src/HOL/Import/Importer.thy
author wenzelm
Thu, 15 Mar 2012 19:02:34 +0100
changeset 46947 b8c7eb0c2f89
parent 46805 50dbdb9e28ad
child 46950 d0181abdbdac
permissions -rw-r--r--
declare minor keywords via theory header;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46801
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     1
(*  Title:      HOL/Import/Importer.thy
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     2
    Author:     Sebastian Skalberg, TU Muenchen
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     3
*)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     4
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     5
theory Importer
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     6
imports Main
46947
b8c7eb0c2f89 declare minor keywords via theory header;
wenzelm
parents: 46805
diff changeset
     7
keywords ">"
46805
50dbdb9e28ad tuned ML
haftmann
parents: 46801
diff changeset
     8
uses "shuffler.ML" "import_rews.ML" ("proof_kernel.ML") ("replay.ML") ("import.ML")
46801
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
     9
begin
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    10
46805
50dbdb9e28ad tuned ML
haftmann
parents: 46801
diff changeset
    11
setup {* Shuffler.setup #> importer_setup *}
50dbdb9e28ad tuned ML
haftmann
parents: 46801
diff changeset
    12
50dbdb9e28ad tuned ML
haftmann
parents: 46801
diff changeset
    13
parse_ast_translation smarter_trueprop_parsing
46801
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    14
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    15
lemma conj_norm [shuffle_rule]: "(A & B ==> PROP C) == ([| A ; B |] ==> PROP C)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    16
proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    17
  assume "A & B ==> PROP C" A B
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    18
  thus "PROP C"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    19
    by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    20
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    21
  assume "[| A; B |] ==> PROP C" "A & B"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    22
  thus "PROP C"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    23
    by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    24
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    25
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    26
lemma imp_norm [shuffle_rule]: "(Trueprop (A --> B)) == (A ==> B)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    27
proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    28
  assume "A --> B" A
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    29
  thus B ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    30
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    31
  assume "A ==> B"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    32
  thus "A --> B"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    33
    by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    34
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    35
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    36
lemma all_norm [shuffle_rule]: "(Trueprop (ALL x. P x)) == (!!x. P x)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    37
proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    38
  fix x
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    39
  assume "ALL x. P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    40
  thus "P x" ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    41
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    42
  assume "!!x. P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    43
  thus "ALL x. P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    44
    ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    45
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    46
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    47
lemma ex_norm [shuffle_rule]: "(EX x. P x ==> PROP Q) == (!!x. P x ==> PROP Q)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    48
proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    49
  fix x
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    50
  assume ex: "EX x. P x ==> PROP Q"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    51
  assume "P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    52
  hence "EX x. P x" ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    53
  with ex show "PROP Q" .
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    54
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    55
  assume allx: "!!x. P x ==> PROP Q"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    56
  assume "EX x. P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    57
  hence p: "P (SOME x. P x)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    58
    ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    59
  from allx
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    60
  have "P (SOME x. P x) ==> PROP Q"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    61
    .
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    62
  with p
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    63
  show "PROP Q"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    64
    by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    65
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    66
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    67
lemma eq_norm [shuffle_rule]: "Trueprop (t = u) == (t == u)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    68
proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    69
  assume "t = u"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    70
  thus "t == u" by simp
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    71
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    72
  assume "t == u"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    73
  thus "t = u"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    74
    by simp
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    75
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    76
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    77
section {* General Setup *}
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    78
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    79
lemma eq_imp: "P = Q \<Longrightarrow> P \<longrightarrow> Q"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    80
  by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    81
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    82
lemma HOLallI: "(!! bogus. P bogus) \<Longrightarrow> (ALL bogus. P bogus)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    83
proof -
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    84
  assume "!! bogus. P bogus"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    85
  thus "ALL x. P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    86
    ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    87
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    88
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    89
consts
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    90
  ONE_ONE :: "('a => 'b) => bool"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    91
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    92
defs
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    93
  ONE_ONE_DEF: "ONE_ONE f == ALL x y. f x = f y --> x = y"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    94
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    95
lemma ONE_ONE_rew: "ONE_ONE f = inj_on f UNIV"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    96
  by (simp add: ONE_ONE_DEF inj_on_def)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    97
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    98
lemma INFINITY_AX: "EX (f::ind \<Rightarrow> ind). (inj f & ~(surj f))"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
    99
proof (rule exI,safe)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   100
  show "inj Suc_Rep"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   101
    by (rule injI) (rule Suc_Rep_inject)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   102
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   103
  assume "surj Suc_Rep"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   104
  hence "ALL y. EX x. y = Suc_Rep x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   105
    by (simp add: surj_def)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   106
  hence "EX x. Zero_Rep = Suc_Rep x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   107
    by (rule spec)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   108
  thus False
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   109
  proof (rule exE)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   110
    fix x
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   111
    assume "Zero_Rep = Suc_Rep x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   112
    hence "Suc_Rep x = Zero_Rep"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   113
      ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   114
    with Suc_Rep_not_Zero_Rep
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   115
    show False
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   116
      ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   117
  qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   118
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   119
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   120
lemma EXISTS_DEF: "Ex P = P (Eps P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   121
proof (rule iffI)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   122
  assume "Ex P"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   123
  thus "P (Eps P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   124
    ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   125
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   126
  assume "P (Eps P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   127
  thus "Ex P"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   128
    ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   129
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   130
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   131
consts
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   132
  TYPE_DEFINITION :: "('a => bool) => ('b => 'a) => bool"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   133
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   134
defs
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   135
  TYPE_DEFINITION: "TYPE_DEFINITION p rep == ((ALL x y. (rep x = rep y) --> (x = y)) & (ALL x. (p x = (EX y. x = rep y))))"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   136
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   137
lemma ex_imp_nonempty: "Ex P ==> EX x. x : (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   138
  by simp
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   139
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   140
lemma light_ex_imp_nonempty: "P t ==> EX x. x : (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   141
proof -
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   142
  assume "P t"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   143
  hence "EX x. P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   144
    ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   145
  thus ?thesis
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   146
    by (rule ex_imp_nonempty)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   147
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   148
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   149
lemma light_imp_as: "[| Q --> P; P --> Q |] ==> P = Q"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   150
  by blast
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   151
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   152
lemma typedef_hol2hol4:
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   153
  assumes a: "type_definition (Rep::'a=>'b) Abs (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   154
  shows "EX rep. TYPE_DEFINITION P (rep::'a=>'b)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   155
proof -
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   156
  from a
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   157
  have td: "(ALL x. P (Rep x)) & (ALL x. Abs (Rep x) = x) & (ALL y. P y \<longrightarrow> Rep (Abs y) = y)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   158
    by (simp add: type_definition_def)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   159
  have ed: "TYPE_DEFINITION P Rep"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   160
  proof (auto simp add: TYPE_DEFINITION)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   161
    fix x y
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   162
    assume b: "Rep x = Rep y"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   163
    from td have "x = Abs (Rep x)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   164
      by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   165
    also have "Abs (Rep x) = Abs (Rep y)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   166
      by (simp add: b)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   167
    also from td have "Abs (Rep y) = y"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   168
      by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   169
    finally show "x = y" .
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   170
  next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   171
    fix x
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   172
    assume "P x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   173
    with td
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   174
    have "Rep (Abs x) = x"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   175
      by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   176
    hence "x = Rep (Abs x)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   177
      ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   178
    thus "EX y. x = Rep y"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   179
      ..
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   180
  next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   181
    fix y
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   182
    from td
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   183
    show "P (Rep y)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   184
      by auto
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   185
  qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   186
  show ?thesis
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   187
    apply (rule exI [of _ Rep])
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   188
    apply (rule ed)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   189
    .
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   190
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   191
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   192
lemma typedef_hol2hollight:
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   193
  assumes a: "type_definition (Rep::'a=>'b) Abs (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   194
  shows "(Abs (Rep a) = a) & (P r = (Rep (Abs r) = r))"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   195
proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   196
  from a
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   197
  show "Abs (Rep a) = a"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   198
    by (rule type_definition.Rep_inverse)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   199
next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   200
  show "P r = (Rep (Abs r) = r)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   201
  proof
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   202
    assume "P r"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   203
    hence "r \<in> (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   204
      by simp
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   205
    with a
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   206
    show "Rep (Abs r) = r"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   207
      by (rule type_definition.Abs_inverse)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   208
  next
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   209
    assume ra: "Rep (Abs r) = r"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   210
    from a
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   211
    have "Rep (Abs r) \<in> (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   212
      by (rule type_definition.Rep)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   213
    thus "P r"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   214
      by (simp add: ra)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   215
  qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   216
qed
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   217
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   218
lemma termspec_help: "[| Ex P ; c == Eps P |] ==> P c"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   219
  apply simp
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   220
  apply (rule someI_ex)
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   221
  .
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   222
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   223
lemma typedef_helper: "EX x. P x \<Longrightarrow> EX x. x \<in> (Collect P)"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   224
  by simp
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   225
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   226
use "proof_kernel.ML"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   227
use "replay.ML"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   228
use "import.ML"
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   229
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   230
setup Import.setup
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   231
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   232
end
b778cc539601 actually add "the" Importer theory
haftmann
parents:
diff changeset
   233