Skip to content

feat(lean): migrate + repair tropical proofs; unify the min-max ⇄ max-plus duality - #16

Merged
hyperpolymath merged 2 commits into
mainfrom
feat/lean-tropical-migration
Jun 11, 2026
Merged

feat(lean): migrate + repair tropical proofs; unify the min-max ⇄ max-plus duality#16
hyperpolymath merged 2 commits into
mainfrom
feat/lean-tropical-migration

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Brings the min-max transport semiring (TropicalAdapterPath.lean) in beside its
max-plus twin (TropicalSessionTypes.lean), repairs both to compile clean under a
pinned Lean 4.13.0 toolchain via Lake, and proves the order-reversing duality that
connects them. Source of the min-max file is the frozen provenance archive in
protocol-squisher — that copy is left untouched.

Why it mattered

Both files, as inherited, did not compile on any installed toolchain (the headers'
Verified: Lean 4.13.0 / 4.29.0 claims were never true — corroborating
protocol-squisher's PROVENANCE.adoc). Only pathCost_mono + hub_ceiling had ever
been machine-checked, in isolation.

Repairs

TropicalSessionTypes.lean (max-plus): import ordering; max-distributivity helpers
(Nat.max_def + split + omega); local One class + OfNat shim (4.13.0 core has Zero
but not One); spec_par QTT case; header version corrected.

TropicalAdapterPath.lean (min-max): import ordering; dangling doc-comment;
push_neg (Mathlib-only) → core tactics; AdapterPath defabbrev; pathCost_append

  • pathCost_le_sequential reproved.

Corrected a false theorem: dual_tcMul_bounded claimed
dual(max m n) = dual m + dual n − maxGrade, false at m=1, n=2 (1 vs 0). Replaced with
the true De Morgan dual dual_tcMul_is_min: dual(max m n) = min(dual m, dual n),
completing the duality pair with dual_tcAdd_is_max.

Verification

  • lake build is green.
  • Axiom audit: every headline theorem depends only on propext (+ Quot.sound) — no
    sorry, no Classical.choice
    . CI (.github/workflows/lean.yml) re-runs this and
    fails on any sorry/Classical.choice.

Also

  • lean-toolchain (pinned 4.13.0), lakefile.lean, lake-manifest.json, .gitignore.
  • docs/LEAN-FORMALIZATION.adoc (authoritative reference), README section, CHANGELOG,
    machine-readable ECOSYSTEM.a2ml, and a drift note on docs/FORMAL-PROOFS.adoc
    (its Lean listings predate the v6.0 source).

Commits GPG-signed (1835A14A).

🤖 Generated with Claude Code

hyperpolymath and others added 2 commits June 11, 2026 22:39
…duality

Bring the min-max transport semiring (TropicalAdapterPath) in beside its
max-plus twin (TropicalSessionTypes) and make both compile clean under a
pinned Lean 4.13.0 toolchain via Lake. The min-max file's source is the
frozen provenance archive in protocol-squisher; that copy is left untouched.

Both files previously did NOT compile on any installed toolchain (the headers'
"Verified" claims were never true — corroborating protocol-squisher's
PROVENANCE.adoc finding). Repairs:

TropicalSessionTypes.lean (max-plus twin):
- import ordering (module doc must follow `import`)
- max-distributivity helpers: Nat.max_def + split + omega (was a looping simp)
- local `One` class + OfNat shim (Lean 4.13.0 core has Zero but not One)
- spec_par QTT-refinement case: split on Nat.max before omega
- header version claim corrected to 4.13.0

TropicalAdapterPath.lean (min-max twin):
- import ordering; dangling doc-comment fixed
- push_neg (Mathlib-only) -> core Nat.max_def + split + omega
- AdapterPath def -> abbrev (so List ++/foldl/membership lemmas apply)
- pathCost_append reproved via a uniform pathCost_cons lemma
- pathCost_le_sequential reproved (removed non-existent Nat.max_le_add)
- corrected a FALSE theorem: dual_tcMul_bounded claimed
  dual(max m n) = dual m + dual n - maxGrade, false at m=1,n=2 (1 vs 0).
  Replaced with the true De Morgan dual dual_tcMul_is_min:
  dual(max m n) = min(dual m, dual n), completing the duality pair.

Build/config:
- lean-toolchain pinned to leanprover/lean4:v4.13.0
- lakefile.lean (lean_lib over both roots) + lake-manifest.json
- .gitignore for Lake/Julia/Isabelle artefacts

Axiom audit: all headline theorems depend only on propext (+ Quot.sound);
no sorryAx, no Classical.choice. `lake build` is green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…le + CI

- docs/LEAN-FORMALIZATION.adoc: authoritative reference for both twins — the
  min-max/max-plus duality, build/verify recipe, theorem index, axiom audit,
  and provenance.
- README.adoc: add a "Lean 4 formalization" section.
- docs/FORMAL-PROOFS.adoc: flag that its Lean code listings predate the v6.0
  source (illustrative API) and point to the authoritative doc.
- CHANGELOG.md: record the migration, the duality bridge, the false-lemma
  correction, the docs, and the CI.
- .machine_readable/6a2/ECOSYSTEM.a2ml: add TropicalAdapterPath, lakefile,
  lean-toolchain and the new doc as artefacts; bump 0.2.1 -> 0.2.2.
- .github/workflows/lean.yml: lake build + axiom audit (fails on
  sorry/Classical.choice) on push/PR.

Adds the owner's canonical SPDX-FileCopyrightText attribution to README.adoc and
CHANGELOG.md to satisfy the strict pre-commit owner-string gate (attribution
only; no SPDX-License-Identifier touched).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 40 issues detected

Severity Count
🔴 Critical 1
🟠 High 26
🟡 Medium 13

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in codeql.yml",
    "type": "missing_workflow",
    "file": "codeql.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in scorecard.yml",
    "type": "missing_workflow",
    "file": "scorecard.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "missing_workflow",
    "file": "mirror.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in secret-scanner.yml",
    "type": "missing_workflow",
    "file": "secret-scanner.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action perpolymath/standards/.github/workflows/governance-reusable.yml@main\n needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action tions/checkout@v4\n\n needs attention",
    "type": "unpinned_action",
    "file": "lean.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in governance.yml",
    "type": "missing_timeout_minutes",
    "file": "governance.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in hypatia-scan.yml",
    "type": "missing_timeout_minutes",
    "file": "hypatia-scan.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in lean.yml",
    "type": "missing_timeout_minutes",
    "file": "lean.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Required file missing (condition: has_dependencies)",
    "type": "missing_requirement",
    "file": ".github/dependabot.yml",
    "action": "create",
    "rule_module": "cicd_rules",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath merged commit 92d13d4 into main Jun 11, 2026
12 checks passed
@hyperpolymath
hyperpolymath deleted the feat/lean-tropical-migration branch June 11, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant