src/HOLCF/FOCUS/Stream_adm.thy
author huffman
Tue Jul 01 02:19:53 2008 +0200 (2008-07-01)
changeset 27413 3154f3765cc7
parent 27101 864d29f11c9d
child 31084 f4db921165ce
permissions -rw-r--r--
replace lub (range Y) with (LUB i. Y i)
wenzelm@17293
     1
(*  Title:      HOLCF/ex/Stream_adm.thy
wenzelm@11355
     2
    ID:         $Id$
wenzelm@17293
     3
    Author:     David von Oheimb, TU Muenchen
oheimb@11350
     4
*)
oheimb@11350
     5
wenzelm@17293
     6
header {* Admissibility for streams *}
oheimb@11350
     7
wenzelm@17293
     8
theory Stream_adm
wenzelm@24107
     9
imports "../ex/Stream" Continuity
wenzelm@17293
    10
begin
oheimb@11350
    11
wenzelm@19763
    12
definition
wenzelm@21404
    13
  stream_monoP  :: "(('a stream) set \<Rightarrow> ('a stream) set) \<Rightarrow> bool" where
wenzelm@19763
    14
  "stream_monoP F = (\<exists>Q i. \<forall>P s. Fin i \<le> #s \<longrightarrow>
wenzelm@19763
    15
                    (s \<in> F P) = (stream_take i\<cdot>s \<in> Q \<and> iterate i\<cdot>rt\<cdot>s \<in> P))"
wenzelm@17293
    16
wenzelm@21404
    17
definition
wenzelm@21404
    18
  stream_antiP  :: "(('a stream) set \<Rightarrow> ('a stream) set) \<Rightarrow> bool" where
wenzelm@19763
    19
  "stream_antiP F = (\<forall>P x. \<exists>Q i.
wenzelm@17293
    20
                (#x  < Fin i \<longrightarrow> (\<forall>y. x \<sqsubseteq> y \<longrightarrow> y \<in> F P \<longrightarrow> x \<in> F P)) \<and>
wenzelm@17293
    21
                (Fin i <= #x \<longrightarrow> (\<forall>y. x \<sqsubseteq> y \<longrightarrow>
wenzelm@19763
    22
                (y \<in> F P) = (stream_take i\<cdot>y \<in> Q \<and> iterate i\<cdot>rt\<cdot>y \<in> P))))"
wenzelm@17293
    23
wenzelm@21404
    24
definition
wenzelm@21404
    25
  antitonP :: "'a set => bool" where
wenzelm@19763
    26
  "antitonP P = (\<forall>x y. x \<sqsubseteq> y \<longrightarrow> y\<in>P \<longrightarrow> x\<in>P)"
wenzelm@17293
    27
wenzelm@17293
    28
huffman@19759
    29
(* ----------------------------------------------------------------------- *)
huffman@19759
    30
huffman@19759
    31
section "admissibility"
huffman@19759
    32
huffman@19759
    33
lemma flatstream_adm_lemma:
wenzelm@26451
    34
  assumes 1: "Porder.chain Y"
huffman@19759
    35
  assumes 2: "!i. P (Y i)"
wenzelm@26451
    36
  assumes 3: "(!!Y. [| Porder.chain Y; !i. P (Y i); !k. ? j. Fin k < #((Y j)::'a::flat stream)|]
huffman@27413
    37
  ==> P(LUB i. Y i))"
huffman@27413
    38
  shows "P(LUB i. Y i)"
berghofe@26838
    39
apply (rule increasing_chain_adm_lemma [of _ P, OF 1 2])
huffman@19759
    40
apply (erule 3, assumption)
huffman@19759
    41
apply (erule thin_rl)
huffman@19759
    42
apply (rule allI)
huffman@19759
    43
apply (case_tac "!j. stream_finite (Y j)")
huffman@19759
    44
apply ( rule chain_incr)
huffman@19759
    45
apply ( rule allI)
huffman@19759
    46
apply ( drule spec)
huffman@19759
    47
apply ( safe)
huffman@19759
    48
apply ( rule exI)
huffman@19759
    49
apply ( rule slen_strict_mono)
huffman@19759
    50
apply (   erule spec)
huffman@19759
    51
apply (  assumption)
huffman@19759
    52
apply ( assumption)
huffman@19759
    53
apply (drule not_ex [THEN iffD1])
huffman@19759
    54
apply (subst slen_infinite)
huffman@19759
    55
apply (erule thin_rl)
haftmann@27101
    56
apply (erule_tac x = j in allE)
haftmann@27101
    57
apply auto
huffman@19759
    58
done
huffman@19759
    59
huffman@19759
    60
(* should be without reference to stream length? *)
wenzelm@26451
    61
