Link Search Menu Expand Document
\( % cbs-mathjax.sty % For use with mathjax-3.html. % For formatting pages using CBS with MathJax-3. % When using Jekyll, include this file in a page by adding to the front matter: % layout: cbs-mathjax % or: % layout: cbs-mathjax-local % The macros support formatting all of CBS. The MathJax-3 rendering is % compatible with the LaTeX rendering of articles that use cbs-latex.sty. % The colors are specified using CSS, so that they can be changed according % to the page background color. % The configuration tex block should include: % maxBuffer : 10 * 1024 % The output block should include: % mtextFont: 'sans-serif' % See the docs at: % ??? \newcommand{\llbracket}{[\![} \newcommand{\rrbracket}{]\!]} \newcommand{\nobreak}{} % \SHADE{MATH} can be defined to produce a shaded background to highlight % inline MATH in running text: \newcommand{\SHADE}[1]{#1} % \STYLE{STYLE-NAME}{TEXT-OR-MATH} lets CSS determine the color of TEXT-OR-MATH, % so that it can change when a web page changes between light and dark modes. % STYLE-NAME should be either Key, PartVariable, Name, SyntaxName, SemanticsName, % Language, or SectNumber. % TO DO: Improve the style names! \newcommand{\STYLE}[2]{\class{cbs-#1}{#2}} % \KEY{text}, \STRING{text}, \ATOM{text}, \LEX{text} can be used in text or math. % When the MathJax configuration includes mtextFont: 'sans-serif', \KEY{text} % renders as slanted sans-serif, but \VAR{text} still renders in a serif font. \newcommand{\KEY}[1]{\textit{\STYLE{Key}{#1}}} \newcommand{\STRING}[1]{\text{``$\mathtt{#1}$''}} \newcommand{\ATOM}[1]{\text{`$\mathtt{#1}$'}} \newcommand{\LEX}[1]{\text{\STYLE{Key}{`}$\mathtt{#1}$\STYLE{Key}{'}}} % The following commands produce ASCII characters that are treated specially by LaTeX: \newcommand{\HASH}{\unicode{x0023}} % {\char`\#} \newcommand{\DOLLAR}{\unicode{x0024}} % {\char`\$} \newcommand{\PERCENT}{\unicode{x0025}} % {\char`\%} \newcommand{\AMPERSAND}{\unicode{x0026}} % {\char`\&} \newcommand{\APOSTROPHE}{\unicode{x0027}} % {\char`\'} \newcommand{\BACKSLASH}{\unicode{x005c}} % {\char`\\} \newcommand{\CARET}{\unicode{x005e}} % {\char`\^} \newcommand{\UNDERSCORE}{\unicode{x005f}} % {\char`\_} \newcommand{\GRAVE}{\unicode{x0060}} % {\char`\`} \newcommand{\LEFTBRACE}{\unicode{x007b}} % {\char`\{} \newcommand{\RIGHTBRACE}{\unicode{x007d}} % {\char`\}} \newcommand{\TILDE}{\unicode{x007e}} % {\textasciitilde} % \FUN{name} highlights the name. % \FUNDEC{name} declares Name.name as the target of links to name. % \FUNREF{name} links name to the target Name.name in the current file. % \FUNHYP{url}{file}{name} links name to Name.name at url/file/file.pdf. % Similarly for \VAR{partvariable}, \SYN{syntaxname}, \SEM{semanticsName}, % and \SECT{sectionnumber} % The kerns in \SUB and \VAR avoid overlaps with primes: \newcommand{\SUB}[1]{_{\kern-2mu\STYLE{PartVariable}{#1}}} % PLAIN \newcommand{\VAR}[1]{\STYLE{PartVariable}{\it#1\kern2mu}} % \it#1 currently formats #1 in the text italic font, independently of mtextFont. \newcommand{\FUN}[1]{\STYLE{Name}{\textsf{#1}}} \newcommand{\SYN}[1]{\STYLE{SyntaxName}{\textsf{#1}}} \newcommand{\SEM}[1]{\STYLE{SemanticsName}{\textsf{#1}}} \newcommand{\SECT}[1]{\STYLE{SectionNumber}{\textsf{#1}}} \newcommand{\LANG}[1]{\STYLE{Language}{#1}} % DEC \newcommand{\DEC}[3]{\smash{\raise{2.4ex}{\cssId{#1:#2}{}}}#3} \newcommand{\VARDEC}[1]{\DEC{PartVariable}{#1}{\VAR{#1}}} \newcommand{\FUNDEC}[1]{\DEC{Name}{#1}{\FUN{#1}}} \newcommand{\SYNDEC}[1]{\DEC{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMDEC}[1]{\DEC{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTDEC}[1]{\DEC{SectionNumber}{#1}{\textsf{#1}}} % \newcommand{\LANGDEC}[1]{\DEC{Language}{#1}{\LANG{#1}}} % REF \newcommand{\REF}[3]{\href{###1%3A#2}{#3}} \newcommand{\VARREF}[1]{\REF{PartVariable}{#1}{\VAR{#1}}} \newcommand{\FUNREF}[1]{\REF{Name}{#1}{\FUN{#1}}} \newcommand{\SYNREF}[1]{\REF{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMREF}[1]{\REF{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTREF}[1]{\REF{SectionNumber}{#1}{\SECT{#1}}} % \newcommand{\LANGREF}[1]{\REF{Language}{#1}{\LANG{#1}}} % HYP \newcommand{\HYP}[5]{\href{#1/#2/index.html###3%3A#4}{#5}} \newcommand{\VARHYP}[3]{\HYP{#1}{#2}{PartVariable}{#3}{\VAR{#3}}} \newcommand{\FUNHYP}[3]{\HYP{#1}{#2}{Name}{#3}{\FUN{#3}}} \newcommand{\SYNHYP}[3]{\HYP{#1}{#2}{SyntaxName}{#3}{\SYN{#3}}} \newcommand{\SEMHYP}[3]{\HYP{#1}{#2}{SemanticsName}{#3}{\SEM{#3}}} \newcommand{\SECTHYP}[3]{\HYP{#1}{#2}{SectionNumber}{#3}{\SECT{#3}}} % \newcommand{\LANGHYP}[3]{\HYP{#1}{#2}{Language}{#3}{\LANG{#3}}} % CBS-beta/math hyperlinks \newcommand{\CBSBETAMATH}{https://plancomps.github.io/CBS-beta/math} \newcommand{\VARCBS}[3]{\VARHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand{\FUNCBS}[3]{\FUNHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand{\SYNCBS}[3]{\SYNHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand{\SEMCBS}[3]{\SEMHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand{\SECTCBS}[3]{\SECTHYP{\CBSBETAMATH/#1}{#2}{#3}} % \newcommand{\LANGCBS}[3]{\LANGHYP{\CBSBETAMATH/#1}{#2}{#3}} % \LEFTPHRASE MATH \RIGHTPHRASE produces [[ MATH ]] with proper brackets: \newcommand{\LEFTPHRASE}{\llbracket} \newcommand{\RIGHTPHRASE}{\rrbracket} % \LEFTGROUP MATH \RIGHTGROUP produces ( MATH ) where the parentheses are % highlighted the same as keywords: \newcommand{\LEFTGROUP}{\STYLE{Key}{(}} \newcommand{\RIGHTGROUP}{\STYLE{Key}{)}} % MATH\PLUS produces a superscript + % MATH\STAR produces a superscript * % MATH\QUERY produces a superscript ? \newcommand{\PLUS}{ {}^{\texttt{+}}} \newcommand{\STAR}{ {}^{\texttt{*}}} \newcommand{\QUERY}{ {}^{\texttt{?}}} % \RULE{premise}{conclusion} produces % premise % ---------- % conclusion \newcommand{\RULE}[2]{\frac{\displaystyle#1}{\displaystyle#2}} % See https://tex.stackexchange.com/questions/337328/superscripts-appear-in-various-weird-places-in-fractions % \RULE % {\begin{aligned} & premise \\ & ... \end{aligned}} % {\begin{aligned} & conclusion ... \\ & ... \end{aligned}} % produces an inference rule with left-aligned premises and split conclusion % premise % ... % -------------- % conclusion ... % ... % \TO TYPE produces => TYPE \newcommand{\TO}{\mathop{\Rightarrow}} % TERM \TRANS TERM produces TERM ---> TERM \newcommand{\TRANS}{\longrightarrow} % TERM \xrightarrow{LABEL} TERM puts the label above the long arrow \)
\( \renewcommand{\HYP}[5]{#5} \)

This page is using MathJax-3. See the same page using MathJax-2.7.

Links to non-local declarations are disabled on this sample page.

OUTLINE

Binding

\[\begin{align*} [ \ \KEY{Type} \quad & \FUNREF{environments} \\ \KEY{Alias} \quad & \FUNREF{envs} \\ \KEY{Datatype} \quad & \FUNREF{identifiers} \\ \KEY{Alias} \quad & \FUNREF{ids} \\ \KEY{Funcon} \quad & \FUNREF{identifier-tagged} \\ \KEY{Alias} \quad & \FUNREF{id-tagged} \\ \KEY{Funcon} \quad & \FUNREF{fresh-identifier} \\ \KEY{Entity} \quad & \FUNREF{environment} \\ \KEY{Alias} \quad & \FUNREF{env} \\ \KEY{Funcon} \quad & \FUNREF{initialise-binding} \\ \KEY{Funcon} \quad & \FUNREF{bind-value} \\ \KEY{Alias} \quad & \FUNREF{bind} \\ \KEY{Funcon} \quad & \FUNREF{unbind} \\ \KEY{Funcon} \quad & \FUNREF{bound-directly} \\ \KEY{Funcon} \quad & \FUNREF{bound-value} \\ \KEY{Alias} \quad & \FUNREF{bound} \\ \KEY{Funcon} \quad & \FUNREF{closed} \\ \KEY{Funcon} \quad & \FUNREF{scope} \\ \KEY{Funcon} \quad & \FUNREF{accumulate} \\ \KEY{Funcon} \quad & \FUNREF{collateral} \\ \KEY{Funcon} \quad & \FUNREF{bind-recursively} \\ \KEY{Funcon} \quad & \FUNREF{recursive} \ ] \end{align*}\] \[\begin{align*} \KEY{Meta-variables} \quad & \VAR{T} <: \FUNHYP{../../../Values}{Value-Types}{values} \end{align*}\]

Environments

\[\begin{align*} \KEY{Type} \quad & \FUNDEC{environments} \leadsto \FUNHYP{../../../Values/Composite}{Maps}{maps} ( \FUNREF{identifiers}, \FUNHYP{../../../Values}{Value-Types}{values}\QUERY ) \\ \KEY{Alias} \quad & \FUNDEC{envs} = \FUNREF{environments} \end{align*}\]

An environment represents bindings of identifiers to values. Mapping an identifier to \(( \ )\) represents that its binding is hidden.

Circularity in environments (due to recursive bindings) is represented using bindings to cut-points called \(\FUNHYP{../.}{Linking}{links}\). Funcons are provided for making declarations recursive and for referring to bound values without explicit mention of links, so their existence can generally be ignored.

\[\begin{align*} \KEY{Datatype} \quad \FUNDEC{identifiers} \ ::= \ & \{ \_ : \FUNHYP{../../../Values/Composite}{Strings}{strings} \} \mid \FUNDEC{identifier-tagged}( \_ : \FUNREF{identifiers}, \_ : \FUNHYP{../../../Values}{Value-Types}{values}) \end{align*}\] \[\begin{align*} \KEY{Alias} \quad & \FUNDEC{ids} = \FUNREF{identifiers} \\ \KEY{Alias} \quad & \FUNDEC{id-tagged} = \FUNREF{identifier-tagged} \end{align*}\]

An identifier is either a string of characters, or an identifier tagged with some value (e.g., with the identifier of a namespace).

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{fresh-identifier} : \TO \FUNREF{identifiers} \end{align*}\]

\(\FUNREF{fresh-identifier}\) computes an identifier distinct from all previously computed identifiers.

\[\begin{align*} \KEY{Rule} \quad & \FUNREF{fresh-identifier} \leadsto \FUNREF{identifier-tagged} ( \STRING{generated}, \FUNHYP{../.}{Generating}{fresh-atom} ) \end{align*}\]

Current bindings

\[\begin{align*} \KEY{Entity} \quad & \FUNDEC{environment}(\_ : \FUNREF{environments}) \vdash \_ \TRANS \_ \end{align*}\] \[\begin{align*} \KEY{Alias} \quad & \FUNDEC{env} = \FUNREF{environment} \end{align*}\]

The environment entity allows a computation to refer to the current bindings of identifiers to values.

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{initialise-binding}( \VAR{X} : \TO \VAR{T}) : \TO \VAR{T} \\&\quad \leadsto \FUNHYP{../.}{Linking}{initialise-linking} ( \FUNHYP{../.}{Generating}{initialise-generating} ( \FUNREF{closed} ( \VAR{X} ) ) ) \end{align*}\]

\(\FUNREF{initialise-binding} ( \VAR{X} )\) ensures that \(\VAR{X}\) does not depend on non-local bindings. It also ensures that the linking entity (used to represent potentially cyclic bindings) and the generating entity (for creating fresh identifiers) are initialised.

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{bind-value}( \VAR{I} : \FUNREF{identifiers}, \VAR{V} : \FUNHYP{../../../Values}{Value-Types}{values}) : \TO \FUNREF{environments} \\&\quad \leadsto \{ \VAR{I} \mapsto \VAR{V} \} \\ \KEY{Alias} \quad & \FUNDEC{bind} = \FUNREF{bind-value} \end{align*}\]

\(\FUNREF{bind-value} ( \VAR{I}, \VAR{X} )\) computes the environment that binds only \(\VAR{I}\) to the value computed by \(\VAR{X}\).

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{unbind}( \VAR{I} : \FUNREF{identifiers}) : \TO \FUNREF{environments} \\&\quad \leadsto \{ \VAR{I} \mapsto ( \ ) \} \end{align*}\]

\(\FUNREF{unbind} ( \VAR{I} )\) computes the environment that hides the binding of \(\VAR{I}\).

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{bound-directly}( \_ : \FUNREF{identifiers}) : \TO \FUNHYP{../../../Values}{Value-Types}{values} \end{align*}\]

\(\FUNREF{bound-directly} ( \VAR{I} )\) returns the value to which \(\VAR{I}\) is currently bound, if any, and otherwise fails.

\(\FUNREF{bound-directly} ( \VAR{I} )\) does not follow links. It is used only in connection with recursively-bound values when references are not encapsulated in abstractions.

\[\begin{align*} \KEY{Rule} \quad & \RULE{ \FUNHYP{../../../Values/Composite}{Maps}{lookup} ( \VAR{\rho}, \VAR{I} ) \leadsto ( \VAR{V} : \FUNHYP{../../../Values}{Value-Types}{values} ) }{ \FUNREF{environment} ( \VAR{\rho} ) \vdash \FUNREF{bound-directly} ( \VAR{I} : \FUNREF{identifiers} ) \TRANS \VAR{V} } \\ \KEY{Rule} \quad & \RULE{ \FUNHYP{../../../Values/Composite}{Maps}{lookup} ( \VAR{\rho}, \VAR{I} ) \leadsto ( \ ) }{ \FUNREF{environment} ( \VAR{\rho} ) \vdash \FUNREF{bound-directly} ( \VAR{I} : \FUNREF{identifiers} ) \TRANS \FUNHYP{../../Abnormal}{Failing}{fail} } \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{bound-value}( \VAR{I} : \FUNREF{identifiers}) : \TO \FUNHYP{../../../Values}{Value-Types}{values} \\&\quad \leadsto \FUNHYP{../.}{Linking}{follow-if-link} ( \FUNREF{bound-directly} ( \VAR{I} ) ) \\ \KEY{Alias} \quad & \FUNDEC{bound} = \FUNREF{bound-value} \end{align*}\]

\(\FUNREF{bound-value} ( \VAR{I} )\) inspects the value to which \(\VAR{I}\) is currently bound, if any, and otherwise fails. If the value is a link, \(\FUNREF{bound-value} ( \VAR{I} )\) returns the value obtained by following the link, if any, and otherwise fails. If the inspected value is not a link, \(\FUNREF{bound-value} ( \VAR{I} )\) returns it.

\(\FUNREF{bound-value} ( \VAR{I} )\) is used for references to non-recursive bindings and to recursively-bound values when references are encapsulated in abstractions.

Scope

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{closed}( \VAR{X} : \TO \VAR{T}) : \TO \VAR{T} \end{align*}\]

\(\FUNREF{closed} ( \VAR{X} )\) ensures that \(\VAR{X}\) does not depend on non-local bindings.

\[\begin{align*} \KEY{Rule} \quad & \RULE{ \FUNREF{environment} ( \FUNHYP{../../../Values/Composite}{Maps}{map} ( \ ) ) \vdash \VAR{X} \TRANS \VAR{X}' }{ \FUNREF{environment} ( \_ ) \vdash \FUNREF{closed} ( \VAR{X} ) \TRANS \FUNREF{closed} ( \VAR{X}' ) } \\ \KEY{Rule} \quad & \FUNREF{closed} ( \VAR{V} : \VAR{T} ) \leadsto \VAR{V} \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{scope}( \_ : \FUNREF{environments}, \_ : \TO \VAR{T}) : \TO \VAR{T} \end{align*}\]

\(\FUNREF{scope} ( \VAR{D}, \VAR{X} )\) executes \(\VAR{D}\) with the current bindings, to compute an environment \(\VAR{\rho}\) representing local bindings. It then executes \(\VAR{X}\) to compute the result, with the current bindings extended by \(\VAR{\rho}\), which may shadow or hide previous bindings.

\(\FUNREF{closed} ( \FUNREF{scope} ( \VAR{\rho}, \VAR{X} ) )\) ensures that \(\VAR{X}\) can reference only the bindings provided by \(\VAR{\rho}\).

\[\begin{align*} \KEY{Rule} \quad & \RULE{ \FUNREF{environment} ( \FUNHYP{../../../Values/Composite}{Maps}{map-override} ( \VAR{\rho}\SUB{1}, \VAR{\rho}\SUB{0} ) ) \vdash \VAR{X} \TRANS \VAR{X}' }{ \FUNREF{environment} ( \VAR{\rho}\SUB{0} ) \vdash \FUNREF{scope} ( \VAR{\rho}\SUB{1} : \FUNREF{environments}, \VAR{X} ) \TRANS \FUNREF{scope} ( \VAR{\rho}\SUB{1}, \VAR{X}' ) } \\ \KEY{Rule} \quad & \FUNREF{scope} ( \_ : \FUNREF{environments}, \VAR{V} : \VAR{T} ) \leadsto \VAR{V} \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{accumulate}( \_ : ( \TO \FUNREF{environments} )\STAR) : \TO \FUNREF{environments} \end{align*}\]

\(\FUNREF{accumulate} ( \VAR{D}\SUB{1}, \VAR{D}\SUB{2} )\) executes \(\VAR{D}\SUB{1}\) with the current bindings, to compute an environment \(\VAR{\rho}\SUB{1}\) representing some local bindings. It then executes \(\VAR{D}\SUB{2}\) to compute an environment \(\VAR{\rho}\SUB{2}\) representing further local bindings, with the current bindings extended by \(\VAR{\rho}\SUB{1}\), which may shadow or hide previous current bindings. The result is \(\VAR{\rho}\SUB{1}\) extended by \(\VAR{\rho}\SUB{2}\), which may shadow or hide the bindings of \(\VAR{\rho}\SUB{1}\).

\(\FUNREF{accumulate} ( \_, \_ )\) is associative, with \(\FUNHYP{../../../Values/Composite}{Maps}{map} ( \ )\) as unit, and extends to any number of arguments.

\[\begin{align*} \KEY{Rule} \quad & \RULE{ \VAR{D}\SUB{1} \TRANS \VAR{D}\SUB{1}' }{ \FUNREF{accumulate} ( \VAR{D}\SUB{1}, \VAR{D}\SUB{2} ) \TRANS \FUNREF{accumulate} ( \VAR{D}\SUB{1}', \VAR{D}\SUB{2} ) } \\ \KEY{Rule} \quad & \FUNREF{accumulate} ( \VAR{\rho}\SUB{1} : \FUNREF{environments}, \VAR{D}\SUB{2} ) \leadsto \FUNREF{scope} ( \VAR{\rho}\SUB{1}, \FUNHYP{../../../Values/Composite}{Maps}{map-override} ( \VAR{D}\SUB{2}, \VAR{\rho}\SUB{1} ) ) \\ \KEY{Rule} \quad & \FUNREF{accumulate} ( \ ) \leadsto \FUNHYP{../../../Values/Composite}{Maps}{map} ( \ ) \\ \KEY{Rule} \quad & \FUNREF{accumulate} ( \VAR{D}\SUB{1} ) \leadsto \VAR{D}\SUB{1} \\ \KEY{Rule} \quad & \FUNREF{accumulate} ( \VAR{D}\SUB{1}, \VAR{D}\SUB{2}, \VAR{D}\PLUS ) \leadsto \FUNREF{accumulate} ( \VAR{D}\SUB{1}, \FUNREF{accumulate} ( \VAR{D}\SUB{2}, \VAR{D}\PLUS ) ) \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{collateral}( \VAR{\rho}\STAR : \FUNREF{environments}\STAR) : \TO \FUNREF{environments} \\&\quad \leadsto \FUNHYP{../../Abnormal}{Failing}{checked} \ \FUNHYP{../../../Values/Composite}{Maps}{map-unite} ( \VAR{\rho}\STAR ) \end{align*}\]

\(\FUNREF{collateral} ( \VAR{D}\SUB{1}, \cdots )\) pre-evaluates its arguments with the current bindings, and unites the resulting maps, which fails if the domains are not pairwise disjoint.

\(\FUNREF{collateral} ( \VAR{D}\SUB{1}, \VAR{D}\SUB{2} )\) is associative and commutative with \(\FUNHYP{../../../Values/Composite}{Maps}{map} ( \ )\) as unit, and extends to any number of arguments.

Recurse

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{bind-recursively}( \VAR{I} : \FUNREF{identifiers}, \VAR{E} : \TO \FUNHYP{../../../Values}{Value-Types}{values}) : \TO \FUNREF{environments} \\&\quad \leadsto \FUNREF{recursive} ( \{ \VAR{I} \}, \FUNREF{bind-value} ( \VAR{I}, \VAR{E} ) ) \end{align*}\]

\(\FUNREF{bind-recursively} ( \VAR{I}, \VAR{E} )\) binds \(\VAR{I}\) to a link that refers to the value of \(\VAR{E}\), representing a recursive binding of \(\VAR{I}\) to the value of \(\VAR{E}\). Since \(\FUNREF{bound-value} ( \VAR{I} )\) follows links, it should not be executed during the evaluation of \(\VAR{E}\).

\[\begin{align*} \KEY{Funcon} \quad & \FUNDEC{recursive}( \VAR{SI} : \FUNHYP{../../../Values/Composite}{Sets}{sets} ( \FUNREF{identifiers} ), \VAR{D} : \TO \FUNREF{environments}) : \TO \FUNREF{environments} \\&\quad \leadsto \FUNREF{re-close} ( \FUNREF{bind-to-forward-links} ( \VAR{SI} ), \VAR{D} ) \end{align*}\]

\(\FUNREF{recursive} ( \VAR{SI}, \VAR{D} )\) executes \(\VAR{D}\) with potential recursion on the bindings of the identifiers in the set \(\VAR{SI}\) (which need not be the same as the set of identifiers bound by \(\VAR{D}\)).

\[\begin{align*} \KEY{Auxiliary Funcon} \quad & \FUNDEC{re-close}( \VAR{M} : \FUNHYP{../../../Values/Composite}{Maps}{maps} ( \FUNREF{identifiers}, \FUNHYP{../.}{Linking}{links} ), \VAR{D} : \TO \FUNREF{environments}) : \TO \FUNREF{environments} \\&\quad \leadsto \FUNREF{accumulate} ( \FUNREF{scope} ( \VAR{M}, \VAR{D} ), \FUNHYP{../.}{Flowing}{sequential} ( \FUNREF{set-forward-links} ( \VAR{M} ), \FUNHYP{../../../Values/Composite}{Maps}{map} ( \ ) ) ) \end{align*}\]

\(\FUNREF{re-close} ( \VAR{M}, \VAR{D} )\) first executes \(\VAR{D}\) in the scope \(\VAR{M}\), which maps identifiers to freshly allocated links. This computes an environment \(\VAR{\rho}\) where the bound values may contain links, or implicit references to links in abstraction values. It then sets the link for each identifier in the domain of \(\VAR{M}\) to refer to its bound value in \(\VAR{\rho}\), and returns \(\VAR{\rho}\) as the result.

\[\begin{align*} \KEY{Auxiliary Funcon} \quad & \FUNDEC{bind-to-forward-links}( \VAR{SI} : \FUNHYP{../../../Values/Composite}{Sets}{sets} ( \FUNREF{identifiers} )) : \TO \FUNHYP{../../../Values/Composite}{Maps}{maps} ( \FUNREF{identifiers}, \FUNHYP{../.}{Linking}{links} ) \\&\quad \leadsto \FUNHYP{../../../Values/Composite}{Maps}{map-unite} ( \\&\quad\quad\quad\quad \FUNHYP{../.}{Giving}{interleave-map} ( \\&\quad\quad\quad\quad\quad \FUNREF{bind-value} ( \FUNHYP{../.}{Giving}{given}, \FUNHYP{../.}{Linking}{fresh-link} ( \FUNHYP{../../../Values}{Value-Types}{values} ) ), \\&\quad\quad\quad\quad\quad \FUNHYP{../../../Values/Composite}{Sets}{set-elements} ( \VAR{SI} ) ) ) \end{align*}\]

\(\FUNREF{bind-to-forward-links} ( \VAR{SI} )\) binds each identifier in the set \(\VAR{SI}\) to a freshly allocated link.

\[\begin{align*} \KEY{Auxiliary Funcon} \quad & \FUNDEC{set-forward-links}( \VAR{M} : \FUNHYP{../../../Values/Composite}{Maps}{maps} ( \FUNREF{identifiers}, \FUNHYP{../.}{Linking}{links} )) : \TO \FUNHYP{../../../Values/Primitive}{Null}{null-type} \\&\quad \leadsto \FUNHYP{../.}{Flowing}{effect} ( \\&\quad\quad\quad\quad \FUNHYP{../.}{Giving}{interleave-map} ( \\&\quad\quad\quad\quad\quad \FUNHYP{../.}{Linking}{set-link} ( \FUNHYP{../../../Values/Composite}{Maps}{map-lookup} ( \VAR{M}, \FUNHYP{../.}{Giving}{given} ), \FUNREF{bound-value} ( \FUNHYP{../.}{Giving}{given} ) ), \\&\quad\quad\quad\quad\quad \FUNHYP{../../../Values/Composite}{Sets}{set-elements} ( \FUNHYP{../../../Values/Composite}{Maps}{map-domain} ( \VAR{M} ) ) ) ) \end{align*}\]

For each identifier \(\VAR{I}\) in the domain of \(\VAR{M}\), \(\FUNREF{set-forward-links} ( \VAR{M} )\) sets the link to which \(\VAR{I}\) is mapped by \(\VAR{M}\) to the current bound value of \(\VAR{I}\).