import Mathlib.MeasureTheory.Order.Lattice import Lean.Meta.DecLevel import Lean.Meta.Transform import Lean.Util.Recognizers import Mathlib.Probability.Kernel.Composition.Prod /-! # Standalone extraction for `getLevelFromEq` 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 -- ═══ ForMathlib.MeasureTheory.Order.Lattice ═══ section open Finset variable {α δ : Type*} [MeasurableSpace δ] [SemilatticeInf α] {m : MeasurableSpace α} [MeasurableInf₂ α] attribute [to_dual existing] MeasurableInf₂ end -- ═══ Tactic.EqLift.Tactic.Universe ═══ section public meta section open Lean Meta ProbabilityTheory /-- Extract the universe level from the left side of an equality expression. -/ def getLevelFromEq (eq : Expr) : MetaM Level := do let eq ← whnf (← zetaReduce (← instantiateMVars eq)) let eq := eq.consumeMData let some (_, lhs, _) := eq.eq? | throwError "Expected an equality, got: {eq}." getDecLevel (← inferType lhs) end