File: .lake/packages/lean4/src/lean/Lean/Meta/Tactic/Simp/Types.lean

full_name: Lean.Meta.Simp.Result.expr
code: /-- The result of simplifying some expression `e`. -/
structure Result where
  /-- The simplified version of `e` -/
  expr           : Expr
  /-- A proof that `$e = $expr`, where the simplified expression is on the RHS.
  If `none`, the proof is assumed to be `refl`. -/
  proof?         : Option Expr := none
  /--
  If `cache := true` the result is cached.
  Warning: we will remove this field in the future. It is currently used by
  `arith := true`, but we can now refactor the code to avoid the hack.
  -/
  cache          : Bool := true
  deriving Inhabited
goal: Lean.Expr

full_name: Lean.Meta.Simp.Result.cache
code: /-- The result of simplifying some expression `e`. -/
structure Result where
  /-- The simplified version of `e` -/
  expr           : Expr
  /-- A proof that `$e = $expr`, where the simplified expression is on the RHS.
  If `none`, the proof is assumed to be `refl`. -/
  proof?         : Option Expr := none
  /--
  If `cache := true` the result is cached.
  Warning: we will remove this field in the future. It is currently used by
  `arith := true`, but we can now refactor the code to avoid the hack.
  -/
  cache          : Bool := true
  deriving Inhabited
goal: Bool

full_name: Lean.Meta.Simp.Result.proof?
code: /-- The result of simplifying some expression `e`. -/
structure Result where
  /-- The simplified version of `e` -/
  expr           : Expr
  /-- A proof that `$e = $expr`, where the simplified expression is on the RHS.
  If `none`, the proof is assumed to be `refl`. -/
  proof?         : Option Expr := none
  /--
  If `cache := true` the result is cached.
  Warning: we will remove this field in the future. It is currently used by
  `arith := true`, but we can now refactor the code to avoid the hack.
  -/
  cache          : Bool := true
  deriving Inhabited
goal: Option Lean.Expr

full_name: Lean.Meta.Simp.Result
code: /-- The result of simplifying some expression `e`. -/
structure Result where
  /-- The simplified version of `e` -/
  expr           : Expr
  /-- A proof that `$e = $expr`, where the simplified expression is on the RHS.
  If `none`, the proof is assumed to be `refl`. -/
  proof?         : Option Expr := none
  /--
  If `cache := true` the result is cached.
  Warning: we will remove this field in the future. It is currently used by
  `arith := true`, but we can now refactor the code to avoid the hack.
  -/
  cache          : Bool := true
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.instInhabitedResult
code: /-- The result of simplifying some expression `e`. -/
structure Result where
  /-- The simplified version of `e` -/
  expr           : Expr
  /-- A proof that `$e = $expr`, where the simplified expression is on the RHS.
  If `none`, the proof is assumed to be `refl`. -/
  proof?         : Option Expr := none
  /--
  If `cache := true` the result is cached.
  Warning: we will remove this field in the future. It is currently used by
  `arith := true`, but we can now refactor the code to avoid the hack.
  -/
  cache          : Bool := true
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.mkEqTransOptProofResult
code: def mkEqTransOptProofResult (h? : Option Expr) (cache : Bool) (r : Result) : MetaM Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.Result.mkEqTrans
code: def Result.mkEqTrans (r₁ r₂ : Result) : MetaM Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.Result.mkEqSymm
code: /-- Flip the proof in a `Simp.Result`. -/
def Result.mkEqSymm (e : Expr) (r : Simp.Result) : MetaM Simp.Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.Cache
code: abbrev Cache 
goal: Type

full_name: Lean.Meta.Simp.CongrCache
code: abbrev CongrCache 
goal: Type

full_name: Lean.Meta.Simp.Context.parent?
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Option Lean.Expr

full_name: Lean.Meta.Simp.Context.maxDischargeDepth
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: UInt32

full_name: Lean.Meta.Simp.Context.simpTheorems
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Lean.Meta.SimpTheoremsArray

full_name: Lean.Meta.Simp.Context.lctxInitIndices
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Nat

full_name: Lean.Meta.Simp.Context.inDSimp
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Bool

full_name: Lean.Meta.Simp.Context.dischargeDepth
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: UInt32

full_name: Lean.Meta.Simp.Context.config
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Lean.Meta.Simp.Config

full_name: Lean.Meta.Simp.Context.congrTheorems
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Lean.Meta.SimpCongrTheorems

full_name: Lean.Meta.Simp.instInhabitedContext
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.Context

