src/HOLCF/Adm.thy
author huffman
Thu May 26 00:30:24 2005 +0200 (2005-05-26)
changeset 16079 757e1c4a8081
parent 16070 4a83dd540b88
child 16207 d67baef02f78
permissions -rw-r--r--
moved adm_chfindom from Adm.thy to Fix.thy, to remove dependence on Cfun
huffman@16056
     1
(*  Title:      HOLCF/Adm.thy
huffman@16056
     2
    ID:         $Id$
huffman@16056
     3
    Author:     Franz Regensburger
huffman@16056
     4
*)
huffman@16056
     5
huffman@16056
     6
header {* Admissibility *}
huffman@16056
     7
huffman@16056
     8
theory Adm
huffman@16079
     9
imports Cont
huffman@16056
    10
begin
huffman@16056
    11
huffman@16056
    12
defaultsort cpo
huffman@16056
    13
huffman@16056
    14
subsection {* Definitions *}
huffman@16056
    15
huffman@16056
    16
consts
huffman@16056
    17
adm		:: "('a::cpo=>bool)=>bool"
huffman@16056
    18
huffman@16056
    19
defs
huffman@16056
    20
adm_def:       "adm P == !Y. chain(Y) --> 
huffman@16056
    21
                        (!i. P(Y i)) --> P(lub(range Y))"
huffman@16056
    22
huffman@16056
    23
subsection {* Admissibility and fixed point induction *}
huffman@16056
    24
huffman@16056
    25
text {* access to definitions *}
huffman@16056
    26
huffman@16056
    27
lemma admI:
huffman@16056
    28
   "(!!Y. [| chain Y; !i. P (Y i) |] ==> P (lub (range Y))) ==> adm P"
huffman@16056
    29
apply (unfold adm_def)
huffman@16056
    30
apply blast
huffman@16056
    31
done
huffman@16056
    32
huffman@16056
    33
lemma triv_admI: "!x. P x ==> adm P"
huffman@16056
    34
apply (rule admI)
huffman@16056
    35
apply (erule spec)
huffman@16056
    36
done
huffman@16056
    37
huffman@16056
    38
lemma admD: "[| adm(P); chain(Y); !i. P(Y(i)) |] ==> P(lub(range(Y)))"
huffman@16056
    39
apply (unfold adm_def)
huffman@16056
    40
apply blast
huffman@16056
    41
done
huffman@16056
    42
huffman@16056
    43
text {* for chain-finite (easy) types every formula is admissible *}
huffman@16056
    44
huffman@16056
    45
lemma adm_max_in_chain: 
huffman@16056
    46
"!Y. chain(Y::nat=>'a) --> (? n. max_in_chain n Y) ==> adm(P::'a=>bool)"
huffman@16056
    47
apply (unfold adm_def)
huffman@16056
    48
apply (intro strip)
huffman@16056
    49
apply (rule exE)
huffman@16056
    50
apply (rule mp)
huffman@16056
    51
apply (erule spec)
huffman@16056
    52
apply assumption
huffman@16056
    53
apply (subst lub_finch1 [THEN thelubI])
huffman@16056
    54
apply assumption
huffman@16056
    55
apply assumption
huffman@16056
    56
apply (erule spec)
huffman@16056
    57
done
huffman@16056
    58
huffman@16056
    59
lemmas adm_chfin = chfin [THEN adm_max_in_chain, standard]
huffman@16056
    60
huffman@16056
    61
text {* improved admissibility introduction *}
huffman@16056
    62
huffman@16056
    63
lemma admI2:
huffman@16056
    64
 "(!!Y. [| chain Y; !i. P (Y i); !i. ? j. i < j & Y i ~= Y j & Y i << Y j |] 
huffman@16056
    65
  ==> P(lub (range Y))) ==> adm P"
huffman@16056
    66
apply (unfold adm_def)
huffman@16056
    67
apply (intro strip)
huffman@16056
    68
apply (erule increasing_chain_adm_lemma)
huffman@16056
    69
apply assumption
huffman@16056
    70
apply fast
huffman@16056
    71
done
huffman@16056
    72
huffman@16056
    73
text {* admissibility of special formulae and propagation *}
huffman@16056
    74
huffman@16056
    75
lemma adm_less [simp]: "[|cont u;cont v|]==> adm(%x. u x << v x)"
huffman@16056
    76
apply (unfold adm_def)
huffman@16056
    77
apply (intro strip)
huffman@16056
    78
apply (frule_tac f = "u" in cont2mono [THEN ch2ch_monofun])
huffman@16056
    79
