src/HOL/Extraction.thy
author berghofe
Tue Jun 01 11:13:09 2010 +0200 (2010-06-01)
changeset 37233 b78f31ca4675
parent 34913 d8cb720c9c53
child 48891 c0eafbd55de3
permissions -rw-r--r--
Adapted to new format of proof terms containing explicit proofs of class membership.
berghofe@13403
     1
(*  Title:      HOL/Extraction.thy
berghofe@13403
     2
    Author:     Stefan Berghofer, TU Muenchen
berghofe@13403
     3
*)
berghofe@13403
     4
berghofe@13403
     5
header {* Program extraction for HOL *}
berghofe@13403
     6
nipkow@15131
     7
theory Extraction
nipkow@30235
     8
imports Option
haftmann@16417
     9
uses "Tools/rewrite_hol_proof.ML"
nipkow@15131
    10
begin
berghofe@13403
    11
berghofe@13403
    12
subsection {* Setup *}
berghofe@13403
    13
wenzelm@16121
    14
setup {*
wenzelm@18708
    15
  Extraction.add_types
berghofe@29930
    16
      [("bool", ([], NONE))] #>
wenzelm@18708
    17
  Extraction.set_preprocessor (fn thy =>
berghofe@13403
    18
      Proofterm.rewrite_proof_notypes
wenzelm@28797
    19
        ([], RewriteHOLProof.elim_cong :: ProofRewriteRules.rprocs true) o
wenzelm@17203
    20
      Proofterm.rewrite_proof thy
berghofe@37233
    21
        (RewriteHOLProof.rews,
berghofe@37233
    22
         ProofRewriteRules.rprocs true @ [ProofRewriteRules.expand_of_class thy]) o
haftmann@27982
    23
      ProofRewriteRules.elim_vars (curry Const @{const_name default}))
berghofe@13403
    24
*}
berghofe@13403
    25
berghofe@13403
    26
lemmas [extraction_expand] =
berghofe@22281
    27
  meta_spec atomize_eq atomize_all atomize_imp atomize_conj
berghofe@13403
    28
  allE rev_mp conjE Eq_TrueI Eq_FalseI eqTrueI eqTrueE eq_cong2
haftmann@20941
    29
  notE' impE' impE iffE imp_cong simp_thms eq_True eq_False
wenzelm@18456
    30
  induct_forall_eq induct_implies_eq induct_equal_eq induct_conj_eq
berghofe@34913
    31
  induct_atomize induct_atomize' induct_rulify induct_rulify'
berghofe@34913
    32
  induct_rulify_fallback induct_trueI
berghofe@25424
    33
  True_implies_equals TrueE
berghofe@13403
    34
wenzelm@33704
    35
lemmas [extraction_expand_def] =
wenzelm@33704
    36
  induct_forall_def induct_implies_def induct_equal_def induct_conj_def
berghofe@34913
    37
  induct_true_def induct_false_def
wenzelm@33704
    38
berghofe@13403
    39
datatype sumbool = Left | Right
berghofe@13403
    40
berghofe@13403
    41
subsection {* Type of extracted program *}
berghofe@13403
    42
berghofe@13403
    43
extract_type
berghofe@13403
    44
  "typeof (Trueprop P) \<equiv> typeof P"
berghofe@13403
    45
berghofe@13403
    46
  "typeof P \<equiv> Type (TYPE(Null)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE('Q)) \<Longrightarrow>
