src/FOL/FOL.ML
author lcp
Tue Nov 01 10:40:10 1994 +0100 (1994-11-01)
changeset 677 dbb8431184f9
parent 440 1577cbcd0936
child 779 4ab9176b45b7
permissions -rw-r--r--
FOL/FOL/swap: deleted
FOL/FOL: tidied the signature
clasohm@0
     1
(*  Title: 	FOL/fol.ML
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1991  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Tactics and lemmas for fol.thy (classical First-Order Logic)
clasohm@0
     7
*)
clasohm@0
     8
clasohm@0
     9
open FOL;
clasohm@0
    10
clasohm@0
    11
signature FOL_LEMMAS = 
clasohm@0
    12
  sig
lcp@677
    13
  val disjCI 		: thm
lcp@677
    14
  val excluded_middle 	: thm
lcp@677
    15
  val excluded_middle_tac: string -> int -> tactic
lcp@677
    16
  val exCI 		: thm
lcp@677
    17
  val ex_classical 	: thm
lcp@677
    18
  val iffCE 		: thm
lcp@677
    19
  val impCE 		: thm
lcp@677
    20
  val notnotD 		: thm
clasohm@0
    21
  end;
clasohm@0
    22
clasohm@0
    23
clasohm@0
    24
structure FOL_Lemmas : FOL_LEMMAS = 
clasohm@0
    25
struct
clasohm@0
    26
clasohm@0
    27
(*** Classical introduction rules for | and EX ***)
clasohm@0
    28
clasohm@0
    29
val disjCI = prove_goal FOL.thy 
clasohm@0
    30
   "(~Q ==> P) ==> P|Q"
clasohm@0
    31
 (fn prems=>
clasohm@0
    32
  [ (resolve_tac [classical] 1),
clasohm@0
    33
    (REPEAT (ares_tac (prems@[disjI1,notI]) 1)),
clasohm@0
    34
    (REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ]);
clasohm@0
    35
clasohm@0
    36
(*introduction rule involving only EX*)
clasohm@0
    37
val ex_classical = prove_goal FOL.thy 
clasohm@0
    38
   "( ~(EX x. P(x)) ==> P(a)) ==> EX x.P(x)"
clasohm@0
    39
 (fn prems=>
clasohm@0
    40
  [ (resolve_tac [classical] 1),
clasohm@0
    41
    (eresolve_tac (prems RL [exI]) 1) ]);
clasohm@0
    42
clasohm@0
    43
(*version of above, simplifying ~EX to ALL~ *)
clasohm@0
    44
val exCI = prove_goal FOL.thy 
clasohm@0
    45
   "(ALL x. ~P(x) ==> P(a)) ==> EX x.P(x)"
clasohm@0
    46
 (fn [prem]=>
clasohm@0
    47
  [ (resolve_tac [ex_classical] 1),
clasohm@0
    48
    (resolve_tac [notI RS allI RS prem] 1),
clasohm@0
    49
    (eresolve_tac [notE] 1),
clasohm@0
    50
    (eresolve_tac [exI] 1) ]);
clasohm@0
    51
clasohm@0
    52
val excluded_middle = prove_goal FOL.thy "~P | P"
clasohm@0
    53
 (fn _=> [ rtac disjCI 1, assume_tac 1 ]);
clasohm@0
    54
lcp@440
    55
(*For disjunctive case analysis*)
lcp@440
    56
fun excluded_middle_tac sP =
lcp@440
    57
    res_inst_tac [("Q",sP)] (excluded_middle RS disjE);
clasohm@0
    58
clasohm@0
    59
(*** Special elimination rules *)
clasohm@0
    60
clasohm@0
    61
clasohm@0
    62
(*Classical implies (-->) elimination. *)
clasohm@0
    63
val impCE = prove_goal FOL.thy 
clasohm@0
    64
    "[| P-->Q;  ~P ==> R;  Q ==> R |] ==> R"
clasohm@0
    65
 (fn major::prems=>
clasohm@0
    66
  [ (resolve_tac [excluded_middle RS disjE] 1),
clasohm@0
    67
    (DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ]);
clasohm@0
    68
clasohm@0
    69
(*Double negation law*)
clasohm@0
    70
val notnotD = prove_goal FOL.thy "~~P ==> P"
clasohm@0
    71
 (fn [major]=>
clasohm@0
    72
  [ (resolve_tac [classical] 1), (eresolve_tac [major RS notE] 1) ]);
clasohm@0
    73
clasohm@0
    74
clasohm@0
    75
(*** Tactics for implication and contradiction ***)
clasohm@0
    76
clasohm@0
    77
(*Classical <-> elimination.  Proof substitutes P=Q in 
clasohm@0
    78
    ~P ==> ~Q    and    P ==> Q  *)
clasohm@0
    79
val iffCE = prove_goalw FOL.thy [iff_def]
clasohm@0
    80
    "[| P<->Q;  [| P; Q |] ==> R;  [| ~P; ~Q |] ==> R |] ==> R"
clasohm@0
    81
 (fn prems =>
clasohm@0
    82
  [ (resolve_tac [conjE] 1),
clasohm@0
    83
    (REPEAT (DEPTH_SOLVE_1 
clasohm@0
    84
	(etac impCE 1  ORELSE  mp_tac 1  ORELSE  ares_tac prems 1))) ]);
clasohm@0
    85
clasohm@0
    86
clasohm@0
    87
end;
clasohm@0
    88
clasohm@0
    89
open FOL_Lemmas;