lemma flatstream_admI: "[|(!!Y. [| Porder.chain Y; !i. P (Y i); 
huffman@27413
    62
 !k. ? j. Fin k < #((Y j)::'a::flat stream)|] ==> P(LUB i. Y i))|]==> adm P"
huffman@19759
    63
apply (unfold adm_def)
huffman@19759
    64
apply (intro strip)
huffman@19759
    65
apply (erule (1) flatstream_adm_lemma)
huffman@19759
    66
apply (fast)
huffman@19759
    67
done
huffman@19759
    68
huffman@19759
    69
huffman@19759
    70
(* context (theory "Nat_InFinity");*)
huffman@19759
    71
lemma ile_lemma: "Fin (i + j) <= x ==> Fin i <= x"
haftmann@27101
    72
  by (rule order_trans) auto
huffman@19759
    73
huffman@19759
    74
lemma stream_monoP2I:
huffman@19759
    75
"!!X. stream_monoP F ==> !i. ? l. !x y. 
huffman@19759
    76
  Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i"
huffman@19759
    77
apply (unfold stream_monoP_def)
huffman@19759
    78
apply (safe)
huffman@19759
    79
apply (rule_tac x="i*ia" in exI)
huffman@19759
    80
apply (induct_tac "ia")
huffman@19759
    81
apply ( simp)
huffman@19759
    82
apply (simp)
huffman@19759
    83
apply (intro strip)
huffman@19759
    84
apply (erule allE, erule all_dupE, drule mp, erule ile_lemma)
huffman@19759
    85
apply (drule_tac P="%x. x" in subst, assumption)
huffman@19759
    86
apply (erule allE, drule mp, rule ile_lemma) back
haftmann@27101
    87
apply ( erule order_trans)
huffman@19759
    88
apply ( erule slen_mono)
huffman@19759
    89
apply (erule ssubst)
huffman@19759
    90
apply (safe)
huffman@19759
    91
apply ( erule (2) ile_lemma [THEN slen_take_lemma3, THEN subst])
huffman@19759
    92
apply (erule allE)
huffman@19759
    93
apply (drule mp)
huffman@19759
    94
apply ( erule slen_rt_mult)
huffman@19759
    95
apply (erule allE)
huffman@19759
    96
apply (drule mp)
huffman@19759
    97
apply (erule monofun_rt_mult)
huffman@19759
    98
apply (drule (1) mp)
huffman@19759
    99
apply (assumption)
huffman@19759
   100
done
huffman@19759
   101
huffman@19759
   102
lemma stream_monoP2_gfp_admI: "[| !i. ? l. !x y. 
huffman@19759
   103
 Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i;
huffman@19759
   104
    down_cont F |] ==> adm (%x. x:gfp F)"
huffman@19759
   105
apply (erule INTER_down_iterate_is_gfp [THEN ssubst]) (* cont *)
huffman@19759
   106
apply (simp (no_asm))
huffman@19759
   107
apply (rule adm_lemmas)
huffman@19759
   108
apply (rule flatstream_admI)
huffman@19759
   109
apply (erule allE)
huffman@19759
   110
apply (erule exE)
huffman@19759
   111
apply (erule allE, erule exE)
huffman@19759
   112
apply (erule allE, erule allE, drule mp) (* stream_monoP *)
huffman@19759
   113
apply ( drule ileI1)
haftmann@27101
   114
apply ( drule order_trans)
huffman@19759
   115
apply (  rule ile_iSuc)
huffman@19759
   116
apply ( drule iSuc_ile_mono [THEN iffD1])
huffman@19759
   117
apply ( assumption)
huffman@19759
   118
apply (drule mp)
huffman@19759
   119
apply ( erule is_ub_thelub)
huffman@19759
   120
apply (fast)
huffman@19759
   121
done
huffman@19759
   122
huffman@19759
   123
lemmas fstream_gfp_admI = stream_monoP2I [THEN stream_monoP2_gfp_admI]
huffman@19759
   124
huffman@19759
   125
lemma stream_antiP2I:
huffman@19759
   126
"!!X. [|stream_antiP (F::(('a::flat stream)set => ('a stream set)))|]
huffman@19759
   127
  ==> !i x y. x << y --> y:down_iterate F i --> x:down_iterate F i"
huffman@19759
   128
apply (unfold stream_antiP_def)
huffman@19759
   129
apply (rule allI)
huffman@19759
   130
apply (induct_tac "i")
huffman@19759
   131
apply ( simp)
huffman@19759
   132
apply (simp)
huffman@19759
   133
apply (intro strip)
huffman@19759
   134
apply (erule allE, erule all_dupE, erule exE, erule exE)
huffman@19759
   135
apply (erule conjE)
huffman@19759
   136
