code wiki / (root) / nx_debt_gate.nx

nx_debt_gate.nx

buildroot/runtime/nx_debt_gate.nx

4226 B85 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic debt
docsdependenciesstructsconstsfunctions

about

nx_debt_gate.nx -- R4 GATE: proves debt amortization is bit-exact, detects the minimum-payment trap, and that avalanche pays LESS total interest than snowball (measured, not asserted by faith). EXACT ANCHORS (hand-computed, banker's rounding, 1% monthly = 12% APR): $1,000 @ 12%, pay $2,000 -> 1 month, interest $10.00 (round(1000.00*0.01)=1000c) $1,000 @ 12%, pay $100 -> 11 months, interest $58.98 (5898c) -- full schedule summed by hand $300 @ 0%, pay $100 -> 3 months, interest $0 $10,000 @ 24%, pay $100 -> -1 TRAP (interest $200 > payment $100; never amortizes) MEASURED: A=$10,000@24% min$200 + B=$2,000@6% min$50, budget $500/mo. Avalanche kills the 24% debt first; snowball kills the small $2,000 debt first. Both pay off; avalanche pays less interest. Exits 0 iff ALL pass. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_money.nx nx_debt_payoff.nx nx_debt_gate.nx

imports: nx_syscalls.nxnx_money.nxnx_debt_payoff.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap mny_rate_from_pct mny_div_round mny_div_floor chk g_puts sys_write g_putn sys_write ↻ sys_mmap ↻ dbt_payoff_months mny_rate_monthly mny_div_round ↻ mny_apply_rate mny_div_round ↻ mny_add dbt_strategy sys_mmap ↻ mny_rate_monthly ↻ mny_add ↻ mny_apply_rate ↻ g_puts ↻ g_putn ↻

structs

none

consts

none

functions

16func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: chkmain calls 1: sys_write
17func g_putn(v: i64) -> i64
called by 2: chkmain calls 2: sys_writesys_mmap
27func chk(name: *u8, got: i64, want: i64, st: *i64) -> i64
called by 1: main calls 2: g_putsg_putn
33func main() -> i64