src/Cube/Example.thy
author haftmann
Mon, 31 May 2021 20:27:45 +0000
changeset 73793 26c0ccf17f31
parent 62020 5d208fd2507d
permissions -rw-r--r--
more accurate export morphism enables proper instantiation by interpretation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58889
5b7a9633cfa8 modernized header uniformly as section;
wenzelm
parents: 58617
diff changeset
     1
section \<open>Lambda Cube Examples\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     3
theory Example
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     4
imports Cube
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     5
begin
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     6
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
     7
text \<open>Examples taken from:
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     8
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
     9
  H. Barendregt. Introduction to Generalised Type Systems.
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    10
  J. Functional Programming.\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    11
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    12
method_setup depth_solve =
59499
14095f771781 misc tuning;
wenzelm
parents: 59498
diff changeset
    13
  \<open>Attrib.thms >> (fn thms => fn ctxt => METHOD (fn facts =>
14095f771781 misc tuning;
wenzelm
parents: 59498
diff changeset
    14
    (DEPTH_SOLVE (HEADGOAL (assume_tac ctxt ORELSE' resolve_tac ctxt (facts @ thms))))))\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    15
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    16
method_setup depth_solve1 =
59499
14095f771781 misc tuning;
wenzelm
parents: 59498
diff changeset
    17
  \<open>Attrib.thms >> (fn thms => fn ctxt => METHOD (fn facts =>
14095f771781 misc tuning;
wenzelm
parents: 59498
diff changeset
    18
    (DEPTH_SOLVE_1 (HEADGOAL (assume_tac ctxt ORELSE' resolve_tac ctxt (facts @ thms))))))\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    19
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    20
method_setup strip_asms =
59498
50b60f501b05 proper context for resolve_tac, eresolve_tac, dresolve_tac, forward_tac etc.;
wenzelm
parents: 58889
diff changeset
    21
  \<open>Attrib.thms >> (fn thms => fn ctxt => METHOD (fn facts =>
61389
wenzelm
parents: 61388
diff changeset
    22
    REPEAT (resolve_tac ctxt @{thms strip_b strip_s} 1 THEN
59499
14095f771781 misc tuning;
wenzelm
parents: 59498
diff changeset
    23
    DEPTH_SOLVE_1 (assume_tac ctxt 1 ORELSE resolve_tac ctxt (facts @ thms) 1))))\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    24
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    25
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    26
subsection \<open>Simple types\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    27
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
    28
schematic_goal "A:* \<turnstile> A\<rightarrow>A : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    29
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    30
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    31
schematic_goal "A:* \<turnstile> \<^bold>\<lambda>a:A. a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    32
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    33
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    34
schematic_goal "A:* B:* b:B \<turnstile> \<^bold>\<lambda>x:A. b : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    35
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    36
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    37
schematic_goal "A:* b:A \<turnstile> (\<^bold>\<lambda>a:A. a)\<cdot>b: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    38
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    39
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    40
schematic_goal "A:* B:* c:A b:B \<turnstile> (\<^bold>\<lambda>x:A. b)\<cdot> c: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    41
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    42
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    43
schematic_goal "A:* B:* \<turnstile> \<^bold>\<lambda>a:A. \<^bold>\<lambda>b:B. a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    44
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    45
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    46
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    47
subsection \<open>Second-order types\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    48
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    49
schematic_goal (in L2) "\<turnstile> \<^bold>\<lambda>A:*. \<^bold>\<lambda>a:A. a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    50
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    51
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
    52
schematic_goal (in L2) "A:* \<turnstile> (\<^bold>\<lambda>B:*. \<^bold>\<lambda>b:B. b)\<cdot>A : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    53
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    54
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
    55
schematic_goal (in L2) "A:* b:A \<turnstile> (\<^bold>\<lambda>B:*. \<^bold>\<lambda>b:B. b) \<cdot> A \<cdot> b: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    56
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    57
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
    58
schematic_goal (in L2) "\<turnstile> \<^bold>\<lambda>B:*. \<^bold>\<lambda>a:(\<Prod>A:*.A).a \<cdot> ((\<Prod>A:*.A)\<rightarrow>B) \<cdot> a: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    59
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    60
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    61
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    62
subsection \<open>Weakly higher-order propositional logic\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    63
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    64
schematic_goal (in Lomega) "\<turnstile> \<^bold>\<lambda>A:*.A\<rightarrow>A : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    65
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    66
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    67
schematic_goal (in Lomega) "B:* \<turnstile> (\<^bold>\<lambda>A:*.A\<rightarrow>A) \<cdot> B : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    68
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    69
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    70
schematic_goal (in Lomega) "B:* b:B \<turnstile> (\<^bold>\<lambda>y:B. b): ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    71
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    72
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    73
schematic_goal (in Lomega) "A:* F:*\<rightarrow>* \<turnstile> F\<cdot>(F\<cdot>A): ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    74
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    75
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    76
schematic_goal (in Lomega) "A:* \<turnstile> \<^bold>\<lambda>F:*\<rightarrow>*.F\<cdot>(F\<cdot>A): ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    77
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    78
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    79
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
    80
subsection \<open>LP\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    81
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
    82
schematic_goal (in LP) "A:* \<turnstile> A \<rightarrow> * : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    83
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    84
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    85
schematic_goal (in LP) "A:* P:A\<rightarrow>* a:A \<turnstile> P\<cdot>a: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    86
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    87
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    88
schematic_goal (in LP) "A:* P:A\<rightarrow>A\<rightarrow>* a:A \<turnstile> \<Prod>a:A. P\<cdot>a\<cdot>a: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    89
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    90
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    91
schematic_goal (in LP) "A:* P:A\<rightarrow>* Q:A\<rightarrow>* \<turnstile> \<Prod>a:A. P\<cdot>a \<rightarrow> Q\<cdot>a: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    92
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    93
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    94
schematic_goal (in LP) "A:* P:A\<rightarrow>* \<turnstile> \<Prod>a:A. P\<cdot>a \<rightarrow> P\<cdot>a: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    95
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    96
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
    97
schematic_goal (in LP) "A:* P:A\<rightarrow>* \<turnstile> \<^bold>\<lambda>a:A. \<^bold>\<lambda>x:P\<cdot>a. x: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    98
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
    99
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   100
schematic_goal (in LP) "A:* P:A\<rightarrow>* Q:* \<turnstile> (\<Prod>a:A. P\<cdot>a\<rightarrow>Q) \<rightarrow> (\<Prod>a:A. P\<cdot>a) \<rightarrow> Q : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   101
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   102
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
   103
schematic_goal (in LP) "A:* P:A\<rightarrow>* Q:* a0:A \<turnstile>
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   104
        \<^bold>\<lambda>x:\<Prod>a:A. P\<cdot>a\<rightarrow>Q. \<^bold>\<lambda>y:\<Prod>a:A. P\<cdot>a. x\<cdot>a0\<cdot>(y\<cdot>a0): ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   105
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   106
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   107
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
   108
subsection \<open>Omega-order types\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   109
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   110
schematic_goal (in L2) "A:* B:* \<turnstile> \<Prod>C:*.(A\<rightarrow>B\<rightarrow>C)\<rightarrow>C : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   111
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   112
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   113
schematic_goal (in Lomega2) "\<turnstile> \<^bold>\<lambda>A:*. \<^bold>\<lambda>B:*.\<Prod>C:*.(A\<rightarrow>B\<rightarrow>C)\<rightarrow>C : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   114
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   115
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   116
schematic_goal (in Lomega2) "\<turnstile> \<^bold>\<lambda>A:*. \<^bold>\<lambda>B:*. \<^bold>\<lambda>x:A. \<^bold>\<lambda>y:B. x : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   117
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   118
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   119
schematic_goal (in Lomega2) "A:* B:* \<turnstile> ?p : (A\<rightarrow>B) \<rightarrow> ((B\<rightarrow>\<Prod>P:*.P)\<rightarrow>(A\<rightarrow>\<Prod>P:*.P))"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   120
  apply (strip_asms rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   121
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   122
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   123
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   124
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   125
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   126
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   127
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   128
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   129
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   130
    apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   131
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   132
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   133
  apply (erule pi_elim)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   134
   apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   135
  apply (erule pi_elim)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   136
   apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   137
  apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   138
  done
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   139
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   140
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
   141
subsection \<open>Second-order Predicate Logic\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   142
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   143
schematic_goal (in LP2) "A:* P:A\<rightarrow>* \<turnstile> \<^bold>\<lambda>a:A. P\<cdot>a\<rightarrow>(\<Prod>A:*.A) : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   144
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   145
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
   146
schematic_goal (in LP2) "A:* P:A\<rightarrow>A\<rightarrow>* \<turnstile>
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   147
    (\<Prod>a:A. \<Prod>b:A. P\<cdot>a\<cdot>b\<rightarrow>P\<cdot>b\<cdot>a\<rightarrow>\<Prod>P:*.P) \<rightarrow> \<Prod>a:A. P\<cdot>a\<cdot>a\<rightarrow>\<Prod>P:*.P : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   148
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   149
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
   150
schematic_goal (in LP2) "A:* P:A\<rightarrow>A\<rightarrow>* \<turnstile>
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   151
    ?p: (\<Prod>a:A. \<Prod>b:A. P\<cdot>a\<cdot>b\<rightarrow>P\<cdot>b\<cdot>a\<rightarrow>\<Prod>P:*.P) \<rightarrow> \<Prod>a:A. P\<cdot>a\<cdot>a\<rightarrow>\<Prod>P:*.P"
62020
5d208fd2507d isabelle update_cartouches -c -t;
wenzelm
parents: 61390
diff changeset
   152
  \<comment> \<open>Antisymmetry implies irreflexivity:\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   153
  apply (strip_asms rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   154
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   155
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   156
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   157
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   158
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   159
    apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   160
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   161
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   162
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   163
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   164
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   165
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   166
  apply (erule pi_elim, assumption, assumption?)+
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   167
  done
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   168
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   169
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
   170
subsection \<open>LPomega\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   171
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   172
schematic_goal (in LPomega) "A:* \<turnstile> \<^bold>\<lambda>P:A\<rightarrow>A\<rightarrow>*. \<^bold>\<lambda>a:A. P\<cdot>a\<cdot>a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   173
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   174
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   175
schematic_goal (in LPomega) "\<turnstile> \<^bold>\<lambda>A:*. \<^bold>\<lambda>P:A\<rightarrow>A\<rightarrow>*. \<^bold>\<lambda>a:A. P\<cdot>a\<cdot>a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   176
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   177
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   178
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
   179
subsection \<open>Constructions\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   180
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   181
schematic_goal (in CC) "\<turnstile> \<^bold>\<lambda>A:*. \<^bold>\<lambda>P:A\<rightarrow>*. \<^bold>\<lambda>a:A. P\<cdot>a\<rightarrow>\<Prod>P:*.P: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   182
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   183
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   184
schematic_goal (in CC) "\<turnstile> \<^bold>\<lambda>A:*. \<^bold>\<lambda>P:A\<rightarrow>*.\<Prod>a:A. P\<cdot>a: ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   185
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   186
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   187
schematic_goal (in CC) "A:* P:A\<rightarrow>* a:A \<turnstile> ?p : (\<Prod>a:A. P\<cdot>a)\<rightarrow>P\<cdot>a"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   188
  apply (strip_asms rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   189
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   190
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   191
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   192
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   193
  apply (erule pi_elim, assumption, assumption)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   194
  done
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   195
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   196
58617
4f169d2cf6f3 more cartouches;
wenzelm
parents: 45242
diff changeset
   197
subsection \<open>Some random examples\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   198
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
   199
schematic_goal (in LP2) "A:* c:A f:A\<rightarrow>A \<turnstile>
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   200
    \<^bold>\<lambda>a:A. \<Prod>P:A\<rightarrow>*.P\<cdot>c \<rightarrow> (\<Prod>x:A. P\<cdot>x\<rightarrow>P\<cdot>(f\<cdot>x)) \<rightarrow> P\<cdot>a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   201
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   202
61390
a705f42b244d tuned whitespace;
wenzelm
parents: 61389
diff changeset
   203
schematic_goal (in CC) "\<^bold>\<lambda>A:*. \<^bold>\<lambda>c:A. \<^bold>\<lambda>f:A\<rightarrow>A.
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   204
    \<^bold>\<lambda>a:A. \<Prod>P:A\<rightarrow>*.P\<cdot>c \<rightarrow> (\<Prod>x:A. P\<cdot>x\<rightarrow>P\<cdot>(f\<cdot>x)) \<rightarrow> P\<cdot>a : ?T"
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   205
  by (depth_solve rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   206
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 59499
diff changeset
   207
schematic_goal (in LP2)
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   208
  "A:* a:A b:A \<turnstile> ?p: (\<Prod>P:A\<rightarrow>*.P\<cdot>a\<rightarrow>P\<cdot>b) \<rightarrow> (\<Prod>P:A\<rightarrow>*.P\<cdot>b\<rightarrow>P\<cdot>a)"
62020
5d208fd2507d isabelle update_cartouches -c -t;
wenzelm
parents: 61390
diff changeset
   209
  \<comment> \<open>Symmetry of Leibnitz equality\<close>
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   210
  apply (strip_asms rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   211
  apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   212
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   213
   prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   214
   apply (depth_solve1 rules)
61388
92e97b800d1e tuned syntax -- more symbols;
wenzelm
parents: 61337
diff changeset
   215
  apply (erule_tac a = "\<^bold>\<lambda>x:A. \<Prod>Q:A\<rightarrow>*.Q\<cdot>x\<rightarrow>Q\<cdot>a" in pi_elim)
17453
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   216
   apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   217
  apply (unfold beta)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   218
  apply (erule imp_elim)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   219
   apply (rule lam_bs)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   220
     apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   221
    prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   222
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   223
   apply (rule lam_ss)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   224
     apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   225
    prefer 2
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   226
    apply (depth_solve1 rules)
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   227
   apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   228
  apply assumption
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   229
  done
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   230
eccff680177d plain test session, includes example;
wenzelm
parents:
diff changeset
   231
end