src/FOL/FOL.ML
author clasohm
Tue, 13 Dec 1994 11:51:12 +0100
changeset 779 4ab9176b45b7
parent 677 dbb8431184f9
child 1280 909079af97b7
permissions -rw-r--r--
removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	FOL/fol.ML
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Tactics and lemmas for fol.thy (classical First-Order Logic)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
open FOL;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
(*** Classical introduction rules for | and EX ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    14
qed_goal "disjCI" FOL.thy 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
   "(~Q ==> P) ==> P|Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
  [ (resolve_tac [classical] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
    (REPEAT (ares_tac (prems@[disjI1,notI]) 1)),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
    (REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
(*introduction rule involving only EX*)
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    22
qed_goal "ex_classical" FOL.thy 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
   "( ~(EX x. P(x)) ==> P(a)) ==> EX x.P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
  [ (resolve_tac [classical] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
    (eresolve_tac (prems RL [exI]) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
(*version of above, simplifying ~EX to ALL~ *)
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    29
qed_goal "exCI" FOL.thy 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
   "(ALL x. ~P(x) ==> P(a)) ==> EX x.P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
 (fn [prem]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  [ (resolve_tac [ex_classical] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
    (resolve_tac [notI RS allI RS prem] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
    (eresolve_tac [notE] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
    (eresolve_tac [exI] 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    37
qed_goal "excluded_middle" FOL.thy "~P | P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
 (fn _=> [ rtac disjCI 1, assume_tac 1 ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
440
1577cbcd0936 FOL/FOL.ML/excluded_middle_tac: new
lcp
parents: 0
diff changeset
    40
(*For disjunctive case analysis*)
1577cbcd0936 FOL/FOL.ML/excluded_middle_tac: new
lcp
parents: 0
diff changeset
    41
fun excluded_middle_tac sP =
1577cbcd0936 FOL/FOL.ML/excluded_middle_tac: new
lcp
parents: 0
diff changeset
    42
    res_inst_tac [("Q",sP)] (excluded_middle RS disjE);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
(*** Special elimination rules *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
(*Classical implies (-->) elimination. *)
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    48
qed_goal "impCE" FOL.thy 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
    "[| P-->Q;  ~P ==> R;  Q ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
  [ (resolve_tac [excluded_middle RS disjE] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
    (DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
(*Double negation law*)
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    55
qed_goal "notnotD" FOL.thy "~~P ==> P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
  [ (resolve_tac [classical] 1), (eresolve_tac [major RS notE] 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
(*** Tactics for implication and contradiction ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
(*Classical <-> elimination.  Proof substitutes P=Q in 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
    ~P ==> ~Q    and    P ==> Q  *)
779
4ab9176b45b7 removed FOL_Lemmas and IFOL_Lemmas; added qed_goal
clasohm
parents: 677
diff changeset
    64
qed_goalw "iffCE" FOL.thy [iff_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
    "[| P<->Q;  [| P; Q |] ==> R;  [| ~P; ~Q |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
  [ (resolve_tac [conjE] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
    (REPEAT (DEPTH_SOLVE_1 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
	(etac impCE 1  ORELSE  mp_tac 1  ORELSE  ares_tac prems 1))) ]);