blob: 919ba81c9312a50e745cb1b9670ba6e6791d4932 [file]
/-
Copyright (c) 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
module
prelude
public import Lean.Meta.Sym.Simp.Discharger
import Lean.Meta.Sym.Simp.Rewrite
import Lean.Meta.Sym.Simp.Goal
import Lean.Meta.Sym.Util
namespace Lean.Meta.Sym
open Simp
/-!
Helper functions for debugging purposes and creating tests.
-/
public def mkSimprocFor (declNames : Array Name) (d : Discharger := dischargeNone) : MetaM Simproc := do
let mut thms : Theorems := {}
for declName in declNames do
thms := thms.insert (← mkTheoremFromDecl declName)
return thms.rewrite d
public def mkMethods (declNames : Array Name) : MetaM Methods := do
return { post := (← mkSimprocFor declNames) }
public def simpGoalUsing (declNames : Array Name) (mvarId : MVarId) : MetaM (Option MVarId) := SymM.run do
let methods ← mkMethods declNames
let mvarId ← preprocessMVar mvarId
(← simpGoal mvarId methods).toOption
end Lean.Meta.Sym