src/HOLCF/Algebraic.thy
author wenzelm
Wed, 28 Apr 2010 12:07:52 +0200
changeset 36452 d37c6eed8117
parent 35901 12f09bf2c77f
child 39199 720112792ba0
permissions -rw-r--r--
renamed command 'defaultsort' to 'default_sort';
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
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
    32
definition
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
    33
  eventual_iterate :: "('a \<rightarrow> 'a::cpo) \<Rightarrow> ('a \<rightarrow> 'a)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
    34
where
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
    35
  "eventual_iterate f = eventual (\<lambda>n. iterate n\<cdot>f)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
    36
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    37
text {* A pre-deflation is like a deflation, but not idempotent. *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    38
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    39
locale pre_deflation =
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    40
  fixes f :: "'a \<rightarrow> 'a::cpo"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    41
  assumes below: "\<And>x. f\<cdot>x \<sqsubseteq> x"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    42
  assumes finite_range: "finite (range (\<lambda>x. f\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    43
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    44
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    45
lemma iterate_below: "iterate i\<cdot>f\<cdot>x \<sqsubseteq> x"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    46
by (induct i, simp_all add: below_trans [OF below])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    47
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    48
lemma iterate_fixed: "f\<cdot>x = x \<Longrightarrow> iterate i\<cdot>f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    49
by (induct i, simp_all)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    50
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    51
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
    52
apply (erule le_Suc_induct)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    53
apply (simp add: below)
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    54
apply (rule below_refl)
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    55
apply (erule (1) below_trans)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    56
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    57
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    58
lemma finite_range_iterate_app: "finite (range (\<lambda>i. iterate i\<cdot>f\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    59
proof (rule finite_subset)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    60
  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
    61
    by (clarify, case_tac i, simp_all)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    62
  show "finite (insert x (range (\<lambda>x. f\<cdot>x)))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    63
    by (simp add: finite_range)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    64
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    65
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    66
lemma eventually_constant_iterate_app:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    67
  "eventually_constant (\<lambda>i. iterate i\<cdot>f\<cdot>x)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    68
unfolding eventually_constant_def MOST_nat_le
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    69
proof -
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    70
  let ?Y = "\<lambda>i. iterate i\<cdot>f\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    71
  have "\<exists>j. \<forall>k. ?Y j \<sqsubseteq> ?Y k"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    72
    apply (rule finite_range_has_max)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    73
    apply (erule antichain_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    74
    apply (rule finite_range_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    75
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    76
  then obtain j where j: "\<And>k. ?Y j \<sqsubseteq> ?Y k" by fast
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    77
  show "\<exists>z m. \<forall>n\<ge>m. ?Y n = z"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    78
  proof (intro exI allI impI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    79
    fix k
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    80
    assume "j \<le> k"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    81
    hence "?Y k \<sqsubseteq> ?Y j" by (rule antichain_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    82
    also have "?Y j \<sqsubseteq> ?Y k" by (rule j)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    83
    finally show "?Y k = ?Y j" .
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    84
  qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    85
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    86
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    87
lemma eventually_constant_iterate:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    88
  "eventually_constant (\<lambda>n. iterate n\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    89
proof -
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    90
  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
    91
    by (simp add: eventually_constant_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    92
  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
    93
    unfolding eventually_constant_MOST_MOST .
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    94
  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
    95
    by (simp only: MOST_finite_Ball_distrib [OF finite_range])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    96
  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
    97
    by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
    98
  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
    99
    by (simp only: iterate_Suc2)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   100
  hence "MOST i. MOST j. iterate (Suc j)\<cdot>f = iterate (Suc i)\<cdot>f"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   101
    by (simp only: expand_cfun_eq)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   102
  hence "eventually_constant (\<lambda>i. iterate (Suc i)\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   103
    unfolding eventually_constant_MOST_MOST .
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   104
  thus "eventually_constant (\<lambda>i. iterate i\<cdot>f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   105
    by (rule eventually_constant_SucD)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   106
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   107
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   108
abbreviation
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   109
  d :: "'a \<rightarrow> 'a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   110
where
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   111
  "d \<equiv> eventual_iterate f"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   112
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   113
lemma MOST_d: "MOST n. P (iterate n\<cdot>f) \<Longrightarrow> P d"
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   114
unfolding eventual_iterate_def
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   115
using eventually_constant_iterate by (rule MOST_eventual)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   116
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   117
lemma f_d: "f\<cdot>(d\<cdot>x) = d\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   118
apply (rule MOST_d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   119
apply (subst iterate_Suc [symmetric])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   120
apply (rule eventually_constant_MOST_Suc_eq)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   121
apply (rule eventually_constant_iterate_app)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   122
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   123
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   124
lemma d_fixed_iff: "d\<cdot>x = x \<longleftrightarrow> f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   125
proof
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   126
  assume "d\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   127
  with f_d [where x=x]
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   128
  show "f\<cdot>x = x" by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   129
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   130
  assume f: "f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   131
  have "\<forall>n. iterate n\<cdot>f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   132
    by (rule allI, rule nat.induct, simp, simp add: f)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   133
  hence "MOST n. iterate n\<cdot>f\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   134
    by (rule ALL_MOST)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   135
  thus "d\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   136
    by (rule MOST_d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   137
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   138
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   139
lemma finite_deflation_d: "finite_deflation d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   140
proof
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   141
  fix x :: 'a
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   142
  have "d \<in> range (\<lambda>n. iterate n\<cdot>f)"
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   143
    unfolding eventual_iterate_def
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   144
    using eventually_constant_iterate
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   145
    by (rule eventual_mem_range)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   146
  then obtain n where n: "d = iterate n\<cdot>f" ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   147
  have "iterate n\<cdot>f\<cdot>(d\<cdot>x) = d\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   148
    using f_d by (rule iterate_fixed)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   149
  thus "d\<cdot>(d\<cdot>x) = d\<cdot>x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   150
    by (simp add: n)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   151
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   152
  fix x :: 'a
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   153
  show "d\<cdot>x \<sqsubseteq> x"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   154
    by (rule MOST_d, simp add: iterate_below)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   155
next
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   156
  from finite_range
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   157
  have "finite {x. f\<cdot>x = x}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   158
    by (rule finite_range_imp_finite_fixes)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   159
  thus "finite {x. d\<cdot>x = x}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   160
    by (simp add: d_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   161
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   162
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   163
lemma deflation_d: "deflation d"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   164
using finite_deflation_d
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   165
by (rule finite_deflation_imp_deflation)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   166
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   167
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   168
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   169
lemma finite_deflation_eventual_iterate:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   170
  "pre_deflation d \<Longrightarrow> finite_deflation (eventual_iterate d)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   171
by (rule pre_deflation.finite_deflation_d)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   172
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   173
lemma pre_deflation_oo:
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   174
  assumes "finite_deflation d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   175
  assumes f: "\<And>x. f\<cdot>x \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   176
  shows "pre_deflation (d oo f)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   177
proof
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   178
  interpret d: finite_deflation d by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   179
  fix x
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   180
  show "\<And>x. (d oo f)\<cdot>x \<sqsubseteq> x"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   181
    by (simp, rule below_trans [OF d.below f])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   182
  show "finite (range (\<lambda>x. (d oo f)\<cdot>x))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   183
    by (rule finite_subset [OF _ d.finite_range], auto)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   184
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   185
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   186
lemma eventual_iterate_oo_fixed_iff:
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   187
  assumes "finite_deflation d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   188
  assumes f: "\<And>x. f\<cdot>x \<sqsubseteq> x"
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   189
  shows "eventual_iterate (d oo f)\<cdot>x = x \<longleftrightarrow> d\<cdot>x = x \<and> f\<cdot>x = x"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   190
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   191
  interpret d: finite_deflation d by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   192
  let ?e = "d oo f"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   193
  interpret e: pre_deflation "d oo f"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   194
    using `finite_deflation d` f
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   195
    by (rule pre_deflation_oo)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   196
  let ?g = "eventual (\<lambda>n. iterate n\<cdot>?e)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   197
  show ?thesis
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   198
    apply (subst e.d_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   199
    apply simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   200
    apply safe
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   201
    apply (erule subst)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   202
    apply (rule d.idem)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   203
    apply (rule below_antisym)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   204
    apply (rule f)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   205
    apply (erule subst, rule d.below)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   206
    apply simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   207
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   208
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   209
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   210
lemma eventual_mono:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   211
  assumes A: "eventually_constant A"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   212
  assumes B: "eventually_constant B"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   213
  assumes below: "\<And>n. A n \<sqsubseteq> B n"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   214
  shows "eventual A \<sqsubseteq> eventual B"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   215
proof -
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   216
  from A have "MOST n. A n = eventual A"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   217
    by (rule MOST_eq_eventual)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   218
  then have "MOST n. eventual A \<sqsubseteq> B n"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   219
    by (rule MOST_mono) (erule subst, rule below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   220
  with B show "eventual A \<sqsubseteq> eventual B"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   221
    by (rule MOST_eventual)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   222
qed
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   223
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   224
lemma eventual_iterate_mono:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   225
  assumes f: "pre_deflation f" and g: "pre_deflation g" and "f \<sqsubseteq> g"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   226
  shows "eventual_iterate f \<sqsubseteq> eventual_iterate g"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   227
unfolding eventual_iterate_def
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   228
apply (rule eventual_mono)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   229
apply (rule pre_deflation.eventually_constant_iterate [OF f])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   230
apply (rule pre_deflation.eventually_constant_iterate [OF g])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   231
apply (rule monofun_cfun_arg [OF `f \<sqsubseteq> g`])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   232
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   233
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   234
lemma cont2cont_eventual_iterate_oo:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   235
  assumes d: "finite_deflation d"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   236
  assumes cont: "cont f" and below: "\<And>x y. f x\<cdot>y \<sqsubseteq> y"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   237
  shows "cont (\<lambda>x. eventual_iterate (d oo f x))"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   238
    (is "cont ?e")
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   239
proof (rule contI2)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   240
  show "monofun ?e"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   241
    apply (rule monofunI)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   242
    apply (rule eventual_iterate_mono)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   243
    apply (rule pre_deflation_oo [OF d below])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   244
    apply (rule pre_deflation_oo [OF d below])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   245
    apply (rule monofun_cfun_arg)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   246
    apply (erule cont2monofunE [OF cont])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   247
    done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   248
next
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   249
  fix Y :: "nat \<Rightarrow> 'b"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   250
  assume Y: "chain Y"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   251
  with cont have fY: "chain (\<lambda>i. f (Y i))"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   252
    by (rule ch2ch_cont)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   253
  assume eY: "chain (\<lambda>i. ?e (Y i))"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   254
  have lub_below: "\<And>x. f (\<Squnion>i. Y i)\<cdot>x \<sqsubseteq> x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   255
    by (rule admD [OF _ Y], simp add: cont, rule below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   256
  have "deflation (?e (\<Squnion>i. Y i))"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   257
    apply (rule pre_deflation.deflation_d)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   258
    apply (rule pre_deflation_oo [OF d lub_below])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   259
    done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   260
  then show "?e (\<Squnion>i. Y i) \<sqsubseteq> (\<Squnion>i. ?e (Y i))"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   261
  proof (rule deflation.belowI)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   262
    fix x :: 'a
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   263
    assume "?e (\<Squnion>i. Y i)\<cdot>x = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   264
    hence "d\<cdot>x = x" and "f (\<Squnion>i. Y i)\<cdot>x = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   265
      by (simp_all add: eventual_iterate_oo_fixed_iff [OF d lub_below])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   266
    hence "(\<Squnion>i. f (Y i)\<cdot>x) = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   267
      apply (simp only: cont2contlubE [OF cont Y])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   268
      apply (simp only: contlub_cfun_fun [OF fY])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   269
      done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   270
    have "compact (d\<cdot>x)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   271
      using d by (rule finite_deflation.compact)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   272
    then have "compact x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   273
      using `d\<cdot>x = x` by simp
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   274
    then have "compact (\<Squnion>i. f (Y i)\<cdot>x)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   275
      using `(\<Squnion>i. f (Y i)\<cdot>x) = x` by simp
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   276
    then have "\<exists>n. max_in_chain n (\<lambda>i. f (Y i)\<cdot>x)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   277
      by - (rule compact_imp_max_in_chain, simp add: fY, assumption)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   278
    then obtain n where n: "max_in_chain n (\<lambda>i. f (Y i)\<cdot>x)" ..
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   279
    then have "f (Y n)\<cdot>x = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   280
      using `(\<Squnion>i. f (Y i)\<cdot>x) = x` fY by (simp add: maxinch_is_thelub)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   281
    with `d\<cdot>x = x` have "?e (Y n)\<cdot>x = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   282
      by (simp add: eventual_iterate_oo_fixed_iff [OF d below])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   283
    moreover have "?e (Y n)\<cdot>x \<sqsubseteq> (\<Squnion>i. ?e (Y i)\<cdot>x)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   284
      by (rule is_ub_thelub, simp add: eY)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   285
    ultimately have "x \<sqsubseteq> (\<Squnion>i. ?e (Y i))\<cdot>x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   286
      by (simp add: contlub_cfun_fun eY)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   287
    also have "(\<Squnion>i. ?e (Y i))\<cdot>x \<sqsubseteq> x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   288
      apply (rule deflation.below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   289
      apply (rule admD [OF adm_deflation eY])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   290
      apply (rule pre_deflation.deflation_d)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   291
      apply (rule pre_deflation_oo [OF d below])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   292
      done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   293
    finally show "(\<Squnion>i. ?e (Y i))\<cdot>x = x" ..
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   294
  qed
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   295
qed
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   296
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   297
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   298
subsection {* Type constructor for finite deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   299
36452
d37c6eed8117 renamed command 'defaultsort' to 'default_sort';
wenzelm
parents: 35901
diff changeset
   300
default_sort profinite
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   301
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   302
typedef (open) 'a fin_defl = "{d::'a \<rightarrow> 'a. finite_deflation d}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   303
by (fast intro: finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   304
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   305
instantiation fin_defl :: (profinite) below
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   306
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   307
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   308
definition below_fin_defl_def:
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   309
    "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep_fin_defl x \<sqsubseteq> Rep_fin_defl y"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   310
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   311
instance ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   312
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   313
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   314
instance fin_defl :: (profinite) po
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   315
by (rule typedef_po [OF type_definition_fin_defl below_fin_defl_def])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   316
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   317
lemma finite_deflation_Rep_fin_defl: "finite_deflation (Rep_fin_defl d)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   318
using Rep_fin_defl by simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   319
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   320
lemma deflation_Rep_fin_defl: "deflation (Rep_fin_defl d)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   321
using finite_deflation_Rep_fin_defl
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   322
by (rule finite_deflation_imp_deflation)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   323
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29252
diff changeset
   324
interpretation Rep_fin_defl: finite_deflation "Rep_fin_defl d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   325
by (rule finite_deflation_Rep_fin_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   326
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   327
lemma fin_defl_belowI:
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   328
  "(\<And>x. Rep_fin_defl a\<cdot>x = x \<Longrightarrow> Rep_fin_defl b\<cdot>x = x) \<Longrightarrow> a \<sqsubseteq> b"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   329
unfolding below_fin_defl_def
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   330
by (rule Rep_fin_defl.belowI)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   331
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   332
lemma fin_defl_belowD:
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   333
  "\<lbrakk>a \<sqsubseteq> b; Rep_fin_defl a\<cdot>x = x\<rbrakk> \<Longrightarrow> Rep_fin_defl b\<cdot>x = x"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   334
unfolding below_fin_defl_def
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   335
by (rule Rep_fin_defl.belowD)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   336
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   337
lemma fin_defl_eqI:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   338
  "(\<And>x. Rep_fin_defl a\<cdot>x = x \<longleftrightarrow> Rep_fin_defl b\<cdot>x = x) \<Longrightarrow> a = b"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   339
apply (rule below_antisym)
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   340
apply (rule fin_defl_belowI, simp)
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   341
apply (rule fin_defl_belowI, simp)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   342
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   343
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   344
lemma Abs_fin_defl_mono:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   345
  "\<lbrakk>finite_deflation a; finite_deflation b; a \<sqsubseteq> b\<rbrakk>
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   346
    \<Longrightarrow> Abs_fin_defl a \<sqsubseteq> Abs_fin_defl b"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   347
unfolding below_fin_defl_def
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   348
by (simp add: Abs_fin_defl_inverse)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   349
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   350
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   351
subsection {* Take function for finite deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   352
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   353
definition
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   354
  defl_approx :: "nat \<Rightarrow> ('a \<rightarrow> 'a) \<Rightarrow> ('a \<rightarrow> 'a)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   355
where
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   356
  "defl_approx i d = eventual_iterate (approx i oo d)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   357
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   358
lemma finite_deflation_defl_approx:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   359
  "deflation d \<Longrightarrow> finite_deflation (defl_approx i d)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   360
unfolding defl_approx_def
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   361
apply (rule pre_deflation.finite_deflation_d)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   362
apply (rule pre_deflation_oo)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   363
apply (rule finite_deflation_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   364
apply (erule deflation.below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   365
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   366
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   367
lemma deflation_defl_approx:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   368
  "deflation d \<Longrightarrow> deflation (defl_approx i d)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   369
apply (rule finite_deflation_imp_deflation)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   370
apply (erule finite_deflation_defl_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   371
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   372
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   373
lemma defl_approx_fixed_iff:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   374
  "deflation d \<Longrightarrow> defl_approx i d\<cdot>x = x \<longleftrightarrow> approx i\<cdot>x = x \<and> d\<cdot>x = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   375
unfolding defl_approx_def
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   376
apply (rule eventual_iterate_oo_fixed_iff)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   377
apply (rule finite_deflation_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   378
apply (erule deflation.below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   379
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   380
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   381
lemma defl_approx_below:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   382
  "\<lbrakk>a \<sqsubseteq> b; deflation a; deflation b\<rbrakk> \<Longrightarrow> defl_approx i a \<sqsubseteq> defl_approx i b"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   383
apply (rule deflation.belowI)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   384
apply (erule deflation_defl_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   385
apply (simp add: defl_approx_fixed_iff)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   386
apply (erule (1) deflation.belowD)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   387
apply (erule conjunct2)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   388
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   389
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   390
lemma cont2cont_defl_approx:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   391
  assumes cont: "cont f" and below: "\<And>x y. f x\<cdot>y \<sqsubseteq> y"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   392
  shows "cont (\<lambda>x. defl_approx i (f x))"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   393
unfolding defl_approx_def
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   394
using finite_deflation_approx assms
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   395
by (rule cont2cont_eventual_iterate_oo)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   396
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   397
definition
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   398
  fd_take :: "nat \<Rightarrow> 'a fin_defl \<Rightarrow> 'a fin_defl"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   399
where
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   400
  "fd_take i d = Abs_fin_defl (defl_approx i (Rep_fin_defl d))"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   401
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   402
lemma Rep_fin_defl_fd_take:
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   403
  "Rep_fin_defl (fd_take i d) = defl_approx i (Rep_fin_defl d)"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   404
unfolding fd_take_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   405
apply (rule Abs_fin_defl_inverse [unfolded mem_Collect_eq])
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   406
apply (rule finite_deflation_defl_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   407
apply (rule deflation_Rep_fin_defl)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   408
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   410
lemma fd_take_fixed_iff:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   411
  "Rep_fin_defl (fd_take i d)\<cdot>x = x \<longleftrightarrow>
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   412
    approx i\<cdot>x = x \<and> Rep_fin_defl d\<cdot>x = x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   413
unfolding Rep_fin_defl_fd_take
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   414
apply (rule defl_approx_fixed_iff)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   415
apply (rule deflation_Rep_fin_defl)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   416
done
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   417
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   418
lemma fd_take_below: "fd_take n d \<sqsubseteq> d"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   419
apply (rule fin_defl_belowI)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   420
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   421
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   422
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   423
lemma fd_take_idem: "fd_take n (fd_take n d) = fd_take n d"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   424
apply (rule fin_defl_eqI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   425
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   426
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   427
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   428
lemma fd_take_mono: "a \<sqsubseteq> b \<Longrightarrow> fd_take n a \<sqsubseteq> fd_take n b"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   429
apply (rule fin_defl_belowI)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   430
apply (simp add: fd_take_fixed_iff)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   431
apply (simp add: fin_defl_belowD)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   432
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   433
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   434
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
   435
by (erule subst, simp add: min_def)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   436
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   437
lemma fd_take_chain: "m \<le> n \<Longrightarrow> fd_take m a \<sqsubseteq> fd_take n a"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   438
apply (rule fin_defl_belowI)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   439
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   440
apply (simp add: approx_fixed_le_lemma)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   441
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   442
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   443
lemma finite_range_fd_take: "finite (range (fd_take n))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   444
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
   445
apply (rule finite_subset [where B="Pow {x. approx n\<cdot>x = x}"])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   446
apply (clarify, simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   447
apply (simp add: finite_fixes_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   448
apply (rule inj_onI, clarify)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   449
apply (simp add: expand_set_eq fin_defl_eqI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   450
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   451
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   452
lemma fd_take_covers: "\<exists>n. fd_take n a = a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   453
apply (rule_tac x=
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   454
  "Max ((\<lambda>x. LEAST n. approx n\<cdot>x = x) ` {x. Rep_fin_defl a\<cdot>x = x})" in exI)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   455
apply (rule below_antisym)
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   456
apply (rule fd_take_below)
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   457
apply (rule fin_defl_belowI)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   458
apply (simp add: fd_take_fixed_iff)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   459
apply (rule approx_fixed_le_lemma)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   460
apply (rule Max_ge)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   461
apply (rule finite_imageI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   462
apply (rule Rep_fin_defl.finite_fixes)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   463
apply (rule imageI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   464
apply (erule CollectI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   465
apply (rule LeastI_ex)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   466
apply (rule profinite_compact_eq_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   467
apply (erule subst)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   468
apply (rule Rep_fin_defl.compact)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   469
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   470
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   471
interpretation fin_defl: basis_take below fd_take
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   472
apply default
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   473
apply (rule fd_take_below)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   474
apply (rule fd_take_idem)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   475
apply (erule fd_take_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   476
apply (rule fd_take_chain, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   477
apply (rule finite_range_fd_take)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   478
apply (rule fd_take_covers)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   479
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   480
33586
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   481
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   482
subsection {* Defining algebraic deflations by ideal completion *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   483
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   484
typedef (open) 'a alg_defl =
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   485
  "{S::'a fin_defl set. below.ideal S}"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   486
by (fast intro: below.ideal_principal)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   487
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   488
instantiation alg_defl :: (profinite) below
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   489
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   490
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   491
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   492
  "x \<sqsubseteq> y \<longleftrightarrow> Rep_alg_defl x \<subseteq> Rep_alg_defl y"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   493
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   494
instance ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   495
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   496
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   497
instance alg_defl :: (profinite) po
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   498
by (rule below.typedef_ideal_po
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   499
    [OF type_definition_alg_defl below_alg_defl_def])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   500
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   501
instance alg_defl :: (profinite) cpo
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   502
by (rule below.typedef_ideal_cpo
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   503
    [OF type_definition_alg_defl below_alg_defl_def])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   504
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   505
lemma Rep_alg_defl_lub:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   506
  "chain Y \<Longrightarrow> Rep_alg_defl (\<Squnion>i. Y i) = (\<Union>i. Rep_alg_defl (Y i))"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   507
by (rule below.typedef_ideal_rep_contlub
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   508
    [OF type_definition_alg_defl below_alg_defl_def])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   509
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   510
lemma ideal_Rep_alg_defl: "below.ideal (Rep_alg_defl xs)"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   511
by (rule Rep_alg_defl [unfolded mem_Collect_eq])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   512
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   513
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   514
  alg_defl_principal :: "'a fin_defl \<Rightarrow> 'a alg_defl" where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   515
  "alg_defl_principal t = Abs_alg_defl {u. u \<sqsubseteq> t}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   516
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   517
lemma Rep_alg_defl_principal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   518
  "Rep_alg_defl (alg_defl_principal t) = {u. u \<sqsubseteq> t}"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   519
unfolding alg_defl_principal_def
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   520
by (simp add: Abs_alg_defl_inverse below.ideal_principal)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   521
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29252
diff changeset
   522
interpretation alg_defl:
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   523
  ideal_completion below fd_take alg_defl_principal Rep_alg_defl
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   524
apply default
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   525
apply (rule ideal_Rep_alg_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   526
apply (erule Rep_alg_defl_lub)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   527
apply (rule Rep_alg_defl_principal)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   528
apply (simp only: below_alg_defl_def)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   529
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   530
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   531
text {* Algebraic deflations are pointed *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   532
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   533
lemma finite_deflation_UU: "finite_deflation \<bottom>"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   534
by default simp_all
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   535
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   536
lemma alg_defl_minimal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   537
  "alg_defl_principal (Abs_fin_defl \<bottom>) \<sqsubseteq> x"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   538
apply (induct x rule: alg_defl.principal_induct, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   539
apply (rule alg_defl.principal_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   540
apply (induct_tac a)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   541
apply (rule Abs_fin_defl_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   542
apply (rule finite_deflation_UU)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   543
apply simp
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   544
apply (rule minimal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   545
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   546
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   547
instance alg_defl :: (bifinite) pcpo
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   548
by intro_classes (fast intro: alg_defl_minimal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   549
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   550
lemma inst_alg_defl_pcpo: "\<bottom> = alg_defl_principal (Abs_fin_defl \<bottom>)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   551
by (rule alg_defl_minimal [THEN UU_I, symmetric])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   552
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   553
text {* Algebraic deflations are profinite *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   554
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   555
instantiation alg_defl :: (profinite) profinite
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   556
begin
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   557
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   558
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   559
  approx_alg_defl_def: "approx = alg_defl.completion_approx"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   560
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   561
instance
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   562
apply (intro_classes, unfold approx_alg_defl_def)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   563
apply (rule alg_defl.chain_completion_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   564
apply (rule alg_defl.lub_completion_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   565
apply (rule alg_defl.completion_approx_idem)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   566
apply (rule alg_defl.finite_fixes_completion_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   567
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   568
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   569
end
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   570
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   571
instance alg_defl :: (bifinite) bifinite ..
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   572
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   573
lemma approx_alg_defl_principal [simp]:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   574
  "approx n\<cdot>(alg_defl_principal t) = alg_defl_principal (fd_take n t)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   575
unfolding approx_alg_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   576
by (rule alg_defl.completion_approx_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   577
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   578
lemma approx_eq_alg_defl_principal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   579
  "\<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
   580
unfolding approx_alg_defl_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   581
by (rule alg_defl.completion_approx_eq_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   582
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   583
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   584
subsection {* Applying algebraic deflations *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   585
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   586
definition
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   587
  cast :: "'a alg_defl \<rightarrow> 'a \<rightarrow> 'a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   588
where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   589
  "cast = alg_defl.basis_fun Rep_fin_defl"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   590
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   591
lemma cast_alg_defl_principal:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   592
  "cast\<cdot>(alg_defl_principal a) = Rep_fin_defl a"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   593
unfolding cast_def
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   594
apply (rule alg_defl.basis_fun_principal)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   595
apply (simp only: below_fin_defl_def)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   596
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   597
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   598
lemma deflation_cast: "deflation (cast\<cdot>d)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   599
apply (induct d rule: alg_defl.principal_induct)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   600
apply (rule adm_subst [OF _ adm_deflation], simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   601
apply (simp add: cast_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   602
apply (rule finite_deflation_imp_deflation)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   603
apply (rule finite_deflation_Rep_fin_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   604
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   605
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   606
lemma finite_deflation_cast:
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   607
  "compact d \<Longrightarrow> finite_deflation (cast\<cdot>d)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   608
apply (drule alg_defl.compact_imp_principal, clarify)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   609
apply (simp add: cast_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   610
apply (rule finite_deflation_Rep_fin_defl)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   611
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   612
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29252
diff changeset
   613
interpretation cast: deflation "cast\<cdot>d"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   614
by (rule deflation_cast)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   615
33586
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   616
declare cast.idem [simp]
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   617
31164
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   618
lemma cast_approx: "cast\<cdot>(approx n\<cdot>A) = defl_approx n (cast\<cdot>A)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   619
apply (rule alg_defl.principal_induct)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   620
apply (rule adm_eq)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   621
apply simp
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   622
apply (simp add: cont2cont_defl_approx cast.below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   623
apply (simp only: approx_alg_defl_principal)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   624
apply (simp only: cast_alg_defl_principal)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   625
apply (simp only: Rep_fin_defl_fd_take)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   626
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   627
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   628
lemma cast_approx_fixed_iff:
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   629
  "cast\<cdot>(approx i\<cdot>A)\<cdot>x = x \<longleftrightarrow> approx i\<cdot>x = x \<and> cast\<cdot>A\<cdot>x = x"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   630
apply (simp only: cast_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   631
apply (rule defl_approx_fixed_iff)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   632
apply (rule deflation_cast)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   633
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   634
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   635
lemma defl_approx_cast: "defl_approx i (cast\<cdot>A) = cast\<cdot>(approx i\<cdot>A)"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   636
by (rule cast_approx [symmetric])
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   637
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   638
lemma cast_below_imp_below: "cast\<cdot>A \<sqsubseteq> cast\<cdot>B \<Longrightarrow> A \<sqsubseteq> B"
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   639
apply (rule profinite_below_ext)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   640
apply (drule_tac i=i in defl_approx_below)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   641
apply (rule deflation_cast)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   642
apply (rule deflation_cast)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   643
apply (simp only: defl_approx_cast)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   644
apply (cut_tac x="approx i\<cdot>A" in alg_defl.compact_imp_principal)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   645
apply (rule compact_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   646
apply (cut_tac x="approx i\<cdot>B" in alg_defl.compact_imp_principal)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   647
apply (rule compact_approx)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   648
apply clarsimp
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   649
apply (simp add: cast_alg_defl_principal)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   650
apply (simp add: below_fin_defl_def)
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   651
done
f550c4cf3f3a continuity proofs for approx function on deflations; lemma cast_below_imp_below
huffman
parents: 31076
diff changeset
   652
33586
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   653
lemma cast_eq_imp_eq: "cast\<cdot>A = cast\<cdot>B \<Longrightarrow> A = B"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   654
by (simp add: below_antisym cast_below_imp_below)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   655
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   656
lemma cast_strict1 [simp]: "cast\<cdot>\<bottom> = \<bottom>"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   657
apply (subst inst_alg_defl_pcpo)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   658
apply (subst cast_alg_defl_principal)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   659
apply (rule Abs_fin_defl_inverse)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   660
apply (simp add: finite_deflation_UU)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   661
done
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   662
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   663
lemma cast_strict2 [simp]: "cast\<cdot>A\<cdot>\<bottom> = \<bottom>"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   664
by (rule cast.below [THEN UU_I])
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   665
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   666
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   667
subsection {* Deflation membership relation *}
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   668
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   669
definition
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   670
  in_deflation :: "'a::profinite \<Rightarrow> 'a alg_defl \<Rightarrow> bool" (infixl ":::" 50)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   671
where
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   672
  "x ::: A \<longleftrightarrow> cast\<cdot>A\<cdot>x = x"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   673
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   674
lemma adm_in_deflation: "adm (\<lambda>x. x ::: A)"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   675
unfolding in_deflation_def by simp
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   676
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   677
lemma in_deflationI: "cast\<cdot>A\<cdot>x = x \<Longrightarrow> x ::: A"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   678
unfolding in_deflation_def .
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   679
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   680
lemma cast_fixed: "x ::: A \<Longrightarrow> cast\<cdot>A\<cdot>x = x"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   681
unfolding in_deflation_def .
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   682
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   683
lemma cast_in_deflation [simp]: "cast\<cdot>A\<cdot>x ::: A"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   684
unfolding in_deflation_def by (rule cast.idem)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   685
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   686
lemma bottom_in_deflation [simp]: "\<bottom> ::: A"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   687
unfolding in_deflation_def by (rule cast_strict2)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   688
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   689
lemma subdeflationD: "A \<sqsubseteq> B \<Longrightarrow> x ::: A \<Longrightarrow> x ::: B"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   690
unfolding in_deflation_def
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   691
 apply (rule deflation.belowD)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   692
   apply (rule deflation_cast)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   693
  apply (erule monofun_cfun_arg)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   694
 apply assumption
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   695
done
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   696
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   697
lemma rev_subdeflationD: "x ::: A \<Longrightarrow> A \<sqsubseteq> B \<Longrightarrow> x ::: B"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   698
by (rule subdeflationD)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   699
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   700
lemma subdeflationI: "(\<And>x. x ::: A \<Longrightarrow> x ::: B) \<Longrightarrow> A \<sqsubseteq> B"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   701
apply (rule cast_below_imp_below)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   702
apply (rule cast.belowI)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   703
apply (simp add: in_deflation_def)
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   704
done
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   705
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   706
text "Identity deflation:"
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   707
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   708
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
   709
apply (subst contlub_cfun_arg)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   710
apply (rule chainI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   711
apply (rule alg_defl.principal_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   712
apply (rule Abs_fin_defl_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   713
apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   714
apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   715
apply (rule chainE)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   716
apply (rule chain_approx)
35901
12f09bf2c77f fix LaTeX overfull hbox warnings in HOLCF document
huffman
parents: 33586
diff changeset
   717
apply (simp add: cast_alg_defl_principal
12f09bf2c77f fix LaTeX overfull hbox warnings in HOLCF document
huffman
parents: 33586
diff changeset
   718
  Abs_fin_defl_inverse finite_deflation_approx)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   719
done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   720
33586
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   721
subsection {* Bifinite domains and algebraic deflations *}
0e745228d605 add in_deflation relation, more lemmas about cast
huffman
parents: 31164
diff changeset
   722
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   723
text {* This lemma says that if we have an ep-pair from
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   724
a bifinite domain into a universal domain, then e oo p
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   725
is an algebraic deflation. *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   726
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   727
lemma
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   728
  assumes "ep_pair e p"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   729
  constrains e :: "'a::profinite \<rightarrow> 'b::profinite"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   730
  shows "\<exists>d. cast\<cdot>d = e oo p"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   731
proof
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   732
  interpret ep_pair e p by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   733
  let ?a = "\<lambda>i. e oo approx i oo p"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   734
  have a: "\<And>i. finite_deflation (?a i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   735
    apply (rule finite_deflation_e_d_p)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   736
    apply (rule finite_deflation_approx)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   737
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   738
  let ?d = "\<Squnion>i. alg_defl_principal (Abs_fin_defl (?a i))"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   739
  show "cast\<cdot>?d = e oo p"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   740
    apply (subst contlub_cfun_arg)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   741
    apply (rule chainI)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   742
    apply (rule alg_defl.principal_mono)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   743
    apply (rule Abs_fin_defl_mono [OF a a])
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   744
    apply (rule chainE, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   745
    apply (subst cast_alg_defl_principal)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   746
    apply (simp add: Abs_fin_defl_inverse a)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   747
    apply (simp add: expand_cfun_eq lub_distribs)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   748
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   749
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   750
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   751
text {* This lemma says that if we have an ep-pair
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   752
from a cpo into a bifinite domain, and e oo p is
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   753
an algebraic deflation, then the cpo is bifinite. *}
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   754
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   755
lemma
28611
983c1855a7af More occurrences of 'includes' gone.
ballarin
parents: 27419
diff changeset
   756
  assumes "ep_pair e p"
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   757
  constrains e :: "'a::cpo \<rightarrow> 'b::profinite"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   758
  assumes d: "\<And>x. cast\<cdot>d\<cdot>x = e\<cdot>(p\<cdot>x)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   759
  obtains a :: "nat \<Rightarrow> 'a \<rightarrow> 'a" where
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   760
    "\<And>i. finite_deflation (a i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   761
    "(\<Squnion>i. a i) = ID"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   762
proof
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 28611
diff changeset
   763
  interpret ep_pair e p by fact
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   764
  let ?a = "\<lambda>i. p oo cast\<cdot>(approx i\<cdot>d) oo e"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   765
  show "\<And>i. finite_deflation (?a i)"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   766
    apply (rule finite_deflation_p_d_e)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   767
    apply (rule finite_deflation_cast)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   768
    apply (rule compact_approx)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   769
    apply (rule below_eq_trans [OF _ d])
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   770
    apply (rule monofun_cfun_fun)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   771
    apply (rule monofun_cfun_arg)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   772
    apply (rule approx_below)
27409
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   773
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   774
  show "(\<Squnion>i. ?a i) = ID"
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   775
    apply (rule ext_cfun, simp)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   776
    apply (simp add: lub_distribs)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   777
    apply (simp add: d)
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   778
    done
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   779
qed
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   780
f65a889f97f9 theory of algebraic deflations
huffman
parents:
diff changeset
   781
end