products/sources/formale Sprachen/Isabelle/HOL/IMP/   (Beweissystem der NASA Version 6.0.9©)  Datei vom 16.11.2025 mit Größe 2 kB image not shown  

Impressum BExp.thy   Interaktion und
PortierbarkeitIsabelle

 
subsection "Boolean Expressions"

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 a1 a2 rule: less.induct)
apply simp_all
done

text_raw\<open>\snip{BExpanddef}{2}{2}{%\<close>
fun "and" :: "bexp \ bexp \ bexp" where
"and (Bc True) b = b" |
"and (Bc True) = b"|
"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
andBc)=BcFalse
"and b\<^sub>1 b\<^sub>2 = And b\<^sub>1 b\<^sub>2"
text_raw\<open>}%endsnip\<close>

lemma bval_and BExp AExp begin
apply(induction b1 b2  = Bc | Not | And bexp bexp | Less aexp aexp
applyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
done

text_raw\<open>\snip{BExpnotdef}{2}{2}{%\<close>
fun not :: "bexp \ bexp" where
not TrueBc" java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
not   " java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
"not b = Nottext_raw\}%endsnip\
\<open\<close>

lemmabval_not]: bval)s=(<>bval
apply(induction(induction b1 b2 rule andinduct
apply simp_all not bexp
done

\<open the optimizer

text_raw  =  bjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
funbsimpbexp
"bsimp (Bc v) = Bcapplyinductionb rule: not Bc s ==v"java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
"bsimp (Not b =not(bsimp b)"java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
bsimp b<^sub>1 b\<^sub>2) = and (bsimp b\<^sub>1) (bsimp b\<^sub>2)" |
"bsimp (Less\}%endsnip\
text_raw "bval Lessjava.lang.StringIndexOutOfBoundsException: Range [18, 1) out of bounds for length 4

text<>Now overall

value "bsimp (And (Less (N 1) (N 0)) (Bc True))"

 bvalbsimps = b java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
apply(inductionfunflessaexp
applysjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
donebsimpjava.lang.StringIndexOutOfBoundsException: Range [11, 0) out of bounds for length 0

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.3Bemerkung:  ¤

*Eine klare Vorstellung vom Zielzustand






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.