feat: add SimpM

This commit is contained in:
Leonardo de Moura 2020-12-29 11:59:46 -08:00
parent c53cc72395
commit 64f7af9da5
4 changed files with 72 additions and 1 deletions

View file

@ -3,4 +3,6 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Lean.Meta.Tactic.Simp.Basic
import Lean.Meta.Tactic.Simp.SimpLemmas
import Lean.Meta.Tactic.Simp.Types
import Lean.Meta.Tactic.Simp.Main

View file

@ -0,0 +1,11 @@
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Lean.Meta.Tactic.Simp.Types
namespace Lean.Meta.Simp
end Lean.Meta.Simp

View file

@ -0,0 +1,58 @@
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Lean.Meta.Tactic.Simp.SimpLemmas
namespace Lean.Meta
namespace Simp
def defaultMaxSteps := 100000
structure Result where
expr : Expr
proof? : Option Expr := none -- If none, proof is assumed to be `refl`
abbrev Cache := ExprMap Result
structure Config where
maxSteps : Nat := defaultMaxSteps
contextual : Bool := false
memoize : Bool := true
singlePass : Bool := false
zeta : Bool := true
beta : Bool := true
eta : Bool := true
proj : Bool := true
ctorEq : Bool := true
structure Context where
config : Config
parent? : Option Expr := none
simpLemmas : SimpLemmas
structure State (σ : Type) where
user : σ -- user state
cache : Cache := {}
numSteps : Nat := 0
abbrev SimpM (σ : Type) := ReaderT Context $ StateRefT (State σ) $ MetaM
inductive Step where
| visit : Result → Step
| done : Result → Step
structure Methods (σ : Type) where
pre : Expr → SimpM σ Step := fun e => return Step.visit { expr := e }
post : Expr → SimpM σ Step := fun e => return Step.done { expr := e }
discharge? : Expr → SimpM σ (Option Expr) := fun e => return none
/- Internal monad -/
abbrev M (σ : Type) := ReaderT (Methods σ) $ SimpM σ
end Simp
export Simp (SimpM)
end Lean.Meta