text‹ Unrestriction is an encoding of semantic freshness that allows us to reason about the
presence of variables in predicates without being concerned with abstract syntax trees.
An expression $p$ is unrestricted by lens $x$, written $x \mathop{\sharp} p$, if
altering the value of $x$ has no effect on the valuation of $p$. This is a sufficient
notion to prove many laws that would ordinarily rely on an \emph{fv} function.
Unrestriction was first defined in the work of Marcel Oliveira~cite‹"Oliveira2005-PHD" and "Oliveira07"› in his
UTP mechanisation in \emph{ProofPowerZ}. Our definition modifies his in that our variables
are semantically characterised as lenses, and supported by the lens laws, rather than named
syntactic entities. We effectively fuse the ideas from both Feliachi~cite‹"Feliachi2010"› and
Oliveira's~cite‹"Oliveira07"› mechanisations of the UTP, the former being also purely semantic
in nature.
We first set up overloaded syntax for unrestriction, as several concepts will have this
defined. ›
text‹ Our syntax translations support both variables and variable sets such that we can write down
predicates like @{term "&x ♯ P"} and also @{term "{&x,&y,&z} <span style='font-size: 18px;'>♯ P"}.
We set up a simple tactic for discharging unrestriction conjectures using a simplification set. ›
text‹ Unrestriction for expressions is defined as a lifted construct using the underlying lens
operations. It states that lens $x$ is unrestricted by expression $e$ provided that, for any
state-space binding $b$ and variable valuation $v$, the value which the expression evaluates
to is unaltered if we set $x$ to $v$ in $b$. In other words, we cannot effect the behaviour
of $e$ by changing $x$. Thus $e$ does not observe the portion of state-space characterised
by $x$. We add this definition to our overloaded constant. ›
lift_definition unrest_uexpr :: "('a ==> 'α) ==> ('b, 'α) uexpr ==> bool" is"λ x e. ∀ b v. e (put b v) = e b" .
adhoc_overloading
unrest ⇌ unrest_uexpr
lemma unrest_expr_alt_def: "weak_lens x ==> (x ♯ P) = (∀ b b'. [P]e (b ⊕L b' on x) = [P]e b)" by (transfer, metis lens_override_def weak_lens.put_get)
subsection‹ Unrestriction laws ›
text‹ We now prove unrestriction laws for the key constructs of our expression model. Many
of these depend on lens properties and so variously employ the assumptions @{term mwb_lens} and
@{term vwb_lens}, depending on the number of assumptions from the lenses theory is required.
Firstly, we prove a general property -- if $x$ and $y$ are both unrestricted in $P$, then their composition
is also unrestricted in $P$. One can interpret the composition here as a union -- if the two sets
of variables $x$ and $y$ are unrestricted, then so is their union. ›
lemma unrest_var_comp [unrest]: "[ x ♯ P; y ♯ P ]==> x;y ♯ P" by (transfer, simp add: lens_defs)
text‹ If an expression is unrestricted by all variables, then it is unrestricted by any variable ›
lemma unrest_all_var: fixes e :: "('a, 'α) uexpr" assumes"Σ ♯ e" shows"x ♯ e" by (metis assms id_lens_def lens.simps(2) unrest_uexpr.rep_eq)
text‹ We can split an unrestriction composed by lens plus ›
lemma unrest_plus_split: fixes P :: "('a, 'α) uexpr" assumes"x ⋈ y""vwb_lens x""vwb_lens y" shows"unrest (x +L y) P ⟷ (x ♯ P) ∧ (y ♯ P)" using assms by (meson lens_plus_right_sublens lens_plus_ub sublens_refl unrest_sublens unrest_var_comp vwb_lens_wb)
text‹ The following laws demonstrate the primary motivation for lens independence: a variable
expression is unrestricted by another variable only when the two variables are independent.
Lens independence thus effectively allows us to semantically characterise when two variables,
or sets of variables, are different. ›
lemma unrest_var [unrest]: "[ mwb_lens x; x ⋈ y ]==> y ♯ var x" by (transfer, auto)
lemma unrest_iuvar [unrest]: "[ mwb_lens x; x ⋈ y ]==> $y ♯ $x" by (simp add: unrest_var)
lemma unrest_ouvar [unrest]: "[ mwb_lens x; x ⋈ y ]==> $y🍋♯ $x🍋" by (simp add: unrest_var)
text‹ The following laws follow automatically from independence of input and output variables. ›
lemma unrest_ouvar_iuvar [unrest]: fixes x :: "('a ==> 'α)" assumes"mwb_lens y" shows"$x🍋♯ $y" by (metis prod.collapse unrest_uexpr.rep_eq var.rep_eq var_lookup_in var_update_out)
text‹ Unrestriction distributes through the various function lifting expression constructs;
this allows us to prove unrestrictions for the majority of the expression language. ›
lemma unrest_uop [unrest]: "x ♯ e ==> x ♯ uop f e" by (transfer, simp)
lemma unrest_bop [unrest]: "[ x ♯ u; x ♯ v ]==> x ♯ bop f u v" by (transfer, simp)
lemma unrest_trop [unrest]: "[ x ♯ u; x ♯ v; x ♯ w ]==> x ♯ trop f u v w" by (transfer, simp)
lemma unrest_qtop [unrest]: "[ x ♯ u; x ♯ v; x ♯ w; x ♯ y ]==> x ♯ qtop f u v w y" by (transfer, simp)
text‹ For convenience, we also prove unrestriction rules for the bespoke operators on equality,
numbers, arithmetic etc. ›
lemma unrest_eq [unrest]: "[ x ♯ u; x ♯ v ]==> x ♯ u =u v" by (simp add: eq_upred_def, transfer, simp)
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.