Return id e
Equations
- Lean.Meta.mkId e = do let type ← Lean.Meta.inferType e let u ← Lean.Meta.getLevel type pure (Lean.mkApp2 (Lean.mkConst (Lean.Name.mkStr1 "id") [u]) type e)
Given e
s.t. inferType e
is definitionally equal to expectedType
, return
term @id expectedType e
.
Equations
- Lean.Meta.mkExpectedTypeHint e expectedType = do let u ← Lean.Meta.getLevel expectedType pure (Lean.mkApp2 (Lean.mkConst (Lean.Name.mkStr1 "id") [u]) expectedType e)
Return a = b
.
Equations
- Lean.Meta.mkEq a b = do let aType ← Lean.Meta.inferType a let u ← Lean.Meta.getLevel aType pure (Lean.mkApp3 (Lean.mkConst (Lean.Name.mkStr1 "Eq") [u]) aType a b)
Return HEq a b
.
Equations
- One or more equations did not get rendered due to their size.
Return a proof of a = a
.
Equations
- Lean.Meta.mkEqRefl a = do let aType ← Lean.Meta.inferType a let u ← Lean.Meta.getLevel aType pure (Lean.mkApp2 (Lean.mkConst (Lean.Name.mkStr2 "Eq" "refl") [u]) aType a)
Return a proof of HEq a a
.
Equations
- Lean.Meta.mkHEqRefl a = do let aType ← Lean.Meta.inferType a let u ← Lean.Meta.getLevel aType pure (Lean.mkApp2 (Lean.mkConst (Lean.Name.mkStr2 "HEq" "refl") [u]) aType a)
Given hp : P
and nhp : Not P
returns an instance of type e
.
Equations
- Lean.Meta.mkAbsurd e hp hnp = do let p ← Lean.Meta.inferType hp let u ← Lean.Meta.getLevel e pure (Lean.mkApp4 (Lean.mkConst (Lean.Name.mkStr1 "absurd") [u]) p e hp hnp)
Given h : False
, return an instance of type e
.
Equations
- Lean.Meta.mkFalseElim e h = do let u ← Lean.Meta.getLevel e pure (Lean.mkApp2 (Lean.mkConst (Lean.Name.mkStr2 "False" "elim") [u]) e h)
Given h : a = b
, returns a proof of b = a
.
Equations
- One or more equations did not get rendered due to their size.
Given h₁ : a = b
and h₂ : b = c
returns a proof of a = c
.
Equations
- One or more equations did not get rendered due to their size.
Given f : α → β
and h : a = b
, returns a proof of f a = f b
.
Equations
- One or more equations did not get rendered due to their size.
Given h : f = g
and a : α
, returns a proof of f a = g a
.
Equations
- One or more equations did not get rendered due to their size.
Given h₁ : f = g
and h₂ : a = b
, returns a proof of f a = g b
.
Equations
- One or more equations did not get rendered due to their size.
Return the application constName xs
.
It tries to fill the implicit arguments before the last element in xs
.
Remark:
mkAppM `arbitrary #[α]
returns @arbitrary.{u} α
without synthesizing
the implicit argument occurring after α
.
Given a x : (([Decidable p] → Bool) × Nat
, mkAppM `Prod.fst #[x]
returns @Prod.fst ([Decidable p] → Bool) Nat x
Equations
- One or more equations did not get rendered due to their size.
Similar to mkAppM
, but takes an Expr
instead of a constant name.
Equations
- Lean.Meta.mkAppM' f xs = do let fType ← Lean.Meta.inferType f Lean.Meta.withAppBuilderTrace f xs (Lean.Meta.withNewMCtxDepth (Lean.Meta.mkAppMArgs f fType xs))
Similar to mkAppM
, but it allows us to specify which arguments are provided explicitly using Option
type.
Example:
Given Pure.pure {m : Type u → Type v} [Pure m] {α : Type u} (a : α) : m α
,
mkAppOptM `Pure.pure #[m, none, none, a]
returns a Pure.pure
application if the instance Pure m
can be synthesized, and the universe match.
Note that,
mkAppM `Pure.pure #[a]
fails because the only explicit argument (a : α)
is not sufficient for inferring the remaining arguments,
we would need the expected type.
Equations
- One or more equations did not get rendered due to their size.
Similar to mkAppOptM
, but takes an Expr
instead of a constant name
Equations
- Lean.Meta.mkAppOptM' f xs = do let fType ← Lean.Meta.inferType f Lean.Meta.withAppBuilderTrace f xs (Lean.Meta.withNewMCtxDepth (Lean.Meta.mkAppOptMAux f xs 0 #[] 0 #[] fType))
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Meta.mkEqMP eqProof pr = Lean.Meta.mkAppM (Lean.Name.mkStr2 "Eq" "mp") #[eqProof, pr]
Equations
- Lean.Meta.mkEqMPR eqProof pr = Lean.Meta.mkAppM (Lean.Name.mkStr2 "Eq" "mpr") #[eqProof, pr]
Equations
- One or more equations did not get rendered due to their size.
Given a monad
and e : α
, makes pure e
.
Equations
- Lean.Meta.mkPure monad e = Lean.Meta.mkAppOptM (Lean.Name.mkStr2 "Pure" "pure") #[some monad, none, none, some e]
mkProjection s fieldName
return an expression for accessing field fieldName
of the structure s
.
Remark: fieldName
may be a subfield of s
.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Meta.mkSorry type synthetic = do let u ← Lean.Meta.getLevel type pure (Lean.mkApp2 (Lean.mkConst (Lean.Name.mkStr1 "sorryAx") [u]) type (Lean.toExpr synthetic))
Return Decidable.decide p
Equations
- Lean.Meta.mkDecide p = Lean.Meta.mkAppOptM (Lean.Name.mkStr2 "Decidable" "decide") #[some p, none]
Return a proof for p : Prop
using decide p
Equations
- One or more equations did not get rendered due to their size.
Return a < b
Equations
- Lean.Meta.mkLt a b = Lean.Meta.mkAppM (Lean.Name.mkStr2 "LT" "lt") #[a, b]
Return a <= b
Equations
- Lean.Meta.mkLe a b = Lean.Meta.mkAppM (Lean.Name.mkStr2 "LE" "le") #[a, b]
Return Inhabited.default α
Equations
- Lean.Meta.mkDefault α = Lean.Meta.mkAppOptM (Lean.Name.mkStr2 "Inhabited" "default") #[some α, none]
Return @Classical.ofNonempty α _
Equations
- Lean.Meta.mkOfNonempty α = Lean.Meta.mkAppOptM (Lean.Name.mkStr2 "Classical" "ofNonempty") #[some α, none]
Return sorryAx type
Equations
- One or more equations did not get rendered due to their size.
Return funext h
Equations
- Lean.Meta.mkFunExt h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "funext") #[h]
Return propext h
Equations
- Lean.Meta.mkPropExt h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "propext") #[h]
Return let_congr h₁ h₂
Equations
- Lean.Meta.mkLetCongr h₁ h₂ = Lean.Meta.mkAppM (Lean.Name.mkStr1 "let_congr") #[h₁, h₂]
Return let_val_congr b h
Equations
- Lean.Meta.mkLetValCongr b h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "let_val_congr") #[b, h]
Return let_body_congr a h
Equations
- Lean.Meta.mkLetBodyCongr a h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "let_body_congr") #[a, h]
Return of_eq_true h
Equations
- Lean.Meta.mkOfEqTrue h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "of_eq_true") #[h]
Return eq_true h
Equations
- Lean.Meta.mkEqTrue h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "eq_true") #[h]
Return eq_false h
h
must have type definitionally equal to ¬ p
in the current
reducibility setting.
Equations
- Lean.Meta.mkEqFalse h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "eq_false") #[h]
Return eq_false' h
h
must have type definitionally equal to p → False
in the current
reducibility setting.
Equations
- Lean.Meta.mkEqFalse' h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "eq_false'") #[h]
Equations
- Lean.Meta.mkImpCongr h₁ h₂ = Lean.Meta.mkAppM (Lean.Name.mkStr1 "implies_congr") #[h₁, h₂]
Equations
- Lean.Meta.mkImpCongrCtx h₁ h₂ = Lean.Meta.mkAppM (Lean.Name.mkStr1 "implies_congr_ctx") #[h₁, h₂]
Equations
- Lean.Meta.mkImpDepCongrCtx h₁ h₂ = Lean.Meta.mkAppM (Lean.Name.mkStr1 "implies_dep_congr_ctx") #[h₁, h₂]
Equations
- Lean.Meta.mkForallCongr h = Lean.Meta.mkAppM (Lean.Name.mkStr1 "forall_congr") #[h]
Return instance for [Monad m]
if there is one
Equations
- One or more equations did not get rendered due to their size.
Return (n : type)
, a numeric literal of type type
. The method fails if we don't have an instance OfNat type n
Equations
- One or more equations did not get rendered due to their size.
Return a + b
using a heterogeneous +
. This method assumes a
and b
have the same type.
Equations
- Lean.Meta.mkAdd a b = Lean.Meta.mkBinaryOp (Lean.Name.mkStr1 "HAdd") (Lean.Name.mkStr2 "HAdd" "hAdd") a b
Return a - b
using a heterogeneous -
. This method assumes a
and b
have the same type.
Equations
- Lean.Meta.mkSub a b = Lean.Meta.mkBinaryOp (Lean.Name.mkStr1 "HSub") (Lean.Name.mkStr2 "HSub" "hSub") a b
Return a * b
using a heterogeneous *
. This method assumes a
and b
have the same type.
Equations
- Lean.Meta.mkMul a b = Lean.Meta.mkBinaryOp (Lean.Name.mkStr1 "HMul") (Lean.Name.mkStr2 "HMul" "hMul") a b
Return a ≤ b
. This method assumes a
and b
have the same type.
Equations
- Lean.Meta.mkLE a b = Lean.Meta.mkBinaryRel (Lean.Name.mkStr1 "LE") (Lean.Name.mkStr2 "LE" "le") a b
Return a < b
. This method assumes a
and b
have the same type.
Equations
- Lean.Meta.mkLT a b = Lean.Meta.mkBinaryRel (Lean.Name.mkStr1 "LT") (Lean.Name.mkStr2 "LT" "lt") a b