src/HOL/Library/Order_Continuity.thy
author nipkow
Wed, 13 Feb 2019 07:48:42 +0100
changeset 69801 a99a0f5474c5
parent 69661 a03a63b81f44
child 69861 62e47f06d22c
permissions -rw-r--r--
too agressive
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
     1
(*  Title:      HOL/Library/Order_Continuity.thy
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
     2
    Author:     David von Oheimb, TU München
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
     3
    Author:     Johannes Hölzl, TU München
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     4
*)
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     5
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
     6
section \<open>Continuity and iterations\<close>
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     7
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
     8
theory Order_Continuity
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
     9
imports Complex_Main Countable_Complete_Lattices
15131
c69542757a4d New theory header syntax.
nipkow
parents: 14981
diff changeset
    10
begin
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
    11
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    12
(* TODO: Generalize theory to chain-complete partial orders *)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    13
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    14
lemma SUP_nat_binary:
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    15
  "(sup A (SUP x\<in>Collect ((<) (0::nat)). B)) = (sup A B::'a::countable_complete_lattice)"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    16
  apply (subst image_constant)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    17
   apply auto
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    18
  done
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    19
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    20
lemma INF_nat_binary:
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    21
  "inf A (INF x\<in>Collect ((<) (0::nat)). B) = (inf A B::'a::countable_complete_lattice)"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    22
  apply (subst image_constant)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    23
   apply auto
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    24
  done
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    25
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    26
text \<open>
61585
a9599d3d7610 isabelle update_cartouches -c -t;
wenzelm
parents: 60714
diff changeset
    27
  The name \<open>continuous\<close> is already taken in \<open>Complex_Main\<close>, so we use
a9599d3d7610 isabelle update_cartouches -c -t;
wenzelm
parents: 60714
diff changeset
    28
  \<open>sup_continuous\<close> and \<open>inf_continuous\<close>. These names appear sometimes in literature
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    29
  and have the advantage that these names are duals.
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    30
\<close>
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    31
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    32
named_theorems order_continuous_intros
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    33
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 60427
diff changeset
    34
subsection \<open>Continuity for complete lattices\<close>
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    35
22367
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    36
definition
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
    37
  sup_continuous :: "('a::countable_complete_lattice \<Rightarrow> 'b::countable_complete_lattice) \<Rightarrow> bool"
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
    38
where
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    39
  "sup_continuous F \<longleftrightarrow> (\<forall>M::nat \<Rightarrow> 'a. mono M \<longrightarrow> F (SUP i. M i) = (SUP i. F (M i)))"
22367
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    40
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    41
lemma sup_continuousD: "sup_continuous F \<Longrightarrow> mono M \<Longrightarrow> F (SUP i::nat. M i) = (SUP i. F (M i))"
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    42
  by (auto simp: sup_continuous_def)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    43
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
    44
lemma sup_continuous_mono:
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    45
  "mono F" if "sup_continuous F"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    46
proof
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    47
  fix A B :: "'a"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    48
  assume "A \<le> B"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    49
  let ?f = "\<lambda>n::nat. if n = 0 then A else B"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    50
  from \<open>A \<le> B\<close> have "incseq ?f"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    51
    by (auto intro: monoI)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    52
  with \<open>sup_continuous F\<close> have *: "F (SUP i. ?f i) = (SUP i. F (?f i))"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    53
    by (auto dest: sup_continuousD)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    54
  thm this [simplified, simplified SUP_nat_binary]
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    55
  from \<open>A \<le> B\<close> have "B = sup A B"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    56
    by (simp add: le_iff_sup)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    57
  then have "F B = F (sup A B)"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    58
    by simp
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    59
  also have "\<dots> = sup (F A) (F B)"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    60
    using * by (simp add: if_distrib SUP_nat_binary cong del: SUP_cong)
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
    61
  finally show "F A \<le> F B"
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
    62
    by (simp add: le_iff_sup)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    63
qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    64
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    65
lemma [order_continuous_intros]:
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    66
  shows sup_continuous_const: "sup_continuous (\<lambda>x. c)"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    67
    and sup_continuous_id: "sup_continuous (\<lambda>x. x)"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    68
    and sup_continuous_apply: "sup_continuous (\<lambda>f. f x)"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    69
    and sup_continuous_fun: "(\<And>s. sup_continuous (\<lambda>x. P x s)) \<Longrightarrow> sup_continuous P"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    70
    and sup_continuous_If: "sup_continuous F \<Longrightarrow> sup_continuous G \<Longrightarrow> sup_continuous (\<lambda>f. if C then F f else G f)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    71
  by (auto simp: sup_continuous_def)
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    72
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    73
lemma sup_continuous_compose:
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    74
  assumes f: "sup_continuous f" and g: "sup_continuous g"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    75
  shows "sup_continuous (\<lambda>x. f (g x))"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    76
  unfolding sup_continuous_def
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    77
proof safe
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 62374
diff changeset
    78
  fix M :: "nat \<Rightarrow> 'c"
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 62374
diff changeset
    79
  assume M: "mono M"
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 62374
diff changeset
    80
  then have "mono (\<lambda>i. g (M i))"
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    81
    using sup_continuous_mono[OF g] by (auto simp: mono_def)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 63979
diff changeset
    82
  with M show "f (g (Sup (M ` UNIV))) = (SUP i. f (g (M i)))"
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    83
    by (auto simp: sup_continuous_def g[THEN sup_continuousD] f[THEN sup_continuousD])
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    84
qed
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
    85
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    86
lemma sup_continuous_sup[order_continuous_intros]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    87
  "sup_continuous f \<Longrightarrow> sup_continuous g \<Longrightarrow> sup_continuous (\<lambda>x. sup (f x) (g x))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
    88
  by (simp add: sup_continuous_def ccSUP_sup_distrib)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    89
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    90
lemma sup_continuous_inf[order_continuous_intros]:
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
    91
  fixes P Q :: "'a :: countable_complete_lattice \<Rightarrow> 'b :: countable_complete_distrib_lattice"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    92
  assumes P: "sup_continuous P" and Q: "sup_continuous Q"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    93
  shows "sup_continuous (\<lambda>x. inf (P x) (Q x))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    94
  unfolding sup_continuous_def
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    95
proof (safe intro!: antisym)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    96
  fix M :: "nat \<Rightarrow> 'a" assume M: "incseq M"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    97
  have "inf (P (SUP i. M i)) (Q (SUP i. M i)) \<le> (SUP j i. inf (P (M i)) (Q (M j)))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
    98
    by (simp add: sup_continuousD[OF P M] sup_continuousD[OF Q M] inf_ccSUP ccSUP_inf)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
    99
  also have "\<dots> \<le> (SUP i. inf (P (M i)) (Q (M i)))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   100
  proof (intro ccSUP_least)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   101
    fix i j from M assms[THEN sup_continuous_mono] show "inf (P (M i)) (Q (M j)) \<le> (SUP i. inf (P (M i)) (Q (M i)))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   102
      by (intro ccSUP_upper2[of _ "sup i j"] inf_mono) (auto simp: mono_def)
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   103
  qed auto
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   104
  finally show "inf (P (SUP i. M i)) (Q (SUP i. M i)) \<le> (SUP i. inf (P (M i)) (Q (M i)))" .
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   105
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   106
  show "(SUP i. inf (P (M i)) (Q (M i))) \<le> inf (P (SUP i. M i)) (Q (SUP i. M i))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   107
    unfolding sup_continuousD[OF P M] sup_continuousD[OF Q M] by (intro ccSUP_least inf_mono ccSUP_upper) auto
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   108
qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   109
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   110
lemma sup_continuous_and[order_continuous_intros]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   111
  "sup_continuous P \<Longrightarrow> sup_continuous Q \<Longrightarrow> sup_continuous (\<lambda>x. P x \<and> Q x)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   112
  using sup_continuous_inf[of P Q] by simp
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   113
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   114
lemma sup_continuous_or[order_continuous_intros]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   115
  "sup_continuous P \<Longrightarrow> sup_continuous Q \<Longrightarrow> sup_continuous (\<lambda>x. P x \<or> Q x)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   116
  by (auto simp: sup_continuous_def)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   117
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   118
lemma sup_continuous_lfp:
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   119
  assumes "sup_continuous F" shows "lfp F = (SUP i. (F ^^ i) bot)" (is "lfp F = ?U")
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   120
proof (rule antisym)
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 60427
diff changeset
   121
  note mono = sup_continuous_mono[OF \<open>sup_continuous F\<close>]
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   122
  show "?U \<le> lfp F"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   123
  proof (rule SUP_least)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   124
    fix i show "(F ^^ i) bot \<le> lfp F"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   125
    proof (induct i)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   126
      case (Suc i)
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   127
      have "(F ^^ Suc i) bot = F ((F ^^ i) bot)" by simp
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   128
      also have "\<dots> \<le> F (lfp F)" by (rule monoD[OF mono Suc])
