src/HOLCF/FOCUS/Stream_adm.ML
author oheimb
Tue Sep 07 16:02:42 2004 +0200 (2004-09-07)
changeset 15188 9d57263faf9e
parent 14981 e73f8140af78
child 17293 ecf182ccc3ca
permissions -rw-r--r--
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb@11350
     1
(*  Title: 	HOLCF/ex/Stream_adm.ML
wenzelm@11355
     2
    ID:         $Id$
oheimb@11350
     3
    Author: 	David von Oheimb, TU Muenchen
oheimb@11350
     4
*)
oheimb@11350
     5
oheimb@11350
     6
(* ----------------------------------------------------------------------- *)
oheimb@11350
     7
oheimb@11350
     8
val down_cont_def = thm "down_cont_def";
oheimb@11350
     9
val INTER_down_iterate_is_gfp = thm "INTER_down_iterate_is_gfp";
oheimb@11350
    10
oheimb@11350
    11
section "admissibility";
oheimb@11350
    12
oheimb@11350
    13
Goal "[| chain Y; !i. P (Y i);\
oheimb@11350
    14
\(!!Y. [| chain Y; !i. P (Y i); !k. ? j. Fin k < #((Y j)::'a::flat stream)|]\
oheimb@11350
    15
\ ==> P(lub (range Y))) |] ==> P(lub (range Y))";
oheimb@11350
    16
by (cut_facts_tac (premises()) 1);
oheimb@11350
    17
by (eatac increasing_chain_adm_lemma 1 1);
oheimb@11350
    18
by (etac thin_rl 1);
oheimb@11350
    19
