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

68 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.

def fib : Nat → Nat
| 0 => 0
| 1 => 1
| n+2 => fib n + fib (n+1)
termination_by n => n
/--
error: Failed: `fail` tactic was invoked
⊢ fib 8 + fib (8 + 1) = 55
-/
#guard_msgs in
example : fib 10 = 55 := by
unfold fib
fail
def ack : Nat → Nat → Nat
| 0, m => m + 1
| n+1, 0 => ack n 1
| n+1, m+1 => ack n (ack (n+1) m)
termination_by n m => (n, m)
/--
error: Failed: `fail` tactic was invoked
⊢ ack 1 (ack (1 + 1) 1) = 7
-/
#guard_msgs in
example : ack 2 2 = 7 := by
unfold ack
fail
-- This checks that we can unfold definitions in the prelude
/--
error: Failed: `fail` tactic was invoked
α : Type u_1
as : Array α
i : Nat
j : Fin as.size
⊢ (if i < ↑j then
let j' := ⟨↑j - 1, ⋯⟩;
let as_1 := as.swap ↑j' ↑j ⋯ ⋯;
insertIdx.loop i as_1 ⟨↑j', ⋯⟩
else as).size =
as.size
-/
#guard_msgs in
@[simp] private theorem Array.size_insertIdx_loop (as : Array α) (i : Nat) (j : Fin as.size) :
(insertIdx.loop i as j).size = as.size := by
unfold insertIdx.loop
fail
theorem fib_eq_fib (n : Nat) : n ≤ fib (n + 2) :=
match h : n with
| 0 => by simp [fib]
| 1 => by simp [fib]
| n+2 => by
have := fib_eq_fib n
have := fib_eq_fib (n+1)
simp only [fib] at *
omega
termination_by n
-- This should not exist!
/-- error: Unknown constant `fib_eq_fib.eq_def` -/
#guard_msgs in
#check fib_eq_fib.eq_def