Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"contract_id": "GCL-CIR-001",
"version": "1.0.0",
"component_id": "oai26_wp03_f011_external_fiber_count_equiv",
"owner": "OAI26 WP03 Family 011 external-vs-GCL totient fiber semantics",
"paths": {
"exact": [
"sources/OPENAI-MATH-2026/WP03_FAMILY011_EXTERNAL_FIBER_COUNT_EQUIV.lean",
"sources/OPENAI-MATH-2026/WP03_FAMILY011_EXTERNAL_FIBER_COUNT_EQUIV_REPLAY.json",
"tests/test_openai_math_wp03_f011_fiber_count_equiv.py"
],
"prefixes": [],
"test_prefixes": []
},
"depends_on": [
"ci_routing"
],
"checks": [
"forge-reconnaissance"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Mathlib
import OAI.NumberTheory.TotientFibers.FiniteFiber

namespace GCL.OAI26.Family011

noncomputable def externalFiberCount (n : ℕ) : ℕ :=
({m : ℕ | Nat.totient m = n} : Set ℕ).ncard

theorem external_fiber_count_eq_g_of_pos (n : ℕ) (hn : 0 < n) :
externalFiberCount n = OAI.TotientFibers.g n := by
have hsets : ({m : ℕ | Nat.totient m = n} : Set ℕ) =
OAI.TotientFibers.fiber n := by
ext m
constructor
· intro h
refine ⟨?_, h⟩
by_contra hm
have hm0 : m = 0 := Nat.eq_zero_of_not_pos hm
subst m
simp at h
omega
· intro h
exact h.2
simp only [externalFiberCount, OAI.TotientFibers.g, hsets]

#print axioms GCL.OAI26.Family011.external_fiber_count_eq_g_of_pos

/-- Removing the single target zero from an infinite set and rewriting the
positive-target preimage count preserves infinitude. -/
theorem infinite_gcl_of_external (ε : ℝ)
(h : Set.Infinite {n : ℕ | (externalFiberCount n : ℝ) >
(n : ℝ) ^ (1 - ε)}) :
Set.Infinite {n : ℕ | 0 < n ∧
(OAI.TotientFibers.g n : ℝ) > (n : ℝ) ^ (1 - ε)} := by
have hpos : Set.Infinite
({n : ℕ | (externalFiberCount n : ℝ) > (n : ℝ) ^ (1 - ε)} \ {0}) :=
h.sdiff (Set.finite_singleton 0)
convert hpos using 1
ext n
simp only [Set.mem_sdiff, Set.mem_ofPred_eq, Set.mem_singleton_iff]
constructor
· rintro ⟨hn, h⟩
rw [← external_fiber_count_eq_g_of_pos n hn] at h
exact ⟨h, Nat.ne_of_gt hn⟩
· rintro ⟨h, hn0⟩
have hn : 0 < n := Nat.pos_of_ne_zero hn0
rw [external_fiber_count_eq_g_of_pos n hn] at h
exact ⟨hn, h⟩

#print axioms GCL.OAI26.Family011.infinite_gcl_of_external

/-- Universal-ε transfer of the exact external Erdős 821 statement to
GCL's positivity-restricted theorem statement. -/
theorem gcl_claim_of_external_claim
(h : ∀ ε > (0 : ℝ),
Set.Infinite {n : ℕ | (externalFiberCount n : ℝ) >
(n : ℝ) ^ (1 - ε)}) :
∀ ε > (0 : ℝ),
Set.Infinite {n : ℕ | 0 < n ∧
(OAI.TotientFibers.g n : ℝ) > (n : ℝ) ^ (1 - ε)} := by
intro ε hε
exact infinite_gcl_of_external ε (h ε hε)

#print axioms GCL.OAI26.Family011.gcl_claim_of_external_claim


end GCL.OAI26.Family011
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"record_type": "GCL_OAI26_F011_EXTERNAL_G_EQUIV_LEAN_REPLAY/1",
"intent": "PROVE_POSITIVE_TARGET_PREIMAGE_COUNT_IDENTITY_AND_INFINITE_SET_TRANSFER",
"external_source": {
"repo": "cadamcat/totient-fibers-lean4",
"commit": "f75d4f2c2d6685a0547f17fa07240377aa2c2ed4",
"path": "Erdos821/Challenge.lean",
"git_blob_sha1": "ac85c9a6a0878d18de3d923ca1a14e8213089c03",
"g_definition": "({m : ℕ | Nat.totient m = n} : Set ℕ).ncard",
"unconditional_external_theorem_replayed_by_gcl": false
},
"gcl_source": {
"repo": "openai/math",
"commit": "1581d4cbdd69a0faf34b2089614fe2a814316a6a",
"manifest_sha256": "cf6105a25d9dca2f166b241d9191bd12c7e13305890dc9c4d0952351cccc0794",
"path": "lean/OAI/NumberTheory/TotientFibers/FiniteFiber.lean",
"git_blob_sha1": "217cfe4d7f9c39981eabe9bbeeb8458febb0fc76",
"g_definition": "(OAI.TotientFibers.fiber n).ncard where fiber n = {m | 0 < m ∧ Nat.totient m = n}",
"toolchain": "leanprover/lean4:v4.34.1",
"mathlib_commit": "d13f23b723b8a846827a245b89c10fc7d3f11612"
},
"proof": {
"path": "sources/OPENAI-MATH-2026/WP03_FAMILY011_EXTERNAL_FIBER_COUNT_EQUIV.lean",
"git_blob_sha1": "f649ebb960794a48e5668531fd38449f7a046fc0",
"sha256": "30886e87944de53e0f681ccfe8d6d4a71bd5fe6607abe16e44b524bf3153c31c",
"theorems": {
"GCL.OAI26.Family011.external_fiber_count_eq_g_of_pos": {
"theorem": "∀ n : ℕ, 0<n → externalFiberCount n = OAI.TotientFibers.g n",
"lean_exit": 0,
"axioms": [
"propext",
"Classical.choice",
"Quot.sound"
]
},
"GCL.OAI26.Family011.infinite_gcl_of_external": {
"theorem": "for any real ε, infinite external-preimage fiber targets imply infinite GCL-positive targets",
"lean_exit": 0,
"axioms": [
"propext",
"Classical.choice",
"Quot.sound"
]
},
"GCL.OAI26.Family011.gcl_claim_of_external_claim": {
"theorem": "all-ε>0 external Erdős 821 statement implies all-ε>0 GCL positive-target statement",
"lean_exit": 0,
"axioms": [
"propext",
"Classical.choice",
"Quot.sound"
]
}
},
"exclusion_argument": "Nat.totient 0 = 0; definitions coincide for n>0, and removing singleton {0} from an infinite set preserves infinitude"
},
"execution": {
"runtime": "CHAD_LOCAL_OS_ONLY_NOT_INDEPENDENTLY_AUTHENTICATED",
"compiler_exit": 0,
"compiler_errors": 0,
"verified_utc": "2026-11-11",
"compiler_log_sha256": "10f421668aa69af088709ba075d72a3761edf706c593120da9f9b69ea510f165",
"compiler_log_path": "/home/jim/gcl-evidence/OAI26-F011/fiber-identity/replay5.log",
"compiler_command": "LEAN_PATH=<exact source-pinned OAI build paths> leanprover/lean4:v4.34.1/bin/lean FiberIdentity.lean",
"no_sorry": true,
"no_fresh_axioms": true
},
"acceptance_limits": {
"mathematical_statement_equivalence_proved": true,
"external_unconditional_theorem_proof_replayed_by_gcl": false,
"source_mathematical_paper_independently_peer_reviewed": false,
"mathcert_certified": false,
"programme_closed": false
},
"next": "Protected exact-head CI/merge of this proof; then finish external 939-module Colab build, verification.sh, leanchecker --fresh Erdos821.Theorem, independent source criticism"
}
89 changes: 89 additions & 0 deletions tests/test_openai_math_wp03_f011_fiber_count_equiv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
"""Pinned mathematical custody guard for external and GCL totient-fiber semantics.

An earlier exact source-pinned Lean 4.34.1 kernel replay is separately recorded.
This Python guard does not itself prove the mathematics.
"""
from copy import deepcopy
from hashlib import sha256
from pathlib import Path
import json
import re
import unittest

