feat(lean): migrate + repair tropical proofs; unify the min-max ⇄ max-plus duality - #16
Merged
Merged
Conversation
…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>
🔍 Hypatia Security ScanFindings: 40 issues detected
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Brings the min-max transport semiring (
TropicalAdapterPath.lean) in beside itsmax-plus twin (
TropicalSessionTypes.lean), repairs both to compile clean under apinned 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.0claims were never true — corroboratingprotocol-squisher's
PROVENANCE.adoc). OnlypathCost_mono+hub_ceilinghad everbeen machine-checked, in isolation.
Repairs
TropicalSessionTypes.lean(max-plus): import ordering; max-distributivity helpers(
Nat.max_def+ split + omega); localOneclass +OfNatshim (4.13.0 core hasZerobut not
One);spec_parQTT case; header version corrected.TropicalAdapterPath.lean(min-max): import ordering; dangling doc-comment;push_neg(Mathlib-only) → core tactics;AdapterPathdef→abbrev;pathCost_appendpathCost_le_sequentialreproved.Corrected a false theorem:
dual_tcMul_boundedclaimeddual(max m n) = dual m + dual n − maxGrade, false atm=1, n=2(1 vs 0). Replaced withthe 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 buildis green.propext(+Quot.sound) — nosorry, noClassical.choice. CI (.github/workflows/lean.yml) re-runs this andfails 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 ondocs/FORMAL-PROOFS.adoc(its Lean listings predate the v6.0 source).
Commits GPG-signed (
1835A14A).🤖 Generated with Claude Code