@[inline]
Equations
- Lean.Expr.const? e = match e with | Lean.Expr.const n us => some (n, us) | x => none
Instances For
@[inline]
Equations
- Lean.Expr.app1? e fName = if Lean.Expr.isAppOfArity e fName 1 = true then some (Lean.Expr.appArg! e) else none
Instances For
@[inline]
Equations
- Lean.Expr.app2? e fName = if Lean.Expr.isAppOfArity e fName 2 = true then some (Lean.Expr.appArg! (Lean.Expr.appFn! e), Lean.Expr.appArg! e) else none
Instances For
@[inline]
Equations
- Lean.Expr.eqOrIff? p = match Lean.Expr.app3? p `Eq with | some (fst, lhs, rhs) => some (lhs, rhs) | x => Lean.Expr.iff? p
Instances For
@[inline]
Equations
- Lean.Expr.notNot? p = match Lean.Expr.not? p with | some p => Lean.Expr.not? p | none => none
Instances For
Equations
- Lean.Expr.natAdd? e = Lean.Expr.app2? e `Nat.add
Instances For
@[inline]
Equations
- Lean.Expr.arrow? x = match x with | Lean.Expr.forallE binderName α β binderInfo => if Lean.Expr.hasLooseBVars β = true then none else some (α, β) | x => none
Instances For
Equations
- Lean.Expr.isEq e = Lean.Expr.isAppOfArity e `Eq 3
Instances For
Equations
- Lean.Expr.isHEq e = Lean.Expr.isAppOfArity e `HEq 4
Instances For
Equations
- Lean.Expr.isIte e = Lean.Expr.isAppOfArity e `ite 5
Instances For
Equations
- Lean.Expr.isDIte e = Lean.Expr.isAppOfArity e `dite 5
Instances For
Equations
Instances For
Equations
- Lean.Expr.arrayLit? e = if Lean.Expr.isAppOfArity' e `List.toArray 2 = true then Lean.Expr.listLit? (Lean.Expr.appArg!' e) else none
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Expr.isConstructorApp env e = Option.isSome (Lean.Expr.isConstructorApp? env e)
Instances For
def
Lean.Expr.constructorApp?
(env : Lean.Environment)
(e : Lean.Expr)
(useRaw : optParam Bool false)
:
If e
is a constructor application, return a pair containing the corresponding ConstructorVal
and the constructor
application arguments.
This function treats numerals as constructors. For example, if e
is the numeral 2
, the result pair
is ConstructorVal
for Nat.succ
, and the array #[1]
. The parameter useRaw
controls how the resulting
numeral is represented. If useRaw := false
, then mkNatLit
is used, otherwise mkRawNatLit
.
Recall that mkNatLit
uses the OfNat.ofNat
application which is the canonical way of representing numerals
in the elaborator and tactic framework. We useRaw := false
in the compiler (aka code generator).
Equations
- One or more equations did not get rendered due to their size.