import Lean open Lean def goals : Array Name := #[`Solution.mainTheorem, `Solution.mainTheoremApprox, `Solution.separation, `Solution.separationClosure, `Solution.permanent_over_real] def lookupTheorem (moduleName : String) (data : ModuleData) (name : Name) : IO TheoremVal := do let some entry := data.constants.find? (fun entry => entry.name == name) | throw (IO.userError s!"{moduleName} is missing {name}") match entry with | .thmInfo info => pure info | _ => throw (IO.userError s!"{name} is not a theorem in {moduleName}") def main (args : List String) : IO Unit := do let [challengePath, solutionPath] := args | throw (IO.userError "Usage: ExactChallenge Challenge.olean Solution.olean") let (challenge, challengeRegion) ← readModuleData challengePath let (solution, solutionRegion) ← readModuleData solutionPath for goal in goals do let expected ← lookupTheorem "Challenge" challenge goal let actual ← lookupTheorem "Solution" solution goal unless expected.levelParams == actual.levelParams && expected.type == actual.type do throw (IO.userError s!"Statement mismatch: {goal}") IO.println s!"MATCH {goal}" let _ := challengeRegion let _ := solutionRegion