author | wenzelm |
Thu, 17 Aug 2023 16:15:25 +0200 | |
changeset 78534 | 879e1ba3868b |
parent 76219 | cf7db6353322 |
permissions | -rw-r--r-- |
12560 | 1 |
(* Title: ZF/Induct/PropLog.thy |
76219 | 2 |
Author: Tobias Nipkow & Lawrence C Paulson |
12088 | 3 |
Copyright 1993 University of Cambridge |
12610 | 4 |
*) |
12560 | 5 |
|
60770 | 6 |
section \<open>Meta-theory of propositional logic\<close> |
12088 | 7 |
|
65449
c82e63b11b8b
clarified main ZF.thy / ZFC.thy, and avoid name clash with global HOL/Main.thy;
wenzelm
parents:
61798
diff
changeset
|
8 |
theory PropLog imports ZF begin |
12088 | 9 |
|
60770 | 10 |
text \<open> |
12610 | 11 |
Datatype definition of propositional logic formulae and inductive |
12 |
definition of the propositional tautologies. |
|
13 |
||
14 |
Inductive definition of propositional logic. Soundness and |
|
15 |
completeness w.r.t.\ truth-tables. |
|
12088 | 16 |
|
61798 | 17 |
Prove: If \<open>H |= p\<close> then \<open>G |= p\<close> where \<open>G \<in> |
18 |
Fin(H)\<close> |
|
60770 | 19 |
\<close> |
12610 | 20 |
|
21 |
||
60770 | 22 |
subsection \<open>The datatype of propositions\<close> |
12088 | 23 |
|
24 |
consts |
|
12610 | 25 |
propn :: i |
12088 | 26 |
|
12610 | 27 |
datatype propn = |
28 |
Fls |
|
69587 | 29 |
| Var ("n \<in> nat") (\<open>#_\<close> [100] 100) |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
30 |
| Imp ("p \<in> propn", "q \<in> propn") (infixr \<open>\<Rightarrow>\<close> 90) |
12610 | 31 |
|
12088 | 32 |
|
60770 | 33 |
subsection \<open>The proof system\<close> |
12610 | 34 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
35 |
consts thms :: "i \<Rightarrow> i" |
35068 | 36 |
|
37 |
abbreviation |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
38 |
thms_syntax :: "[i,i] \<Rightarrow> o" (infixl \<open>|-\<close> 50) |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
39 |
where "H |- p \<equiv> p \<in> thms(H)" |
12088 | 40 |
|
41 |
inductive |
|
12610 | 42 |
domains "thms(H)" \<subseteq> "propn" |
12560 | 43 |
intros |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
44 |
H: "\<lbrakk>p \<in> H; p \<in> propn\<rbrakk> \<Longrightarrow> H |- p" |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
45 |
K: "\<lbrakk>p \<in> propn; q \<in> propn\<rbrakk> \<Longrightarrow> H |- p\<Rightarrow>q\<Rightarrow>p" |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
46 |
S: "\<lbrakk>p \<in> propn; q \<in> propn; r \<in> propn\<rbrakk> |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
47 |
\<Longrightarrow> H |- (p\<Rightarrow>q\<Rightarrow>r) \<Rightarrow> (p\<Rightarrow>q) \<Rightarrow> p\<Rightarrow>r" |
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
48 |
DN: "p \<in> propn \<Longrightarrow> H |- ((p\<Rightarrow>Fls) \<Rightarrow> Fls) \<Rightarrow> p" |
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
49 |
MP: "\<lbrakk>H |- p\<Rightarrow>q; H |- p; p \<in> propn; q \<in> propn\<rbrakk> \<Longrightarrow> H |- q" |
12560 | 50 |
type_intros "propn.intros" |
12088 | 51 |
|
12560 | 52 |
declare propn.intros [simp] |
53 |
||
12610 | 54 |
|
60770 | 55 |
subsection \<open>The semantics\<close> |
12610 | 56 |
|
60770 | 57 |
subsubsection \<open>Semantics of propositional logic.\<close> |
12560 | 58 |
|
12610 | 59 |
consts |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
60 |
is_true_fun :: "[i,i] \<Rightarrow> i" |
12610 | 61 |
primrec |
62 |
"is_true_fun(Fls, t) = 0" |
|
63 |
"is_true_fun(Var(v), t) = (if v \<in> t then 1 else 0)" |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
64 |
"is_true_fun(p\<Rightarrow>q, t) = (if is_true_fun(p,t) = 1 then is_true_fun(q,t) else 1)" |
12610 | 65 |
|
24893 | 66 |
definition |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
67 |
is_true :: "[i,i] \<Rightarrow> o" where |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
68 |
"is_true(p,t) \<equiv> is_true_fun(p,t) = 1" |
61798 | 69 |
\<comment> \<open>this definition is required since predicates can't be recursive\<close> |
12560 | 70 |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
35762
diff
changeset
|
71 |
lemma is_true_Fls [simp]: "is_true(Fls,t) \<longleftrightarrow> False" |
12610 | 72 |
by (simp add: is_true_def) |
12560 | 73 |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
35762
diff
changeset
|
74 |
lemma is_true_Var [simp]: "is_true(#v,t) \<longleftrightarrow> v \<in> t" |
12610 | 75 |
by (simp add: is_true_def) |
12560 | 76 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
77 |
lemma is_true_Imp [simp]: "is_true(p\<Rightarrow>q,t) \<longleftrightarrow> (is_true(p,t)\<longrightarrow>is_true(q,t))" |
12610 | 78 |
by (simp add: is_true_def) |
79 |
||
80 |
||
60770 | 81 |
subsubsection \<open>Logical consequence\<close> |
12610 | 82 |
|
60770 | 83 |
text \<open> |
61798 | 84 |
For every valuation, if all elements of \<open>H\<close> are true then so |
85 |
is \<open>p\<close>. |
|
60770 | 86 |
\<close> |
12610 | 87 |
|
24893 | 88 |
definition |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
89 |
logcon :: "[i,i] \<Rightarrow> o" (infixl \<open>|=\<close> 50) where |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
90 |
"H |= p \<equiv> \<forall>t. (\<forall>q \<in> H. is_true(q,t)) \<longrightarrow> is_true(p,t)" |
12560 | 91 |
|
92 |
||
60770 | 93 |
text \<open> |
61798 | 94 |
A finite set of hypotheses from \<open>t\<close> and the \<open>Var\<close>s in |
95 |
\<open>p\<close>. |
|
60770 | 96 |
\<close> |
12610 | 97 |
|
98 |
consts |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
99 |
hyps :: "[i,i] \<Rightarrow> i" |
12610 | 100 |
primrec |
101 |
"hyps(Fls, t) = 0" |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
102 |
"hyps(Var(v), t) = (if v \<in> t then {#v} else {#v\<Rightarrow>Fls})" |
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
103 |
"hyps(p\<Rightarrow>q, t) = hyps(p,t) \<union> hyps(q,t)" |
12610 | 104 |
|
105 |
||
106 |
||
60770 | 107 |
subsection \<open>Proof theory of propositional logic\<close> |
12560 | 108 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
109 |
lemma thms_mono: "G \<subseteq> H \<Longrightarrow> thms(G) \<subseteq> thms(H)" |
76217 | 110 |
unfolding thms.defs |
12610 | 111 |
apply (rule lfp_mono) |
112 |
apply (rule thms.bnd_mono)+ |
|
113 |
apply (assumption | rule univ_mono basic_monos)+ |
|
114 |
done |
|
12560 | 115 |
|
116 |
lemmas thms_in_pl = thms.dom_subset [THEN subsetD] |
|
117 |
||
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
118 |
inductive_cases ImpE: "p\<Rightarrow>q \<in> propn" |
12560 | 119 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
120 |
lemma thms_MP: "\<lbrakk>H |- p\<Rightarrow>q; H |- p\<rbrakk> \<Longrightarrow> H |- q" |
61798 | 121 |
\<comment> \<open>Stronger Modus Ponens rule: no typechecking!\<close> |
12610 | 122 |
apply (rule thms.MP) |
123 |
apply (erule asm_rl thms_in_pl thms_in_pl [THEN ImpE])+ |
|
124 |
done |
|
12560 | 125 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
126 |
lemma thms_I: "p \<in> propn \<Longrightarrow> H |- p\<Rightarrow>p" |
61798 | 127 |
\<comment> \<open>Rule is called \<open>I\<close> for Identity Combinator, not for Introduction.\<close> |
12610 | 128 |
apply (rule thms.S [THEN thms_MP, THEN thms_MP]) |
129 |
apply (rule_tac [5] thms.K) |
|
130 |
apply (rule_tac [4] thms.K) |
|
131 |
apply simp_all |
|
132 |
done |
|
133 |
||
12560 | 134 |
|
60770 | 135 |
subsubsection \<open>Weakening, left and right\<close> |
12560 | 136 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
137 |
lemma weaken_left: "\<lbrakk>G \<subseteq> H; G|-p\<rbrakk> \<Longrightarrow> H|-p" |
61798 | 138 |
\<comment> \<open>Order of premises is convenient with \<open>THEN\<close>\<close> |
12610 | 139 |
by (erule thms_mono [THEN subsetD]) |
12560 | 140 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
141 |
lemma weaken_left_cons: "H |- p \<Longrightarrow> cons(a,H) |- p" |
12610 | 142 |
by (erule subset_consI [THEN weaken_left]) |
12560 | 143 |
|
144 |
lemmas weaken_left_Un1 = Un_upper1 [THEN weaken_left] |
|
145 |
lemmas weaken_left_Un2 = Un_upper2 [THEN weaken_left] |
|
146 |
||
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
147 |
lemma weaken_right: "\<lbrakk>H |- q; p \<in> propn\<rbrakk> \<Longrightarrow> H |- p\<Rightarrow>q" |
12610 | 148 |
by (simp_all add: thms.K [THEN thms_MP] thms_in_pl) |
12560 | 149 |
|
150 |
||
60770 | 151 |
subsubsection \<open>The deduction theorem\<close> |
12610 | 152 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
153 |
theorem deduction: "\<lbrakk>cons(p,H) |- q; p \<in> propn\<rbrakk> \<Longrightarrow> H |- p\<Rightarrow>q" |
12610 | 154 |
apply (erule thms.induct) |
155 |
apply (blast intro: thms_I thms.H [THEN weaken_right]) |
|
156 |
apply (blast intro: thms.K [THEN weaken_right]) |
|
157 |
apply (blast intro: thms.S [THEN weaken_right]) |
|
158 |
apply (blast intro: thms.DN [THEN weaken_right]) |
|
159 |
apply (blast intro: thms.S [THEN thms_MP [THEN thms_MP]]) |
|
160 |
done |
|
12560 | 161 |
|
162 |
||
60770 | 163 |
subsubsection \<open>The cut rule\<close> |
12610 | 164 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
165 |
lemma cut: "\<lbrakk>H|-p; cons(p,H) |- q\<rbrakk> \<Longrightarrow> H |- q" |
12610 | 166 |
apply (rule deduction [THEN thms_MP]) |
167 |
apply (simp_all add: thms_in_pl) |
|
168 |
done |
|
12560 | 169 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
170 |
lemma thms_FlsE: "\<lbrakk>H |- Fls; p \<in> propn\<rbrakk> \<Longrightarrow> H |- p" |
12610 | 171 |
apply (rule thms.DN [THEN thms_MP]) |
172 |
apply (rule_tac [2] weaken_right) |
|
173 |
apply (simp_all add: propn.intros) |
|
174 |
done |
|
12560 | 175 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
176 |
lemma thms_notE: "\<lbrakk>H |- p\<Rightarrow>Fls; H |- p; q \<in> propn\<rbrakk> \<Longrightarrow> H |- q" |
12610 | 177 |
by (erule thms_MP [THEN thms_FlsE]) |
178 |
||
179 |
||
60770 | 180 |
subsubsection \<open>Soundness of the rules wrt truth-table semantics\<close> |
12560 | 181 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
182 |
theorem soundness: "H |- p \<Longrightarrow> H |= p" |
76216
9fc34f76b4e8
getting rid of apply (unfold ...)
paulson <lp15@cam.ac.uk>
parents:
76215
diff
changeset
|
183 |
unfolding logcon_def |
18415 | 184 |
apply (induct set: thms) |
12610 | 185 |
apply auto |
186 |
done |
|
12560 | 187 |
|
12610 | 188 |
|
60770 | 189 |
subsection \<open>Completeness\<close> |
12610 | 190 |
|
60770 | 191 |
subsubsection \<open>Towards the completeness proof\<close> |
12560 | 192 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
193 |
lemma Fls_Imp: "\<lbrakk>H |- p\<Rightarrow>Fls; q \<in> propn\<rbrakk> \<Longrightarrow> H |- p\<Rightarrow>q" |
12610 | 194 |
apply (frule thms_in_pl) |
195 |
apply (rule deduction) |
|
196 |
apply (rule weaken_left_cons [THEN thms_notE]) |
|
197 |
apply (blast intro: thms.H elim: ImpE)+ |
|
198 |
done |
|
12560 | 199 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
200 |
lemma Imp_Fls: "\<lbrakk>H |- p; H |- q\<Rightarrow>Fls\<rbrakk> \<Longrightarrow> H |- (p\<Rightarrow>q)\<Rightarrow>Fls" |
12610 | 201 |
apply (frule thms_in_pl) |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
202 |
apply (frule thms_in_pl [of concl: "q\<Rightarrow>Fls"]) |
12610 | 203 |
apply (rule deduction) |
204 |
apply (erule weaken_left_cons [THEN thms_MP]) |
|
205 |
apply (rule consI1 [THEN thms.H, THEN thms_MP]) |
|
206 |
apply (blast intro: weaken_left_cons elim: ImpE)+ |
|
207 |
done |
|
12560 | 208 |
|
209 |
lemma hyps_thms_if: |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
210 |
"p \<in> propn \<Longrightarrow> hyps(p,t) |- (if is_true(p,t) then p else p\<Rightarrow>Fls)" |
61798 | 211 |
\<comment> \<open>Typical example of strengthening the induction statement.\<close> |
12610 | 212 |
apply simp |
213 |
apply (induct_tac p) |
|
214 |
apply (simp_all add: thms_I thms.H) |
|
215 |
apply (safe elim!: Fls_Imp [THEN weaken_left_Un1] Fls_Imp [THEN weaken_left_Un2]) |
|
216 |
apply (blast intro: weaken_left_Un1 weaken_left_Un2 weaken_right Imp_Fls)+ |
|
217 |
done |
|
218 |
||
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
219 |
lemma logcon_thms_p: "\<lbrakk>p \<in> propn; 0 |= p\<rbrakk> \<Longrightarrow> hyps(p,t) |- p" |
61798 | 220 |
\<comment> \<open>Key lemma for completeness; yields a set of assumptions satisfying \<open>p\<close>\<close> |
12610 | 221 |
apply (drule hyps_thms_if) |
222 |
apply (simp add: logcon_def) |
|
223 |
done |
|
224 |
||
60770 | 225 |
text \<open> |
12610 | 226 |
For proving certain theorems in our new propositional logic. |
60770 | 227 |
\<close> |
12560 | 228 |
|
12610 | 229 |
lemmas propn_SIs = propn.intros deduction |
230 |
and propn_Is = thms_in_pl thms.H thms.H [THEN thms_MP] |
|
231 |
||
60770 | 232 |
text \<open> |
12610 | 233 |
The excluded middle in the form of an elimination rule. |
60770 | 234 |
\<close> |
12560 | 235 |
|
12610 | 236 |
lemma thms_excluded_middle: |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
237 |
"\<lbrakk>p \<in> propn; q \<in> propn\<rbrakk> \<Longrightarrow> H |- (p\<Rightarrow>q) \<Rightarrow> ((p\<Rightarrow>Fls)\<Rightarrow>q) \<Rightarrow> q" |
12610 | 238 |
apply (rule deduction [THEN deduction]) |
239 |
apply (rule thms.DN [THEN thms_MP]) |
|
240 |
apply (best intro!: propn_SIs intro: propn_Is)+ |
|
241 |
done |
|
12560 | 242 |
|
12610 | 243 |
lemma thms_excluded_middle_rule: |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
244 |
"\<lbrakk>cons(p,H) |- q; cons(p\<Rightarrow>Fls,H) |- q; p \<in> propn\<rbrakk> \<Longrightarrow> H |- q" |
61798 | 245 |
\<comment> \<open>Hard to prove directly because it requires cuts\<close> |
12610 | 246 |
apply (rule thms_excluded_middle [THEN thms_MP, THEN thms_MP]) |
247 |
apply (blast intro!: propn_SIs intro: propn_Is)+ |
|
248 |
done |
|
12560 | 249 |
|
250 |
||
60770 | 251 |
subsubsection \<open>Completeness -- lemmas for reducing the set of assumptions\<close> |
12560 | 252 |
|
60770 | 253 |
text \<open> |
69593 | 254 |
For the case \<^prop>\<open>hyps(p,t)-cons(#v,Y) |- p\<close> we also have \<^prop>\<open>hyps(p,t)-{#v} \<subseteq> hyps(p, t-{v})\<close>. |
60770 | 255 |
\<close> |
12560 | 256 |
|
12610 | 257 |
lemma hyps_Diff: |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
258 |
"p \<in> propn \<Longrightarrow> hyps(p, t-{v}) \<subseteq> cons(#v\<Rightarrow>Fls, hyps(p,t)-{#v})" |
18415 | 259 |
by (induct set: propn) auto |
12560 | 260 |
|
60770 | 261 |
text \<open> |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
262 |
For the case \<^prop>\<open>hyps(p,t)-cons(#v \<Rightarrow> Fls,Y) |- p\<close> we also have |
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
263 |
\<^prop>\<open>hyps(p,t)-{#v\<Rightarrow>Fls} \<subseteq> hyps(p, cons(v,t))\<close>. |
60770 | 264 |
\<close> |
12560 | 265 |
|
266 |
lemma hyps_cons: |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
267 |
"p \<in> propn \<Longrightarrow> hyps(p, cons(v,t)) \<subseteq> cons(#v, hyps(p,t)-{#v\<Rightarrow>Fls})" |
18415 | 268 |
by (induct set: propn) auto |
12560 | 269 |
|
61798 | 270 |
text \<open>Two lemmas for use with \<open>weaken_left\<close>\<close> |
12560 | 271 |
|
272 |
lemma cons_Diff_same: "B-C \<subseteq> cons(a, B-cons(a,C))" |
|
12610 | 273 |
by blast |
12560 | 274 |
|
275 |
lemma cons_Diff_subset2: "cons(a, B-{c}) - D \<subseteq> cons(a, B-cons(c,D))" |
|
12610 | 276 |
by blast |
12560 | 277 |
|
60770 | 278 |
text \<open> |
69593 | 279 |
The set \<^term>\<open>hyps(p,t)\<close> is finite, and elements have the form |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
280 |
\<^term>\<open>#v\<close> or \<^term>\<open>#v\<Rightarrow>Fls\<close>; could probably prove the stronger |
69593 | 281 |
\<^prop>\<open>hyps(p,t) \<in> Fin(hyps(p,0) \<union> hyps(p,nat))\<close>. |
60770 | 282 |
\<close> |
12610 | 283 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
284 |
lemma hyps_finite: "p \<in> propn \<Longrightarrow> hyps(p,t) \<in> Fin(\<Union>v \<in> nat. {#v, #v\<Rightarrow>Fls})" |
18415 | 285 |
by (induct set: propn) auto |
12560 | 286 |
|
287 |
lemmas Diff_weaken_left = Diff_mono [OF _ subset_refl, THEN weaken_left] |
|
288 |
||
60770 | 289 |
text \<open> |
69593 | 290 |
Induction on the finite set of assumptions \<^term>\<open>hyps(p,t0)\<close>. We |
12610 | 291 |
may repeatedly subtract assumptions until none are left! |
60770 | 292 |
\<close> |
12610 | 293 |
|
12560 | 294 |
lemma completeness_0_lemma [rule_format]: |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
295 |
"\<lbrakk>p \<in> propn; 0 |= p\<rbrakk> \<Longrightarrow> \<forall>t. hyps(p,t) - hyps(p,t0) |- p" |
12610 | 296 |
apply (frule hyps_finite) |
297 |
apply (erule Fin_induct) |
|
298 |
apply (simp add: logcon_thms_p Diff_0) |
|
60770 | 299 |
txt \<open>inductive step\<close> |
12610 | 300 |
apply safe |
69593 | 301 |
txt \<open>Case \<^prop>\<open>hyps(p,t)-cons(#v,Y) |- p\<close>\<close> |
12610 | 302 |
apply (rule thms_excluded_middle_rule) |
303 |
apply (erule_tac [3] propn.intros) |
|
304 |
apply (blast intro: cons_Diff_same [THEN weaken_left]) |
|
305 |
apply (blast intro: cons_Diff_subset2 [THEN weaken_left] |
|
306 |
hyps_Diff [THEN Diff_weaken_left]) |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
307 |
txt \<open>Case \<^prop>\<open>hyps(p,t)-cons(#v \<Rightarrow> Fls,Y) |- p\<close>\<close> |
12610 | 308 |
apply (rule thms_excluded_middle_rule) |
309 |
apply (erule_tac [3] propn.intros) |
|
310 |
apply (blast intro: cons_Diff_subset2 [THEN weaken_left] |
|
311 |
hyps_cons [THEN Diff_weaken_left]) |
|
12560 | 312 |
apply (blast intro: cons_Diff_same [THEN weaken_left]) |
12610 | 313 |
done |
314 |
||
315 |
||
60770 | 316 |
subsubsection \<open>Completeness theorem\<close> |
12560 | 317 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
318 |
lemma completeness_0: "\<lbrakk>p \<in> propn; 0 |= p\<rbrakk> \<Longrightarrow> 0 |- p" |
61798 | 319 |
\<comment> \<open>The base case for completeness\<close> |
12610 | 320 |
apply (rule Diff_cancel [THEN subst]) |
321 |
apply (blast intro: completeness_0_lemma) |
|
322 |
done |
|
12560 | 323 |
|
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
324 |
lemma logcon_Imp: "\<lbrakk>cons(p,H) |= q\<rbrakk> \<Longrightarrow> H |= p\<Rightarrow>q" |
61798 | 325 |
\<comment> \<open>A semantic analogue of the Deduction Theorem\<close> |
12610 | 326 |
by (simp add: logcon_def) |
12560 | 327 |
|
18415 | 328 |
lemma completeness: |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
329 |
"H \<in> Fin(propn) \<Longrightarrow> p \<in> propn \<Longrightarrow> H |= p \<Longrightarrow> H |- p" |
20503 | 330 |
apply (induct arbitrary: p set: Fin) |
12610 | 331 |
apply (safe intro!: completeness_0) |
332 |
apply (rule weaken_left_cons [THEN thms_MP]) |
|
333 |
apply (blast intro!: logcon_Imp propn.intros) |
|
334 |
apply (blast intro: propn_Is) |
|
335 |
done |
|
12560 | 336 |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
337 |
theorem thms_iff: "H \<in> Fin(propn) \<Longrightarrow> H |- p \<longleftrightarrow> H |= p \<and> p \<in> propn" |
12610 | 338 |
by (blast intro: soundness completeness thms_in_pl) |
12560 | 339 |
|
12088 | 340 |
end |