src/HOL/FixedPoint.thy
author haftmann
Tue, 10 Jul 2007 17:30:50 +0200
changeset 23709 fd31da8f752a
parent 23707 745799215e02
child 23737 9194aecbf20e
permissions -rw-r--r--
moved lfp_induct2 here
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     1
(*  Title:      HOL/FixedPoint.thy
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     2
    ID:         $Id$
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
     4
    Author:     Stefan Berghofer, TU Muenchen
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     5
    Copyright   1992  University of Cambridge
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     6
*)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     7
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
     8
header {* Fixed Points and the Knaster-Tarski Theorem*}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
     9
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
    10
theory FixedPoint
23707
745799215e02 moved lfp_induct2 to Relation.thy
haftmann
parents: 23131
diff changeset
    11
imports Fun
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
    12
begin
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
    13
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
    14
subsection {* Complete lattices *}
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
    15
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
    16
class complete_lattice = lattice +
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    17
  fixes Inf :: "'a set \<Rightarrow> 'a" ("\<Sqinter>_" [900] 900)
22845
5f9138bcb3d7 changed code generator invocation syntax
haftmann
parents: 22744
diff changeset
    18
  assumes Inf_lower: "x \<in> A \<Longrightarrow> \<Sqinter>A \<sqsubseteq> x"
5f9138bcb3d7 changed code generator invocation syntax
haftmann
parents: 22744
diff changeset
    19
  assumes Inf_greatest: "(\<And>x. x \<in> A \<Longrightarrow> z \<sqsubseteq> x) \<Longrightarrow> z \<sqsubseteq> \<Sqinter>A"
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    20
begin
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    21
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    22
definition
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    23
  Sup :: "'a set \<Rightarrow> 'a" ("\<Squnion>_" [900] 900)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    24
where
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    25
  "\<Squnion>A = \<Sqinter>{b. \<forall>a \<in> A. a \<^loc>\<le> b}"
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    26
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    27
lemma Inf_Sup: "\<Sqinter>A = \<Squnion>{b. \<forall>a \<in> A. b \<^loc>\<le> a}"
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    28
  unfolding Sup_def by (auto intro: Inf_greatest Inf_lower)
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    29
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    30
lemma Sup_upper: "x \<in> A \<Longrightarrow> x \<^loc>\<le> \<Squnion>A"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    31
  by (auto simp: Sup_def intro: Inf_greatest)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    32
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    33
lemma Sup_least: "(\<And>x. x \<in> A \<Longrightarrow> x \<^loc>\<le> z) \<Longrightarrow> \<Squnion>A \<^loc>\<le> z"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    34
  by (auto simp: Sup_def intro: Inf_lower)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    35
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    36
lemma top_greatest [simp]: "x \<^loc>\<le> \<Sqinter>{}"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    37
  by (rule Inf_greatest) simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    38
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    39
lemma bot_least [simp]: "\<Squnion>{} \<^loc>\<le> x"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    40
  by (rule Sup_least) simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    41
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    42
lemma Inf_Univ: "\<Sqinter>UNIV = \<Squnion>{}"
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    43
  unfolding Sup_def by auto
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    44
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    45
lemma Sup_Univ: "\<Squnion>UNIV = \<Sqinter>{}"
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    46
  unfolding Inf_Sup by auto
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
    47
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    48
lemma Inf_insert: "\<Sqinter>insert a A = a \<sqinter> \<Sqinter>A"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    49
  apply (rule antisym)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    50
  apply (rule le_infI)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    51
  apply (rule Inf_lower)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    52
  apply simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    53
  apply (rule Inf_greatest)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    54
  apply (rule Inf_lower)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    55
  apply simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    56
  apply (rule Inf_greatest)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    57
  apply (erule insertE)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    58
  apply (rule le_infI1)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    59
  apply simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    60
  apply (rule le_infI2)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    61
  apply (erule Inf_lower)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    62
  done
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    63
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    64
lemma Sup_insert: "\<Squnion>insert a A = a \<squnion> \<Squnion>A"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    65
  apply (rule antisym)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    66
  apply (rule Sup_least)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    67
  apply (erule insertE)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    68
  apply (rule le_supI1)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    69
  apply simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    70
  apply (rule le_supI2)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    71
  apply (erule Sup_upper)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    72
  apply (rule le_supI)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    73
  apply (rule Sup_upper)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    74
  apply simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    75
  apply (rule Sup_least)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    76
  apply (rule Sup_upper)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    77
  apply simp
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    78
  done
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    79
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    80
lemma Inf_singleton [simp]:
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    81
  "\<Sqinter>{a} = a"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    82
  by (auto intro: antisym Inf_lower Inf_greatest)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    83
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    84
lemma Sup_singleton [simp]:
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    85
  "\<Squnion>{a} = a"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    86
  by (auto intro: antisym Sup_upper Sup_least)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    87
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    88
lemma Inf_insert_simp:
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    89
  "\<Sqinter>insert a A = (if A = {} then a else a \<sqinter> \<Sqinter>A)"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    90
  by (cases "A = {}") (simp_all, simp add: Inf_insert)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    91
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    92
lemma Sup_insert_simp:
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    93
  "\<Squnion>insert a A = (if A = {} then a else a \<squnion> \<Squnion>A)"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    94
  by (cases "A = {}") (simp_all, simp add: Sup_insert)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    95
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    96
lemma Inf_binary:
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    97
  "\<Sqinter>{a, b} = a \<sqinter> b"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    98
  by (simp add: Inf_insert_simp)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
    99
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   100
lemma Sup_binary:
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   101
  "\<Squnion>{a, b} = a \<squnion> b"
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   102
  by (simp add: Sup_insert_simp)
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   103
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   104
end
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   105
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   106
lemmas Sup_def = Sup_def [folded complete_lattice_class.Sup]
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   107
lemmas Sup_upper = Sup_upper [folded complete_lattice_class.Sup]
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   108
lemmas Sup_least = Sup_least [folded complete_lattice_class.Sup]
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   109
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   110
lemmas bot_least [simp] = bot_least [folded complete_lattice_class.Sup]
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   111
lemmas Sup_insert [code func] = Sup_insert [folded complete_lattice_class.Sup]
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   112
lemmas Sup_singleton [simp, code func] = Sup_singleton [folded complete_lattice_class.Sup]
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   113
lemmas Sup_insert_simp = Sup_insert_simp [folded complete_lattice_class.Sup]
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   114
lemmas Sup_binary = Sup_binary [folded complete_lattice_class.Sup]
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   115
22430
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   116
definition
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   117
  SUPR :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b::complete_lattice) \<Rightarrow> 'b" where
22430
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   118
  "SUPR A f == Sup (f ` A)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   119
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   120
definition
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   121
  INFI :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b::complete_lattice) \<Rightarrow> 'b" where
22430
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   122
  "INFI A f == Inf (f ` A)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   123
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   124
syntax
22439
b709739c69e6 syntax: proper body priorty for derived binders;
wenzelm
parents: 22430
diff changeset
   125
  "_SUP1"     :: "pttrns => 'b => 'b"           ("(3SUP _./ _)" [0, 10] 10)
b709739c69e6 syntax: proper body priorty for derived binders;
wenzelm
parents: 22430
diff changeset
   126
  "_SUP"      :: "pttrn => 'a set => 'b => 'b"  ("(3SUP _:_./ _)" [0, 10] 10)
b709739c69e6 syntax: proper body priorty for derived binders;
wenzelm
parents: 22430
diff changeset
   127
  "_INF1"     :: "pttrns => 'b => 'b"           ("(3INF _./ _)" [0, 10] 10)
b709739c69e6 syntax: proper body priorty for derived binders;
wenzelm
parents: 22430
diff changeset
   128
  "_INF"      :: "pttrn => 'a set => 'b => 'b"  ("(3INF _:_./ _)" [0, 10] 10)
22430
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   129
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   130
translations
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   131
  "SUP x y. B"   == "SUP x. SUP y. B"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   132
  "SUP x. B"     == "CONST SUPR UNIV (%x. B)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   133
  "SUP x. B"     == "SUP x:UNIV. B"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   134
  "SUP x:A. B"   == "CONST SUPR A (%x. B)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   135
  "INF x y. B"   == "INF x. INF y. B"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   136
  "INF x. B"     == "CONST INFI UNIV (%x. B)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   137
  "INF x. B"     == "INF x:UNIV. B"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   138
  "INF x:A. B"   == "CONST INFI A (%x. B)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   139
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   140
(* To avoid eta-contraction of body: *)
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   141
print_translation {*
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   142
let
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   143
  fun btr' syn (A :: Abs abs :: ts) =
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   144
    let val (x,t) = atomic_abs_tr' abs
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   145
    in list_comb (Syntax.const syn $ x $ A $ t, ts) end
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   146
  val const_syntax_name = Sign.const_syntax_name @{theory} o fst o dest_Const
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   147
in
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   148
[(const_syntax_name @{term SUPR}, btr' "_SUP"),(const_syntax_name @{term "INFI"}, btr' "_INF")]
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   149
end
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   150
*}
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   151
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   152
lemma le_SUPI: "i : A \<Longrightarrow> M i \<le> (SUP i:A. M i)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   153
  by (auto simp add: SUPR_def intro: Sup_upper)
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   154
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   155
lemma SUP_leI: "(\<And>i. i : A \<Longrightarrow> M i \<le> u) \<Longrightarrow> (SUP i:A. M i) \<le> u"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   156
  by (auto simp add: SUPR_def intro: Sup_least)
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   157
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   158
lemma INF_leI: "i : A \<Longrightarrow> (INF i:A. M i) \<le> M i"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   159
  by (auto simp add: INFI_def intro: Inf_lower)
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   160
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   161
lemma le_INFI: "(\<And>i. i : A \<Longrightarrow> u \<le> M i) \<Longrightarrow> u \<le> (INF i:A. M i)"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   162
  by (auto simp add: INFI_def intro: Inf_greatest)
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   163
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   164
lemma mono_inf: "mono f \<Longrightarrow> f (inf A B) <= inf (f A) (f B)"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   165
  by (auto simp add: mono_def)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   166
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   167
lemma mono_sup: "mono f \<Longrightarrow> sup (f A) (f B) <= f (sup A B)"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   168
  by (auto simp add: mono_def)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   169
22430
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   170
lemma SUP_const[simp]: "A \<noteq> {} \<Longrightarrow> (SUP i:A. M) = M"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   171
  by (auto intro: order_antisym SUP_leI le_SUPI)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   172
22430
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   173
lemma INF_const[simp]: "A \<noteq> {} \<Longrightarrow> (INF i:A. M) = M"
6a56bf1b3a64 Generalized version of SUP and INF (with index set).
berghofe
parents: 22422
diff changeset
   174
  by (auto intro: order_antisym INF_leI le_INFI)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   175
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   176
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   177
subsection {* Some instances of the type class of complete lattices *}
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   178
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   179
subsubsection {* Booleans *}
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   180
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   181
instance bool :: complete_lattice
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   182
  Inf_bool_def: "Inf A \<equiv> \<forall>x\<in>A. x"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   183
  apply intro_classes
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   184
  apply (unfold Inf_bool_def)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   185
  apply (iprover intro!: le_boolI elim: ballE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   186
  apply (iprover intro!: ballI le_boolI elim: ballE le_boolE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   187
  done
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   188
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   189
theorem Sup_bool_eq: "Sup A \<longleftrightarrow> (\<exists>x\<in>A. x)"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   190
  apply (rule order_antisym)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   191
  apply (rule Sup_least)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   192
  apply (rule le_boolI)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   193
  apply (erule bexI, assumption)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   194
  apply (rule le_boolI)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   195
  apply (erule bexE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   196
  apply (rule le_boolE)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   197
  apply (rule Sup_upper)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   198
  apply assumption+
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   199
  done
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   200
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   201
lemma Inf_empty_bool [simp]:
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   202
  "Inf {}"
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   203
  unfolding Inf_bool_def by auto
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   204
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   205
lemma not_Sup_empty_bool [simp]:
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   206
  "\<not> Sup {}"
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   207
  unfolding Sup_def Inf_bool_def by auto
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   208
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   209
subsubsection {* Functions *}
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   210
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   211
instance "fun" :: (type, complete_lattice) complete_lattice
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   212
  Inf_fun_def: "Inf A \<equiv> (\<lambda>x. Inf {y. \<exists>f\<in>A. y = f x})"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   213
  apply intro_classes
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   214
  apply (unfold Inf_fun_def)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   215
  apply (rule le_funI)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   216
  apply (rule Inf_lower)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   217
  apply (rule CollectI)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   218
  apply (rule bexI)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   219
  apply (rule refl)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   220
  apply assumption
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   221
  apply (rule le_funI)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   222
  apply (rule Inf_greatest)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   223
  apply (erule CollectE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   224
  apply (erule bexE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   225
  apply (iprover elim: le_funE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   226
  done
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   227
22845
5f9138bcb3d7 changed code generator invocation syntax
haftmann
parents: 22744
diff changeset
   228
lemmas [code func del] = Inf_fun_def
22744
5cbe966d67a2 Isar definitions are now added explicitly to code theorem table
haftmann
parents: 22477
diff changeset
   229
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   230
theorem Sup_fun_eq: "Sup A = (\<lambda>x. Sup {y. \<exists>f\<in>A. y = f x})"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   231
  apply (rule order_antisym)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   232
  apply (rule Sup_least)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   233
  apply (rule le_funI)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   234
  apply (rule Sup_upper)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   235
  apply fast
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   236
  apply (rule le_funI)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   237
  apply (rule Sup_least)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   238
  apply (erule CollectE)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   239
  apply (erule bexE)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   240
  apply (drule le_funD [OF Sup_upper])
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   241
  apply simp
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   242
  done
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   243
23131
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   244
lemma Inf_empty_fun:
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   245
  "Inf {} = (\<lambda>_. Inf {})"
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   246
  by rule (auto simp add: Inf_fun_def)
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   247
23131
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   248
lemma Sup_empty_fun:
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   249
  "Sup {} = (\<lambda>_. Sup {})"
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   250
proof -
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   251
  have aux: "\<And>x. {y. \<exists>f. y = f x} = UNIV" by auto
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   252
  show ?thesis
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   253
  by (auto simp add: Sup_def Inf_fun_def Inf_binary inf_bool_eq aux)
29e913950928 generalized lemmas
haftmann
parents: 23108
diff changeset
   254
qed
23108
7cb68a8708c1 using rudimentary class target mechanism
haftmann
parents: 22918
diff changeset
   255
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   256
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   257
subsubsection {* Sets *}
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   258
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   259
instance set :: (type) complete_lattice
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   260
  Inf_set_def: "Inf S \<equiv> \<Inter>S"
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   261
  by intro_classes (auto simp add: Inf_set_def)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   262
22845
5f9138bcb3d7 changed code generator invocation syntax
haftmann
parents: 22744
diff changeset
   263
lemmas [code func del] = Inf_set_def
22744
5cbe966d67a2 Isar definitions are now added explicitly to code theorem table
haftmann
parents: 22477
diff changeset
   264
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   265
theorem Sup_set_eq: "Sup S = \<Union>S"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   266
  apply (rule subset_antisym)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   267
  apply (rule Sup_least)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   268
  apply (erule Union_upper)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   269
  apply (rule Union_least)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   270
  apply (erule Sup_upper)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   271
  done
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   272
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   273
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   274
subsection {* Least and greatest fixed points *}
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   275
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   276
definition
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   277
  lfp :: "('a\<Colon>complete_lattice \<Rightarrow> 'a) \<Rightarrow> 'a" where
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   278
  "lfp f = Inf {u. f u \<le> u}"    --{*least fixed point*}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   279
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   280
definition
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22439
diff changeset
   281
  gfp :: "('a\<Colon>complete_lattice \<Rightarrow> 'a) \<Rightarrow> 'a" where
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   282
  "gfp f = Sup {u. u \<le> f u}"    --{*greatest fixed point*}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   283
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   284
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   285
subsection{* Proof of Knaster-Tarski Theorem using @{term lfp} *}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   286
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   287
text{*@{term "lfp f"} is the least upper bound of 
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   288
      the set @{term "{u. f(u) \<le> u}"} *}
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   289
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   290
lemma lfp_lowerbound: "f A \<le> A ==> lfp f \<le> A"
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   291
  by (auto simp add: lfp_def intro: Inf_lower)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   292
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   293
lemma lfp_greatest: "(!!u. f u \<le> u ==> A \<le> u) ==> A \<le> lfp f"
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   294
  by (auto simp add: lfp_def intro: Inf_greatest)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   295
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   296
lemma lfp_lemma2: "mono f ==> f (lfp f) \<le> lfp f"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   297
  by (iprover intro: lfp_greatest order_trans monoD lfp_lowerbound)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   298
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   299
lemma lfp_lemma3: "mono f ==> lfp f \<le> f (lfp f)"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   300
  by (iprover intro: lfp_lemma2 monoD lfp_lowerbound)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   301
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   302
lemma lfp_unfold: "mono f ==> lfp f = f (lfp f)"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   303
  by (iprover intro: order_antisym lfp_lemma2 lfp_lemma3)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   304
22356
fe054a72d9ce Added lemma lfp_const: "lfp (%x. t) = t
krauss
parents: 22276
diff changeset
   305
lemma lfp_const: "lfp (\<lambda>x. t) = t"
fe054a72d9ce Added lemma lfp_const: "lfp (%x. t) = t
krauss
parents: 22276
diff changeset
   306
  by (rule lfp_unfold) (simp add:mono_def)
fe054a72d9ce Added lemma lfp_const: "lfp (%x. t) = t
krauss
parents: 22276
diff changeset
   307
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   308
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   309
subsection {* General induction rules for least fixed points *}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   310
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   311
theorem lfp_induct:
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   312
  assumes mono: "mono f" and ind: "f (inf (lfp f) P) <= P"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   313
  shows "lfp f <= P"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   314
proof -
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   315
  have "inf (lfp f) P <= lfp f" by (rule inf_le1)
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   316
  with mono have "f (inf (lfp f) P) <= f (lfp f)" ..
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   317
  also from mono have "f (lfp f) = lfp f" by (rule lfp_unfold [symmetric])
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   318
  finally have "f (inf (lfp f) P) <= lfp f" .
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   319
  from this and ind have "f (inf (lfp f) P) <= inf (lfp f) P" by (rule le_infI)
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   320
  hence "lfp f <= inf (lfp f) P" by (rule lfp_lowerbound)
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   321
  also have "inf (lfp f) P <= P" by (rule inf_le2)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   322
  finally show ?thesis .
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   323
qed
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   324
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   325
lemma lfp_induct_set:
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   326
  assumes lfp: "a: lfp(f)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   327
      and mono: "mono(f)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   328
      and indhyp: "!!x. [| x: f(lfp(f) Int {x. P(x)}) |] ==> P(x)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   329
  shows "P(a)"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   330
  by (rule lfp_induct [THEN subsetD, THEN CollectD, OF mono _ lfp])
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   331
    (auto simp: inf_set_eq intro: indhyp)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   332
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   333
lemma lfp_ordinal_induct: 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   334
  assumes mono: "mono f"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   335
  shows "[| !!S. P S ==> P(f S); !!M. !S:M. P S ==> P(Union M) |] 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   336
         ==> P(lfp f)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   337
apply(subgoal_tac "lfp f = Union{S. S \<subseteq> lfp f & P S}")
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   338
 apply (erule ssubst, simp) 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   339
apply(subgoal_tac "Union{S. S \<subseteq> lfp f & P S} \<subseteq> lfp f")
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   340
 prefer 2 apply blast
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   341
apply(rule equalityI)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   342
 prefer 2 apply assumption
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   343
apply(drule mono [THEN monoD])
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   344
apply (cut_tac mono [THEN lfp_unfold], simp)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   345
apply (rule lfp_lowerbound, auto) 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   346
done
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   347
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   348
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   349
text{*Definition forms of @{text lfp_unfold} and @{text lfp_induct}, 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   350
    to control unfolding*}
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   351
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   352
lemma def_lfp_unfold: "[| h==lfp(f);  mono(f) |] ==> h = f(h)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   353
by (auto intro!: lfp_unfold)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   354
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   355
lemma def_lfp_induct: 
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   356
    "[| A == lfp(f); mono(f);
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   357
        f (inf A P) \<le> P
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   358
     |] ==> A \<le> P"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   359
  by (blast intro: lfp_induct)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   360
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   361
lemma def_lfp_induct_set: 
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   362
    "[| A == lfp(f);  mono(f);   a:A;                    
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   363
        !!x. [| x: f(A Int {x. P(x)}) |] ==> P(x)         
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   364
     |] ==> P(a)"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   365
  by (blast intro: lfp_induct_set)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   366
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   367
(*Monotonicity of lfp!*)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   368
lemma lfp_mono: "(!!Z. f Z \<le> g Z) ==> lfp f \<le> lfp g"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   369
  by (rule lfp_lowerbound [THEN lfp_greatest], blast intro: order_trans)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   370
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   371
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   372
subsection {* Proof of Knaster-Tarski Theorem using @{term gfp} *}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   373
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   374
text{*@{term "gfp f"} is the greatest lower bound of 
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   375
      the set @{term "{u. u \<le> f(u)}"} *}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   376
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   377
lemma gfp_upperbound: "X \<le> f X ==> X \<le> gfp f"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   378
  by (auto simp add: gfp_def intro: Sup_upper)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   379
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   380
lemma gfp_least: "(!!u. u \<le> f u ==> u \<le> X) ==> gfp f \<le> X"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 21017
diff changeset
   381
  by (auto simp add: gfp_def intro: Sup_least)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   382
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   383
lemma gfp_lemma2: "mono f ==> gfp f \<le> f (gfp f)"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   384
  by (iprover intro: gfp_least order_trans monoD gfp_upperbound)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   385
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   386
lemma gfp_lemma3: "mono f ==> f (gfp f) \<le> gfp f"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   387
  by (iprover intro: gfp_lemma2 monoD gfp_upperbound)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   388
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   389
lemma gfp_unfold: "mono f ==> gfp f = f (gfp f)"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   390
  by (iprover intro: order_antisym gfp_lemma2 gfp_lemma3)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   391
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   392
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   393
subsection {* Coinduction rules for greatest fixed points *}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   394
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   395
text{*weak version*}
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   396
lemma weak_coinduct: "[| a: X;  X \<subseteq> f(X) |] ==> a : gfp(f)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   397
by (rule gfp_upperbound [THEN subsetD], auto)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   398
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   399
lemma weak_coinduct_image: "!!X. [| a : X; g`X \<subseteq> f (g`X) |] ==> g a : gfp f"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   400
apply (erule gfp_upperbound [THEN subsetD])
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   401
apply (erule imageI)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   402
done
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   403
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   404
lemma coinduct_lemma:
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   405
     "[| X \<le> f (sup X (gfp f));  mono f |] ==> sup X (gfp f) \<le> f (sup X (gfp f))"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   406
  apply (frule gfp_lemma2)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   407
  apply (drule mono_sup)
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   408
  apply (rule le_supI)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   409
  apply assumption
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   410
  apply (rule order_trans)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   411
  apply (rule order_trans)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   412
  apply assumption
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   413
  apply (rule sup_ge2)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   414
  apply assumption
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   415
  done
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   416
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   417
text{*strong version, thanks to Coen and Frost*}
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   418
lemma coinduct_set: "[| mono(f);  a: X;  X \<subseteq> f(X Un gfp(f)) |] ==> a : gfp(f)"
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   419
by (blast intro: weak_coinduct [OF _ coinduct_lemma, simplified sup_set_eq])
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   420
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   421
lemma coinduct: "[| mono(f); X \<le> f (sup X (gfp f)) |] ==> X \<le> gfp(f)"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   422
  apply (rule order_trans)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   423
  apply (rule sup_ge1)
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   424
  apply (erule gfp_upperbound [OF coinduct_lemma])
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   425
  apply assumption
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   426
  done
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   427
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   428
lemma gfp_fun_UnI2: "[| mono(f);  a: gfp(f) |] ==> a: f(X Un gfp(f))"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   429
by (blast dest: gfp_lemma2 mono_Un)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   430
22918
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   431
b8b4d53ccd24 localized Sup/Inf
haftmann
parents: 22845
diff changeset
   432
subsection {* Even Stronger Coinduction Rule, by Martin Coen *}
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   433
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   434
text{* Weakens the condition @{term "X \<subseteq> f(X)"} to one expressed using both
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   435
  @{term lfp} and @{term gfp}*}
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   436
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   437
lemma coinduct3_mono_lemma: "mono(f) ==> mono(%x. f(x) Un X Un B)"
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 17006
diff changeset
   438
by (iprover intro: subset_refl monoI Un_mono monoD)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   439
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   440
lemma coinduct3_lemma:
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   441
     "[| X \<subseteq> f(lfp(%x. f(x) Un X Un gfp(f)));  mono(f) |]
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   442
      ==> lfp(%x. f(x) Un X Un gfp(f)) \<subseteq> f(lfp(%x. f(x) Un X Un gfp(f)))"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   443
apply (rule subset_trans)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   444
apply (erule coinduct3_mono_lemma [THEN lfp_lemma3])
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   445
apply (rule Un_least [THEN Un_least])
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   446
apply (rule subset_refl, assumption)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   447
apply (rule gfp_unfold [THEN equalityD1, THEN subset_trans], assumption)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   448
apply (rule monoD, assumption)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   449
apply (subst coinduct3_mono_lemma [THEN lfp_unfold], auto)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   450
done
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   451
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   452
lemma coinduct3: 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   453
  "[| mono(f);  a:X;  X \<subseteq> f(lfp(%x. f(x) Un X Un gfp(f))) |] ==> a : gfp(f)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   454
apply (rule coinduct3_lemma [THEN [2] weak_coinduct])
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   455
apply (rule coinduct3_mono_lemma [THEN lfp_unfold, THEN ssubst], auto)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   456
done
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   457
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   458
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   459
text{*Definition forms of @{text gfp_unfold} and @{text coinduct}, 
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   460
    to control unfolding*}
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   461
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   462
lemma def_gfp_unfold: "[| A==gfp(f);  mono(f) |] ==> A = f(A)"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   463
by (auto intro!: gfp_unfold)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   464
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   465
lemma def_coinduct:
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   466
     "[| A==gfp(f);  mono(f);  X \<le> f(sup X A) |] ==> X \<le> A"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   467
by (iprover intro!: coinduct)
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   468
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   469
lemma def_coinduct_set:
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   470
     "[| A==gfp(f);  mono(f);  a:X;  X \<subseteq> f(X Un A) |] ==> a: A"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   471
by (auto intro!: coinduct_set)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   472
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   473
(*The version used in the induction/coinduction package*)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   474
lemma def_Collect_coinduct:
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   475
    "[| A == gfp(%w. Collect(P(w)));  mono(%w. Collect(P(w)));   
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   476
        a: X;  !!z. z: X ==> P (X Un A) z |] ==>  
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   477
     a : A"
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   478
apply (erule def_coinduct_set, auto) 
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   479
done
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   480
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   481
lemma def_coinduct3:
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   482
    "[| A==gfp(f); mono(f);  a:X;  X \<subseteq> f(lfp(%x. f(x) Un X Un A)) |] ==> a: A"
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   483
by (auto intro!: coinduct3)
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   484
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   485
text{*Monotonicity of @{term gfp}!*}
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   486
lemma gfp_mono: "(!!Z. f Z \<le> g Z) ==> gfp f \<le> gfp g"
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   487
  by (rule gfp_upperbound [THEN gfp_least], blast intro: order_trans)
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   488
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   489
ML
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   490
{*
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   491
val lfp_def = thm "lfp_def";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   492
val lfp_lowerbound = thm "lfp_lowerbound";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   493
val lfp_greatest = thm "lfp_greatest";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   494
val lfp_unfold = thm "lfp_unfold";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   495
val lfp_induct = thm "lfp_induct";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   496
val lfp_ordinal_induct = thm "lfp_ordinal_induct";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   497
val def_lfp_unfold = thm "def_lfp_unfold";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   498
val def_lfp_induct = thm "def_lfp_induct";
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   499
val def_lfp_induct_set = thm "def_lfp_induct_set";
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   500
val lfp_mono = thm "lfp_mono";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   501
val gfp_def = thm "gfp_def";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   502
val gfp_upperbound = thm "gfp_upperbound";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   503
val gfp_least = thm "gfp_least";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   504
val gfp_unfold = thm "gfp_unfold";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   505
val weak_coinduct = thm "weak_coinduct";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   506
val weak_coinduct_image = thm "weak_coinduct_image";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   507
val coinduct = thm "coinduct";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   508
val gfp_fun_UnI2 = thm "gfp_fun_UnI2";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   509
val coinduct3 = thm "coinduct3";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   510
val def_gfp_unfold = thm "def_gfp_unfold";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   511
val def_coinduct = thm "def_coinduct";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   512
val def_Collect_coinduct = thm "def_Collect_coinduct";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   513
val def_coinduct3 = thm "def_coinduct3";
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   514
val gfp_mono = thm "gfp_mono";
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   515
val le_funI = thm "le_funI";
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   516
val le_boolI = thm "le_boolI";
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   517
val le_boolI' = thm "le_boolI'";
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   518
val inf_fun_eq = thm "inf_fun_eq";
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22390
diff changeset
   519
val inf_bool_eq = thm "inf_bool_eq";
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   520
val le_funE = thm "le_funE";
22276
96a4db55a0b3 Introduction and elimination rules for <= on predicates
berghofe
parents: 21547
diff changeset
   521
val le_funD = thm "le_funD";
21017
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   522
val le_boolE = thm "le_boolE";
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   523
val le_boolD = thm "le_boolD";
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   524
val le_bool_def = thm "le_bool_def";
5693e4471c2b Generalized gfp and lfp to arbitrary complete lattices.
berghofe
parents: 17589
diff changeset
   525
val le_fun_def = thm "le_fun_def";
17006
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   526
*}
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   527
cffca870816a combined Lfp and Gfp to FixedPoint
avigad
parents:
diff changeset
   528
end