@[inline]
Equations
- Lean.Expr.const? e = match e with | Lean.Expr.const n us x => some (n, us) | x => none
@[inline]
Equations
- Lean.Expr.app1? e fName = if Lean.Expr.isAppOfArity e fName 1 = true then some (Lean.Expr.appArg! e) else none
@[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
@[inline]
Equations
- Lean.Expr.app3? e fName = if Lean.Expr.isAppOfArity e fName 3 = true then some (Lean.Expr.appArg! (Lean.Expr.appFn! (Lean.Expr.appFn! e)), Lean.Expr.appArg! (Lean.Expr.appFn! e), Lean.Expr.appArg! e) else none
@[inline]
Equations
- Lean.Expr.app4? e fName = if Lean.Expr.isAppOfArity e fName 4 = true then some (Lean.Expr.appArg! (Lean.Expr.appFn! (Lean.Expr.appFn! (Lean.Expr.appFn! e))), Lean.Expr.appArg! (Lean.Expr.appFn! (Lean.Expr.appFn! e)), Lean.Expr.appArg! (Lean.Expr.appFn! e), Lean.Expr.appArg! e) else none
@[inline]
Equations
- Lean.Expr.eq? p = Lean.Expr.app3? p `Eq
@[inline]
Equations
- Lean.Expr.ne? p = Lean.Expr.app3? p `Ne
@[inline]
Equations
- Lean.Expr.iff? p = Lean.Expr.app2? p `Iff
@[inline]
Equations
- Lean.Expr.not? p = Lean.Expr.app1? p `Not
@[inline]
Equations
- Lean.Expr.notNot? p = match Lean.Expr.not? p with | some p => Lean.Expr.not? p | none => none
@[inline]
Equations
- Lean.Expr.and? p = Lean.Expr.app2? p `And
@[inline]
Equations
- Lean.Expr.heq? p = Lean.Expr.app4? p `HEq
Equations
- Lean.Expr.natAdd? e = Lean.Expr.app2? e `Nat.add
@[inline]
Equations
- Lean.Expr.arrow? x = match x with | Lean.Expr.forallE x α β x_1 => if Lean.Expr.hasLooseBVars β = true then none else some (α, β) | x => none
Equations
- Lean.Expr.isEq e = Lean.Expr.isAppOfArity e `Eq 3
Equations
- Lean.Expr.isHEq e = Lean.Expr.isAppOfArity e `HEq 4
Equations
- Lean.Expr.isIte e = Lean.Expr.isAppOfArity e `ite 5
Equations
- Lean.Expr.isDIte e = Lean.Expr.isAppOfArity e `dite 5
Equations
- Lean.Expr.listLit? e = (fun loop => loop e []) Lean.Expr.listLit?.loop
Equations
- Lean.Expr.arrayLit? e = match Lean.Expr.app2? e `List.toArray with | some (x, e) => Lean.Expr.listLit? e | none => none
Equations
- Lean.Expr.prod? e = Lean.Expr.app2? e `Prod
Equations
- Lean.Expr.isConstructorApp? env e = match e with | Lean.Expr.lit (Lean.Literal.natVal n) x => if (n == 0) = true then Lean.Expr.getConstructorVal? env `Nat.zero else Lean.Expr.getConstructorVal? env `Nat.succ | x => match Lean.Expr.getAppFn e with | Lean.Expr.const n x x_1 => match Lean.Expr.getConstructorVal? env n with | some v => if (v.numParams + v.numFields == Lean.Expr.getAppNumArgs e) = true then some v else none | none => none | x => none
Equations
- Lean.Expr.isConstructorApp env e = Option.isSome (Lean.Expr.isConstructorApp? env e)
Equations
- Lean.Expr.constructorApp? env e = OptionM.run (match e with | Lean.Expr.lit (Lean.Literal.natVal n) x => if (n == 0) = true then do let v ← Lean.Expr.getConstructorVal? env `Nat.zero pure (v, #[]) else do let v ← Lean.Expr.getConstructorVal? env `Nat.succ pure (v, #[Lean.mkNatLit (n - 1)]) | x => match Lean.Expr.getAppFn e with | Lean.Expr.const n x x_1 => do let v ← Lean.Expr.getConstructorVal? env n if (v.numParams + v.numFields == Lean.Expr.getAppNumArgs e) = true then pure (v, Lean.Expr.getAppArgs e) else none | x => none)