File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -240,15 +240,23 @@ structure Config where
240240 -/
241241 implicitDefEqProofs : Bool := true
242242 /--
243- When `true` (default : `true`), then simps will remove unused let-declarations:
243+ When `true` (default : `true`), `simp` removes unused let-declarations:
244244 `let x := v; e` simplifies to `e` when `x` does not occur in `e`.
245245 -/
246246 zetaUnused : Bool := true
247247 /--
248- When `true` (default : `true`), then simps will catch runtime exceptions and
249- convert them into `simp` exceptions.
248+ When `true` (default : `true`), `simp` catches runtime exceptions and
249+ converts them into `simp` exceptions.
250250 -/
251251 catchRuntime : Bool := true
252+ /--
253+ When `true` (default : `true`), `simp` tries to realize constant `f.congr_simp`
254+ when constructing an auxiliary congruence proof for `f`.
255+ This option exists because the termination prover uses `simp` and `withoutModifyingEnv`
256+ while constructing the termination proof. Thus, any constant realized by `simp`
257+ is deleted.
258+ -/
259+ congrConsts : Bool := true
252260 deriving Inhabited, BEq
253261
254262-- Configuration object for `simp_all`
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ private def getSimpContext : MetaM Simp.Context := do
7373 Simp.mkContext
7474 (simpTheorems := #[simpTheorems])
7575 (congrTheorems := {})
76- (config := { Simp.neutralConfig with dsimp := true })
76+ -- Remark: we use `congrConsts` because this module uses `withoutModifyingEnv`
77+ -- which would erase any congruence lemmas realized in the `withoutModifyingEnv` block.
78+ (config := { Simp.neutralConfig with dsimp := true , congrConsts := false })
7779
7880def isWfParam? (e : Expr) : Option Expr :=
7981 if e.isAppOfArity ``wfParam 2 then
Original file line number Diff line number Diff line change @@ -650,7 +650,9 @@ def mkCongrSimp? (f : Expr) : SimpM (Option CongrTheorem) := do
650650 match (← get).congrCache[f]? with
651651 | some thm? => return thm?
652652 | none =>
653- let thm? ← if let .const declName us := f then
653+ let thm? ← if !(← getConfig).congrConsts then
654+ mkCongrSimpCore? f info kinds
655+ else if let .const declName us := f then
654656 mkCongrSimpForConst? declName us
655657 else
656658 mkCongrSimpCore? f info kinds
You can’t perform that action at this time.
0 commit comments