ROOT=Path(__file__).resolve().parents[1]/"sources"/"OPENAI-MATH-2026"
SOURCE=ROOT/"WP03_FAMILY011_EXTERNAL_FIBER_COUNT_EQUIV.lean"
RECEIPT=ROOT/"WP03_FAMILY011_EXTERNAL_FIBER_COUNT_EQUIV_REPLAY.json"
EXPECTED_SHA="30886e87944de53e0f681ccfe8d6d4a71bd5fe6607abe16e44b524bf3153c31c"
EXPECTED_HEAD="1581d4cbdd69a0faf34b2089614fe2a814316a6a"
EXTERNAL_HEAD="f75d4f2c2d6685a0547f17fa07240377aa2c2ed4"
THEOREMS=[
"GCL.OAI26.Family011.external_fiber_count_eq_g_of_pos",
"GCL.OAI26.Family011.infinite_gcl_of_external",
"GCL.OAI26.Family011.gcl_claim_of_external_claim"]
AXIOMS={"propext","Classical.choice","Quot.sound"}

def validate(source,record):
if record["record_type"]!="GCL_OAI26_F011_EXTERNAL_G_EQUIV_LEAN_REPLAY/1":
raise ValueError("wrong record type")
if sha256(source.encode()).hexdigest()!=EXPECTED_SHA or record["proof"]["sha256"]!=EXPECTED_SHA:
raise ValueError("source hash drift")
if record["external_source"]["commit"]!=EXTERNAL_HEAD or record["gcl_source"]["commit"]!=EXPECTED_HEAD:
raise ValueError("source revision drift")
if record["external_source"]["git_blob_sha1"]!="ac85c9a6a0878d18de3d923ca1a14e8213089c03":
raise ValueError("external g source changed")
if record["gcl_source"]["git_blob_sha1"]!="217cfe4d7f9c39981eabe9bbeeb8458febb0fc76":
raise ValueError("GCL g source changed")
if set(record["proof"]["theorems"])!=set(THEOREMS):
raise ValueError("missing formal theorem")
for name in THEOREMS:
d=record["proof"]["theorems"][name]
if d["lean_exit"]!=0 or set(d["axioms"])!=AXIOMS:
raise ValueError("failed or untrusted theorem")
if record["execution"]["compiler_exit"]!=0 or record["execution"]["compiler_errors"]!=0:
raise ValueError("Lean replay incomplete")
b=record["acceptance_limits"]
if b["external_unconditional_theorem_proof_replayed_by_gcl"] or b["mathcert_certified"] or b["programme_closed"]:
raise ValueError("unearned external proof acceptance")
anchors=["Nat.totient m = n",
"OAI.TotientFibers.g n",
"theorem external_fiber_count_eq_g_of_pos",
"0 < n",
"theorem infinite_gcl_of_external",
"h.sdiff (Set.finite_singleton 0)",
"theorem gcl_claim_of_external_claim",
"#print axioms GCL.OAI26.Family011.gcl_claim_of_external_claim"]
if any(s not in source for s in anchors):
raise ValueError("altered theorem text")
if re.search(r"(?m)^\\s*(sorry|admit|axiom)\\b",source):
raise ValueError("proof placeholder")
return True

class TestF011TotientFiberIdentity(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.s=SOURCE.read_text()
cls.j=json.loads(RECEIPT.read_text())
def test_valid_receipt(self):self.assertTrue(validate(self.s,self.j))
def reject(self,change,message):
x=deepcopy(self.j);change(x)
with self.assertRaisesRegex(ValueError,message):validate(self.s,x)
def test_wrong_external_head(self):
self.reject(lambda x:x["external_source"].update(commit="0"*40),"revision")
def test_wrong_g_definition(self):
self.reject(lambda x:x["gcl_source"].update(git_blob_sha1="0"*40),"GCL g")
def test_unearned_external_proof_pass(self):
self.reject(lambda x:x["acceptance_limits"].update(external_unconditional_theorem_proof_replayed_by_gcl=True),"unearned")
def test_unearned_certification(self):
self.reject(lambda x:x["acceptance_limits"].update(mathcert_certified=True),"unearned")
def test_lost_theorem(self):
self.reject(lambda x:x["proof"]["theorems"].pop(THEOREMS[1]),"missing formal")
def test_sorry_axiom(self):
self.reject(lambda x:x["proof"]["theorems"][THEOREMS[2]]["axioms"].append("sorryAx"),"untrusted")
def test_false_lean_result(self):
self.reject(lambda x:x["execution"].update(compiler_exit=1),"replay incomplete")
def test_erased_zero_exclusion(self):
with self.assertRaisesRegex(ValueError,"source hash drift"):
validate(self.s.replace("h.sdiff (Set.finite_singleton 0)","h"),self.j)

if __name__=="__main__":
unittest.main()
Loading