src/FOLP/FOLP_lemmas.ML
author paulson
Fri, 05 Oct 2007 09:59:03 +0200
changeset 24854 0ebcd575d3c6
parent 24584 01e83ffa6c54
permissions -rw-r--r--
filtering out some package theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24584
01e83ffa6c54 fixed title
haftmann
parents: 17480
diff changeset
     1
(*  Title:      FOLP/FOLP_lemmas.ML
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     3
    Author:     Martin D Coen, Cambridge University Computer Laboratory
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     5
*)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     6
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     7
(*** Classical introduction rules for | and EX ***)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     8
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
     9
val prems= goal (the_context ())
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    10
   "(!!x. x:~Q ==> f(x):P) ==> ?p : P|Q";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    11
by (rtac classical 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    12
by (REPEAT (ares_tac (prems@[disjI1,notI]) 1));
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    13
by (REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ;
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    14
qed "disjCI";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    15
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    16
(*introduction rule involving only EX*)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    17
val prems= goal (the_context ())
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    18
   "( !!u. u:~(EX x. P(x)) ==> f(u):P(a)) ==> ?p : EX x. P(x)";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    19
by (rtac classical 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    20
by (eresolve_tac (prems RL [exI]) 1) ;
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    21
qed "ex_classical";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    22
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    23
(*version of above, simplifying ~EX to ALL~ *)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    24
val [prem]= goal (the_context ())
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    25
   "(!!u. u:ALL x. ~P(x) ==> f(u):P(a)) ==> ?p : EX x. P(x)";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    26
by (rtac ex_classical 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    27
by (resolve_tac [notI RS allI RS prem] 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    28
by (etac notE 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    29
by (etac exI 1) ;
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    30
qed "exCI";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    31
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    32
val excluded_middle = prove_goal (the_context ()) "?p : ~P | P"
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    33
 (fn _=> [ rtac disjCI 1, assume_tac 1 ]);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    34
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    35
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    36
(*** Special elimination rules *)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    37
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    38
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    39
(*Classical implies (-->) elimination. *)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    40
val major::prems= goal (the_context ())
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    41
    "[| p:P-->Q;  !!x. x:~P ==> f(x):R;  !!y. y:Q ==> g(y):R |] ==> ?p : R";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    42
by (resolve_tac [excluded_middle RS disjE] 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    43
by (DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ;
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    44
qed "impCE";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    45
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    46
(*Double negation law*)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    47
Goal "p:~~P ==> ?p : P";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    48
by (rtac classical 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    49
by (etac notE 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    50
by (assume_tac 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    51
qed "notnotD";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    52
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    53
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    54
(*** Tactics for implication and contradiction ***)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    55
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    56
(*Classical <-> elimination.  Proof substitutes P=Q in
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    57
    ~P ==> ~Q    and    P ==> Q  *)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    58
val prems = goalw (the_context ()) [iff_def]
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    59
    "[| p:P<->Q; !!x y.[| x:P; y:Q |] ==> f(x,y):R;  \
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    60
\                !!x y.[| x:~P; y:~Q |] ==> g(x,y):R |] ==> ?p : R";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    61
by (rtac conjE 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    62
by (REPEAT (DEPTH_SOLVE_1 (etac impCE 1
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    63
               ORELSE  mp_tac 1  ORELSE  ares_tac prems 1))) ;
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    64
qed "iffCE";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    65
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    66
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    67
(*Should be used as swap since ~P becomes redundant*)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    68
val major::prems= goal (the_context ())
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    69
   "p:~P ==> (!!x. x:~Q ==> f(x):P) ==> ?p : Q";
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    70
by (rtac classical 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    71
by (rtac (major RS notE) 1);
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    72
by (REPEAT (ares_tac prems 1)) ;
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents:
diff changeset
    73
qed "swap";