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