full_name: Lean.Meta.Simp.Context
code: structure Context where
  config           : Config := {}
  /-- `maxDischargeDepth` from `config` as an `UInt32`. -/
  maxDischargeDepth : UInt32 := UInt32.ofNatTruncate config.maxDischargeDepth
  simpTheorems      : SimpTheoremsArray := {}
  congrTheorems     : SimpCongrTheorems := {}
  /--
  Stores the "parent" term for the term being simplified.
  If a simplification procedure result depends on this value,
  then it is its reponsability to set `Result.cache := false`.

  Motivation for this field:
  Suppose we have a simplication procedure for normalizing arithmetic terms.
  Then, given a term such as `t_1 + ... + t_n`, we don't want to apply the procedure
  to every subterm `t_1 + ... + t_i` for `i < n` for performance issues. The procedure
  can accomplish this by checking whether the parent term is also an arithmetical expression
  and do nothing if it is. However, it should set `Result.cache := false` to ensure
  we don't miss simplification opportunities. For example, consider the following:
  ```
  example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
    simp_arith only
    ...
  ```
  If we don't set `Result.cache := false` for the first `x + x`, then we get
  the resulting state:
  ```
  ... |- id (2*x + y) = id (x + x)
  ```
  instead of
  ```
  ... |- id (2*x + y) = id (2*x)
  ```
  as expected.

  Remark: given an application `f a b c` the "parent" term for `f`, `a`, `b`, and `c`
  is `f a b c`.
  -/
  parent?           : Option Expr := none
  dischargeDepth    : UInt32 := 0
  /--
  Number of indices in the local context when starting `simp`.
  We use this information to decide which assumptions we can use without
  invalidating the cache.
  -/
  lctxInitIndices   : Nat := 0
  /--
  If `inDSimp := true`, then `simp` is in `dsimp` mode, and only applying
  transformations that presereve definitional equality.
  -/
  inDSimp : Bool := false
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.Context.isDeclToUnfold
code: def Context.isDeclToUnfold (ctx : Context) (declName : Name) : Bool 
goal: Bool

full_name: Lean.Meta.Simp.UsedSimps
code: structure UsedSimps where
  -- We should use `PHashMap` because we backtrack the contents of `UsedSimps`
  -- The natural number tracks the insertion order
  map  : PHashMap Origin Nat := {}
  size : Nat := 0
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.instInhabitedUsedSimps
code: structure UsedSimps where
  -- We should use `PHashMap` because we backtrack the contents of `UsedSimps`
  -- The natural number tracks the insertion order
  map  : PHashMap Origin Nat := {}
  size : Nat := 0
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.UsedSimps

full_name: Lean.Meta.Simp.UsedSimps.size
code: structure UsedSimps where
  -- We should use `PHashMap` because we backtrack the contents of `UsedSimps`
  -- The natural number tracks the insertion order
  map  : PHashMap Origin Nat := {}
  size : Nat := 0
  deriving Inhabited
goal: Nat

full_name: Lean.Meta.Simp.UsedSimps.map
code: structure UsedSimps where
  -- We should use `PHashMap` because we backtrack the contents of `UsedSimps`
  -- The natural number tracks the insertion order
  map  : PHashMap Origin Nat := {}
  size : Nat := 0
  deriving Inhabited
goal: Lean.PHashMap Lean.Meta.Origin Nat

full_name: Lean.Meta.Simp.UsedSimps.insert
code: def UsedSimps.insert (s : UsedSimps) (thmId : Origin) : UsedSimps 
goal: Lean.Meta.Simp.UsedSimps

full_name: Lean.Meta.Simp.UsedSimps.toArray
code: def UsedSimps.toArray (s : UsedSimps) : Array Origin 
goal: Array Lean.Meta.Origin

full_name: Lean.Meta.Simp.Diagnostics.congrThmCounter
code: structure Diagnostics where
  /-- Number of times each simp theorem has been used/applied. -/
  usedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each simp theorem has been tried. -/
  triedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each congr theorem has been tried. -/
  congrThmCounter : PHashMap Name Nat := {}
  /--
  When using `Simp.Config.index := false`, and `set_option diagnostics true`,
  for every theorem used by `simp`, we check whether the theorem would be
  also applied if `index := true`, and we store it here if it would not have
  been tried.
  -/
  thmsWithBadKeys : PArray SimpTheorem := {}
  deriving Inhabited
goal: Lean.PHashMap Lean.Name Nat

