src/HOLCF/Bifinite.thy
author Brian Huffman <brianh@cs.pdx.edu>
Tue Oct 05 17:53:00 2010 -0700 (2010-10-05)
changeset 39973 c62b4ff97bfc
parent 39972 4244ff4f9649
child 39974 b525988432e9
permissions -rw-r--r--
add lemma finite_deflation_intro
huffman@25903
     1
(*  Title:      HOLCF/Bifinite.thy
huffman@25903
     2
    Author:     Brian Huffman
huffman@25903
     3
*)
huffman@25903
     4
huffman@25903
     5
header {* Bifinite domains and approximation *}
huffman@25903
     6
huffman@25903
     7
theory Bifinite
huffman@27402
     8
imports Deflation
huffman@25903
     9
begin
huffman@25903
    10
huffman@26407
    11
subsection {* Omega-profinite and bifinite domains *}
huffman@25903
    12
haftmann@29614
    13
class profinite =
huffman@26962
    14
  fixes approx :: "nat \<Rightarrow> 'a \<rightarrow> 'a"
huffman@27310
    15
  assumes chain_approx [simp]: "chain approx"
huffman@26962
    16
  assumes lub_approx_app [simp]: "(\<Squnion>i. approx i\<cdot>x) = x"
huffman@26962
    17
  assumes approx_idem: "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
huffman@26962
    18
  assumes finite_fixes_approx: "finite {x. approx i\<cdot>x = x}"
huffman@25903
    19
huffman@26962
    20
class bifinite = profinite + pcpo
huffman@25909
    21
huffman@31076
    22
lemma approx_below: "approx i\<cdot>x \<sqsubseteq> x"
huffman@27402
    23
proof -
huffman@27402
    24
  have "chain (\<lambda>i. approx i\<cdot>x)" by simp
huffman@27402
    25
  hence "approx i\<cdot>x \<sqsubseteq> (\<Squnion>i. approx i\<cdot>x)" by (rule is_ub_thelub)
huffman@27402
    26
  thus "approx i\<cdot>x \<sqsubseteq> x" by simp
huffman@27402
    27
qed
huffman@27402
    28
huffman@27402
    29
lemma finite_deflation_approx: "finite_deflation (approx i)"
huffman@27402
    30
proof
huffman@27402
    31
  fix x :: 'a
huffman@27402
    32
  show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
huffman@27402
    33
    by (rule approx_idem)
huffman@27402
    34
  show "approx i\<cdot>x \<sqsubseteq> x"
huffman@31076
    35
    by (rule approx_below)
huffman@27402
    36
  show "finite {x. approx i\<cdot>x = x}"
huffman@27402
    37
    by (rule finite_fixes_approx)
huffman@27402
    38
qed
huffman@27402
    39
wenzelm@30729
    40
interpretation approx: finite_deflation "approx i"
huffman@27402
    41
by (rule finite_deflation_approx)
huffman@27402
    42
ballarin@28234
    43
lemma (in deflation) deflation: "deflation d" ..
ballarin@28234
    44
huffman@27402
    45
lemma deflation_approx: "deflation (approx i)"
ballarin@28234
    46
by (rule approx.deflation)
huffman@25903
    47
huffman@27186
    48
lemma lub_approx [simp]: "(\<Squnion>i. approx i) = (\<Lambda> x. x)"
huffman@25903
    49
by (rule ext_cfun, simp add: contlub_cfun_fun)
huffman@25903
    50
huffman@27309
    51
lemma approx_strict [simp]: "approx i\<cdot>\<bottom> = \<bottom>"
huffman@31076
    52
by (rule UU_I, rule approx_below)
huffman@25903
    53
huffman@25903
    54
lemma approx_approx1:
huffman@27186
    55
  "i \<le> j \<Longrightarrow> approx i\<cdot>(approx j\<cdot>x) = approx i\<cdot>x"
huffman@31076
    56
apply (rule deflation_below_comp1 [OF deflation_approx deflation_approx])
huffman@25922
    57
apply (erule chain_mono [OF chain_approx])
huffman@25903
    58
done
huffman@25903
    59
huffman@25903
    60
lemma approx_approx2:
huffman@27186
    61
  "j \<le> i \<Longrightarrow> approx i\<cdot>(approx j\<cdot>x) = approx j\<cdot>x"
huffman@31076
    62
apply (rule deflation_below_comp2 [OF deflation_approx deflation_approx])
huffman@25922
    63
apply (erule chain_mono [OF chain_approx])
huffman@25903
    64
done
huffman@25903
    65
huffman@25903
    66
lemma approx_approx [simp]:
huffman@27186
    67
  "approx i\<cdot>(approx j\<cdot>x) = approx (min i j)\<cdot>x"
huffman@25903
    68
apply (rule_tac x=i and y=j in linorder_le_cases)
huffman@25903
    69
apply (simp add: approx_approx1 min_def)
huffman@25903
    70
apply (simp add: approx_approx2 min_def)
huffman@25903
    71
done
huffman@25903
    72
huffman@27402
    73
lemma finite_image_approx: "finite ((\<lambda>x. approx n\<cdot>x) ` A)"
huffman@27402
    74
by (rule approx.finite_image)
huffman@25903
    75
huffman@27402
    76
lemma finite_range_approx: "finite (range (\<lambda>x. approx i\<cdot>x))"
huffman@27402
    77
by (rule approx.finite_range)
huffman@27186
    78
huffman@27186
    79
lemma compact_approx [simp]: "compact (approx n\<cdot>x)"
huffman@27402
    80
by (rule approx.compact)
huffman@25903
    81
huffman@27309
    82
lemma profinite_compact_eq_approx: "compact x \<Longrightarrow> \<exists>i. approx i\<cdot>x = x"
huffman@27402
    83
by (rule admD2, simp_all)
huffman@25903
    84
huffman@27309
    85
lemma profinite_compact_iff: "compact x \<longleftrightarrow> (\<exists>n. approx n\<cdot>x = x)"
huffman@25903
    86
 apply (rule iffI)
huffman@27309
    87
  apply (erule profinite_compact_eq_approx)
huffman@25903
    88
 apply (erule exE)
huffman@25903
    89
 apply (erule subst)
huffman@25903
    90
 apply (rule compact_approx)
huffman@25903
    91
done
huffman@25903
    92
huffman@25903
    93
lemma approx_induct:
huffman@25903
    94
  assumes adm: "adm P" and P: "\<And>n x. P (approx n\<cdot>x)"
huffman@27186
    95
  shows "P x"
huffman@25903
    96
proof -
huffman@25903
    97
  have "P (\<Squnion>n. approx n\<cdot>x)"
huffman@25903
    98
    by (rule admD [OF adm], simp, simp add: P)
huffman@25903
    99
  thus "P x" by simp
huffman@25903
   100
qed
huffman@25903
   101
huffman@31076
   102
lemma profinite_below_ext: "(\<And>i. approx i\<cdot>x \<sqsubseteq> approx i\<cdot>y) \<Longrightarrow> x \<sqsubseteq> y"
huffman@25903
   103
apply (subgoal_tac "(\<Squnion>i. approx i\<cdot>x) \<sqsubseteq> (\<Squnion>i. approx i\<cdot>y)", simp)
huffman@25923
   104
apply (rule lub_mono, simp, simp, simp)
huffman@25903
   105
done
huffman@25903
   106
huffman@31113
   107
subsection {* Instance for product type *}
huffman@31113
   108
huffman@33504
   109
definition
huffman@33504
   110
  cprod_map :: "('a \<rightarrow> 'b) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> 'a \<times> 'c \<rightarrow> 'b \<times> 'd"
huffman@33504
   111
where
huffman@33504
   112
  "cprod_map = (\<Lambda> f g p. (f\<cdot>(fst p), g\<cdot>(snd p)))"
huffman@33504
   113
huffman@33504
   114
lemma cprod_map_Pair [simp]: "cprod_map\<cdot>f\<cdot>g\<cdot>(x, y) = (f\<cdot>x, g\<cdot>y)"
huffman@33504
   115
unfolding cprod_map_def by simp
huffman@33504
   116
huffman@33808
   117
lemma cprod_map_ID: "cprod_map\<cdot>ID\<cdot>ID = ID"
huffman@33808
   118
unfolding expand_cfun_eq by auto
huffman@33808
   119
huffman@33587
   120
lemma cprod_map_map:
huffman@33587
   121
  "cprod_map\<cdot>f1\<cdot>g1\<cdot>(cprod_map\<cdot>f2\<cdot>g2\<cdot>p) =
