lemma"[P x y z; Suc x < y]==> f z = x*y" txt‹
{subgoals[display,indent=0,margin=65]} › apply (subst mult.commute) txt‹
{subgoals[display,indent=0,margin=65]} › oops
(*exercise involving THEN*) lemma"[P x y z; Suc x < y]==> f z = x*y" apply (rule mult.commute [THEN ssubst]) oops
lemma"[x = f x; triple (f x) (f x) x]==> triple x x x" apply (erule ssubst) ―‹@{subgoals[display,indent=0,margin=65]}› back―‹@{subgoals[display,indent=0,margin=65]}› back―‹@{subgoals[display,indent=0,margin=65]}› back―‹@{subgoals[display,indent=0,margin=65]}› back―‹@{subgoals[display,indent=0,margin=65]}› apply assumption done
lemma"[ x = f x; triple (f x) (f x) x ]==> triple x x x" apply (erule ssubst, assumption) done
text‹
better still ›
lemma"[ x = f x; triple (f x) (f x) x ]==> triple x x x" by (erule ssubst)
lemma"[ x = f x; triple (f x) (f x) x ]==> triple x x x" apply (erule_tac P="λu. triple u u x"in ssubst) apply (assumption) done
lemma"[ x = f x; triple (f x) (f x) x ]==> triple x x x" by (erule_tac P="λu. triple u u x"in ssubst)
lemma"P&Q" apply (rule_tac P=P and Q=Q in conjI) oops
text‹unification failure trace›
declare [[unify_trace_failure = true]]
lemma"P(a, f(b, g(e,a), b), a) ==> P(a, f(b, g(c,a), b), a)" txt‹
{subgoals[display,indent=0,margin=65]}
assumption
: e =/= c
: == =/= Trueprop › oops
lemma"∀x y. P(x,y) --> P(y,x)" apply auto txt‹
{subgoals[display,indent=0,margin=65]}
assumption
: bound variable x (depth 1) =/= bound variable y (depth 0)
: == =/= Trueprop
: == =/= Trueprop › oops
declare [[unify_trace_failure = false]]
text‹Quantifiers›
text‹
{thm[display] allI}
rulename{allI}
{thm[display] allE}
rulename{allE}
{thm[display] spec}
rulename{spec} ›
lemma"∀x. P x ⟶ P x" apply (rule allI) by (rule impI)
lemma"(∀x. P ⟶ Q x) ==> P ⟶ (∀x. Q x)" apply (rule impI, rule allI) apply (drule spec) by (drule mp)
text‹rename_tac› lemma"x < y ==>∀x y. P x (f y)" apply (intro allI) ―‹@{subgoals[display,indent=0,margin=65]}› apply (rename_tac v w) ―‹@{subgoals[display,indent=0,margin=65]}› oops
lemma"[∀x. P x ⟶ P (h x); P a]==> P(h (h a))" apply (frule spec) ―‹@{subgoals[display,indent=0,margin=65]}› apply (drule mp, assumption) apply (drule spec) ―‹@{subgoals[display,indent=0,margin=65]}› by (drule mp)
lemma"[∀x. P x ⟶ P (f x); P a]==> P(f (f a))" by blast
text‹
existential quantifier›
text‹
{thm[display]"exI"}
rulename{exI}
{thm[display]"exE"}
rulename{exE} ›
text‹
quantifiers explicitly by rule_tac and erule_tac›
lemma"[∀x. P x ⟶ P (h x); P a]==> P(h (h a))" apply (frule spec) ―‹@{subgoals[display,indent=0,margin=65]}› apply (drule mp, assumption) ―‹@{subgoals[display,indent=0,margin=65]}› apply (drule_tac x = "h a"in spec) ―‹@{subgoals[display,indent=0,margin=65]}› by (drule mp)
text‹
{thm[display]"dvd_def"}
rulename{dvd_def} ›
lemma mult_dvd_mono: "[i dvd m; j dvd n]==> i*j dvd (m*n :: nat)" apply (simp add: dvd_def) ―‹@{subgoals[display,indent=0,margin=65]}› apply (erule exE) ―‹@{subgoals[display,indent=0,margin=65]}› apply (erule exE) ―‹@{subgoals[display,indent=0,margin=65]}› apply (rename_tac l) ―‹@{subgoals[display,indent=0,margin=65]}› apply (rule_tac x="k*l"in exI) ―‹@{subgoals[display,indent=0,margin=65]}› apply simp done
theorem Least_equality: "[ P (k::nat); ∀x. P x ⟶ k ≤ x ]==> (LEAST x. P(x)) = k" apply (simp add: Least_def)
txt‹
{subgoals[display,indent=0,margin=65]} ›
apply (rule the_equality)
txt‹
{subgoals[display,indent=0,margin=65]}
subgoal is existence; second is uniqueness › by (auto intro: order_antisym)
theorem axiom_of_choice: "(∀x. ∃y. P x y) ==>∃f. ∀x. P x (f x)" apply (rule exI, rule allI)
txt‹
{subgoals[display,indent=0,margin=65]}
after intro rules › apply (drule spec, erule exE)
txt‹
{subgoals[display,indent=0,margin=65]}
@text{someI} automatically instantiates term‹f› to term‹λx. SOME y. P x y› ›
by (rule someI)
(*both can be done by blast, which however hasn't been introduced yet*) lemma"[| P (k::nat); ∀x. P x ⟶ k ≤ x |] ==> (LEAST x. P(x)) = k" apply (simp add: Least_def) by (blast intro: order_antisym)
theorem axiom_of_choice': "(∀x. ∃y. P x y) ==>∃f. ∀x. P x (f x)" apply (rule exI [of _ "λx. SOME y. P x y"]) by (blast intro: someI)
text‹end of Epsilon section›
lemma"(∃x. P x) ∨ (∃x. Q x) ==>∃x. P x ∨ Q x" apply (elim exE disjE) apply (intro exI disjI1) apply assumption apply (intro exI disjI2) apply assumption done
lemma"∀y. R y y ==>∃x. ∀y. R x y" apply (rule exI) ―‹@{subgoals[display,indent=0,margin=65]}› apply (rule allI) ―‹@{subgoals[display,indent=0,margin=65]}› apply (drule spec) ―‹@{subgoals[display,indent=0,margin=65]}› oops
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.