(* Title: HOL/HOLCF/ex/Loop.thy Author: Franz Regensburger
*)
section \<open>Theory for a loop primitive like while\<close>(* Title: HOL/HOLCF/ex/Loop.thyAuthor Franz Regensburger
theory Loop imports HOLCF begin
definition step :: "('a \<rightarrow> tr) \<rightarrow> ('a \<rightarrow> 'a) \<rightarrow> 'a \<rightarrow> 'a" where "step = (LAM b g x. If b\<cdot>x then g\<cdot>x else x)"
definition while :: "('a \<rightarrow> tr) \<rightarrow> ('a \<rightarrow> 'a) \<rightarrow> 'a \<rightarrow> 'a" where "while = (LAM b g. fix\<cdot>(LAM f x. If b\<cdot>x then f\<cdot>(g\<cdot>x) else x))"
lemmaapply java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
k apply simp ( transjava.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 18 apply simp apply (rulejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 apply(rule iterate
) apply apply loop_lemma3 (no_asm apply subst) apply(ule_tac"\java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 apply simpjava.lang.StringIndexOutOfBoundsException: Index 154 out of bounds for length 154 apply (subst( s "hile\b\g\(iterate (Suc 0)\(step\b\g)\x)" in trans) apply(rule_tac"UU" t = b apply (erule simp)) applyapply ( stripsimp applyapply( p = "b(iterate n\(step\b\g)\x)" in trE) apply simp apply (subst while_unfold) apply simp ( notE) done
while_unfold3: "hile\b\g\x = while\b\g\(step\b\g\x)" apply (rule_tac "\b\g\(iterate (Suc 0)\(step\b\g)\x)" in trans) applyapply (simp apply simpapply (rule_tac s = "iterate (Suc and t = "g\<cdot>(iterate n\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x)" in ssubst) donedone
(* ------------------------------------------------------------------------- *) trans (* properties of while and iterations *) (* ------------------------------------------------------------------------- *)(ubstapply simpapply (apply (simplesubstapply (introapplyapply (ruleappl
blast:)
<Longrightarrow(Suc(d) apply simpapply simpapply java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 applyapply (java.lang.StringIndexOutOfBoundsException: Range [16, 5) out of bounds for length 26 apply (rule step_def2java.lang.NullPointerException apply simp apply (erule exE) apply (erule flat_codom k)apply (blast intro: loop_lemma6) apply (* -------- done
lemma [rule_formatno_asm "apply erulen) \<exists>y. b\<cdot>y = FF; INV x\<rbrakk> \<Longrightarrow apply (induct_tac apply>(<forall>y. INV y \<and> b\<cdot>y = TT \<and> g\<cdot>y \<noteq> UU \<longrightarrow> INV (g\<cdot>y)); apply (introINV;while apply (simp() add:step_def2 applyapply( () del:s\<cdot
erule apply (simp: (simplesubstjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 apply (simp (no_asm_simpandpplyruleconjI applyrule(simp ) apply (erule ( (1)lemma3 apply ( (no_asm_simp: iterate_Suc: loop_lemma2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 and java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 prefer (ssumption apply (simp add apply (drule: done
lemma [rule_format
premI apply (induct_taci "Andy applyand:
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 apply (simplesubst while_unfoldulejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 applyjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
rule(strip
esubst( intro) apply ( intro )
y (ule apply (lemma [ (no_asm apply simp\<forall>k. b\<cdot>(iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x) \<noteq> FF \<Longrightarrow> done
lemma [ ()]: \forall>k.java.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101
apply (simplesubst) apply (rule fix_ind) apply simp apply simp apply (rule allI) applyapply( (no_asm)) apply (rule_tac p = "b\(iterate m\(step\b\g)\x)" in trE) apply (simpapply(rule_tacp ="b<>(iterate m\(step\b\g)\x)" in trE) apply (simp (no_asm_simp)) apply ( s = xa apply (erule_tac [2] spec>iterate mjava.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95 apply rule) apply (rule trans) apply(rule_tac] [symmetric apply (simp [2 [symmetric apply done
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 4 apply( t x iterate_0 subst apply (erule loop_lemma5apply ( loop_lemma5) done
(* ------------------------------------------------------------------------- *) (* an invariant rule for loops *) (* ------------------------------------------------------------------------- *)
lemma loop_inv2: "\(\y. INV y \ b\y = TT \ g\y \ UU \ INV (g\y));
(\<forall>y. INV y \<and> b\<cdot>y = FF \<longrightarrow> Q y);
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 apply( P= \lambda> java.lang.StringIndexOutOfBoundsException: Index 103 out of bounds for length 103 apply ( loop_lemma7 apply (simplesubst loop_lemma4) apply apply(drule, erule mp apply( conjI prefer2applyassumption apply (rule) apply assumption apply (blast introloop_lemma6) apply assumption apply (rotate_tac -1) apply (simp add: loop_lemma4) done
lemma:
premP"Px)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 and: " and premTT ( -)
premFF"\y. \INV y; b\y = FF\ \ Q y" and premW: "while\b\g\x \ UU"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 apply(rule) apply d premI: "\y. P y \ INV y" apply (rule_tac [3] premW nd: "y. \INV y; b\y = TT; g\y \ UU\ \ INV (g\y)" apply ( while apply rule) done rule_tac] [THENpremI
end
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.