apply assumption
huffman@16056
    80
apply (frule_tac f = "v" in cont2mono [THEN ch2ch_monofun])
huffman@16056
    81
apply assumption
huffman@16056
    82
apply (erule cont2contlub [THEN contlubE, THEN spec, THEN mp, THEN ssubst])
huffman@16056
    83
apply assumption
huffman@16056
    84
apply (erule cont2contlub [THEN contlubE, THEN spec, THEN mp, THEN ssubst])
huffman@16056
    85
apply assumption
huffman@16056
    86
apply (blast intro: lub_mono)
huffman@16056
    87
done
huffman@16056
    88
huffman@16056
    89
lemma adm_conj [simp]: "[| adm P; adm Q |] ==> adm(%x. P x & Q x)"
huffman@16056
    90
by (fast elim: admD intro: admI)
huffman@16056
    91
huffman@16056
    92
lemma adm_not_free [simp]: "adm(%x. t)"
huffman@16056
    93
apply (unfold adm_def)
huffman@16056
    94
apply fast
huffman@16056
    95
done
huffman@16056
    96
huffman@16056
    97
lemma adm_not_less: "cont t ==> adm(%x.~ (t x) << u)"
huffman@16056
    98
apply (unfold adm_def)
huffman@16056
    99
apply (intro strip)
huffman@16056
   100
apply (rule contrapos_nn)
huffman@16056
   101
apply (erule spec)
huffman@16056
   102
apply (rule trans_less)
huffman@16056
   103
prefer 2 apply (assumption)
huffman@16056
   104
apply (erule cont2mono [THEN monofun_fun_arg])
huffman@16056
   105
apply (rule is_ub_thelub)
huffman@16056
   106
apply assumption
huffman@16056
   107
done
huffman@16056
   108
huffman@16056
   109
lemma adm_all: "!y. adm(P y) ==> adm(%x.!y. P y x)"
huffman@16056
   110
by (fast intro: admI elim: admD)
huffman@16056
   111
huffman@16056
   112
lemmas adm_all2 = allI [THEN adm_all, standard]
huffman@16056
   113
huffman@16056
   114
lemma adm_subst: "[|cont t; adm P|] ==> adm(%x. P (t x))"
huffman@16056
   115
apply (rule admI)
huffman@16056
   116
apply (simplesubst cont2contlub [THEN contlubE, THEN spec, THEN mp])
huffman@16056
   117
apply assumption
huffman@16056
   118
apply assumption
huffman@16056
   119
apply (erule admD)
huffman@16056
   120
apply (erule cont2mono [THEN ch2ch_monofun])
huffman@16056
   121
apply assumption
huffman@16056
   122
apply assumption
huffman@16056
   123
done
huffman@16056
   124
huffman@16056
   125
lemma adm_UU_not_less: "adm(%x.~ UU << t(x))"
huffman@16056
   126
by simp
huffman@16056
   127
huffman@16056
   128
lemma adm_not_UU: "cont(t)==> adm(%x.~ (t x) = UU)"
huffman@16056
   129
apply (unfold adm_def)
huffman@16056
   130
apply (intro strip)
huffman@16056
   131
apply (rule contrapos_nn)
huffman@16056
   132
apply (erule spec)
huffman@16056
   133
apply (rule chain_UU_I [THEN spec])
huffman@16056
   134
apply (erule cont2mono [THEN ch2ch_monofun])
huffman@16056
   135
apply assumption
huffman@16056
   136
apply (erule cont2contlub [THEN contlubE, THEN spec, THEN mp, THEN subst])
huffman@16056
   137
apply assumption
huffman@16056
   138
apply assumption
huffman@16056
   139
done
huffman@16056
   140
huffman@16056
   141
lemma adm_eq: "[|cont u ; cont v|]==> adm(%x. u x = v x)"
huffman@16056
   142
by (simp add: po_eq_conv)
huffman@16056
   143
huffman@16056
   144
text {* admissibility for disjunction is hard to prove. It takes 7 Lemmas *}
huffman@16056
   145
huffman@16056
   146
lemma adm_disj_lemma1:
huffman@16056
   147
  "\<forall>n::nat. P n \<or> Q n \<Longrightarrow> (\<forall>i. \<exists>j\<ge>i. P j) \<or> (\<forall>i. \<exists>j\<ge>i. Q j)"
huffman@16056
   148
apply (erule contrapos_pp)
huffman@16056
   149
apply clarsimp
huffman@16056
   150
apply (rule exI)
huffman@16056
   151
apply (rule conjI)
huffman@16056
   152