huffman@33587
   122
    cprod_map\<cdot>(\<Lambda> x. f1\<cdot>(f2\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"
huffman@33587
   123
by (induct p) simp
huffman@33587
   124
huffman@33504
   125
lemma ep_pair_cprod_map:
huffman@33504
   126
  assumes "ep_pair e1 p1" and "ep_pair e2 p2"
huffman@33504
   127
  shows "ep_pair (cprod_map\<cdot>e1\<cdot>e2) (cprod_map\<cdot>p1\<cdot>p2)"
huffman@33504
   128
proof
huffman@33504
   129
  interpret e1p1: ep_pair e1 p1 by fact
huffman@33504
   130
  interpret e2p2: ep_pair e2 p2 by fact
huffman@33504
   131
  fix x show "cprod_map\<cdot>p1\<cdot>p2\<cdot>(cprod_map\<cdot>e1\<cdot>e2\<cdot>x) = x"
huffman@33504
   132
    by (induct x) simp
huffman@33504
   133
  fix y show "cprod_map\<cdot>e1\<cdot>e2\<cdot>(cprod_map\<cdot>p1\<cdot>p2\<cdot>y) \<sqsubseteq> y"
huffman@33504
   134
    by (induct y) (simp add: e1p1.e_p_below e2p2.e_p_below)
huffman@33504
   135
qed
huffman@33504
   136
huffman@33504
   137
lemma deflation_cprod_map:
huffman@33504
   138
  assumes "deflation d1" and "deflation d2"
huffman@33504
   139
  shows "deflation (cprod_map\<cdot>d1\<cdot>d2)"
huffman@33504
   140
proof
huffman@33504
   141
  interpret d1: deflation d1 by fact
huffman@33504
   142
  interpret d2: deflation d2 by fact
huffman@33504
   143
  fix x
huffman@33504
   144
  show "cprod_map\<cdot>d1\<cdot>d2\<cdot>(cprod_map\<cdot>d1\<cdot>d2\<cdot>x) = cprod_map\<cdot>d1\<cdot>d2\<cdot>x"
huffman@33504
   145
    by (induct x) (simp add: d1.idem d2.idem)
huffman@33504
   146
  show "cprod_map\<cdot>d1\<cdot>d2\<cdot>x \<sqsubseteq> x"
huffman@33504
   147
    by (induct x) (simp add: d1.below d2.below)
huffman@33504
   148
qed
huffman@33504
   149
huffman@33504
   150
lemma finite_deflation_cprod_map:
huffman@33504
   151
  assumes "finite_deflation d1" and "finite_deflation d2"
huffman@33504
   152
  shows "finite_deflation (cprod_map\<cdot>d1\<cdot>d2)"
brianh@39973
   153
proof (rule finite_deflation_intro)
huffman@33504
   154
  interpret d1: finite_deflation d1 by fact
huffman@33504
   155
  interpret d2: finite_deflation d2 by fact
huffman@33504
   156
  have "deflation d1" and "deflation d2" by fact+
huffman@33504
   157
  thus "deflation (cprod_map\<cdot>d1\<cdot>d2)" by (rule deflation_cprod_map)
huffman@33504
   158
  have "{p. cprod_map\<cdot>d1\<cdot>d2\<cdot>p = p} \<subseteq> {x. d1\<cdot>x = x} \<times> {y. d2\<cdot>y = y}"
huffman@33504
   159
    by clarsimp
huffman@33504
   160
  thus "finite {p. cprod_map\<cdot>d1\<cdot>d2\<cdot>p = p}"
huffman@33504
   161
    by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)
huffman@33504
   162
qed
huffman@33504
   163
haftmann@37678
   164
instantiation prod :: (profinite, profinite) profinite
huffman@31113
   165
begin
huffman@31113
   166
huffman@33504
   167
definition
huffman@33504
   168
  approx_prod_def:
huffman@33504
   169
    "approx = (\<lambda>n. cprod_map\<cdot>(approx n)\<cdot>(approx n))"
huffman@31113
   170
huffman@31113
   171
instance proof
huffman@31113
   172
  fix i :: nat and x :: "'a \<times> 'b"
huffman@31113
   173
  show "chain (approx :: nat \<Rightarrow> 'a \<times> 'b \<rightarrow> 'a \<times> 'b)"
huffman@31113
   174
    unfolding approx_prod_def by simp
huffman@31113
   175
  show "(\<Squnion>i. approx i\<cdot>x) = x"
huffman@33504
   176
    unfolding approx_prod_def cprod_map_def
huffman@31113
   177
    by (simp add: lub_distribs thelub_Pair)
huffman@31113
   178
  show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
huffman@33504
   179
    unfolding approx_prod_def cprod_map_def by simp
huffman@31113
   180
  have "{x::'a \<times> 'b. approx i\<cdot>x = x} \<subseteq>
huffman@31113
   181
        {x::'a. approx i\<cdot>x = x} \<times> {x::'b. approx i\<cdot>x = x}"
huffman@31113
   182
    unfolding approx_prod_def by clarsimp
huffman@31113
   183
  thus "finite {x::'a \<times> 'b. approx i\<cdot>x = x}"
huffman@31113
   184
    by (rule finite_subset,
huffman@31113
   185
        intro finite_cartesian_product finite_fixes_approx)
huffman@31113
   186
qed
huffman@31113
   187
huffman@31113
   188
end
huffman@31113
   189
haftmann@37678
   190
instance prod :: (bifinite, bifinite) bifinite ..
huffman@31113
   191
huffman@31113
   192
lemma approx_Pair [simp]:
huffman@31113
   193
  "approx i\<cdot>(x, y) = (approx i\<cdot>x, approx i\<cdot>y)"
huffman@31113
   194
unfolding approx_prod_def by simp
huffman@31113
   195
huffman@31113
   196
lemma fst_approx: "fst (approx i\<cdot>p) = approx i\<cdot>(fst p)"
huffman@31113
   197
by (induct p, simp)
huffman@31113
   198
huffman@31113
   199
lemma snd_approx: "snd (approx i\<cdot>p) = approx i\<cdot>(snd p)"
huffman@31113
   200
by (induct p, simp)
huffman@31113
   201
huffman@31113
   202
huffman@25903
   203
subsection {* Instance for continuous function space *}
huffman@25903
   204
huffman@33504
   205
definition
huffman@33504
   206
  cfun_map :: "('b \<rightarrow> 'a) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> ('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'd)"
huffman@33504
   207
where
huffman@33504
   208
  "cfun_map = (\<Lambda> a b f x. b\<cdot>(f\<cdot>(a\<cdot>x)))"
huffman@33504
   209
huffman@33504
   210
lemma cfun_map_beta [simp]: "cfun_map\<cdot>a\<cdot>b\<cdot>f\<cdot>x = b\<cdot>(f\<cdot>(a\<cdot>x))"
huffman@33504
   211
unfolding cfun_map_def by simp
huffman@33504
   212
huffman@33808
   213
lemma cfun_map_ID: "cfun_map\<cdot>ID\<cdot>ID = ID"
huffman@33808
   214
unfolding expand_cfun_eq by simp
huffman@33808
   215
huffman@33587
   216
lemma cfun_map_map:
huffman@33587
   217
  "cfun_map\<cdot>f1\<cdot>g1\<cdot>(cfun_map\<cdot>f2\<cdot>g2\<cdot>p) =
huffman@33587
   218
    cfun_map\<cdot>(\<Lambda> x. f2\<cdot>(f1\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"
huffman@33587
   219
by (rule ext_cfun) simp
huffman@33587
   220
huffman@33504
   221
lemma ep_pair_cfun_map:
huffman@33504
   222
  assumes "ep_pair e1 p1" and "ep_pair e2 p2"
huffman@33504
   223
  shows "ep_pair (cfun_map\<cdot>p1\<cdot>e2) (cfun_map\<cdot>e1\<cdot>p2)"
huffman@33504
   224
proof
huffman@33504
   225
  interpret e1p1: ep_pair e1 p1 by fact
huffman@33504
   226
  interpret e2p2: ep_pair e2 p2 by fact
huffman@33504
   227
  fix f show "cfun_map\<cdot>e1\<cdot>p2\<cdot>(cfun_map\<cdot>p1\<cdot>e2\<cdot>f) = f"
huffman@33504
   228
    by (simp add: expand_cfun_eq)
huffman@33504
   229
  fix g show "cfun_map\<cdot>p1\<cdot>e2\<cdot>(cfun_map\<cdot>e1\<cdot>p2\<cdot>g) \<sqsubseteq> g"
huffman@33504
   230
    apply (rule below_cfun_ext, simp)
huffman@33504
   231
    apply (rule below_trans [OF e2p2.e_p_below])
huffman@33504
   232
    apply (rule monofun_cfun_arg)
huffman@33504
   233
    apply (rule e1p1.e_p_below)
huffman@33504
   234
    done
huffman@33504
   235
qed
huffman@33504
   236
huffman@33504
   237
lemma deflation_cfun_map:
huffman@33504
   238
  assumes "deflation d1" and "deflation d2"
huffman@33504
   239
  shows "deflation (cfun_map\<cdot>d1\<cdot>d2)"
huffman@33504
   240
proof
huffman@33504
   241
  interpret d1: deflation d1 by fact
huffman@33504
   242
  interpret d2: deflation d2 by fact
huffman@33504
   243
  fix f
huffman@33504
   244
  show "cfun_map\<cdot>d1\<cdot>d2\<cdot>(cfun_map\<cdot>d1\<cdot>d2\<cdot>f) = cfun_map\<cdot>d1\<cdot>d2\<cdot>f"
huffman@33504
   245
    by (simp add: expand_cfun_eq d1.idem d2.idem)
huffman@33504
   246
  show "cfun_map\<cdot>d1\<cdot>d2\<cdot>f \<sqsubseteq> f"
huffman@33504
   247
    apply (rule below_cfun_ext, simp)
huffman@33504
   248
    apply (rule below_trans [OF d2.below])
huffman@33504
   249
    apply (rule monofun_cfun_arg)
huffman@33504
   250
    apply (rule d1.below)
huffman@33504
   251
    done
huffman@33504
   252
qed
huffman@33504
   253
huffman@33504
   254
lemma finite_range_cfun_map:
huffman@27402
   255
  assumes a: "finite (range (\<lambda>x. a\<cdot>x))"
huffman@27402
   256
  assumes b: "finite (range (\<lambda>y. b\<cdot>y))"
huffman@33504
   257
  shows "finite (range (\<lambda>f. cfun_map\<cdot>a\<cdot>b\<cdot>f))"  (is "finite (range ?h)")
huffman@27402
   258
proof (rule finite_imageD)
huffman@27402
   259
  let ?f = "\<lambda>g. range (\<lambda>x. (a\<cdot>x, g\<cdot>x))"
huffman@27402
   260
  show "finite (?f ` range ?h)"
huffman@27402
   261
  proof (rule finite_subset)
huffman@27402
   262
    let ?B = "Pow (range (\<lambda>x. a\<cdot>x) \<times> range (\<lambda>y. b\<cdot>y))"
huffman@27402
   263
    show "?f ` range ?h \<subseteq> ?B"
huffman@27402
   264
      by clarsimp
huffman@27402
   265
    show "finite ?B"
huffman@27402
   266
      by (simp add: a b)
huffman@27402
   267
  qed
huffman@27402
   268
  show "inj_on ?f (range ?h)"
huffman@27402
   269
  proof (rule inj_onI, rule ext_cfun, clarsimp)
huffman@27402
   270
    fix x f g
huffman@27402
   271
    assume "range (\<lambda>x. (a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x)))) = range (\<lambda>x. (a\<cdot>x, b\<cdot>(g\<cdot>(a\<cdot>x))))"
huffman@27402
   272
    hence "range (\<lambda>x. (a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x)))) \<subseteq> range (\<lambda>x. (a\<cdot>x, b\<cdot>(g\<cdot>(a\<cdot>x))))"
huffman@27402
   273
      by (rule equalityD1)
huffman@27402
   274
    hence "(a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x))) \<in> range (\<lambda>x. (a\<cdot>x, b\<cdot>(g\<cdot>(a\<cdot>x))))"
huffman@27402
   275
      by (simp add: subset_eq)
huffman@27402
   276
    then obtain y where "(a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x))) = (a\<cdot>y, b\<cdot>(g\<cdot>(a\<cdot>y)))"
huffman@27402
   277
      by (rule rangeE)
huffman@27402
   278
    thus "b\<cdot>(f\<cdot>(a\<cdot>x)) = b\<cdot>(g\<cdot>(a\<cdot>x))"
huffman@27402
   279
      by clarsimp
huffman@27402
   280
  qed
huffman@27402
   281
qed
huffman@25903
   282
huffman@33504
   283
lemma finite_deflation_cfun_map:
huffman@33504
   284
  assumes "finite_deflation d1" and "finite_deflation d2"
huffman@33504
   285
  shows "finite_deflation (cfun_map\<cdot>d1\<cdot>d2)"
brianh@39973
   286
proof (rule finite_deflation_intro)
huffman@33504
   287
  interpret d1: finite_deflation d1 by fact
huffman@33504
   288
  interpret d2: finite_deflation d2 by fact
huffman@33504
   289
  have "deflation d1" and "deflation d2" by fact+
huffman@33504
   290
  thus "deflation (cfun_map\<cdot>d1\<cdot>d2)" by (rule deflation_cfun_map)
huffman@33504
   291
  have "finite (range (\<lambda>f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f))"
huffman@33504
   292
    using d1.finite_range d2.finite_range
huffman@33504
   293
    by (rule finite_range_cfun_map)
huffman@33504
   294
  thus "finite {f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f = f}"
huffman@33504
   295
    by (rule finite_range_imp_finite_fixes)
huffman@33504
   296
qed
huffman@33504
   297
brianh@39972
   298
text {* Finite deflations are compact elements of the function space *}
brianh@39972
   299
brianh@39972
   300
lemma finite_deflation_imp_compact: "finite_deflation d \<Longrightarrow> compact d"
brianh@39972
   301
apply (frule finite_deflation_imp_deflation)
brianh@39972
   302
apply (subgoal_tac "compact (cfun_map\<cdot>d\<cdot>d\<cdot>d)")
brianh@39972
   303
apply (simp add: cfun_map_def deflation.idem eta_cfun)
brianh@39972
   304
apply (rule finite_deflation.compact)
brianh@39972
   305
apply (simp only: finite_deflation_cfun_map)
brianh@39972
   306
done
brianh@39972
   307
huffman@35525
   308
instantiation cfun :: (profinite, profinite) profinite
huffman@26962
   309
begin
huffman@25903
   310
huffman@26962
   311
definition
huffman@25903
   312
  approx_cfun_def:
huffman@33504
   313
    "approx = (\<lambda>n. cfun_map\<cdot>(approx n)\<cdot>(approx n))"
huffman@25903
   314
huffman@27402
   315
instance proof
huffman@27402
   316
  show "chain (approx :: nat \<Rightarrow> ('a \<rightarrow> 'b) \<rightarrow> ('a \<rightarrow> 'b))"
huffman@27402
   317
    unfolding approx_cfun_def by simp
huffman@27402
   318
next
huffman@27402
   319
  fix x :: "'a \<rightarrow> 'b"
huffman@27402
   320
  show "(\<Squnion>i. approx i\<cdot>x) = x"
huffman@33504
   321
    unfolding approx_cfun_def cfun_map_def
huffman@27402
   322
    by (simp add: lub_distribs eta_cfun)
huffman@27402
   323
next
huffman@27402
   324
  fix i :: nat and x :: "'a \<rightarrow> 'b"
huffman@27402
   325
  show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
huffman@33504
   326
    unfolding approx_cfun_def cfun_map_def by simp
huffman@27402
   327
next
huffman@27402
   328
  fix i :: nat
huffman@27402
   329
  show "finite {x::'a \<rightarrow> 'b. approx i\<cdot>x = x}"
huffman@33504
   330
    unfolding approx_cfun_def
huffman@33504
   331
    by (intro finite_deflation.finite_fixes
huffman@33504
   332
              finite_deflation_cfun_map
huffman@33504
   333
              finite_deflation_approx)
huffman@27402
   334
qed
huffman@25903
   335
huffman@26962
   336
end
huffman@26962
   337
huffman@35525
   338
instance cfun :: (profinite, bifinite) bifinite ..
huffman@25909
   339
huffman@25903
   340
lemma approx_cfun: "approx n\<cdot>f\<cdot>x = approx n\<cdot>(f\<cdot>(approx n\<cdot>x))"
huffman@25903
   341
by (simp add: approx_cfun_def)
huffman@25903
   342
huffman@25903
   343
end