Expr helpers #
Equations
Instances For
Equations
- Lean.Elab.Tactic.BVDecide.Frontend.Normalize.BitVec.mkInstMul w = Lean.mkApp (Lean.Expr.const `BitVec.instMul []) w
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct a literal of type BitVec w, with value n.
Equations
- Lean.Elab.Tactic.BVDecide.Frontend.Normalize.mkBitVecLit w n = Lean.mkApp2 (Lean.mkConst `BitVec.ofNat) w (Lean.mkNatLit n)
Instances For
Types #
Instances For
Bitvector operations that we perform AC canonicalization on.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an expression of an (unapplied) operation, return the decoded Op.
Return none if the expression is not a recognized operation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an application of a recognized binary operation (to two arguments),
return the decoded Op.
Return none if the expression is not an application of a recognized operation.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The identity / neutral element of given operation
Equations
Instances For
Equations
- Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Op.instToMessageData = { toMessageData := fun (op : Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Op) => Lean.toMessageData op.toExpr }
- op : Op
The associative and commutative operator we are currently canonicalizing with respect to.
- exprToVarIndex : Std.HashMap Expr VarIndex
Map from atomic expressions to an index.
Inverse of
exprToVarIndex, which maps aVarIndexto the expression it represents.
Instances For
We don't verify the state manipulations, but if we would, these are the invariants:
structure LegalVarState extends VarState where
/-- `varToExpr` and `exprToVarIndex` have the same number of elements. -/
h_size : varToExpr.size = exprToVarIndex.size
/-- `exprToVarIndex` is the inverse of `varToExpr`. -/
h_elems : ∀ h_lt : i < varToExpr.size, exprToVarIndex[varToExpr[i]]? = some i
A representation of an expression as a map from variable index to the number of occurrences of the expression represented by that variable.
See CoefficientsMap.toExpr for the explicit conversion.
Equations
Instances For
VarState monadic boilerplate #
Equations
Instances For
Equations
- x.run' s = StateT.run' x s
Instances For
Implementation #
Return the unique variable index for an expression, or none if the expression
is a neutral element (see isNeutral).
Modifies the monadic state to add a new mapping, if needed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return the expression that is represented by a specific variable index.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a binary, associative and commutative operation op,
decompose expression e into its variable coefficients.
For example a ⊕ b ⊕ (a ⊕ c) will give the coefficients:
a => 2
b => 1
c => 1
Any compound expression which is not an application of the given op will be
abstracted away and treated as a variable (see VarStateM.exprToVar).
Equations
Instances For
Compute the canonical expression for a given set of coefficients.
Returns none if all coefficients are zero.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an expression P lhs rhs, where lhs, rhs : ty and P : $ty → $ty → _,
canonicalize top-level applications of a recognized associative and commutative
operation on both the lhs and the rhs such that the final expression is:
P ($common ⊕ $lhs') ($common ⊕ $rhs')
That is, in a way that exposes terms that are shared between the lhs and rhs.
For example, x₁ * (y₁ * z) == x₂ * (y₂ * z) is normalized to
z * (x₁ * y₁) == z * (x₂ * y₂), pulling the shared variable z to the front on
both sides.
See Op.fromExpr? to see which operations are recognized.
Other operations are ignored, even if they are associative and commutative.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic Boilerplate #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.