Theory ND_Compl_Truthtable
theory ND_Compl_Truthtable
imports ND_Sound
begin
textβΉThis proof is inspired by Huth and Ryan~\<^cite>βΉ"huth2004logic"βΊ.βΊ
definition "turn_true π F β‘ if π β¨ F then F else (Not F)"
lemma lemma0[simp,intro!]: "π β¨ turn_true π F" unfolding turn_true_def by simp
lemma turn_true_simps[simp]:
"π β¨ F βΉ turn_true π F = F"
"Β¬ π β¨ F βΉ turn_true π F = βΒ¬ F"
unfolding turn_true_def by simp_all
definition line_assm :: "'a valuation β 'a set β 'a formula set" where
"line_assm π β‘ (`) (Ξ»k. turn_true π (Atom k))"
definition line_suitable :: "'a set β 'a formula β bool" where
"line_suitable Z F β‘ (atoms F β Z)"
lemma line_suitable_junctors[simp]:
"line_suitable π (Not F) = line_suitable π F"
"line_suitable π (And F G) = (line_suitable π F β§ line_suitable π G)"
"line_suitable π (Or F G) = (line_suitable π F β§ line_suitable π G)"
"line_suitable π (Imp F G) = (line_suitable π F β§ line_suitable π G)"
unfolding line_suitable_def by(clarsimp; linarith)+
lemma line_assm_Cons[simp]: "line_assm π (kβΉks) = (if π k then Atom k else Not (Atom k)) βΉ line_assm π ks"
unfolding line_assm_def by simp
lemma NotD: "Ξ β’ βΒ¬ F βΉ FβΉΞ β’ β₯" by (meson Not2I NotE Weaken subset_insertI)
lemma truthline_ND_proof:
fixes F :: "'a formula"
assumes "line_suitable Z F"
shows "line_assm π Z β’ turn_true π F"
using assms proof(induction F)
case (Atom k) thus ?case using Ax[where 'a='a] by (simp add: line_suitable_def line_assm_def)
next
case Bot
have "turn_true π β₯ = Not Bot" unfolding turn_true_def by simp
thus ?case by (simp add: Ax NotI)
next
have [simp]: "Ξ β’ βΒ¬ (βΒ¬ F) β· Ξ β’ F" for F :: "'a formula" and Ξ by (metis NDtrans Not2E Not2I)
case (Not F)
hence "line_assm π Z β’ turn_true π F" by simp
thus ?case by(cases "π β¨ F"; simp)
next
have [simp]: "β¦line_assm π Z β’ βΒ¬ F; Β¬ π β¨ Fβ§ βΉ F ββ§ GβΉ line_assm π Z β’ β₯" for F G by(blast intro!: NotE[where F=F] intro: AndE1[OF Ax] Weaken[OF _ subset_insertI])
have [simp]: "β¦line_assm π Z β’ βΒ¬ G; Β¬ π β¨ Gβ§ βΉ F ββ§ GβΉ line_assm π Z β’ β₯" for F G by(blast intro!: NotE[where F=G] intro: AndE2[OF Ax] Weaken[OF _ subset_insertI])
case (And F G)
thus ?case by(cases "π β¨ F"; cases "π β¨ G"; simp; intro ND.NotI AndI; simp)
next
case (Or F G)
thus ?case by(cases "π β¨ F"; cases "π β¨ G"; simp; (elim ND.OrI1 ND.OrI2)?) (force intro!: NotI dest!: NotD dest: OrL_sim)
next
case (Imp F G)
hence mIH: "line_assm π Z β’ turn_true π F" "line_assm π Z β’ turn_true π G" by simp+
thus ?case by(cases "π β¨ F"; cases "π β¨ G"; simp; intro ImpI NotI ImpL_sim; simp add: Weaken[OF _ subset_insertI] NotSwap NotD NotD[THEN BotE])
qed
thm NotD[THEN BotE]
lemma deconstruct_assm_set:
assumes IH: "βπ. line_assm π (kβΉZ) β’ F"
shows "βπ. line_assm π Z β’ F"
proof cases
assume "k β Z" with IH show "?thesis π" for π by (simp add: insert_absorb)
next
assume "k β Z"
fix π
textβΉSince we require the IH for arbitrary @{term π}, we use a modified @{term π} from the conclusion like this:βΊ
from IH have av: "line_assm (π(k := v)) (kβΉZ) β’ F" for v by blast
textβΉHowever, that modification is only relevant for @{term "kβΉZ"}, nothing from @{term Z} gets touched.βΊ
from βΉk β ZβΊ have "line_assm (π(k := v)) Z = line_assm π Z" for v unfolding line_assm_def turn_true_def by force
textβΉThat means we can rewrite the modified @{const line_assm} like this:βΊ
hence "line_assm (π(k := v)) (kβΉZ) =
(if v then Atom k else Not (Atom k)) βΉ line_assm π Z" for v by simp
textβΉInserting @{const True} and @{const False} for βΉvβΊ yields the two alternatives.βΊ
with av have "Atom k βΉ line_assm π Z β’ F" "Not (Atom k) βΉ line_assm π Z β’ F"
by(metis (full_types))+
with ND_caseDistinction show "line_assm π Z β’ F" .
qed
theorem ND_complete:
assumes taut: "β¨ F"
shows "{} β’ F"
proof -
have [simp]: "turn_true Z F = F" for Z using taut by simp
have "line_assm π {} β’ F" for π
proof(induction arbitrary: π rule: finite_empty_induct)
show fat: "finite (atoms F)" by (fact atoms_finite)
next
have su: "line_suitable (atoms F) F" unfolding line_suitable_def by simp
with truthline_ND_proof[OF su] show base: "line_assm π (atoms F) β’ F" for π by simp
next
case (3 k Z)
from βΉk β ZβΊ have *: βΉk βΉ Z - {k} = ZβΊ by blast
from βΉβπ. line_assm π Z β’ FβΊ
show βΉline_assm π (Z - {k}) β’ FβΊ
using deconstruct_assm_set[of k "Z - {k}" F π]
unfolding * by argo
qed
thus ?thesis unfolding line_assm_def by simp
qed
corollary ND_sound_complete: "{} β’ F β· β¨ F"
using ND_sound[of "{}" F] ND_complete[of F] unfolding entailment_def by blast
end