Skip to content

Commit 11912a4

Browse files
committed
cleanup
1 parent 62896fb commit 11912a4

File tree

1 file changed

+72
-72
lines changed

1 file changed

+72
-72
lines changed

HOL/IntuitionisticProofScript.sml

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
(* ========================================================================== *)
33
(* Equivalence of Sequent Calculus and Natural Deduction *)
44
(* Working from Troelstra and Schwichtenburg - Basic Proof Theory 2nd Edition *)
5-
(* *)
5+
(* Written by Alexander Cox, ANU, u6060697@anu.edu.au *)
6+
(* Supervised by Michael Norrish, ANU; Data61 *)
67
(* ========================================================================== *)
78

89
open HolKernel boolLib Parse bossLib;
@@ -13,50 +14,50 @@ open FormulaSyntaxTheory;
1314

1415
val _ = new_theory "IntuitionisticProof";
1516

16-
(** Natural Deduction for intuitionistic logic **)
17-
(* N is the 'deduciblility' relation for this system *)
18-
(* A, B and C are used to represent formulae *)
17+
(* Natural Deduction for intuitionistic logic *)
18+
(* N is the 'deduciblility' relation for this system *)
19+
(* A, B and C are used to represent formulae *)
1920
(* D, D1, D2, D3 are used to represent the set of open assumptions *)
20-
(* I'm representing the deductions simply with unlabeled sets of
21-
open assumptions, as in T&S 2.1.8-2.1.9 (p.41--44) *)
21+
(* I'm representing the deductions simply with unlabeled sets of *)
22+
(* open assumptions, as in T&S 2.1.8-2.1.9 (p.41--44) *)
2223

2324
val (N_rules, N_ind, N_cases) = Hol_reln `
24-
(! (A :'a formula). N {A} A) (* Base case *)
25-
/\ (!A B D1 D2. (N D1 A) /\ (N D2 B)
25+
(∀ (A :'a formula). N {A} A) (* Base case *)
26+
∧ (∀A B D1 D2. (N D1 A) (N D2 B)
2627
==> (N (D1 UNION D2) (A And B))) (* And Intro *)
27-
/\ (!A B D. (N D (A And B)) ==> N D A) (* And Elimination Left Conjunct *)
28-
/\ (!A B D. (N D (A And B)) ==> N D B) (* And Elim Right Conjunct *)
29-
/\ (!A B D. (N (A INSERT D) B) ==> N D (A Imp B)) (* Imp Intro *)
30-
/\ (!A B D1 D2. (N D1 (A Imp B)) /\ (N D2 A)
28+
∧ (∀A B D. (N D (A And B)) ==> N D A) (* And Elimination Left Conjunct *)
29+
∧ (∀A B D. (N D (A And B)) ==> N D B) (* And Elim Right Conjunct *)
30+
∧ (∀A B D. (N (A INSERT D) B) ==> N D (A Imp B)) (* Imp Intro *)
31+
∧ (∀A B D1 D2. (N D1 (A Imp B)) (N D2 A)
3132
==> N (D1 UNION D2) B) (* Imp Elim *)
32-
/\ (!A B D. N D A ==> N D (A Or B)) (* Or Intro right *)
33-
/\ (!A B D. N D B ==> N D (A Or B)) (* Or Intro left *)
34-
/\ (!A B C D D1 D2. (N D (A Or B)) /\ (* Or Elim *)
35-
(N (A INSERT D1) C) /\ (N (B INSERT D2) C) ==> N (D ∪ D1 ∪ D2) C)
36-
/\ (!A D. (N D Bot) ==> (N D A))`; (* Intuitionistic Absurdity Rule *)
33+
∧ (∀A B D. N D A ==> N D (A Or B)) (* Or Intro right *)
34+
∧ (∀A B D. N D B ==> N D (A Or B)) (* Or Intro left *)
35+
∧ (∀A B C D D1 D2. (N D (A Or B)) (* Or Elim *)
36+
(N (A INSERT D1) C) (N (B INSERT D2) C) ==> N (D ∪ D1 ∪ D2) C)
37+
∧ (∀A D. (N D Bot) ==> (N D A))`; (* Intuitionistic Absurdity Rule *)
3738

3839
val [N_ax, N_andi, N_andel, N_ander,
3940
N_impi, N_impe, N_orir, N_oril, N_ore, N_bot] = CONJUNCTS N_rules;
4041

4142
Theorem N_FINITE:
42-
!D A. N D A ==> FINITE D
43+
D A. N D A ==> FINITE D
4344
Proof Induct_on `N` >> rw[]
4445
QED
4546

4647
val (Nd_rules, Nd_ind, Nd_cases) = Hol_reln `
47-
(! (A :'a formula). Nd {A} A) (* Base case *)
48-
/\ (!A B D1 D2. (Nd D1 A) /\ (Nd D2 B)
48+
(∀ (A :'a formula). Nd {A} A) (* Base case *)
49+
∧ (∀A B D1 D2. (Nd D1 A) (Nd D2 B)
4950
==> (Nd (D1 UNION D2) (A And B))) (* And Intro *)
50-
/\ (!A B D. (Nd D (A And B)) ==> Nd D A) (* And Elimination Left Conjunct *)
51-
/\ (!A B D. (Nd D (A And B)) ==> Nd D B) (* And Elim Right Conjunct *)
52-
/\ (!A B D. (Nd D B) ==> Nd (D DELETE A) (A Imp B)) (* Imp Intro *)
53-
/\ (!A B D1 D2. (Nd D1 (A Imp B)) /\ (Nd D2 A)
51+
∧ (∀A B D. (Nd D (A And B)) ==> Nd D A) (* And Elimination Left Conjunct *)
52+
∧ (∀A B D. (Nd D (A And B)) ==> Nd D B) (* And Elim Right Conjunct *)
53+
∧ (∀A B D. (Nd D B) ==> Nd (D DELETE A) (A Imp B)) (* Imp Intro *)
54+
∧ (∀A B D1 D2. (Nd D1 (A Imp B)) (Nd D2 A)
5455
==> Nd (D1 UNION D2) B) (* Imp Elim *)
55-
/\ (!A B D. Nd D A ==> Nd D (A Or B)) (* Or Intro right *)
56-
/\ (!A B D. Nd D B ==> Nd D (A Or B)) (* Or Intro left *)
57-
/\ (!A B C D D1 D2. (Nd D (A Or B)) /\ (Nd D1 C) /\ (Nd D2 C)
56+
∧ (∀A B D. Nd D A ==> Nd D (A Or B)) (* Or Intro right *)
57+
∧ (∀A B D. Nd D B ==> Nd D (A Or B)) (* Or Intro left *)
58+
∧ (∀A B C D D1 D2. (Nd D (A Or B)) (Nd D1 C) (Nd D2 C)
5859
==> Nd (D ∪ (D1 DELETE A) ∪ (D2 DELETE B)) C) (* Or Elim *)
59-
/\ (!A D. (Nd D Bot) ==> (Nd D A))`; (* Intuitionistic Absurdity Rule *)
60+
∧ (∀A D. (Nd D Bot) ==> (Nd D A))`; (* Intuitionistic Absurdity Rule *)
6061

6162
val [Nd_ax, Nd_andi, Nd_andel, Nd_ander,
6263
Nd_impi, Nd_impe, Nd_orir, Nd_oril, Nd_ore, Nd_bot] = CONJUNCTS Nd_rules;
@@ -82,7 +83,7 @@ Proof
8283
QED
8384

8485
Theorem N_lw_SUBSET:
85-
∀D'. FINITE D' ==> ∀D A. N D A /\ D ⊆ D' ==> N D' A
86+
∀D'. FINITE D' ==> ∀D A. N D A D ⊆ D' ==> N D' A
8687
Proof
8788
GEN_TAC >>
8889
Induct_on `CARD D'`
@@ -91,8 +92,8 @@ Proof
9192
>- (rw[] >>
9293
Cases_on `D=D'`
9394
>- metis_tac[]
94-
>- (`?D₀ e. (D' = e INSERT D₀) /\ D ⊆ D₀ /\ e NOTIN D₀`
95-
by (`?e. e ∈ D' /\ e NOTIN D`
95+
>- (`D₀ e. (D' = e INSERT D₀) D ⊆ D₀ e NOTIN D₀`
96+
by (`e. e ∈ D' e NOTIN D`
9697
by metis_tac[PSUBSET_DEF,PSUBSET_MEMBER] >>
9798
qexists_tac `D' DELETE e` >>
9899
qexists_tac `e` >>
@@ -104,14 +105,14 @@ Proof
104105
QED
105106

106107
Theorem Nd_lw_SUBSET:
107-
∀D'. FINITE D' ==> ∀D A. Nd D A /\ D ⊆ D' ==> Nd D' A
108+
∀D'. FINITE D' ==> ∀D A. Nd D A D ⊆ D' ==> Nd D' A
108109
Proof
109110
GEN_TAC >>
110111
Induct_on `CARD D'`
111112
>- (rw[] >> metis_tac[CARD_EQ_0,SUBSET_EMPTY])
112113
>- (rw[] >> Cases_on `D=D'` >- metis_tac[] >>
113-
`?D₀ e. (D' = e INSERT D₀) /\ D ⊆ D₀ /\ e NOTIN D₀`
114-
by (`?e. e ∈ D' /\ e NOTIN D`
114+
`D₀ e. (D' = e INSERT D₀) D ⊆ D₀ e NOTIN D₀`
115+
by (`e. e ∈ D' e NOTIN D`
115116
by metis_tac[PSUBSET_DEF,PSUBSET_MEMBER] >>
116117
qexists_tac `D' DELETE e` >>
117118
qexists_tac `e` >>
@@ -128,7 +129,7 @@ Proof
128129
rw[] >>
129130
`N (B INSERT D) A` by metis_tac[N_lw] >>
130131
Cases_on `B ∈ D`
131-
>- (`?D'. (D = B INSERT D') /\ B NOTIN D'`
132+
>- (`D'. (D = B INSERT D') B NOTIN D'`
132133
by metis_tac[DECOMPOSITION] >>
133134
fs[] >>
134135
`(B INSERT D') DELETE B = D'`
@@ -204,35 +205,35 @@ val N_example = Q.prove(`NThm (Bot Imp A)`,
204205
rw[NThm]);
205206

206207

207-
(** Sequent Calculus (Gentzen System) for intuitionistic logic **)
208-
(* G is the 'deduciblility' relation for this system *)
209-
(* A, B and C are used to represent formulae *)
210-
(* S is used to represent the multiset of the Antecedent Context *)
211-
(* The consequent is always a single formula in the intuitionistic logic *)
208+
(* Sequent Calculus (Gentzen System) for intuitionistic logic *)
209+
(* G is the 'deduciblility' relation for this system *)
210+
(* A, B and C are used to represent formulae *)
211+
(* Γ is used to represent the multiset of the antecedents *)
212+
(* The consequent is always a single formula in intuitionistic logic *)
212213

213214
val (G_rules, G_ind, G_cases) = Hol_reln `
214-
(!(A:'a formula) Γ. (A <: Γ) /\ FINITE_BAG Γ ==> G Γ A) (* Ax *)
215-
/\ (∀ A Γ. (Bot <: Γ) /\ FINITE_BAG Γ ==> G Γ A) (* LBot *)
216-
/\ (!A Γ C. (G ({|A;A|} + Γ) C)
217-
==> G ({|A|} + Γ) C) (* Left Contraction *)
218-
/\ (!A B Γ C. (G (BAG_INSERT A Γ) C)
215+
(∀(A:'a formula) Γ. (A <: Γ) FINITE_BAG Γ ==> G Γ A) (* Ax *)
216+
(∀ A Γ. (Bot <: Γ) FINITE_BAG Γ ==> G Γ A) (* LBot *)
217+
∧ (∀A Γ C. (G ({|A;A|} Γ) C)
218+
==> G ({|A|} Γ) C) (* Left Contraction *)
219+
∧ (∀A B Γ C. (G (BAG_INSERT A Γ) C)
219220
==> (G (BAG_INSERT (A And B) Γ) C)) (* Left And 1 *)
220-
/\ (!A B Γ C. (G (BAG_INSERT B Γ) C)
221+
∧ (∀A B Γ C. (G (BAG_INSERT B Γ) C)
221222
==> (G (BAG_INSERT (A And B) Γ) C)) (* Left And 2 *)
222-
/\ (!A B Γ. (G Γ A) /\ (G Γ B)
223+
∧ (∀A B Γ. (G Γ A) (G Γ B)
223224
==> (G Γ (A And B))) (* Right And *)
224-
/\ (!A B Γ C. (G (BAG_INSERT A Γ) C)
225-
/\ (G (BAG_INSERT B Γ) C)
225+
∧ (∀A B Γ C. (G (BAG_INSERT A Γ) C)
226+
(G (BAG_INSERT B Γ) C)
226227
==> (G (BAG_INSERT (A Or B) Γ) C)) (* Left Or *)
227-
/\ (!A B Γ. (G Γ A)
228+
∧ (∀A B Γ. (G Γ A)
228229
==> (G Γ (A Or B))) (* Right Or 1 *)
229-
/\ (!A B Γ. (G Γ B)
230+
∧ (∀A B Γ. (G Γ B)
230231
==> (G Γ (A Or B))) (* Right Or 2 *)
231-
/\ (!A B Γ C. (G Γ A) /\ (G (BAG_INSERT B Γ) C)
232+
∧ (∀A B Γ C. (G Γ A) (G (BAG_INSERT B Γ) C)
232233
==> (G (BAG_INSERT (A Imp B) Γ) C)) (* Left Imp *)
233-
/\ (!A B Γ. (G (BAG_INSERT A Γ) B)
234+
∧ (∀A B Γ. (G (BAG_INSERT A Γ) B)
234235
==> (G Γ (A Imp B))) (* Right Imp *)
235-
(∀A B Γ Δ. (G Γ A) ∧ (G (BAG_INSERT A Δ) B) ==> G (Γ + Δ) B)` (* Cut *)
236+
∧ (∀A B Γ Δ. (G Γ A) ∧ (G (BAG_INSERT A Δ) B) ==> G (Γ Δ) B)` (* Cut *)
236237

237238
val [G_ax, G_bot, G_lc, G_landl, G_landr, G_rand,
238239
G_lor, G_rorl, G_rorr, G_limp, G_rimp, G_cut] = CONJUNCTS G_rules;
@@ -254,24 +255,24 @@ rw[GThm] >>
254255
`G {|(A Imp A Imp B);A|} (B)` suffices_by metis_tac[BAG_INSERT_commutes] >>
255256
metis_tac[G_rules]);
256257

257-
val G_land_commutes =
258-
Q.prove(`G {| A And B |} Δ ==> G {| B And A |} Δ`, rw[] >>
258+
val G_land_commutes = Q.prove(`G {| A And B |} Δ ==> G {| B And A |} Δ`,
259+
rw[] >>
259260
`G {|B|} B` by metis_tac[G_ax,BAG_IN_BAG_INSERT,FINITE_BAG] >>
260261
`G {|B And A|} B` by metis_tac[G_landl] >>
261262
`G {|A|} A` by metis_tac[G_ax,BAG_IN_BAG_INSERT,FINITE_BAG] >>
262263
`G {|B And A|} A` by metis_tac[G_landr] >>
263264
`G {|B And A|} (A And B)` by metis_tac[G_rand] >>
264-
`G ({|B And A|} + {||}) Δ` by metis_tac[G_cut] >>
265+
`G ({|B And A|} {||}) Δ` by metis_tac[G_cut] >>
265266
metis_tac[BAG_UNION_EMPTY]);
266267

267268
Theorem G_FINITE:
268-
!Γ A. G Γ A ==> FINITE_BAG Γ
269+
Γ A. G Γ A ==> FINITE_BAG Γ
269270
Proof Induct_on `G` >> rw[]
270271
QED
271272

272-
(* Thanks for this theorem Michael *)
273+
(* Thanks for your help with this theorem Michael *)
273274
Theorem G_lw:
274-
∀Γ A. G Γ A ⇒ ∀Γ'. Γ ≤ Γ' /\ FINITE_BAG Γ' ⇒ G Γ' A
275+
∀Γ A. G Γ A ⇒ ∀Γ'. Γ ≤ Γ' FINITE_BAG Γ' ⇒ G Γ' A
275276
Proof
276277
Induct_on `G` >> rw[]
277278
>- (irule G_ax >> fs[SUB_BAG, BAG_IN])
@@ -310,7 +311,7 @@ Proof
310311
QED
311312

312313
Theorem G_lw_BAG_MERGE:
313-
!Γ A. G Γ A ==> !Γ'. FINITE_BAG Γ' ==> G (BAG_MERGE Γ' Γ) A
314+
Γ A. G Γ A ==> Γ'. FINITE_BAG Γ' ==> G (BAG_MERGE Γ' Γ) A
314315
Proof
315316
rw[] >>
316317
irule G_lw >>
@@ -394,14 +395,14 @@ Proof
394395
simp[BAG_OF_SET_UNION] >>
395396
metis_tac[G_lw_BAG_MERGE,G_FINITE])
396397
>- (simp[BAG_OF_SET_UNION] >>
397-
metis_tac[G_lw_BAG_MERGE,G_FINITE]))
398+
metis_tac[G_lw_BAG_MERGE,G_FINITE]))
398399
>- (`G {|A|} A` by metis_tac[G_ax,BAG_IN_BAG_INSERT,FINITE_BAG] >>
399400
`G {|A And B|} A` by metis_tac[G_landl] >>
400-
`G ((BAG_OF_SET D) + {||}) A` by metis_tac[G_cut] >>
401+
`G ((BAG_OF_SET D) {||}) A` by metis_tac[G_cut] >>
401402
metis_tac[BAG_UNION_EMPTY])
402403
>- (`G {|A'|} A'` by metis_tac[G_ax,BAG_IN_BAG_INSERT,FINITE_BAG] >>
403404
`G {|A And A'|} A'` by metis_tac[G_landr] >>
404-
`G ((BAG_OF_SET D) + {||}) A'` by metis_tac[G_cut] >>
405+
`G ((BAG_OF_SET D) {||}) A'` by metis_tac[G_cut] >>
405406
metis_tac[BAG_UNION_EMPTY])
406407
>- (irule G_rimp >>
407408
fs[BAG_OF_SET_INSERT] >>
@@ -442,7 +443,7 @@ Proof
442443
fs[]) >>
443444
`FINITE_BAG (BAG_INSERT B Δ)`
444445
by (simp[Abbr`Δ`,FINITE_BAG_THM] >>
445-
metis_tac[FINITE_BAG_OF_SET,N_FINITE,FINITE_INSERT]) >>
446+
metis_tac[FINITE_BAG_OF_SET,N_FINITE,FINITE_INSERT]) >>
446447
`G (BAG_INSERT B Δ) C`
447448
by (`G (BAG_MERGE {|B|} Δ) C`
448449
suffices_by metis_tac[BAG_MERGE_ELBAG_SUB_BAG_INSERT,G_lw] >>
@@ -477,16 +478,16 @@ Theorem G_N:
477478
∀Γ A. G Γ A ==> N (SET_OF_BAG Γ) A
478479
Proof
479480
Induct_on `G` >> rw[N_rules]
480-
>- (`?b. Γ = BAG_INSERT A b` by metis_tac[BAG_DECOMPOSE] >>
481-
fs[] >>
481+
>- (`b. Γ = BAG_INSERT A b` by metis_tac[BAG_DECOMPOSE] >>
482+
fs[] >>
482483
simp[SET_OF_BAG_INSERT, Once INSERT_SING_UNION] >>
483484
`N {A} A` by metis_tac[N_ax] >>
484485
simp[UNION_COMM] >>
485486
irule N_lw_SUBSET >>
486487
conj_tac >- metis_tac[FINITE_UNION,FINITE_SET_OF_BAG,FINITE_DEF] >>
487488
metis_tac[SUBSET_UNION])
488-
>- (`?b. Γ = BAG_INSERT Bot b` by metis_tac[BAG_DECOMPOSE] >>
489-
fs[] >>
489+
>- (`b. Γ = BAG_INSERT Bot b` by metis_tac[BAG_DECOMPOSE] >>
490+
fs[] >>
490491
simp[SET_OF_BAG_INSERT, Once INSERT_SING_UNION] >>
491492
`N {Bot} Bot` by metis_tac[N_ax] >>
492493
`N {Bot} A` by metis_tac[N_bot] >>
@@ -503,7 +504,7 @@ Proof
503504
fs[DELETE_DEF] >>
504505
`N (((SET_OF_BAG Γ) DIFF {A}) ∪ {A And B}) C` by metis_tac[N_impe] >>
505506
`N ((A And B) INSERT ((SET_OF_BAG Γ) DIFF {A})) C`
506-
by metis_tac[UNION_COMM,INSERT_SING_UNION] >>
507+
by metis_tac[UNION_COMM,INSERT_SING_UNION] >>
507508
irule N_lw_SUBSET >>
508509
conj_tac >- metis_tac[N_FINITE,FINITE_INSERT] >>
509510
qexists_tac `(A And B) INSERT SET_OF_BAG Γ DIFF {A}` >>
@@ -515,7 +516,7 @@ Proof
515516
`N (B INSERT Γ') C` by metis_tac[N_lw] >>
516517
`N (Γ' DELETE B) (B Imp C)`
517518
by (Cases_on `B ∈ Γ'`
518-
>- (`?Γ0. (Γ' = B INSERT Γ0) /\ B NOTIN Γ0`
519+
>- (`Γ0. (Γ' = B INSERT Γ0) B NOTIN Γ0`
519520
by metis_tac[DECOMPOSITION] >>
520521
fs[] >>
521522
`(B INSERT Γ0) DELETE B = Γ0`
@@ -613,5 +614,4 @@ Proof
613614
metis_tac[G_unibag]
614615
QED
615616

616-
617617
val _ = export_theory()

0 commit comments

Comments
 (0)