(******************************************************************************) theory i140309aa__semantab imports Complex_Main (*"../../iHelp/i"*) (*"../../IsaN/work/IsaN" *) begin (*( \ ): Turnstile to shorten the notation for meta-implication.*) no_notation ==> (infixr "\" 4) abbreviation mimp_turn :: "prop \ prop \ prop" where "mimp_turn P Q == (PROP P \ PROP Q)" notation mimp_turn (infixr "\" 4) (*( \ ): Cedilla, to act as a comma, for formulas such as P\ Q \ R.*) notation (input) ==> (infixr "\" 4) (*( \ ): False, to shorten the notation. The output is bold for visibility.*) notation (input) False ("\") notation (output) False ("\<^bold>\") (*( \~\ ): notP, PROP not.*) abbreviation notP :: "prop \ prop" where "notP P == (PROP P \ False)" notation notP ("\~\'(_')") (* \~\ *) (*( \\<^sub>p ): orP, PROP disjunction.*) (*PROP or: orP*) abbreviation orP :: "prop \ prop \ prop" where "orP P Q == ((PROP P \ False) \ PROP Q)" notation orP (infixr "(\\<^sub>p)" 4) (*( \\<^sub>p ): andP, PROP conjunction.*) abbreviation andP :: "prop \ prop \ prop" where "andP P Q == ((PROP P \ PROP Q \ False) \ False)" notation andP (infixr "(\\<^sub>p)" 4) (*( \\<^sub>4 ): and4, bool conjunction with the same priority as andP. For conversions from bool to PROP, to ensure that the same parenthesizing applies.*) abbreviation (input) and4 :: "bool \ bool \ bool" where "and4 P Q == (P \ Q)" notation and4 (infixr "(\\<^sub>4)" 4) (*******************************) (* LOGIC RULES *****************) (*******************************) lemma mimp2in_to_3and_mimps_False: "P\ Q \ R == P \\<^sub>4 Q \\<^sub>4 \R \ False" by(rule equal_intr_rule, auto) lemma or6_mimps_False_to_6andP_of_notPs: "P\<^sub>1 \ P\<^sub>2 \ P\<^sub>3 \ P\<^sub>4 \ P\<^sub>5 \ P\<^sub>6 \ False == \~\(P\<^sub>1) \\<^sub>p \~\(P\<^sub>2) \\<^sub>p \~\(P\<^sub>3) \\<^sub>p \~\(P\<^sub>4) \\<^sub>p \~\(P\<^sub>5) \\<^sub>p \~\(P\<^sub>6)" by(rule equal_intr_rule, auto) lemma and_eq_andP: "Trueprop(P \ Q) == P \\<^sub>p Q" by(rule equal_intr_rule, auto) lemma not_eq_notP: "Trueprop(\P) == \~\(P)" by(rule equal_intr_rule, auto) lemmas semantab_bool_expansion = simp_thms(1) imp_conv_disj de_Morgan_conj de_Morgan_disj conj_comms conj_disj_distribL disj_assoc lemmas semantab_bool_to_prop = and_eq_andP not_eq_notP (**************************) (* THEOREM ****************) (**************************) notation Trueprop ("_\\<^sub>T" [1000] 1000) declare[[show_sorts=false, show_types=false, show_brackets=true]] lemma "(A \ B) \ C\ \A \ D \ B \ (C \ D)" unfolding mimp2in_to_3and_mimps_False unfolding semantab_bool_expansion unfolding or6_mimps_False_to_6andP_of_notPs unfolding semantab_bool_to_prop by(auto) lemma "(A \ B) \ C\ \A \ D \ B \ (C \ D)" (*|Negate the conclusion and convert it to a 3-bool-and that mimps False. The notation for (P \ False) is \~\(P). Because of requirements due to Trueprop and other low priorities, notP needs to be in parentheses.|*) unfolding mimp2in_to_3and_mimps_False (*|Expand the bool formulas. The result will be a 6-bool-or that is nested to the left, and that mimps False.|*) unfolding simp_thms(1) imp_conv_disj de_Morgan_conj de_Morgan_disj conj_comms conj_disj_distribL (*|Nest the 6-bool-or to the right.|*) unfolding disj_assoc (*|Convert the 6-bool-or to 6 chains of andP-ands that each mimp False.|*) unfolding or6_mimps_False_to_6andP_of_notPs (*|Convert the bool-nots and bool-ands to notP-nots and andP-ands.|*) unfolding and_eq_andP unfolding not_eq_notP (*Now, there is no use of HOL in the formula except for the use of Trueprop and False. This can be seen by the fact that all of A, B, C, and D are being coerced by Trueprop. To turn the Trueprop printing off, change notation above to no_notation.*) using[[show_sorts=false, show_types=false, show_brackets=false]] (*The definition is shown as follows, from HOL.thy: defs True_def: "True == ((%x::bool. x) = (%x. x))" All_def: "All(P) == (P = (%x. True))" Ex_def: "Ex(P) == !Q. (!x. P x --> Q) --> Q" False_def: "False == (!P. P)" It's defined using only All and True, however, obviously, it's totally tied into the logic of HOL. But then, that's what makes auto work by magic when used above, and below. Of course, auto doesn't need any of this to be done for this theorem, but it could be that auto will be grateful someday. On the other hand, it's more likely that auto is an emotionless automaton, who doesn't care whether I live or die. In that case, it will be me who is grateful someday.*) by(auto) (******************************************************************************) end