File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -189,5 +189,10 @@ generated `grind` tactic scripts.
189189-/
190190syntax (name := exposeNames) " expose_names" : grind
191191
192+ /--
193+ `set_option opt val in tacs` (the tactic) acts like `set_option opt val` at the command level,
194+ but it sets the option only within the tactics `tacs`. -/
195+ syntax (name := setOption) " set_option " ident ppSpace optionValue " in " grindSeq : grind
196+
192197end Grind
193198end Lean.Parser.Tactic
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import Lean.Elab.Tactic.Basic
2525import Lean.Elab.Tactic.RenameInaccessibles
2626import Lean.Elab.Tactic.Grind.Filter
2727import Lean.Elab.Tactic.Grind.ShowState
28+ import Lean.Elab.SetOption
2829namespace Lean.Elab.Tactic.Grind
2930
3031def showStateAt (ref : Syntax) (filter : Filter) : GrindTacticM Unit := do
@@ -424,4 +425,8 @@ where
424425 liftGrindM <| resetAnchors
425426 replaceMainGoal [{ goal with mvarId }]
426427
428+ @[builtin_grind_tactic setOption] def elabSetOption : GrindTactic := fun stx => do
429+ let options ← Elab.elabSetOption stx[1 ] stx[2 ]
430+ withOptions (fun _ => options) do evalGrindTactic stx[4 ]
431+
427432end Lean.Elab.Tactic.Grind
Original file line number Diff line number Diff line change @@ -431,6 +431,25 @@ example (as bs cs : Array α) (v₁ v₂ : α)
431431 grind =>
432432 repeat instantiate only [= Array.getElem_set]
433433
434+ /--
435+ trace: [ grind.ematch.instance ] Array.getElem_set: (as.set i₁ v₁ ⋯)[ j ] = if i₁ = j then v₁ else as[ j ]
436+ -/
437+ #guard_msgs in
438+ example (as bs cs : Array α) (v₁ v₂ : α)
439+ (i₁ i₂ j : Nat)
440+ (h₁ : i₁ < as.size)
441+ (h₂ : bs = as.set i₁ v₁)
442+ (h₃ : i₂ < bs.size)
443+ (h₃ : cs = bs.set i₂ v₂)
444+ (h₄ : i₁ ≠ j ∧ i₂ ≠ j)
445+ (h₅ : j < cs.size)
446+ (h₆ : j < as.size)
447+ : cs[j] = as[j] := by
448+ grind =>
449+ instantiate
450+ set_option trace.grind.ematch.instance true in
451+ instantiate
452+
434453opaque p : Nat → Prop
435454opaque q : Nat → Prop
436455opaque f : Nat → Nat
You can’t perform that action at this time.
0 commit comments