berghofe@13403
    47
     typeof (P \<longrightarrow> Q) \<equiv> Type (TYPE('Q))"
berghofe@13403
    48
berghofe@13403
    49
  "typeof Q \<equiv> Type (TYPE(Null)) \<Longrightarrow> typeof (P \<longrightarrow> Q) \<equiv> Type (TYPE(Null))"
berghofe@13403
    50
berghofe@13403
    51
  "typeof P \<equiv> Type (TYPE('P)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE('Q)) \<Longrightarrow>
berghofe@13403
    52
     typeof (P \<longrightarrow> Q) \<equiv> Type (TYPE('P \<Rightarrow> 'Q))"
berghofe@13403
    53
berghofe@13403
    54
  "(\<lambda>x. typeof (P x)) \<equiv> (\<lambda>x. Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
    55
     typeof (\<forall>x. P x) \<equiv> Type (TYPE(Null))"
berghofe@13403
    56
berghofe@13403
    57
  "(\<lambda>x. typeof (P x)) \<equiv> (\<lambda>x. Type (TYPE('P))) \<Longrightarrow>
berghofe@13403
    58
     typeof (\<forall>x::'a. P x) \<equiv> Type (TYPE('a \<Rightarrow> 'P))"
berghofe@13403
    59
berghofe@13403
    60
  "(\<lambda>x. typeof (P x)) \<equiv> (\<lambda>x. Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
    61
     typeof (\<exists>x::'a. P x) \<equiv> Type (TYPE('a))"
berghofe@13403
    62
berghofe@13403
    63
  "(\<lambda>x. typeof (P x)) \<equiv> (\<lambda>x. Type (TYPE('P))) \<Longrightarrow>
berghofe@13403
    64
     typeof (\<exists>x::'a. P x) \<equiv> Type (TYPE('a \<times> 'P))"
berghofe@13403
    65
berghofe@13403
    66
  "typeof P \<equiv> Type (TYPE(Null)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE(Null)) \<Longrightarrow>
berghofe@13403
    67
     typeof (P \<or> Q) \<equiv> Type (TYPE(sumbool))"
berghofe@13403
    68
berghofe@13403
    69
  "typeof P \<equiv> Type (TYPE(Null)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE('Q)) \<Longrightarrow>
berghofe@13403
    70
     typeof (P \<or> Q) \<equiv> Type (TYPE('Q option))"
berghofe@13403
    71
berghofe@13403
    72
  "typeof P \<equiv> Type (TYPE('P)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE(Null)) \<Longrightarrow>
berghofe@13403
    73
     typeof (P \<or> Q) \<equiv> Type (TYPE('P option))"
berghofe@13403
    74
berghofe@13403
    75
  "typeof P \<equiv> Type (TYPE('P)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE('Q)) \<Longrightarrow>
berghofe@13403
    76
     typeof (P \<or> Q) \<equiv> Type (TYPE('P + 'Q))"
berghofe@13403
    77
berghofe@13403
    78
  "typeof P \<equiv> Type (TYPE(Null)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE('Q)) \<Longrightarrow>
berghofe@13403
    79
     typeof (P \<and> Q) \<equiv> Type (TYPE('Q))"
berghofe@13403
    80
berghofe@13403
    81
  "typeof P \<equiv> Type (TYPE('P)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE(Null)) \<Longrightarrow>
berghofe@13403
    82
     typeof (P \<and> Q) \<equiv> Type (TYPE('P))"
berghofe@13403
    83
berghofe@13403
    84
  "typeof P \<equiv> Type (TYPE('P)) \<Longrightarrow> typeof Q \<equiv> Type (TYPE('Q)) \<Longrightarrow>
berghofe@13403
    85
     typeof (P \<and> Q) \<equiv> Type (TYPE('P \<times> 'Q))"
berghofe@13403
    86
berghofe@13403
    87
  "typeof (P = Q) \<equiv> typeof ((P \<longrightarrow> Q) \<and> (Q \<longrightarrow> P))"
berghofe@13403
    88
berghofe@13403
    89
  "typeof (x \<in> P) \<equiv> typeof P"
berghofe@13403
    90
berghofe@13403
    91
subsection {* Realizability *}
berghofe@13403
    92
berghofe@13403
    93
realizability
berghofe@13403
    94
  "(realizes t (Trueprop P)) \<equiv> (Trueprop (realizes t P))"
berghofe@13403
    95
berghofe@13403
    96
  "(typeof P) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
    97
     (realizes t (P \<longrightarrow> Q)) \<equiv> (realizes Null P \<longrightarrow> realizes t Q)"
berghofe@13403
    98
berghofe@13403
    99
  "(typeof P) \<equiv> (Type (TYPE('P))) \<Longrightarrow>
berghofe@13403
   100
   (typeof Q) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   101
     (realizes t (P \<longrightarrow> Q)) \<equiv> (\<forall>x::'P. realizes x P \<longrightarrow> realizes Null Q)"
berghofe@13403
   102
berghofe@13403
   103
  "(realizes t (P \<longrightarrow> Q)) \<equiv> (\<forall>x. realizes x P \<longrightarrow> realizes (t x) Q)"
berghofe@13403
   104
berghofe@13403
   105
  "(\<lambda>x. typeof (P x)) \<equiv> (\<lambda>x. Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   106
     (realizes t (\<forall>x. P x)) \<equiv> (\<forall>x. realizes Null (P x))"
berghofe@13403
   107
berghofe@13403
   108
  "(realizes t (\<forall>x. P x)) \<equiv> (\<forall>x. realizes (t x) (P x))"
berghofe@13403
   109
berghofe@13403
   110
  "(\<lambda>x. typeof (P x)) \<equiv> (\<lambda>x. Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   111
     (realizes t (\<exists>x. P x)) \<equiv> (realizes Null (P t))"
berghofe@13403
   112
berghofe@13403
   113
  "(realizes t (\<exists>x. P x)) \<equiv> (realizes (snd t) (P (fst t)))"
berghofe@13403
   114
berghofe@13403
   115
  "(typeof P) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   116
   (typeof Q) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   117
     (realizes t (P \<or> Q)) \<equiv>
berghofe@13403
   118
     (case t of Left \<Rightarrow> realizes Null P | Right \<Rightarrow> realizes Null Q)"
berghofe@13403
   119
berghofe@13403
   120
  "(typeof P) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   121
     (realizes t (P \<or> Q)) \<equiv>
berghofe@13403
   122
     (case t of None \<Rightarrow> realizes Null P | Some q \<Rightarrow> realizes q Q)"
berghofe@13403
   123
berghofe@13403
   124
  "(typeof Q) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   125
     (realizes t (P \<or> Q)) \<equiv>
berghofe@13403
   126
     (case t of None \<Rightarrow> realizes Null Q | Some p \<Rightarrow> realizes p P)"
berghofe@13403
   127
berghofe@13403
   128
  "(realizes t (P \<or> Q)) \<equiv>
berghofe@13403
   129
   (case t of Inl p \<Rightarrow> realizes p P | Inr q \<Rightarrow> realizes q Q)"
berghofe@13403
   130
berghofe@13403
   131
  "(typeof P) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   132
     (realizes t (P \<and> Q)) \<equiv> (realizes Null P \<and> realizes t Q)"
berghofe@13403
   133
berghofe@13403
   134
  "(typeof Q) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
berghofe@13403
   135
     (realizes t (P \<and> Q)) \<equiv> (realizes t P \<and> realizes Null Q)"
berghofe@13403
   136
berghofe@13403
   137
  "(realizes t (P \<and> Q)) \<equiv> (realizes (fst t) P \<and> realizes (snd t) Q)"
berghofe@13403
   138
berghofe@13403
   139
  "typeof P \<equiv> Type (TYPE(Null)) \<Longrightarrow>
berghofe@13403
   140
     realizes t (\<not> P) \<equiv> \<not> realizes Null P"
berghofe@13403
   141
berghofe@13403
   142
  "typeof P \<equiv> Type (TYPE('P)) \<Longrightarrow>
berghofe@13403
   143
     realizes t (\<not> P) \<equiv> (\<forall>x::'P. \<not> realizes x P)"
berghofe@13403
   144
berghofe@13403
   145
  "typeof (P::bool) \<equiv> Type (TYPE(Null)) \<Longrightarrow>
berghofe@13403
   146
   typeof Q \<equiv> Type (TYPE(Null)) \<Longrightarrow>
berghofe@13403
   147
     realizes t (P = Q) \<equiv> realizes Null P = realizes Null Q"
berghofe@13403
   148
berghofe@13403
   149
  "(realizes t (P = Q)) \<equiv> (realizes t ((P \<longrightarrow> Q) \<and> (Q \<longrightarrow> P)))"
berghofe@13403
   150
berghofe@13403
   151
subsection {* Computational content of basic inference rules *}
berghofe@13403
   152
berghofe@13403
   153
theorem disjE_realizer:
berghofe@13403
   154
  assumes r: "case x of Inl p \<Rightarrow> P p | Inr q \<Rightarrow> Q q"
berghofe@13403
   155
  and r1: "\<And>p. P p \<Longrightarrow> R (f p)" and r2: "\<And>q. Q q \<Longrightarrow> R (g q)"
berghofe@13403
   156
  shows "R (case x of Inl p \<Rightarrow> f p | Inr q \<Rightarrow> g q)"
berghofe@13403
   157
proof (cases x)
berghofe@13403
   158
  case Inl
berghofe@13403
   159
  with r show ?thesis by simp (rule r1)
berghofe@13403
   160
next
berghofe@13403
   161
  case Inr
berghofe@13403
   162
  with r show ?thesis by simp (rule r2)
berghofe@13403
   163
qed
berghofe@13403
   164
berghofe@13403
   165
theorem disjE_realizer2:
berghofe@13403
   166
  assumes r: "case x of None \<Rightarrow> P | Some q \<Rightarrow> Q q"
berghofe@13403
   167
  and r1: "P \<Longrightarrow> R f" and r2: "\<And>q. Q q \<Longrightarrow> R (g q)"
berghofe@13403
   168
  shows "R (case x of None \<Rightarrow> f | Some q \<Rightarrow> g q)"
berghofe@13403
   169
proof (cases x)
berghofe@13403
   170
  case None
berghofe@13403
   171
  with r show ?thesis by simp (rule r1)
berghofe@13403
   172
next
berghofe@13403
   173
  case Some
berghofe@13403
   174
  with r show ?thesis by simp (rule r2)
berghofe@13403
   175
qed
berghofe@13403
   176
berghofe@13403
   177
theorem disjE_realizer3:
berghofe@13403
   178
  assumes r: "case x of Left \<Rightarrow> P | Right \<Rightarrow> Q"
berghofe@13403
   179
  and r1: "P \<Longrightarrow> R f" and r2: "Q \<Longrightarrow> R g"
berghofe@13403
   180
  shows "R (case x of Left \<Rightarrow> f | Right \<Rightarrow> g)"
berghofe@13403
   181
proof (cases x)
berghofe@13403
   182
  case Left
berghofe@13403
   183
  with r show ?thesis by simp (rule r1)
berghofe@13403
   184
next
berghofe@13403
   185
  case Right
berghofe@13403
   186
  with r show ?thesis by simp (rule r2)
berghofe@13403
   187
qed
berghofe@13403
   188
berghofe@13403
   189
theorem conjI_realizer:
berghofe@13403
   190
  "P p \<Longrightarrow> Q q \<Longrightarrow> P (fst (p, q)) \<and> Q (snd (p, q))"
berghofe@13403
   191
  by simp
berghofe@13403
   192
berghofe@13403
   193
theorem exI_realizer:
berghofe@13918
   194
  "P y x \<Longrightarrow> P (snd (x, y)) (fst (x, y))" by simp
berghofe@13918
   195
berghofe@13918
   196
theorem exE_realizer: "P (snd p) (fst p) \<Longrightarrow>
berghofe@15393
   197
  (\<And>x y. P y x \<Longrightarrow> Q (f x y)) \<Longrightarrow> Q (let (x, y) = p in f x y)"
berghofe@15393
   198
  by (cases p) (simp add: Let_def)
berghofe@13918
   199
berghofe@13918
   200
theorem exE_realizer': "P (snd p) (fst p) \<Longrightarrow>
berghofe@13918
   201
  (\<And>x y. P y x \<Longrightarrow> Q) \<Longrightarrow> Q" by (cases p) simp
berghofe@13403
   202
berghofe@13403
   203
realizers
berghofe@13725
   204
  impI (P, Q): "\<lambda>pq. pq"
berghofe@37233
   205
    "\<Lambda> (c: _) (d: _) P Q pq (h: _). allI \<cdot> _ \<bullet> c \<bullet> (\<Lambda> x. impI \<cdot> _ \<cdot> _ \<bullet> (h \<cdot> x))"
berghofe@13403
   206
berghofe@13403
   207
  impI (P): "Null"
berghofe@37233
   208
    "\<Lambda> (c: _) P Q (h: _). allI \<cdot> _ \<bullet> c \<bullet> (\<Lambda> x. impI \<cdot> _ \<cdot> _ \<bullet> (h \<cdot> x))"
berghofe@13403
   209
berghofe@37233
   210
  impI (Q): "\<lambda>q. q" "\<Lambda> (c: _) P Q q. impI \<cdot> _ \<cdot> _"
berghofe@13403
   211
berghofe@13725
   212
  impI: "Null" "impI"
berghofe@13403
   213
berghofe@13725
   214
  mp (P, Q): "\<lambda>pq. pq"
berghofe@37233
   215
    "\<Lambda> (c: _) (d: _) P Q pq (h: _) p. mp \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> p \<bullet> c \<bullet> h)"
berghofe@13403
   216
berghofe@13403
   217
  mp (P): "Null"
berghofe@37233
   218
    "\<Lambda> (c: _) P Q (h: _) p. mp \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> p \<bullet> c \<bullet> h)"
berghofe@13403
   219
berghofe@37233
   220
  mp (Q): "\<lambda>q. q" "\<Lambda> (c: _) P Q q. mp \<cdot> _ \<cdot> _"
berghofe@13403
   221
berghofe@13725
   222
  mp: "Null" "mp"
berghofe@13403
   223
berghofe@37233
   224
  allI (P): "\<lambda>p. p" "\<Lambda> (c: _) P (d: _) p. allI \<cdot> _ \<bullet> d"
berghofe@13403
   225
berghofe@13725
   226
  allI: "Null" "allI"
berghofe@13403
   227
berghofe@37233
   228
  spec (P): "\<lambda>x p. p x" "\<Lambda> (c: _) P x (d: _) p. spec \<cdot> _ \<cdot> x \<bullet> d"
berghofe@13403
   229
berghofe@13725
   230
  spec: "Null" "spec"
berghofe@13403
   231
berghofe@37233
   232
  exI (P): "\<lambda>x p. (x, p)" "\<Lambda> (c: _) P x (d: _) p. exI_realizer \<cdot> P \<cdot> p \<cdot> x \<bullet> c \<bullet> d"
berghofe@13403
   233
berghofe@37233
   234
  exI: "\<lambda>x. x" "\<Lambda> P x (c: _) (h: _). h"
berghofe@13403
   235
berghofe@15393
   236
  exE (P, Q): "\<lambda>p pq. let (x, y) = p in pq x y"
berghofe@37233
   237
    "\<Lambda> (c: _) (d: _) P Q (e: _) p (h: _) pq. exE_realizer \<cdot> P \<cdot> p \<cdot> Q \<cdot> pq \<bullet> c \<bullet> e \<bullet> d \<bullet> h"
berghofe@13403
   238
berghofe@13403
   239
  exE (P): "Null"
berghofe@37233
   240
    "\<Lambda> (c: _) P Q (d: _) p. exE_realizer' \<cdot> _ \<cdot> _ \<cdot> _ \<bullet> c \<bullet> d"
berghofe@13403
   241
berghofe@13725
   242
  exE (Q): "\<lambda>x pq. pq x"
berghofe@37233
   243
    "\<Lambda> (c: _) P Q (d: _) x (h1: _) pq (h2: _). h2 \<cdot> x \<bullet> h1"
berghofe@13403
   244
berghofe@13403
   245
  exE: "Null"
berghofe@37233
   246
    "\<Lambda> P Q (c: _) x (h1: _) (h2: _). h2 \<cdot> x \<bullet> h1"
berghofe@13403
   247
berghofe@13725
   248
  conjI (P, Q): "Pair"
berghofe@37233
   249
    "\<Lambda> (c: _) (d: _) P Q p (h: _) q. conjI_realizer \<cdot> P \<cdot> p \<cdot> Q \<cdot> q \<bullet> c \<bullet> d \<bullet> h"
berghofe@13403
   250
berghofe@13725
   251
  conjI (P): "\<lambda>p. p"
berghofe@37233
   252
    "\<Lambda> (c: _) P Q p. conjI \<cdot> _ \<cdot> _"
berghofe@13403
   253
berghofe@13725
   254
  conjI (Q): "\<lambda>q. q"
berghofe@37233
   255
    "\<Lambda> (c: _) P Q (h: _) q. conjI \<cdot> _ \<cdot> _ \<bullet> h"
berghofe@13403
   256
berghofe@13725
   257
  conjI: "Null" "conjI"
berghofe@13403
   258
berghofe@13725
   259
  conjunct1 (P, Q): "fst"
berghofe@37233
   260
    "\<Lambda> (c: _) (d: _) P Q pq. conjunct1 \<cdot> _ \<cdot> _"
berghofe@13403
   261
berghofe@13725
   262
  conjunct1 (P): "\<lambda>p. p"
berghofe@37233
   263
    "\<Lambda> (c: _) P Q p. conjunct1 \<cdot> _ \<cdot> _"
berghofe@13403
   264
berghofe@13403
   265
  conjunct1 (Q): "Null"
berghofe@37233
   266
    "\<Lambda> (c: _) P Q q. conjunct1 \<cdot> _ \<cdot> _"
berghofe@13403
   267
berghofe@13725
   268
  conjunct1: "Null" "conjunct1"
berghofe@13403
   269
berghofe@13725
   270
  conjunct2 (P, Q): "snd"
berghofe@37233
   271
    "\<Lambda> (c: _) (d: _) P Q pq. conjunct2 \<cdot> _ \<cdot> _"
berghofe@13403
   272
berghofe@13403
   273
  conjunct2 (P): "Null"
berghofe@37233
   274
    "\<Lambda> (c: _) P Q p. conjunct2 \<cdot> _ \<cdot> _"
berghofe@13403
   275
berghofe@13725
   276
  conjunct2 (Q): "\<lambda>p. p"
berghofe@37233
   277
    "\<Lambda> (c: _) P Q p. conjunct2 \<cdot> _ \<cdot> _"
berghofe@13403
   278
berghofe@13725
   279
  conjunct2: "Null" "conjunct2"
berghofe@13725
   280
berghofe@13725
   281
  disjI1 (P, Q): "Inl"
berghofe@37233
   282
    "\<Lambda> (c: _) (d: _) P Q p. iffD2 \<cdot> _ \<cdot> _ \<bullet> (sum.cases_1 \<cdot> P \<cdot> _ \<cdot> p \<bullet> arity_type_bool \<bullet> c \<bullet> d)"
berghofe@13403
   283
berghofe@13725
   284
  disjI1 (P): "Some"
berghofe@37233
   285
    "\<Lambda> (c: _) P Q p. iffD2 \<cdot> _ \<cdot> _ \<bullet> (option.cases_2 \<cdot> _ \<cdot> P \<cdot> p \<bullet> arity_type_bool \<bullet> c)"
berghofe@13403
   286
berghofe@13725
   287
  disjI1 (Q): "None"
berghofe@37233
   288
    "\<Lambda> (c: _) P Q. iffD2 \<cdot> _ \<cdot> _ \<bullet> (option.cases_1 \<cdot> _ \<cdot> _ \<bullet> arity_type_bool \<bullet> c)"
berghofe@13403
   289
berghofe@13725
   290
  disjI1: "Left"
berghofe@37233
   291
    "\<Lambda> P Q. iffD2 \<cdot> _ \<cdot> _ \<bullet> (sumbool.cases_1 \<cdot> _ \<cdot> _ \<bullet> arity_type_bool)"
berghofe@13403
   292
berghofe@13725
   293
  disjI2 (P, Q): "Inr"
berghofe@37233
   294
    "\<Lambda> (d: _) (c: _) Q P q. iffD2 \<cdot> _ \<cdot> _ \<bullet> (sum.cases_2 \<cdot> _ \<cdot> Q \<cdot> q \<bullet> arity_type_bool \<bullet> c \<bullet> d)"
berghofe@13403
   295
berghofe@13725
   296
  disjI2 (P): "None"
berghofe@37233
   297
    "\<Lambda> (c: _) Q P. iffD2 \<cdot> _ \<cdot> _ \<bullet> (option.cases_1 \<cdot> _ \<cdot> _ \<bullet> arity_type_bool \<bullet> c)"
berghofe@13403
   298
berghofe@13725
   299
  disjI2 (Q): "Some"
berghofe@37233
   300
    "\<Lambda> (c: _) Q P q. iffD2 \<cdot> _ \<cdot> _ \<bullet> (option.cases_2 \<cdot> _ \<cdot> Q \<cdot> q \<bullet> arity_type_bool \<bullet> c)"
berghofe@13403
   301
berghofe@13725
   302
  disjI2: "Right"
berghofe@37233
   303
    "\<Lambda> Q P. iffD2 \<cdot> _ \<cdot> _ \<bullet> (sumbool.cases_2 \<cdot> _ \<cdot> _ \<bullet> arity_type_bool)"
berghofe@13403
   304
berghofe@13725
   305
  disjE (P, Q, R): "\<lambda>pq pr qr.
berghofe@13403
   306
     (case pq of Inl p \<Rightarrow> pr p | Inr q \<Rightarrow> qr q)"
berghofe@37233
   307
    "\<Lambda> (c: _) (d: _) (e: _) P Q R pq (h1: _) pr (h2: _) qr.
berghofe@37233
   308
       disjE_realizer \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> pr \<cdot> qr \<bullet> c \<bullet> d \<bullet> e \<bullet> h1 \<bullet> h2"
berghofe@13403
   309
berghofe@13725
   310
  disjE (Q, R): "\<lambda>pq pr qr.
berghofe@13403
   311
     (case pq of None \<Rightarrow> pr | Some q \<Rightarrow> qr q)"
berghofe@37233
   312
    "\<Lambda> (c: _) (d: _) P Q R pq (h1: _) pr (h2: _) qr.
berghofe@37233
   313
       disjE_realizer2 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> pr \<cdot> qr \<bullet> c \<bullet> d \<bullet> h1 \<bullet> h2"
berghofe@13403
   314
berghofe@13725
   315
  disjE (P, R): "\<lambda>pq pr qr.
berghofe@13403
   316
     (case pq of None \<Rightarrow> qr | Some p \<Rightarrow> pr p)"
berghofe@37233
   317
    "\<Lambda> (c: _) (d: _) P Q R pq (h1: _) pr (h2: _) qr (h3: _).
berghofe@37233
   318
       disjE_realizer2 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> qr \<cdot> pr \<bullet> c \<bullet> d \<bullet> h1 \<bullet> h3 \<bullet> h2"
berghofe@13403
   319
berghofe@13725
   320
  disjE (R): "\<lambda>pq pr qr.
berghofe@13403
   321
     (case pq of Left \<Rightarrow> pr | Right \<Rightarrow> qr)"
berghofe@37233
   322
    "\<Lambda> (c: _) P Q R pq (h1: _) pr (h2: _) qr.
berghofe@37233
   323
       disjE_realizer3 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> pr \<cdot> qr \<bullet> c \<bullet> h1 \<bullet> h2"
berghofe@13403
   324
berghofe@13403
   325
  disjE (P, Q): "Null"
berghofe@37233
   326
    "\<Lambda> (c: _) (d: _) P Q R pq. disjE_realizer \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> (\<lambda>x. R) \<cdot> _ \<cdot> _ \<bullet> c \<bullet> d \<bullet> arity_type_bool"
berghofe@13403
   327
berghofe@13403
   328
  disjE (Q): "Null"
berghofe@37233
   329
    "\<Lambda> (c: _) P Q R pq. disjE_realizer2 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> (\<lambda>x. R) \<cdot> _ \<cdot> _ \<bullet> c \<bullet> arity_type_bool"
berghofe@13403
   330
berghofe@13403
   331
  disjE (P): "Null"
berghofe@37233
   332
    "\<Lambda> (c: _) P Q R pq (h1: _) (h2: _) (h3: _).
berghofe@37233
   333
       disjE_realizer2 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> (\<lambda>x. R) \<cdot> _ \<cdot> _ \<bullet> c \<bullet> arity_type_bool \<bullet> h1 \<bullet> h3 \<bullet> h2"
berghofe@13403
   334
berghofe@13403
   335
  disjE: "Null"
berghofe@37233
   336
    "\<Lambda> P Q R pq. disjE_realizer3 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> (\<lambda>x. R) \<cdot> _ \<cdot> _ \<bullet> arity_type_bool"
berghofe@13403
   337
haftmann@27982
   338
  FalseE (P): "default"
berghofe@37233
   339
    "\<Lambda> (c: _) P. FalseE \<cdot> _"
berghofe@13403
   340
berghofe@13725
   341
  FalseE: "Null" "FalseE"
berghofe@13403
   342
berghofe@13403
   343
  notI (P): "Null"
berghofe@37233
   344
    "\<Lambda> (c: _) P (h: _). allI \<cdot> _ \<bullet> c \<bullet> (\<Lambda> x. notI \<cdot> _ \<bullet> (h \<cdot> x))"
berghofe@13403
   345
berghofe@13725
   346
  notI: "Null" "notI"
berghofe@13403
   347
haftmann@27982
   348
  notE (P, R): "\<lambda>p. default"
berghofe@37233
   349
    "\<Lambda> (c: _) (d: _) P R (h: _) p. notE \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> p \<bullet> c \<bullet> h)"
berghofe@13403
   350
berghofe@13403
   351
  notE (P): "Null"
berghofe@37233
   352
    "\<Lambda> (c: _) P R (h: _) p. notE \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> p \<bullet> c \<bullet> h)"
berghofe@13403
   353
haftmann@27982
   354
  notE (R): "default"
berghofe@37233
   355
    "\<Lambda> (c: _) P R. notE \<cdot> _ \<cdot> _"
berghofe@13403
   356
berghofe@13725
   357
  notE: "Null" "notE"
berghofe@13403
   358
berghofe@13725
   359
  subst (P): "\<lambda>s t ps. ps"
berghofe@37233
   360
    "\<Lambda> (c: _) s t P (d: _) (h: _) ps. subst \<cdot> s \<cdot> t \<cdot> P ps \<bullet> d \<bullet> h"
berghofe@13403
   361
berghofe@13725
   362
  subst: "Null" "subst"
berghofe@13725
   363
berghofe@13725
   364
  iffD1 (P, Q): "fst"
berghofe@37233
   365
    "\<Lambda> (d: _) (c: _) Q P pq (h: _) p.
berghofe@37233
   366
       mp \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> p \<bullet> d \<bullet> (conjunct1 \<cdot> _ \<cdot> _ \<bullet> h))"
berghofe@13403
   367
berghofe@13725
   368
  iffD1 (P): "\<lambda>p. p"
berghofe@37233
   369
    "\<Lambda> (c: _) Q P p (h: _). mp \<cdot> _ \<cdot> _ \<bullet> (conjunct1 \<cdot> _ \<cdot> _ \<bullet> h)"
berghofe@13403
   370
berghofe@13403
   371
  iffD1 (Q): "Null"
berghofe@37233
   372
    "\<Lambda> (c: _) Q P q1 (h: _) q2.
berghofe@37233
   373
       mp \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> q2 \<bullet> c \<bullet> (conjunct1 \<cdot> _ \<cdot> _ \<bullet> h))"
berghofe@13403
   374
berghofe@13725
   375
  iffD1: "Null" "iffD1"
berghofe@13403
   376
berghofe@13725
   377
  iffD2 (P, Q): "snd"
berghofe@37233
   378
    "\<Lambda> (c: _) (d: _) P Q pq (h: _) q.
berghofe@37233
   379
       mp \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> q \<bullet> d \<bullet> (conjunct2 \<cdot> _ \<cdot> _ \<bullet> h))"
berghofe@13403
   380
berghofe@13725
   381
  iffD2 (P): "\<lambda>p. p"
berghofe@37233
   382
    "\<Lambda> (c: _) P Q p (h: _). mp \<cdot> _ \<cdot> _ \<bullet> (conjunct2 \<cdot> _ \<cdot> _ \<bullet> h)"
berghofe@13403
   383
berghofe@13403
   384
  iffD2 (Q): "Null"
berghofe@37233
   385
    "\<Lambda> (c: _) P Q q1 (h: _) q2.
berghofe@37233
   386
       mp \<cdot> _ \<cdot> _ \<bullet> (spec \<cdot> _ \<cdot> q2 \<bullet> c \<bullet> (conjunct2 \<cdot> _ \<cdot> _ \<bullet> h))"
berghofe@13403
   387
berghofe@13725
   388
  iffD2: "Null" "iffD2"
berghofe@13403
   389
berghofe@13725
   390
  iffI (P, Q): "Pair"
berghofe@37233
   391
    "\<Lambda> (c: _) (d: _) P Q pq (h1 : _) qp (h2 : _). conjI_realizer \<cdot>
berghofe@13725
   392
       (\<lambda>pq. \<forall>x. P x \<longrightarrow> Q (pq x)) \<cdot> pq \<cdot>
berghofe@13725
   393
       (\<lambda>qp. \<forall>x. Q x \<longrightarrow> P (qp x)) \<cdot> qp \<bullet>
berghofe@37233
   394
       (arity_type_fun \<bullet> c \<bullet> d) \<bullet>
berghofe@37233
   395
       (arity_type_fun \<bullet> d \<bullet> c) \<bullet>
berghofe@37233
   396
       (allI \<cdot> _ \<bullet> c \<bullet> (\<Lambda> x. impI \<cdot> _ \<cdot> _ \<bullet> (h1 \<cdot> x))) \<bullet>
berghofe@37233
   397
       (allI \<cdot> _ \<bullet> d \<bullet> (\<Lambda> x. impI \<cdot> _ \<cdot> _ \<bullet> (h2 \<cdot> x)))"
berghofe@13403
   398
berghofe@13725
   399
  iffI (P): "\<lambda>p. p"
berghofe@37233
   400
    "\<Lambda> (c: _) P Q (h1 : _) p (h2 : _). conjI \<cdot> _ \<cdot> _ \<bullet>
berghofe@37233
   401
       (allI \<cdot> _ \<bullet> c \<bullet> (\<Lambda> x. impI \<cdot> _ \<cdot> _ \<bullet> (h1 \<cdot> x))) \<bullet>
berghofe@13403
   402
       (impI \<cdot> _ \<cdot> _ \<bullet> h2)"
berghofe@13403
   403
berghofe@13725
   404
  iffI (Q): "\<lambda>q. q"
berghofe@37233
   405
    "\<Lambda> (c: _) P Q q (h1 : _) (h2 : _). conjI \<cdot> _ \<cdot> _ \<bullet>
berghofe@13403
   406
       (impI \<cdot> _ \<cdot> _ \<bullet> h1) \<bullet>
berghofe@37233
   407
       (allI \<cdot> _ \<bullet> c \<bullet> (\<Lambda> x. impI \<cdot> _ \<cdot> _ \<bullet> (h2 \<cdot> x)))"
berghofe@13403
   408
berghofe@13725
   409
  iffI: "Null" "iffI"
berghofe@13403
   410
berghofe@13403
   411
end