src/HOL/HOLCF/Domain.thy
author wenzelm
Thu Mar 14 16:55:06 2019 +0100 (5 weeks ago)
changeset 69913 ca515cf61651
parent 69605 a96320074298
permissions -rw-r--r--
more specific keyword kinds;
wenzelm@42151
     1
(*  Title:      HOL/HOLCF/Domain.thy
huffman@15741
     2
    Author:     Brian Huffman
huffman@15741
     3
*)
huffman@15741
     4
wenzelm@62175
     5
section \<open>Domain package\<close>
huffman@15741
     6
huffman@15741
     7
theory Domain
huffman@41285
     8
imports Representable Domain_Aux
wenzelm@46950
     9
keywords
wenzelm@63432
    10
  "lazy" "unsafe" and
wenzelm@69913
    11
  "domaindef" "domain" :: thy_defn and
wenzelm@69913
    12
  "domain_isomorphism" :: thy_decl
huffman@15741
    13
begin
huffman@15741
    14
huffman@40504
    15
default_sort "domain"
huffman@40504
    16
wenzelm@62175
    17
subsection \<open>Representations of types\<close>
huffman@40504
    18
huffman@40504
    19
lemma emb_prj: "emb\<cdot>((prj\<cdot>x)::'a) = cast\<cdot>DEFL('a)\<cdot>x"
huffman@40504
    20
by (simp add: cast_DEFL)
huffman@40504
    21
huffman@40504
    22
lemma emb_prj_emb:
huffman@40504
    23
  fixes x :: "'a"
huffman@40504
    24
  assumes "DEFL('a) \<sqsubseteq> DEFL('b)"
huffman@40504
    25
  shows "emb\<cdot>(prj\<cdot>(emb\<cdot>x) :: 'b) = emb\<cdot>x"
huffman@40504
    26
unfolding emb_prj
huffman@40504
    27
apply (rule cast.belowD)
huffman@40504
    28
apply (rule monofun_cfun_arg [OF assms])
huffman@40504
    29
apply (simp add: cast_DEFL)
huffman@40504
    30
done
huffman@40504
    31
huffman@40504
    32
lemma prj_emb_prj:
huffman@40504
    33
  assumes "DEFL('a) \<sqsubseteq> DEFL('b)"
huffman@40504
    34
  shows "prj\<cdot>(emb\<cdot>(prj\<cdot>x :: 'b)) = (prj\<cdot>x :: 'a)"
huffman@40504
    35
 apply (rule emb_eq_iff [THEN iffD1])
huffman@40504
    36
 apply (simp only: emb_prj)
huffman@40504
    37
 apply (rule deflation_below_comp1)
huffman@40504
    38
   apply (rule deflation_cast)
huffman@40504
    39
  apply (rule deflation_cast)
huffman@40504
    40
 apply (rule monofun_cfun_arg [OF assms])
huffman@40504
    41
done
huffman@40504
    42
wenzelm@62175
    43
text \<open>Isomorphism lemmas used internally by the domain package:\<close>
huffman@40504
    44
huffman@40504
    45
lemma domain_abs_iso:
huffman@40504
    46
  fixes abs and rep
huffman@40504
    47
  assumes DEFL: "DEFL('b) = DEFL('a)"
huffman@40504
    48
  assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb"
huffman@40504
    49
  assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb"
huffman@40504
    50
  shows "rep\<cdot>(abs\<cdot>x) = x"
huffman@40504
    51
unfolding abs_def rep_def
huffman@40504
    52
by (simp add: emb_prj_emb DEFL)
huffman@40504
    53
huffman@40504
    54
lemma domain_rep_iso:
huffman@40504
    55
  fixes abs and rep
huffman@40504
    56
  assumes DEFL: "DEFL('b) = DEFL('a)"
huffman@40504
    57
  assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb"
huffman@40504
    58
  assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb"
huffman@40504
    59
  shows "abs\<cdot>(rep\<cdot>x) = x"
huffman@40504
    60