full_name: Lean.Meta.Simp.Diagnostics
code: structure Diagnostics where
  /-- Number of times each simp theorem has been used/applied. -/
  usedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each simp theorem has been tried. -/
  triedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each congr theorem has been tried. -/
  congrThmCounter : PHashMap Name Nat := {}
  /--
  When using `Simp.Config.index := false`, and `set_option diagnostics true`,
  for every theorem used by `simp`, we check whether the theorem would be
  also applied if `index := true`, and we store it here if it would not have
  been tried.
  -/
  thmsWithBadKeys : PArray SimpTheorem := {}
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.Diagnostics.usedThmCounter
code: structure Diagnostics where
  /-- Number of times each simp theorem has been used/applied. -/
  usedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each simp theorem has been tried. -/
  triedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each congr theorem has been tried. -/
  congrThmCounter : PHashMap Name Nat := {}
  /--
  When using `Simp.Config.index := false`, and `set_option diagnostics true`,
  for every theorem used by `simp`, we check whether the theorem would be
  also applied if `index := true`, and we store it here if it would not have
  been tried.
  -/
  thmsWithBadKeys : PArray SimpTheorem := {}
  deriving Inhabited
goal: Lean.PHashMap Lean.Meta.Origin Nat

full_name: Lean.Meta.Simp.instInhabitedDiagnostics
code: structure Diagnostics where
  /-- Number of times each simp theorem has been used/applied. -/
  usedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each simp theorem has been tried. -/
  triedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each congr theorem has been tried. -/
  congrThmCounter : PHashMap Name Nat := {}
  /--
  When using `Simp.Config.index := false`, and `set_option diagnostics true`,
  for every theorem used by `simp`, we check whether the theorem would be
  also applied if `index := true`, and we store it here if it would not have
  been tried.
  -/
  thmsWithBadKeys : PArray SimpTheorem := {}
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.Diagnostics

full_name: Lean.Meta.Simp.Diagnostics.triedThmCounter
code: structure Diagnostics where
  /-- Number of times each simp theorem has been used/applied. -/
  usedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each simp theorem has been tried. -/
  triedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each congr theorem has been tried. -/
  congrThmCounter : PHashMap Name Nat := {}
  /--
  When using `Simp.Config.index := false`, and `set_option diagnostics true`,
  for every theorem used by `simp`, we check whether the theorem would be
  also applied if `index := true`, and we store it here if it would not have
  been tried.
  -/
  thmsWithBadKeys : PArray SimpTheorem := {}
  deriving Inhabited
goal: Lean.PHashMap Lean.Meta.Origin Nat

full_name: Lean.Meta.Simp.Diagnostics.thmsWithBadKeys
code: structure Diagnostics where
  /-- Number of times each simp theorem has been used/applied. -/
  usedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each simp theorem has been tried. -/
  triedThmCounter : PHashMap Origin Nat := {}
  /-- Number of times each congr theorem has been tried. -/
  congrThmCounter : PHashMap Name Nat := {}
  /--
  When using `Simp.Config.index := false`, and `set_option diagnostics true`,
  for every theorem used by `simp`, we check whether the theorem would be
  also applied if `index := true`, and we store it here if it would not have
  been tried.
  -/
  thmsWithBadKeys : PArray SimpTheorem := {}
  deriving Inhabited
goal: Lean.PArray Lean.Meta.SimpTheorem

full_name: Lean.Meta.Simp.State.numSteps
code: structure State where
  cache        : Cache := {}
  congrCache   : CongrCache := {}
  usedTheorems : UsedSimps := {}
  numSteps     : Nat := 0
  diag         : Diagnostics := {}
goal: Nat

full_name: Lean.Meta.Simp.State.cache
code: structure State where
  cache        : Cache := {}
  congrCache   : CongrCache := {}
  usedTheorems : UsedSimps := {}
  numSteps     : Nat := 0
  diag         : Diagnostics := {}
goal: Lean.Meta.Simp.Cache

full_name: Lean.Meta.Simp.State.diag
code: structure State where
  cache        : Cache := {}
  congrCache   : CongrCache := {}
  usedTheorems : UsedSimps := {}
  numSteps     : Nat := 0
  diag         : Diagnostics := {}
goal: Lean.Meta.Simp.Diagnostics

full_name: Lean.Meta.Simp.State
code: structure State where
  cache        : Cache := {}
  congrCache   : CongrCache := {}
  usedTheorems : UsedSimps := {}
  numSteps     : Nat := 0
  diag         : Diagnostics := {}
goal: Type

full_name: Lean.Meta.Simp.State.congrCache
code: structure State where
  cache        : Cache := {}
  congrCache   : CongrCache := {}
  usedTheorems : UsedSimps := {}
  numSteps     : Nat := 0
  diag         : Diagnostics := {}
