The implementation type of DIMACS variables (hence the "I" in IVar).
In DIMACS, variables are represented by strictly positive integers. We attach the positivity-hypothesis as a subtype here.
This type is the exact same as the one for PNat in Mathlib
(see Data.PNat.Defs.lean).
We redefine it here to avoid the dependency on Mathlib,
and also in case we want to change the backing type to UInt64 in the future.
Instances For
Equations
The implementation type of DIMACS literals (hence the "I" in ILit).
In DIMACS, literals are non-zero integers, with negative numbers variables with an optional negation. We represent them as integers, with the invariant that they are non-zero.
Instances For
Equations
index #
Equations
- Trestle.IVar.instInhabited = { default := ⟨1, Trestle.IVar.instInhabited._proof_1⟩ }
Equations
- Trestle.IVar.instToString = { toString := Trestle.IVar.toString }
Equations
- Trestle.IVar.instHashable = { hash := fun (v : Trestle.IVar) => hash v.val }
Equations
- Trestle.IVar.instOrd = { compare := fun (a b : Trestle.IVar) => compare a.val b.val }
Equations
- Trestle.IVar.instLT = { lt := fun (a b : Trestle.IVar) => a.val < b.val }
Equations
- Trestle.IVar.instLE = { le := fun (a b : Trestle.IVar) => a.val ≤ b.val }
Equations
- Trestle.IVar.instCoeIVar = { coe := fun (v : Trestle.IVar) => v.toPosILit }
Equations
- Trestle.ILit.instInhabited = { default := ⟨1, Trestle.ILit.instInhabited._proof_1⟩ }
Equations
- Trestle.ILit.instHashable = { hash := fun (v : Trestle.ILit) => hash v.val }
Equations
- Trestle.ILit.instOrd = { compare := fun (a b : Trestle.ILit) => compare a.val b.val }
Equations
- Trestle.ILit.instCoeInt = { coe := fun (v : Trestle.ILit) => v.val }
Equations
- Trestle.ILit.instToString = { toString := Trestle.ILit.toString }
Equations
- Trestle.ILit.instCoeToIVar = { coe := fun (v : Trestle.ILit) => v.toIVar }
Equations
- Trestle.ILit.instCoeOfIVar = { coe := fun (v : Trestle.IVar) => Trestle.ILit.ofIVar v }
Equations
- Trestle.ILit.toNat ⟨l, property⟩ = l.natAbs
Instances For
Returns true iff the literal is positive.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- Trestle.ILit.instNeg = { neg := Trestle.LitVar.negate }
index #
Equations
Instances For
Equations
Instances For
Equations
Instances For
Finds the maximum DIMACS variable in a clause. If the clause is empty, then 0 is returned.
Equations
- C.maxVar = Array.foldl max 0 (Array.map Trestle.ILit.toNat C)
Instances For
Finds the maximum DIMACS variable in the CNF. If there are no variables in the formula, then 0 is returned.
Equations
- F.maxVar = Array.foldl max 0 (Array.map Trestle.IClause.maxVar F)