unfolding abs_def rep_def
huffman@40504
    61
by (simp add: emb_prj_emb DEFL)
huffman@40504
    62
wenzelm@62175
    63
subsection \<open>Deflations as sets\<close>
huffman@40504
    64
huffman@41287
    65
definition defl_set :: "'a::bifinite defl \<Rightarrow> 'a set"
huffman@40504
    66
where "defl_set A = {x. cast\<cdot>A\<cdot>x = x}"
huffman@40504
    67
huffman@40504
    68
lemma adm_defl_set: "adm (\<lambda>x. x \<in> defl_set A)"
huffman@40504
    69
unfolding defl_set_def by simp
huffman@40504
    70
huffman@40504
    71
lemma defl_set_bottom: "\<bottom> \<in> defl_set A"
huffman@40504
    72
unfolding defl_set_def by simp
huffman@40504
    73
huffman@40504
    74
lemma defl_set_cast [simp]: "cast\<cdot>A\<cdot>x \<in> defl_set A"
huffman@40504
    75
unfolding defl_set_def by simp
huffman@40504
    76
huffman@40504
    77
lemma defl_set_subset_iff: "defl_set A \<subseteq> defl_set B \<longleftrightarrow> A \<sqsubseteq> B"
huffman@40504
    78
apply (simp add: defl_set_def subset_eq cast_below_cast [symmetric])
huffman@40504
    79
apply (auto simp add: cast.belowI cast.belowD)
huffman@40504
    80
done
huffman@40504
    81
wenzelm@62175
    82
subsection \<open>Proving a subtype is representable\<close>
huffman@40504
    83
wenzelm@62175
    84
text \<open>Temporarily relax type constraints.\<close>
huffman@40504
    85
wenzelm@62175
    86
setup \<open>
huffman@40504
    87
  fold Sign.add_const_constraint
