-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathseminar04.v
More file actions
228 lines (152 loc) · 3.11 KB
/
seminar04.v
File metadata and controls
228 lines (152 loc) · 3.11 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat div.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
(* SSReflect tactic practice *)
Section IntLogic.
Variables A B C : Prop.
(** * Exercise *)
Lemma andA :
(A /\ B) /\ C -> A /\ (B /\ C).
Proof.
case.
case.
move=> a b c.
split.
- exact: a.
split.
- exact: b.
exact: c.
Restart. Show.
by case=> [[a b] c].
Show Proof.
Qed.
Lemma andA' :
(A /\ B) /\ C -> A /\ (B /\ C).
Proof.
by case=> [[a b] c].
Defined.
About andA.
Compute andA.
About andA'.
Compute andA'.
(** * Exercise *)
Lemma conj_disjD :
A /\ (B \/ C) -> (A /\ B) \/ (A /\ C).
Proof.
Admitted.
(** * Exercise *)
Lemma disj_conjD :
A \/ (B /\ C) -> (A \/ B) /\ (A \/ C).
Proof.
Admitted.
(** * Exercise *)
Lemma notTrue_iff_False :
(~ True) <-> False.
Proof.
Admitted.
(** Hint 1: use [case] tactic on a proof of [False] to apply the explosion
principle. *)
(** Hint 2: to solve the goal of the form [True], use [exact: I], or simple
automation. *)
(** * Exercise *)
Lemma imp_trans :
(A -> B) -> (B -> C) -> (A -> C).
Proof.
move=> ab bc a.
move: bc.
apply.
move: ab.
apply.
exact: a.
Restart. Show.
by move=> ab bc /ab.
Qed.
(** * Exercise *)
Lemma dne_False :
~ ~ False -> False.
Proof.
Admitted.
(** * Exercise *)
Lemma dne_True :
~ ~ True -> True.
Proof.
Admitted.
(** * Exercise *)
Lemma LEMisNotFalse :
~ ~ (A \/ ~ A).
Proof.
Admitted.
(** Hint : use `apply: (identifier)`
to apply a hypothesis from the context to
the goal and keep the hypothesis in the context *)
(** * Exercise *)
Lemma weak_Peirce :
((((A -> B) -> A) -> A) -> B) -> B.
Proof.
Admitted.
End IntLogic.
Section EquationalReasoning.
Variables A B : Type.
(** * Exercise 10 *)
Lemma eqext_refl (f : A -> B) :
f =1 f.
Proof.
Admitted.
(** * Exercise 11 *)
Lemma eqext_sym (f g : A -> B) :
f =1 g -> g =1 f.
Proof.
Admitted.
(** Hint: `rewrite` tactic also works with
universally quantified equalities. I.e. if you
have a hypothesis `eq` of type `forall x, f x = g
x`, you can use `rewrite eq` and Coq will usually
figure out the concrete `x` it needs to specialize
`eq` with, meaning that `rewrite eq` is
essentially `rewrite (eq t)` here. *)
(** * Exercise *)
Lemma eqext_trans (f g h : A -> B) :
f =1 g -> g =1 h -> f =1 h.
Proof.
Admitted.
End EquationalReasoning.
(** * Exercise *)
Lemma and_via_ex (A B : Prop) :
(exists (_ : A), B) <-> A /\ B.
Proof.
Admitted.
(** * Exercise *)
(* Hint: the `case` tactic understands constructors are injective *)
Lemma pair_inj A B (a1 a2 : A) (b1 b2 : B) :
(a1, b1) = (a2, b2) -> (a1 = a2) /\ (b1 = b2).
Proof.
Admitted.
(** * Exercise *)
Lemma false_eq_true_implies_False :
forall n, n.+1 = 0 -> False.
Proof.
Admitted.
(** * Exercise *)
Lemma addn0 :
right_id 0 addn.
Proof.
Admitted.
(** * Exercise *)
Lemma addnS :
forall m n, m + n.+1 = (m + n).+1.
Proof.
Admitted.
(** * Exercise: *)
Lemma addnCA : left_commutative addn.
Proof.
Admitted.
(** * Exercise: *)
Lemma addnC : commutative addn.
Proof.
Admitted.
(** * Exercise (optional): *)
Lemma unit_neq_bool:
unit <> bool.
Proof.
Admitted.