by (EVERY'[eresolve_tac (premises()), atac, etac thin_rl] 1);
oheimb@11350
    20
by (rtac allI 1);
oheimb@11350
    21
by (case_tac "!j. stream_finite (Y j)" 1);
wenzelm@11355
    22
by ( rtac (thm "chain_incr") 1);
oheimb@11350
    23
by ( rtac allI 1);
oheimb@11350
    24
by ( dtac spec 1);
oheimb@11350
    25
by ( Safe_tac);
oheimb@11350
    26
by ( rtac exI 1);
oheimb@15188
    27
by ( rtac (thm "slen_strict_mono") 1);
oheimb@11350
    28
by (   etac spec 1);
oheimb@11350
    29
by (  atac 1);
oheimb@11350
    30
by ( atac 1);
oheimb@11350
    31
by (dtac (not_ex RS iffD1) 1);
oheimb@15188
    32
by (stac (thm "slen_infinite") 1);
oheimb@11350
    33
by (etac thin_rl 1);
oheimb@11350
    34
by (dtac spec 1);
wenzelm@11355
    35
by (fold_goals_tac [thm "ile_def"]);
wenzelm@11355
    36
by (etac (thm "ile_iless_trans" RS (thm "Infty_eq" RS iffD1)) 1);
oheimb@11350
    37
by (Simp_tac 1);
oheimb@11350
    38
qed "flatstream_adm_lemma";
oheimb@11350
    39
oheimb@11350
    40
oheimb@11350
    41
(* should be without reference to stream length? *)
oheimb@11350
    42
Goalw [adm_def] "[|(!!Y. [| chain Y; !i. P (Y i); \
oheimb@11350
    43
\!k. ? j. Fin k < #((Y j)::'a::flat stream)|] ==> P(lub (range Y)))|]==> adm P";
oheimb@11350
    44
by (strip_tac 1);
oheimb@11350
    45
by (eatac flatstream_adm_lemma 1 1);
oheimb@11350
    46
by (EVERY'[eresolve_tac (premises()), atac, atac] 1);
oheimb@11350
    47
qed "flatstream_admI";
oheimb@11350
    48
oheimb@11350
    49
oheimb@11350
    50
(* context (theory "Nat_InFinity");*)
oheimb@11350
    51
Goal "Fin (i + j) <= x ==> Fin i <= x";
wenzelm@11355
    52
by (rtac (thm "ile_trans") 1);
oheimb@11350
    53
by  (atac 2);
oheimb@11350
    54
by (Simp_tac 1);
oheimb@11350
    55
qed "ile_lemma";
oheimb@11350
    56
oheimb@11350
    57
Goalw [stream_monoP_def]
oheimb@11350
    58
"!!X. stream_monoP F ==> !i. ? l. !x y. \
oheimb@11350
    59
\ Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i";
oheimb@11350
    60
by (safe_tac HOL_cs);
oheimb@11350
    61
by (res_inst_tac [("x","i*ia")] exI 1);
berghofe@13454
    62
by (induct_tac "ia" 1);
oheimb@11350
    63
by ( Simp_tac 1);
oheimb@11350
    64
by (Simp_tac 1);
oheimb@11350
    65
by (strip_tac 1);
oheimb@11350
    66
by (etac allE 1 THEN etac all_dupE 1 THEN dtac mp 1 THEN etac ile_lemma 1);
oheimb@11350
    67
by (dres_inst_tac [("P","%x. x")] subst 1 THEN atac 1);
oheimb@11350
    68
by (etac allE 1 THEN dtac mp 1 THEN rtac ile_lemma 1);
wenzelm@11355
    69
by ( etac (thm "ile_trans") 1);
oheimb@15188
    70
by ( etac (thm "slen_mono") 1);
oheimb@11350
    71
by (etac ssubst 1);
oheimb@11350
    72
by (safe_tac HOL_cs);
oheimb@15188
    73
by ( eatac (ile_lemma RS thm "slen_take_lemma3" RS subst) 2 1);
oheimb@11350
    74
by (etac allE 1);
oheimb@11350
    75
by (etac allE 1);
oheimb@11350
    76
by (dtac mp 1);
oheimb@15188
    77
by ( etac (thm "slen_rt_mult") 1);
oheimb@11350
    78
by (dtac mp 1);
oheimb@15188
    79
by (etac (thm "monofun_rt_mult") 1);
oheimb@11350
    80
by (mp_tac 1); 
oheimb@11350
    81
by (atac 1);
oheimb@11350
    82
qed "stream_monoP2I";
oheimb@11350
    83
oheimb@11350
    84
Goal "[| !i. ? l. !x y. \
oheimb@11350
    85
\Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i;\
oheimb@11350
    86
\   down_cont F |] ==> adm (%x. x:gfp F)";
oheimb@11350
    87
byev[	etac (INTER_down_iterate_is_gfp RS ssubst) 1, (* cont *)
oheimb@11350
    88
	Simp_tac 1,
oheimb@11350
    89
	resolve_tac adm_lemmas 1,
oheimb@11350
    90
	rtac flatstream_admI 1,
oheimb@11350
    91
	etac allE 1,
oheimb@11350
    92
	etac exE 1,
oheimb@11350
    93
	etac allE 1 THEN etac exE 1,
oheimb@11350
    94
	etac allE 1 THEN etac allE 1 THEN dtac mp 1, (* stream_monoP *)
wenzelm@11355
    95
	 dtac (thm "ileI1") 1,
wenzelm@11355
    96
	 dtac (thm "ile_trans") 1,
wenzelm@11355
    97
	  rtac (thm "ile_iSuc") 1,
wenzelm@11355
    98
	 dtac (thm "iSuc_ile_mono" RS iffD1) 1,
oheimb@11350
    99
	 atac 1,
oheimb@11350
   100
	dtac mp 1,
oheimb@11350
   101
	 etac is_ub_thelub 1,
oheimb@11350
   102
	Fast_tac 1];
oheimb@11350
   103
qed "stream_monoP2_gfp_admI";
oheimb@11350
   104
oheimb@11350
   105
bind_thm("fstream_gfp_admI",stream_monoP2I RS stream_monoP2_gfp_admI);
oheimb@11350
   106
oheimb@11350
   107
qed_goalw "stream_antiP2I" thy [stream_antiP_def]
oheimb@11350
   108
"!!X. [|stream_antiP (F::(('a::flat stream)set => ('a stream set)))|]\
oheimb@11350
   109
\ ==> !i x y. x << y --> y:down_iterate F i --> x:down_iterate F i" (K [
oheimb@11350
   110
	rtac allI 1,
berghofe@13454
   111
	induct_tac "i" 1,
oheimb@11350
   112
	 Simp_tac 1,
oheimb@11350
   113
	Simp_tac 1,
oheimb@11350
   114
	strip_tac 1,
oheimb@11350
   115
	etac allE 1 THEN etac all_dupE 1 THEN etac exE 1 THEN etac exE 1,
oheimb@11350
   116
	etac conjE 1,
berghofe@13454
   117
	case_tac "#x < Fin i" 1,
oheimb@11350
   118
	 fast_tac HOL_cs 1,
wenzelm@11355
   119
	fold_goals_tac [thm "ile_def"],
oheimb@11350
   120
	mp_tac 1,
oheimb@11350
   121
	etac all_dupE 1 THEN dtac mp 1 THEN rtac refl_less 1,
oheimb@11350
   122
	etac ssubst 1,
oheimb@11350
   123
        etac allE 1 THEN mp_tac 1,
oheimb@11350
   124
	dres_inst_tac [("P","%x. x")] subst 1 THEN atac 1,
oheimb@11350
   125
	etac conjE 1 THEN rtac conjI 1,
oheimb@15188
   126
	 etac (thm "slen_take_lemma3" RS ssubst) 1 THEN atac 1,
oheimb@11350
   127
	 atac 1,
oheimb@15188
   128
	etac allE 1 THEN etac allE 1 THEN dtac mp 1 THEN etac (thm "monofun_rt_mult") 1,
oheimb@11350
   129
	mp_tac 1,
oheimb@11350
   130
	atac 1]);
