src/Cube/ex/ex.thy
author wenzelm
Sat, 03 Sep 2005 21:43:50 +0200
changeset 17252 e352f65d5893
parent 4583 6d9be46ea566
child 17255 f9c5cbdce422
permissions -rw-r--r--
converted to Isar theory format;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4583
6d9be46ea566 reorganized into individual theories;
wenzelm
parents:
diff changeset
     1
17252
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     2
theory ex
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     3
imports Cube
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     4
begin
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     5
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     6
text {*
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     7
  Examples taken from:
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     8
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
     9
  H. Barendregt. Introduction to Generalised Type Systems.
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    10
  J. Functional Programming.
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    11
*}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    12
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    13
method_setup depth_solve = {*
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    14
  Method.thms_args (fn thms => Method.METHOD (fn facts =>
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    15
  (DEPTH_SOLVE (HEADGOAL (ares_tac (facts @ thms))))))
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    16
*} ""
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    17
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    18
method_setup depth_solve1 = {*
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    19
  Method.thms_args (fn thms => Method.METHOD (fn facts =>
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    20
  (DEPTH_SOLVE_1 (HEADGOAL (ares_tac (facts @ thms))))))
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    21
*} ""
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    22
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    23
ML {*
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    24
local val strip_b = thm "strip_b" and strip_s = thm "strip_s" in
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    25
fun strip_asms_tac thms  i =
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    26
  REPEAT (resolve_tac [strip_b, strip_s] i THEN DEPTH_SOLVE_1 (ares_tac thms i))
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    27
end
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    28
*}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    29
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    30
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    31
subsection {* Simple types *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    32
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    33
lemma "A:* |- A->A : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    34
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    35
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    36
lemma "A:* |- Lam a:A. a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    37
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    38
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    39
lemma "A:* B:* b:B |- Lam x:A. b : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    40
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    41
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    42
lemma "A:* b:A |- (Lam a:A. a)^b: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    43
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    44
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    45
lemma "A:* B:* c:A b:B |- (Lam x:A. b)^ c: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    46
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    47
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    48
lemma "A:* B:* |- Lam a:A. Lam b:B. a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    49
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    50
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    51
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    52
subsection {* Second-order types *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    53
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    54
lemma (in L2) "|- Lam A:*. Lam a:A. a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    55
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    56
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    57
lemma (in L2) "A:* |- (Lam B:*.Lam b:B. b)^A : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    58
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    59
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    60
lemma (in L2) "A:* b:A |- (Lam B:*.Lam b:B. b) ^ A ^ b: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    61
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    62
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    63
lemma (in L2) "|- Lam B:*.Lam a:(Pi A:*.A).a ^ ((Pi A:*.A)->B) ^ a: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    64
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    65
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    66
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    67
subsection {* Weakly higher-order propositional logic *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    68
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    69
lemma (in Lomega) "|- Lam A:*.A->A : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    70
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    71
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    72
lemma (in Lomega) "B:* |- (Lam A:*.A->A) ^ B : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    73
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    74
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    75
lemma (in Lomega) "B:* b:B |- (Lam y:B. b): ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    76
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    77
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    78
lemma (in Lomega) "A:* F:*->* |- F^(F^A): ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    79
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    80
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    81
lemma (in Lomega) "A:* |- Lam F:*->*.F^(F^A): ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    82
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    83
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    84
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    85
subsection {* LP *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    86
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    87
lemma (in LP) "A:* |- A -> * : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    88
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    89
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    90
lemma (in LP) "A:* P:A->* a:A |- P^a: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    91
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    92
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    93
lemma (in LP) "A:* P:A->A->* a:A |- Pi a:A. P^a^a: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    94
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    95
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    96
lemma (in LP) "A:* P:A->* Q:A->* |- Pi a:A. P^a -> Q^a: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    97
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    98
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
    99
lemma (in LP) "A:* P:A->* |- Pi a:A. P^a -> P^a: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   100
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   101
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   102
lemma (in LP) "A:* P:A->* |- Lam a:A. Lam x:P^a. x: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   103
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   104
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   105
lemma (in LP) "A:* P:A->* Q:* |- (Pi a:A. P^a->Q) -> (Pi a:A. P^a) -> Q : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   106
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   107
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   108
lemma (in LP) "A:* P:A->* Q:* a0:A |-
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   109
        Lam x:Pi a:A. P^a->Q. Lam y:Pi a:A. P^a. x^a0^(y^a0): ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   110
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   111
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   112
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   113
subsection {* Omega-order types *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   114
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   115
lemma (in L2) "A:* B:* |- Pi C:*.(A->B->C)->C : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   116
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   117
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   118
lemma (in Lomega2) "|- Lam A:*.Lam B:*.Pi C:*.(A->B->C)->C : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   119
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   120
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   121
lemma (in Lomega2) "|- Lam A:*.Lam B:*.Lam x:A. Lam y:B. x : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   122
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   123
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   124
lemma (in Lomega2) "A:* B:* |- ?p : (A->B) -> ((B->Pi P:*.P)->(A->Pi P:*.P))"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   125
  apply (tactic {* strip_asms_tac (thms "rules") 1 *})
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   126
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   127
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   128
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   129
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   130
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   131
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   132
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   133
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   134
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   135
    apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   136
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   137
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   138
  apply (erule pi_elim)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   139
   apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   140
  apply (erule pi_elim)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   141
   apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   142
  apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   143
  done
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   144
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   145
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   146
subsection {* Second-order Predicate Logic *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   147
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   148
lemma (in LP2) "A:* P:A->* |- Lam a:A. P^a->(Pi A:*.A) : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   149
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   150
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   151
lemma (in LP2) "A:* P:A->A->* |-
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   152
    (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"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   153
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   154
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   155
lemma (in LP2) "A:* P:A->A->* |-
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   156
    ?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"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   157
  -- {* Antisymmetry implies irreflexivity: *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   158
  apply (tactic {* strip_asms_tac (thms "rules") 1 *})
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   159
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   160
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   161
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   162
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   163
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   164
    apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   165
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   166
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   167
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   168
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   169
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   170
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   171
  apply (erule pi_elim, assumption, assumption?)+
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   172
  done
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   173
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   174
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   175
subsection {* LPomega *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   176
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   177
lemma (in LPomega) "A:* |- Lam P:A->A->*.Lam a:A. P^a^a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   178
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   179
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   180
lemma (in LPomega) "|- Lam A:*.Lam P:A->A->*.Lam a:A. P^a^a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   181
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   182
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   183
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   184
subsection {* Constructions *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   185
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   186
lemma (in CC) "|- Lam A:*.Lam P:A->*.Lam a:A. P^a->Pi P:*.P: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   187
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   188
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   189
lemma (in CC) "|- Lam A:*.Lam P:A->*.Pi a:A. P^a: ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   190
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   191
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   192
lemma (in CC) "A:* P:A->* a:A |- ?p : (Pi a:A. P^a)->P^a"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   193
  apply (tactic {* strip_asms_tac (thms "rules") 1 *})
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   194
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   195
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   196
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   197
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   198
  apply (erule pi_elim, assumption, assumption)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   199
  done
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   200
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   201
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   202
subsection {* Some random examples *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   203
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   204
lemma (in LP2) "A:* c:A f:A->A |-
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   205
    Lam a:A. Pi P:A->*.P^c -> (Pi x:A. P^x->P^(f^x)) -> P^a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   206
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   207
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   208
lemma (in CC) "Lam A:*.Lam c:A. Lam f:A->A.
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   209
    Lam a:A. Pi P:A->*.P^c -> (Pi x:A. P^x->P^(f^x)) -> P^a : ?T"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   210
  by (depth_solve rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   211
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   212
lemma (in LP2)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   213
  "A:* a:A b:A |- ?p: (Pi P:A->*.P^a->P^b) -> (Pi P:A->*.P^b->P^a)"
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   214
  -- {* Symmetry of Leibnitz equality *}
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   215
  apply (tactic {* strip_asms_tac (thms "rules") 1 *})
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   216
  apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   217
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   218
   prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   219
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   220
  apply (erule_tac a = "Lam x:A. Pi Q:A->*.Q^x->Q^a" in pi_elim)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   221
   apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   222
  apply (unfold beta)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   223
  apply (erule imp_elim)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   224
   apply (rule lam_bs)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   225
     apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   226
    prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   227
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   228
   apply (rule lam_ss)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   229
     apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   230
    prefer 2
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   231
    apply (depth_solve1 rules)
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   232
   apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   233
  apply assumption
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   234
  done
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   235
e352f65d5893 converted to Isar theory format;
wenzelm
parents: 4583
diff changeset
   236
end