#!/usr/bin/env python3 """planted_control_template.py — GCY-1 Planted Negative Control Reference Harness. Demonstrates the mandatory anti-spoofing rule used across GoCheckYourself bundles: every positive mathematical or computational certificate is paired with a deliberately broken twin (planted negative control), and the automated verifier MUST assert that the checker rejects the broken twin with non-zero exit status. Usage: python -I planted_control_template.py --demo """ from __future__ import annotations import argparse from fractions import Fraction def check_exact_rational_bound(numerator: int, denominator: int, target_num: int, target_den: int) -> tuple[bool, str]: """Exact zero-float rational inequality check: numerator/denominator > target_num/target_den.""" if denominator <= 0 or target_den <= 0: return False, "Denominators must be strictly positive" lhs = Fraction(numerator, denominator) rhs = Fraction(target_num, target_den) if lhs > rhs: return True, f"PASS: {lhs} > {rhs} (exact margin +{lhs - rhs})" return False, f"REJECTED: {lhs} <= {rhs} (deficit {lhs - rhs})" def run_demo() -> int: # Positive witness: 380600332185 / 10^12 > 380600000000 / 10^12 pos_ok, pos_msg = check_exact_rational_bound(380600332185, 10**12, 380600000000, 10**12) # Planted negative control: perturbed by -10^-6 so the claim is strictly false neg_ok, neg_msg = check_exact_rational_bound(380599332185, 10**12, 380600000000, 10**12) print(f"POSITIVE_WITNESS: {pos_msg}") print(f"PLANTED_CONTROL: {neg_msg}") if not pos_ok: print("HARNESS_FAIL: Positive witness did not pass!") return 1 if neg_ok: print("HARNESS_FAIL: Planted negative control was NOT rejected!") return 1 print("PLANTED_CONTROL_HARNESS=PASS (1/1 positive accepted, 1/1 planted control rejected)") return 0 def main() -> int: parser = argparse.ArgumentParser(description="GCY-1 Planted Negative Control Template") parser.add_argument("--demo", action="store_true", help="Run exact positive + planted-fail control demonstration") args = parser.parse_args() if args.demo: return run_demo() parser.print_help() return 2 if __name__ == "__main__": raise SystemExit(main())