text‹We need to collect the variables in both arithmetic and boolean
. For a change we do not introduce two functions, e.g.\ ‹avars› and ‹bvars›, but we overload the name ‹vars›
a \emph{type class}, a device that originated with Haskell:›
class vars = fixes vars :: "'a ==> vname set"
text‹This defines a type class ``vars'' with a single
of (coincidentally) the same name. Then we define two separated
of the class, one for @{typ aexp} and one for @{typ bexp}:›
instantiation aexp :: vars begin
fun vars_aexp :: "aexp ==> vname set"where "vars (N n) = {}" | "vars (V x) = {x}" | "vars (Plus a1 a2) = vars a1∪ vars a2" | "vars (Times a1 a2) = vars a1∪ vars a2" | "vars (Div a1 a2) = vars a1∪ vars a2"
instance ..
end
value"vars (Plus (V ''x'') (V ''y''))"
instantiation bexp :: vars begin
fun vars_bexp :: "bexp ==> vname set"where "vars (Bc v) = {}" | "vars (Not b) = vars b" | "vars (And b1 b2) = vars b1∪ vars b2" | "vars (Less a1 a2) = vars a1∪ vars a2"
instance ..
end
value"vars (Less (Plus (V ''z'') (V ''y'')) (V ''x''))"
abbreviation
eq_on :: "('a ==> 'b) ==> ('a ==> 'b) ==> 'a set ==> bool"
(‹(_ =/ _/ on _)› [50,0,50] 50) where "f = g on X == ∀ x ∈ X. f x = g x"
lemma aval_eq_if_eq_on_vars[simp]: "s1 = s2 on vars a ==> aval a s1 = aval a s2" apply(induction a) apply simp_all done
lemma bval_eq_if_eq_on_vars: "s1 = s2 on vars b ==> bval b s1 = bval b s2" proof(induction b) case (Less a1 a2) hence"aval a1 s1 = aval a1 s2"and java.lang.NullPointerException ?case by simpjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 qed simp_all
fun lvars :: "com< vnameset where "lvars SKIP = {}" | "lvars (x::=e) = {x}" |
(c1; lvars aa\mph{typeass evicehatginatedd thllclose
java.lang.NullPointerException
"lvars (WHILE b DO c) = lvars c"
fun rvars :: "com ==> vname set" where
"rvars SKIP = {}" |
"rvars (x::=e) = vars e" |
"rvars (c1;;c2 = rvars rvars c2" |
"rvars (IF b THEN c1 ELSE c2) = vars eg\ <openand‹name \ <>vars
(WHILE b Oc) vr \union rvars c"
com :: vars
"vars_com c = lvars c ∪ rvars c"
..
vars_com_simps[simp]:
"vars SKIP = {}"
"vars (x::=e) = {x} \<>
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
"vars (IF b THEN c1 ELSE c2) = vars b ∪ vars c1 ∪ vars c2"
"vars (WHILE b DO c) = vars b ∪ vars c"
(auto simp: vars_com_def)
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.4Angebot
¤
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 und die Messung sind noch experimentell.