✓
Passing This code compiles and runs correctly.
Code
// PIN (collapse-recursion pass, WAY-TWO leg — BOUNDARY PROBE): n=92 is the
// last i64-exact Fibonacci (7540113804746346429). Fast-doubling would compute
// fib(93) and overflow where the original recursion does not, so the emitted
// body must carry the literal boundary answer for n == 92 and reserve the
// closed form for n <= 91. This pins exactness at the proven boundary —
// not assumed.
import std/io
pub tor fib { n: i64 } -> i64
fib = if(n < 2)
| then -> n
| else |> fib(n: n - 1): a |> fib(n: n - 2): b -> a + b
fib(n: 92): r |> std/io:print.ln("{{ r:d }}")
Actual
7540113804746346429
Expected output
7540113804746346429
Flows
subflow ~fib click a branch to expand · @labels scroll to their anchor
if (n < 2)
flow ~fib click a branch to expand · @labels scroll to their anchor
fib (n: 92)
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# Pin (boundary probe): fib(92) must return the literal 7540113804746346429 —
# the emitted body carries `if (n == 92) return 7540113804746346429;` between
# the n<=91 doubling block and the residual. Without it the doubling overflows
# i64 one step early.
set -e
if ! grep -q '__koru_collapse_b1_fib' output_emitted.zig; then
echo "FAIL: __koru_collapse_b1_fib marker absent — collapse pass did not fire on fib"
exit 1
fi
if ! grep -q '== 92) return 7540113804746346429' output_emitted.zig; then
echo "FAIL: n==92 boundary literal absent — fib(92) would overflow in the doubling"
exit 1
fi