This repository has been archived by the owner on Jul 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSequent_calculus_LK.v
283 lines (259 loc) · 9.97 KB
/
Sequent_calculus_LK.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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
Require Import Lang.
Require Import List.
Import List.ListNotations.
Coercion list_to_prop (P : prop) : (list prop) := [P].
(* Reserved Notation "G1 +' G2 ⇒ D1 +'' D2 >< n" (no associativity, at level 61). (* 21d2 *) *)
Reserved Notation "G ⇒ p >< n" (no associativity, at level 61). (* 21d2 *)
Inductive Node : Type :=
|leaf : Node
|onen: Node -> Node
|twon: Node -> Node -> Node.
Notation "☉ M" := (onen M) (no associativity, at level 65).
Notation "M1 ≍ M2" := (twon M1 M2 )(no associativity, at level 66).
Inductive LK : Node -> list prop -> list prop -> Prop :=
(* Axiom : A |- A *)
(*1*)
| LKA: forall p : prop, p ⇒ p >< leaf
(* Structral Rules *)
(* Weakening *)
(*2*)
|LKrW: forall G D (a: prop) n, G ⇒ D >< n-> G ⇒ a :: D >< ☉n
(*3*)
|LKlW: forall G D (a: prop) n, G ⇒ D >< n -> a :: G ⇒ D >< ☉ n
(* Exchange *)
(*4*)
|LKrE: forall G D D' (a b : prop) n, G ⇒ D ++ (a :: b :: D') >< n ->
G ⇒ D ++ (b :: a :: D') >< ☉ n
(*5*)
|LKlE: forall G G' D (a b : prop) n, G ++ (a :: b :: G') ⇒ D >< n ->
G ++ (b :: a :: G') ⇒ D >< ☉ n
(* Contraction *)
(*6*)
|LKrC: forall G D (a : prop) n, G ⇒ a :: a :: D >< n -> G ⇒ a :: D >< ☉ n
(*7*)
|LKlC: forall G D (a : prop) n, a :: a :: G ⇒ D >< n -> a :: G ⇒ D >< ☉ n
(* Logical Rules *)
(* Conjunction *)
(*8*)
|LKrA: forall G D (a b: prop) m n,
G ⇒ a :: D >< m-> G ⇒ b :: D >< n -> G ⇒ (a ∧ b) :: D >< (m ≍ n)
(*9*)
|LKl1A: forall G D (a b : prop) n,
a :: G ⇒ D >< n -> (a ∧ b) :: G ⇒ D >< ☉ n
(*10*)
|LKl2A: forall G D (a b : prop) n,
b :: G ⇒ D >< n -> (a ∧ b) :: G ⇒ D >< ☉ n
(* Disjunction *)
(*11*)
|LKr1O: forall G D (a b : prop) n,
G ⇒ a :: D >< n -> G ⇒ (a ∨ b) :: D >< ☉ n
(*12*)
|LKr2O: forall G D (a b : prop) n,
G ⇒ b :: D >< n -> G ⇒ (a ∨ b) :: D >< ☉ n
(*13*)
|LKlO: forall G D (a b : prop) m n,
a :: G ⇒ D >< m -> b :: G ⇒ D >< n -> (a ∨ b) :: G ⇒ D >< (m ≍ n)
(* Negation *)
(*14*)
|LKrN: forall G D (a : prop) n, a :: G ⇒ D >< n -> G ⇒ (¬ a) :: D >< ☉ n
(*15*)
|LKlN: forall G D (a : prop) n, G ⇒ a :: D >< n -> (¬ a) :: G ⇒ D >< ☉ n
(* Implication *)
(*16*)
|LKrI: forall G D (a b : prop) n, a :: G ⇒ b :: D >< n ->
G ⇒ (a ⊃ b) :: D >< ☉ n
(*17*)
|LKlI: forall G D (a b : prop) m n,
G ⇒ a :: D >< m -> b :: G ⇒ D >< n->
(a ⊃ b) :: G ⇒ D >< (m ≍ n)
where "G ⇒ p >< n" := (LK n G p).
Lemma LKr_app_list: forall G D D' m,
G ⇒ D >< m -> (exists m', G ⇒ D' ++ D >< m').
Proof.
intros. induction D'.
- exists m. simpl. apply H.
- destruct IHD' as [m' H']. exists (☉ m').
rewrite <- app_comm_cons. constructor 2. apply H'.
Qed.
Lemma app_cons: forall {X : Type}(l l' : list X) (a : X),
l ++ a :: l' = l ++ [a] ++ l'.
Proof.
intros. induction l.
- simpl. reflexivity.
- simpl. rewrite IHl. reflexivity.
Qed.
Lemma LKr_partition_mid_atom_r: forall G D D' a m,
G ⇒ D ++ a :: D' >< m -> (exists m', G ⇒ D ++ D' ++ a >< m').
Proof.
intros. generalize dependent D. generalize dependent m. induction D'.
- intros. simpl. exists m. apply H.
- intros. specialize (IHD' (☉ m) (D ++ [a0])) as H'.
apply (LKrE G D D' a a0 m) in H.
rewrite app_cons in H. rewrite app_assoc in H.
apply H' in H as H0. destruct H0 as [m' H0].
rewrite app_assoc in H0. rewrite <- (app_assoc D [a0] D') in H0.
rewrite <- app_cons in H0. rewrite <- app_assoc in H0.
exists m'. apply H0.
Qed.
Lemma LKr_partition_mid_atom_l: forall G D D' a m,
G ⇒ D ++ a :: D' >< m -> (exists m', G ⇒ a :: D ++ D' >< m').
Proof.
intros. generalize dependent D'. generalize dependent m.
induction D using rev_ind.
- intros. exists m. subst. simpl. simpl in H. apply H.
- intros. rewrite <- app_assoc in H. rewrite <- app_cons in H.
apply (LKrE G D D' x a m) in H.
specialize (IHD (☉ m) (x :: D') H) as H'. destruct H' as [m' H'].
exists m'. rewrite <- app_assoc. rewrite <- app_cons. apply H'.
Qed.
Lemma LKr_partition_mid_l: forall G D D' D'' m,
G ⇒ D'' ++ D ++ D' >< m -> (exists m', G ⇒ D ++ D'' ++ D' >< m').
Proof.
intros.
generalize dependent D'.
generalize dependent D''.
induction D.
- intros. simpl. simpl in H. exists m. apply H.
- intros. rewrite app_assoc in H. rewrite app_cons in H.
rewrite app_assoc in H. rewrite <- app_assoc in H.
specialize (IHD (D'' ++ a :: []) D' H) as H'. destruct H' as [m' H'].
rewrite <- app_assoc in H'. rewrite <- app_cons in H'. rewrite app_assoc in H'.
apply (LKr_partition_mid_atom_l) in H'.
destruct H' as [m'' H']. rewrite <- app_assoc in H'.
exists m''.
rewrite <- (app_nil_l (a :: D)). rewrite app_cons. simpl. apply H'.
Qed.
Lemma LKr_partition_mid_r: forall G D D' D'' m,
G ⇒ D'' ++ D ++ D' >< m -> (exists m', G ⇒ D'' ++ D' ++ D >< m').
Proof.
intros.
generalize dependent D'.
generalize dependent D''.
induction D using rev_ind.
- intros. rewrite app_nil_r. simpl in H. exists m. apply H.
- intros. rewrite <- app_assoc in H.
specialize (IHD D'' ([x] ++ D') H) as H'. destruct H' as [m' H'].
rewrite <- app_assoc in H'. apply LKr_partition_mid_atom_r in H'.
destruct H' as [m'' H'].
exists m''. rewrite <- app_assoc in H'. apply H'.
Qed.
Lemma LK_cons_app: forall G D D' m,
G ⇒ D' ++ D >< m -> (exists m', G ⇒ D ++ D' >< m').
Proof.
intros.
rewrite <- app_nil_l in H. apply LKr_partition_mid_r in H. apply H.
Qed.
Lemma LKr_weak_l: forall G D a m,
G ⇒ D >< m -> (exists m', G ⇒ D ++ [a] >< m').
Proof.
intros.
apply (LKrW G D a m) in H.
rewrite <- app_nil_l in H. rewrite app_cons in H.
apply LKr_partition_mid_r in H. destruct H as [m' H]. simpl in H.
exists m'. apply H.
Qed.
Lemma LKl_app_list: forall G G' D m,
G ⇒ D >< m -> (exists m', G' ++ G ⇒ D >< m').
Proof.
intros. induction G'.
- exists m. auto.
- destruct IHG' as [m' H']. exists (☉ m').
rewrite <- app_comm_cons. constructor 3. apply H'.
Qed.
Lemma LKl_partition_mid_atom_r: forall G G' D a m,
G ++ a :: G' ⇒ D >< m -> (exists m', G ++ G' ++ a ⇒ D >< m').
Proof.
intros. generalize dependent G. generalize dependent m. induction G'.
- intros. simpl. exists m. apply H.
- intros. specialize (IHG' (☉ m) (G ++ [a0])) as H'.
apply (LKlE G G' D a a0 m) in H.
rewrite app_cons in H. rewrite app_assoc in H.
apply H' in H as H0. destruct H0 as [m' H0].
rewrite app_assoc in H0. rewrite <- (app_assoc G [a0] G') in H0.
rewrite <- app_cons in H0. rewrite <- app_assoc in H0.
exists m'. apply H0.
Qed.
Lemma LKl_partition_mid_atom_l: forall G G' D a m,
G ++ a :: G' ⇒ D >< m -> (exists m', a :: G ++ G' ⇒ D >< m').
Proof.
intros. generalize dependent G'. generalize dependent m.
induction G using rev_ind.
- intros. exists m. subst. simpl. simpl in H. apply H.
- intros. rewrite <- app_assoc in H. rewrite <- app_cons in H.
apply (LKlE G G' D x a m) in H.
specialize (IHG (☉ m) (x :: G') H) as H'. destruct H' as [m' H'].
exists m'. rewrite <- app_assoc. rewrite <- app_cons. apply H'.
Qed.
Lemma LKl_partition_mid_l: forall G G' G'' D m,
G'' ++ G ++ G' ⇒ D >< m -> (exists m', G ++ G'' ++ G' ⇒ D >< m').
Proof.
intros.
generalize dependent G'.
generalize dependent G''.
induction G.
- intros. simpl. simpl in H. exists m. apply H.
- intros. rewrite app_assoc in H. rewrite app_cons in H.
rewrite app_assoc in H. rewrite <- app_assoc in H.
specialize (IHG (G'' ++ a :: []) G' H) as H'. destruct H' as [m' H'].
rewrite <- app_assoc in H'. rewrite <- app_cons in H'. rewrite app_assoc in H'.
apply (LKl_partition_mid_atom_l) in H'.
destruct H' as [m'' H']. rewrite <- app_assoc in H'.
exists m''.
rewrite <- (app_nil_l (a :: G)). rewrite app_cons. simpl. apply H'.
Qed.
Lemma LKl_partition_mid_r: forall G G' G'' D m,
G'' ++ G ++ G' ⇒ D >< m -> (exists m', G'' ++ G' ++ G ⇒ D >< m').
Proof.
intros.
generalize dependent G'.
generalize dependent G''.
induction G using rev_ind.
- intros. rewrite app_nil_r. simpl in H. exists m. apply H.
- intros. rewrite <- app_assoc in H.
specialize (IHG G'' ([x] ++ G') H) as H'. destruct H' as [m' H'].
rewrite <- app_assoc in H'. apply LKl_partition_mid_atom_r in H'.
destruct H' as [m'' H'].
exists m''. rewrite <- app_assoc in H'. apply H'.
Qed.
Lemma LKl_cons_app: forall G G' D m,
G' ++ G ⇒ D >< m -> (exists m', G ++ G' ⇒ D >< m').
Proof.
intros.
rewrite <- (app_nil_l (G' ++ G)) in H. apply LKl_partition_mid_r in H. apply H.
Qed.
Lemma LKl_weak_l: forall G D a m,
G ⇒ D >< m -> (exists m', G ++ [a]⇒ D >< m').
Proof.
intros.
apply (LKlW G D a m) in H.
rewrite <- (app_nil_l (a::G)) in H. rewrite app_cons in H.
apply LKl_partition_mid_r in H. destruct H as [m' H]. simpl in H.
exists m'. apply H.
Qed.
Lemma mp : forall p q : prop, exists n, (p ⊃ q)::p ⇒ q >< n.
Proof.
intros p q.
(* (☉ ☉ leaf) ≍ (☉ ☉ leaf) *)
exists ((☉ ☉ leaf) ≍ (☉ ☉ leaf)).
(* apply (LKlE [] [] q p (p ⊃ q)). simpl.
apply (LKlE [] [] q p ) *)
apply (LKlI p q p q (onen (onen leaf)) (onen (onen leaf))).
- apply (LKrE p [] [] q p (onen leaf)). simpl. apply (LKrW p p q leaf). apply (LKA p).
- apply (LKlE [] [] q p q (onen leaf)). simpl. apply (LKlW q q p leaf). apply (LKA q).
Qed.
Lemma cut : forall (G G' D D' : list prop) (a : prop) m n,
G ⇒ a :: D >< m -> G' ++ a ⇒ D' >< n -> exists r, G ++ G' ⇒ D ++ D' >< r.
Admitted.
(* Lemma deduction_r : forall (p q : prop) (n : Node), exists (m : Node),p ⇒ q >< n -> [] ⇒ p ⊃ q >< m.
Proof.
intros.
exists (onen n).
intros.
apply (LKrI [] [] p q n).
apply H.
Qed.
Lemma deduction_l : forall (p q : prop), (exists (n : Node), [] ⇒ p ⊃ q >< n) -> exists (m : Node), p ⇒ q >< m .
intros. destruct H as [n H]. specialize (mp p q) as H'. destruct H' as [m H']. apply (cut [] [p] [] [q] (p ⊃ q) n (onen m)).
+ apply H.
+ apply (LKlE [] [] q (p ⊃ q) p m). simpl. apply H'.
Qed. *)