apply (drule spec, erule mp)
huffman@16056
   153
apply (rule le_maxI1)
huffman@16056
   154
apply (drule spec, erule mp)
huffman@16056
   155
apply (rule le_maxI2)
huffman@16056
   156
done
huffman@16056
   157
huffman@16056
   158
lemma adm_disj_lemma2: "[| adm P; \<exists>X. chain X & (!n. P(X n)) & 
huffman@16056
   159
      lub(range Y)=lub(range X)|] ==> P(lub(range Y))"
huffman@16056
   160
by (force elim: admD)
huffman@16056
   161
huffman@16056
   162
lemma adm_disj_lemma3: 
huffman@16056
   163
  "[| chain(Y::nat=>'a::cpo); \<forall>i. \<exists>j\<ge>i. P (Y j) |] ==> 
huffman@16056
   164
            chain(%m. Y (LEAST j. m\<le>j \<and> P(Y j)))"
huffman@16056
   165
apply (rule chainI)
huffman@16056
   166
apply (erule chain_mono3)
huffman@16056
   167
apply (rule Least_le)
huffman@16056
   168
apply (rule conjI)
huffman@16056
   169
apply (rule Suc_leD)
huffman@16056
   170
apply (erule allE)
huffman@16056
   171
apply (erule exE)
huffman@16056
   172
apply (erule LeastI [THEN conjunct1])
huffman@16056
   173
apply (erule allE)
huffman@16056
   174
apply (erule exE)
huffman@16056
   175
apply (erule LeastI [THEN conjunct2])
huffman@16056
   176
done
huffman@16056
   177
huffman@16056
   178
lemma adm_disj_lemma4: 
huffman@16056
   179
  "[| \<forall>i. \<exists>j\<ge>i. P (Y j) |] ==> ! m. P(Y(LEAST j::nat. m\<le>j & P(Y j)))"
huffman@16056
   180
apply (rule allI)
huffman@16056
   181
apply (erule allE)
huffman@16056
   182
apply (erule exE)
huffman@16056
   183
apply (erule LeastI [THEN conjunct2])
huffman@16056
   184
done
huffman@16056
   185
huffman@16056
   186
lemma adm_disj_lemma5: 
huffman@16056
   187
  "[| chain(Y::nat=>'a::cpo); \<forall>i. \<exists>j\<ge>i. P(Y j) |] ==> 
huffman@16056
   188
            lub(range(Y)) = (LUB m. Y(LEAST j. m\<le>j & P(Y j)))"
huffman@16056
   189
 apply (rule antisym_less)
huffman@16056
   190
  apply (rule lub_mono)
huffman@16056
   191
    apply assumption
huffman@16056
   192
   apply (erule adm_disj_lemma3)
huffman@16056
   193
   apply assumption
huffman@16056
   194
  apply (rule allI)
huffman@16056
   195
  apply (erule chain_mono3)
huffman@16056
   196
  apply (erule allE)
huffman@16056
   197
  apply (erule exE)
huffman@16056
   198
  apply (erule LeastI [THEN conjunct1])
huffman@16056
   199
 apply (rule lub_mono3)
huffman@16056
   200
   apply (erule adm_disj_lemma3)
huffman@16056
   201
   apply assumption
huffman@16056
   202
  apply assumption
huffman@16056
   203
 apply (rule allI)
huffman@16056
   204
 apply (rule exI)
huffman@16056
   205
 apply (rule refl_less)
huffman@16056
   206
done
huffman@16056
   207
huffman@16056
   208
lemma adm_disj_lemma6:
huffman@16056
   209
  "[| chain(Y::nat=>'a::cpo); \<forall>i. \<exists>j\<ge>i. P(Y j) |] ==> 
huffman@16056
   210
            \<exists>X. chain X & (\<forall>n. P(X n)) & lub(range Y) = lub(range X)"
huffman@16056
   211
apply (rule_tac x = "%m. Y (LEAST j. m\<le>j & P (Y j))" in exI)
huffman@16056
   212
apply (fast intro!: adm_disj_lemma3 adm_disj_lemma4 adm_disj_lemma5)
huffman@16056
   213
done
huffman@16056
   214
huffman@16056
   215
lemma adm_disj_lemma7:
huffman@16056
   216
"[| adm(P); chain(Y); \<forall>i. \<exists>j\<ge>i. P(Y j) |]==>P(lub(range(Y)))"
huffman@16056
   217
apply (erule adm_disj_lemma2)
huffman@16056
   218
apply (erule adm_disj_lemma6)
huffman@16056
   219
apply assumption
huffman@16056
   220
