-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathBinaryGroup.v
67 lines (57 loc) · 1.52 KB
/
BinaryGroup.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
57
58
59
60
61
62
63
64
65
66
67
Inductive bin : Type :=
| Zero : bin
| One : bin.
Definition add ( x : bin ) ( y : bin ) :=
match x, y with
| Zero , _ => y
| _ , Zero => x
| One, One => Zero
end.
Definition sub ( x : bin ) ( y : bin ) := add.
Theorem Closure : forall ( a b : bin ) , exists ( c : bin ) ,
c = add a b.
Proof.
intros a b. exists ( add a b).
reflexivity.
Qed.
Theorem Associativity: forall ( a b c : bin ) ,
add a ( add b c ) = add ( add a b ) c.
Proof.
intros a b c. destruct a. simpl. reflexivity.
destruct b. unfold add. reflexivity.
destruct c. simpl. reflexivity. simpl. reflexivity.
Qed.
Theorem Identity_left : forall ( a : bin ) , exists ( e : bin ),
add e a = a.
Proof.
intros a. exists Zero. reflexivity.
Qed.
Theorem Identity_right : forall ( a : bin ) , exists ( e : bin ),
add a e = a.
Proof.
intros a. exists Zero. destruct a. reflexivity.
reflexivity.
Qed.
Theorem Inverse_left : forall ( a : bin ) , exists ( b : bin ),
add a b = Zero.
Proof.
intros a. destruct a. exists Zero. reflexivity.
exists One. reflexivity.
Qed.
Theorem Inverse_righ : forall ( a : bin ), exists ( b : bin ) ,
add b a = Zero.
Proof.
intros a. destruct a. exists Zero. reflexivity.
exists One. reflexivity.
Qed.
Theorem Abelian_group : forall ( a b : bin ),
add a b = add b a.
Proof.
intros a b. destruct a.
assert ( H1 : add Zero b = add b Zero ).
destruct b. reflexivity. reflexivity.
apply H1.
assert ( H2 : add One b = add b One ).
destruct b. reflexivity. reflexivity.
apply H2.
Qed.