src/HOLCF/Algebraic.thy
author immler@in.tum.de
Thu, 26 Feb 2009 10:13:43 +0100
changeset 30151 629f3a92863e
parent 29252 ea97aa6aeba2
child 30729 461ee3e49ad3
permissions -rw-r--r--
removed global ref dfg_format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     1
(*  Title:      HOLCF/Algebraic.thy
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     2
    Author:     Brian Huffman
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     3
*)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     4
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     5
header {* Algebraic deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     6
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     7
theory Algebraic
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     8
imports Completion Fix Eventual
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
     9
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    10
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    11
subsection {* Constructing finite deflations by iteration *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    12
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    13
lemma finite_deflation_imp_deflation:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    14
  "finite_deflation d \<Longrightarrow> deflation d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    15
unfolding finite_deflation_def by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    16
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    17
lemma le_Suc_induct:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    18
  assumes le: "i \<le> j"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    19
  assumes step: "\<And>i. P i (Suc i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    20
  assumes refl: "\<And>i. P i i"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    21
  assumes trans: "\<And>i j k. \<lbrakk>P i j; P j k\<rbrakk> \<Longrightarrow> P i k"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    22
  shows "P i j"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    23
proof (cases "i = j")
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    24
  assume "i = j"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    25
  thus "P i j" by (simp add: refl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    26
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    27
  assume "i \<noteq> j"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    28
  with le have "i < j" by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    29
  thus "P i j" using step trans by (rule less_Suc_induct)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    30
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    31
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    32
text {* A pre-deflation is like a deflation, but not idempotent. *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    33
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    34
locale pre_deflation =
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    35
  fixes f :: "'a \<rightarrow> 'a::cpo"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    36
  assumes less: "\<And>x. f\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    37
  assumes finite_range: "finite (range (\<lambda>x. f\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    38
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    39
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    40
lemma iterate_less: "iterate i\<cdot>f\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    41
by (induct i, simp_all add: trans_less [OF less])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    42
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    43
lemma iterate_fixed: "f\<cdot>x = x \<Longrightarrow> iterate i\<cdot>f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    44
by (induct i, simp_all)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    45
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    46
lemma antichain_iterate_app: "i \<le> j \<Longrightarrow> iterate j\<cdot>f\<cdot>x \<sqsubseteq> iterate i\<cdot>f\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    47
apply (erule le_Suc_induct)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    48
apply (simp add: less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    49
apply (rule refl_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    50
apply (erule (1) trans_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    51
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    52
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    53
lemma finite_range_iterate_app: "finite (range (\<lambda>i. iterate i\<cdot>f\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    54
proof (rule finite_subset)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    55
  show "range (\<lambda>i. iterate i\<cdot>f\<cdot>x) \<subseteq> insert x (range (\<lambda>x. f\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    56
    by (clarify, case_tac i, simp_all)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    57
  show "finite (insert x (range (\<lambda>x. f\<cdot>x)))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    58
    by (simp add: finite_range)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    59
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    60
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    61
lemma eventually_constant_iterate_app:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    62
  "eventually_constant (\<lambda>i. iterate i\<cdot>f\<cdot>x)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    63
unfolding eventually_constant_def MOST_nat_le
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    64
proof -
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    65
  let ?Y = "\<lambda>i. iterate i\<cdot>f\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    66
  have "\<exists>j. \<forall>k. ?Y j \<sqsubseteq> ?Y k"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    67
    apply (rule finite_range_has_max)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    68
    apply (erule antichain_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    69
    apply (rule finite_range_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    70
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    71
  then obtain j where j: "\<And>k. ?Y j \<sqsubseteq> ?Y k" by fast
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    72
  show "\<exists>z m. \<forall>n\<ge>m. ?Y n = z"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    73
  proof (intro exI allI impI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    74
    fix k
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    75
    assume "j \<le> k"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    76
    hence "?Y k \<sqsubseteq> ?Y j" by (rule antichain_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    77
    also have "?Y j \<sqsubseteq> ?Y k" by (rule j)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    78
    finally show "?Y k = ?Y j" .
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    79
  qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    80
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    81
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    82
lemma eventually_constant_iterate:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    83
  "eventually_constant (\<lambda>n. iterate n\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    84
proof -
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    85
  have "\<forall>y\<in>range (\<lambda>x. f\<cdot>x). eventually_constant (\<lambda>i. iterate i\<cdot>f\<cdot>y)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    86
    by (simp add: eventually_constant_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    87
  hence "\<forall>y\<in>range (\<lambda>x. f\<cdot>x). MOST i. MOST j. iterate j\<cdot>f\<cdot>y = iterate i\<cdot>f\<cdot>y"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    88
    unfolding eventually_constant_MOST_MOST .
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    89
  hence "MOST i. MOST j. \<forall>y\<in>range (\<lambda>x. f\<cdot>x). iterate j\<cdot>f\<cdot>y = iterate i\<cdot>f\<cdot>y"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    90
    by (simp only: MOST_finite_Ball_distrib [OF finite_range])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    91
  hence "MOST i. MOST j. \<forall>x. iterate j\<cdot>f\<cdot>(f\<cdot>x) = iterate i\<cdot>f\<cdot>(f\<cdot>x)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    92
    by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    93
  hence "MOST i. MOST j. \<forall>x. iterate (Suc j)\<cdot>f\<cdot>x = iterate (Suc i)\<cdot>f\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    94
    by (simp only: iterate_Suc2)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    95
  hence "MOST i. MOST j. iterate (Suc j)\<cdot>f = iterate (Suc i)\<cdot>f"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    96
    by (simp only: expand_cfun_eq)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    97
  hence "eventually_constant (\<lambda>i. iterate (Suc i)\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    98
    unfolding eventually_constant_MOST_MOST .
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    99
  thus "eventually_constant (\<lambda>i. iterate i\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   100
    by (rule eventually_constant_SucD)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   101
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   102
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   103
abbreviation
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   104
  d :: "'a \<rightarrow> 'a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   105
where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   106
  "d \<equiv> eventual (\<lambda>n. iterate n\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   107
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   108
lemma MOST_d: "MOST n. P (iterate n\<cdot>f) \<Longrightarrow> P d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   109
using eventually_constant_iterate by (rule MOST_eventual)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   110
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   111
lemma f_d: "f\<cdot>(d\<cdot>x) = d\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   112
apply (rule MOST_d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   113
apply (subst iterate_Suc [symmetric])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   114
apply (rule eventually_constant_MOST_Suc_eq)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   115
apply (rule eventually_constant_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   116
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   117
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   118
lemma d_fixed_iff: "d\<cdot>x = x \<longleftrightarrow> f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   119
proof
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   120
  assume "d\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   121
  with f_d [where x=x]
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   122
  show "f\<cdot>x = x" by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   123
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   124
  assume f: "f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   125
  have "\<forall>n. iterate n\<cdot>f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   126
    by (rule allI, rule nat.induct, simp, simp add: f)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   127
  hence "MOST n. iterate n\<cdot>f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   128
    by (rule ALL_MOST)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   129
  thus "d\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   130
    by (rule MOST_d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   131
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   132
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   133
lemma finite_deflation_d: "finite_deflation d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   134
proof
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   135
  fix x :: 'a
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   136
  have "d \<in> range (\<lambda>n. iterate n\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   137
    using eventually_constant_iterate
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   138
    by (rule eventual_mem_range)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   139
  then obtain n where n: "d = iterate n\<cdot>f" ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   140
  have "iterate n\<cdot>f\<cdot>(d\<cdot>x) = d\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   141
    using f_d by (rule iterate_fixed)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   142
  thus "d\<cdot>(d\<cdot>x) = d\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   143
    by (simp add: n)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   144
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   145
  fix x :: 'a
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   146
  show "d\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   147
    by (rule MOST_d, simp add: iterate_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   148
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   149
  from finite_range
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   150
  have "finite {x. f\<cdot>x = x}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   151
    by (rule finite_range_imp_finite_fixes)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   152
  thus "finite {x. d\<cdot>x = x}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   153
    by (simp add: d_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   154
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   155
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   156
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   157
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   158
lemma pre_deflation_d_f:
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   159
  assumes "finite_deflation d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   160
  assumes f: "\<And>x. f\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   161
  shows "pre_deflation (d oo f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   162
proof
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   163
  interpret d: finite_deflation d by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   164
  fix x
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   165
  show "\<And>x. (d oo f)\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   166
    by (simp, rule trans_less [OF d.less f])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   167
  show "finite (range (\<lambda>x. (d oo f)\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   168
    by (rule finite_subset [OF _ d.finite_range], auto)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   169
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   170
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   171
lemma eventual_iterate_oo_fixed_iff:
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   172
  assumes "finite_deflation d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   173
  assumes f: "\<And>x. f\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   174
  shows "eventual (\<lambda>n. iterate n\<cdot>(d oo f))\<cdot>x = x \<longleftrightarrow> d\<cdot>x = x \<and> f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   175
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   176
  interpret d: finite_deflation d by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   177
  let ?e = "d oo f"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   178
  interpret e: pre_deflation "d oo f"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   179
    using `finite_deflation d` f
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   180
    by (rule pre_deflation_d_f)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   181
  let ?g = "eventual (\<lambda>n. iterate n\<cdot>?e)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   182
  show ?thesis
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   183
    apply (subst e.d_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   184
    apply simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   185
    apply safe
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   186
    apply (erule subst)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   187
    apply (rule d.idem)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   188
    apply (rule antisym_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   189
    apply (rule f)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   190
    apply (erule subst, rule d.less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   191
    apply simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   192
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   193
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   194
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   195
subsection {* Type constructor for finite deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   196
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   197
defaultsort profinite
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   198
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   199
typedef (open) 'a fin_defl = "{d::'a \<rightarrow> 'a. finite_deflation d}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   200
by (fast intro: finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   201
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   202
instantiation fin_defl :: (profinite) sq_ord
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   203
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   204
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   205
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   206
  sq_le_fin_defl_def:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   207
    "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep_fin_defl x \<sqsubseteq> Rep_fin_defl y"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   208
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   209
instance ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   210
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   211
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   212
instance fin_defl :: (profinite) po
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   213
by (rule typedef_po [OF type_definition_fin_defl sq_le_fin_defl_def])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   214
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   215
lemma finite_deflation_Rep_fin_defl: "finite_deflation (Rep_fin_defl d)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   216
using Rep_fin_defl by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   217
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   218
interpretation Rep_fin_defl!: finite_deflation "Rep_fin_defl d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   219
by (rule finite_deflation_Rep_fin_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   220
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   221
lemma fin_defl_lessI:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   222
  "(\<And>x. Rep_fin_defl a\<cdot>x = x \<Longrightarrow> Rep_fin_defl b\<cdot>x = x) \<Longrightarrow> a \<sqsubseteq> b"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   223
unfolding sq_le_fin_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   224
by (rule Rep_fin_defl.lessI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   225
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   226
lemma fin_defl_lessD:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   227
  "\<lbrakk>a \<sqsubseteq> b; Rep_fin_defl a\<cdot>x = x\<rbrakk> \<Longrightarrow> Rep_fin_defl b\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   228
unfolding sq_le_fin_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   229
by (rule Rep_fin_defl.lessD)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   230
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   231
lemma fin_defl_eqI:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   232
  "(\<And>x. Rep_fin_defl a\<cdot>x = x \<longleftrightarrow> Rep_fin_defl b\<cdot>x = x) \<Longrightarrow> a = b"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   233
apply (rule antisym_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   234
apply (rule fin_defl_lessI, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   235
apply (rule fin_defl_lessI, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   236
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   237
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   238
lemma Abs_fin_defl_mono:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   239
  "\<lbrakk>finite_deflation a; finite_deflation b; a \<sqsubseteq> b\<rbrakk>
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   240
    \<Longrightarrow> Abs_fin_defl a \<sqsubseteq> Abs_fin_defl b"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   241
unfolding sq_le_fin_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   242
by (simp add: Abs_fin_defl_inverse)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   243
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   244
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   245
subsection {* Take function for finite deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   246
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   247
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   248
  fd_take :: "nat \<Rightarrow> 'a fin_defl \<Rightarrow> 'a fin_defl"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   249
where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   250
  "fd_take i d = Abs_fin_defl (eventual (\<lambda>n. iterate n\<cdot>(approx i oo Rep_fin_defl d)))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   251
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   252
lemma Rep_fin_defl_fd_take:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   253
  "Rep_fin_defl (fd_take i d) =
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   254
    eventual (\<lambda>n. iterate n\<cdot>(approx i oo Rep_fin_defl d))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   255
unfolding fd_take_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   256
apply (rule Abs_fin_defl_inverse [unfolded mem_Collect_eq])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   257
apply (rule pre_deflation.finite_deflation_d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   258
apply (rule pre_deflation_d_f)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   259
apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   260
apply (rule Rep_fin_defl.less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   261
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   262
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   263
lemma fd_take_fixed_iff:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   264
  "Rep_fin_defl (fd_take i d)\<cdot>x = x \<longleftrightarrow>
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   265
    approx i\<cdot>x = x \<and> Rep_fin_defl d\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   266
unfolding Rep_fin_defl_fd_take
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   267
by (rule eventual_iterate_oo_fixed_iff
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   268
    [OF finite_deflation_approx Rep_fin_defl.less])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   269
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   270
lemma fd_take_less: "fd_take n d \<sqsubseteq> d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   271
apply (rule fin_defl_lessI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   272
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   273
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   274
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   275
lemma fd_take_idem: "fd_take n (fd_take n d) = fd_take n d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   276
apply (rule fin_defl_eqI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   277
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   278
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   279
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   280
lemma fd_take_mono: "a \<sqsubseteq> b \<Longrightarrow> fd_take n a \<sqsubseteq> fd_take n b"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   281
apply (rule fin_defl_lessI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   282
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   283
apply (simp add: fin_defl_lessD)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   284
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   285
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   286
lemma approx_fixed_le_lemma: "\<lbrakk>i \<le> j; approx i\<cdot>x = x\<rbrakk> \<Longrightarrow> approx j\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   287
by (erule subst, simp add: min_def)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   288
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   289
lemma fd_take_chain: "m \<le> n \<Longrightarrow> fd_take m a \<sqsubseteq> fd_take n a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   290
apply (rule fin_defl_lessI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   291
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   292
apply (simp add: approx_fixed_le_lemma)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   293
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   294
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   295
lemma finite_range_fd_take: "finite (range (fd_take n))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   296
apply (rule finite_imageD [where f="\<lambda>a. {x. Rep_fin_defl a\<cdot>x = x}"])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   297
apply (rule finite_subset [where B="Pow {x. approx n\<cdot>x = x}"])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   298
apply (clarify, simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   299
apply (simp add: finite_fixes_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   300
apply (rule inj_onI, clarify)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   301
apply (simp add: expand_set_eq fin_defl_eqI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   302
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   303
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   304
lemma fd_take_covers: "\<exists>n. fd_take n a = a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   305
apply (rule_tac x=
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   306
  "Max ((\<lambda>x. LEAST n. approx n\<cdot>x = x) ` {x. Rep_fin_defl a\<cdot>x = x})" in exI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   307
apply (rule antisym_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   308
apply (rule fd_take_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   309
apply (rule fin_defl_lessI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   310
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   311
apply (rule approx_fixed_le_lemma)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   312
apply (rule Max_ge)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   313
apply (rule finite_imageI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   314
apply (rule Rep_fin_defl.finite_fixes)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   315
apply (rule imageI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   316
apply (erule CollectI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   317
apply (rule LeastI_ex)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   318
apply (rule profinite_compact_eq_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   319
apply (erule subst)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   320
apply (rule Rep_fin_defl.compact)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   321
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   322
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   323
interpretation fin_defl!: basis_take sq_le fd_take
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   324
apply default
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   325
apply (rule fd_take_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   326
apply (rule fd_take_idem)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   327
apply (erule fd_take_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   328
apply (rule fd_take_chain, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   329
apply (rule finite_range_fd_take)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   330
apply (rule fd_take_covers)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   331
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   332
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   333
subsection {* Defining algebraic deflations by ideal completion *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   334
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   335
typedef (open) 'a alg_defl =
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   336
  "{S::'a fin_defl set. sq_le.ideal S}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   337
by (fast intro: sq_le.ideal_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   338
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   339
instantiation alg_defl :: (profinite) sq_ord
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   340
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   341
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   342
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   343
  "x \<sqsubseteq> y \<longleftrightarrow> Rep_alg_defl x \<subseteq> Rep_alg_defl y"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   344
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   345
instance ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   346
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   347
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   348
instance alg_defl :: (profinite) po
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   349
by (rule sq_le.typedef_ideal_po
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   350
    [OF type_definition_alg_defl sq_le_alg_defl_def])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   351
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   352
instance alg_defl :: (profinite) cpo
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   353
by (rule sq_le.typedef_ideal_cpo
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   354
    [OF type_definition_alg_defl sq_le_alg_defl_def])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   355
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   356
lemma Rep_alg_defl_lub:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   357
  "chain Y \<Longrightarrow> Rep_alg_defl (\<Squnion>i. Y i) = (\<Union>i. Rep_alg_defl (Y i))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   358
by (rule sq_le.typedef_ideal_rep_contlub
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   359
    [OF type_definition_alg_defl sq_le_alg_defl_def])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   360
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   361
lemma ideal_Rep_alg_defl: "sq_le.ideal (Rep_alg_defl xs)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   362
by (rule Rep_alg_defl [unfolded mem_Collect_eq])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   363
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   364
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   365
  alg_defl_principal :: "'a fin_defl \<Rightarrow> 'a alg_defl" where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   366
  "alg_defl_principal t = Abs_alg_defl {u. u \<sqsubseteq> t}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   367
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   368
lemma Rep_alg_defl_principal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   369
  "Rep_alg_defl (alg_defl_principal t) = {u. u \<sqsubseteq> t}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   370
unfolding alg_defl_principal_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   371
by (simp add: Abs_alg_defl_inverse sq_le.ideal_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   372
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   373
interpretation alg_defl!:
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   374
  ideal_completion sq_le fd_take alg_defl_principal Rep_alg_defl
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   375
apply default
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   376
apply (rule ideal_Rep_alg_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   377
apply (erule Rep_alg_defl_lub)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   378
apply (rule Rep_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   379
apply (simp only: sq_le_alg_defl_def)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   380
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   381
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   382
text {* Algebraic deflations are pointed *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   383
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   384
lemma finite_deflation_UU: "finite_deflation \<bottom>"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   385
by default simp_all
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   386
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   387
lemma alg_defl_minimal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   388
  "alg_defl_principal (Abs_fin_defl \<bottom>) \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   389
apply (induct x rule: alg_defl.principal_induct, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   390
apply (rule alg_defl.principal_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   391
apply (induct_tac a)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   392
apply (rule Abs_fin_defl_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   393
apply (rule finite_deflation_UU)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   394
apply simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   395
apply (rule minimal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   396
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   397
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   398
instance alg_defl :: (bifinite) pcpo
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   399
by intro_classes (fast intro: alg_defl_minimal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   400
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   401
lemma inst_alg_defl_pcpo: "\<bottom> = alg_defl_principal (Abs_fin_defl \<bottom>)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   402
by (rule alg_defl_minimal [THEN UU_I, symmetric])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   403
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   404
text {* Algebraic deflations are profinite *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   405
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   406
instantiation alg_defl :: (profinite) profinite
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   407
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   408
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   409
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   410
  approx_alg_defl_def: "approx = alg_defl.completion_approx"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   411
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   412
instance
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   413
apply (intro_classes, unfold approx_alg_defl_def)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   414
apply (rule alg_defl.chain_completion_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   415
apply (rule alg_defl.lub_completion_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   416
apply (rule alg_defl.completion_approx_idem)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   417
apply (rule alg_defl.finite_fixes_completion_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   418
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   419
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   420
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   421
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   422
instance alg_defl :: (bifinite) bifinite ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   423
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   424
lemma approx_alg_defl_principal [simp]:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   425
  "approx n\<cdot>(alg_defl_principal t) = alg_defl_principal (fd_take n t)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   426
unfolding approx_alg_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   427
by (rule alg_defl.completion_approx_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   428
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   429
lemma approx_eq_alg_defl_principal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   430
  "\<exists>t\<in>Rep_alg_defl xs. approx n\<cdot>xs = alg_defl_principal (fd_take n t)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   431
unfolding approx_alg_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   432
by (rule alg_defl.completion_approx_eq_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   433
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   434
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   435
subsection {* Applying algebraic deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   436
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   437
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   438
  cast :: "'a alg_defl \<rightarrow> 'a \<rightarrow> 'a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   439
where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   440
  "cast = alg_defl.basis_fun Rep_fin_defl"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   441
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   442
lemma cast_alg_defl_principal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   443
  "cast\<cdot>(alg_defl_principal a) = Rep_fin_defl a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   444
unfolding cast_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   445
apply (rule alg_defl.basis_fun_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   446
apply (simp only: sq_le_fin_defl_def)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   447
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   448
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   449
lemma deflation_cast: "deflation (cast\<cdot>d)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   450
apply (induct d rule: alg_defl.principal_induct)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   451
apply (rule adm_subst [OF _ adm_deflation], simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   452
apply (simp add: cast_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   453
apply (rule finite_deflation_imp_deflation)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   454
apply (rule finite_deflation_Rep_fin_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   455
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   456
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   457
lemma finite_deflation_cast:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   458
  "compact d \<Longrightarrow> finite_deflation (cast\<cdot>d)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   459
apply (drule alg_defl.compact_imp_principal, clarify)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   460
apply (simp add: cast_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   461
apply (rule finite_deflation_Rep_fin_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   462
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   463
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   464
interpretation cast!: deflation "cast\<cdot>d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   465
by (rule deflation_cast)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   466
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   467
lemma "cast\<cdot>(\<Squnion>i. alg_defl_principal (Abs_fin_defl (approx i)))\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   468
apply (subst contlub_cfun_arg)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   469
apply (rule chainI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   470
apply (rule alg_defl.principal_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   471
apply (rule Abs_fin_defl_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   472
apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   473
apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   474
apply (rule chainE)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   475
apply (rule chain_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   476
apply (simp add: cast_alg_defl_principal Abs_fin_defl_inverse finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   477
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   478
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   479
text {* This lemma says that if we have an ep-pair from
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   480
a bifinite domain into a universal domain, then e oo p
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   481
is an algebraic deflation. *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   482
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   483
lemma
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   484
  assumes "ep_pair e p"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   485
  constrains e :: "'a::profinite \<rightarrow> 'b::profinite"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   486
  shows "\<exists>d. cast\<cdot>d = e oo p"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   487
proof
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   488
  interpret ep_pair e p by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   489
  let ?a = "\<lambda>i. e oo approx i oo p"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   490
  have a: "\<And>i. finite_deflation (?a i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   491
    apply (rule finite_deflation_e_d_p)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   492
    apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   493
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   494
  let ?d = "\<Squnion>i. alg_defl_principal (Abs_fin_defl (?a i))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   495
  show "cast\<cdot>?d = e oo p"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   496
    apply (subst contlub_cfun_arg)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   497
    apply (rule chainI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   498
    apply (rule alg_defl.principal_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   499
    apply (rule Abs_fin_defl_mono [OF a a])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   500
    apply (rule chainE, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   501
    apply (subst cast_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   502
    apply (simp add: Abs_fin_defl_inverse a)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   503
    apply (simp add: expand_cfun_eq lub_distribs)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   504
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   505
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   506
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   507
text {* This lemma says that if we have an ep-pair
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   508
from a cpo into a bifinite domain, and e oo p is
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   509
an algebraic deflation, then the cpo is bifinite. *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   510
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   511
lemma
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   512
  assumes "ep_pair e p"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   513
  constrains e :: "'a::cpo \<rightarrow> 'b::profinite"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   514
  assumes d: "\<And>x. cast\<cdot>d\<cdot>x = e\<cdot>(p\<cdot>x)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   515
  obtains a :: "nat \<Rightarrow> 'a \<rightarrow> 'a" where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   516
    "\<And>i. finite_deflation (a i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   517
    "(\<Squnion>i. a i) = ID"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   518
proof
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   519
  interpret ep_pair e p by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   520
  let ?a = "\<lambda>i. p oo cast\<cdot>(approx i\<cdot>d) oo e"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   521
  show "\<And>i. finite_deflation (?a i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   522
    apply (rule finite_deflation_p_d_e)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   523
    apply (rule finite_deflation_cast)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   524
    apply (rule compact_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   525
    apply (rule sq_ord_less_eq_trans [OF _ d])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   526
    apply (rule monofun_cfun_fun)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   527
    apply (rule monofun_cfun_arg)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   528
    apply (rule approx_less)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   529
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   530
  show "(\<Squnion>i. ?a i) = ID"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   531
    apply (rule ext_cfun, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   532
    apply (simp add: lub_distribs)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   533
    apply (simp add: d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   534
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   535
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   536
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   537
end