goal: Lean.Meta.Simp.CongrCache

full_name: Lean.Meta.Simp.State.usedTheorems
code: structure State where
  cache        : Cache := {}
  congrCache   : CongrCache := {}
  usedTheorems : UsedSimps := {}
  numSteps     : Nat := 0
  diag         : Diagnostics := {}
goal: Lean.Meta.Simp.UsedSimps

full_name: Lean.Meta.Simp.Stats
code: structure Stats where
  usedTheorems : UsedSimps := {}
  diag : Diagnostics := {}
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.Stats.usedTheorems
code: structure Stats where
  usedTheorems : UsedSimps := {}
  diag : Diagnostics := {}
  deriving Inhabited
goal: Lean.Meta.Simp.UsedSimps

full_name: Lean.Meta.Simp.instInhabitedStats
code: structure Stats where
  usedTheorems : UsedSimps := {}
  diag : Diagnostics := {}
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.Stats

full_name: Lean.Meta.Simp.Stats.diag
code: structure Stats where
  usedTheorems : UsedSimps := {}
  diag : Diagnostics := {}
  deriving Inhabited
goal: Lean.Meta.Simp.Diagnostics

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Simp.Types.0.Lean.Meta.Simp.MethodsRefPointed
code: private opaque MethodsRefPointed : NonemptyType.{0}
goal: NonemptyType

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Simp.Types.0.Lean.Meta.Simp.MethodsRef
code: private def MethodsRef : Type 
goal: Type

full_name: Lean.Meta.Simp.instNonemptyMethodsRef
code: instance : Nonempty MethodsRef 
goal: Nonempty Lean.Meta.Simp.MethodsRef

full_name: Lean.Meta.Simp.SimpM
code: abbrev SimpM 
goal: Type

full_name: Lean.Meta.Simp.simp
code: @[extern "lean_simp"]
opaque simp (e : Expr) : SimpM Result
goal: Lean.Meta.SimpM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.dsimp
code: @[extern "lean_dsimp"]
opaque dsimp (e : Expr) : SimpM Expr
goal: Lean.Meta.SimpM Lean.Expr

full_name: Lean.Meta.Simp.modifyDiag
code: @[inline] def modifyDiag (f : Diagnostics → Diagnostics) : SimpM Unit 
goal: Lean.Meta.SimpM Unit

full_name: Lean.Meta.Simp.instInhabitedStep
code: /--
Result type for a simplification procedure. We have `pre` and `post` simplication procedures.
-/
inductive Step where
  /--
  For `pre` procedures, it returns the result without visiting any subexpressions.

  For `post` procedures, it returns the result.
  -/
  | done (r : Result)
  /--
  For `pre` procedures, the resulting expression is passed to `pre` again.

  For `post` procedures, the resulting expression is passed to `pre` again IF
  `Simp.Config.singlePass := false` and resulting expression is not equal to initial expression.
  -/
  | visit (e : Result)
  /--
  For `pre` procedures, continue transformation by visiting subexpressions, and then
  executing `post` procedures.

  For `post` procedures, this is equivalent to returning `visit`.
  -/
  | continue (e? : Option Result := none)
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.Step
code: /--
Result type for a simplification procedure. We have `pre` and `post` simplication procedures.
-/
inductive Step where
  /--
  For `pre` procedures, it returns the result without visiting any subexpressions.

  For `post` procedures, it returns the result.
  -/
  | done (r : Result)
  /--
  For `pre` procedures, the resulting expression is passed to `pre` again.

  For `post` procedures, the resulting expression is passed to `pre` again IF
  `Simp.Config.singlePass := false` and resulting expression is not equal to initial expression.
  -/
  | visit (e : Result)
  /--
  For `pre` procedures, continue transformation by visiting subexpressions, and then
  executing `post` procedures.

  For `post` procedures, this is equivalent to returning `visit`.
  -/
  | continue (e? : Option Result := none)
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.Step.continue
code: /--
Result type for a simplification procedure. We have `pre` and `post` simplication procedures.
-/
inductive Step where
  /--
  For `pre` procedures, it returns the result without visiting any subexpressions.

  For `post` procedures, it returns the result.
  -/
  | done (r : Result)
  /--
  For `pre` procedures, the resulting expression is passed to `pre` again.

  For `post` procedures, the resulting expression is passed to `pre` again IF
  `Simp.Config.singlePass := false` and resulting expression is not equal to initial expression.
  -/
  | visit (e : Result)
  /--
  For `pre` procedures, continue transformation by visiting subexpressions, and then
  executing `post` procedures.

  For `post` procedures, this is equivalent to returning `visit`.
  -/
  | continue (e? : Option Result := none)
  deriving Inhabited