63979
95c3ae4baba8 clarified lfp/gfp statements and proofs;
wenzelm
parents: 63540
diff changeset
   129
      also have "\<dots> = lfp F" by (simp add: lfp_fixpoint[OF mono])
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   130
      finally show ?case .
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   131
    qed simp
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   132
  qed
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   133
  show "lfp F \<le> ?U"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   134
  proof (rule lfp_lowerbound)
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   135
    have "mono (\<lambda>i::nat. (F ^^ i) bot)"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   136
    proof -
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   137
      { fix i::nat have "(F ^^ i) bot \<le> (F ^^ (Suc i)) bot"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32456
diff changeset
   138
        proof (induct i)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32456
diff changeset
   139
          case 0 show ?case by simp
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32456
diff changeset
   140
        next
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32456
diff changeset
   141
          case Suc thus ?case using monoD[OF mono Suc] by auto
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32456
diff changeset
   142
        qed }
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   143
      thus ?thesis by (auto simp add: mono_iff_le_Suc)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   144
    qed
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   145
    hence "F ?U = (SUP i. (F ^^ Suc i) bot)"
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 60427
diff changeset
   146
      using \<open>sup_continuous F\<close> by (simp add: sup_continuous_def)
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   147
    also have "\<dots> \<le> ?U"
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   148
      by (fast intro: SUP_least SUP_upper)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   149
    finally show "F ?U \<le> ?U" .
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   150
  qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   151
qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
   152
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   153
lemma lfp_transfer_bounded:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   154
  assumes P: "P bot" "\<And>x. P x \<Longrightarrow> P (f x)" "\<And>M. (\<And>i. P (M i)) \<Longrightarrow> P (SUP i::nat. M i)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   155
  assumes \<alpha>: "\<And>M. mono M \<Longrightarrow> (\<And>i::nat. P (M i)) \<Longrightarrow> \<alpha> (SUP i. M i) = (SUP i. \<alpha> (M i))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   156
  assumes f: "sup_continuous f" and g: "sup_continuous g"
60714
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   157
  assumes [simp]: "\<And>x. P x \<Longrightarrow> x \<le> lfp f \<Longrightarrow> \<alpha> (f x) = g (\<alpha> x)"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   158
  assumes g_bound: "\<And>x. \<alpha> bot \<le> g x"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   159
  shows "\<alpha> (lfp f) = lfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   160
proof (rule antisym)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   161
  note mono_g = sup_continuous_mono[OF g]
60714
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   162
  note mono_f = sup_continuous_mono[OF f]
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   163
  have lfp_bound: "\<alpha> bot \<le> lfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   164
    by (subst lfp_unfold[OF mono_g]) (rule g_bound)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   165
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   166
  have P_pow: "P ((f ^^ i) bot)" for i
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   167
    by (induction i) (auto intro!: P)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   168
  have incseq_pow: "mono (\<lambda>i. (f ^^ i) bot)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   169
    unfolding mono_iff_le_Suc
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   170
  proof
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   171
    fix i show "(f ^^ i) bot \<le> (f ^^ (Suc i)) bot"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   172
    proof (induct i)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   173
      case Suc thus ?case using monoD[OF sup_continuous_mono[OF f] Suc] by auto
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   174
    qed (simp add: le_fun_def)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   175
  qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   176
  have P_lfp: "P (lfp f)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   177
    using P_pow unfolding sup_continuous_lfp[OF f] by (auto intro!: P)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   178
60714
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   179
  have iter_le_lfp: "(f ^^ n) bot \<le> lfp f" for n
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   180
    apply (induction n)
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   181
    apply simp
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   182
    apply (subst lfp_unfold[OF mono_f])
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   183
    apply (auto intro!: monoD[OF mono_f])
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   184
    done
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   185
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   186
  have "\<alpha> (lfp f) = (SUP i. \<alpha> ((f^^i) bot))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   187
    unfolding sup_continuous_lfp[OF f] using incseq_pow P_pow by (rule \<alpha>)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   188
  also have "\<dots> \<le> lfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   189
  proof (rule SUP_least)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   190
    fix i show "\<alpha> ((f^^i) bot) \<le> lfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   191
    proof (induction i)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   192
      case (Suc n) then show ?case
60714
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   193
        by (subst lfp_unfold[OF mono_g]) (simp add: monoD[OF mono_g] P_pow iter_le_lfp)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   194
    qed (simp add: lfp_bound)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   195
  qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   196
  finally show "\<alpha> (lfp f) \<le> lfp g" .
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   197
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   198
  show "lfp g \<le> \<alpha> (lfp f)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   199
  proof (induction rule: lfp_ordinal_induct[OF mono_g])
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   200
    case (1 S) then show ?case
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   201
      by (subst lfp_unfold[OF sup_continuous_mono[OF f]])
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   202
         (simp add: monoD[OF mono_g] P_lfp)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   203
  qed (auto intro: Sup_least)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   204
qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   205
60714
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   206
lemma lfp_transfer:
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   207
  "sup_continuous \<alpha> \<Longrightarrow> sup_continuous f \<Longrightarrow> sup_continuous g \<Longrightarrow>
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   208
    (\<And>x. \<alpha> bot \<le> g x) \<Longrightarrow> (\<And>x. x \<le> lfp f \<Longrightarrow> \<alpha> (f x) = g (\<alpha> x)) \<Longrightarrow> \<alpha> (lfp f) = lfp g"
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   209
  by (rule lfp_transfer_bounded[where P=top]) (auto dest: sup_continuousD)
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   210
19736
wenzelm
parents: 15140
diff changeset
   211
definition
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   212
  inf_continuous :: "('a::countable_complete_lattice \<Rightarrow> 'b::countable_complete_lattice) \<Rightarrow> bool"
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   213
where
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   214
  "inf_continuous F \<longleftrightarrow> (\<forall>M::nat \<Rightarrow> 'a. antimono M \<longrightarrow> F (INF i. M i) = (INF i. F (M i)))"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   215
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   216
lemma inf_continuousD: "inf_continuous F \<Longrightarrow> antimono M \<Longrightarrow> F (INF i::nat. M i) = (INF i. F (M i))"
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   217
  by (auto simp: inf_continuous_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   218
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   219
lemma inf_continuous_mono:
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   220
  "mono F" if "inf_continuous F"
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   221
proof
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   222
  fix A B :: "'a"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   223
  assume "A \<le> B"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   224
  let ?f = "\<lambda>n::nat. if n = 0 then B else A"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   225
  from \<open>A \<le> B\<close> have "decseq ?f"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   226
    by (auto intro: antimonoI)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   227
  with \<open>inf_continuous F\<close> have *: "F (INF i. ?f i) = (INF i. F (?f i))"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   228
    by (auto dest: inf_continuousD)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   229
  from \<open>A \<le> B\<close> have "A = inf B A"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   230
    by (simp add: inf.absorb_iff2)
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   231
  then have "F A = F (inf B A)"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   232
    by simp
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   233
  also have "\<dots> = inf (F B) (F A)"
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   234
    using * by (simp add: if_distrib INF_nat_binary cong del: INF_cong)
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   235
  finally show "F A \<le> F B"
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69313
diff changeset
   236
    by (simp add: inf.absorb_iff2)
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   237
qed
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   238
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   239
lemma [order_continuous_intros]:
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   240
  shows inf_continuous_const: "inf_continuous (\<lambda>x. c)"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   241
    and inf_continuous_id: "inf_continuous (\<lambda>x. x)"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   242
    and inf_continuous_apply: "inf_continuous (\<lambda>f. f x)"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   243
    and inf_continuous_fun: "(\<And>s. inf_continuous (\<lambda>x. P x s)) \<Longrightarrow> inf_continuous P"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   244
    and inf_continuous_If: "inf_continuous F \<Longrightarrow> inf_continuous G \<Longrightarrow> inf_continuous (\<lambda>f. if C then F f else G f)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   245
  by (auto simp: inf_continuous_def)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   246
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   247
lemma inf_continuous_inf[order_continuous_intros]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   248
  "inf_continuous f \<Longrightarrow> inf_continuous g \<Longrightarrow> inf_continuous (\<lambda>x. inf (f x) (g x))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   249
  by (simp add: inf_continuous_def ccINF_inf_distrib)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   250
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   251
lemma inf_continuous_sup[order_continuous_intros]:
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   252
  fixes P Q :: "'a :: countable_complete_lattice \<Rightarrow> 'b :: countable_complete_distrib_lattice"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   253
  assumes P: "inf_continuous P" and Q: "inf_continuous Q"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   254
  shows "inf_continuous (\<lambda>x. sup (P x) (Q x))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   255
  unfolding inf_continuous_def
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   256
proof (safe intro!: antisym)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   257
  fix M :: "nat \<Rightarrow> 'a" assume M: "decseq M"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   258
  show "sup (P (INF i. M i)) (Q (INF i. M i)) \<le> (INF i. sup (P (M i)) (Q (M i)))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   259
    unfolding inf_continuousD[OF P M] inf_continuousD[OF Q M] by (intro ccINF_greatest sup_mono ccINF_lower) auto
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   260
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   261
  have "(INF i. sup (P (M i)) (Q (M i))) \<le> (INF j i. sup (P (M i)) (Q (M j)))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   262
  proof (intro ccINF_greatest)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   263
    fix i j from M assms[THEN inf_continuous_mono] show "sup (P (M i)) (Q (M j)) \<ge> (INF i. sup (P (M i)) (Q (M i)))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   264
      by (intro ccINF_lower2[of _ "sup i j"] sup_mono) (auto simp: mono_def antimono_def)
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   265
  qed auto
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   266
  also have "\<dots> \<le> sup (P (INF i. M i)) (Q (INF i. M i))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   267
    by (simp add: inf_continuousD[OF P M] inf_continuousD[OF Q M] ccINF_sup sup_ccINF)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   268
  finally show "sup (P (INF i. M i)) (Q (INF i. M i)) \<ge> (INF i. sup (P (M i)) (Q (M i)))" .
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   269
qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   270
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   271
lemma inf_continuous_and[order_continuous_intros]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   272
  "inf_continuous P \<Longrightarrow> inf_continuous Q \<Longrightarrow> inf_continuous (\<lambda>x. P x \<and> Q x)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   273
  using inf_continuous_inf[of P Q] by simp
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   274
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   275
lemma inf_continuous_or[order_continuous_intros]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   276
  "inf_continuous P \<Longrightarrow> inf_continuous Q \<Longrightarrow> inf_continuous (\<lambda>x. P x \<or> Q x)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   277
  using inf_continuous_sup[of P Q] by simp
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   278
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   279
lemma inf_continuous_compose:
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   280
  assumes f: "inf_continuous f" and g: "inf_continuous g"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   281
  shows "inf_continuous (\<lambda>x. f (g x))"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   282
  unfolding inf_continuous_def
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   283
proof safe
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 62374
diff changeset
   284
  fix M :: "nat \<Rightarrow> 'c"
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 62374
diff changeset
   285
  assume M: "antimono M"
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 62374
diff changeset
   286
  then have "antimono (\<lambda>i. g (M i))"
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   287
    using inf_continuous_mono[OF g] by (auto simp: mono_def antimono_def)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 63979
diff changeset
   288
  with M show "f (g (Inf (M ` UNIV))) = (INF i. f (g (M i)))"
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   289
    by (auto simp: inf_continuous_def g[THEN inf_continuousD] f[THEN inf_continuousD])
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   290
qed
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60500
diff changeset
   291
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   292
lemma inf_continuous_gfp:
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 58881
diff changeset
   293
  assumes "inf_continuous F" shows "gfp F = (INF i. (F ^^ i) top)" (is "gfp F = ?U")
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   294
proof (rule antisym)
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 60427
diff changeset
   295
  note mono = inf_continuous_mono[OF \<open>inf_continuous F\<close>]
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   296
  show "gfp F \<le> ?U"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   297
  proof (rule INF_greatest)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   298
    fix i show "gfp F \<le> (F ^^ i) top"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   299
    proof (induct i)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   300
      case (Suc i)
63979
95c3ae4baba8 clarified lfp/gfp statements and proofs;
wenzelm
parents: 63540
diff changeset
   301
      have "gfp F = F (gfp F)" by (simp add: gfp_fixpoint[OF mono])
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   302
      also have "\<dots> \<le> F ((F ^^ i) top)" by (rule monoD[OF mono Suc])
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   303
      also have "\<dots> = (F ^^ Suc i) top" by simp
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   304
      finally show ?case .
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   305
    qed simp
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   306
  qed
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   307
  show "?U \<le> gfp F"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   308
  proof (rule gfp_upperbound)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   309
    have *: "antimono (\<lambda>i::nat. (F ^^ i) top)"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   310
    proof -
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   311
      { fix i::nat have "(F ^^ Suc i) top \<le> (F ^^ i) top"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   312
        proof (induct i)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   313
          case 0 show ?case by simp
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   314
        next
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   315
          case Suc thus ?case using monoD[OF mono Suc] by auto
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   316
        qed }
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   317
      thus ?thesis by (auto simp add: antimono_iff_le_Suc)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   318
    qed
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   319
    have "?U \<le> (INF i. (F ^^ Suc i) top)"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   320
      by (fast intro: INF_greatest INF_lower)
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   321
    also have "\<dots> \<le> F ?U"
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 60427
diff changeset
   322
      by (simp add: inf_continuousD \<open>inf_continuous F\<close> *)
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   323
    finally show "?U \<le> F ?U" .
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   324
  qed
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 54257
diff changeset
   325
qed
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   326
60427
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   327
lemma gfp_transfer:
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   328
  assumes \<alpha>: "inf_continuous \<alpha>" and f: "inf_continuous f" and g: "inf_continuous g"
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   329
  assumes [simp]: "\<alpha> top = top" "\<And>x. \<alpha> (f x) = g (\<alpha> x)"
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   330
  shows "\<alpha> (gfp f) = gfp g"
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   331
proof -
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   332
  have "\<alpha> (gfp f) = (INF i. \<alpha> ((f^^i) top))"
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   333
    unfolding inf_continuous_gfp[OF f] by (intro f \<alpha> inf_continuousD antimono_funpow inf_continuous_mono)
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   334
  moreover have "\<alpha> ((f^^i) top) = (g^^i) top" for i
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   335
    by (induction i; simp)
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   336
  ultimately show ?thesis
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   337
    unfolding inf_continuous_gfp[OF g] by simp
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   338
qed
b4b672f09270 add transfer theorems for fixed points
hoelzl
parents: 60172
diff changeset
   339
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   340
lemma gfp_transfer_bounded:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   341
  assumes P: "P (f top)" "\<And>x. P x \<Longrightarrow> P (f x)" "\<And>M. antimono M \<Longrightarrow> (\<And>i. P (M i)) \<Longrightarrow> P (INF i::nat. M i)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   342
  assumes \<alpha>: "\<And>M. antimono M \<Longrightarrow> (\<And>i::nat. P (M i)) \<Longrightarrow> \<alpha> (INF i. M i) = (INF i. \<alpha> (M i))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   343
  assumes f: "inf_continuous f" and g: "inf_continuous g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   344
  assumes [simp]: "\<And>x. P x \<Longrightarrow> \<alpha> (f x) = g (\<alpha> x)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   345
  assumes g_bound: "\<And>x. g x \<le> \<alpha> (f top)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   346
  shows "\<alpha> (gfp f) = gfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   347
proof (rule antisym)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   348
  note mono_g = inf_continuous_mono[OF g]
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   349
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   350
  have P_pow: "P ((f ^^ i) (f top))" for i
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   351
    by (induction i) (auto intro!: P)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   352
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   353
  have antimono_pow: "antimono (\<lambda>i. (f ^^ i) top)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   354
    unfolding antimono_iff_le_Suc
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   355
  proof
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   356
    fix i show "(f ^^ Suc i) top \<le> (f ^^ i) top"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   357
    proof (induct i)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   358
      case Suc thus ?case using monoD[OF inf_continuous_mono[OF f] Suc] by auto
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   359
    qed (simp add: le_fun_def)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   360
  qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   361
  have antimono_pow2: "antimono (\<lambda>i. (f ^^ i) (f top))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   362
  proof
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   363
    show "x \<le> y \<Longrightarrow> (f ^^ y) (f top) \<le> (f ^^ x) (f top)" for x y
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   364
      using antimono_pow[THEN antimonoD, of "Suc x" "Suc y"]
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   365
      unfolding funpow_Suc_right by simp
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   366
  qed
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   367
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   368
  have gfp_f: "gfp f = (INF i. (f ^^ i) (f top))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   369
    unfolding inf_continuous_gfp[OF f]
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   370
  proof (rule INF_eq)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   371
    show "\<exists>j\<in>UNIV. (f ^^ j) (f top) \<le> (f ^^ i) top" for i
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   372
      by (intro bexI[of _ "i - 1"]) (auto simp: diff_Suc funpow_Suc_right simp del: funpow.simps(2) split: nat.split)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   373
    show "\<exists>j\<in>UNIV. (f ^^ j) top \<le> (f ^^ i) (f top)" for i
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   374
      by (intro bexI[of _ "Suc i"]) (auto simp: funpow_Suc_right simp del: funpow.simps(2))
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   375
  qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   376
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   377
  have P_lfp: "P (gfp f)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   378
    unfolding gfp_f by (auto intro!: P P_pow antimono_pow2)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   379
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   380
  have "\<alpha> (gfp f) = (INF i. \<alpha> ((f^^i) (f top)))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   381
    unfolding gfp_f by (rule \<alpha>) (auto intro!: P_pow antimono_pow2)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   382
  also have "\<dots> \<ge> gfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   383
  proof (rule INF_greatest)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   384
    fix i show "gfp g \<le> \<alpha> ((f^^i) (f top))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   385
    proof (induction i)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   386
      case (Suc n) then show ?case
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   387
        by (subst gfp_unfold[OF mono_g]) (simp add: monoD[OF mono_g] P_pow)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   388
    next
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   389
      case 0
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   390
      have "gfp g \<le> \<alpha> (f top)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   391
        by (subst gfp_unfold[OF mono_g]) (rule g_bound)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   392
      then show ?case
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   393
        by simp
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   394
    qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   395
  qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   396
  finally show "gfp g \<le> \<alpha> (gfp f)" .
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   397
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   398
  show "\<alpha> (gfp f) \<le> gfp g"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   399
  proof (induction rule: gfp_ordinal_induct[OF mono_g])
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   400
    case (1 S) then show ?case
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   401
      by (subst gfp_unfold[OF inf_continuous_mono[OF f]])
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   402
         (simp add: monoD[OF mono_g] P_lfp)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   403
  qed (auto intro: Inf_greatest)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   404
qed
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
   405
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   406
subsubsection \<open>Least fixed points in countable complete lattices\<close>
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   407
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   408
definition (in countable_complete_lattice) cclfp :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a"
62374
cb27a55d868a remove lattice syntax from countable complete lattice
hoelzl
parents: 62373
diff changeset
   409
  where "cclfp f = (SUP i. (f ^^ i) bot)"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   410
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   411
lemma cclfp_unfold:
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   412
  assumes "sup_continuous F" shows "cclfp F = F (cclfp F)"
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   413
proof -
62374
cb27a55d868a remove lattice syntax from countable complete lattice
hoelzl
parents: 62373
diff changeset
   414
  have "cclfp F = (SUP i. F ((F ^^ i) bot))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   415
    unfolding cclfp_def by (subst UNIV_nat_eq) auto
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   416
  also have "\<dots> = F (cclfp F)"
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   417
    unfolding cclfp_def
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   418
    by (intro sup_continuousD[symmetric] assms mono_funpow sup_continuous_mono)
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   419
  finally show ?thesis .
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   420
qed
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   421
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   422
lemma cclfp_lowerbound: assumes f: "mono f" and A: "f A \<le> A" shows "cclfp f \<le> A"
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   423
  unfolding cclfp_def
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   424
proof (intro ccSUP_least)
62374
cb27a55d868a remove lattice syntax from countable complete lattice
hoelzl
parents: 62373
diff changeset
   425
  fix i show "(f ^^ i) bot \<le> A"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   426
  proof (induction i)
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   427
    case (Suc i) from monoD[OF f this] A show ?case
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   428
      by auto
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   429
  qed simp
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   430
qed simp
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   431
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   432
lemma cclfp_transfer:
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   433
  assumes "sup_continuous \<alpha>" "mono f"
62374
cb27a55d868a remove lattice syntax from countable complete lattice
hoelzl
parents: 62373
diff changeset
   434
  assumes "\<alpha> bot = bot" "\<And>x. \<alpha> (f x) = g (\<alpha> x)"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   435
  shows "\<alpha> (cclfp f) = cclfp g"
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   436
proof -
62374
cb27a55d868a remove lattice syntax from countable complete lattice
hoelzl
parents: 62373
diff changeset
   437
  have "\<alpha> (cclfp f) = (SUP i. \<alpha> ((f ^^ i) bot))"
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   438
    unfolding cclfp_def by (intro sup_continuousD assms mono_funpow sup_continuous_mono)
62374
cb27a55d868a remove lattice syntax from countable complete lattice
hoelzl
parents: 62373
diff changeset
   439
  moreover have "\<alpha> ((f ^^ i) bot) = (g ^^ i) bot" for i
62373
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   440
    by (induction i) (simp_all add: assms)
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   441
  ultimately show ?thesis
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   442
    by (simp add: cclfp_def)
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   443
qed
ea7a442e9a56 add countable complete lattices
hoelzl
parents: 61585
diff changeset
   444
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   445
end