Compare commits

...

1 Commits

Author SHA1 Message Date
Leonardo de Moura
59d0515aa3 fix: MarkNestedProofs 2025-03-05 16:27:31 -08:00
2 changed files with 36 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import Init.Grind.Util
import Lean.Util.PtrSet
import Lean.Meta.Basic
import Lean.Meta.InferType
import Lean.Meta.Tactic.Grind.Util
namespace Lean.Meta.Grind
@@ -21,6 +22,13 @@ where
if let some r := ( get).find? e then
return r
let prop inferType e
/-
We must unfold reducible constants occurring in `prop` because the congruence closure
module in `grind` assumes they have been expanded.
See `grind_mark_nested_proofs_bug.lean` for an example.
TODO: We may have to normalize `prop` too.
-/
let prop unfoldReducible prop
let e' := mkApp2 (mkConst ``Lean.Grind.nestedProof) prop e
modify fun s => s.insert e e'
return e'

View File

@@ -0,0 +1,28 @@
set_option grind.warning false
example (as bs cs : Array α) (v : α)
(i : Nat)
(h₁ : i < as.size)
(h₂ : bs = as.set i v)
(h₃ : cs = bs)
(h₄ : i j)
(h₅ : j < cs.size)
(h₆ : j < as.size)
: cs[j] = as[j] := by
skip
grind only [= Array.getElem_set_ne, = Array.size_set] -- works
theorem Array.getElem_set_ne_abstracted (xs : Array α) (i : Nat) (h' : i < xs.size) (v : α) {j : Nat}
(pj : j < xs.size) (h : i j) :
(xs.set i v)[j]'(by as_aux_lemma => simp [*]) = xs[j] := Array.getElem_set_ne xs i h' v pj h
example (as bs cs : Array α) (v : α)
(i : Nat)
(h₁ : i < as.size)
(h₂ : bs = as.set i v)
(h₃ : cs = bs)
(h₄ : i j)
(h₅ : j < cs.size)
(h₆ : j < as.size)
: cs[j] = as[j] := by
grind only [= Array.getElem_set_ne_abstracted, = Array.size_set] -- should work