perf: decide `isProofQuick` for applications whose type is a `motive`
This PR makes `Meta.isProofQuick` return a definite answer for applications such as `match` auxiliary functions, `casesOn`, `brecOn`, and recursors, whose type is a `motive` variable applied to arguments. Previously these fell through to `isProof`'s slow path, which infers the type and reduces it to a sort.
`isArrowProposition'` already handled the case where the codomain of the function type is a de Bruijn variable, by inspecting the sort of the corresponding binder. It now also handles the case where that variable is applied to arguments, by stripping the same number of arrows from the binder type before inspecting its sort. For example, `f.match_1.{u} : (motive : Nat → Sort u) → ... → motive x` instantiated at `u := 1` is definitely not a proof, and at `u := 0` it definitely is.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This is the repository for Lean 4.
See Install Lean.
Please read our Contribution Guidelines first.
See Building Lean.