oheimb@11350
   131
oheimb@11350
   132
qed_goalw "stream_antiP2_non_gfp_admI" thy [adm_def]
oheimb@11350
   133
"!!X. [|!i x y. x << y --> y:down_iterate F i --> x:down_iterate F i; down_cont F |] \
oheimb@11350
   134
\ ==> adm (%u. ~ u:gfp F)" (K [
oheimb@11350
   135
	asm_simp_tac (simpset() addsimps [INTER_down_iterate_is_gfp]) 1,
oheimb@11350
   136
	fast_tac (claset() addSDs [is_ub_thelub]) 1]);
oheimb@11350
   137
oheimb@11350
   138
bind_thm ("fstream_non_gfp_admI", stream_antiP2I RS 
oheimb@11350
   139
				stream_antiP2_non_gfp_admI);
oheimb@11350
   140
oheimb@11350
   141
oheimb@11350
   142
oheimb@11350
   143
(**new approach for adm********************************************************)
oheimb@11350
   144
oheimb@11350
   145
section "antitonP";
oheimb@11350
   146
oheimb@11350
   147
Goalw [antitonP_def] "[| antitonP P; y:P; x<<y |] ==> x:P";
oheimb@11350
   148
by Auto_tac;
oheimb@11350
   149
qed "antitonPD";
oheimb@11350
   150
oheimb@11350
   151
Goalw [antitonP_def]"!x y. y:P --> x<<y --> x:P ==> antitonP P";
oheimb@11350
   152
by (Fast_tac 1);
oheimb@11350
   153
qed "antitonPI";
oheimb@11350
   154
oheimb@11350
   155
Goalw [adm_def] "antitonP P ==> adm (%u. u~:P)";
oheimb@11350
   156
by (auto_tac (claset() addDs [antitonPD] addEs [is_ub_thelub],simpset()));
oheimb@11350
   157
qed "antitonP_adm_non_P";
oheimb@11350
   158
oheimb@11350
   159
Goal "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> \
oheimb@11350
   160
\ adm (\\<lambda>u. u\\<notin>P)";
oheimb@11350
   161
by (Asm_full_simp_tac 1);
oheimb@11350
   162
by (rtac antitonP_adm_non_P 1);
oheimb@11350
   163
by (rtac antitonPI 1);
oheimb@11350
   164
by (dtac gfp_upperbound 1);
oheimb@11350
   165
by (Fast_tac 1);
oheimb@11350
   166
qed "def_gfp_adm_nonP";
oheimb@11350
   167
oheimb@11350
   168
Goalw [adm_def] 
oheimb@11350
   169
"{lub (range Y) |Y. chain Y & (\\<forall>i. Y i \\<in> P)} \\<subseteq> P \\<Longrightarrow> adm (\\<lambda>x. x\\<in>P)";
oheimb@11350
   170
by (Fast_tac 1);
oheimb@11350
   171
qed "adm_set";
oheimb@11350
   172
oheimb@11350
   173
Goal "P \\<equiv> gfp F \\<Longrightarrow> {lub (range Y) |Y. chain Y \\<and> (\\<forall>i. Y i \\<in> P)} \\<subseteq> \
oheimb@11350
   174
\ F {lub (range Y) |Y. chain Y \\<and> (\\<forall>i. Y i \\<in> P)} \\<Longrightarrow> adm (\\<lambda>x. x\\<in>P)";
oheimb@11350
   175
by (Asm_full_simp_tac 1);
oheimb@11350
   176
by (rtac adm_set 1);
oheimb@11350
   177
by (etac gfp_upperbound 1);
oheimb@11350
   178
qed "def_gfp_admI";