notation (ASCII)
not_equal (infixl‹~=›50) and
Not (‹(‹open_block notation=‹prefix ~››~ _)› [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›
lemmas strip = impI allI
lemma TrueI: ‹True› unfolding True_def by (rule impI)
subsubsection‹Sequent-style elimination rules for ‹∧›‹⟶› and ‹∀››
lemma conjE: assumes major: ‹P ∧ Q› and r: ‹[P; Q]==> R› shows‹R› proof (rule r) show"P" by (rule major [THEN conjunct1]) show"Q" by (rule major [THEN conjunct2]) qed
lemma impE: assumes major: ‹P ⟶ Q› and‹P› and r: ‹Q ==> R› shows‹R› proof (rule r) show"Q" by (rule mp [OF major ‹P›]) qed
lemma allE: assumes major: ‹∀x. P(x)› and r: ‹P(x) ==> R› shows‹R› proof (rule r) show"P(x)" by (rule major [THEN spec]) qed
text‹Duplicates the quantifier; for use with 🪙‹eresolve_tac›.› lemma all_dupE: assumes major: ‹∀x. P(x)› and r: ‹[P(x); ∀x. P(x)]==> R› shows‹R› proof (rule r) show"P(x)" by (rule major [THEN spec]) qed (rule major)
subsubsection‹Negation rules, which translate between ‹¬ P› and ‹P ⟶ False››
text‹This is useful with the special implication rules for each kind of ‹P›.› lemma not_to_imp: assumes‹¬ P› and r: ‹P ⟶ False ==> Q› shows‹Q› apply (rule r) apply (rule impI) apply (erule notE [OF ‹¬ P›]) done
text‹
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› by (erule mp)
text‹Contrapositive of an inference rule.› lemma contrapos: assumes major: ‹¬ Q› and minor: ‹P ==> Q› shows‹¬ P› apply (rule major [THENnotE, THEN notI]) apply (erule minor) done
subsubsection‹Modus Ponens Tactics›
text‹
Finds ‹P ⟶ Q› and P in the assumptions, replaces implication by ‹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; ›
subsection‹If-and-only-if›
lemma iffI: ‹[P ==> Q; Q ==> P]==> P ⟷ Q› unfolding iff_def by (rule conjI; erule impI)
lemma iffE: assumes major: ‹P ⟷ Q› and r: ‹[P ⟶ Q; Q ⟶ P]==> R› shows‹R› using major unfolding iff_def apply (rule conjE) apply (erule r) apply assumption done
subsubsection‹Destruct rules for ‹⟷› similar to Modus Ponens›
subsubsection‹‹⟷› congruence rules for simplification›
text‹Use ‹iffE› on a premise. For ‹conj_cong›, ‹imp_cong›, ‹all_cong›, ‹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); ›
text‹A special case of ‹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
subsection‹Simplifications of assumed implications›
text‹
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). ›
lemma conj_impE: 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› shows‹R› by (assumption | rule disjI1 disjI2 impI major [THEN mp] r)+
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› shows‹R› by (assumption | rule impI major [THEN mp] r1 r2)+
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 | assumption)+ done
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› shows‹R› by (assumption | rule iffI impI major [THEN mp] r1 r2 r3)+
text‹What if ‹(∀x. ¬¬ P(x)) ⟶¬¬ (∀x. P(x))› is an assumption?
UNSAFE.› lemma all_impE: assumes major: ‹(∀x. P(x)) ⟶ S› and r1: ‹∧x. P(x)› and r2: ‹S ==> R› shows‹R› by (rule allI impI major [THEN mp] r1 r2)+
text‹
Unsafe: ‹∃x. P(x)) ⟶ S› is equivalent
to ‹∀x. P(x) ⟶ S›.› lemma ex_impE: assumes major: ‹(∃x. P(x)) ⟶ S› and r: ‹P(x) ⟶ S ==> R› shows‹R› by (assumption | rule exI impI major [THEN mp] r)+
val conjunct1 = @{thm conjunct1}
val conjunct2 = @{thm conjunct2}
val mp = @{thm mp}
›
ML_file ‹fologic.ML›
lemma thin_refl: ‹[x = x; PROP W]==> PROP W› .
ML ‹
Hypsubst = Hypsubst
val dest_eq = FOLogic.dest_eq
val dest_Trueprop = 🍋
val dest_imp = FOLogic.dest_imp
val eq_reflection = @{thm eq_reflection}
val rev_eq_reflection = @{thm meta_eq_to_obj_eq}
val imp_intr = @{thm impI}
val rev_mp = @{thm rev_mp}
val subst = @{thm subst}
val sym = @{thm sym}
val thin_refl = @{thm thin_refl}
;
Hypsubst; ›
text‹The ‹x = t› versions are needed for the simplification
procedures.› lemma quant_simps: ‹∧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+
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)› by iprover+
lemma subst_all: ‹(∧x. x = a ==> PROP P(x)) ≡ PROP P(a)› ‹(∧x. a = x ==> PROP P(x)) ≡ PROP P(a)› proof - show‹(∧x. x = a ==> PROP P(x)) ≡ PROP P(a)› proof (rule equal_intr_rule) assume *: ‹∧x. x = a ==> PROP P(x)› show‹PROP P(a)› by (rule *) (rule refl) next fix x assume‹PROP P(a)›and‹x = a› from‹x = a›have‹x ≡ a› by (rule eq_reflection) with‹PROP P(a)›show‹PROP P(x)› by simp qed show‹(∧x. a = x ==> PROP P(x)) ≡ PROP P(a)› proof (rule equal_intr_rule) assume *: ‹∧x. a = x ==> PROP P(x)› show‹PROP P(a)› by (rule *) (rule refl) next fix x assume‹PROP P(a)›and‹a = x› from‹a = x›have‹a ≡ x› by (rule eq_reflection) with‹PROP P(a)›show‹PROP P(x)› by simp qed qed
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])
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.