src/FOLP/IFOLP.ML
author haftmann
Wed, 08 Feb 2006 14:39:00 +0100
changeset 18977 f24c416a4814
parent 17480 fd19f77dcf60
child 19046 bc5c6c9b114e
permissions -rw-r--r--
introduced gen_distinct in place of distinct
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
     1
(*  Title:      FOLP/IFOLP.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
     3
    Author:     Martin D Coen, Cambridge University Computer Laboratory
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
     5
*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
(*** Sequent-style elimination rules for & --> and ALL ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
     9
val prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    10
    "[| p:P&Q; !!x y.[| x:P; y:Q |] ==> f(x,y):R |] ==> ?a:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    11
by (REPEAT (resolve_tac prems 1
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    12
   ORELSE (resolve_tac [conjunct1, conjunct2] 1 THEN resolve_tac prems 1))) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    13
qed "conjE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    15
val prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    16
    "[| p:P-->Q;  q:P;  !!x. x:Q ==> r(x):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    17
by (REPEAT (resolve_tac (prems@[mp]) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    18
qed "impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    20
val prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    21
    "[| p:ALL x. P(x); !!y. y:P(x) ==> q(y):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    22
by (REPEAT (resolve_tac (prems@[spec]) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    23
qed "allE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
(*Duplicates the quantifier; for use with eresolve_tac*)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    26
val prems= Goal
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
    27
    "[| p:ALL x. P(x);  !!y z.[| y:P(x); z:ALL x. P(x) |] ==> q(y,z):R \
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    28
\    |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    29
by (REPEAT (resolve_tac (prems@[spec]) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    30
qed "all_dupE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
(*** Negation rules, which translate between ~P and P-->False ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    35
val notI = prove_goalw (the_context ()) [not_def]  "(!!x. x:P ==> q(x):False) ==> ?p:~P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
 (fn prems=> [ (REPEAT (ares_tac (prems@[impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    38
val notE = prove_goalw (the_context ()) [not_def] "[| p:~P;  q:P |] ==> ?p:R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
  [ (resolve_tac [mp RS FalseE] 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
    (REPEAT (resolve_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
(*This is useful with the special implication rules for each kind of P. *)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    44
val prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    45
    "[| p:~P;  !!x. x:(P-->False) ==> q(x):Q |] ==> ?p:Q";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    46
by (REPEAT (ares_tac (prems@[impI,notE]) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    47
qed "not_to_imp";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
(* For substitution int an assumption P, reduce Q to P-->Q, substitute into
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
   this implication, then apply impI to move P back into the assumptions.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
   To specify P use something like
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
      eres_inst_tac [ ("P","ALL y. ?S(x,y)") ] rev_mp 1   *)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    54
Goal "[| p:P;  q:P --> Q |] ==> ?p:Q";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    55
by (REPEAT (ares_tac [mp] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    56
qed "rev_mp";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
(*Contrapositive of an inference rule*)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    60
val [major,minor]= Goal "[| p:~Q;  !!y. y:P==>q(y):Q |] ==> ?a:~P";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    61
by (rtac (major RS notE RS notI) 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    62
by (etac minor 1) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    63
qed "contrapos";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
(** Unique assumption tactic.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
    Ignores proof objects.
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    67
    Fails unless one assumption is equal and exactly one is unifiable
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
**)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
local
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    71
    fun discard_proof (Const("Proof",_) $ P $ _) = P;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
in
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
val uniq_assume_tac =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    74
  SUBGOAL
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
    (fn (prem,i) =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    76
      let val hyps = map discard_proof (Logic.strip_assums_hyp prem)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
          and concl = discard_proof (Logic.strip_assums_concl prem)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    78
      in
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
    79
          if exists (fn hyp => hyp aconv concl) hyps
18977
f24c416a4814 introduced gen_distinct in place of distinct
haftmann
parents: 17480
diff changeset
    80
          then case gen_distinct (op =) (List.filter (fn hyp=> could_unify(hyp,concl)) hyps) of
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
    81
                   [_] => assume_tac i
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    82
                 |  _  => no_tac
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
          else no_tac
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
      end);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
(*** Modus Ponens Tactics ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    90
(*Finds P-->Q and P in the assumptions, replaces implication by Q *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
fun mp_tac i = eresolve_tac [notE,make_elim mp] i  THEN  assume_tac i;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
(*Like mp_tac but instantiates no variables*)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
    94
fun int_uniq_mp_tac i = eresolve_tac [notE,impE] i  THEN  uniq_assume_tac i;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    95
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
(*** If-and-only-if ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
    99
val iffI = prove_goalw (the_context ()) [iff_def]
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   100
   "[| !!x. x:P ==> q(x):Q;  !!x. x:Q ==> r(x):P |] ==> ?p:P<->Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
 (fn prems=> [ (REPEAT (ares_tac (prems@[conjI, impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
(*Observe use of rewrite_rule to unfold "<->" in meta-assumptions (prems) *)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   105
val iffE = prove_goalw (the_context ()) [iff_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
    "[| p:P <-> Q;  !!x y.[| x:P-->Q; y:Q-->P |] ==> q(x,y):R |] ==> ?p:R"
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   107
 (fn prems => [ (rtac conjE 1), (REPEAT (ares_tac prems 1)) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
(* Destruct rules for <-> similar to Modus Ponens *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   111
val iffD1 = prove_goalw (the_context ()) [iff_def] "[| p:P <-> Q;  q:P |] ==> ?p:Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
 (fn prems => [ (rtac (conjunct1 RS mp) 1), (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   114
val iffD2 = prove_goalw (the_context ()) [iff_def] "[| p:P <-> Q;  q:Q |] ==> ?p:P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
 (fn prems => [ (rtac (conjunct2 RS mp) 1), (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   117
Goal "?p:P <-> P";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   118
by (REPEAT (ares_tac [iffI] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   119
qed "iff_refl";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   121
Goal "p:Q <-> P ==> ?p:P <-> Q";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   122
by (etac iffE 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   123
by (rtac iffI 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   124
by (REPEAT (eresolve_tac [asm_rl,mp] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   125
qed "iff_sym";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   127
Goal "[| p:P <-> Q; q:Q<-> R |] ==> ?p:P <-> R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   128
by (rtac iffI 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   129
by (REPEAT (eresolve_tac [asm_rl,iffE] 1 ORELSE mp_tac 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   130
qed "iff_trans";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   132
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
(*** Unique existence.  NOTE THAT the following 2 quantifications
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
   EX!x such that [EX!y such that P(x,y)]     (sequential)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
   EX!x,y such that P(x,y)                    (simultaneous)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
 do NOT mean the same thing.  The parser treats EX!x y.P(x,y) as sequential.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   137
***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   139
val prems = goalw (the_context ()) [ex1_def]
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   140
    "[| p:P(a);  !!x u. u:P(x) ==> f(u) : x=a |] ==> ?p:EX! x. P(x)";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   141
by (REPEAT (ares_tac (prems@[exI,conjI,allI,impI]) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   142
qed "ex1I";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   144
val prems = goalw (the_context ()) [ex1_def]
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   145
    "[| p:EX! x. P(x);  \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
\       !!x u v. [| u:P(x);  v:ALL y. P(y) --> y=x |] ==> f(x,u,v):R |] ==>\
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   147
\    ?a : R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   148
by (cut_facts_tac prems 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   149
by (REPEAT (eresolve_tac [exE,conjE] 1 ORELSE ares_tac prems 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   150
qed "ex1E";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   152
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   153
(*** <-> congruence rules for simplification ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
(*Use iffE on a premise.  For conj_cong, imp_cong, all_cong, ex_cong*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   156
fun iff_tac prems i =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   157
    resolve_tac (prems RL [iffE]) i THEN
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   158
    REPEAT1 (eresolve_tac [asm_rl,mp] i);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   160
val conj_cong = prove_goal (the_context ())
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   161
    "[| p:P <-> P';  !!x. x:P' ==> q(x):Q <-> Q' |] ==> ?p:(P&Q) <-> (P'&Q')"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   162
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
    (REPEAT  (ares_tac [iffI,conjI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
      ORELSE  eresolve_tac [iffE,conjE,mp] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   166
      ORELSE  iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   167
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   168
val disj_cong = prove_goal (the_context ())
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
    "[| p:P <-> P';  q:Q <-> Q' |] ==> ?p:(P|Q) <-> (P'|Q')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
    (REPEAT  (eresolve_tac [iffE,disjE,disjI1,disjI2] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
      ORELSE  ares_tac [iffI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   174
      ORELSE  mp_tac 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   176
val imp_cong = prove_goal (the_context ())
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   177
    "[| p:P <-> P';  !!x. x:P' ==> q(x):Q <-> Q' |] ==> ?p:(P-->Q) <-> (P'-->Q')"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
    (REPEAT   (ares_tac [iffI,impI] 1
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   181
      ORELSE  etac iffE 1
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
      ORELSE  mp_tac 1 ORELSE iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   184
val iff_cong = prove_goal (the_context ())
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
    "[| p:P <-> P';  q:Q <-> Q' |] ==> ?p:(P<->Q) <-> (P'<->Q')"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
  [ (cut_facts_tac prems 1),
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   188
    (REPEAT   (etac iffE 1
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   189
      ORELSE  ares_tac [iffI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   190
      ORELSE  mp_tac 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   191
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   192
val not_cong = prove_goal (the_context ())
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   193
    "p:P <-> P' ==> ?p:~P <-> ~P'"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   194
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   195
  [ (cut_facts_tac prems 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   196
    (REPEAT   (ares_tac [iffI,notI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   197
      ORELSE  mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   198
      ORELSE  eresolve_tac [iffE,notE] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   199
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   200
val all_cong = prove_goal (the_context ())
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   201
    "(!!x. f(x):P(x) <-> Q(x)) ==> ?p:(ALL x. P(x)) <-> (ALL x. Q(x))"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   202
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   203
  [ (REPEAT   (ares_tac [iffI,allI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   204
      ORELSE   mp_tac 1
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   205
      ORELSE   etac allE 1 ORELSE iff_tac prems 1)) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   206
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   207
val ex_cong = prove_goal (the_context ())
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   208
    "(!!x. f(x):P(x) <-> Q(x)) ==> ?p:(EX x. P(x)) <-> (EX x. Q(x))"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   209
 (fn prems =>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   210
  [ (REPEAT   (etac exE 1 ORELSE ares_tac [iffI,exI] 1
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
      ORELSE   mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   212
      ORELSE   iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   214
(*NOT PROVED
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   215
val ex1_cong = prove_goal (the_context ())
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   216
    "(!!x.f(x):P(x) <-> Q(x)) ==> ?p:(EX! x.P(x)) <-> (EX! x.Q(x))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   217
 (fn prems =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
  [ (REPEAT   (eresolve_tac [ex1E, spec RS mp] 1 ORELSE ares_tac [iffI,ex1I] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   219
      ORELSE   mp_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   220
      ORELSE   iff_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   221
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   222
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   223
(*** Equality rules ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   224
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   225
val refl = ieqI;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   227
val subst = prove_goal (the_context ()) "[| p:a=b;  q:P(a) |] ==> ?p : P(b)"
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   228
 (fn [prem1,prem2] => [ rtac (prem2 RS rev_mp) 1, (rtac (prem1 RS ieqE) 1),
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
                        rtac impI 1, atac 1 ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   231
Goal "q:a=b ==> ?c:b=a";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   232
by (etac subst 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   233
by (rtac refl 1) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   234
qed "sym";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   235
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   236
Goal "[| p:a=b;  q:b=c |] ==> ?d:a=c";
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   237
by (etac subst 1 THEN assume_tac 1);
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   238
qed "trans";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   239
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   240
(** ~ b=a ==> ~ a=b **)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   241
Goal "p:~ b=a ==> ?q:~ a=b";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   242
by (etac contrapos 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   243
by (etac sym 1) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   244
qed "not_sym";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
(*calling "standard" reduces maxidx to 0*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   247
val ssubst = standard (sym RS subst);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   248
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
(*A special case of ex1E that would otherwise need quantifier expansion*)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   250
Goal "[| p:EX! x. P(x);  q:P(a);  r:P(b) |] ==> ?d:a=b";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   251
by (etac ex1E 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   252
by (rtac trans 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   253
by (rtac sym 2);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   254
by (REPEAT (eresolve_tac [asm_rl, spec RS mp] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   255
qed "ex1_equalsE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   256
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   257
(** Polymorphic congruence rules **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   259
Goal "[| p:a=b |]  ==>  ?d:t(a)=t(b)";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   260
by (etac ssubst 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   261
by (rtac refl 1) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   262
qed "subst_context";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   263
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   264
Goal "[| p:a=b;  q:c=d |]  ==>  ?p:t(a,c)=t(b,d)";
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   265
by (REPEAT (etac ssubst 1));
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   266
by (rtac refl 1) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   267
qed "subst_context2";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   269
Goal "[| p:a=b;  q:c=d;  r:e=f |]  ==>  ?p:t(a,c,e)=t(b,d,f)";
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   270
by (REPEAT (etac ssubst 1));
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   271
by (rtac refl 1) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   272
qed "subst_context3";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
(*Useful with eresolve_tac for proving equalties from known equalities.
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   275
        a = b
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   276
        |   |
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   277
        c = d   *)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   278
Goal "[| p:a=b;  q:a=c;  r:b=d |] ==> ?p:c=d";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   279
by (rtac trans 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   280
by (rtac trans 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   281
by (rtac sym 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   282
by (REPEAT (assume_tac 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   283
qed "box_equals";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   284
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   285
(*Dual of box_equals: for proving equalities backwards*)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   286
Goal "[| p:a=c;  q:b=d;  r:c=d |] ==> ?p:a=b";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   287
by (rtac trans 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   288
by (rtac trans 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   289
by (REPEAT (eresolve_tac [asm_rl, sym] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   290
qed "simp_equals";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   291
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
(** Congruence rules for predicate letters **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   294
Goal "p:a=a' ==> ?p:P(a) <-> P(a')";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   295
by (rtac iffI 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   296
by (DEPTH_SOLVE (eresolve_tac [asm_rl, subst, ssubst] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   297
qed "pred1_cong";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   299
Goal "[| p:a=a';  q:b=b' |] ==> ?p:P(a,b) <-> P(a',b')";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   300
by (rtac iffI 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   301
by (DEPTH_SOLVE (eresolve_tac [asm_rl, subst, ssubst] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   302
qed "pred2_cong";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   303
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   304
Goal "[| p:a=a';  q:b=b';  r:c=c' |] ==> ?p:P(a,b,c) <-> P(a',b',c')";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   305
by (rtac iffI 1);
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   306
by (DEPTH_SOLVE (eresolve_tac [asm_rl, subst, ssubst] 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   307
qed "pred3_cong";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   308
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   309
(*special cases for free variables P, Q, R, S -- up to 3 arguments*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   311
val pred_congs =
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   312
    List.concat (map (fn c =>
1459
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   313
               map (fn th => read_instantiate [("P",c)] th)
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   314
                   [pred1_cong,pred2_cong,pred3_cong])
d12da312eff4 expanded tabs
clasohm
parents: 1142
diff changeset
   315
               (explode"PQRS"));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   317
(*special case for the equality predicate!*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   318
val eq_cong = read_instantiate [("P","op =")] pred2_cong;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   321
(*** Simplifications of assumed implications.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   322
     Roy Dyckhoff has proved that conj_impE, disj_impE, and imp_impE
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   323
     used with mp_tac (restricted to atomic formulae) is COMPLETE for
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
     intuitionistic propositional logic.  See
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   325
   R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   326
    (preprint, University of St Andrews, 1991)  ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   327
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   328
val major::prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   329
    "[| p:(P&Q)-->S;  !!x. x:P-->(Q-->S) ==> q(x):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   330
by (REPEAT (ares_tac ([conjI, impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   331
qed "conj_impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   332
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   333
val major::prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   334
    "[| p:(P|Q)-->S;  !!x y.[| x:P-->S; y:Q-->S |] ==> q(x,y):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   335
by (DEPTH_SOLVE (ares_tac ([disjI1, disjI2, impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   336
qed "disj_impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   337
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   338
(*Simplifies the implication.  Classical version is stronger.
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   339
  Still UNSAFE since Q must be provable -- backtracking needed.  *)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   340
val major::prems= Goal
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 1459
diff changeset
   341
    "[| p:(P-->Q)-->S;  !!x y.[| x:P; y:Q-->S |] ==> q(x,y):Q;  !!x. x:S ==> r(x):R |] ==> \
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   342
\    ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   343
by (REPEAT (ares_tac ([impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   344
qed "imp_impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   345
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   346
(*Simplifies the implication.  Classical version is stronger.
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   347
  Still UNSAFE since ~P must be provable -- backtracking needed.  *)
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   348
val major::prems= Goal
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   349
    "[| p:~P --> S;  !!y. y:P ==> q(y):False;  !!y. y:S ==> r(y):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   350
by (REPEAT (ares_tac ([notI, impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   351
qed "not_impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   352
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   353
(*Simplifies the implication.   UNSAFE.  *)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   354
val major::prems= Goal
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   355
    "[| p:(P<->Q)-->S;  !!x y.[| x:P; y:Q-->S |] ==> q(x,y):Q;  \
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   356
\       !!x y.[| x:Q; y:P-->S |] ==> r(x,y):P;  !!x. x:S ==> s(x):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   357
by (REPEAT (ares_tac ([iffI, impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   358
qed "iff_impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   359
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   360
(*What if (ALL x.~~P(x)) --> ~~(ALL x.P(x)) is an assumption? UNSAFE*)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   361
val major::prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   362
    "[| p:(ALL x. P(x))-->S;  !!x. q:P(x);  !!y. y:S ==> r(y):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   363
by (REPEAT (ares_tac ([allI, impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   364
qed "all_impE";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   365
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   366
(*Unsafe: (EX x.P(x))-->S  is equivalent to  ALL x.P(x)-->S.  *)
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 15570
diff changeset
   367
val major::prems= Goal
9263
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   368
    "[| p:(EX x. P(x))-->S;  !!y. y:P(a)-->S ==> q(y):R |] ==> ?p:R";
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   369
by (REPEAT (ares_tac ([exI, impI, major RS mp]@prems) 1)) ;
53e09e592278 removal of batch style, and tidying
paulson
parents: 3836
diff changeset
   370
qed "ex_impE";