3.6. Formal search-cost evidence
The proof-only scanner profile returns the parser result together with the exact number of completed root candidates tested by the search phase:
#check @Triptych.scanProfile_result
#check @Triptych.scannerCandidateChecks_le
#check @Triptych.scannerCandidateChecks_eq_zero_of_fastScan
#check @Decimal.parse_profile_result
#check @Decimal.parse_candidateChecks_le
#check @Decimal.parse_candidateChecks_eq_zero_of_fastScan
These theorems establish three facts:
-
profiling does not describe a different parser;
-
every generated parse stays within the finite candidate-tree budget; and
-
a successful certified fast scan performs zero complete-candidate backtracking.
This is a formal search guarantee, not a blanket linear-time theorem. Ambiguous grammar choices
can still yield an exponential candidate tree, and user-supplied value' or
constraints' functions can perform arbitrary work. For a fixed deterministic generated
grammar, the fast path avoids root-candidate backtracking; wall-clock time and allocation remain
properties measured by benchmarks rather than hidden inside the theorem statement.