lean4-htt/tests/lean/run/binderNameHint_congr.lean
jrr6 62f14514da
refactor: update built-in tactic error messages (#9633)
This PR updates various error messages produced by or associated with
built-in tactics and adapts their formatting to current conventions.
2025-07-31 14:16:57 +00:00

61 lines
1.4 KiB
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.

section no_congr
/--
error: Failed: `fail` tactic was invoked
xs : List Nat
⊢ xs = List.map (fun y => 1 + y) xs
-/
#guard_msgs in
example : xs = List.map (fun y => 1 + (y + 1 - 1)) xs := by
simp
fail
end no_congr
section with_congr
/--
info: List.map_congr_left.{u_1, u_2} {α✝ : Type u_1} {l : List α✝} {α✝¹ : Type u_2} {f g : α✝ → α✝¹}
(h : ∀ (a : α✝), a ∈ l → f a = g a) : List.map f l = List.map g l
-/
#guard_msgs in
#check List.map_congr_left
attribute [local congr] List.map_congr_left
/--
error: Failed: `fail` tactic was invoked
xs : List Nat
⊢ xs = List.map (fun a => 1 + a) xs
-/
#guard_msgs in
example : xs = List.map (fun y => 1 + (y + 1 - 1)) xs := by
simp -- NB: Changes variable name!
fail
end with_congr
section with_congr_hint
-- Trying to use the binderNameHint on a congruence rule
theorem List.map_congr_left'' {f g : α → β}
(h : ∀ (a : α), a ∈ l → binderNameHint a f (f a) = g a) :
List.map f l = List.map g l := List.map_congr_left h
attribute [local congr] List.map_congr_left''
-- set_option trace.Debug.Meta.Tactic.simp true
-- set_option pp.instantiateMVars false
-- set_option trace.Debug.Meta.Tactic.simp.congr true
/--
error: Failed: `fail` tactic was invoked
xs : List Nat
⊢ xs = List.map (fun y => 1 + y) xs
-/
#guard_msgs in
example : xs = List.map (fun y => 1 + (y + 1 - 1)) xs := by
simp
fail
end with_congr_hint