"""The upkeep principle: how fast a built hurdle decays, and what it takes to stay above the line. Uses the same draws as the value model (orc_value_model.py, seed 20261113).""" import io, contextlib, importlib.util, json, math, os HERE = os.path.dirname(os.path.abspath(__file__)) spec = importlib.util.spec_from_file_location("orc_value_model", os.path.join(HERE, "orc_value_model.py")) # keep both files in one folder m = importlib.util.module_from_spec(spec) with contextlib.redirect_stdout(io.StringIO()): spec.loader.exec_module(m) S, T, LN2 = m.S, m.T, math.log(2) rows = m.simulate(m.PUBLIC) # (orc0, floor, h, token share) pct = lambda xs, q: m.pct(xs, q) out = {} # 1. decay of the AI-priced hurdle out["decay"] = [{"h": h, "month": 1 - 2 ** (-1 / h), "year": 1 - 2 ** (-12 / h), "rebuild_months": h / LN2} for h in (6.0, math.sqrt(72), 12.0)] # 2. the score: cautious headroom over the line, by the month in which a build starts def orc_m(r, t, up=0.0): o0, f, h = r[0], r[1], r[2] d = 2 ** (-t / h) return f + (o0 - f) * d + up * h / LN2 * (1 - d) # upkeep 'up' adds replication value each month, which then decays too def score(t, up=0.0, floor_add=0.0): p10 = pct([orc_m(r, t, up) + floor_add for r in rows], 0.10) return 100 * (1 - S / p10), p10 out["score_path"] = [{"t": t, "none": score(t)[0]} for t in range(0, 61, 3)] out["line_price"] = [{"t": t, "price": score(t)[1] / T} for t in (0, 12, 24, 36, 48, 60)] fl10 = pct([r[1] for r in rows], 0.10) out["line_price_floor"] = fl10 / T # 3. the stamp: decay rate times the AI-priced part of the cover, at the line stamp = [LN2 / r[2] * max(S - r[1], 0.0) for r in rows] out["stamp"] = {"p10": pct(stamp, 0.10), "p50": pct(stamp, 0.50), "p90": pct(stamp, 0.90), "zero_share": sum(s == 0 for s in stamp) / len(stamp)} hold0 = [LN2 / r[2] * (r[0] - r[1]) for r in rows] out["stamp_to_hold_today"] = {"p10": pct(hold0, 0.10), "p50": pct(hold0, 0.50), "p90": pct(hold0, 0.90)} # 4. constant upkeep that keeps the score above the line at month 36, and for good def bis(f, lo, hi, n=40): for _ in range(n): mid = (lo + hi) / 2 if f(mid): hi = mid else: lo = mid return hi out["up36"] = bis(lambda u: score(36, u)[0] >= 0, 0.0, 200.0) out["up_forever"] = bis(lambda u: pct([r[1] + u * r[2] / LN2 for r in rows], 0.10) >= S, 0.0, 200.0) for k in ("up36", "up_forever"): u = out[k] for row in out["score_path"]: row[k] = score(row["t"], u)[0] # the lowest point of each maintained path out["min_score"] = {k: min((r[k], r["t"]) for r in out["score_path"]) for k in ("up36", "up_forever")} # 5. the same upkeep in function points: replication price of one counted point, central inputs c = {k: math.sqrt(v[0] * v[1]) if isinstance(v, tuple) else v for k, v in m.PUBLIC.items()} per_point = (1 + c["hidden"]) * (1 + c["finesse_extra"]) * (c["tokens_cfp"] + c["hours_cfp"] * m.WAGE) * (1 / m.PI + m.UPKEEP * T / 12) out["per_point_today"] = per_point h = c["halving"] out["points"] = [{"t": t, "per_point": per_point * 2 ** (-t / h), "points_month_stamp": out["stamp"]["p50"] / (per_point * 2 ** (-t / h)), "points_month_up36": out["up36"] / (per_point * 2 ** (-t / h))} for t in (0, 12, 24, 36, 48)] # 6. the anchor: a running cost every replica must also pay, per month, that makes the plan durable at 90% out["anchor_month"] = (S - fl10) / T out["floor_p10"] = fl10 json.dump(out, open(os.path.join(HERE, "upkeep.json"), "w"), indent=1) r = lambda x, d=2: round(x, d) print("decay", [(r(d["h"]), r(d["month"] * 100, 1), r(d["year"] * 100, 1), r(d["rebuild_months"], 1)) for d in out["decay"]]) print("score none", [(p["t"], r(p["none"], 1)) for p in out["score_path"]]) print("line price", [(p["t"], r(p["price"])) for p in out["line_price"]], "floor", r(out["line_price_floor"])) print("stamp", {k: r(v, 3) for k, v in out["stamp"].items()}, "hold today", {k: r(v) for k, v in out["stamp_to_hold_today"].items()}) print("up36", r(out["up36"]), "up_forever", r(out["up_forever"]), "min", out["min_score"]) print("score up36", [(p["t"], r(p["up36"], 1)) for p in out["score_path"]]) print("score forever", [(p["t"], r(p["up_forever"], 1)) for p in out["score_path"]]) print("per point", r(per_point), "points", [(p["t"], r(p["per_point"]), r(p["points_month_stamp"], 2), r(p["points_month_up36"], 2)) for p in out["points"]]) print("anchor per month", r(out["anchor_month"]), "floor p10", r(fl10))