Skip to content

Instantly share code, notes, and snippets.

@pa4373
Created October 29, 2014 12:40
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 pa4373/0cc7ea9e86c2cda07e7b to your computer and use it in GitHub Desktop.
Save pa4373/0cc7ea9e86c2cda07e7b to your computer and use it in GitHub Desktop.
Some algebra proof about Group using Coq.
Section Group.
Variable G : Set.
Variable op : G -> G -> G.
Infix "o" := op (at level 35, right associativity).
Axiom assoc : forall a b c : G, a o (b o c) = (a o b) o c.
Variable e : G.
Axiom unit_l : forall a : G, e o a = a.
Axiom unit_r : forall a : G, a o e = a.
Axiom inv_l : forall a : G, exists b : G, b o a = e.
Axiom inv_r : forall a : G, exists b : G, a o b = e.
Goal forall a b c : G, a o b = a o c -> b = c.
Proof.
intros.
rewrite <- unit_l with b.
rewrite <- unit_l with c.
elim (inv_l a).
intros.
rewrite <- H0.
rewrite <- assoc.
rewrite <- assoc.
rewrite <- H.
reflexivity.
Qed.
Goal forall a b c : G, (a o b = e) /\ (b o a = e) /\ (a o c = e) /\ (c o a = e) -> b = c.
Proof.
intros.
rewrite <- unit_l with b.
decompose [and] H.
rewrite <- H4.
rewrite <- assoc.
rewrite H0.
rewrite unit_r.
reflexivity.
Qed.
End Group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment