Boolean partial assignments #
A partial assignment records, for each named Boolean variable, either a fixed
value or a live variable. Restricted functions retain the original input
indexing: values supplied at fixed coordinates are ignored. This representation
is convenient for random restrictions and decision trees, while conversion to
InputSubstitution connects it to the library's existing semantic interface.
Sequential refinement is left-biased. In rho.refine sigma, assignments
already fixed by rho remain fixed, and sigma is consulted only at variables
left live by rho.
A Boolean restriction on n named variables. none means that a variable
is live; some value fixes it to value.
Equations
- Algebraic.PartialAssignment n = (Fin n → Option Bool)
Instances For
Two partial assignments are equal when they agree on every variable.
The empty partial assignment leaves every variable live.
Equations
Instances For
A total assignment fixes every variable.
Equations
- Algebraic.PartialAssignment.total input index = some (input index)
Instances For
The partial assignment fixing exactly one variable.
Equations
Instances For
Apply a partial assignment to a complete input. Values at fixed variables are overwritten, while values at live variables are retained.
Instances For
Refine rho with sigma, retaining every value already fixed by rho.
Equations
Instances For
Clear a designated finite set of coordinates, leaving every other value unchanged. This is the inverse operation used by refinement encodings once their newly fixed support has been reconstructed.
Instances For
Sequential refinement is associative.
Replacing the freshly assigned head coordinate by a path value commutes with retaining the rest of a refinement. The selected coordinate must be live in the original restriction.
View a partial assignment as a semantic input substitution on the same named variables.
Equations
- rho.toInputSubstitution index input = rho.apply input index
Instances For
Conversion to input substitutions preserves sequential composition.
The finite set of variables left live by a partial assignment.
Equations
- rho.liveVariables = {index : Fin n | rho index = none}
Instances For
The number of variables left live by a partial assignment.
Equations
- rho.liveCount = rho.liveVariables.card
Instances For
The increasing bijection from a compact input namespace to the variables left live by a partial assignment.
Equations
- rho.liveOrderIso = rho.liveVariables.orderIsoOfFin ⋯
Instances For
The original input coordinate represented by a compact live-input index.
Equations
- rho.liveVariable index = ↑(rho.liveOrderIso index)
Instances For
The compact index of an original coordinate known to be live.
Instances For
Read a complete input only at the coordinates left live by rho.
Equations
- rho.projectLive input index = input (rho.liveVariable index)
Instances For
Express every original input as either a fixed Boolean or one of the compactly reindexed live inputs.
Equations
Instances For
Projecting a complete input to its live coordinates and then restoring fixed coordinates is exactly ordinary application of the restriction.
Compact live inputs are recovered after restoring the original input namespace.
The finite set of variables fixed by a partial assignment.
Equations
- rho.fixedVariables = {index : Fin n | rho index ≠ none}
Instances For
The number of variables fixed by a partial assignment.
Equations
- rho.fixedCount = rho.fixedVariables.card
Instances For
Every variable is either live or fixed, but not both.
The live and fixed variable sets are disjoint.
Live and fixed variables partition the input coordinates exactly.
Fixing one variable removes exactly that variable from the live set.
A one-variable assignment fixes exactly its selected coordinate.
The live variables after sequential refinement are the variables left live by both constituent partial assignments.
The variables fixed by a sequential refinement are exactly those fixed by either constituent assignment.
Sequential refinement cannot increase the number of live variables.
Refining by a one-variable assignment removes exactly that variable from the live set. If it was already fixed, the set is unchanged.
Fixing a currently live variable strictly decreases the live count.
If the second assignment fixes only variables left live by the first, their fixed-variable counts add under refinement.
Clearing exactly the support added by a refinement recovers the original restriction, provided the refinement fixed only previously live variables.
Under a refinement that fixes only live variables, the decrease in live count is exactly the second assignment's fixed count.
Inputs that agree on every live variable become equal after applying the partial assignment.
Restrict a scalar Boolean function by a partial assignment.
Instances For
Restricting twice agrees with restriction by sequential refinement.
A restricted scalar function depends only on variables left live.
Restrict every output of a Boolean target by a partial assignment.
Equations
- target.restrict rho = target.substitute rho.toInputSubstitution
Instances For
A restricted target depends only on variables left live.