goal: Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.Step.visit
code: /--
Result type for a simplification procedure. We have `pre` and `post` simplication procedures.
-/
inductive Step where
  /--
  For `pre` procedures, it returns the result without visiting any subexpressions.

  For `post` procedures, it returns the result.
  -/
  | done (r : Result)
  /--
  For `pre` procedures, the resulting expression is passed to `pre` again.

  For `post` procedures, the resulting expression is passed to `pre` again IF
  `Simp.Config.singlePass := false` and resulting expression is not equal to initial expression.
  -/
  | visit (e : Result)
  /--
  For `pre` procedures, continue transformation by visiting subexpressions, and then
  executing `post` procedures.

  For `post` procedures, this is equivalent to returning `visit`.
  -/
  | continue (e? : Option Result := none)
  deriving Inhabited
goal: Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.Step.done
code: /--
Result type for a simplification procedure. We have `pre` and `post` simplication procedures.
-/
inductive Step where
  /--
  For `pre` procedures, it returns the result without visiting any subexpressions.

  For `post` procedures, it returns the result.
  -/
  | done (r : Result)
  /--
  For `pre` procedures, the resulting expression is passed to `pre` again.

  For `post` procedures, the resulting expression is passed to `pre` again IF
  `Simp.Config.singlePass := false` and resulting expression is not equal to initial expression.
  -/
  | visit (e : Result)
  /--
  For `pre` procedures, continue transformation by visiting subexpressions, and then
  executing `post` procedures.

  For `post` procedures, this is equivalent to returning `visit`.
  -/
  | continue (e? : Option Result := none)
  deriving Inhabited
goal: Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.Simproc
code: /--
A simplification procedure. Recall that we have `pre` and `post` procedures.
See `Step`.
-/
abbrev Simproc 
goal: Type

full_name: Lean.Meta.Simp.DStep
code: abbrev DStep 
goal: Type

full_name: Lean.Meta.Simp.DSimproc
code: /--
Similar to `Simproc`, but resulting expression should be definitionally equal to the input one.
-/
abbrev DSimproc 
goal: Type

full_name: Lean.TransformStep.toStep
code: def _root_.Lean.TransformStep.toStep (s : TransformStep) : Step 
goal: Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.mkEqTransResultStep
code: def mkEqTransResultStep (r : Result) (s : Step) : MetaM Step 
goal: Lean.MetaM Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.andThen
code: /--
"Compose" the two given simplification procedures. We use the following semantics.
- If `f` produces `done` or `visit`, then return `f`'s result.
- If `f` produces `continue`, then apply `g` to new expression returned by `f`.

See `Simp.Step` type.
-/
@[always_inline]
def andThen (f g : Simproc) : Simproc 
goal: Lean.Meta.Simp.Simproc

full_name: Lean.Meta.Simp.instAndThenSimproc
code: instance : AndThen Simproc 
goal: AndThen Lean.Meta.Simp.Simproc

full_name: Lean.Meta.Simp.dandThen
code: @[always_inline]
def dandThen (f g : DSimproc) : DSimproc 
goal: Lean.Meta.Simp.DSimproc

full_name: Lean.Meta.Simp.instAndThenDSimproc
code: instance : AndThen DSimproc 
goal: AndThen Lean.Meta.Simp.DSimproc

full_name: Lean.Meta.Simp.instInhabitedSimprocOLeanEntry
code: /--
`Simproc` .olean entry.
-/
structure SimprocOLeanEntry where
  /-- Name of a declaration stored in the environment which has type `Simproc`. -/
  declName : Name
  post     : Bool := true
  keys     : Array SimpTheoremKey := #[]
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.SimprocOLeanEntry

full_name: Lean.Meta.Simp.SimprocOLeanEntry.post
code: /--
`Simproc` .olean entry.
-/
structure SimprocOLeanEntry where
  /-- Name of a declaration stored in the environment which has type `Simproc`. -/
  declName : Name
  post     : Bool := true
  keys     : Array SimpTheoremKey := #[]
  deriving Inhabited
goal: Bool

full_name: Lean.Meta.Simp.SimprocOLeanEntry
code: /--
`Simproc` .olean entry.
-/
structure SimprocOLeanEntry where
  /-- Name of a declaration stored in the environment which has type `Simproc`. -/
  declName : Name
  post     : Bool := true
  keys     : Array SimpTheoremKey := #[]
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.SimprocOLeanEntry.declName
code: /--
`Simproc` .olean entry.
-/
structure SimprocOLeanEntry where
  /-- Name of a declaration stored in the environment which has type `Simproc`. -/
  declName : Name
  post     : Bool := true
  keys     : Array SimpTheoremKey := #[]
  deriving Inhabited
