Partial assignments and subcubes #
A consistent partial assignment is modelled as a function V → Option Bool:
none means the coordinate is free, some b means it is fixed to b. (Consistency
is automatic in this encoding.)
Main definitions, following Section 1.3 of bs_lambda.txt:
PartialAssign.Sat P x/PartialAssign.cube P— the subcubeC(P);PartialAssign.proj P x— the nearest-point projectionπ_C(x);PartialAssign.Conflict P Q v—PandQfixvto opposite values;PartialAssign.fixedSet P— the coordinates fixed byP;PartialAssign.codim P— its cardinality;PartialAssign.violSet P x— the fixed literals ofPviolated byx;PartialAssign.dist P x—dist(x, C(P)), the number of violated literals;PartialAssign.indUnion P— the indicator of the union of a family of subcubes.
The two directions relating a point to its projection are PartialAssign.isLeast_dist
(the projection realises the distance) and PartialAssign.eq_flipSet_proj_violSet
(the point is recovered from the projection by flipping the violated literals).
Adapted for Lean Pool from Timeroot/BS_Lam at commit
7bd39a8d41ee7910d3296d0477ad18f8fff9d870; ported to Lean Pool with proof and dependency cleanup.
A consistent partial assignment on the coordinate set V: none = free,
some b = fixed to b.
Equations
- BSLambda.PartialAssign V = (V → Option Bool)
Instances For
Satisfaction, projection and conflicts #
The nearest-point projection of x onto C(P): reset every violated fixed
coordinate, leave the free coordinates alone.
Instances For
The projection keeps the value P fixes, falling back on the value of x.
Conflict is an existential over Bool, hence decidable; providing the instance
keeps the Finset statements of Section 4 free of Classical.dec.
Equations
- One or more equations did not get rendered due to their size.
Points of two conflicting subcubes disagree at the conflict coordinate.
A point of the cube lies in at most one member of a pairwise conflicting family.
Two partial assignments that conflict nowhere have a common point: merge them, taking
the value of P where P fixes a coordinate and the value of Q elsewhere.
Converse of Conflict.disjoint_cube: disjoint subcubes come from a conflicting pair of
literals.
Equations
- P.instDecidableSat x = { decide := decide (∀ a ∈ Finset.univ, (fun (v : V) => ∀ (b : Bool), P v = some b → x v = b) a), reflects_decide := ⋯ }
The fixed coordinates and the codimension #
The codimension of the subcube C(P): the number of coordinates that P fixes.
Instances For
The defining equation for codim, so that call sites need not unfold the def.
Two points of the same subcube can only differ at a coordinate the subcube leaves free.
The violated literals and the distance to the subcube #
A point that agrees outside A with some point of C(P) violates no literal of P
outside A.
The distance to C(P) is realised by the projection.
No point of C(P) is closer to x than dist(x, C(P)).
Converse of Conflict.ne: a coordinate fixed by both P and Q at which two
satisfying points differ is a conflict coordinate.
The indicator of a union of subcubes #
The indicator of the union ⋃ i, C(P i) of a family of subcubes.
Equations
- BSLambda.PartialAssign.indUnion P x = decide (∃ (i : ι), (P i).Sat x)
Instances For
The subcube C(P) cut out by the partial assignment P.
Equations
- P.cube = {x : BSLambda.Input V | P.Sat x}
Instances For
dist(x, C(P)) really is the minimum Hamming distance to the subcube.
If P and Q conflict somewhere then their subcubes are disjoint.
Points, projections and flips #
Flipping a coordinate that P leaves free keeps the point inside C(P).
Every point is recovered from its projection onto C(P) by flipping exactly the
literals of P that it violates.
A point at distance one from C(P) is a single flip of its projection, at the unique
violated coordinate.
Two conflicting subcubes joined by a two-coordinate flip #
If x ∈ C(P), its {p, q}-flip lies in C(Q), P and Q conflict at q and Q
leaves p free, then q is the only literal of Q that x violates.
In the situation of violSet_eq_singleton_of_conflict, if instead P does fix p,
then the flipped point violates exactly the two literals p and q of P.