text‹This is an excerpt of the Optics library 🪙‹https://www.isa-afp.org/entries/Optics.html› by Frank Zeyda and
Simon Foster. It provides a rich infrastructure for 🪙‹algebraic lenses›,
an abstract theory allowing to describe parts of memory and their
independence. We use it to abstractly model typed program variables and
framing conditions.
Optics provides a rich framework for lense compositions and sub-lenses
which we will not use in the context of Clean; even the offered concept
of a list-lense, a possible means to model the stack-infrastructure
required for local variables, is actually richer than needed.
Since Clean strives for minimality, we restrict ourselves to this "proxy"
theory for Optics. ›
theory Optics imports Lens_Laws begin
fun upd_hd :: "('a ==> 'a) ==> 'a list ==> 'a list" where"upd_hd f [] = []"
| "upd_hd f (a#S) = f a # S"
lemma [simp] :"tl (upd_hd f S) = tl S" by (metis list.sel(3) upd_hd.elims)
definition upd2put :: "(('d ==> 'b) ==> 'a ==> 'c) ==> 'a ==> 'b ==> 'c" where"upd2put f = (λσ. λ b. f (λ_. b) σ)"
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.