Skip to content

Instantly share code, notes, and snippets.

@Blaisorblade
Forked from vlj/ring3.v
Last active April 1, 2020 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blaisorblade/cc2825d413b38782c3ee4bbd7c2857e0 to your computer and use it in GitHub Desktop.
Save Blaisorblade/cc2825d413b38782c3ee4bbd7c2857e0 to your computer and use it in GitHub Desktop.
rom mathcomp Require Import ssreflect ssrnat eqtype ssrbool ssrnum ssralg.
Require Import Ring.
Import GRing.Theory.
Open Scope ring_scope.
Section foo.
Variable R: numFieldType.
Definition T:= R.
Definition subT : T -> T -> T := fun x y => (x - y)%R.
Local Notation "x - y":= (subT x y).
Definition oppT : T -> T :=
fun x => (-x)%R.
Local Notation "- x":= (oppT x).
Definition addT : T -> T -> T := +%R.
Local Infix "+" := addT.
Definition rt :
(* Doesn't work.*)
(* @ring_theory T 0%:R 1%:R +%R *%R (fun a b => a - b) -%R eq. *)
(* Works. *)
(* @ring_theory T 0%:R 1%:R addT *%R (fun a b => a - b) -%R eq. *)
(* Also works. *)
@ring_theory T 0%:R 1%R addT *%R subT oppT eq.
(* Admitted. *) (* Also enough! *)
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:T, x + y = y + x.
Proof. move => x y. ring. Qed.
End foo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment