Safe implementation of physically equivalence for Expr.
Equations
- Blaster.Optimize.exprEq op1 op2 = (op1 == op2)
Instances For
Equations
- Blaster.Optimize.instantiate1' e subst = if e.hasLooseBVars = true then e.instantiate1 subst else e
Instances For
Return true if e contains free / bounded variables.
Equations
- Blaster.Optimize.hasVars e = (e.hasFVar || e.hasLooseBVars)
Instances For
Instances For
Return true iff e contains a free variable v.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Return true if v occurs at least once in e.
Equations
Instances For
If the e is a sequence of lambda fun x₁ => fun x₂ => ... fun xₙ => b,
return b. Otherwise return e.
Equations
- Blaster.Optimize.getLambdaBody (Lean.Expr.lam binderName binderType b binderInfo) = Blaster.Optimize.getLambdaBody b
- Blaster.Optimize.getLambdaBody e = e
Instances For
Determine if e is a boolean not expression and return its corresponding argument.
Otherwise return none.
Equations
- Blaster.Optimize.boolNot? ((Lean.Expr.const `Bool.not us).app n) = some n
- Blaster.Optimize.boolNot? e = none
Instances For
Determine if e is a boolean and expression and return its corresponding argument.
Otherwise return none.
Equations
- Blaster.Optimize.boolAnd? (((Lean.Expr.const `Bool.and us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.boolAnd? e = none
Instances For
Determine if e is a boolean or expression and return its corresponding argument.
Otherwise return none.
Equations
- Blaster.Optimize.boolOr? (((Lean.Expr.const `Bool.or us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.boolOr? e = none
Instances For
Determine if e is a Bool literal expression b and return some b.
Otherwise none
Equations
- Blaster.Optimize.isBoolValue? (Lean.Expr.const `Bool.true us) = some true
- Blaster.Optimize.isBoolValue? (Lean.Expr.const `Bool.false us) = some false
- Blaster.Optimize.isBoolValue? e = none
Instances For
Return true only when e is a Bool literal. Otherwise false`
Equations
- Blaster.Optimize.isBoolCtor (Lean.Expr.const `Bool.true us) = true
- Blaster.Optimize.isBoolCtor (Lean.Expr.const `Bool.false us) = true
- Blaster.Optimize.isBoolCtor e = false
Instances For
Determine if e is an boolean == expression and return its corresponding arguments.
Otherwise return none.
Equations
Instances For
Determine if e is an Eq expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.eq? ((((Lean.Expr.const `Eq us).app psort).app e1).app e2) = some (psort, e1, e2)
- Blaster.Optimize.eq? e = none
Instances For
Determine if e is an LE.le expression and return its corresponding arguments.
Otherwise return none.
Equations
Instances For
Determine if e is an LT.lt expression and return its corresponding arguments.
Otherwise return none.
Equations
Instances For
Determine if e is an Not expression and return its corresponding argument.
Otherwise return none.
Equations
- Blaster.Optimize.propNot? ((Lean.Expr.const `Not us).app n) = some n
- Blaster.Optimize.propNot? e = none
Instances For
Determine if e is an And expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.propAnd? (((Lean.Expr.const `And us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.propAnd? e = none
Instances For
Determine if e is an Or expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.propOr? (((Lean.Expr.const `Or us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.propOr? e = none
Instances For
Return true when e1 := ¬ ne ∧ ne =ₚₜᵣ e2. Otherwise false.
Equations
- Blaster.Optimize.isNotExprOf e1 e2 = match Blaster.Optimize.propNot? e1 with | some op => Blaster.Optimize.exprEq e2 op | x => false
Instances For
Return true when e1 := not ne ∧ ne =ₚₜᵣ e2. Otherwise false.
Equations
- Blaster.Optimize.isBoolNotExprOf e1 e2 = match Blaster.Optimize.boolNot? e1 with | some op => Blaster.Optimize.exprEq e2 op | x => false
Instances For
Return true when e1 := false = c ∧ e2 := true = c.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return true if the given expression is of the form const ``Bool.
Equations
Instances For
Return true if the given expression is of the form const ``Nat.
Equations
Instances For
Return true if the given expression is of the form const ``Int.
Equations
Instances For
Return true if the given expression is of the form const ``String.
Equations
Instances For
Determine if e is an autoParam expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.autoParam? (((Lean.Expr.const `autoParam us).app t).app tac) = some (t, tac)
- Blaster.Optimize.autoParam? e = none
Instances For
Return true only when e is a Nat literal expression Expr.lit (Literal.natVal n)
Equations
Instances For
Determine if e is a String literal expression Expr.lit (Literal.strVal s)
and return some s as result. Otherwise return none.
Equations
Instances For
Determine if e is a UInt32 literal expression UInt32.mk (Fin.mk UInt32.size n isLt)
and return some n only when n < UInt32.size.
Otherwise return none
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.isUInt32Value? ((Lean.Expr.const `UInt32.ofBitVec us).app (((Lean.Expr.const `BitVec.ofFin us_1).app arg).app fn2)) = none
- Blaster.Optimize.isUInt32Value? ((Lean.Expr.const `UInt32.ofBitVec us).app fn1) = none
- Blaster.Optimize.isUInt32Value? e = none
Instances For
Determine if e is a Char literal expression Char.mk (UInt32.mk (Fin.mk UInt32.size n isLt)
and return some Char.ofNat n) only when Nat.isValidChar n.
Otherwise return none
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.isCharValue? e = none
Instances For
Return true if e := Nat.add e1 e2. Otherwise return false.
Note that true is returned only when e is a fully applied `Nat.add expression.
Equations
- Blaster.Optimize.isNatAddExpr (((Lean.Expr.const `Nat.add us).app arg).app arg_1) = true
- Blaster.Optimize.isNatAddExpr e = false
Instances For
Return true if e := Nat.sub e1 e2. Otherwise return false.
Note that true is returned only when e is a fully applied `Nat.sub expression.
Equations
- Blaster.Optimize.isNatSubExpr (((Lean.Expr.const `Nat.sub us).app arg).app arg_1) = true
- Blaster.Optimize.isNatSubExpr e = false
Instances For
Return true if e := Nat.pow e1 e2. Otherwise return false.
Note that true is returned only when e is a fully applied `Nat.pow expression.
Equations
- Blaster.Optimize.isNatPowExpr (((Lean.Expr.const `Nat.pow us).app arg).app arg_1) = true
- Blaster.Optimize.isNatPowExpr e = false
Instances For
Determine if e is a Nat.mul expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.natMul? (((Lean.Expr.const `Nat.mul us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.natMul? e = none
Instances For
Determine if e is a Nat.add expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.natAdd? (((Lean.Expr.const `Nat.add us).app arg).app arg_1) = some (arg, arg_1)
- Blaster.Optimize.natAdd? e = none
Instances For
Determine if e is a Nat.sub expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.natSub? (((Lean.Expr.const `Nat.sub us).app arg).app arg_1) = some (arg, arg_1)
- Blaster.Optimize.natSub? e = none
Instances For
Determine if e is a Nat.pow expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.natPow? (((Lean.Expr.const `Nat.pow us).app arg).app arg_1) = some (arg, arg_1)
- Blaster.Optimize.natPow? e = none
Instances For
Return some (f, op1, op2) when e is a binary operator. Otherwise none.
Equations
Instances For
Determine if e is an Int.neg expression and return its corresponding argument.
Otherwise return none.
Equations
- Blaster.Optimize.intNeg? ((Lean.Expr.const `Int.neg us).app n) = some n
- Blaster.Optimize.intNeg? e = none
Instances For
Determine if e is a Int.add expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.intAdd? (((Lean.Expr.const `Int.add us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.intAdd? e = none
Instances For
Determine if e is a Int.mul expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.intMul? (((Lean.Expr.const `Int.mul us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.intMul? e = none
Instances For
Determine if e is a Int.tdiv expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.intTDiv? (((Lean.Expr.const `Int.tdiv us).app op1).app op2) = some (op1, op2)
- Blaster.Optimize.intTDiv? e = none
Instances For
Return true when e1 := -ne ∧ ne =ₚₜᵣ e2. Otherwise false.
Equations
- Blaster.Optimize.isIntNegExprOf e1 e2 = match Blaster.Optimize.intNeg? e1 with | some op => Blaster.Optimize.exprEq e2 op | x => false
Instances For
Determine if e is a Blaster.decide' expression and return its corresponding arguments.
Otherwise return none.
Equations
- Blaster.Optimize.decide'? ((Lean.Expr.const `Blaster.decide' us).app op) = some op
- Blaster.Optimize.decide'? e = none
Instances For
Determine if e is an Blaster.ite' expression and return its corresponding arguments.
Otherwise return none.
Equations
Instances For
Determine if e is an Blaster.dite' expression and return its corresponding arguments.
Otherwise return none.
Equations
Instances For
Return true only when e := Expr.const ``Blaster.dite' _
Otherwise false.
Equations
- Blaster.Optimize.isBlasterDiteConst (Lean.Expr.const `Blaster.dite' us) = true
- Blaster.Optimize.isBlasterDiteConst e = false
Instances For
Return true only when e is a Int expression corresponding to one of the following:
Int.ofNat (Expr.lit (Literal.natVal n))Int.negSucc (Expr.lit (Literal.natVal n))
Equations
- Blaster.Optimize.isIntValue ((Lean.Expr.const `Int.ofNat us).app a) = if Blaster.Optimize.isNatValue a = true then true else false
- Blaster.Optimize.isIntValue ((Lean.Expr.const `Int.negSucc us).app a) = if Blaster.Optimize.isNatValue a = true then true else false
- Blaster.Optimize.isIntValue (f.app a) = if Blaster.Optimize.isNatValue a = true then false else false
- Blaster.Optimize.isIntValue e = false
Instances For
Determine if e is a Int expression corresponding to one of the following:
Int.ofNat (Expr.lit (Literal.natVal n))Int.negSucc (Expr.lit (Literal.natVal n))Return eithersome (Int.ofNat n)orsome (Int.negSucc n)as result. Otherwise returnnoneNOTE: This function is to be used only when it is guaranteed thatNat.zerohas been normalized toExpr.lit (Literal.natVal 0).
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.isIntValue? e = none
Instances For
Given e of the form ∀ (a₁ : A₁) ... (aₙ : Aₙ), B[a₁, ..., aₙ]
and p₁ : A₁, ... pₘ : Aₙ, return B[p₁, ..., pₘ].
Equations
- Blaster.Optimize.betaForAll e args = Blaster.Optimize.betaForAll.visit args 0 e
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.betaLambda.visit args finish e i = if i < args.size then Lean.mkAppN (finish e i) (args.extract i) else finish e i
Instances For
(fun x => e) a ==> e[x/a].
Equations
Instances For
Return true only when e is a FVar of type ∀ α₀ → ... → αₙ.
Equations
- Blaster.Optimize.isQuantifiedFun (Lean.Expr.fvar v) = do let __do_lift ← v.getType pure __do_lift.isForall
- Blaster.Optimize.isQuantifiedFun e = pure false