0

1 
(* Title: FOL/fol.ML


2 
ID: $Id$


3 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory


4 
Copyright 1991 University of Cambridge


5 


6 
Tactics and lemmas for fol.thy (classical FirstOrder Logic)


7 
*)


8 


9 
open FOL;


10 


11 
signature FOL_LEMMAS =


12 
sig

677

13 
val disjCI : thm


14 
val excluded_middle : thm


15 
val excluded_middle_tac: string > int > tactic


16 
val exCI : thm


17 
val ex_classical : thm


18 
val iffCE : thm


19 
val impCE : thm


20 
val notnotD : thm

0

21 
end;


22 


23 


24 
structure FOL_Lemmas : FOL_LEMMAS =


25 
struct


26 


27 
(*** Classical introduction rules for  and EX ***)


28 


29 
val disjCI = prove_goal FOL.thy


30 
"(~Q ==> P) ==> PQ"


31 
(fn prems=>


32 
[ (resolve_tac [classical] 1),


33 
(REPEAT (ares_tac (prems@[disjI1,notI]) 1)),


34 
(REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ]);


35 


36 
(*introduction rule involving only EX*)


37 
val ex_classical = prove_goal FOL.thy


38 
"( ~(EX x. P(x)) ==> P(a)) ==> EX x.P(x)"


39 
(fn prems=>


40 
[ (resolve_tac [classical] 1),


41 
(eresolve_tac (prems RL [exI]) 1) ]);


42 


43 
(*version of above, simplifying ~EX to ALL~ *)


44 
val exCI = prove_goal FOL.thy


45 
"(ALL x. ~P(x) ==> P(a)) ==> EX x.P(x)"


46 
(fn [prem]=>


47 
[ (resolve_tac [ex_classical] 1),


48 
(resolve_tac [notI RS allI RS prem] 1),


49 
(eresolve_tac [notE] 1),


50 
(eresolve_tac [exI] 1) ]);


51 


52 
val excluded_middle = prove_goal FOL.thy "~P  P"


53 
(fn _=> [ rtac disjCI 1, assume_tac 1 ]);


54 

440

55 
(*For disjunctive case analysis*)


56 
fun excluded_middle_tac sP =


57 
res_inst_tac [("Q",sP)] (excluded_middle RS disjE);

0

58 


59 
(*** Special elimination rules *)


60 


61 


62 
(*Classical implies (>) elimination. *)


63 
val impCE = prove_goal FOL.thy


64 
"[ P>Q; ~P ==> R; Q ==> R ] ==> R"


65 
(fn major::prems=>


66 
[ (resolve_tac [excluded_middle RS disjE] 1),


67 
(DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ]);


68 


69 
(*Double negation law*)


70 
val notnotD = prove_goal FOL.thy "~~P ==> P"


71 
(fn [major]=>


72 
[ (resolve_tac [classical] 1), (eresolve_tac [major RS notE] 1) ]);


73 


74 


75 
(*** Tactics for implication and contradiction ***)


76 


77 
(*Classical <> elimination. Proof substitutes P=Q in


78 
~P ==> ~Q and P ==> Q *)


79 
val iffCE = prove_goalw FOL.thy [iff_def]


80 
"[ P<>Q; [ P; Q ] ==> R; [ ~P; ~Q ] ==> R ] ==> R"


81 
(fn prems =>


82 
[ (resolve_tac [conjE] 1),


83 
(REPEAT (DEPTH_SOLVE_1


84 
(etac impCE 1 ORELSE mp_tac 1 ORELSE ares_tac prems 1))) ]);


85 


86 


87 
end;


88 


89 
open FOL_Lemmas;
