lean4-htt/tests/elab/binderNameHint_congr.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +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