Documentation

Mathlib.Tactic.ToExpr

ToExpr instances for Mathlib #

This module should be imported by any module that intends to define ToExpr instances. It provides necessary dependencies (the Lean.ToLevel class) and it also overrides the instances that come from core Lean 4 that do not handle universe polymorphism. (See the module Lean.ToExpr for the instances that are overridden.)

In addition, we provide some additional ToExpr instances for core definitions.

Equations
  • Lean.instToExprOptionOfToLevel = { toExpr := Lean.toExprOption✝, toTypeExpr := (Lean.Expr.const `Option [Lean.toLevel.{?u.22}]).app (Lean.toTypeExpr α✝) }
Equations
Equations
  • One or more equations did not get rendered due to their size.
instance Lean.instToExprProdOfToLevel {α✝ : Type u} {β✝ : Type v} [Lean.ToExpr α✝] [Lean.ToExpr β✝] [Lean.ToLevel.{u}] [Lean.ToLevel.{v}] :
Lean.ToExpr (α✝ × β✝)
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • Mathlib.instToExprULiftOfToLevel = { toExpr := Mathlib.toExprULift✝, toTypeExpr := (Lean.Expr.const `ULift [Lean.toLevel.{?u.28}, Lean.toLevel.{?u.27}]).app (Lean.toTypeExpr α✝) }

Hand-written instance since PUnit is a Sort rather than a Type.

Equations
  • Mathlib.instToExprPUnitOfToLevel = { toExpr := fun (x : PUnit) => Lean.mkConst `PUnit.unit [Lean.toLevel.{?u.12 + 1}], toTypeExpr := Lean.mkConst `PUnit [Lean.toLevel.{?u.12 + 1}] }