done
huffman@16056
   221
huffman@16056
   222
lemma adm_disj: "[| adm P; adm Q |] ==> adm(%x. P x | Q x)"
huffman@16056
   223
apply (rule admI)
huffman@16056
   224
apply (erule adm_disj_lemma1 [THEN disjE])
huffman@16056
   225
apply (rule disjI1)
huffman@16056
   226
apply (erule adm_disj_lemma7)
huffman@16056
   227
apply assumption
huffman@16056
   228
apply assumption
huffman@16056
   229
apply (rule disjI2)
huffman@16056
   230
apply (erule adm_disj_lemma7)
huffman@16056
   231
apply assumption
huffman@16056
   232
apply assumption
huffman@16056
   233
done
huffman@16056
   234
huffman@16056
   235
lemma adm_imp: "[| adm(%x.~(P x)); adm Q |] ==> adm(%x. P x --> Q x)"
huffman@16056
   236
by (subst imp_conv_disj, rule adm_disj)
huffman@16056
   237
huffman@16056
   238
lemma adm_iff: "[| adm (%x. P x --> Q x); adm (%x. Q x --> P x) |]  
huffman@16056
   239
            ==> adm (%x. P x = Q x)"
huffman@16056
   240
by (subst iff_conv_conj_imp, rule adm_conj)
huffman@16056
   241
huffman@16056
   242
lemma adm_not_conj: "[| adm (%x. ~ P x); adm (%x. ~ Q x) |] ==> adm (%x. ~ (P x & Q x))"
huffman@16056
   243
by (subst de_Morgan_conj, rule adm_disj)
huffman@16056
   244
huffman@16056
   245
lemmas adm_lemmas = adm_not_free adm_imp adm_disj adm_eq adm_not_UU
huffman@16056
   246
        adm_UU_not_less adm_all2 adm_not_less adm_not_conj adm_iff
huffman@16056
   247
huffman@16056
   248
declare adm_lemmas [simp]
huffman@16056
   249
paulson@16062
   250
(* legacy ML bindings *)
paulson@16062
   251
ML
paulson@16062
   252
{*
paulson@16062
   253
val adm_def = thm "adm_def";
paulson@16062
   254
val admI = thm "admI";
paulson@16062
   255
val triv_admI = thm "triv_admI";
paulson@16062
   256
val admD = thm "admD";
paulson@16062
   257
val adm_max_in_chain = thm "adm_max_in_chain";
paulson@16062
   258
val adm_chfin = thm "adm_chfin";
paulson@16062
   259
val admI2 = thm "admI2";
paulson@16062
   260
val adm_less = thm "adm_less";
paulson@16062
   261
val adm_conj = thm "adm_conj";
paulson@16062
   262
val adm_not_free = thm "adm_not_free";
paulson@16062
   263
val adm_not_less = thm "adm_not_less";
paulson@16062
   264
val adm_all = thm "adm_all";
paulson@16062
   265
val adm_all2 = thm "adm_all2";
paulson@16062
   266
val adm_subst = thm "adm_subst";
paulson@16062
   267
val adm_UU_not_less = thm "adm_UU_not_less";
paulson@16062
   268
val adm_not_UU = thm "adm_not_UU";
paulson@16062
   269
val adm_eq = thm "adm_eq";
paulson@16062
   270
val adm_disj_lemma1 = thm "adm_disj_lemma1";
paulson@16062
   271
val adm_disj_lemma2 = thm "adm_disj_lemma2";
paulson@16062
   272
val adm_disj_lemma3 = thm "adm_disj_lemma3";
paulson@16062
   273
val adm_disj_lemma4 = thm "adm_disj_lemma4";
paulson@16062
   274
val adm_disj_lemma5 = thm "adm_disj_lemma5";
paulson@16062
   275
val adm_disj_lemma6 = thm "adm_disj_lemma6";
paulson@16062
   276
val adm_disj_lemma7 = thm "adm_disj_lemma7";
paulson@16062
   277
val adm_disj = thm "adm_disj";
paulson@16062
   278
val adm_imp = thm "adm_imp";
paulson@16062
   279
val adm_iff = thm "adm_iff";
paulson@16062
   280
val adm_not_conj = thm "adm_not_conj";
paulson@16062
   281
val adm_lemmas = [adm_not_free, adm_imp, adm_disj, adm_eq, adm_not_UU,
paulson@16062
   282
        adm_UU_not_less, adm_all2, adm_not_less, adm_not_conj, adm_iff]
paulson@16062
   283
*}
paulson@16062
   284
huffman@16056
   285
end
huffman@16056
   286