lean4-htt/tests/lean/run/autoparam.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

49 lines
907 B
Text

/-!
# Testing the autoparam feature
-/
def f (x y : Nat) (h : x = y := by assumption) : Nat :=
x + x
def g (x y z : Nat) (h : x = y) : Nat :=
f x y
def f2 (x y : Nat) (h : x = y := by exact rfl) : Nat :=
x + x
def f3 (x y : Nat) (h : x = y := by exact Eq.refl x) : Nat :=
x + x
#check fun x => f2 x x
#check fun x => f3 x x
/--
error: could not synthesize default value for parameter 'h' using tactics
---
error: Tactic `assumption` failed
⊢ 1 = 2
-/
#guard_msgs in example := f 1 2
/-!
From #2950, field autoparam should mention which field failed.
-/
structure Foo where
val : String
len : Nat := val.length
inv : val.length = len := by next => decide
/--
error: could not synthesize default value for field 'inv' of 'Foo' using tactics
---
error: Tactic `decide` proved that the proposition
"abc".length = 5
is false
-/
#guard_msgs in
def test2 : Foo := {
val := "abc"
len := 5
}