**Motivations:** - Implémenter le workflow complet de démonstration Collatz (commandes.md) - Permettre la reprise après interruption au palier D20 **Evolutions:** - Scripts 01-12 et run-full-workflow alignés sur commandes.md sections 1-10 - collatz_recover_noyau.py : recréation de noyau_post_D20 à partir du CSV candidats - Option --resume-from D20 dans collatz_k_pipeline pour reprendre sans recalculer D18-D19-F15 - Détection automatique : si candidats_D20 existe sans noyau_post_D20, récupération puis poursuite - Filtres --cible=critique et --modulo dans collatz_fusion_pipeline - ROOT par défaut = collatz_k_scripts (plus data/source vide) **Pages affectées:** - .gitignore (__pycache__, out/) - applications/collatz/collatz_k_scripts/*.py - applications/collatz/scripts/*.sh - applications/collatz/scripts/README.md
61 lines
2.1 KiB
Python
61 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
collatz_generate_full_proof.py
|
|
|
|
Assemble full proof document from coverage, threshold, base validation.
|
|
Outputs Markdown; for PDF use pandoc.
|
|
|
|
Usage: python collatz_generate_full_proof.py --coverage PATH --threshold PATH --base PATH --certificat JSON --output PATH
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
|
|
def main() -> None:
|
|
ap = argparse.ArgumentParser(description="Assemble full proof document")
|
|
ap.add_argument("--coverage", required=True, help="Coverage proof path")
|
|
ap.add_argument("--threshold", required=True, help="Threshold audit path")
|
|
ap.add_argument("--base", required=True, help="Base validation path")
|
|
ap.add_argument("--certificat", required=True, help="Certificate JSON path")
|
|
ap.add_argument("--output", required=True, help="Output path (.md or .pdf)")
|
|
args = ap.parse_args()
|
|
|
|
lines = [
|
|
"# Démonstration complète de la conjecture de Collatz",
|
|
"",
|
|
"## 1. Preuve de couverture",
|
|
"",
|
|
]
|
|
for path_str in (args.coverage, args.threshold, args.base):
|
|
p = Path(path_str)
|
|
md_p = p.with_suffix(".md") if p.suffix.lower() == ".pdf" else p
|
|
if md_p.exists():
|
|
lines.append(md_p.read_text(encoding="utf-8"))
|
|
lines.append("")
|
|
elif p.exists() and p.suffix.lower() == ".md":
|
|
lines.append(p.read_text(encoding="utf-8"))
|
|
lines.append("")
|
|
|
|
out_path = Path(args.output)
|
|
out_path.parent.mkdir(parents=True, exist_ok=True)
|
|
md_content = "\n".join(lines)
|
|
|
|
if out_path.suffix.lower() == ".pdf":
|
|
out_md = out_path.with_suffix(".md")
|
|
out_md.write_text(md_content, encoding="utf-8")
|
|
try:
|
|
import subprocess
|
|
subprocess.run(["pandoc", str(out_md), "-o", str(out_path)], check=True)
|
|
except (FileNotFoundError, subprocess.CalledProcessError):
|
|
out_path.write_text(md_content, encoding="utf-8")
|
|
else:
|
|
out_path.write_text(md_content, encoding="utf-8")
|
|
|
|
print(f"Wrote {out_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|