src/HOL/Complete_Partial_Order.thy
author wenzelm
Sat, 07 Apr 2012 16:41:59 +0200
changeset 47389 e8552cba702d
parent 46041 1e3ff542e83e
child 53361 1cb7d3c0cf31
permissions -rw-r--r--
explicit checks stable_finished_theory/stable_command allow parallel asynchronous command transactions; tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     1
(* Title:    HOL/Complete_Partial_Order.thy
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     2
   Author:   Brian Huffman, Portland State University
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     3
   Author:   Alexander Krauss, TU Muenchen
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     4
*)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     5
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     6
header {* Chain-complete partial orders and their fixpoints *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     7
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     8
theory Complete_Partial_Order
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
     9
imports Product_Type
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    10
begin
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    11
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    12
subsection {* Monotone functions *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    13
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    14
text {* Dictionary-passing version of @{const Orderings.mono}. *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    15
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    16
definition monotone :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    17
where "monotone orda ordb f \<longleftrightarrow> (\<forall>x y. orda x y \<longrightarrow> ordb (f x) (f y))"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    18
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    19
lemma monotoneI[intro?]: "(\<And>x y. orda x y \<Longrightarrow> ordb (f x) (f y))
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    20
 \<Longrightarrow> monotone orda ordb f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    21
unfolding monotone_def by iprover
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    22
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    23
lemma monotoneD[dest?]: "monotone orda ordb f \<Longrightarrow> orda x y \<Longrightarrow> ordb (f x) (f y)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    24
unfolding monotone_def by iprover
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    25
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    26
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    27
subsection {* Chains *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    28
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    29
text {* A chain is a totally-ordered set. Chains are parameterized over
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    30
  the order for maximal flexibility, since type classes are not enough.
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    31
*}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    32
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    33
definition
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    34
  chain :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> bool"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    35
where
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    36
  "chain ord S \<longleftrightarrow> (\<forall>x\<in>S. \<forall>y\<in>S. ord x y \<or> ord y x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    37
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    38
lemma chainI:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    39
  assumes "\<And>x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> ord x y \<or> ord y x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    40
  shows "chain ord S"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    41
using assms unfolding chain_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    42
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    43
lemma chainD:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    44
  assumes "chain ord S" and "x \<in> S" and "y \<in> S"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    45
  shows "ord x y \<or> ord y x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    46
using assms unfolding chain_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    47
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    48
lemma chainE:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    49
  assumes "chain ord S" and "x \<in> S" and "y \<in> S"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    50
  obtains "ord x y" | "ord y x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    51
using assms unfolding chain_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    52
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    53
subsection {* Chain-complete partial orders *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    54
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    55
text {*
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    56
  A ccpo has a least upper bound for any chain.  In particular, the
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    57
  empty set is a chain, so every ccpo must have a bottom element.
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    58
*}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    59
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    60
class ccpo = order + Sup +
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    61
  assumes ccpo_Sup_upper: "\<lbrakk>chain (op \<le>) A; x \<in> A\<rbrakk> \<Longrightarrow> x \<le> Sup A"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    62
  assumes ccpo_Sup_least: "\<lbrakk>chain (op \<le>) A; \<And>x. x \<in> A \<Longrightarrow> x \<le> z\<rbrakk> \<Longrightarrow> Sup A \<le> z"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    63
begin
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    64
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    65
subsection {* Transfinite iteration of a function *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    66
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    67
inductive_set iterates :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a set"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    68
for f :: "'a \<Rightarrow> 'a"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    69
where
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    70
  step: "x \<in> iterates f \<Longrightarrow> f x \<in> iterates f"
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    71
| Sup: "chain (op \<le>) M \<Longrightarrow> \<forall>x\<in>M. x \<in> iterates f \<Longrightarrow> Sup M \<in> iterates f"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    72
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    73
lemma iterates_le_f:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    74
  "x \<in> iterates f \<Longrightarrow> monotone (op \<le>) (op \<le>) f \<Longrightarrow> x \<le> f x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    75
by (induct x rule: iterates.induct)
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    76
  (force dest: monotoneD intro!: ccpo_Sup_upper ccpo_Sup_least)+
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    77
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    78
lemma chain_iterates:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    79
  assumes f: "monotone (op \<le>) (op \<le>) f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    80
  shows "chain (op \<le>) (iterates f)" (is "chain _ ?C")
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    81
proof (rule chainI)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    82
  fix x y assume "x \<in> ?C" "y \<in> ?C"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    83
  then show "x \<le> y \<or> y \<le> x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    84
  proof (induct x arbitrary: y rule: iterates.induct)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    85
    fix x y assume y: "y \<in> ?C"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    86
    and IH: "\<And>z. z \<in> ?C \<Longrightarrow> x \<le> z \<or> z \<le> x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    87
    from y show "f x \<le> y \<or> y \<le> f x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    88
    proof (induct y rule: iterates.induct)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    89
      case (step y) with IH f show ?case by (auto dest: monotoneD)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    90
    next
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    91
      case (Sup M)
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    92
      then have chM: "chain (op \<le>) M"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    93
        and IH': "\<And>z. z \<in> M \<Longrightarrow> f x \<le> z \<or> z \<le> f x" by auto
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    94
      show "f x \<le> Sup M \<or> Sup M \<le> f x"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    95
      proof (cases "\<exists>z\<in>M. f x \<le> z")
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    96
        case True then have "f x \<le> Sup M"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    97
          apply rule
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
    98
          apply (erule order_trans)
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
    99
          by (rule ccpo_Sup_upper[OF chM])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   100
        thus ?thesis ..
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   101
      next
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   102
        case False with IH'
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   103
        show ?thesis by (auto intro: ccpo_Sup_least[OF chM])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   104
      qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   105
    qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   106
  next
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   107
    case (Sup M y)
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   108
    show ?case
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   109
    proof (cases "\<exists>x\<in>M. y \<le> x")
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   110
      case True then have "y \<le> Sup M"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   111
        apply rule
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   112
        apply (erule order_trans)
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   113
        by (rule ccpo_Sup_upper[OF Sup(1)])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   114
      thus ?thesis ..
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   115
    next
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   116
      case False with Sup
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   117
      show ?thesis by (auto intro: ccpo_Sup_least)
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   118
    qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   119
  qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   120
qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   121
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   122
subsection {* Fixpoint combinator *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   123
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   124
definition
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   125
  fixp :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   126
where
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   127
  "fixp f = Sup (iterates f)"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   128
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   129
lemma iterates_fixp:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   130
  assumes f: "monotone (op \<le>) (op \<le>) f" shows "fixp f \<in> iterates f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   131
unfolding fixp_def
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   132
by (simp add: iterates.Sup chain_iterates f)
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   133
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   134
lemma fixp_unfold:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   135
  assumes f: "monotone (op \<le>) (op \<le>) f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   136
  shows "fixp f = f (fixp f)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   137
proof (rule antisym)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   138
  show "fixp f \<le> f (fixp f)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   139
    by (intro iterates_le_f iterates_fixp f)
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   140
  have "f (fixp f) \<le> Sup (iterates f)"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   141
    by (intro ccpo_Sup_upper chain_iterates f iterates.step iterates_fixp)
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   142
  thus "f (fixp f) \<le> fixp f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   143
    unfolding fixp_def .
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   144
qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   145
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   146
lemma fixp_lowerbound:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   147
  assumes f: "monotone (op \<le>) (op \<le>) f" and z: "f z \<le> z" shows "fixp f \<le> z"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   148
unfolding fixp_def
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   149
proof (rule ccpo_Sup_least[OF chain_iterates[OF f]])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   150
  fix x assume "x \<in> iterates f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   151
  thus "x \<le> z"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   152
  proof (induct x rule: iterates.induct)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   153
    fix x assume "x \<le> z" with f have "f x \<le> f z" by (rule monotoneD)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   154
    also note z finally show "f x \<le> z" .
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   155
  qed (auto intro: ccpo_Sup_least)
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   156
qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   157
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   158
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   159
subsection {* Fixpoint induction *}
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   160
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   161
definition
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   162
  admissible :: "('a \<Rightarrow> bool) \<Rightarrow> bool"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   163
where
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   164
  "admissible P = (\<forall>A. chain (op \<le>) A \<longrightarrow> (\<forall>x\<in>A. P x) \<longrightarrow> P (Sup A))"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   165
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   166
lemma admissibleI:
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   167
  assumes "\<And>A. chain (op \<le>) A \<Longrightarrow> \<forall>x\<in>A. P x \<Longrightarrow> P (Sup A)"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   168
  shows "admissible P"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   169
using assms unfolding admissible_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   170
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   171
lemma admissibleD:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   172
  assumes "admissible P"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   173
  assumes "chain (op \<le>) A"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   174
  assumes "\<And>x. x \<in> A \<Longrightarrow> P x"
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   175
  shows "P (Sup A)"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   176
using assms by (auto simp: admissible_def)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   177
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   178
lemma fixp_induct:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   179
  assumes adm: "admissible P"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   180
  assumes mono: "monotone (op \<le>) (op \<le>) f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   181
  assumes step: "\<And>x. P x \<Longrightarrow> P (f x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   182
  shows "P (fixp f)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   183
unfolding fixp_def using adm chain_iterates[OF mono]
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   184
proof (rule admissibleD)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   185
  fix x assume "x \<in> iterates f"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   186
  thus "P x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   187
    by (induct rule: iterates.induct)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   188
      (auto intro: step admissibleD adm)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   189
qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   190
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   191
lemma admissible_True: "admissible (\<lambda>x. True)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   192
unfolding admissible_def by simp
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   193
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   194
lemma admissible_False: "\<not> admissible (\<lambda>x. False)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   195
unfolding admissible_def chain_def by simp
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   196
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   197
lemma admissible_const: "admissible (\<lambda>x. t) = t"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   198
by (cases t, simp_all add: admissible_True admissible_False)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   199
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   200
lemma admissible_conj:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   201
  assumes "admissible (\<lambda>x. P x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   202
  assumes "admissible (\<lambda>x. Q x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   203
  shows "admissible (\<lambda>x. P x \<and> Q x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   204
using assms unfolding admissible_def by simp
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   205
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   206
lemma admissible_all:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   207
  assumes "\<And>y. admissible (\<lambda>x. P x y)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   208
  shows "admissible (\<lambda>x. \<forall>y. P x y)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   209
using assms unfolding admissible_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   210
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   211
lemma admissible_ball:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   212
  assumes "\<And>y. y \<in> A \<Longrightarrow> admissible (\<lambda>x. P x y)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   213
  shows "admissible (\<lambda>x. \<forall>y\<in>A. P x y)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   214
using assms unfolding admissible_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   215
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   216
lemma chain_compr: "chain (op \<le>) A \<Longrightarrow> chain (op \<le>) {x \<in> A. P x}"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   217
unfolding chain_def by fast
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   218
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   219
lemma admissible_disj_lemma:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   220
  assumes A: "chain (op \<le>)A"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   221
  assumes P: "\<forall>x\<in>A. \<exists>y\<in>A. x \<le> y \<and> P y"
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   222
  shows "Sup A = Sup {x \<in> A. P x}"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   223
proof (rule antisym)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   224
  have *: "chain (op \<le>) {x \<in> A. P x}"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   225
    by (rule chain_compr [OF A])
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   226
  show "Sup A \<le> Sup {x \<in> A. P x}"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   227
    apply (rule ccpo_Sup_least [OF A])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   228
    apply (drule P [rule_format], clarify)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   229
    apply (erule order_trans)
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   230
    apply (simp add: ccpo_Sup_upper [OF *])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   231
    done
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   232
  show "Sup {x \<in> A. P x} \<le> Sup A"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   233
    apply (rule ccpo_Sup_least [OF *])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   234
    apply clarify
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   235
    apply (simp add: ccpo_Sup_upper [OF A])
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   236
    done
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   237
qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   238
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   239
lemma admissible_disj:
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   240
  fixes P Q :: "'a \<Rightarrow> bool"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   241
  assumes P: "admissible (\<lambda>x. P x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   242
  assumes Q: "admissible (\<lambda>x. Q x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   243
  shows "admissible (\<lambda>x. P x \<or> Q x)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   244
proof (rule admissibleI)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   245
  fix A :: "'a set" assume A: "chain (op \<le>) A"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   246
  assume "\<forall>x\<in>A. P x \<or> Q x"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   247
  hence "(\<forall>x\<in>A. \<exists>y\<in>A. x \<le> y \<and> P y) \<or> (\<forall>x\<in>A. \<exists>y\<in>A. x \<le> y \<and> Q y)"
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   248
    using chainD[OF A] by blast
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   249
  hence "Sup A = Sup {x \<in> A. P x} \<or> Sup A = Sup {x \<in> A. Q x}"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   250
    using admissible_disj_lemma [OF A] by fast
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   251
  thus "P (Sup A) \<or> Q (Sup A)"
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   252
    apply (rule disjE, simp_all)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   253
    apply (rule disjI1, rule admissibleD [OF P chain_compr [OF A]], simp)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   254
    apply (rule disjI2, rule admissibleD [OF Q chain_compr [OF A]], simp)
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   255
    done
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   256
qed
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   257
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   258
end
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   259
46041
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   260
instance complete_lattice \<subseteq> ccpo
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   261
  by default (fast intro: Sup_upper Sup_least)+
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   262
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   263
lemma lfp_eq_fixp:
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   264
  assumes f: "mono f" shows "lfp f = fixp f"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   265
proof (rule antisym)
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   266
  from f have f': "monotone (op \<le>) (op \<le>) f"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   267
    unfolding mono_def monotone_def .
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   268
  show "lfp f \<le> fixp f"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   269
    by (rule lfp_lowerbound, subst fixp_unfold [OF f'], rule order_refl)
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   270
  show "fixp f \<le> lfp f"
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   271
    by (rule fixp_lowerbound [OF f'], subst lfp_unfold [OF f], rule order_refl)
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   272
qed
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   273
1e3ff542e83e remove constant 'ccpo.lub', re-use constant 'Sup' instead
huffman
parents: 40252
diff changeset
   274
hide_const (open) iterates fixp admissible
40106
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   275
c58951943cba Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
krauss
parents:
diff changeset
   276
end