wenzelm@69597
    88
  [ (\<^const_name>\<open>defl\<close>, SOME \<^typ>\<open>'a::pcpo itself \<Rightarrow> udom defl\<close>)
wenzelm@69597
    89
  , (\<^const_name>\<open>emb\<close>, SOME \<^typ>\<open>'a::pcpo \<rightarrow> udom\<close>)
wenzelm@69597
    90
  , (\<^const_name>\<open>prj\<close>, SOME \<^typ>\<open>udom \<rightarrow> 'a::pcpo\<close>)
wenzelm@69597
    91
  , (\<^const_name>\<open>liftdefl\<close>, SOME \<^typ>\<open>'a::pcpo itself \<Rightarrow> udom u defl\<close>)
wenzelm@69597
    92
  , (\<^const_name>\<open>liftemb\<close>, SOME \<^typ>\<open>'a::pcpo u \<rightarrow> udom u\<close>)
wenzelm@69597
    93
  , (\<^const_name>\<open>liftprj\<close>, SOME \<^typ>\<open>udom u \<rightarrow> 'a::pcpo u\<close>) ]
wenzelm@62175
    94
\<close>
huffman@40504
    95
huffman@41292
    96
lemma typedef_domain_class:
huffman@40504
    97
  fixes Rep :: "'a::pcpo \<Rightarrow> udom"
huffman@40504
    98
  fixes Abs :: "udom \<Rightarrow> 'a::pcpo"
huffman@41287
    99
  fixes t :: "udom defl"
huffman@40504
   100
  assumes type: "type_definition Rep Abs (defl_set t)"
nipkow@67399
   101
  assumes below: "(\<sqsubseteq>) \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
huffman@40504
   102
  assumes emb: "emb \<equiv> (\<Lambda> x. Rep x)"
huffman@40504
   103
  assumes prj: "prj \<equiv> (\<Lambda> x. Abs (cast\<cdot>t\<cdot>x))"
huffman@40504
   104
  assumes defl: "defl \<equiv> (\<lambda> a::'a itself. t)"
huffman@41292
   105
  assumes liftemb: "(liftemb :: 'a u \<rightarrow> udom u) \<equiv> u_map\<cdot>emb"
huffman@41292
   106
  assumes liftprj: "(liftprj :: udom u \<rightarrow> 'a u) \<equiv> u_map\<cdot>prj"
huffman@41436
   107
  assumes liftdefl: "(liftdefl :: 'a itself \<Rightarrow> _) \<equiv> (\<lambda>t. liftdefl_of\<cdot>DEFL('a))"
huffman@41292
   108
  shows "OFCLASS('a, domain_class)"
huffman@41292
   109
proof
huffman@40504
   110
  have emb_beta: "\<And>x. emb\<cdot>x = Rep x"
huffman@40504
   111
    unfolding emb
huffman@40504
   112
    apply (rule beta_cfun)
huffman@40834
   113
    apply (rule typedef_cont_Rep [OF type below adm_defl_set cont_id])
huffman@40504
   114
    done
huffman@40504
   115
  have prj_beta: "\<And>y. prj\<cdot>y = Abs (cast\<cdot>t\<cdot>y)"
huffman@40504
   116
    unfolding prj
huffman@40504
   117
    apply (rule beta_cfun)
huffman@40504
   118
    apply (rule typedef_cont_Abs [OF type below adm_defl_set])
huffman@40504
   119
    apply simp_all
huffman@40504
   120
    done
huffman@40504
   121
  have prj_emb: "\<And>x::'a. prj\<cdot>(emb\<cdot>x) = x"
huffman@40504
   122
    using type_definition.Rep [OF type]
huffman@40504
   123
    unfolding prj_beta emb_beta defl_set_def
huffman@40504
   124
    by (simp add: type_definition.Rep_inverse [OF type])
huffman@40504
   125
  have emb_prj: "\<And>y. emb\<cdot>(prj\<cdot>y :: 'a) = cast\<cdot>t\<cdot>y"
huffman@40504
   126
    unfolding prj_beta emb_beta
huffman@40504
   127
    by (simp add: type_definition.Abs_inverse [OF type])
huffman@40504
   128
  show "ep_pair (emb :: 'a \<rightarrow> udom) prj"
wenzelm@61169
   129
    apply standard
huffman@40504
   130
    apply (simp add: prj_emb)
huffman@40504
   131
    apply (simp add: emb_prj cast.below)
huffman@40504
   132
    done
huffman@40504
   133
  show "cast\<cdot>DEFL('a) = emb oo (prj :: udom \<rightarrow> 'a)"
huffman@40504
   134
    by (rule cfun_eqI, simp add: defl emb_prj)
huffman@41292
   135
qed (simp_all only: liftemb liftprj liftdefl)
huffman@40504
   136
huffman@40504
   137
lemma typedef_DEFL:
huffman@40504
   138
  assumes "defl \<equiv> (\<lambda>a::'a::pcpo itself. t)"
huffman@40504
   139
  shows "DEFL('a::pcpo) = t"
huffman@40504
   140
unfolding assms ..
huffman@40504
   141
wenzelm@62175
   142
text \<open>Restore original typing constraints.\<close>
huffman@40504
   143
wenzelm@62175
   144
setup \<open>
huffman@40504
   145
  fold Sign.add_const_constraint
wenzelm@69597
   146
   [(\<^const_name>\<open>defl\<close>, SOME \<^typ>\<open>'a::domain itself \<Rightarrow> udom defl\<close>),
wenzelm@69597
   147
    (\<^const_name>\<open>emb\<close>, SOME \<^typ>\<open>'a::domain \<rightarrow> udom\<close>),
wenzelm@69597
   148
    (\<^const_name>\<open>prj\<close>, SOME \<^typ>\<open>udom \<rightarrow> 'a::domain\<close>),
wenzelm@69597
   149
    (\<^const_name>\<open>liftdefl\<close>, SOME \<^typ>\<open>'a::predomain itself \<Rightarrow> udom u defl\<close>),
wenzelm@69597
   150
    (\<^const_name>\<open>liftemb\<close>, SOME \<^typ>\<open>'a::predomain u \<rightarrow> udom u\<close>),
wenzelm@69597
   151
    (\<^const_name>\<open>liftprj\<close>, SOME \<^typ>\<open>udom u \<rightarrow> 'a::predomain u\<close>)]
wenzelm@62175
   152
\<close>
huffman@40504
   153
wenzelm@69605
   154
ML_file \<open>Tools/domaindef.ML\<close>
huffman@40504
   155
wenzelm@62175
   156
subsection \<open>Isomorphic deflations\<close>
huffman@40504
   157
huffman@41292
   158
definition isodefl :: "('a \<rightarrow> 'a) \<Rightarrow> udom defl \<Rightarrow> bool"
huffman@41292
   159
  where "isodefl d t \<longleftrightarrow> cast\<cdot>t = emb oo d oo prj"
huffman@41292
   160
huffman@41292
   161
definition isodefl' :: "('a::predomain \<rightarrow> 'a) \<Rightarrow> udom u defl \<Rightarrow> bool"
huffman@41292
   162
  where "isodefl' d t \<longleftrightarrow> cast\<cdot>t = liftemb oo u_map\<cdot>d oo liftprj"
huffman@40504
   163
huffman@40504
   164
lemma isodeflI: "(\<And>x. cast\<cdot>t\<cdot>x = emb\<cdot>(d\<cdot>(prj\<cdot>x))) \<Longrightarrow> isodefl d t"
huffman@40504
   165
unfolding isodefl_def by (simp add: cfun_eqI)
huffman@40504
   166
huffman@40504
   167
lemma cast_isodefl: "isodefl d t \<Longrightarrow> cast\<cdot>t = (\<Lambda> x. emb\<cdot>(d\<cdot>(prj\<cdot>x)))"
huffman@40504
   168
unfolding isodefl_def by (simp add: cfun_eqI)
huffman@40504
   169
huffman@40504
   170
lemma isodefl_strict: "isodefl d t \<Longrightarrow> d\<cdot>\<bottom> = \<bottom>"
huffman@40504
   171
unfolding isodefl_def
huffman@40504
   172
by (drule cfun_fun_cong [where x="\<bottom>"], simp)
huffman@40504
   173
huffman@40504
   174
lemma isodefl_imp_deflation:
huffman@40504
   175
  fixes d :: "'a \<rightarrow> 'a"
huffman@40504
   176
  assumes "isodefl d t" shows "deflation d"
huffman@40504
   177
proof
huffman@40504
   178
  note assms [unfolded isodefl_def, simp]
huffman@40504
   179
  fix x :: 'a
huffman@40504
   180
  show "d\<cdot>(d\<cdot>x) = d\<cdot>x"
huffman@40504
   181
    using cast.idem [of t "emb\<cdot>x"] by simp
huffman@40504
   182
  show "d\<cdot>x \<sqsubseteq> x"
huffman@40504
   183
    using cast.below [of t "emb\<cdot>x"] by simp
huffman@40504
   184
qed
huffman@40504
   185
huffman@40504
   186
lemma isodefl_ID_DEFL: "isodefl (ID :: 'a \<rightarrow> 'a) DEFL('a)"
huffman@40504
   187
unfolding isodefl_def by (simp add: cast_DEFL)
huffman@40504
   188
huffman@40504
   189
lemma isodefl_LIFTDEFL:
huffman@41292
   190
  "isodefl' (ID :: 'a \<rightarrow> 'a) LIFTDEFL('a::predomain)"
huffman@41292
   191
unfolding isodefl'_def by (simp add: cast_liftdefl u_map_ID)
huffman@40504
   192
huffman@40504
   193
lemma isodefl_DEFL_imp_ID: "isodefl (d :: 'a \<rightarrow> 'a) DEFL('a) \<Longrightarrow> d = ID"
huffman@40504
   194
unfolding isodefl_def
huffman@40504
   195
apply (simp add: cast_DEFL)
huffman@40504
   196
apply (simp add: cfun_eq_iff)
huffman@40504
   197
apply (rule allI)
huffman@40504
   198
apply (drule_tac x="emb\<cdot>x" in spec)
huffman@40504
   199
apply simp
huffman@40504
   200
done
huffman@40504
   201
huffman@40504
   202
lemma isodefl_bottom: "isodefl \<bottom> \<bottom>"
huffman@40504
   203
unfolding isodefl_def by (simp add: cfun_eq_iff)
huffman@40504
   204
huffman@40504
   205
lemma adm_isodefl:
huffman@40504
   206
  "cont f \<Longrightarrow> cont g \<Longrightarrow> adm (\<lambda>x. isodefl (f x) (g x))"
huffman@40504
   207
unfolding isodefl_def by simp
huffman@40504
   208
huffman@40504
   209
lemma isodefl_lub:
huffman@40504
   210
  assumes "chain d" and "chain t"
huffman@40504
   211
  assumes "\<And>i. isodefl (d i) (t i)"
huffman@40504
   212
  shows "isodefl (\<Squnion>i. d i) (\<Squnion>i. t i)"
wenzelm@41529
   213
using assms unfolding isodefl_def
huffman@40504
   214
by (simp add: contlub_cfun_arg contlub_cfun_fun)
huffman@40504
   215
huffman@40504
   216
lemma isodefl_fix:
huffman@40504
   217
  assumes "\<And>d t. isodefl d t \<Longrightarrow> isodefl (f\<cdot>d) (g\<cdot>t)"
huffman@40504
   218
  shows "isodefl (fix\<cdot>f) (fix\<cdot>g)"
huffman@40504
   219
unfolding fix_def2
huffman@40504
   220
apply (rule isodefl_lub, simp, simp)
huffman@40504
   221
apply (induct_tac i)
huffman@40504
   222
apply (simp add: isodefl_bottom)
huffman@40504
   223
apply (simp add: assms)
huffman@40504
   224
done
huffman@40504
   225
huffman@40504
   226
lemma isodefl_abs_rep:
huffman@40504
   227
  fixes abs and rep and d
huffman@40504
   228
  assumes DEFL: "DEFL('b) = DEFL('a)"
huffman@40504
   229
  assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb"
huffman@40504
   230
  assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb"
huffman@40504
   231
  shows "isodefl d t \<Longrightarrow> isodefl (abs oo d oo rep) t"
huffman@40504
   232
unfolding isodefl_def
huffman@40504
   233
by (simp add: cfun_eq_iff assms prj_emb_prj emb_prj_emb)
huffman@40504
   234
huffman@41436
   235
lemma isodefl'_liftdefl_of: "isodefl d t \<Longrightarrow> isodefl' d (liftdefl_of\<cdot>t)"
huffman@41292
   236
unfolding isodefl_def isodefl'_def
huffman@41436
   237
by (simp add: cast_liftdefl_of u_map_oo liftemb_eq liftprj_eq)
huffman@41292
   238
huffman@40592
   239
lemma isodefl_sfun:
huffman@40504
   240
  "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow>
huffman@40592
   241
    isodefl (sfun_map\<cdot>d1\<cdot>d2) (sfun_defl\<cdot>t1\<cdot>t2)"
huffman@40504
   242
apply (rule isodeflI)
huffman@40592
   243
apply (simp add: cast_sfun_defl cast_isodefl)
huffman@40592
   244
apply (simp add: emb_sfun_def prj_sfun_def)
huffman@40592
   245
apply (simp add: sfun_map_map isodefl_strict)
huffman@40504
   246
done
huffman@40504
   247
huffman@40504
   248
lemma isodefl_ssum:
huffman@40504
   249
  "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow>
huffman@40504
   250
    isodefl (ssum_map\<cdot>d1\<cdot>d2) (ssum_defl\<cdot>t1\<cdot>t2)"
huffman@40504
   251
apply (rule isodeflI)
huffman@40504
   252
apply (simp add: cast_ssum_defl cast_isodefl)
huffman@40504
   253
apply (simp add: emb_ssum_def prj_ssum_def)
huffman@40504
   254
apply (simp add: ssum_map_map isodefl_strict)
huffman@40504
   255
done
huffman@40504
   256
huffman@40504
   257
lemma isodefl_sprod:
huffman@40504
   258
  "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow>
huffman@40504
   259
    isodefl (sprod_map\<cdot>d1\<cdot>d2) (sprod_defl\<cdot>t1\<cdot>t2)"
huffman@40504
   260
apply (rule isodeflI)
huffman@40504
   261
apply (simp add: cast_sprod_defl cast_isodefl)
huffman@40504
   262
apply (simp add: emb_sprod_def prj_sprod_def)
huffman@40504
   263
apply (simp add: sprod_map_map isodefl_strict)
huffman@40504
   264
done
huffman@40504
   265
huffman@41297
   266
lemma isodefl_prod:
huffman@40504
   267
  "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow>
huffman@41297
   268
    isodefl (prod_map\<cdot>d1\<cdot>d2) (prod_defl\<cdot>t1\<cdot>t2)"
huffman@40504
   269
apply (rule isodeflI)
huffman@40504
   270
apply (simp add: cast_prod_defl cast_isodefl)
huffman@40504
   271
apply (simp add: emb_prod_def prj_prod_def)
huffman@41297
   272
apply (simp add: prod_map_map cfcomp1)
huffman@40504
   273
done
huffman@40504
   274
huffman@40504
   275
lemma isodefl_u:
huffman@41437
   276
  "isodefl d t \<Longrightarrow> isodefl (u_map\<cdot>d) (u_defl\<cdot>t)"
huffman@40504
   277
apply (rule isodeflI)
huffman@41437
   278
apply (simp add: cast_u_defl cast_isodefl)
huffman@41437
   279
apply (simp add: emb_u_def prj_u_def liftemb_eq liftprj_eq u_map_map)
huffman@41437
   280
done
huffman@41437
   281
huffman@41437
   282
lemma isodefl_u_liftdefl:
huffman@41437
   283
  "isodefl' d t \<Longrightarrow> isodefl (u_map\<cdot>d) (u_liftdefl\<cdot>t)"
huffman@41437
   284
apply (rule isodeflI)
huffman@41437
   285
apply (simp add: cast_u_liftdefl isodefl'_def)
huffman@40504
   286
apply (simp add: emb_u_def prj_u_def liftemb_eq liftprj_eq)
huffman@40504
   287
done
huffman@40504
   288
huffman@40504
   289
lemma encode_prod_u_map:
huffman@41297
   290
  "encode_prod_u\<cdot>(u_map\<cdot>(prod_map\<cdot>f\<cdot>g)\<cdot>(decode_prod_u\<cdot>x))
huffman@40504
   291
    = sprod_map\<cdot>(u_map\<cdot>f)\<cdot>(u_map\<cdot>g)\<cdot>x"
huffman@40504
   292
unfolding encode_prod_u_def decode_prod_u_def
huffman@40504
   293
apply (case_tac x, simp, rename_tac a b)
huffman@40504
   294
apply (case_tac a, simp, case_tac b, simp, simp)
huffman@40504
   295
done
huffman@40504
   296
huffman@41297
   297
lemma isodefl_prod_u:
huffman@41292
   298
  assumes "isodefl' d1 t1" and "isodefl' d2 t2"
huffman@41297
   299
  shows "isodefl' (prod_map\<cdot>d1\<cdot>d2) (prod_liftdefl\<cdot>t1\<cdot>t2)"
huffman@41292
   300
using assms unfolding isodefl'_def
huffman@41292
   301
unfolding liftemb_prod_def liftprj_prod_def
huffman@41292
   302
by (simp add: cast_prod_liftdefl cfcomp1 encode_prod_u_map sprod_map_map)
huffman@40504
   303
huffman@40592
   304
lemma encode_cfun_map:
huffman@40592
   305
  "encode_cfun\<cdot>(cfun_map\<cdot>f\<cdot>g\<cdot>(decode_cfun\<cdot>x))
huffman@40592
   306
    = sfun_map\<cdot>(u_map\<cdot>f)\<cdot>g\<cdot>x"
huffman@40592
   307
unfolding encode_cfun_def decode_cfun_def
huffman@40592
   308
apply (simp add: sfun_eq_iff cfun_map_def sfun_map_def)
huffman@40592
   309
apply (rule cfun_eqI, rename_tac y, case_tac y, simp_all)
huffman@40592
   310
done
huffman@40592
   311
huffman@40592
   312
lemma isodefl_cfun:
huffman@40830
   313
  assumes "isodefl (u_map\<cdot>d1) t1" and "isodefl d2 t2"
huffman@40830
   314
  shows "isodefl (cfun_map\<cdot>d1\<cdot>d2) (sfun_defl\<cdot>t1\<cdot>t2)"
huffman@40830
   315
using isodefl_sfun [OF assms] unfolding isodefl_def
huffman@40830
   316
by (simp add: emb_cfun_def prj_cfun_def cfcomp1 encode_cfun_map)
huffman@40592
   317
wenzelm@62175
   318
subsection \<open>Setting up the domain package\<close>
huffman@40504
   319
wenzelm@57945
   320
named_theorems domain_defl_simps "theorems like DEFL('a t) = t_defl$DEFL('a)"
wenzelm@59028
   321
  and domain_isodefl "theorems like isodefl d t ==> isodefl (foo_map$d) (foo_defl$t)"
wenzelm@57945
   322
wenzelm@69605
   323
ML_file \<open>Tools/Domain/domain_isomorphism.ML\<close>
wenzelm@69605
   324
ML_file \<open>Tools/Domain/domain_axioms.ML\<close>
wenzelm@69605
   325
ML_file \<open>Tools/Domain/domain.ML\<close>
huffman@40504
   326
huffman@40504
   327
lemmas [domain_defl_simps] =
huffman@40592
   328
  DEFL_cfun DEFL_sfun DEFL_ssum DEFL_sprod DEFL_prod DEFL_u
huffman@41437
   329
  liftdefl_eq LIFTDEFL_prod u_liftdefl_liftdefl_of
huffman@40504
   330
huffman@40504
   331
lemmas [domain_map_ID] =
huffman@41297
   332
  cfun_map_ID sfun_map_ID ssum_map_ID sprod_map_ID prod_map_ID u_map_ID
huffman@40504
   333
huffman@40504
   334
lemmas [domain_isodefl] =
huffman@40592
   335
  isodefl_u isodefl_sfun isodefl_ssum isodefl_sprod
huffman@41436
   336
  isodefl_cfun isodefl_prod isodefl_prod_u isodefl'_liftdefl_of
huffman@41437
   337
  isodefl_u_liftdefl
huffman@40504
   338
huffman@40504
   339
lemmas [domain_deflation] =
huffman@40592
   340
  deflation_cfun_map deflation_sfun_map deflation_ssum_map
huffman@41297
   341
  deflation_sprod_map deflation_prod_map deflation_u_map
huffman@40504
   342
wenzelm@62175
   343
setup \<open>
huffman@40737
   344
  fold Domain_Take_Proofs.add_rec_type
wenzelm@68357
   345
    [(\<^type_name>\<open>cfun\<close>, [true, true]),
wenzelm@68357
   346
     (\<^type_name>\<open>sfun\<close>, [true, true]),
wenzelm@68357
   347
     (\<^type_name>\<open>ssum\<close>, [true, true]),
wenzelm@68357
   348
     (\<^type_name>\<open>sprod\<close>, [true, true]),
wenzelm@68357
   349
     (\<^type_name>\<open>prod\<close>, [true, true]),
wenzelm@68357
   350
     (\<^type_name>\<open>u\<close>, [true])]
wenzelm@62175
   351
\<close>
huffman@40504
   352
huffman@15741
   353
end