Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek Loop.thy   Sprache: Isabelle

 

    :
*)

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))"

(* ------------------------------------------------------------------------- *)
(* access to definitions                                                     *)
(* ------------------------------------------------------------------------- *)


theoryLoop HOLCF
apply (unfold step_def)
apply simp
done

lemma while_def2: "while\b\g = fix\(LAM f x. If b\x then f\(g\x) else x)"
apply (unfold while_def)
apply simp
done


(* ------------------------------------------------------------------------- *)
(* rekursive properties of while                                             *)
(* ------------------------------------------------------------------------- *)

lemma while_unfold: "while\b\g\x = If b\x then while\b\g\(g\x) else x"
apply (rule trans)
apply (rule while_def2 [THEN fix_eq5])
apply simp
done

lemma while_unfold2: "\x. while\b\g\x = while\b\g\(iterate k\(step\b\g)\x)"
apply (induct_tac
java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
apply (rule allI)
apply (rule trans)

apply (subst iterate_Suc2)
apply (rule trans
 erule_tac []spec
apply ( (unfold step_def
apply ( p ="b\x" in trE)
apply : "\b fix<>LAMfx.I \cdotx f\(g\x) else x)"
apply (subst while_unfold(unfold)
 simp
apply
apply simp
apply simp

apply (subst while_unfold
apply simp
done

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

 : "<>>y. b\y = FF; iterate k\(step\b\g)\x = UU\
     \<Longrightarrow> iterate(Suc k)\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x = UU"
( while_unfold( s="UU t = b
applyrule)
apply rule)
apply simp
 simp
apply simp
apply simp_all
done

lemma loop_lemma2: "\\y. b\y = FF; iterate (Suc k)\(step\b\g)\x \ UU\ \
      iterate
applyblast


lemma [rule_format)]:
( step_def2 ( p = b<cdot>x" in trE)
b\<cdot>y = FF; INV x\<rbrakk>
      <Longrightarrow> iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x \<noteq> UU \<longrightarrow> INV (iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x)"
apply  s = "UU"and"\UU" in ssubst)
( (no_asm_simp
applyintrosimp

 rule_tacjava.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
applyerule
applydone
applywhile_unfold3"
apply (rule s=while

apply (simp (no_asm_simp) del: iterate_Suc add: loop_lemma2)
apply (rule_tac s = "iterate (Suc n)\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x"
  and t = "g\<cdot>(iterate n\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x)" in ssubst)
prefer 2 apply (assumption)
apply (simp add: step_def2)
apply (drule (1) loop_lemma2, simp)
done

lemma loop_lemma4 [rule_format]:
  "\<forall>x. b\<cdot>(iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x) = FF \<longrightarrow> while\<cdot>b\<cdot>g\<cdot>x = iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x"
apply (induct_tac k)
apply (simp (no_asm))
apply (intro strip)
apply (simplesubst while_unfold)
apply simp
apply (rule allI)
apply (simplesubst iterate_Suc2)
apply (intro strip)
apply (rule trans)
apply (rule while_unfold3)
apply simp
done

lemma loop_lemma5 [rule_format (no_asm)]:
  "\<forall>k. b\<cdot>(iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x) \<noteq> FF \<Longrightarrow>
    \<forall>m. while\<cdot>b\<cdot>g\<cdot>(iterate m\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x) = UU"
apply (simplesubst while_def2)
apply (rule fix_ind)
apply simp
apply simp
apply (rule allI)
apply (simp (no_asm))
apply (rule_tac p = "b\<cdot>(iterate m\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x)" in trE)
apply (simp (no_asm_simp))
apply (simp (no_asm_simp))
apply (rule_tac s = "xa\<cdot>(iterate (Suc m)\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x)" in trans)
apply (erule_tac [2] spec)
apply (rule cfun_arg_cong)
apply (rule trans)
apply (rule_tac [2] iterate_Suc [symmetric])
apply (simp add: step_def2)
apply blast
done

lemma loop_lemma6: "\<forall>k. b\<cdot>(iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x) \<noteq> FF \<Longrightarrow> while\<cdot>b\<cdot>g\<cdot>x = UU"
apply (rule_tac t = "x" in iterate_0 [THEN subst])
apply (erule loop_lemma5)
done

lemma loop_lemma7: "while\<cdot>b\<cdot>g\<cdot>x \<noteq> UU \<Longrightarrow> \<exists>k. b\<cdot>(iterate k\<cdot>(step\<cdot>b\<cdot>g)\<cdot>x) = FF"
apply (blast intro: loop_lemma6)
done


(* ------------------------------------------------------------------------- *)

(* 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 (applynotE)
pply )
apply assumption
apply (drule specapply(rule_tac  "iterate ( )\(step\b\g)\x"
pply( ule
prefer apply (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

100%


¤ 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:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge