fix: preserve smart unfolding checks for function-valued matches

This PR fixes two cases where `rfl` could produce a proof that the kernel rejects. Both arise when a structurally recursive definition applies the result of a `match` to an extra argument.

Preserve the selected branch's smart unfolding annotation when beta-reducing an overapplied matcher. Include extra arguments containing marked matches in the input mask so that a branch returning one of its arguments cannot bypass the check.
3 files changed