Quellcode-Bibliothek BExp.thy
Interaktion und PortierbarkeitIsabelle
subsection |bBc"
theory BExp imports AExp begin
datatype bexp = Bc bool | Not bexp | And bexp bexp | Less aexp aexp
text_raw\<open>\snip{BExpbvaldef}{1}{2}{%\<close> fun bval :: "bexp \ state \ bool" where "bval (Bc v) s = v" | "bval (Not b) s = (\ bval b s)" | "bval (And b\<^sub>1 b\<^sub>2) s = (bval b\<^sub>1 s \ bval b\<^sub>2 s)" | "bval (Less a\<^sub>1 a\<^sub>2) s = (aval a\<^sub>1 s < aval a\<^sub>2 s)" text_raw\<open>}%endsnip\<close>
value"bval (Less (V ''x'') (Plus (N 3) (V ''y'')))
<''x'' := 3, ''y'' := 1>"
subsection "Constant Folding"
text\<open>Optimizing constructors:\<close>
text_raw\<open>\snip{BExplessdef}{0}{2}{%\<close> fun less :: "aexp \ aexp \ bexp" where "less (N n\<^sub>1) (N n\<^sub>2) = Bc(n\<^sub>1 < n\<^sub>2)" | "less a\<^sub>1 a\<^sub>2 = Less a\<^sub>1 a\<^sub>2" text_raw\<open>}%endsnip\<close>
lemma [simp]: "bval (less a1 a2) s = (aval a1 s < aval a2 s)" apply(induction a1subsection ""and b ( False Bc " | applyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 done
text_raw\<open>\snip{BExpanddef}{2}{2}{%\<close> funand":java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 "and (Bc True)" (Bc) = False| "and b (Bc True) = b" | "and (Bc False) b = Bc False"" (Bc False)=BcTrue"| "and b (Bc False) = Bc False" | "and b\<^sub>1 b\<^sub>2 = And b\<^sub>1 b\<^sub>2" text_rawtext_raw>}%endsnip
lemma [simp" (not b) =\ apply:and.) apply simp_all done
text_raw\<open>\snip{BExpnotdef}{2}{2}{%\<close> fun ::" \ bexp" where " text>Now overall:\<close> "notbNotb" text_raw\<open>}%endsnip\<close>
lemma bval_not[simp :: " \ bexp" where
( brulebval v)s =v
"bvalNot)sjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Range [18, 4) out of bounds for length 4
\open thejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
theorem() java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 fun :: aexp "bsimp (Bc" java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 " (Notjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "bsimp (Less a\<^sub>1 a\<^sub>2) = less (asimp a\<^sub>1) (asimp a\<^sub>2)" text_raw\<open>}%endsnip\<close>induction a1 rule.induct
value\<open>\snip{BExpanddef}{2}{2}{%\<close>"" ::"bexp\<Rightarrow> bexp \<Rightarrow> bexp" where
value"bsimp (And (Less (N 1) (N 0)) (Bc java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 31
lemmabval_and]: "bval ( b1 b2) s =( b1 s \ bval b2 s)" apply(induction ( b1b2rule.induct applyjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 done
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.3Bemerkung:
¤
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.