# HG changeset patch # User wenzelm # Date 1445279369 -7200 # Node ID f8cb97e0fd0b47c39d507e2a1efa44ab1136eebe # Parent 3590367b0ce97d26a8be407048075886f8ff1eeb more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode; diff -r 3590367b0ce9 -r f8cb97e0fd0b src/FOL/FOL.thy --- a/src/FOL/FOL.thy Mon Oct 19 17:45:36 2015 +0200 +++ b/src/FOL/FOL.thy Mon Oct 19 20:29:29 2015 +0200 @@ -17,7 +17,7 @@ subsection \The classical axiom\ axiomatization where - classical: "(~P ==> P) ==> P" + classical: "(\ P \ P) \ P" subsection \Lemmas and proof tools\ @@ -25,40 +25,41 @@ lemma ccontr: "(\ P \ False) \ P" by (erule FalseE [THEN classical]) -(*** Classical introduction rules for | and EX ***) -lemma disjCI: "(~Q ==> P) ==> P|Q" +subsubsection \Classical introduction rules for @{text "\"} and @{text "\"}\ + +lemma disjCI: "(\ Q \ P) \ P \ Q" apply (rule classical) apply (assumption | erule meta_mp | rule disjI1 notI)+ apply (erule notE disjI2)+ done -(*introduction rule involving only EX*) +text \Introduction rule involving only @{text "\"}\ lemma ex_classical: - assumes r: "~(EX x. P(x)) ==> P(a)" - shows "EX x. P(x)" + assumes r: "\ (\x. P(x)) \ P(a)" + shows "\x. P(x)" apply (rule classical) apply (rule exI, erule r) done -(*version of above, simplifying ~EX to ALL~ *) +text \Version of above, simplifying @{text "\\"} to @{text "\\"}.\ lemma exCI: - assumes r: "ALL x. ~P(x) ==> P(a)" - shows "EX x. P(x)" + assumes r: "\x. \ P(x) \ P(a)" + shows "\x. P(x)" apply (rule ex_classical) apply (rule notI [THEN allI, THEN r]) apply (erule notE) apply (erule exI) done -lemma excluded_middle: "~P | P" +lemma excluded_middle: "\ P \ P" apply (rule disjCI) apply assumption done lemma case_split [case_names True False]: - assumes r1: "P ==> Q" - and r2: "~P ==> Q" + assumes r1: "P \ Q" + and r2: "\ P \ Q" shows Q apply (rule excluded_middle [THEN disjE]) apply (erule r2) @@ -67,7 +68,7 @@ ML \ fun case_tac ctxt a fixes = - Rule_Insts.res_inst_tac ctxt [((("P", 0), Position.none), a)] fixes @{thm case_split} + Rule_Insts.res_inst_tac ctxt [((("P", 0), Position.none), a)] fixes @{thm case_split}; \ method_setup case_tac = \ @@ -76,14 +77,13 @@ \ "case_tac emulation (dynamic instantiation!)" -(*** Special elimination rules *) - +subsection \Special elimination rules\ -(*Classical implies (-->) elimination. *) +text \Classical implies (@{text "\"}) elimination.\ lemma impCE: - assumes major: "P-->Q" - and r1: "~P ==> R" - and r2: "Q ==> R" + assumes major: "P \ Q" + and r1: "\ P \ R" + and r2: "Q \ R" shows R apply (rule excluded_middle [THEN disjE]) apply (erule r1) @@ -91,13 +91,15 @@ apply (erule major [THEN mp]) done -(*This version of --> elimination works on Q before P. It works best for - those cases in which P holds "almost everywhere". Can't install as - default: would break old proofs.*) +text \ + This version of @{text "\"} elimination works on @{text Q} before @{text + P}. It works best for those cases in which P holds ``almost everywhere''. + Can't install as default: would break old proofs. +\ lemma impCE': - assumes major: "P-->Q" - and r1: "Q ==> R" - and r2: "~P ==> R" + assumes major: "P \ Q" + and r1: "Q \ R" + and r2: "\ P \ R" shows R apply (rule excluded_middle [THEN disjE]) apply (erule r2) @@ -105,27 +107,30 @@ apply (erule major [THEN mp]) done -(*Double negation law*) -lemma notnotD: "~~P ==> P" +text \Double negation law.\ +lemma notnotD: "\ \ P \ P" apply (rule classical) apply (erule notE) apply assumption done -lemma contrapos2: "[| Q; ~ P ==> ~ Q |] ==> P" +lemma contrapos2: "\Q; \ P \ \ Q\ \ P" apply (rule classical) apply (drule (1) meta_mp) apply (erule (1) notE) done -(*** Tactics for implication and contradiction ***) + +subsubsection \Tactics for implication and contradiction\ -(*Classical <-> elimination. Proof substitutes P=Q in - ~P ==> ~Q and P ==> Q *) +text \ + Classical @{text "\"} elimination. Proof substitutes @{text "P = Q"} in + @{text "\ P \ \ Q"} and @{text "P \ Q"}. +\ lemma iffCE: - assumes major: "P<->Q" - and r1: "[| P; Q |] ==> R" - and r2: "[| ~P; ~Q |] ==> R" + assumes major: "P \ Q" + and r1: "\P; Q\ \ R" + and r2: "\\ P; \ Q\ \ R" shows R apply (rule major [unfolded iff_def, THEN conjE]) apply (elim impCE) @@ -137,8 +142,8 @@ (*Better for fast_tac: needs no quantifier duplication!*) lemma alt_ex1E: - assumes major: "EX! x. P(x)" - and r: "!!x. [| P(x); ALL y y'. P(y) & P(y') --> y=y' |] ==> R" + assumes major: "\! x. P(x)" + and r: "\x. \P(x); \y y'. P(y) \ P(y') \ y = y'\ \ R" shows R using major proof (rule ex1E) @@ -147,19 +152,22 @@ assume "P(x)" then show R proof (rule r) - { fix y y' + { + fix y y' assume "P(y)" and "P(y')" - with * have "x = y" and "x = y'" by - (tactic "IntPr.fast_tac @{context} 1")+ + with * have "x = y" and "x = y'" + by - (tactic "IntPr.fast_tac @{context} 1")+ then have "y = y'" by (rule subst) } note r' = this - show "\y y'. P(y) \ P(y') \ y = y'" by (intro strip, elim conjE) (rule r') + show "\y y'. P(y) \ P(y') \ y = y'" + by (intro strip, elim conjE) (rule r') qed qed -lemma imp_elim: "P --> Q ==> (~ R ==> P) ==> (Q ==> R) ==> R" +lemma imp_elim: "P \ Q \ (\ R \ P) \ (Q \ R) \ R" by (rule classical) iprover -lemma swap: "~ P ==> (~ R ==> P) ==> R" +lemma swap: "\ P \ (\ R \ P) \ R" by (rule classical) iprover @@ -207,11 +215,11 @@ \ -lemma ex1_functional: "[| EX! z. P(a,z); P(a,b); P(a,c) |] ==> b = c" +lemma ex1_functional: "\\! z. P(a,z); P(a,b); P(a,c)\ \ b = c" by blast -(* Elimination of True from asumptions: *) -lemma True_implies_equals: "(True ==> PROP P) == PROP P" +text \Elimination of @{text True} from assumptions:\ +lemma True_implies_equals: "(True \ PROP P) \ PROP P" proof assume "True \ PROP P" from this and TrueI show "PROP P" . @@ -220,98 +228,108 @@ then show "PROP P" . qed -lemma uncurry: "P --> Q --> R ==> P & Q --> R" +lemma uncurry: "P \ Q \ R \ P \ Q \ R" by blast -lemma iff_allI: "(!!x. P(x) <-> Q(x)) ==> (ALL x. P(x)) <-> (ALL x. Q(x))" +lemma iff_allI: "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by blast -lemma iff_exI: "(!!x. P(x) <-> Q(x)) ==> (EX x. P(x)) <-> (EX x. Q(x))" +lemma iff_exI: "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by blast -lemma all_comm: "(ALL x y. P(x,y)) <-> (ALL y x. P(x,y))" by blast +lemma all_comm: "(\x y. P(x,y)) \ (\y x. P(x,y))" + by blast -lemma ex_comm: "(EX x y. P(x,y)) <-> (EX y x. P(x,y))" by blast +lemma ex_comm: "(\x y. P(x,y)) \ (\y x. P(x,y))" + by blast -(*** Classical simplification rules ***) +subsection \Classical simplification rules\ -(*Avoids duplication of subgoals after expand_if, when the true and false - cases boil down to the same thing.*) -lemma cases_simp: "(P --> Q) & (~P --> Q) <-> Q" by blast +text \ + Avoids duplication of subgoals after @{text expand_if}, when the true and + false cases boil down to the same thing. +\ + +lemma cases_simp: "(P \ Q) \ (\ P \ Q) \ Q" + by blast -(*** Miniscoping: pushing quantifiers in - We do NOT distribute of ALL over &, or dually that of EX over | - Baaz and Leitsch, On Skolemization and Proof Complexity (1994) - show that this step can increase proof length! -***) +subsubsection \Miniscoping: pushing quantifiers in\ + +text \ + We do NOT distribute of @{text "\"} over @{text "\"}, or dually that of + @{text "\"} over @{text "\"}. -(*existential miniscoping*) + Baaz and Leitsch, On Skolemization and Proof Complexity (1994) show that + this step can increase proof length! +\ + +text \Existential miniscoping.\ lemma int_ex_simps: - "!!P Q. (EX x. P(x) & Q) <-> (EX x. P(x)) & Q" - "!!P Q. (EX x. P & Q(x)) <-> P & (EX x. Q(x))" - "!!P Q. (EX x. P(x) | Q) <-> (EX x. P(x)) | Q" - "!!P Q. (EX x. P | Q(x)) <-> P | (EX x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" by iprover+ -(*classical rules*) +text \Classical rules.\ lemma cla_ex_simps: - "!!P Q. (EX x. P(x) --> Q) <-> (ALL x. P(x)) --> Q" - "!!P Q. (EX x. P --> Q(x)) <-> P --> (EX x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" by blast+ lemmas ex_simps = int_ex_simps cla_ex_simps -(*universal miniscoping*) +text \Universal miniscoping.\ lemma int_all_simps: - "!!P Q. (ALL x. P(x) & Q) <-> (ALL x. P(x)) & Q" - "!!P Q. (ALL x. P & Q(x)) <-> P & (ALL x. Q(x))" - "!!P Q. (ALL x. P(x) --> Q) <-> (EX x. P(x)) --> Q" - "!!P Q. (ALL x. P --> Q(x)) <-> P --> (ALL x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\ x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" by iprover+ -(*classical rules*) +text \Classical rules.\ lemma cla_all_simps: - "!!P Q. (ALL x. P(x) | Q) <-> (ALL x. P(x)) | Q" - "!!P Q. (ALL x. P | Q(x)) <-> P | (ALL x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" by blast+ lemmas all_simps = int_all_simps cla_all_simps -(*** Named rewrite rules proved for IFOL ***) +subsubsection \Named rewrite rules proved for IFOL\ -lemma imp_disj1: "(P-->Q) | R <-> (P-->Q | R)" by blast -lemma imp_disj2: "Q | (P-->R) <-> (P-->Q | R)" by blast +lemma imp_disj1: "(P \ Q) \ R \ (P \ Q \ R)" by blast +lemma imp_disj2: "Q \ (P \ R) \ (P \ Q \ R)" by blast -lemma de_Morgan_conj: "(~(P & Q)) <-> (~P | ~Q)" by blast +lemma de_Morgan_conj: "(\ (P \ Q)) \ (\ P \ \ Q)" by blast -lemma not_imp: "~(P --> Q) <-> (P & ~Q)" by blast -lemma not_iff: "~(P <-> Q) <-> (P <-> ~Q)" by blast +lemma not_imp: "\ (P \ Q) \ (P \ \ Q)" by blast +lemma not_iff: "\ (P \ Q) \ (P \ \ Q)" by blast -lemma not_all: "(~ (ALL x. P(x))) <-> (EX x.~P(x))" by blast -lemma imp_all: "((ALL x. P(x)) --> Q) <-> (EX x. P(x) --> Q)" by blast +lemma not_all: "(\ (\x. P(x))) \ (\x. \ P(x))" by blast +lemma imp_all: "((\x. P(x)) \ Q) \ (\x. P(x) \ Q)" by blast lemmas meta_simps = - triv_forall_equality (* prunes params *) - True_implies_equals (* prune asms `True' *) + triv_forall_equality -- \prunes params\ + True_implies_equals -- \prune asms @{text True}\ lemmas IFOL_simps = refl [THEN P_iff_T] conj_simps disj_simps not_simps imp_simps iff_simps quant_simps -lemma notFalseI: "~False" by iprover +lemma notFalseI: "\ False" by iprover lemma cla_simps_misc: - "~(P&Q) <-> ~P | ~Q" - "P | ~P" - "~P | P" - "~ ~ P <-> P" - "(~P --> P) <-> P" - "(~P <-> ~Q) <-> (P<->Q)" by blast+ + "\ (P \ Q) \ \ P \ \ Q" + "P \ \ P" + "\ P \ P" + "\ \ P \ P" + "(\ P \ P) \ P" + "(\ P \ \ Q) \ (P \ Q)" by blast+ lemmas cla_simps = de_Morgan_conj de_Morgan_disj imp_disj1 imp_disj2 @@ -320,8 +338,8 @@ ML_file "simpdata.ML" -simproc_setup defined_Ex ("EX x. P(x)") = \fn _ => Quantifier1.rearrange_ex\ -simproc_setup defined_All ("ALL x. P(x)") = \fn _ => Quantifier1.rearrange_all\ +simproc_setup defined_Ex ("\x. P(x)") = \fn _ => Quantifier1.rearrange_ex\ +simproc_setup defined_All ("\x. P(x)") = \fn _ => Quantifier1.rearrange_all\ ML \ (*intuitionistic simprules only*) @@ -349,35 +367,36 @@ subsection \Other simple lemmas\ -lemma [simp]: "((P-->R) <-> (Q-->R)) <-> ((P<->Q) | R)" -by blast +lemma [simp]: "((P \ R) \ (Q \ R)) \ ((P \ Q) \ R)" + by blast -lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))" -by blast +lemma [simp]: "((P \ Q) \ (P \ R)) \ (P \ (Q \ R))" + by blast -lemma not_disj_iff_imp: "~P | Q <-> (P-->Q)" -by blast +lemma not_disj_iff_imp: "\ P \ Q \ (P \ Q)" + by blast + -(** Monotonicity of implications **) +subsubsection \Monotonicity of implications\ -lemma conj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)" -by fast (*or (IntPr.fast_tac 1)*) +lemma conj_mono: "\P1 \ Q1; P2 \ Q2\ \ (P1 \ P2) \ (Q1 \ Q2)" + by fast (*or (IntPr.fast_tac 1)*) -lemma disj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)" -by fast (*or (IntPr.fast_tac 1)*) +lemma disj_mono: "\P1 \ Q1; P2 \ Q2\ \ (P1 \ P2) \ (Q1 \ Q2)" + by fast (*or (IntPr.fast_tac 1)*) -lemma imp_mono: "[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)" -by fast (*or (IntPr.fast_tac 1)*) +lemma imp_mono: "\Q1 \ P1; P2 \ Q2\ \ (P1 \ P2) \ (Q1 \ Q2)" + by fast (*or (IntPr.fast_tac 1)*) -lemma imp_refl: "P-->P" -by (rule impI, assumption) +lemma imp_refl: "P \ P" + by (rule impI) -(*The quantifier monotonicity rules are also intuitionistically valid*) -lemma ex_mono: "(!!x. P(x) --> Q(x)) ==> (EX x. P(x)) --> (EX x. Q(x))" -by blast +text \The quantifier monotonicity rules are also intuitionistically valid.\ +lemma ex_mono: "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" + by blast -lemma all_mono: "(!!x. P(x) --> Q(x)) ==> (ALL x. P(x)) --> (ALL x. Q(x))" -by blast +lemma all_mono: "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" + by blast subsection \Proof by cases and induction\ diff -r 3590367b0ce9 -r f8cb97e0fd0b src/FOL/IFOL.thy --- a/src/FOL/IFOL.thy Mon Oct 19 17:45:36 2015 +0200 +++ b/src/FOL/IFOL.thy Mon Oct 19 20:29:29 2015 +0200 @@ -30,81 +30,85 @@ typedecl o judgment - Trueprop :: "o => prop" ("(_)" 5) + Trueprop :: "o \ prop" ("(_)" 5) subsubsection \Equality\ axiomatization - eq :: "['a, 'a] => o" (infixl "=" 50) + eq :: "['a, 'a] \ o" (infixl "=" 50) where - refl: "a=a" and - subst: "a=b \ P(a) \ P(b)" + refl: "a = a" and + subst: "a = b \ P(a) \ P(b)" subsubsection \Propositional logic\ axiomatization False :: o and - conj :: "[o, o] => o" (infixr "&" 35) and - disj :: "[o, o] => o" (infixr "|" 30) and - imp :: "[o, o] => o" (infixr "-->" 25) + conj :: "[o, o] => o" (infixr "\" 35) and + disj :: "[o, o] => o" (infixr "\" 30) and + imp :: "[o, o] => o" (infixr "\" 25) where - conjI: "[| P; Q |] ==> P&Q" and - conjunct1: "P&Q ==> P" and - conjunct2: "P&Q ==> Q" and + conjI: "\P; Q\ \ P \ Q" and + conjunct1: "P \ Q \ P" and + conjunct2: "P \ Q \ Q" and - disjI1: "P ==> P|Q" and - disjI2: "Q ==> P|Q" and - disjE: "[| P|Q; P ==> R; Q ==> R |] ==> R" and + disjI1: "P \ P \ Q" and + disjI2: "Q \ P \ Q" and + disjE: "\P \ Q; P \ R; Q \ R\ \ R" and - impI: "(P ==> Q) ==> P-->Q" and - mp: "[| P-->Q; P |] ==> Q" and + impI: "(P \ Q) \ P \ Q" and + mp: "\P \ Q; P\ \ Q" and - FalseE: "False ==> P" + FalseE: "False \ P" subsubsection \Quantifiers\ axiomatization - All :: "('a => o) => o" (binder "ALL " 10) and - Ex :: "('a => o) => o" (binder "EX " 10) + All :: "('a \ o) \ o" (binder "\" 10) and + Ex :: "('a \ o) \ o" (binder "\" 10) where - allI: "(!!x. P(x)) ==> (ALL x. P(x))" and - spec: "(ALL x. P(x)) ==> P(x)" and - exI: "P(x) ==> (EX x. P(x))" and - exE: "[| EX x. P(x); !!x. P(x) ==> R |] ==> R" + allI: "(\x. P(x)) \ (\x. P(x))" and + spec: "(\x. P(x)) \ P(x)" and + exI: "P(x) \ (\x. P(x))" and + exE: "\\x. P(x); \x. P(x) \ R\ \ R" subsubsection \Definitions\ -definition "True == False-->False" -definition Not ("~ _" [40] 40) where not_def: "~P == P-->False" -definition iff (infixr "<->" 25) where "P<->Q == (P-->Q) & (Q-->P)" +definition "True \ False \ False" + +definition Not ("\ _" [40] 40) + where not_def: "\ P \ P \ False" -definition Ex1 :: "('a => o) => o" (binder "EX! " 10) - where ex1_def: "EX! x. P(x) == EX x. P(x) & (ALL y. P(y) --> y=x)" +definition iff (infixr "\" 25) + where "P \ Q \ (P \ Q) \ (Q \ P)" + +definition Ex1 :: "('a \ o) \ o" (binder "\!" 10) + where ex1_def: "\!x. P(x) \ \x. P(x) \ (\y. P(y) \ y = x)" axiomatization where -- \Reflection, admissible\ - eq_reflection: "(x=y) ==> (x==y)" and - iff_reflection: "(P<->Q) ==> (P==Q)" + eq_reflection: "(x = y) \ (x \ y)" and + iff_reflection: "(P \ Q) \ (P \ Q)" + +abbreviation not_equal :: "['a, 'a] \ o" (infixl "\" 50) + where "x \ y \ \ (x = y)" -subsubsection \Additional notation\ - -abbreviation not_equal :: "['a, 'a] => o" (infixl "~=" 50) - where "x ~= y == ~ (x = y)" +subsubsection \Old-style ASCII syntax\ -notation (xsymbols) - not_equal (infixl "\" 50) and - Not ("\ _" [40] 40) and - conj (infixr "\" 35) and - disj (infixr "\" 30) and - All (binder "\" 10) and - Ex (binder "\" 10) and - Ex1 (binder "\!" 10) and - imp (infixr "\" 25) and - iff (infixr "\" 25) +notation (ASCII) + not_equal (infixl "~=" 50) and + Not ("~ _" [40] 40) and + conj (infixr "&" 35) and + disj (infixr "|" 30) and + All (binder "ALL " 10) and + Ex (binder "EX " 10) and + Ex1 (binder "EX! " 10) and + imp (infixr "-->" 25) and + iff (infixr "<->" 25) subsection \Lemmas and proof tools\ @@ -115,11 +119,11 @@ unfolding True_def by (rule impI) -(*** Sequent-style elimination rules for & --> and ALL ***) +subsubsection \Sequent-style elimination rules for @{text "\"} @{text "\"} and @{text "\"}\ lemma conjE: - assumes major: "P & Q" - and r: "[| P; Q |] ==> R" + assumes major: "P \ Q" + and r: "\P; Q\ \ R" shows R apply (rule r) apply (rule major [THEN conjunct1]) @@ -127,9 +131,9 @@ done lemma impE: - assumes major: "P --> Q" + assumes major: "P \ Q" and P - and r: "Q ==> R" + and r: "Q \ R" shows R apply (rule r) apply (rule major [THEN mp]) @@ -137,17 +141,17 @@ done lemma allE: - assumes major: "ALL x. P(x)" - and r: "P(x) ==> R" + assumes major: "\x. P(x)" + and r: "P(x) \ R" shows R apply (rule r) apply (rule major [THEN spec]) done -(*Duplicates the quantifier; for use with eresolve_tac*) +text \Duplicates the quantifier; for use with @{ML eresolve_tac}.\ lemma all_dupE: - assumes major: "ALL x. P(x)" - and r: "[| P(x); ALL x. P(x) |] ==> R" + assumes major: "\x. P(x)" + and r: "\P(x); \x. P(x)\ \ R" shows R apply (rule r) apply (rule major [THEN spec]) @@ -155,64 +159,71 @@ done -(*** Negation rules, which translate between ~P and P-->False ***) +subsubsection \Negation rules, which translate between @{text "\ P"} and @{text "P \ False"}\ -lemma notI: "(P ==> False) ==> ~P" +lemma notI: "(P \ False) \ \ P" unfolding not_def by (erule impI) -lemma notE: "[| ~P; P |] ==> R" +lemma notE: "\\ P; P\ \ R" unfolding not_def by (erule mp [THEN FalseE]) -lemma rev_notE: "[| P; ~P |] ==> R" +lemma rev_notE: "\P; \ P\ \ R" by (erule notE) -(*This is useful with the special implication rules for each kind of P. *) +text \This is useful with the special implication rules for each kind of @{text P}.\ lemma not_to_imp: - assumes "~P" - and r: "P --> False ==> Q" + assumes "\ P" + and r: "P \ False \ Q" shows Q apply (rule r) apply (rule impI) - apply (erule notE [OF \~P\]) + apply (erule notE [OF \\ P\]) done -(* For substitution into an assumption P, reduce Q to P-->Q, substitute into - this implication, then apply impI to move P back into the assumptions.*) -lemma rev_mp: "[| P; P --> Q |] ==> Q" +text \ + For substitution into an assumption @{text P}, reduce @{text Q} to @{text + "P \ Q"}, substitute into this implication, then apply @{text impI} to + move @{text P} back into the assumptions. +\ +lemma rev_mp: "\P; P \ Q\ \ Q" by (erule mp) -(*Contrapositive of an inference rule*) +text \Contrapositive of an inference rule.\ lemma contrapos: - assumes major: "~Q" - and minor: "P ==> Q" - shows "~P" + assumes major: "\ Q" + and minor: "P \ Q" + shows "\ P" apply (rule major [THEN notE, THEN notI]) apply (erule minor) done -(*** Modus Ponens Tactics ***) +subsubsection \Modus Ponens Tactics\ -(*Finds P-->Q and P in the assumptions, replaces implication by Q *) +text \ + Finds @{text "P \ Q"} and P in the assumptions, replaces implication by + @{text Q}. +\ ML \ - fun mp_tac ctxt i = eresolve_tac ctxt @{thms notE impE} i THEN assume_tac ctxt i - fun eq_mp_tac ctxt i = eresolve_tac ctxt @{thms notE impE} i THEN eq_assume_tac i + fun mp_tac ctxt i = + eresolve_tac ctxt @{thms notE impE} i THEN assume_tac ctxt i; + fun eq_mp_tac ctxt i = + eresolve_tac ctxt @{thms notE impE} i THEN eq_assume_tac i; \ -(*** If-and-only-if ***) +subsection \If-and-only-if\ -lemma iffI: "[| P ==> Q; Q ==> P |] ==> P<->Q" +lemma iffI: "\P \ Q; Q \ P\ \ P \ Q" apply (unfold iff_def) apply (rule conjI) apply (erule impI) apply (erule impI) done - lemma iffE: - assumes major: "P <-> Q" - and r: "P-->Q ==> Q-->P ==> R" + assumes major: "P \ Q" + and r: "P \ Q \ Q \ P \ R" shows R apply (insert major, unfold iff_def) apply (erule conjE) @@ -220,236 +231,250 @@ apply assumption done -(* Destruct rules for <-> similar to Modus Ponens *) -lemma iffD1: "[| P <-> Q; P |] ==> Q" +subsubsection \Destruct rules for @{text "\"} similar to Modus Ponens\ + +lemma iffD1: "\P \ Q; P\ \ Q" apply (unfold iff_def) apply (erule conjunct1 [THEN mp]) apply assumption done -lemma iffD2: "[| P <-> Q; Q |] ==> P" +lemma iffD2: "\P \ Q; Q\ \ P" apply (unfold iff_def) apply (erule conjunct2 [THEN mp]) apply assumption done -lemma rev_iffD1: "[| P; P <-> Q |] ==> Q" +lemma rev_iffD1: "\P; P \ Q\ \ Q" apply (erule iffD1) apply assumption done -lemma rev_iffD2: "[| Q; P <-> Q |] ==> P" +lemma rev_iffD2: "\Q; P \ Q\ \ P" apply (erule iffD2) apply assumption done -lemma iff_refl: "P <-> P" +lemma iff_refl: "P \ P" by (rule iffI) -lemma iff_sym: "Q <-> P ==> P <-> Q" +lemma iff_sym: "Q \ P \ P \ Q" apply (erule iffE) apply (rule iffI) apply (assumption | erule mp)+ done -lemma iff_trans: "[| P <-> Q; Q<-> R |] ==> P <-> R" +lemma iff_trans: "\P \ Q; Q \ R\ \ P \ R" apply (rule iffI) apply (assumption | erule iffE | erule (1) notE impE)+ done -(*** Unique existence. NOTE THAT the following 2 quantifications - EX!x such that [EX!y such that P(x,y)] (sequential) - EX!x,y such that P(x,y) (simultaneous) - do NOT mean the same thing. The parser treats EX!x y.P(x,y) as sequential. -***) +subsection \Unique existence\ + +text \ + NOTE THAT the following 2 quantifications: -lemma ex1I: - "P(a) \ (!!x. P(x) ==> x=a) \ EX! x. P(x)" + \<^item> EX!x such that [EX!y such that P(x,y)] (sequential) + \<^item> EX!x,y such that P(x,y) (simultaneous) + + do NOT mean the same thing. The parser treats EX!x y.P(x,y) as sequential. +\ + +lemma ex1I: "P(a) \ (\x. P(x) \ x = a) \ \!x. P(x)" apply (unfold ex1_def) apply (assumption | rule exI conjI allI impI)+ done -(*Sometimes easier to use: the premises have no shared variables. Safe!*) -lemma ex_ex1I: - "EX x. P(x) \ (!!x y. [| P(x); P(y) |] ==> x=y) \ EX! x. P(x)" +text \Sometimes easier to use: the premises have no shared variables. Safe!\ +lemma ex_ex1I: "\x. P(x) \ (\x y. \P(x); P(y)\ \ x = y) \ \!x. P(x)" apply (erule exE) apply (rule ex1I) apply assumption apply assumption done -lemma ex1E: - "EX! x. P(x) \ (!!x. [| P(x); ALL y. P(y) --> y=x |] ==> R) \ R" +lemma ex1E: "\! x. P(x) \ (\x. \P(x); \y. P(y) \ y = x\ \ R) \ R" apply (unfold ex1_def) apply (assumption | erule exE conjE)+ done -(*** <-> congruence rules for simplification ***) +subsubsection \@{text "\"} congruence rules for simplification\ -(*Use iffE on a premise. For conj_cong, imp_cong, all_cong, ex_cong*) +text \Use @{text iffE} on a premise. For @{text conj_cong}, @{text + imp_cong}, @{text all_cong}, @{text ex_cong}.\ ML \ fun iff_tac ctxt prems i = resolve_tac ctxt (prems RL @{thms iffE}) i THEN - REPEAT1 (eresolve_tac ctxt @{thms asm_rl mp} i) + REPEAT1 (eresolve_tac ctxt @{thms asm_rl mp} i); \ method_setup iff = - \Attrib.thms >> (fn prems => fn ctxt => SIMPLE_METHOD' (iff_tac ctxt prems))\ + \Attrib.thms >> + (fn prems => fn ctxt => SIMPLE_METHOD' (iff_tac ctxt prems))\ lemma conj_cong: - assumes "P <-> P'" - and "P' ==> Q <-> Q'" - shows "(P&Q) <-> (P'&Q')" + assumes "P \ P'" + and "P' \ Q \ Q'" + shows "(P \ Q) \ (P' \ Q')" apply (insert assms) apply (assumption | rule iffI conjI | erule iffE conjE mp | iff assms)+ done -(*Reversed congruence rule! Used in ZF/Order*) +text \Reversed congruence rule! Used in ZF/Order.\ lemma conj_cong2: - assumes "P <-> P'" - and "P' ==> Q <-> Q'" - shows "(Q&P) <-> (Q'&P')" + assumes "P \ P'" + and "P' \ Q \ Q'" + shows "(Q \ P) \ (Q' \ P')" apply (insert assms) apply (assumption | rule iffI conjI | erule iffE conjE mp | iff assms)+ done lemma disj_cong: - assumes "P <-> P'" and "Q <-> Q'" - shows "(P|Q) <-> (P'|Q')" + assumes "P \ P'" and "Q \ Q'" + shows "(P \ Q) \ (P' \ Q')" apply (insert assms) - apply (erule iffE disjE disjI1 disjI2 | assumption | rule iffI | erule (1) notE impE)+ + apply (erule iffE disjE disjI1 disjI2 | + assumption | rule iffI | erule (1) notE impE)+ done lemma imp_cong: - assumes "P <-> P'" - and "P' ==> Q <-> Q'" - shows "(P-->Q) <-> (P'-->Q')" + assumes "P \ P'" + and "P' \ Q \ Q'" + shows "(P \ Q) \ (P' \ Q')" apply (insert assms) apply (assumption | rule iffI impI | erule iffE | erule (1) notE impE | iff assms)+ done -lemma iff_cong: "[| P <-> P'; Q <-> Q' |] ==> (P<->Q) <-> (P'<->Q')" +lemma iff_cong: "\P \ P'; Q \ Q'\ \ (P \ Q) \ (P' \ Q')" apply (erule iffE | assumption | rule iffI | erule (1) notE impE)+ done -lemma not_cong: "P <-> P' ==> ~P <-> ~P'" +lemma not_cong: "P \ P' \ \ P \ \ P'" apply (assumption | rule iffI notI | erule (1) notE impE | erule iffE notE)+ done lemma all_cong: - assumes "!!x. P(x) <-> Q(x)" - shows "(ALL x. P(x)) <-> (ALL x. Q(x))" + assumes "\x. P(x) \ Q(x)" + shows "(\x. P(x)) \ (\x. Q(x))" apply (assumption | rule iffI allI | erule (1) notE impE | erule allE | iff assms)+ done lemma ex_cong: - assumes "!!x. P(x) <-> Q(x)" - shows "(EX x. P(x)) <-> (EX x. Q(x))" + assumes "\x. P(x) \ Q(x)" + shows "(\x. P(x)) \ (\x. Q(x))" apply (erule exE | assumption | rule iffI exI | erule (1) notE impE | iff assms)+ done lemma ex1_cong: - assumes "!!x. P(x) <-> Q(x)" - shows "(EX! x. P(x)) <-> (EX! x. Q(x))" + assumes "\x. P(x) \ Q(x)" + shows "(\!x. P(x)) \ (\!x. Q(x))" apply (erule ex1E spec [THEN mp] | assumption | rule iffI ex1I | erule (1) notE impE | iff assms)+ done -(*** Equality rules ***) -lemma sym: "a=b ==> b=a" +subsection \Equality rules\ + +lemma sym: "a = b \ b = a" apply (erule subst) apply (rule refl) done -lemma trans: "[| a=b; b=c |] ==> a=c" +lemma trans: "\a = b; b = c\ \ a = c" apply (erule subst, assumption) done -(** **) -lemma not_sym: "b ~= a ==> a ~= b" +lemma not_sym: "b \ a \ a \ b" apply (erule contrapos) apply (erule sym) done - -(* Two theorms for rewriting only one instance of a definition: - the first for definitions of formulae and the second for terms *) -lemma def_imp_iff: "(A == B) ==> A <-> B" +text \ + Two theorems for rewriting only one instance of a definition: + the first for definitions of formulae and the second for terms. +\ + +lemma def_imp_iff: "(A \ B) \ A \ B" apply unfold apply (rule iff_refl) done -lemma meta_eq_to_obj_eq: "(A == B) ==> A = B" +lemma meta_eq_to_obj_eq: "(A \ B) \ A = B" apply unfold apply (rule refl) done -lemma meta_eq_to_iff: "x==y ==> x<->y" +lemma meta_eq_to_iff: "x \ y \ x \ y" by unfold (rule iff_refl) -(*substitution*) -lemma ssubst: "[| b = a; P(a) |] ==> P(b)" +text \Substitution.\ +lemma ssubst: "\b = a; P(a)\ \ P(b)" apply (drule sym) apply (erule (1) subst) done -(*A special case of ex1E that would otherwise need quantifier expansion*) -lemma ex1_equalsE: - "[| EX! x. P(x); P(a); P(b) |] ==> a=b" +text \A special case of @{text ex1E} that would otherwise need quantifier + expansion.\ +lemma ex1_equalsE: "\\!x. P(x); P(a); P(b)\ \ a = b" apply (erule ex1E) apply (rule trans) apply (rule_tac [2] sym) apply (assumption | erule spec [THEN mp])+ done -(** Polymorphic congruence rules **) -lemma subst_context: "[| a=b |] ==> t(a)=t(b)" +subsubsection \Polymorphic congruence rules\ + +lemma subst_context: "a = b \ t(a) = t(b)" apply (erule ssubst) apply (rule refl) done -lemma subst_context2: "[| a=b; c=d |] ==> t(a,c)=t(b,d)" +lemma subst_context2: "\a = b; c = d\ \ t(a,c) = t(b,d)" + apply (erule ssubst)+ + apply (rule refl) + done + +lemma subst_context3: "\a = b; c = d; e = f\ \ t(a,c,e) = t(b,d,f)" apply (erule ssubst)+ apply (rule refl) done -lemma subst_context3: "[| a=b; c=d; e=f |] ==> t(a,c,e)=t(b,d,f)" - apply (erule ssubst)+ - apply (rule refl) - done +text \ + Useful with @{ML eresolve_tac} for proving equalties from known + equalities. -(*Useful with eresolve_tac for proving equalties from known equalities. a = b | | - c = d *) -lemma box_equals: "[| a=b; a=c; b=d |] ==> c=d" + c = d +\ +lemma box_equals: "\a = b; a = c; b = d\ \ c = d" apply (rule trans) apply (rule trans) apply (rule sym) apply assumption+ done -(*Dual of box_equals: for proving equalities backwards*) -lemma simp_equals: "[| a=c; b=d; c=d |] ==> a=b" +text \Dual of box_equals: for proving equalities backwards.\ +lemma simp_equals: "\a = c; b = d; c = d\ \ a = b" apply (rule trans) apply (rule trans) apply assumption+ apply (erule sym) done -(** Congruence rules for predicate letters **) -lemma pred1_cong: "a=a' ==> P(a) <-> P(a')" +subsubsection \Congruence rules for predicate letters\ + +lemma pred1_cong: "a = a' \ P(a) \ P(a')" apply (rule iffI) apply (erule (1) subst) apply (erule (1) ssubst) done -lemma pred2_cong: "[| a=a'; b=b' |] ==> P(a,b) <-> P(a',b')" +lemma pred2_cong: "\a = a'; b = b'\ \ P(a,b) \ P(a',b')" apply (rule iffI) apply (erule subst)+ apply assumption @@ -457,7 +482,7 @@ apply assumption done -lemma pred3_cong: "[| a=a'; b=b'; c=c' |] ==> P(a,b,c) <-> P(a',b',c')" +lemma pred3_cong: "\a = a'; b = b'; c = c'\ \ P(a,b,c) \ P(a',b',c')" apply (rule iffI) apply (erule subst)+ apply assumption @@ -465,81 +490,85 @@ apply assumption done -(*special case for the equality predicate!*) -lemma eq_cong: "[| a = a'; b = b' |] ==> a = b <-> a' = b'" +text \Special case for the equality predicate!\ +lemma eq_cong: "\a = a'; b = b'\ \ a = b \ a' = b'" apply (erule (1) pred2_cong) done -(*** Simplifications of assumed implications. - Roy Dyckhoff has proved that conj_impE, disj_impE, and imp_impE - used with mp_tac (restricted to atomic formulae) is COMPLETE for - intuitionistic propositional logic. See - R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic - (preprint, University of St Andrews, 1991) ***) +subsection \Simplifications of assumed implications\ + +text \ + Roy Dyckhoff has proved that @{text conj_impE}, @{text disj_impE}, and + @{text imp_impE} used with @{ML mp_tac} (restricted to atomic formulae) is + COMPLETE for intuitionistic propositional logic. + + See R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic + (preprint, University of St Andrews, 1991). +\ lemma conj_impE: - assumes major: "(P&Q)-->S" - and r: "P-->(Q-->S) ==> R" + assumes major: "(P \ Q) \ S" + and r: "P \ (Q \ S) \ R" shows R by (assumption | rule conjI impI major [THEN mp] r)+ lemma disj_impE: - assumes major: "(P|Q)-->S" - and r: "[| P-->S; Q-->S |] ==> R" + assumes major: "(P \ Q) \ S" + and r: "\P \ S; Q \ S\ \ R" shows R by (assumption | rule disjI1 disjI2 impI major [THEN mp] r)+ -(*Simplifies the implication. Classical version is stronger. - Still UNSAFE since Q must be provable -- backtracking needed. *) +text \Simplifies the implication. Classical version is stronger. + Still UNSAFE since Q must be provable -- backtracking needed.\ lemma imp_impE: - assumes major: "(P-->Q)-->S" - and r1: "[| P; Q-->S |] ==> Q" - and r2: "S ==> R" + assumes major: "(P \ Q) \ S" + and r1: "\P; Q \ S\ \ Q" + and r2: "S \ R" shows R by (assumption | rule impI major [THEN mp] r1 r2)+ -(*Simplifies the implication. Classical version is stronger. - Still UNSAFE since ~P must be provable -- backtracking needed. *) -lemma not_impE: - "~P --> S \ (P ==> False) \ (S ==> R) \ R" +text \Simplifies the implication. Classical version is stronger. + Still UNSAFE since ~P must be provable -- backtracking needed.\ +lemma not_impE: "\ P \ S \ (P \ False) \ (S \ R) \ R" apply (drule mp) apply (rule notI) apply assumption apply assumption done -(*Simplifies the implication. UNSAFE. *) +text \Simplifies the implication. UNSAFE.\ lemma iff_impE: - assumes major: "(P<->Q)-->S" - and r1: "[| P; Q-->S |] ==> Q" - and r2: "[| Q; P-->S |] ==> P" - and r3: "S ==> R" + assumes major: "(P \ Q) \ S" + and r1: "\P; Q \ S\ \ Q" + and r2: "\Q; P \ S\ \ P" + and r3: "S \ R" shows R apply (assumption | rule iffI impI major [THEN mp] r1 r2 r3)+ done -(*What if (ALL x.~~P(x)) --> ~~(ALL x.P(x)) is an assumption? UNSAFE*) +text \What if @{text "(\x. \ \ P(x)) \ \ \ (\x. P(x))"} is an assumption? + UNSAFE.\ lemma all_impE: - assumes major: "(ALL x. P(x))-->S" - and r1: "!!x. P(x)" - and r2: "S ==> R" + assumes major: "(\x. P(x)) \ S" + and r1: "\x. P(x)" + and r2: "S \ R" shows R apply (rule allI impI major [THEN mp] r1 r2)+ done -(*Unsafe: (EX x.P(x))-->S is equivalent to ALL x.P(x)-->S. *) +text \ + Unsafe: @{text "\x. P(x)) \ S"} is equivalent + to @{text "\x. P(x) \ S"}.\ lemma ex_impE: - assumes major: "(EX x. P(x))-->S" - and r: "P(x)-->S ==> R" + assumes major: "(\x. P(x)) \ S" + and r: "P(x) \ S \ R" shows R apply (assumption | rule exI impI major [THEN mp] r)+ done -(*** Courtesy of Krzysztof Grabczewski ***) - -lemma disj_imp_disj: - "P|Q \ (P==>R) \ (Q==>S) \ R|S" +text \Courtesy of Krzysztof Grabczewski.\ +lemma disj_imp_disj: "P \ Q \ (P \ R) \ (Q \ S) \ R \ S" apply (erule disjE) apply (rule disjI1) apply assumption apply (rule disjI2) apply assumption @@ -556,7 +585,7 @@ ML_file "fologic.ML" -lemma thin_refl: "[|x=x; PROP W|] ==> PROP W" . +lemma thin_refl: "\x = x; PROP W\ \ PROP W" . ML \ structure Hypsubst = Hypsubst @@ -583,9 +612,9 @@ setup \Intuitionistic.method_setup @{binding iprover}\ lemma impE': - assumes 1: "P --> Q" - and 2: "Q ==> R" - and 3: "P --> Q ==> P" + assumes 1: "P \ Q" + and 2: "Q \ R" + and 3: "P \ Q \ P" shows R proof - from 3 and 1 have P . @@ -594,8 +623,8 @@ qed lemma allE': - assumes 1: "ALL x. P(x)" - and 2: "P(x) ==> ALL x. P(x) ==> Q" + assumes 1: "\x. P(x)" + and 2: "P(x) \ \x. P(x) \ Q" shows Q proof - from 1 have "P(x)" by (rule spec) @@ -603,8 +632,8 @@ qed lemma notE': - assumes 1: "~ P" - and 2: "~ P ==> P" + assumes 1: "\ P" + and 2: "\ P \ P" shows R proof - from 2 and 1 have P . @@ -616,70 +645,73 @@ and [Pure.elim 2] = allE notE' impE' and [Pure.intro] = exI disjI2 disjI1 -setup \Context_Rules.addSWrapper (fn ctxt => fn tac => hyp_subst_tac ctxt ORELSE' tac)\ +setup \ + Context_Rules.addSWrapper + (fn ctxt => fn tac => hyp_subst_tac ctxt ORELSE' tac) +\ -lemma iff_not_sym: "~ (Q <-> P) ==> ~ (P <-> Q)" +lemma iff_not_sym: "\ (Q \ P) \ \ (P \ Q)" by iprover lemmas [sym] = sym iff_sym not_sym iff_not_sym and [Pure.elim?] = iffD1 iffD2 impE -lemma eq_commute: "a=b <-> b=a" -apply (rule iffI) -apply (erule sym)+ -done +lemma eq_commute: "a = b \ b = a" + apply (rule iffI) + apply (erule sym)+ + done subsection \Atomizing meta-level rules\ -lemma atomize_all [atomize]: "(!!x. P(x)) == Trueprop (ALL x. P(x))" +lemma atomize_all [atomize]: "(\x. P(x)) \ Trueprop (\x. P(x))" proof - assume "!!x. P(x)" - then show "ALL x. P(x)" .. + assume "\x. P(x)" + then show "\x. P(x)" .. next - assume "ALL x. P(x)" - then show "!!x. P(x)" .. + assume "\x. P(x)" + then show "\x. P(x)" .. qed -lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)" +lemma atomize_imp [atomize]: "(A \ B) \ Trueprop (A \ B)" proof - assume "A ==> B" - then show "A --> B" .. + assume "A \ B" + then show "A \ B" .. next - assume "A --> B" and A + assume "A \ B" and A then show B by (rule mp) qed -lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)" +lemma atomize_eq [atomize]: "(x \ y) \ Trueprop (x = y)" proof - assume "x == y" - show "x = y" unfolding \x == y\ by (rule refl) + assume "x \ y" + show "x = y" unfolding \x \ y\ by (rule refl) next assume "x = y" - then show "x == y" by (rule eq_reflection) + then show "x \ y" by (rule eq_reflection) qed -lemma atomize_iff [atomize]: "(A == B) == Trueprop (A <-> B)" +lemma atomize_iff [atomize]: "(A \ B) \ Trueprop (A \ B)" proof - assume "A == B" - show "A <-> B" unfolding \A == B\ by (rule iff_refl) + assume "A \ B" + show "A \ B" unfolding \A \ B\ by (rule iff_refl) next - assume "A <-> B" - then show "A == B" by (rule iff_reflection) + assume "A \ B" + then show "A \ B" by (rule iff_reflection) qed -lemma atomize_conj [atomize]: "(A &&& B) == Trueprop (A & B)" +lemma atomize_conj [atomize]: "(A &&& B) \ Trueprop (A \ B)" proof assume conj: "A &&& B" - show "A & B" + show "A \ B" proof (rule conjI) from conj show A by (rule conjunctionD1) from conj show B by (rule conjunctionD2) qed next - assume conj: "A & B" + assume conj: "A \ B" show "A &&& B" proof - from conj show A .. @@ -693,24 +725,24 @@ subsection \Atomizing elimination rules\ -lemma atomize_exL[atomize_elim]: "(!!x. P(x) ==> Q) == ((EX x. P(x)) ==> Q)" +lemma atomize_exL[atomize_elim]: "(\x. P(x) \ Q) \ ((\x. P(x)) \ Q)" by rule iprover+ -lemma atomize_conjL[atomize_elim]: "(A ==> B ==> C) == (A & B ==> C)" +lemma atomize_conjL[atomize_elim]: "(A \ B \ C) \ (A \ B \ C)" by rule iprover+ -lemma atomize_disjL[atomize_elim]: "((A ==> C) ==> (B ==> C) ==> C) == ((A | B ==> C) ==> C)" +lemma atomize_disjL[atomize_elim]: "((A \ C) \ (B \ C) \ C) \ ((A \ B \ C) \ C)" by rule iprover+ -lemma atomize_elimL[atomize_elim]: "(!!B. (A ==> B) ==> B) == Trueprop(A)" .. +lemma atomize_elimL[atomize_elim]: "(\B. (A \ B) \ B) \ Trueprop(A)" .. subsection \Calculational rules\ -lemma forw_subst: "a = b ==> P(b) ==> P(a)" +lemma forw_subst: "a = b \ P(b) \ P(a)" by (rule ssubst) -lemma back_subst: "P(a) ==> a = b ==> P(b)" +lemma back_subst: "P(a) \ a = b \ P(b)" by (rule subst) text \ @@ -724,12 +756,13 @@ mp trans + subsection \``Let'' declarations\ nonterminal letbinds and letbind -definition Let :: "['a::{}, 'a => 'b] => ('b::{})" where - "Let(s, f) == f(s)" +definition Let :: "['a::{}, 'a => 'b] \ ('b::{})" + where "Let(s, f) \ f(s)" syntax "_bind" :: "[pttrn, 'a] => letbind" ("(2_ =/ _)" 10) @@ -739,12 +772,11 @@ translations "_Let(_binds(b, bs), e)" == "_Let(b, _Let(bs, e))" - "let x = a in e" == "CONST Let(a, %x. e)" - + "let x = a in e" == "CONST Let(a, \x. e)" -lemma LetI: - assumes "!!x. x=t ==> P(u(x))" - shows "P(let x=t in u(x))" +lemma LetI: + assumes "\x. x = t \ P(u(x))" + shows "P(let x = t in u(x))" apply (unfold Let_def) apply (rule refl [THEN assms]) done @@ -753,108 +785,113 @@ subsection \Intuitionistic simplification rules\ lemma conj_simps: - "P & True <-> P" - "True & P <-> P" - "P & False <-> False" - "False & P <-> False" - "P & P <-> P" - "P & P & Q <-> P & Q" - "P & ~P <-> False" - "~P & P <-> False" - "(P & Q) & R <-> P & (Q & R)" + "P \ True \ P" + "True \ P \ P" + "P \ False \ False" + "False \ P \ False" + "P \ P \ P" + "P \ P \ Q \ P \ Q" + "P \ \ P \ False" + "\ P \ P \ False" + "(P \ Q) \ R \ P \ (Q \ R)" by iprover+ lemma disj_simps: - "P | True <-> True" - "True | P <-> True" - "P | False <-> P" - "False | P <-> P" - "P | P <-> P" - "P | P | Q <-> P | Q" - "(P | Q) | R <-> P | (Q | R)" + "P \ True \ True" + "True \ P \ True" + "P \ False \ P" + "False \ P \ P" + "P \ P \ P" + "P \ P \ Q \ P \ Q" + "(P \ Q) \ R \ P \ (Q \ R)" by iprover+ lemma not_simps: - "~(P|Q) <-> ~P & ~Q" - "~ False <-> True" - "~ True <-> False" + "\ (P \ Q) \ \ P \ \ Q" + "\ False \ True" + "\ True \ False" by iprover+ lemma imp_simps: - "(P --> False) <-> ~P" - "(P --> True) <-> True" - "(False --> P) <-> True" - "(True --> P) <-> P" - "(P --> P) <-> True" - "(P --> ~P) <-> ~P" + "(P \ False) \ \ P" + "(P \ True) \ True" + "(False \ P) \ True" + "(True \ P) \ P" + "(P \ P) \ True" + "(P \ \ P) \ \ P" by iprover+ lemma iff_simps: - "(True <-> P) <-> P" - "(P <-> True) <-> P" - "(P <-> P) <-> True" - "(False <-> P) <-> ~P" - "(P <-> False) <-> ~P" + "(True \ P) \ P" + "(P \ True) \ P" + "(P \ P) \ True" + "(False \ P) \ \ P" + "(P \ False) \ \ P" by iprover+ -(*The x=t versions are needed for the simplification procedures*) +text \The @{text "x = t"} versions are needed for the simplification + procedures.\ lemma quant_simps: - "!!P. (ALL x. P) <-> P" - "(ALL x. x=t --> P(x)) <-> P(t)" - "(ALL x. t=x --> P(x)) <-> P(t)" - "!!P. (EX x. P) <-> P" - "EX x. x=t" - "EX x. t=x" - "(EX x. x=t & P(x)) <-> P(t)" - "(EX x. t=x & P(x)) <-> P(t)" + "\P. (\x. P) \ P" + "(\x. x = t \ P(x)) \ P(t)" + "(\x. t = x \ P(x)) \ P(t)" + "\P. (\x. P) \ P" + "\x. x = t" + "\x. t = x" + "(\x. x = t \ P(x)) \ P(t)" + "(\x. t = x \ P(x)) \ P(t)" by iprover+ -(*These are NOT supplied by default!*) +text \These are NOT supplied by default!\ lemma distrib_simps: - "P & (Q | R) <-> P&Q | P&R" - "(Q | R) & P <-> Q&P | R&P" - "(P | Q --> R) <-> (P --> R) & (Q --> R)" + "P \ (Q \ R) \ P \ Q \ P \ R" + "(Q \ R) \ P \ Q \ P \ R \ P" + "(P \ Q \ R) \ (P \ R) \ (Q \ R)" by iprover+ -text \Conversion into rewrite rules\ +subsubsection \Conversion into rewrite rules\ -lemma P_iff_F: "~P ==> (P <-> False)" by iprover -lemma iff_reflection_F: "~P ==> (P == False)" by (rule P_iff_F [THEN iff_reflection]) +lemma P_iff_F: "\ P \ (P \ False)" + by iprover +lemma iff_reflection_F: "\ P \ (P \ False)" + by (rule P_iff_F [THEN iff_reflection]) -lemma P_iff_T: "P ==> (P <-> True)" by iprover -lemma iff_reflection_T: "P ==> (P == True)" by (rule P_iff_T [THEN iff_reflection]) +lemma P_iff_T: "P \ (P \ True)" + by iprover +lemma iff_reflection_T: "P \ (P \ True)" + by (rule P_iff_T [THEN iff_reflection]) -text \More rewrite rules\ +subsubsection \More rewrite rules\ -lemma conj_commute: "P&Q <-> Q&P" by iprover -lemma conj_left_commute: "P&(Q&R) <-> Q&(P&R)" by iprover +lemma conj_commute: "P \ Q \ Q \ P" by iprover +lemma conj_left_commute: "P \ (Q \ R) \ Q \ (P \ R)" by iprover lemmas conj_comms = conj_commute conj_left_commute -lemma disj_commute: "P|Q <-> Q|P" by iprover -lemma disj_left_commute: "P|(Q|R) <-> Q|(P|R)" by iprover +lemma disj_commute: "P \ Q \ Q \ P" by iprover +lemma disj_left_commute: "P \ (Q \ R) \ Q \ (P \ R)" by iprover lemmas disj_comms = disj_commute disj_left_commute -lemma conj_disj_distribL: "P&(Q|R) <-> (P&Q | P&R)" by iprover -lemma conj_disj_distribR: "(P|Q)&R <-> (P&R | Q&R)" by iprover +lemma conj_disj_distribL: "P \ (Q \ R) \ (P \ Q \ P \ R)" by iprover +lemma conj_disj_distribR: "(P \ Q) \ R \ (P \ R \ Q \ R)" by iprover -lemma disj_conj_distribL: "P|(Q&R) <-> (P|Q) & (P|R)" by iprover -lemma disj_conj_distribR: "(P&Q)|R <-> (P|R) & (Q|R)" by iprover +lemma disj_conj_distribL: "P \ (Q \ R) \ (P \ Q) \ (P \ R)" by iprover +lemma disj_conj_distribR: "(P \ Q) \ R \ (P \ R) \ (Q \ R)" by iprover -lemma imp_conj_distrib: "(P --> (Q&R)) <-> (P-->Q) & (P-->R)" by iprover -lemma imp_conj: "((P&Q)-->R) <-> (P --> (Q --> R))" by iprover -lemma imp_disj: "(P|Q --> R) <-> (P-->R) & (Q-->R)" by iprover +lemma imp_conj_distrib: "(P \ (Q \ R)) \ (P \ Q) \ (P \ R)" by iprover +lemma imp_conj: "((P \ Q) \ R) \ (P \ (Q \ R))" by iprover +lemma imp_disj: "(P \ Q \ R) \ (P \ R) \ (Q \ R)" by iprover -lemma de_Morgan_disj: "(~(P | Q)) <-> (~P & ~Q)" by iprover +lemma de_Morgan_disj: "(\ (P \ Q)) \ (\ P \ \ Q)" by iprover -lemma not_ex: "(~ (EX x. P(x))) <-> (ALL x.~P(x))" by iprover -lemma imp_ex: "((EX x. P(x)) --> Q) <-> (ALL x. P(x) --> Q)" by iprover +lemma not_ex: "(\ (\x. P(x))) \ (\x. \ P(x))" by iprover +lemma imp_ex: "((\x. P(x)) \ Q) \ (\x. P(x) \ Q)" by iprover -lemma ex_disj_distrib: - "(EX x. P(x) | Q(x)) <-> ((EX x. P(x)) | (EX x. Q(x)))" by iprover +lemma ex_disj_distrib: "(\x. P(x) \ Q(x)) \ ((\x. P(x)) \ (\x. Q(x)))" + by iprover -lemma all_conj_distrib: - "(ALL x. P(x) & Q(x)) <-> ((ALL x. P(x)) & (ALL x. Q(x)))" by iprover +lemma all_conj_distrib: "(\x. P(x) \ Q(x)) \ ((\x. P(x)) \ (\x. Q(x)))" + by iprover end diff -r 3590367b0ce9 -r f8cb97e0fd0b src/FOL/ex/Locale_Test/Locale_Test1.thy --- a/src/FOL/ex/Locale_Test/Locale_Test1.thy Mon Oct 19 17:45:36 2015 +0200 +++ b/src/FOL/ex/Locale_Test/Locale_Test1.thy Mon Oct 19 20:29:29 2015 +0200 @@ -162,8 +162,8 @@ declare [[show_hyps]] ML \ - check_syntax @{context} @{thm d1_def} "d1(?x) <-> ~ p2(p1(?x))"; - check_syntax @{context} @{thm d2_def} "d2(?x) <-> ~ p2(?x)"; + check_syntax @{context} @{thm d1_def} "d1(?x) \ \ p2(p1(?x))"; + check_syntax @{context} @{thm d2_def} "d2(?x) \ \ p2(?x)"; \ end @@ -175,8 +175,8 @@ (* should print as "syntax.d1(p3, p2, ?x) <-> ..." and "d2(?x) <-> ..." *) ML \ - check_syntax @{context} @{thm d1_def} "syntax.d1(p3, p2, ?x) <-> ~ p2(p3(?x))"; - check_syntax @{context} @{thm d2_def} "d2(?x) <-> ~ p2(?x)"; + check_syntax @{context} @{thm d1_def} "syntax.d1(p3, p2, ?x) \ \ p2(p3(?x))"; + check_syntax @{context} @{thm d2_def} "d2(?x) \ \ p2(?x)"; \ end