goal: Lean.Name

full_name: Lean.Meta.Simp.SimprocOLeanEntry.keys
code: /--
`Simproc` .olean entry.
-/
structure SimprocOLeanEntry where
  /-- Name of a declaration stored in the environment which has type `Simproc`. -/
  declName : Name
  post     : Bool := true
  keys     : Array SimpTheoremKey := #[]
  deriving Inhabited
goal: Array Lean.Meta.SimpTheoremKey

full_name: Lean.Meta.Simp.SimprocEntry.proc
code: /--
`Simproc` entry. It is the .olean entry plus the actual function.
-/
structure SimprocEntry extends SimprocOLeanEntry where
  /--
  Recall that we cannot store `Simproc` into .olean files because it is a closure.
  Given `SimprocOLeanEntry.declName`, we convert it into a `Simproc` by using the unsafe function `evalConstCheck`.
  -/
  proc : Sum Simproc DSimproc
goal: Lean.Meta.Simp.Simproc ⊕ Lean.Meta.Simp.DSimproc

full_name: Lean.Meta.Simp.SimprocEntry
code: /--
`Simproc` entry. It is the .olean entry plus the actual function.
-/
structure SimprocEntry extends SimprocOLeanEntry where
  /--
  Recall that we cannot store `Simproc` into .olean files because it is a closure.
  Given `SimprocOLeanEntry.declName`, we convert it into a `Simproc` by using the unsafe function `evalConstCheck`.
  -/
  proc : Sum Simproc DSimproc
goal: Type

full_name: Lean.Meta.Simp.SimprocTree
code: abbrev SimprocTree 
goal: Type

full_name: Lean.Meta.Simp.Simprocs.erased
code: structure Simprocs where
  pre          : SimprocTree   := DiscrTree.empty
  post         : SimprocTree   := DiscrTree.empty
  simprocNames : PHashSet Name := {}
  erased       : PHashSet Name := {}
  deriving Inhabited
goal: Lean.PHashSet Lean.Name

full_name: Lean.Meta.Simp.Simprocs.post
code: structure Simprocs where
  pre          : SimprocTree   := DiscrTree.empty
  post         : SimprocTree   := DiscrTree.empty
  simprocNames : PHashSet Name := {}
  erased       : PHashSet Name := {}
  deriving Inhabited
goal: Lean.Meta.Simp.SimprocTree

full_name: Lean.Meta.Simp.instInhabitedSimprocs
code: structure Simprocs where
  pre          : SimprocTree   := DiscrTree.empty
  post         : SimprocTree   := DiscrTree.empty
  simprocNames : PHashSet Name := {}
  erased       : PHashSet Name := {}
  deriving Inhabited
goal: Inhabited Lean.Meta.Simprocs

full_name: Lean.Meta.Simp.Simprocs.pre
code: structure Simprocs where
  pre          : SimprocTree   := DiscrTree.empty
  post         : SimprocTree   := DiscrTree.empty
  simprocNames : PHashSet Name := {}
  erased       : PHashSet Name := {}
  deriving Inhabited
goal: Lean.Meta.Simp.SimprocTree

full_name: Lean.Meta.Simp.Simprocs.simprocNames
code: structure Simprocs where
  pre          : SimprocTree   := DiscrTree.empty
  post         : SimprocTree   := DiscrTree.empty
  simprocNames : PHashSet Name := {}
  erased       : PHashSet Name := {}
  deriving Inhabited
goal: Lean.PHashSet Lean.Name

full_name: Lean.Meta.Simp.Simprocs
code: structure Simprocs where
  pre          : SimprocTree   := DiscrTree.empty
  post         : SimprocTree   := DiscrTree.empty
  simprocNames : PHashSet Name := {}
  erased       : PHashSet Name := {}
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.Methods
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Simp.instInhabitedMethods
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Inhabited Lean.Meta.Simp.Methods

full_name: Lean.Meta.Simp.Methods.dpre
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Lean.Meta.Simp.DSimproc

full_name: Lean.Meta.Simp.Methods.dpost
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Lean.Meta.Simp.DSimproc

full_name: Lean.Meta.Simp.Methods.wellBehavedDischarge
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Bool

full_name: Lean.Meta.Simp.Methods.discharge?
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Lean.Expr → Lean.Meta.SimpM (Option Lean.Expr)