apply (case_tac "#x < Fin i")
huffman@19759
   137
apply ( fast)
huffman@26102
   138
apply (unfold linorder_not_less)
huffman@19759
   139
apply (drule (1) mp)
huffman@19759
   140
apply (erule all_dupE, drule mp, rule refl_less)
huffman@19759
   141
apply (erule ssubst)
huffman@19759
   142
apply (erule allE, drule (1) mp)
huffman@19759
   143
apply (drule_tac P="%x. x" in subst, assumption)
huffman@19759
   144
apply (erule conjE, rule conjI)
huffman@19759
   145
apply ( erule slen_take_lemma3 [THEN ssubst], assumption)
huffman@19759
   146
apply ( assumption)
huffman@19759
   147
apply (erule allE, erule allE, drule mp, erule monofun_rt_mult)
huffman@19759
   148
apply (drule (1) mp)
huffman@19759
   149
apply (assumption)
huffman@19759
   150
done
huffman@19759
   151
huffman@19759
   152
lemma stream_antiP2_non_gfp_admI:
huffman@19759
   153
"!!X. [|!i x y. x << y --> y:down_iterate F i --> x:down_iterate F i; down_cont F |] 
huffman@19759
   154
  ==> adm (%u. ~ u:gfp F)"
huffman@19759
   155
apply (unfold adm_def)
huffman@19759
   156
apply (simp add: INTER_down_iterate_is_gfp)
huffman@19759
   157
apply (fast dest!: is_ub_thelub)
huffman@19759
   158
done
huffman@19759
   159
huffman@19759
   160
lemmas fstream_non_gfp_admI = stream_antiP2I [THEN stream_antiP2_non_gfp_admI]
huffman@19759
   161
huffman@19759
   162
huffman@19759
   163
huffman@19759
   164
(**new approach for adm********************************************************)
huffman@19759
   165
huffman@19759
   166
section "antitonP"
huffman@19759
   167
huffman@19759
   168
lemma antitonPD: "[| antitonP P; y:P; x<<y |] ==> x:P"
huffman@19759
   169
apply (unfold antitonP_def)
huffman@19759
   170
apply auto
huffman@19759
   171
done
huffman@19759
   172
huffman@19759
   173
lemma antitonPI: "!x y. y:P --> x<<y --> x:P ==> antitonP P"
huffman@19759
   174
apply (unfold antitonP_def)
huffman@19759
   175
apply (fast)
huffman@19759
   176
done
huffman@19759
   177
huffman@19759
   178
lemma antitonP_adm_non_P: "antitonP P ==> adm (%u. u~:P)"
huffman@19759
   179
apply (unfold adm_def)
huffman@19759
   180
apply (auto dest: antitonPD elim: is_ub_thelub)
huffman@19759
   181
done
huffman@19759
   182
huffman@19759
   183
lemma def_gfp_adm_nonP: "P \<equiv> gfp F \<Longrightarrow> {y. \<exists>x::'a::pcpo. y \<sqsubseteq> x \<and> x \<in> P} \<subseteq> F {y. \<exists>x. y \<sqsubseteq> x \<and> x \<in> P} \<Longrightarrow> 
huffman@19759
   184
  adm (\<lambda>u. u\<notin>P)"
huffman@19759
   185
apply (simp)
huffman@19759
   186
apply (rule antitonP_adm_non_P)
huffman@19759
   187
apply (rule antitonPI)
huffman@19759
   188
apply (drule gfp_upperbound)
huffman@19759
   189
apply (fast)
huffman@19759
   190
done
huffman@19759
   191
huffman@19759
   192
lemma adm_set:
huffman@27413
   193
"{\<Squnion>i. Y i |Y. Porder.chain Y & (\<forall>i. Y i \<in> P)} \<subseteq> P \<Longrightarrow> adm (\<lambda>x. x\<in>P)"
huffman@19759
   194
apply (unfold adm_def)
huffman@19759
   195
apply (fast)
huffman@19759
   196
done
huffman@19759
   197
huffman@27413
   198
lemma def_gfp_admI: "P \<equiv> gfp F \<Longrightarrow> {\<Squnion>i. Y i |Y. Porder.chain Y \<and> (\<forall>i. Y i \<in> P)} \<subseteq> 
huffman@27413
   199
  F {\<Squnion>i. Y i |Y. Porder.chain Y \<and> (\<forall>i. Y i \<in> P)} \<Longrightarrow> adm (\<lambda>x. x\<in>P)"
huffman@19759
   200
apply (simp)
huffman@19759
   201
apply (rule adm_set)
huffman@19759
   202
apply (erule gfp_upperbound)
huffman@19759
   203
done
huffman@19759
   204
oheimb@11350
   205
end