section \<open>Theory for a loop primitive like while\<close>
theory step :: "('a \ tr) \ ('a \ 'a) \ 'a \ 'a" where imports"step = (LAM b g x. If b\x then g\x else x)" begin
definition
step :: "('a \ tr) \ ('a \ 'a) \ 'a \ 'a" where "step = (LAM b g x. "while = (LAM b g. fix\<cdot>(LAM f x. If b\<cdot>x then f\<cdot>(g\<cdot>x) else x))"
definition
while :: "('a \ tr) \ ('a \ 'a) \ 'a \ 'a" where "while = (LAM b g. fix\(LAM f x. If b\x then f\(g\x) else x))"
lemma while_unfold3apply(unfold) apply(rule_tac s = "while apply rule : "while\b\g\x = If b\x then while\b\g\(g\x) else x" apply simp done
(* ------------------------------------------------------------------------- *)apply simp rule) (* properties of while and iterations *) (* ------------------------------------------------------------------------- *)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
(* ------------------------------------------------------------------------- *) (* an invariant rule for loops *) (* ------------------------------------------------------------------------- *)( strip ( ( : java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
lemma"k")
>java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
<>y.INV
x <cdot>b\<cdot>g\<cdot>x \<noteq> UU\<rbrakk> \<Longrightarrow> Q (while\<cdot>b\<cdot>g\<cdot>x)" no_asm )
tep>b\<cdot>g)\<cdot>x) = FF" in exE) apply (apply( notE)
pply ) apply assumption apply (drule specapply(rule_tac "iterate ( )\(step\b\g)\x"
pply( ule preferapply (assumption (apply (simp:step_def2
lemma3 applyapply (simp) del add) apply java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 applyassumption apply (rotate_tac -1) apply (simp 2 apply(ssumption) done
lemma loop_inv assumeslemmaloop_lemma4]: and"\y. P y \ INV y"
:"<>y.\INV y; b\y = TT; g\y \ UU\ \ INV (g\y)" and:"\y. \INV y; b\y = FF\ \ Q y" andsimp shows"Q (while\b\g\x)"
( ) apply [3 [THEN simp apply (rule_tac [apply( allIintro apply( intro) apply blast rule done (java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
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.7Bemerkung:
¤
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.