19819

1 
(* Title: FOL/ex/Intro.thy


2 
ID: $Id$


3 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory


4 
Copyright 1992 University of Cambridge


5 


6 
Derives some inference rules, illustrating the use of definitions.


7 
*)


8 


9 
header {* Examples for the manual ``Introduction to Isabelle'' *}


10 


11 
theory Intro


12 
imports FOL


13 
begin


14 


15 
subsubsection {* Some simple backward proofs *}


16 


17 
lemma mythm: "PP > P"


18 
apply (rule impI)


19 
apply (rule disjE)


20 
prefer 3 apply (assumption)


21 
prefer 2 apply (assumption)


22 
apply assumption


23 
done


24 


25 
lemma "(P & Q)  R > (P  R)"


26 
apply (rule impI)


27 
apply (erule disjE)


28 
apply (drule conjunct1)


29 
apply (rule disjI1)


30 
apply (rule_tac [2] disjI2)


31 
apply assumption+


32 
done


33 


34 
(*Correct version, delaying use of "spec" until last*)


35 
lemma "(ALL x y. P(x,y)) > (ALL z w. P(w,z))"


36 
apply (rule impI)


37 
apply (rule allI)


38 
apply (rule allI)


39 
apply (drule spec)


40 
apply (drule spec)


41 
apply assumption


42 
done


43 


44 


45 
subsubsection {* Demonstration of @{text "fast"} *}


46 


47 
lemma "(EX y. ALL x. J(y,x) <> ~J(x,x))


48 
> ~ (ALL x. EX y. ALL z. J(z,y) <> ~ J(z,x))"


49 
apply fast


50 
done


51 


52 


53 
lemma "ALL x. P(x,f(x)) <>


54 
(EX y. (ALL z. P(z,y) > P(z,f(x))) & P(x,y))"


55 
apply fast


56 
done


57 


58 


59 
subsubsection {* Derivation of conjunction elimination rule *}


60 


61 
lemma


62 
assumes major: "P&Q"


63 
and minor: "[ P; Q ] ==> R"


64 
shows R


65 
apply (rule minor)


66 
apply (rule major [THEN conjunct1])


67 
apply (rule major [THEN conjunct2])


68 
done


69 


70 


71 
subsection {* Derived rules involving definitions *}


72 


73 
text {* Derivation of negation introduction *}


74 


75 
lemma


76 
assumes "P ==> False"


77 
shows "~ P"


78 
apply (unfold not_def)


79 
apply (rule impI)


80 
apply (rule prems)


81 
apply assumption


82 
done


83 


84 
lemma


85 
assumes major: "~P"


86 
and minor: P


87 
shows R


88 
apply (rule FalseE)


89 
apply (rule mp)


90 
apply (rule major [unfolded not_def])


91 
apply (rule minor)


92 
done


93 


94 
text {* Alternative proof of the result above *}


95 
lemma


96 
assumes major: "~P"


97 
and minor: P


98 
shows R


99 
apply (rule minor [THEN major [unfolded not_def, THEN mp, THEN FalseE]])


100 
done


101 


102 
end
