import hashlib
import json
from pathlib import Path
P = 2**64 - 2**32 + 1
BASE = "8525b17"
def centered(value):
value %= P
return value if value <= P // 2 else value - P
def main():
a, rho, value = 19, 23, 7
c0, c1 = (a * rho + value) % P, (-a * rho) % P
assert (c0 + c1) % P == value
imbalance = 1
accepts_nonzero = abs(centered(imbalance)) * 2 < P
assert accepts_nonzero
integer_output = P
assert 0 <= integer_output < 2**64 and integer_output != 0
assert integer_output % P == 0
previous, delta = 100, 7
current = previous + delta
assert current - previous == delta
contributions = [11, 13, 17]
assert sum(contributions) - sum(contributions[:2]) == contributions[2]
spent = {"fixed-note-nullifier"}
live_after_reset = set()
assert "fixed-note-nullifier" in spent
assert "fixed-note-nullifier" not in live_after_reset
assert 0 != P and 0 % P == P % P
result = {
"scope": "counterexamples to simplified prose; not production exploits",
"soft3_base_prefix": BASE,
"script_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),
"goldilocks_prime": P,
"bbg_displayed_components_cancel_to_value": (c0 + c1) % P,
"bbg_norm_accepts_nonzero_imbalance": accepts_nonzero,
"field_only_conservation_accepts_integer_output": integer_output,
"singleton_release_recovers_delta": current - previous,
"colluders_recover_remaining_contribution": sum(contributions) - sum(contributions[:2]),
"live_only_reset_forgets_spend": True,
"single_field_identifier_alias": [0, P],
}
print(json.dumps(result, indent=2))
if __name__ == "__main__":
main()