Quellcode-Bibliothek Collecting_Examples.thy
Interaktion und PortierbarkeitIsabelle
subsection "Collecting Semantics Examples"
theory Collecting_Examples imports Collecting Vars begin
subsubsection "Pretty printing state sets"
text\<open>Tweak code generation to work with sets of non-equality types:\<close> lemma insert_code [code]: "insert x (set xs) = set (x#xs)" and union_code [code]: "set xs \ A = fold insert xs A" by (simp_all add: union_set_fold)
text\<open>Compensate for the fact that sets may now have duplicates:\<close> definition compact :: "'a set \ 'a set" where "compact X = X"
text\<open>In order to display commands annotated with state sets, states must be
translated into a printable format as sets of variable-state pairs, for the
variables in the command:\<close>
definition show_acom :: "state set acom \ (vname*val)set set acom" where "show_acom C =
annotate (\<lambda>p. (\<lambda>s. (\<lambda>x. (x, s x)) ` (vars_acom C)) ` anno C p) (strip C)"
subsubsection "Examples"
definition"c0 = WHILE Less (V ''x'') (N 3)
DO ''x'' ::= Plus (V ''x'') (N 2)"
definition C0 :: "state set acom"where"C0 = annotate (\p. {}) c0"
¤ 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.1Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
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.