full_name: Lean.Meta.Simp.Methods.post
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Lean.Meta.Simp.Simproc

full_name: Lean.Meta.Simp.Methods.pre
code: structure Methods where
  pre        : Simproc  := fun _ => return .continue
  post       : Simproc  := fun e => return .done { expr := e }
  dpre       : DSimproc := fun _ => return .continue
  dpost      : DSimproc := fun e => return .done e
  discharge? : Expr → SimpM (Option Expr) := fun _ => return none
  /--
  `wellBehavedDischarge` must **not** be set to `true` IF `discharge?`
  access local declarations with index >= `Context.lctxInitIndices` when
  `contextual := false`.
  Reason: it would prevent us from aggressively caching `simp` results.
  -/
  wellBehavedDischarge : Bool := true
  deriving Inhabited
goal: Lean.Meta.Simp.Simproc

full_name: Lean.Meta.Simp.Methods.toMethodsRefImpl
code: unsafe def Methods.toMethodsRefImpl (m : Methods) : MethodsRef 
goal: Lean.Meta.Simp.MethodsRef

full_name: Lean.Meta.Simp.Methods.toMethodsRef
code: @[implemented_by Methods.toMethodsRefImpl]
opaque Methods.toMethodsRef (m : Methods) : MethodsRef
goal: Lean.Meta.Simp.MethodsRef

full_name: Lean.Meta.Simp.MethodsRef.toMethodsImpl
code: unsafe def MethodsRef.toMethodsImpl (m : MethodsRef) : Methods 
goal: Lean.Meta.Simp.Methods

full_name: Lean.Meta.Simp.MethodsRef.toMethods
code: @[implemented_by MethodsRef.toMethodsImpl]
opaque MethodsRef.toMethods (m : MethodsRef) : Methods
goal: Lean.Meta.Simp.Methods

full_name: Lean.Meta.Simp.getMethods
code: def getMethods : SimpM Methods 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Methods

full_name: Lean.Meta.Simp.pre
code: def pre (e : Expr) : SimpM Step 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.post
code: def post (e : Expr) : SimpM Step 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.getContext
code: @[inline] def getContext : SimpM Context 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Context

full_name: Lean.Meta.Simp.getConfig
code: def getConfig : SimpM Config 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Config

full_name: Lean.Meta.Simp.withParent
code: @[inline] def withParent (parent : Expr) (f : SimpM α) : SimpM α 
goal: Lean.Meta.SimpM α

full_name: Lean.Meta.Simp.getSimpTheorems
code: def getSimpTheorems : SimpM SimpTheoremsArray 
goal: Lean.Meta.SimpM Lean.Meta.SimpTheoremsArray

full_name: Lean.Meta.Simp.getSimpCongrTheorems
code: def getSimpCongrTheorems : SimpM SimpCongrTheorems 
goal: Lean.Meta.SimpM Lean.Meta.SimpCongrTheorems

full_name: Lean.Meta.Simp.inDSimp
code: /--
Returns `true` if `simp` is in `dsimp` mode.
That is, only transformations that preserve definitional equality should be applied.
-/
def inDSimp : SimpM Bool 
goal: Lean.Meta.SimpM Bool

full_name: Lean.Meta.Simp.withPreservedCache
code: @[inline] def withPreservedCache (x : SimpM α) : SimpM α 
goal: Lean.Meta.SimpM α

full_name: Lean.Meta.Simp.withFreshCache
code: /--
Save current cache, reset it, execute `x`, and then restore original cache.
-/
@[inline] def withFreshCache (x : SimpM α) : SimpM α 
goal: Lean.Meta.SimpM α

full_name: Lean.Meta.Simp.withDischarger
code: @[inline] def withDischarger (discharge? : Expr → SimpM (Option Expr)) (wellBehavedDischarge : Bool) (x : SimpM α) : SimpM α 
goal: Lean.Meta.SimpM α

full_name: Lean.Meta.Simp.recordTriedSimpTheorem
code: def recordTriedSimpTheorem (thmId : Origin) : SimpM Unit 
goal: Lean.Meta.SimpM Unit

full_name: Lean.Meta.Simp.recordSimpTheorem
code: def recordSimpTheorem (thmId : Origin) : SimpM Unit 
goal: Lean.Meta.SimpM Unit

full_name: Lean.Meta.Simp.recordCongrTheorem
code: def recordCongrTheorem (declName : Name) : SimpM Unit 
goal: Lean.Meta.SimpM Unit

