Skip to content

Instantly share code, notes, and snippets.

@Blaisorblade
Created April 2, 2020 11:14
Show Gist options
  • Save Blaisorblade/990d4ef7418bcbbc0f329dedee5c7b93 to your computer and use it in GitHub Desktop.
Save Blaisorblade/990d4ef7418bcbbc0f329dedee5c7b93 to your computer and use it in GitHub Desktop.
From mathcomp Require Import ssreflect ssrnat eqtype ssrbool ssrnum ssralg.
Require Import Ring.
Import GRing.Theory.
Open Scope ring_scope.
Section foo.
(* Variant of the same problem. *)
(* Variable R: numFieldType. *)
Variable R: comRingType.
Locate "+".
Lemma check_defeq: GRing.Zmodule.sort R = GRing.ComRing.sort R. done. Qed.
Locate "+%R".
Check +%R.
(* Definition addT : R -> R -> R := +%R.
Local Infix "+" := addT. *)
Definition rt :
(* @ring_theory (GRing.ComRing.sort R) 0%:R 1%:R addT *%R (fun a b => a - b) -%R eq. *)
@ring_theory (GRing.Zmodule.sort R) 0%:R 1%:R +%R *%R (fun a b => a - b) -%R eq.
(* Doesn't work.*)
(* @ring_theory R 0%:R 1%:R +%R *%R (fun a b => a - b) -%R eq. *)
(* Works. *)
(* @ring_theory R 0%:R 1%:R addT *%R (fun a b => a - b) -%R eq. *)
Proof.
apply mk_rt.
- apply add0r.
- apply addrC.
- apply addrA.
- apply mul1r.
- apply mulrC.
- apply mulrA.
- apply mulrDl.
- by [].
- apply subrr.
Qed.
Add Ring Ringgg : rt.
Lemma tmp2:
forall x y: R, eq (x + y) (y + x).
Proof. move => x y. ring. Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment