src/Cube/ex/ex.ML
author oheimb
Wed, 12 Nov 1997 12:34:43 +0100
changeset 4206 688050e83d89
parent 3836 f1a1817659e6
child 4583 6d9be46ea566
permissions -rw-r--r--
restored last version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     1
(* Examples taken from
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     2
        H. Barendregt. Introduction to Generalised Type Systems.
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     3
        J. Functional Programming.
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     4
*)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     5
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     6
fun strip_asms_tac thms  i =
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     7
    REPEAT(resolve_tac[strip_b,strip_s]i THEN DEPTH_SOLVE_1(ares_tac thms i));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     8
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
     9
val imp_elim = prove_goal thy "[| f:A->B; a:A; f^a:B ==> PROP P |] ==> PROP P"
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    10
        (fn asms => [REPEAT(resolve_tac (app::asms) 1)]);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    11
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    12
val pi_elim = prove_goal thy
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    13
        "[| F:Prod(A,B); a:A; F^a:B(a) ==> PROP P |] ==> PROP P"
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    14
        (fn asms => [REPEAT(resolve_tac (app::asms) 1)]);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    15
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    16
(* SIMPLE TYPES *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    17
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    18
goal thy "A:* |- A->A : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    19
by (DEPTH_SOLVE (ares_tac simple 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    20
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    21
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    22
goal thy "A:* |- Lam a:A. a : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    23
by (DEPTH_SOLVE (ares_tac simple 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    24
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    25
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    26
goal thy "A:* B:* b:B |- Lam x:A. b : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    27
by (DEPTH_SOLVE (ares_tac simple 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    28
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    29
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    30
goal thy "A:* b:A |- (Lam a:A. a)^b: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    31
by (DEPTH_SOLVE (ares_tac simple 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    32
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    33
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    34
goal thy "A:* B:* c:A b:B |- (Lam x:A. b)^ c: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    35
by (DEPTH_SOLVE (ares_tac simple 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    36
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    37
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    38
goal thy "A:* B:* |- Lam a:A. Lam b:B. a : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    39
by (DEPTH_SOLVE (ares_tac simple 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    40
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    41
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    42
(* SECOND-ORDER TYPES *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    43
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    44
goal L2_thy "|- Lam A:*. Lam a:A. a : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    45
by (DEPTH_SOLVE (ares_tac L2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    46
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    47
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    48
goal L2_thy "A:* |- (Lam B:*.Lam b:B. b)^A : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    49
by (DEPTH_SOLVE (ares_tac L2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    50
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    51
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    52
goal L2_thy "A:* b:A |- (Lam B:*.Lam b:B. b) ^ A ^ b: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    53
by (DEPTH_SOLVE (ares_tac L2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    54
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    55
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    56
goal L2_thy "|- Lam B:*.Lam a:(Pi A:*.A).a ^ ((Pi A:*.A)->B) ^ a: ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    57
by (DEPTH_SOLVE (ares_tac L2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    58
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    59
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    60
(* Weakly higher-order proposiional logic *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    61
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    62
goal Lomega_thy "|- Lam A:*.A->A : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    63
by (DEPTH_SOLVE (ares_tac Lomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    64
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    65
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    66
goal Lomega_thy "B:* |- (Lam A:*.A->A) ^ B : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    67
by (DEPTH_SOLVE (ares_tac Lomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    68
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    69
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    70
goal Lomega_thy "B:* b:B |- (Lam y:B. b): ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    71
by (DEPTH_SOLVE (ares_tac Lomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    72
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    73
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    74
goal Lomega_thy "A:* F:*->* |- F^(F^A): ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    75
by (DEPTH_SOLVE (ares_tac Lomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    76
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    77
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    78
goal Lomega_thy "A:* |- Lam F:*->*.F^(F^A): ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    79
by (DEPTH_SOLVE (ares_tac Lomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    80
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    81
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    82
(* LF *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    83
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    84
goal LP_thy "A:* |- A -> * : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    85
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    86
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    87
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    88
goal LP_thy "A:* P:A->* a:A |- P^a: ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    89
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    90
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    91
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    92
goal LP_thy "A:* P:A->A->* a:A |- Pi a:A. P^a^a: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    93
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    94
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    95
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
    96
goal LP_thy "A:* P:A->* Q:A->* |- Pi a:A. P^a -> Q^a: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    97
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    98
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
    99
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   100
goal LP_thy "A:* P:A->* |- Pi a:A. P^a -> P^a: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   101
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   102
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   103
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   104
goal LP_thy "A:* P:A->* |- Lam a:A. Lam x:P^a. x: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   105
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   106
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   107
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   108
goal LP_thy "A:* P:A->* Q:* |- (Pi a:A. P^a->Q) -> (Pi a:A. P^a) -> Q : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   109
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   110
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   111
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   112
goal LP_thy "A:* P:A->* Q:* a0:A |- \
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   113
\       Lam x:Pi a:A. P^a->Q. Lam y:Pi a:A. P^a. x^a0^(y^a0): ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   114
by (DEPTH_SOLVE (ares_tac LP 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   115
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   116
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   117
(* OMEGA-ORDER TYPES *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   118
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   119
goal L2_thy "A:* B:* |- Pi C:*.(A->B->C)->C : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   120
by (DEPTH_SOLVE (ares_tac L2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   121
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   122
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   123
goal LOmega_thy "|- Lam A:*.Lam B:*.Pi C:*.(A->B->C)->C : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   124
by (DEPTH_SOLVE (ares_tac LOmega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   125
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   126
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   127
goal LOmega_thy "|- Lam A:*.Lam B:*.Lam x:A. Lam y:B. x : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   128
by (DEPTH_SOLVE (ares_tac LOmega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   129
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   130
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   131
goal LOmega_thy "A:* B:* |- ?p : (A->B) -> ((B->Pi P:*.P)->(A->Pi P:*.P))";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   132
by (strip_asms_tac LOmega 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   133
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   134
by (DEPTH_SOLVE_1(ares_tac LOmega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   135
by (DEPTH_SOLVE_1(ares_tac LOmega 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   136
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   137
by (DEPTH_SOLVE_1(ares_tac LOmega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   138
by (DEPTH_SOLVE_1(ares_tac LOmega 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   139
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   140
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   141
by (DEPTH_SOLVE_1(ares_tac LOmega 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   142
by (etac pi_elim 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   143
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   144
by (etac pi_elim 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   145
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   146
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   147
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   148
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   149
(* Second-order Predicate Logic *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   150
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   151
goal LP2_thy "A:* P:A->* |- Lam a:A. P^a->(Pi A:*.A) : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   152
by (DEPTH_SOLVE (ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   153
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   154
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   155
goal LP2_thy "A:* P:A->A->* |- \
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   156
\       (Pi a:A. Pi b:A. P^a^b->P^b^a->Pi P:*.P) -> Pi a:A. P^a^a->Pi P:*.P : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   157
by (DEPTH_SOLVE (ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   158
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   159
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   160
(* Antisymmetry implies irreflexivity: *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   161
goal LP2_thy "A:* P:A->A->* |- \
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   162
\       ?p: (Pi a:A. Pi b:A. P^a^b->P^b^a->Pi P:*.P) -> Pi a:A. P^a^a->Pi P:*.P";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   163
by (strip_asms_tac LP2 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   164
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   165
by (DEPTH_SOLVE_1(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   166
by (DEPTH_SOLVE_1(ares_tac LP2 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   167
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   168
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   169
by (DEPTH_SOLVE_1(ares_tac LP2 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   170
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   171
by (DEPTH_SOLVE_1(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   172
by (DEPTH_SOLVE_1(ares_tac LP2 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   173
by (REPEAT(EVERY[etac pi_elim 1, assume_tac 1, TRY(assume_tac 1)]));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   174
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   175
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   176
(* LPomega *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   177
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   178
goal LPomega_thy "A:* |- Lam P:A->A->*.Lam a:A. P^a^a : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   179
by (DEPTH_SOLVE (ares_tac LPomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   180
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   181
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   182
goal LPomega_thy "|- Lam A:*.Lam P:A->A->*.Lam a:A. P^a^a : ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   183
by (DEPTH_SOLVE (ares_tac LPomega 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   184
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   185
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   186
(* CONSTRUCTIONS *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   187
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   188
goal CC_thy "|- Lam A:*.Lam P:A->*.Lam a:A. P^a->Pi P:*.P: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   189
by (DEPTH_SOLVE (ares_tac CC 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   190
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   191
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   192
goal CC_thy "|- Lam A:*.Lam P:A->*.Pi a:A. P^a: ?T";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   193
by (DEPTH_SOLVE (ares_tac CC 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   194
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   195
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   196
goal CC_thy "A:* P:A->* a:A |- ?p : (Pi a:A. P^a)->P^a";
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   197
by (strip_asms_tac CC 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   198
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   199
by (DEPTH_SOLVE_1(ares_tac CC 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   200
by (DEPTH_SOLVE_1(ares_tac CC 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   201
by (EVERY[etac pi_elim 1, assume_tac 1, assume_tac 1]);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   202
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   203
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   204
(* Some random examples *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   205
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   206
goal LP2_thy "A:* c:A f:A->A |- \
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   207
\       Lam a:A. Pi P:A->*.P^c -> (Pi x:A. P^x->P^(f^x)) -> P^a : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   208
by (DEPTH_SOLVE(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   209
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   210
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   211
goal CC_thy "Lam A:*.Lam c:A. Lam f:A->A. \
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   212
\       Lam a:A. Pi P:A->*.P^c -> (Pi x:A. P^x->P^(f^x)) -> P^a : ?T";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   213
by (DEPTH_SOLVE(ares_tac CC 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   214
uresult();
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   215
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   216
(* Symmetry of Leibnitz equality *)
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   217
goal LP2_thy "A:* a:A b:A |- ?p: (Pi P:A->*.P^a->P^b) -> (Pi P:A->*.P^b->P^a)";
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   218
by (strip_asms_tac LP2 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   219
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   220
by (DEPTH_SOLVE_1(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   221
by (DEPTH_SOLVE_1(ares_tac LP2 2));
3836
f1a1817659e6 fixed dots;
wenzelm
parents: 2817
diff changeset
   222
by (eres_inst_tac [("a","Lam x:A. Pi Q:A->*.Q^x->Q^a")] pi_elim 1);
2817
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   223
by (DEPTH_SOLVE_1(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   224
by (rewtac beta);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   225
by (etac imp_elim 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   226
by (rtac lam_bs 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   227
by (DEPTH_SOLVE_1(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   228
by (DEPTH_SOLVE_1(ares_tac LP2 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   229
by (rtac lam_ss 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   230
by (DEPTH_SOLVE_1(ares_tac LP2 1));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   231
by (DEPTH_SOLVE_1(ares_tac LP2 2));
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   232
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   233
by (assume_tac 1);
23564e91463e replaced ex.ML by ex/ROOT.ML, ex/ex.ML;
wenzelm
parents:
diff changeset
   234
uresult();