full_name: Lean.Meta.Simp.recordTheoremWithBadKeys
code: def recordTheoremWithBadKeys (thm : SimpTheorem) : SimpM Unit 
goal: Lean.Meta.SimpM Unit

full_name: Lean.Meta.Simp.Result.getProof
code: def Result.getProof (r : Result) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Simp.Result.getProof'
code: /--
  Similar to `Result.getProof`, but adds a `mkExpectedTypeHint` if `proof?` is `none`
  (i.e., result is definitionally equal to input), but we cannot establish that
  `source` and `r.expr` are definitionally when using `TransparencyMode.reducible`. -/
def Result.getProof' (source : Expr) (r : Result) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Simp.Result.mkCast
code: /-- Construct the `Expr` `cast h e`, from a `Simp.Result` with proof `h`. -/
def Result.mkCast (r : Simp.Result) (e : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Simp.mkCongrFun
code: def mkCongrFun (r : Result) (a : Expr) : MetaM Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.mkCongr
code: def mkCongr (r₁ r₂ : Result) : MetaM Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.mkImpCongr
code: def mkImpCongr (src : Expr) (r₁ r₂ : Result) : MetaM Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.removeUnnecessaryCasts.isDummyEqRec
code: /-- Given the application `e`, remove unnecessary casts of the form `Eq.rec a rfl` and `Eq.ndrec a rfl`. -/
partial def removeUnnecessaryCasts (e : Expr) : MetaM Expr 
goal: Bool

full_name: Lean.Meta.Simp.removeUnnecessaryCasts.elimDummyEqRec
code: /-- Given the application `e`, remove unnecessary casts of the form `Eq.rec a rfl` and `Eq.ndrec a rfl`. -/
partial def removeUnnecessaryCasts (e : Expr) : MetaM Expr 
goal: Lean.Expr

full_name: Lean.Meta.Simp.removeUnnecessaryCasts
code: /-- Given the application `e`, remove unnecessary casts of the form `Eq.rec a rfl` and `Eq.ndrec a rfl`. -/
partial def removeUnnecessaryCasts (e : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Simp.congrArgs
code: /--
Given a simplified function result `r` and arguments `args`, simplify arguments using `simp` and `dsimp`.
The resulting proof is built using `congr` and `congrFun` theorems.
-/
def congrArgs (r : Result) (args : Array Expr) : SimpM Result 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.mkCongrSimp?
code: /--
Retrieve auto-generated congruence lemma for `f`.

Remark: If all argument kinds are `fixed` or `eq`, it returns `none` because
using simple congruence theorems `congr`, `congrArg`, and `congrFun` produces a more compact proof.
-/
def mkCongrSimp? (f : Expr) : SimpM (Option CongrTheorem) 
goal: Lean.Meta.SimpM (Option Lean.Meta.CongrTheorem)

full_name: Lean.Meta.Simp.tryAutoCongrTheorem?
code: /--
Try to use automatically generated congruence theorems. See `mkCongrSimp?`.
-/
def tryAutoCongrTheorem? (e : Expr) : SimpM (Option Result) 
goal: Lean.Meta.SimpM (Option Lean.Meta.Simp.Result)

full_name: Lean.Meta.Simp.getDtConfig
code: /--
Return a WHNF configuration for retrieving `[simp]` from the discrimination tree.
If user has disabled `zeta` and/or `beta` reduction in the simplifier, or enabled `zetaDelta`,
we must also disable/enable them when retrieving lemmas from discrimination tree. See issues: #2669 and #2281
-/
def getDtConfig (cfg : Config) : WhnfCoreConfig 
goal: Lean.Meta.WhnfCoreConfig

full_name: Lean.Meta.Simp.Result.addExtraArgs
code: def Result.addExtraArgs (r : Result) (extraArgs : Array Expr) : MetaM Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Meta.Simp.Step.addExtraArgs
code: def Step.addExtraArgs (s : Step) (extraArgs : Array Expr) : MetaM Step 
goal: Lean.MetaM Lean.Meta.Simp.Step

full_name: Lean.Meta.Simp.DStep.addExtraArgs
code: def DStep.addExtraArgs (s : DStep) (extraArgs : Array Expr) : DStep 
goal: Lean.Meta.Simp.DStep

full_name: Lean.Meta.applySimpResultToTarget
code: /--
  Auxiliary method.
  Given the current `target` of `mvarId`, apply `r` which is a new target and proof that it is equal to the current one.
-/
def applySimpResultToTarget (mvarId : MVarId) (target : Expr) (r : Simp.Result) : MetaM MVarId 
goal: Lean.MetaM Lean.MVarId