forked from math-comp/hierarchy-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhierarchy_0.v
56 lines (45 loc) · 1.45 KB
/
hierarchy_0.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From Coq Require Import ssreflect ssrfun.
From HB Require Import structures.
(**************************************************************************)
(* Stage 0: +Ring+ *)
(**************************************************************************)
HB.mixin Record Ring_of_TYPE A := {
zero : A;
one : A;
add : A -> A -> A;
opp : A -> A;
mul : A -> A -> A;
addrA : associative add;
addrC : commutative add;
add0r : left_id zero add;
addNr : left_inverse zero opp add;
mulrA : associative mul;
mul1r : left_id one mul;
mulr1 : right_id one mul;
mulrDl : left_distributive mul add;
mulrDr : right_distributive mul add;
}.
HB.structure Definition Ring := { A of Ring_of_TYPE A }.
(* Notations *)
Declare Scope hb_scope.
Delimit Scope hb_scope with G.
Local Open Scope hb_scope.
Notation "0" := zero : hb_scope.
Notation "1" := one : hb_scope.
Infix "+" := (@add _) : hb_scope.
Notation "- x" := (@opp _ x) : hb_scope.
Infix "*" := (@mul _) : hb_scope.
Notation "x - y" := (x + - y) : hb_scope.
(* Theory *)
Section Theory.
Variable R : Ring.type.
Implicit Type (x : R).
Lemma addr0 : right_id (@zero R) add.
Proof. by move=> x; rewrite addrC add0r. Qed.
Lemma addrN : right_inverse (@zero R) opp add.
Proof. by move=> x; rewrite addrC addNr. Qed.
Lemma subrr x : x - x = 0.
Proof. by rewrite addrN. Qed.
Lemma addrNK x y : x + y - y = x.
Proof. by rewrite -addrA subrr addr0. Qed.
End Theory.