File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -158,5 +158,16 @@ macro "admit" : grind => `(grind| sorry)
158158/-- `fail msg` is a tactic that always fails, and produces an error using the given message. -/
159159syntax (name := fail) "fail" (ppSpace str)? : grind
160160
161+ /--
162+ `repeat tac` repeatedly applies `tac` so long as it succeeds.
163+ The tactic `tac` may be a tactic sequence, and if `tac` fails at any point in its execution,
164+ `repeat` will revert any partial changes that `tac` made to the tactic state.
165+ The tactic `tac` should eventually fail, otherwise `repeat tac` will run indefinitely.
166+ -/
167+ syntax "repeat " grindSeq : grind
168+
169+ macro_rules
170+ | `(grind| repeat $seq) => `(grind| first | ($seq); repeat $seq | skip)
171+
161172end Grind
162173end Lean.Parser.Tactic
Original file line number Diff line number Diff line change @@ -376,6 +376,19 @@ example (as bs cs : Array α) (v₁ v₂ : α)
376376 instantiate = Array.getElem_set
377377 instantiate ← Array.getElem_set
378378
379+ example (as bs cs : Array α) (v₁ v₂ : α)
380+ (i₁ i₂ j : Nat)
381+ (h₁ : i₁ < as.size)
382+ (h₂ : bs = as.set i₁ v₁)
383+ (h₃ : i₂ < bs.size)
384+ (h₃ : cs = bs.set i₂ v₂)
385+ (h₄ : i₁ ≠ j ∧ i₂ ≠ j)
386+ (h₅ : j < cs.size)
387+ (h₆ : j < as.size)
388+ : cs[j] = as[j] := by
389+ grind =>
390+ repeat instantiate =Array.getElem_set
391+
379392opaque p : Nat → Prop
380393opaque q : Nat → Prop
381394opaque f : Nat → Nat
You can’t perform that action at this time.
0 commit comments