Skip to main content

Subcube

Struct Subcube 

Source
pub struct Subcube {
    pub n: usize,
    pub care: u64,
    pub value: u64,
}
Expand description

A subcube of {0,1}ⁿ: the coordinates set in care are fixed to the matching bits of value; the rest are free. As a blocker it is the footprint of one clause — the corners that falsify it. (Pnp.lean’s Blocker, generalized from clean 3-bit faces to any width.)

Fields§

§n: usize§care: u64

Bitmask of the fixed (“cared-about”) coordinates — the blocker’s support.

§value: u64

Required values on the fixed coordinates; bits outside care are held at 0.

Implementations§

Source§

impl Subcube

Source

pub fn blocker(clause: &[Lit], n: usize) -> Subcube

The blocker of a clause: the subcube of corners that set every literal false. A positive literal xᵥ is false at c[v]=0; a negative literal ¬xᵥ is false at c[v]=1. So care is the clause’s variable set and value’s bit v is set exactly for the negative literals.

Source

pub fn covers(&self, corner: Corner) -> bool

Does this subcube contain corner? (Pnp.lean’s Blocker.Covers — is the clause falsified at this corner?)

Source

pub fn dimension(&self) -> usize

The number of free coordinates — the subcube’s dimension as a face (n - |support|).

Source

pub fn footprint_card(&self) -> u64

How many corners this blocker forbids: 2^dimension (the footprint cardinality).

Source

pub fn clause_literals(&self) -> Vec<(usize, bool)>

Recover the clause this blocker is the footprint of — the inverse of Subcube::blocker. A fixed coordinate v appears positively when value’s bit is 0 (the clause is falsified at v=0) and negatively when it is 1. Round-tripping a clause through blocker and back is the proof that the geometric representation loses nothing.

Source

pub fn clause_lp_value(&self, point: &[f64]) -> f64

The LP value of this blocker’s clause at a fractional point of [0,1]ⁿ: Σ over literals of x (positive) or 1−x (negative). The clause’s relaxation is satisfied iff the value is ≥ 1. At the ½-center every literal contributes ½, so the value is width/2 — satisfied iff width ≥ 2.

Source

pub fn resolve(&self, other: &Subcube) -> Option<(usize, Subcube)>

Resolve two blockers — the geometry of clause resolution, the engine of “rules beget rules.” Two blockers resolve when their fixed coordinates agree everywhere except a single pivot where they take opposite values (one clause carries the pivot literal, the other its negation, with no other clashing literal). The resolvent is the merged blocker with the pivot freed — a new rule derived from the two neighbors, exactly the Quine–McCluskey adjacency of two implicants. Returns (pivot, resolvent), or None when there is no single clean pivot (no opposite literal, or a second clash making the resolvent a tautology).

Source

pub fn footprint(&self) -> Vec<Corner>

Enumerate the blocked corners — the full footprint. Only sensible for small dimension.

Trait Implementations§

Source§

impl Clone for Subcube

Source§

fn clone(&self) -> Subcube

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Subcube

Source§

impl Debug for Subcube

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Subcube

Source§

impl Hash for Subcube

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Subcube

Source§

fn cmp(&self, other: &Subcube) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Subcube

Source§

fn eq(&self, other: &Subcube) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Subcube

Source§

fn partial_cmp(&self, other: &Subcube) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Subcube

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.