src/FOL/FOL.ML
author clasohm
Mon, 29 Jan 1996 13:58:15 +0100
changeset 1459 d12da312eff4
parent 1280 909079af97b7
child 2469 b50b8c0eec01
permissions -rw-r--r--
expanded tabs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
     1
(*  Title:      FOL/FOL.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
1280
909079af97b7 corrected spelling of title
clasohm
parents: 779
diff changeset
     6
Tactics and lemmas for FOL.thy (classical First-Order Logic)
0
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=>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    17
  [ (rtac classical 1),
0
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=>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    25
  [ (rtac classical 1),
0
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]=>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    32
  [ (rtac ex_classical 1),
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
    (resolve_tac [notI RS allI RS prem] 1),
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    34
    (etac notE 1),
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    35
    (etac exI 1) ]);
0
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]=>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    57
  [ (rtac classical 1), (eresolve_tac [major RS notE] 1) ]);
0
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 =>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    67
  [ (rtac conjE 1),
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
    (REPEAT (DEPTH_SOLVE_1 
1459
d12da312eff4 expanded tabs
clasohm
parents: 1280
diff changeset
    69
        (etac impCE 1  ORELSE  mp_tac 1  ORELSE  ares_tac prems 1))) ]);