lean4-htt/tests/lean/run/mvcgenWithFail.lean
Sebastian Graf 6642061623
fix: make mvcgen with tac fail if tac fails on one of the VCs (#11871)
This PR makes `mvcgen with tac` fail if `tac` fails on one of the VCs,
just as `induction ... with tac` fails if `tac` fails on one of the
goals. The old behavior can be recovered by writing `mvcgen with try
tac` instead.
2026-01-02 10:52:25 +00:00

41 lines
889 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Std
/-!
`mvcgen with grind` should behave like `induction ... with grind` and fail if `grind` fails on
one of the goals.
-/
open Std.Do
set_option mvcgen.warning false
set_option warn.sorry false
variable {α : Type}
@[grind]
def List.last? (as : List α) : Option α :=
match as with
| [] => none
| [a] => some a
| _ :: bs => last? bs
open List
example (as bs : List α) (h : bs ≠ []) :
(as ++ bs).last? = bs.last? := by
fail_if_success induction bs generalizing as with simp
sorry
def nodup (l : List Int) : Bool := Id.run do
let mut seen : Std.HashSet Int := ∅
for x in l do
if x ∈ seen then
return false
seen := seen.insert x
return true
theorem nodup_correct_invariants_with_pretac (l : List Int) : nodup l ↔ l.Nodup := by
generalize h : nodup l = r
apply Id.of_wp_run_eq h
fail_if_success mvcgen with grind
sorry