Canonical switching-path advice #
This module turns a typed canonical DNF path trace into the local data used by the switching-lemma injection. Each query is annotated with
- its position in the selected source term,
- whether it closes the current term block,
- whether the original path bit differs from the satisfying literal value, and
- the value satisfying that source literal.
Only the first three fields become finite advice. The queried coordinate and satisfying value remain internal witnesses used to define the output restriction and prove reconstruction. No paths or circuits are enumerated.
Deterministic Boolean value extracted from a literal requirement. On the support of the literal set this is its unique satisfying value.
Equations
- set.satisfyingValue index = (set.requirements index).getD false
Instances For
One symbol of switching advice. The position names a variable within the currently selected source term.
- position : Fin widthBound
Zero-based position in the selected source term's ordered support.
- closesBlock : Bool
Whether this query is the last one in the current source-term block.
- difference : Bool
Whether the path bit differs from the selected literal's satisfying value.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Algebraic.AC0.Switching.instFintypeQueryAdvice = Fintype.ofEquiv ((_ : Fin widthBound✝) × (_ : Bool) × Bool) (Algebraic.AC0.Switching.QueryAdvice.proxyTypeEquiv widthBound✝)
Recover the original path bit from its value relative to the selected literal's satisfying value.
Equations
- advice.decodeValue satisfyingValue = (satisfyingValue ^^ advice.difference)
Instances For
Encoding a path bit by its difference from the satisfying value and then decoding it recovers that path bit.
Fixed-length switching advice.
Equations
- Algebraic.AC0.Switching.Advice widthBound pathLength = (Fin pathLength → Algebraic.AC0.Switching.QueryAdvice widthBound)
Instances For
Internal annotation of one canonical query. The source term, coordinate, and satisfying value are deliberately not part of the finite advice.
- term : Term n
Source term selected for this block.
- index : Fin n
Coordinate queried at this step.
- satisfyingValue : Bool
Value that satisfies the source literal at
index. - advice : QueryAdvice widthBound
Finite symbol retained by the switching encoding.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The two local facts needed to decode an internal query record: its hidden value satisfies the named literal, and its public position selects the hidden coordinate from the source term.
Equations
- record.WellFormed = (record.term.requirements record.index = some record.satisfyingValue ∧ (Algebraic.AC0.LiteralSet.orderedSupport record.term)[↑record.advice.position]? = some record.index)
Instances For
The internal query record's satisfying assignment step.
Equations
- record.satisfyingStep = { index := record.index, value := record.satisfyingValue }
Instances For
Forget the internal fields of a query record.
Instances For
Query advice is exactly a bounded position and two bits.
Equations
- One or more equations did not get rendered due to their size.
Instances For
There are exactly 4 * widthBound possible symbols per query.
Fixed-length advice has the exact cardinality used by the weighted switching calculation.
Reindex a list of known length as a fixed finite function.
Equations
- Algebraic.AC0.Switching.listToFn values length_eq index = values.get (Fin.cast ⋯ index)
Instances For
Choose the source term currently being decoded. A term is retained inside a block; at a block boundary the canonical first-surviving selector is run on the replay state.
Equations
- Algebraic.AC0.Switching.selectTerm formula state (some term) = some term
- Algebraic.AC0.Switching.selectTerm formula state none = formula.firstSurviving state
Instances For
Replay switching advice and recover its queried coordinates. Malformed advice is handled totally by returning the successfully decoded prefix.
Equations
Instances For
Decode an encoded restriction/advice pair by replaying its coordinates and clearing them from the refined restriction.
Equations
- Algebraic.AC0.Switching.decode formula encoded = encoded.1.clear (Algebraic.AC0.Switching.replayIndices formula encoded.1 none (List.ofFn encoded.2)).toFinset
Instances For
If the canonical selector returns term, replay from a block boundary is
the same as replay with term already selected.
Position of a coordinate in a source term, reduced into the declared width bound. Valid traced queries are proved below to lie below the bound, so the reduction does not change their position.
Equations
- set.sourcePosition index = Fin.ofNat widthBound (List.idxOf index set.orderedSupport)
Instances For
A support coordinate's extracted Boolean value is its literal's required value.
The ordered support lists each support coordinate exactly once, so its length is the literal-set width.
For a valid bounded term coordinate, reduction modulo the width bound is inert.
Decoding a valid bounded source position recovers its coordinate.
Assigning a live support coordinate its satisfying value preserves nonconflict with the literal set.
Once a nonconflicting literal set has no live support, no later refinement can create a conflict with it.
A refinement cannot falsify a nonconflicting literal set when every value it adds on the set's live support is either absent or the satisfying value.
Fixing the head of a live-support list removes exactly that coordinate.
Annotate all queries in a canonical trace.
Equations
- (Algebraic.AC0.DNF.CanonicalTrace.nil rho).queryRecords = []
- (Algebraic.AC0.DNF.CanonicalTrace.start found support_eq nonempty block).queryRecords = block.queryRecords
Instances For
Annotate the queries remaining in one canonical source-term block.
Equations
- One or more equations did not get rendered due to their size.
- (Algebraic.AC0.DNF.CanonicalBlockTrace.nil rho index rest).queryRecords = []
Instances For
The satisfying query transcript underlying the output assignment.
Equations
Instances For
Satisfying transcript for the remaining queries of one source-term block.
Equations
Instances For
Satisfying assignment placed into the injection's output restriction.
Equations
Instances For
Satisfying assignment for the remaining queries of one source-term block.
Equations
Instances For
Variable-length advice before it is reindexed by the prescribed path length.
Equations
Instances For
Variable-length advice for the remaining queries in one source-term block.
Equations
Instances For
Query-record coordinates agree exactly with the original path coordinates.
The same coordinate agreement while traversing a source-term block.
Every record extracted from a width-bounded canonical trace carries a genuine satisfying literal value and a correctly decodable source position.
The record invariant while traversing one source-term block.
The satisfying transcript queries precisely the original path's coordinates, changing only their Boolean values.
The satisfying assignment fixes the same coordinates as the original path assignment.
Variable-length advice has one symbol per original path query.
Fixed-length advice associated to a trace whose path has the prescribed length.
Equations
- trace.advice length_eq = Algebraic.AC0.Switching.listToFn trace.adviceList ⋯
Instances For
Listing fixed-length trace advice recovers the original advice list.
On every pending coordinate, a block's satisfying assignment either leaves the variable live or assigns the selected term's satisfying value.
Satisfying all queries remaining in one source-term block never falsifies
that term. The invariant support_eq says precisely which of its source
coordinates are still live at the current state.
A source term surviving at the start of a canonical trace still survives after the trace's satisfying assignment is added.
The first-surviving source-term selector is unchanged when the satisfying assignment extracted from the trace is added. This is the selector equation used by the reconstruction decoder.
Replaying the advice extracted from a satisfying canonical trace recovers the original path's query coordinates exactly.
The replay invariant inside one selected source-term block.
A traced satisfying assignment fixes exactly the prescribed canonical path length.
A traced satisfying assignment fixes only variables live before the path began.
The explicit replay-and-clear decoder is a left inverse of every valid canonical trace encoding.