import Mathlib.MeasureTheory.Order.Lattice import Mathlib.Probability.Kernel.Composition.Prod import Mathlib.Probability.Kernel.Composition.CompProd import Mathlib.MeasureTheory.MeasurableSpace.Embedding import Lean.Elab.Tactic.Location import Lean.Meta.DecLevel import Lean.Meta.Transform import Lean.Util.Recognizers import Lean.Meta.Tactic.Replace import Lean.Meta.Tactic.Rewrite import Mathlib.Probability.Kernel.Deterministic import Mathlib.Combinatorics.Quiver.ReflQuiver import Mathlib.Probability.Kernel.Category.SFinKer import Mathlib.MeasureTheory.Integral.Lebesgue.Countable /-! # Standalone extraction for `getUniverseFromEq` Definitions are copied verbatim; theorem proofs are replaced by `sorry`. Auto-generated by Referee. -/ set_option quotPrecheck false -- Namespace stubs (so later `open`s resolve). namespace Finset end Finset namespace Lean end Lean namespace Lean.Meta end Lean.Meta namespace ProbabilityTheory end ProbabilityTheory namespace ProbabilityTheory.Kernel end ProbabilityTheory.Kernel -- ═══ ForMathlib.MeasureTheory.Order.Lattice ═══ section open Finset variable {α δ : Type*} [MeasurableSpace δ] [SemilatticeInf α] {m : MeasurableSpace α} [MeasurableInf₂ α] attribute [to_dual existing] MeasurableInf₂ end -- ═══ Tactic.KernelHom.Tactic.HomKernel ═══ section public meta section open Lean Elab Tactic Meta CategoryTheory Parser.Tactic ProbabilityTheory MonoidalCategory open ProbabilityTheory.Kernel /-- Get the universe level from the left side of an equality expression. -/ def getUniverseFromEq (eq : Expr) : MetaM Level := do let eq ← instantiateMVars eq let eq ← zetaReduce eq let eq ← whnf eq let eq := eq.consumeMData let some (_, lhs, _) := eq.eq? | throwError "Expected an equality, got: {eq}." let l ← getLevel (← inferType lhs) match l with | Level.succ l' => return l' | _ => throwError "Expected a universe level ≥ 1, got: {l}" end