lean4-htt/tests/lean/run/4230.lean
Marc Huisinga 9d427fdfcf
feat: "try this" messages with support for interactivity (#10524)
This PR adds support for interactivity to the combined "try this"
messages that were introduced in #9966. In doing so, it moves the link
to apply a suggestion to a separate `[apply]` button in front of the
suggestion. Hints with diffs remain unchanged, as they did not
previously support interacting with terms in the diff, either.

<img width="379" height="256" alt="Suggestion with interactive message"
src="https://github.com/user-attachments/assets/7838ebf6-0613-46e7-bc88-468a05acbf51"
/>
2025-10-13 13:39:03 +00:00

25 lines
644 B
Text

def copy (curr : Nat) (input : Array Nat) (output : Array Nat) : Array Nat :=
if hcurr:curr < input.size then
copy (curr + 1) input (output.push (input[curr]'hcurr))
else
output
termination_by input.size - curr
/--
info: Try this:
[apply] termination_by input.size - curr
-/
#guard_msgs(drop warning, info) in
theorem foo (curr : Nat) (input : Array Nat) (output : Array Nat)
: ∀ (idx : Nat) (hidx1 : idx < curr),
(copy curr input output)[idx]'sorry
=
output[idx]'sorry := by
intro idx hidx
unfold copy
split
. rw [foo]
. rw [Array.getElem_push_lt]
. omega
. rfl
termination_by?