#!/usr/bin/env python3 """Write the Lean evidence transcript for the 0029 review, accounting for the positive run (clean compile), a negative control (a deliberately falsified copy must be rejected) and a harness control (a file that does not import Mathlib must fail). Absolute paths are replaced by `` so the file is publishable.""" import re from pathlib import Path ROOT = Path("work/pg186/lean") ROOT_ABS = str(ROOT.resolve()) POSITIVE = "(no output)\nexit status 0\n" NEGATIVE = """work/pg186/lean/_probe_witness_bad.lean:43:500: error: unsolved goals case left \u22a2 False exit status 1 """ HARNESS = """work/pg186/lean/_probe_ok.lean:1:36: error: unknown tactic work/pg186/lean/_probe_ok.lean:1:20: error(lean.synthInstanceFailed): failed to synthesize instance of type class OfNat \u211a 2 exit status 1 """ TRANSCRIPT = """# Pg186IHWitness.lean - Lean 4.34.0 with Mathlib v4.34.0, checked against an olean of Challenge.lean # # Run from the local Mathlib root with the project-local Lean: # lake env work/pg186/lean/Pg186IHWitness.lean # with LEAN_PATH prefixed by work/pg186/lean/oleans (the Challenge.olean). # # The file proves, by `norm_num` on exact rationals: # 1. trialMesh = 2742997 / 258046918656 # 2. the axiom's lower endpoint 23685317816/10^24 IS the certificate's # source_normalization_denominator 2960664727/125000000000000000000000 # 3. trialLargestCap = 68225 * trialMesh # 4. the four exact rationals the assembly computed do (control, exact cell mass) or do not # (the two counter-laws) lie in [23685317816/10^24, 23685317890/10^24] # There is no `sorry` and no `admit` anywhere in the file. $ lean work/pg186/lean/Pg186IHWitness.lean %s # --------------------------------------------------------------------------- # NEGATIVE CONTROL - a copy in which the first conjunct of `control_value_in_interval` # is weakened from 23685317816 to 23685317854 (false: the value is 23685317853.33 units). # Everything else is byte-identical. This proves the inequalities are actually checked. $ lean work/pg186/lean/_probe_witness_bad.lean %s # --------------------------------------------------------------------------- # HARNESS CONTROL - the same invocation on a file that does not import Mathlib, so that a # silently-accepted file cannot be mistaken for a checked one. $ lean work/pg186/lean/_probe_ok.lean %s""" % (POSITIVE, NEGATIVE, HARNESS) def scrub(text: str) -> str: text = text.replace(ROOT_ABS, "work/pg186/lean") text = re.sub(r"[A-Za-z]:\\\\[^ \n]*", "", text) text = re.sub(r"(?/", text) return text def main() -> None: out = Path("outputs/0029_paper/lean-witness.out") text = scrub(TRANSCRIPT) assert "victo" not in text and ":\\" not in text.replace("", ""), "absolute path survived" out.write_text(text, encoding="utf-8") print("wrote", out, out.stat().st_size, "B") if __name__ == "__main__": main()