Returns 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 `id [u]) type e)
Instances For
Equations
- Lean.Meta.mkExpectedTypeHintCore e expectedType expectedTypeUniv = Lean.mkApp2 (Lean.mkConst `id [expectedTypeUniv]) expectedType e
Instances For
Given proof s.t. inferType proof is definitionally equal to expectedProp, returns
term @id expectedProp proof.
Equations
- Lean.Meta.mkExpectedPropHint proof expectedProp = Lean.Meta.mkExpectedTypeHintCore proof expectedProp Lean.levelZero
Instances For
Given e s.t. inferType e is definitionally equal to expectedType, returns
term @id expectedType e.
Equations
- Lean.Meta.mkExpectedTypeHint e expectedType = do let u ← Lean.Meta.getLevel expectedType pure (Lean.Meta.mkExpectedTypeHintCore e expectedType u)
Instances For
Returns 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 `Eq [u]) aType a b)
Instances For
Returns a ≍ b.
Equations
- Lean.Meta.mkHEq a b = do let aType ← Lean.Meta.inferType a let bType ← Lean.Meta.inferType b let u ← Lean.Meta.getLevel aType pure (Lean.mkApp4 (Lean.mkConst `HEq [u]) aType a bType b)
Instances For
If a and b have definitionally equal types, returns a = b, otherwise returns a ≍ b.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns 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 `Eq.refl [u]) aType a)
Instances For
Returns a proof of 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 `HEq.refl [u]) aType a)
Instances For
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 `absurd [u]) p e hp hnp)
Instances For
Given h : False, returns an instance of type e.
Equations
- Lean.Meta.mkFalseElim e h = do let u ← Lean.Meta.getLevel e pure (Lean.mkApp2 (Lean.mkConst `False.elim [u]) e h)
Instances For
Given h : a = b, returns a proof of b = a.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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.
Instances For
Similar to mkEqTrans, but arguments can be none.
none is treated as a reflexivity proof.
Equations
- Lean.Meta.mkEqTrans? none none = pure none
- Lean.Meta.mkEqTrans? none (some h) = pure (some h)
- Lean.Meta.mkEqTrans? (some h) none = pure (some h)
- Lean.Meta.mkEqTrans? (some h₁) (some h₂) = do let a ← Lean.Meta.mkEqTrans h₁ h₂ pure (some a)
Instances For
Given h : a ≍ b, returns a proof of b ≍ a.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given h₁ : a ≍ b, h₂ : b ≍ c, returns a proof of a ≍ c.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given h : a = b, returns a proof of a ≍ b.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given f : α → β and h : a = b, returns a proof of f a = f b.
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.
Instances For
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.
Instances For
Returns 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.
Instances For
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))
Instances For
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.
Instances For
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))
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.
Instances For
Equations
- Lean.Meta.mkEqMP eqProof pr = Lean.Meta.mkAppM `Eq.mp #[eqProof, pr]
Instances For
Equations
- Lean.Meta.mkEqMPR eqProof pr = Lean.Meta.mkAppM `Eq.mpr #[eqProof, pr]
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
mkProjection s fieldName returns an expression for accessing field fieldName of the structure s.
Remark: fieldName may be a subfield of s.
Equations
- Lean.Meta.mkArrayLit type xs = do let u ← Lean.Meta.getDecLevel type let listLit ← Lean.Meta.mkListLit type xs pure (Lean.mkApp (Lean.mkApp (Lean.mkConst `List.toArray [u]) type) listLit)
Instances For
Equations
- Lean.Meta.mkNone type = do let u ← Lean.Meta.getDecLevel type pure (Lean.mkApp (Lean.mkConst `Option.none [u]) type)
Instances For
Equations
- Lean.Meta.mkSome type value = do let u ← Lean.Meta.getDecLevel type pure (Lean.mkApp2 (Lean.mkConst `Option.some [u]) type value)
Instances For
Returns Decidable.decide p
Equations
- Lean.Meta.mkDecide p = Lean.Meta.mkAppOptM `Decidable.decide #[some p, none]
Instances For
Returns a proof for p : Prop using decide p
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns Inhabited.default α
Equations
- Lean.Meta.mkDefault α = Lean.Meta.mkAppOptM `Inhabited.default #[some α, none]
Instances For
Returns @Classical.ofNonempty α _
Equations
- Lean.Meta.mkOfNonempty α = Lean.Meta.mkAppOptM `Classical.ofNonempty #[some α, none]
Instances For
Returns let_congr h₁ h₂
Equations
- Lean.Meta.mkLetCongr h₁ h₂ = Lean.Meta.mkAppM `let_congr #[h₁, h₂]
Instances For
Returns let_val_congr b h
Equations
- Lean.Meta.mkLetValCongr b h = Lean.Meta.mkAppM `let_val_congr #[b, h]
Instances For
Returns let_body_congr a h
Equations
- Lean.Meta.mkLetBodyCongr a h = Lean.Meta.mkAppM `let_body_congr #[a, h]
Instances For
Returns @of_eq_false p h
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns of_eq_false h
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns @of_eq_true p h
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns of_eq_true h
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns eq_true h
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns 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 `eq_false' #[h]
Instances For
Equations
- Lean.Meta.mkImpCongr h₁ h₂ = Lean.Meta.mkAppM `implies_congr #[h₁, h₂]
Instances For
Equations
- Lean.Meta.mkImpCongrCtx h₁ h₂ = Lean.Meta.mkAppM `implies_congr_ctx #[h₁, h₂]
Instances For
Equations
- Lean.Meta.mkImpDepCongrCtx h₁ h₂ = Lean.Meta.mkAppM `implies_dep_congr_ctx #[h₁, h₂]
Instances For
Equations
- Lean.Meta.mkForallCongr h = Lean.Meta.mkAppM `forall_congr #[h]
Instances For
Returns a + b using a heterogeneous +. This method assumes a and b have the same type.
Equations
- Lean.Meta.mkAdd a b = Lean.Meta.mkBinaryOp✝ `HAdd `HAdd.hAdd a b
Instances For
Returns a - b using a heterogeneous -. This method assumes a and b have the same type.
Equations
- Lean.Meta.mkSub a b = Lean.Meta.mkBinaryOp✝ `HSub `HSub.hSub a b
Instances For
Returns a * b using a heterogeneous *. This method assumes a and b have the same type.
Equations
- Lean.Meta.mkMul a b = Lean.Meta.mkBinaryOp✝ `HMul `HMul.hMul a b
Instances For
Returns a ≤ b. This method assumes a and b have the same type.
Equations
- Lean.Meta.mkLE a b = Lean.Meta.mkBinaryRel✝ `LE `LE.le a b
Instances For
Returns a < b. This method assumes a and b have the same type.
Equations
- Lean.Meta.mkLT a b = Lean.Meta.mkBinaryRel✝ `LT `LT.lt a b
Instances For
Given h : a = b, returns a proof for a ↔ b.
Equations
- Lean.Meta.mkIffOfEq h = if h.isAppOfArity `propext 3 = true then pure h.appArg! else Lean.Meta.mkAppM `Iff.of_eq #[h]
Instances For
Given proofs hᵢ : pᵢ, returns a proof for p₁ ∧ ... ∧ pₙ.
Roughly, mkAndIntroN hs : mkAndN (← hs.mapM inferType).
Equations
- Lean.Meta.mkAndIntroN hs = (fun (x : Lean.Expr × Lean.Expr) => x.fst) <$> Lean.Meta.mkAndIntroN.go✝ hs