diff --git a/.github/workflows/small-lifetime-shape.yml b/.github/workflows/small-lifetime-shape.yml new file mode 100644 index 000000000..6bac52cf4 --- /dev/null +++ b/.github/workflows/small-lifetime-shape.yml @@ -0,0 +1,37 @@ +name: Small-lifetime shape and moment crossover checks + +'on': + pull_request: + paths: + - 'frontiers/small_lifetime_shape_20260930/**' + - '.github/workflows/small-lifetime-shape.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + exact-and-source: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + persist-credentials: false + fetch-depth: 0 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: '3.11.16' + - name: Fetch exact public source commits + run: | + set -euo pipefail + git fetch --no-tags origin ae343a1c2a0070476fed4d31a15b6911831edd4d + git fetch --no-tags origin 56a7904f9ad7d409c31e23195c0e7eeab230613a + - name: Verify both sources, packet and exact controls + env: + PYTHONDONTWRITEBYTECODE: '1' + GIT_NO_REPLACE_OBJECTS: '1' + run: | + set -euo pipefail + python -B -S frontiers/small_lifetime_shape_20260930/verify.py + git diff --exit-code diff --git a/frontiers/small_lifetime_shape_20260930/MANIFEST.json b/frontiers/small_lifetime_shape_20260930/MANIFEST.json new file mode 100644 index 000000000..dcad2d5d7 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/MANIFEST.json @@ -0,0 +1,79 @@ +{ + "schema": 1, + "scientific_effect": "NONE", + "review_status": "NONAUTHOR_REVIEW_OPEN", + "files": [ + { + "path": "PLAN.md", + "bytes": 1990, + "sha256": "57197b803f766fbb499b8036db59b169a34c0eed4bbe883c69064bff0714bd94", + "git_blob": "3a21113120bd24e783ba1a647797f56df5d2ee34" + }, + { + "path": "PROOF.md", + "bytes": 17932, + "sha256": "70aec4a9cf0ea0aed1dae04f7345481a32f42f2707dca89d31a086fd451d9b64", + "git_blob": "71906304451abc7a422c65a76b297874bdcb8cfe" + }, + { + "path": "README.md", + "bytes": 3749, + "sha256": "52dd2c3050eb34c46364cdf0ec47d1178650d7116a3be6209b47f59a5ab6bc31", + "git_blob": "d0886a4bac606f87731c275fe3243c2a444b168f" + }, + { + "path": "RECONNAISSANCE.md", + "bytes": 2127, + "sha256": "d23d28c62e8a90b25c07d7013d5de2eb8240aa3ef8a8f89f2eb6a98cd96050f1", + "git_blob": "533cef3ce59bc1976e32c0c7077c4d8b54d0317c" + }, + { + "path": "RESULTS.json", + "bytes": 800, + "sha256": "a733f8baf3a4d409d8b3bff6768a609e3efd36d235d4c04dc76f6ce208e72e39", + "git_blob": "7083aeb451578d29e071303e78451692947e7d2a" + }, + { + "path": "SOURCES.json", + "bytes": 1118, + "sha256": "a594d88ce35716bd3f8ef659cf43ee9267b1d1b186b5b19edc0813f327182651", + "git_blob": "bde07b2fc5ed653185713c6d011f0ab2bd441b48" + }, + { + "path": "VALIDATION.md", + "bytes": 3507, + "sha256": "c6035d317c3e5b677f0657113ef5641072e7a0abf97d91f0fc14dd6887ee8940", + "git_blob": "1cc9569f49e2ccf27173cbae2cfe1dd1ecc28372" + }, + { + "path": "shape.py", + "bytes": 8811, + "sha256": "fa7d46f74b74ca7ab5e52edb0285e60fc0b6db320cd004e1f6bd3dce16ea9226", + "git_blob": "d44da81c9faf7428998cf484290db59d89bbf55f" + }, + { + "path": "test_jacobian.py", + "bytes": 1849, + "sha256": "eb7569f5ec0eb8a4d29cdfe2e0ea2a19e4b7518f44159af02576ae0d45f03682", + "git_blob": "4fbd7f0a4f0976c3fa01663f37ec0d1c643dfbf9" + }, + { + "path": "test_shape.py", + "bytes": 8137, + "sha256": "ce20396e5659af4361d4102a528496793df532bd83d00c1b0f5fa5a664a73e7d", + "git_blob": "a47c361f0cc820a06e1c6e89b80e7844a9da5051" + }, + { + "path": "test_verify.py", + "bytes": 6746, + "sha256": "5ae0bd70f64e1f481405a2ac3be15d420310a1eda764d0e51e22cc96aa6b63d9", + "git_blob": "acc836c2c2719f4788cf1e6651d25e20df7dfb15" + }, + { + "path": "verify.py", + "bytes": 5379, + "sha256": "484320913f4f196c0b4113a6af02e245527542825270ad2ee32ad90caa50d0dd", + "git_blob": "3403814d2f27574be63faa5f89d3635f7b6d3316" + } + ] +} diff --git a/frontiers/small_lifetime_shape_20260930/PLAN.md b/frontiers/small_lifetime_shape_20260930/PLAN.md new file mode 100644 index 000000000..3a2111312 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/PLAN.md @@ -0,0 +1,31 @@ +# Small-lifetime recovery and implementation plan + +Goal: recover the specific unfinished calculation from the user's interruption +screenshot, test it and publish an additive conditional consumer. Do not redo +PR182's fixed-r inverse moment proof, alter PR181 or count source-exposed work +as independent review. The new direct September30 Continue authorizes this +foreground work; it does not restart a stopped agent, timer, watch or loop. + +Design: start from PR181's explicit normalized shape density and exact companion +map. Solve the singleton boundary before scaling. Blow up the selected lifetime +and shape coordinate, derive the normalized limiting law, then compare it against +the exact finite-cutoff doublet square density. The square corner analysis is +needed to justify unbounded moments rather than infer them from weak convergence. + +Implementation is inline in a new isolated packet directory. A complete local +upstream checkout could not be obtained, so GitHub Git-data writes are additive +on a new branch and actual historical-source verification is hosted. + +Completed author-side tasks: +1. Read live main#95 claims, PR181 exact interface and PR182's delivered reviews. +2. Claim only the unfinished small-lifetime consumer, not an overlapping source. +3. Write eight failing exact tests; implement shape and ratio algebra. +4. Expand independent checks, including the direct inner-root square Jacobian. +5. Write16 hostile Git/inventory tests and observe29 failures before implementation. +6. Implement verification; run46 tests per mode and all six semantic mutants. +7. Write full proof, immutable source pins, exact results and bounded reconnaissance. + +Publication tasks: authenticate the full remote packet tree against local bytes; +create an additive PR/workflow; request bounded nonauthor A/B/C reviews; inspect +current hosted source and existing downstream/formal checks, without anticipating +success or acceptance. The author will not self-merge or change scientific status. diff --git a/frontiers/small_lifetime_shape_20260930/PROOF.md b/frontiers/small_lifetime_shape_20260930/PROOF.md new file mode 100644 index 000000000..719063044 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/PROOF.md @@ -0,0 +1,389 @@ +# Small-lifetime doublets: an exact shape limit and a singular companion-moment crossover + +Object: OA-SMALL-LIFETIME-SHAPE-20260930-v1. +Author: OpenAI / GPT-6 Astra Pro, foreground continuation after the owner's +new September 30 instruction and interrupted-session screenshot. +Disposition: AUTHOR-SIDE CONDITIONAL CANDIDATE; NONAUTHOR REVIEW OPEN. +Scientific effect NONE. No source proof, register, Boolean, prize or existing +review changes. This conversation authored the source cluster calculations; +its reconstruction here is not an independent review of those premises. + +## 1. Precisely which law is being conditioned + +This paper studies an EXPLICIT, finite-dimensional probability measure. Its +interpretation as an actual Gaussian elder-partner law is conditional on [E]. +The original field separation r tends to zero first, and the selected partner's +microscopic radius threshold tends to infinity second, as in [E]. We then +condition the resulting lifetime fraction e to be at most epsilon and take +epsilon to zero. A further large companion-ratio limit is taken only afterward. +This is NOT the fixed-r small-lifetime problem of PR182, and that theorem is +neither consumed nor re-proved here. + +Immutable sources (full identities in SOURCES.json): +[E] PR181 PROOF.md at ae343a1c2a0070476fed4d31a15b6911831edd4d, +blob 91f88e392fb8aa947dac4fc81c2b45f783fa66cd: its explicit selected shape law, +(4)-(7), (15)-(17), and its doublet square density and heights (20)-(23). +[C] PR169 PROOF.md at 56a7904f9ad7d409c31e23195c0e7eeab230613a, +blob 19a6044f2066643b5baab34ce5b6b6efb431e84a: deterministic companion-root +involution and strict doublet classifier E12-E17. No new Gaussian or +actual-pairing conclusion is inferred from polynomial roots alone. + +Put E0=888807/280. In the coordinates of [E], x=-u-1/2 and +v=6(e+x), the selected shape probability Pi has density + + dPi(e,x)=E0^-1 K(e,x) de dx, + K(e,x)=10368(e-x^2)(e+x^2+2x)(e+2ex+x^2), (1) + +on 00 solves 3b^2+2b^3=e. (2) + +The root b(e) is unique in (0,1/2). K is strictly positive on the interior. +The mass is one: integrate e first on the two polynomial strips +-11. +On singletons define V=1 and the other marks by a sentinel; their mass will +vanish in the new limit. None of the claims concern the global torus count. + +Write Pi_epsilon=Pi(. | e<=epsilon), and let Pi_epsilon,2 additionally condition +on n=2. The parameter epsilon is a lifetime cutoff, not r or the radius cutoff. +Total variation is half the full L1 distance of probability densities. + +## 2. Exact singleton boundary, before taking a limit + +**Lemma 1.** Let c(e)>0 be the unique root of + + 2c^3+3e c^2=e^2. (3) + +On the support of (1), n=1 exactly for x<=c(e), and n=2 exactly for x>c(e), +up to tie null sets. In particular 0=-1/2 lies on the singleton side of the cubic classifier. +For x>0 set p=x+1/2, A=12p^2-3=12x(1+x) and v=6(e+x). +The source doublet inequalities are v0. + +Direct expansion gives + + (v-A)^2(2v+A)-12(v-Ap)^2 + =432(1-e)(2x^3+3e x^2-e^2). (4) + +The second inequality therefore reduces to the positive sign in (3). +It implies the first: if e>=x+2x^2 (equivalently v>=A), the expression +2x^3+3e x^2-e^2 is decreasing in e on that range, and at e=x+2x^2 it equals +x^2(2x-1)(x+1)<0 for 00, negative at zero, and at x=b(e) is 2b(e)^3(1-e)>0. +This proves the unique boundary and the classification. At equality the +companion lies at the excluded window height; treating it as one root rather +than two has no effect on the absolutely continuous measure. QED. + +Two DIFFERENT scales appear as e decreases: + + b(e)=sqrt(e)[1/sqrt(3)+O(sqrt(e))], + c(e)=e^(2/3)[2^(-1/3)+O(e^(1/3))], + a(e)=-e/2+O(e^2). (5) + +For b, divide its equation by e. For c, set c=e^(2/3)z and obtain +2z^3+3e^(1/3)z^2=1. The implicit-function theorem at the respective positive +roots gives both estimates, with bounded derivatives on a small fixed interval. + +## 3. Normalized shape limit and a sharp singleton probability + +Define, under Pi_epsilon, + + Y=e/epsilon, W=x/sqrt(e). (6) + +**Theorem 1 (shape and multiplicity).** The law of (Y,W) converges in total +variation at O(sqrt(epsilon)) to independent variables with densities + + f_Y(y)=4y^3, 00. (8) + +Consequently doublets tend to probability one. For the TAGGED joint law, + + dTV(Law_Pi_epsilon(n,Y,W), delta_2 x Law(Y,W in (7))) + =C_s epsilon^(1/3)+O(epsilon^(1/2)). (9) + +No rate is asserted for physical marks obtained through epsilon-dependent +singular maps; their convergence below is weak. + +Proof of (7). Put delta=sqrt(e). From (1), after x=delta w, + + K(e,x)dx=10368 e^3 Phi_delta(w) dw, + Phi_delta(w)=(1-w^2)[2w+delta(1+w^2)] + [1+w^2+2delta w]. (10) + +Its interval is l(delta)=0, +l,h are smooth and all interval endpoints and coefficients are bounded. +Therefore the L1 difference between the interval-extended Phi_delta and +Phi_0(w)=2w(1-w^4)1_(0,1/sqrt(3)) is O(delta). This includes the moving +boundary contribution; Phi_0 does not vanish at its upper endpoint. + +Its integral is A0=26/81. Hence, writing unnormalized shape masses, + + A_epsilon=integral_(e<=epsilon) K de dx + =832 epsilon^4[1+O(sqrt(epsilon))]. (11) + +The normalized density of (Y,W) is proportional to +y^3 Phi_(sqrt(epsilon y))(w), with the same interval restrictions. The L1 +estimate, integrated over y, is O(sqrt(epsilon)), and the normalizing constant +tends to A0/4. This gives exactly (7). Both densities integrate to one. + +Proof of (8). The unnormalized singleton density at e is +S(e)=integral_(a(e))^(c(e)) K(e,x)dx. Put tau=e^(1/3), x=e^(2/3)z. Then + + S(e)=10368 e^(10/3) integral + (1-tau z^2)(2z+tau+tau^2 z^2)(1+tau z^2+2tau^2z) dz. (12) + +The lower endpoint is -tau/(1+sqrt(1-tau^3)); the upper endpoint solves +2z^3+3tau z^2=1. They converge to 0 and 2^(-1/3), smoothly in tau. Thus + + S(e)=10368*2^(-2/3)e^(10/3)[1+O(e^(1/3))]. (13) + +Integrate from zero to epsilon and divide by (11). The coefficient is +10368*(3/13)/832 times 2^(-2/3), namely C_s. The relative error is +O(epsilon^(1/3)); the smaller normalization error O(sqrt(epsilon)) does not +change it. This proves (8). + +Finally replace n by 2 without changing (Y,W). The TV distance between the +original tagged law and this replacement is exactly Pi_epsilon(n=1). +The replacement is O(sqrt(epsilon)) from the limit in (7). The triangle and +reverse-triangle inequalities give (9). QED. + +The nonzero singleton error is not an artifact of numerics: its e^(2/3) +spatial-jet boundary (3) is thinner than, but sits inside, the main sqrt(e) +shape scale. Conditioning only on an exact e gives the analogous singleton +probability (81/26)2^(-2/3)e^(1/3)[1+O(e^(1/3))]. + +## 4. Limiting companion geometry and a tail of exponent ONE + +**Theorem 2.** Under Pi_epsilon, the companion ratio, defined on doublets, +converges in distribution to + + V0=(1-W^2)/(2W^2)>1. (14) + +It is independent of Y in (7). Its exact density and survival function are + + g(v)=(81/13)[(2v+1)^(-2)-(2v+1)^(-4)], v>1, + P(V0>t)=81/[26(2t+1)]-27/[26(2t+1)^3], t>=1. (15) + +In particular P(V0>t)~(81/52)t^-1. Its nonnegative moments are finite exactly +below 1; E[min(V0,T)]~(81/52)log T. The reciprocal rho0 has density + + (324/13)(1+rho)/(2+rho)^4, 0 (Y, H(V0), Y H(V0)), + H(v)=v^3(v+2)/(2v+1). (17) + +This convergence is weak, including sentinel removal using (8). + +Proof. Write delta=sqrt(e), u=-1/2-delta w, v_shape=6(delta^2+delta w). +Substituting in the exact companion involution yields the following rational +identities, wherever a counted companion exists: + + D_delta(w)=4w^3+delta(3w^4+6w^2-1)+4delta^2w^3, + V_delta(w)=(1-w^2)[2w+delta(1+w^2)]/D_delta(w), + e_c/e=(1-w^2)^3[1+3w^2+delta(6w+2w^3)+delta^2(1+3w^2)] + /D_delta(w)^2. (18) + +On each compact subset of 0t)~[81/(52*2^(1/3))]t^-1/3. (19) + +Independence and E[Y^(1/3)]=12/13 give +P(YH(V0)>t)~[243/(169*2^(1/3))]t^-1/3. A bounded-tail envelope from (15) +justifies dominated convergence in Y. The nonnegative moment thresholds for +these two limits are1/3. These are height ratios/scaled marks, not the +unscaled bounded height e_c at a positive epsilon. + +## 5. Why exponent13 at fixed epsilon is consistent with exponent1 in the limit + +Use [E]'s doublet square coordinates (rho,z) in (0,1)^2. Its unnormalized +selected density and lifetime are + + J(rho,z)=165888 rho^12 z^7(1+z)^4 R(rho,z), + R=(1+rho z)^4(1+rho z+rho)^7/ + [(1+rho)^5(1+2rho z+rho)^9], + e(rho,z)=rho^3 z^2(1+z)(rho z+rho+2)/ + [(rho+1)(2rho z+rho+1)]. (20) + +The normalization on e<=epsilon,n=2 is +B_epsilon=integral J 1{e<=epsilon} d rho dz. +By (8)-(11), + + B_epsilon=832 epsilon^4[1+O(epsilon^(1/3))]. (21) + +This is a SHAPE normalization, not the original Gaussian endpoint normalizer. +There is no extra D or E0 in the conditional density J/B_epsilon. +The coefficient R and the positive function e/(rho^3 z^2) extend continuously +to the closed square, with finite positive upper/lower bounds. Thus + + c rho^3z^2<=e(rho,z)<=C rho^3z^2, + c rho^12 z^7<=J(rho,z)<=C rho^12 z^7. (22) + +**Theorem 3 (a uniform tail envelope in the algebraic law).** For sufficiently +small epsilon and all T>=1, + + Pi_epsilon,2(V>T) + <= C min(T^-1, epsilon^-4 T^-13). (23) + +For each FIXED epsilon>0, + + Pi_epsilon,2(V>T) + ~ [165888 H0/(13 B_epsilon)] T^-13, + H0=6401/3960. (24) + +Hence its nonnegative moments are finite exactly for p<13 at every positive +epsilon. The exponent1 emerges only after epsilon->0. There is no +contradiction or unmentioned transfer of uniform integrability. + +Proof. The event e<=epsilon implies z<=min(1,C sqrt(epsilon)rho^-3/2). +Integration of the bound rho^12 z^7 gives + + integral_(rho<1/T,e<=epsilon) J + <= C integral_0^(1/T) min(rho^12,epsilon^4)d rho. + +Divide by (21), and either bound the integrand by epsilon^4 or by rho^12. +This proves (23). At fixed epsilon, for all sufficiently small rho the entire +z interval satisfies e<=epsilon, by the uniform upper bound in (22). Moreover +R(rho,z)->1 uniformly. Direct integration then gives (24). A positive lower +bound on any interior z subinterval shows divergence at p>=13, while the +upper bound J<=C rho^12 z^7 gives finiteness below13. QED. + +The crossover scale in this envelope is T of order epsilon^-1/3. The two terms +in (23) are bounds, not an asserted exact uniform crossover profile. + +## 6. Complete companion-moment crossover within the explicit law + +**Theorem 4.** Under Pi_epsilon,2, as epsilon->0: + + 0<=p<1: E[V^p] -> E[V0^p]=13: E[V^p]=infinity for every fixed epsilon>0, (25) + +where the positive finite coefficient is explicitly + + K_p=2592/[13(13-p)] * 2^(-(13-p)/3) + * integral_0^1 z^((2p-5)/3)(1+z)^((p-1)/3) dz. (26) + +For example K_4=30/13, K_7=441/65, and K_10=3270/91. +The normalization may instead be Pi_epsilon with the moment restricted to n=2; +its leading asymptotics agree because Pi_epsilon(n=2)->1. No statement is made +about these moments in the original finite-r field. + +Proof for p<1. The first bound in (23), uniformly in epsilon, supplies uniform +integrability of V^p (use any intervening power less than1). The weak limit in +Theorem2 gives convergence. The case p=0 is normalization. + +Proof for 11 and the cutoff tends to +q^3 A(z)<=1, A(z)=2z^2(1+z). +The resulting integrand is 165888 q^(12-p) z^7(1+z)^4 on that domain. +An integrable domination follows directly from (22): for q near0, p<13; +for q large, the cutoff forces z<=Cq^-3/2, and integration in z bounds the +tail by Cq^-p, integrable exactly when p>1. Dominated convergence is legitimate +on the two-dimensional domain, including its corner, not just at fixed z. +Integrating q first yields + + 165888/(13-p) integral_0^1 z^7(1+z)^4 A(z)^(-(13-p)/3) dz. + +Dividing by B_epsilon~832epsilon^4 gives (26). The displayed rational cases +follow by binomial expansion, without numerical integration. + +Proof for p=1. At fixed rho, the lifetime is strictly increasing in z: its +logarithmic derivative is +2/z+1/(1+z)+rho/(rho z+rho+2)-2rho/(2rho z+rho+1)>0, +since the last term is less than1/z in magnitude. Near z=0, uniformly in +0<=rho<=1, + + e= kappa(rho) z^2[1+O(z)], + kappa(rho)=rho^3(rho+2)/(rho+1)^2, + J=165888 rho^12 z^7/(1+rho)^7 [1+O(z)]. (27) + +Choose a sufficiently large fixed M. For rho>=M epsilon^(1/3), the unique +cutoff root has z_epsilon=(epsilon/kappa)^(1/2)[1+O((epsilon/kappa)^(1/2))], +with uniform constants. Integrating J to that root gives + + integral J 1{e<=epsilon} dz + =20736 epsilon^4 (1+rho)/(2+rho)^4 + [1+O(epsilon^(1/2)rho^-3/2)]. (28) + +After division by B_epsilon and multiplication by rho^-1, the leading integral +from M epsilon^(1/3) to1 is + + integral [(324/13)(1+rho)/(2+rho)^4] d rho/rho. + +Its logarithmic coefficient is (81/52)/3=27/52. The integrated relative +cutoff error is bounded, since epsilon^(1/2) integral_(M epsilon^(1/3))^1 +rho^-5/2 d rho=O(1). The normalizer error O(epsilon^(1/3)) times the logarithm +is bounded and tends to zero. On rho=13 assertion was proved in Theorem3. QED. + +The moment crossover is a quantitative explanation for why the limiting ratio +can have infinite mean although every positive-epsilon conditional mean is +finite. It does not assert convergence of unbounded observables from weak +convergence alone; each such claim was proved with the explicit corner density. + +## 7. Review and verification boundaries + +A: Lemma1 and Theorem1 — exact count classification, normalization, two distinct +jet scales, singleton coefficient and tagged/untagged TV distinction. +B: Theorem2 — companion/height substitutions, explicit limiting tail and marks, +sentinels, independence and order of limits. +C: Theorems3-4 — uniform algebraic tail envelope, fixed-epsilon exponent13, +corner domination, exact K_p and the logarithmic coefficient27/52. + +All new conclusions are unconditional statements about the explicitly defined +shape measure (1), together with the stated deterministic root-label interface. +Their Gaussian actual-elder interpretation remains CONDITIONAL on the precise +source laws. No numerical model coefficient, new elder-pairing proof, finite-r +inverse moment, fixed-r count certainty, original-field doublet tail exponent1, +uniform r/epsilon/radius limit or Lean formalization is claimed. + +The companion scripts test finite exact identities, moments, root brackets and +negative variants. They do not certify dominated convergence, total variation +limits, the field-source hypotheses or independent review authenticity. The +fixed-r inverse-moment threshold2/3 in PR182 and the lifetime-fraction threshold4 +in PR181 are different statements; neither is changed by this result. diff --git a/frontiers/small_lifetime_shape_20260930/README.md b/frontiers/small_lifetime_shape_20260930/README.md new file mode 100644 index 000000000..d0886a4ba --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/README.md @@ -0,0 +1,68 @@ +# Small-lifetime doublets and a companion-moment crossover + +OpenAI / GPT-6 Astra Pro. **New conditional consumer; nonauthor analytic review +OPEN. Scientific effect NONE. No self-merge.** This packet recovers the unfinished +small-lifetime calculation, not the separately published fixed-r PR182 theorem. + +## Exactly which limit + +PR181 defines the limiting shape of a distant actual elder partner. We take that +explicit shape probability, condition its lifetime fraction e<=epsilon, and let +epsilon->0. Its field interpretation is conditional on PR181's own hypotheses +and actual-elder interfaces. Order: original r->0, distant microscopic radius +->infinity, THEN epsilon->0. A later companion-threshold limit is distinct. +No finite-r uniform estimate or unbounded moment transfer is asserted. + +## Results in PROOF.md + +- The exact singleton/doublet boundary is `2x^3+3e x^2=e^2`, where x=-u-1/2. + Singletons remain at every positive cutoff. Their conditional probability is + `(486/169)2^(-2/3) epsilon^(1/3)+O(epsilon^(2/3))`. +- `(e/epsilon,x/sqrt(e))` tends in TV at O(sqrt(epsilon)) to independent densities + `4y^3` and `(81/13)w(1-w^4)` on `0=13 diverge already at positive epsilon. + K_p is an explicit one-dimensional integral; K4=30/13,K7=441/65,K10=3270/91. + +The assertions are proved for the explicit finite-dimensional law, including +normalization and corner domination. They are not consequences of weak moment +convergence alone. In particular the exponent-one law does not overwrite the +fixed-epsilon exponent13, nor PR182's fixed-separation inverse threshold2/3. + +## Reproduction + +From a full Git checkout containing both pinned source objects: + + python -B -S frontiers/small_lifetime_shape_20260930/verify.py + +Standalone download: + + python -B -S verify.py --local-only + +The latter explicitly reports source_pins_checked=false. The hosted workflow +must authenticate the actual two source commit/path/size/SHA256/blob bindings. +All real source Git reads disable replacements and check path/object modes. +Local temporary Git repositories test that behavior, not the project sources. + +46 unit-test methods pass in each ordinary/optimized Python mode, including +589 rational classifier cases,12 independent square-to-shape Jacobians, exact +polynomial moments, interval root bounds, signed companion identities and16 +real-Git/packet regression methods. Six semantic mutants reject in both modes. +The scripts use only the standard library; there is no Lean formalization of +the new analytic results. Finite tests are not independent mathematical review. + +## Review requested + +A: exact singleton boundary, two scales, normalized TV limit and sharp singleton +coefficient. B: companion/height limits and change-of-variables tail formulas. +C: uniform tail envelope, finite-cutoff exponent13, corner domination, K_p and +the critical mean coefficient27/52. All reviews must bind exact proof bytes and +declare source exposure. Previous PR181 acceptance, if any, is not a new verdict. diff --git a/frontiers/small_lifetime_shape_20260930/RECONNAISSANCE.md b/frontiers/small_lifetime_shape_20260930/RECONNAISSANCE.md new file mode 100644 index 000000000..533cef3ce --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/RECONNAISSANCE.md @@ -0,0 +1,39 @@ +# Narrow primary-source reconnaissance — 30 September 2026 + +Actual web queries in this recovery pass: +- site.arxiv.org conditional extremes hidden regular variation conditioning tail index moments +- site.arxiv.org Planinic Palm theory extremes typical clusters size bias 2104.03810 + +Primary arXiv abstract/metadata pages opened successfully: + +1. Sidney I. Resnick, Multivariate Regular Variation on Cones: Application to + Extreme Values, Hidden Regular Variation and Conditioned Limit Laws, + arXiv:0712.3442, submitted20 December2007. + https://arxiv.org/abs/0712.3442 + Related framework: different cones and conditioning regimes can expose + different tail behavior. We do not import a theorem whose hypotheses have + not been verified for the present model. + +2. Hrvoje Planinic, Palm theory for extremes of stationary regularly varying + time series and random fields, arXiv:2104.03810v2, revised14 March2023. + https://arxiv.org/abs/2104.03810 + Related framework: typical exceedances versus typical clusters and their + sampling biases. Those generic principles are not new claims of this packet. + +3. Johan Segers, One- versus multi-component regular variation and extremes of + Markov trees, arXiv:1902.02226v2, revised1 October2020; Advances in Applied + Probability52,855-878(2020). + https://arxiv.org/abs/1902.02226 + Related conditional extreme-mark limits. We do not assume a Markov-tree + model, spatial independence or a regularly varying original field from this + analogy. Our probability measure is explicitly defined in PROOF Section1. + +Access depth: abstracts/metadata only; no full text or PDF was audited. No +exhaustive novelty, priority or absence-from-literature assertion is made. +The proof derives its polynomial density, normalizations, limiting tails and +moment crossover directly. Uniform-integrability requirements and the failure +of moment convergence under weak convergence alone are established background, +not discoveries here. + +Consensus was not invoked in this recovery pass; the active request names +GitHub/Superpowers. No current quota or connection status is asserted. diff --git a/frontiers/small_lifetime_shape_20260930/RESULTS.json b/frontiers/small_lifetime_shape_20260930/RESULTS.json new file mode 100644 index 000000000..7083aeb45 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/RESULTS.json @@ -0,0 +1,25 @@ +{ + "critical_mean_log_coefficient": "27/52", + "finite_epsilon_companion_moment_threshold": 13, + "limiting_companion_moment_threshold": 1, + "limiting_companion_tail_coefficient": "81/52", + "mathematical_acceptance": false, + "moment_blowup_constants": { + "10": "3270/91", + "4": "30/13", + "7": "441/65" + }, + "passed": true, + "rational_classifier_cases": 589, + "scientific_effect": "NONE", + "scope": "finite algebra and interval checks only", + "singleton_probability_coefficient": "(486/169)*2^(-2/3)", + "singleton_probability_exponent": "1/3", + "small_lifetime_w_density": "(81/13) w (1-w^4) on (0,1/sqrt(3))", + "small_lifetime_y_density": "4 y^3 on (0,1)", + "source_shape_moments": { + "0": "888807/280", + "1": "3524743221/1361360", + "2": "190490806059/87127040" + } +} diff --git a/frontiers/small_lifetime_shape_20260930/SOURCES.json b/frontiers/small_lifetime_shape_20260930/SOURCES.json new file mode 100644 index 000000000..bde07b2fc --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/SOURCES.json @@ -0,0 +1,25 @@ +{ + "schema": 1, + "scientific_effect": "NONE", + "source_scope": "Conditional exact interfaces; no parent revalidation", + "sources": [ + { + "id": "E", + "commit": "ae343a1c2a0070476fed4d31a15b6911831edd4d", + "path": "frontiers/elder_partner_extremes_20260930/PROOF.md", + "bytes": 17895, + "git_blob": "91f88e392fb8aa947dac4fc81c2b45f783fa66cd", + "sha256": "db6a857879e5829c0da62e3812faa55be5c140589d6d800a479197c68cc8ddd7", + "use": "Explicit selected density and normalization, deterministic root selector, square doublet law and lifetime map. Gaussian interpretation remains conditional; author exposure." + }, + { + "id": "C", + "commit": "56a7904f9ad7d409c31e23195c0e7eeab230613a", + "path": "frontiers/extreme_cluster_sampling_20260930/PROOF.md", + "bytes": 21891, + "git_blob": "19a6044f2066643b5baab34ce5b6b6efb431e84a", + "sha256": "b90cf745e2e67bc9b501c481552f7080d27c28245580668cf72aefa5b7f04715", + "use": "E12-E17 deterministic companion and doublet classification only; no additional Gaussian source claim. Author exposure." + } + ] +} diff --git a/frontiers/small_lifetime_shape_20260930/VALIDATION.md b/frontiers/small_lifetime_shape_20260930/VALIDATION.md new file mode 100644 index 000000000..1cc9569f4 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/VALIDATION.md @@ -0,0 +1,58 @@ +# Actual author-side execution and review boundaries + +The interrupted screenshot is not evidence of a proved or published result. +Live GitHub reads located the fixed-r work in PR182, so it was not duplicated. +The new source-specific small-lifetime shape argument is written in this packet. +The exact original source proof bytes remain unchanged. + +## Test-first execution + +The initial eight-method mathematical scaffold failed all eight assertions. +After implementation the same eight passed. Expanded mathematics includes29 +methods in test_shape.py plus one independently differentiated Jacobian method +in test_jacobian.py. The latter checks12 rational points of the direct +(rho,z)->(e,x) map against K(e,x)|Jacobian|=J(rho,z), including the companion +ratio. This connects the two representations without trusting their apparent +normalization agreement. + +The16-method source/inventory scaffold failed29 assertions including subtests. +After implementation all16 passed. Temporary real Git fixtures check actual +commit types, annotated tags/trees/blobs, full sizes/hashes, historical-versus- +worktree data, path confinement, leaf/ancestor symlinks, replacement forgery, +complete source inventories and packet drift. Their ordinary Git read is first +shown to see forged replacement bytes; the protected verifier must still read +the original source. No actual source tampering is claimed. + +Fresh full suite:46 tests PASS in normal Python and46 PASS under -O, also with +GIT_NO_REPLACE_OBJECTS=1. The mathematical core checks589 exact rational count +classifications, six exact scaled-companion configurations, polynomial density +normalization/moments, exact tail/reciprocal Jacobians, rational singleton/root +brackets, and K4/K7/K10. Six deliberately wrong semantic variants must return1 +in both modes; an unknown label returns2. RESULTS.json is deterministic. + +An exploratory NumPy quadrature checked small-epsilon moment trends. It is +kept outside this packet, is not a standard-library runtime dependency, and is +not used to certify any Gaussian value or limiting theorem. The exact coefficients +in the proof have rational polynomial or one-dimensional integral derivations. + +## Source identity and scope + +Local source copies of PR181/PROOF.md (17895 bytes) and PR169/PROOF.md (21891 +bytes) match the exact recorded SHA256 and Git-blob identities. That byte +comparison is NOT the same as authenticating their historical commit/path +bindings. A complete upstream checkout was unavailable after a direct network +attempt failed DNS. Therefore local-only replay reports source_pins_checked=false; +the hosted target must authenticate both actual Git source bindings. + +All new analytic conclusions require source-bound nonauthor review. Finite +algebra does not prove the limiting Gaussian elder interface, TV domination, +corner limits or independence claims. The spatial statements are weak; scalar +TV statements use fixed-coordinate densities. No unbounded moment is inferred +merely from weak convergence. PR182's fixed-r threshold2/3, PR181's limiting +lifetime threshold4, and this paper's finite-epsilon/limiting companion thresholds +13/1 concern distinct probability laws and are not interchangeable. + +No Lean formalization of the new proof or numerical Gaussian coefficient is +asserted. Hosted results belong in the PR discussion only after direct readback +at their actual head/base. Source reviews do not promote this consumer, and the +author will not self-merge or change a global scientific-status register. diff --git a/frontiers/small_lifetime_shape_20260930/shape.py b/frontiers/small_lifetime_shape_20260930/shape.py new file mode 100644 index 000000000..d44da81c9 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/shape.py @@ -0,0 +1,261 @@ +"""Exact controls for the small-lifetime crossover in a limiting elder law. + +Only the Python standard library is used. These identities and interval checks +are not a proof of the source Gaussian/elder interfaces or uniform field limits. +""" +import argparse +from fractions import Fraction as F +import json +from math import comb + +MUTANTS=('all-doublets-finite','wrong-shape-normalization','retain-exponent13', + 'lose-ratio-jacobian','wrong-height-ratio','lose-moment-crossover') +_MUTANT=None + + +def rat(x): + if type(x) not in (int,F): raise TypeError('exact int or Fraction required') + return F(x) + + +def add(*polys): + out={} + for pol in polys: + for ij,c in pol.items(): out[ij]=out.get(ij,F(0))+c + return {ij:c for ij,c in out.items() if c} + + +def scale(pol,c): return {ij:a*c for ij,a in pol.items() if a*c} + + +def mul(a,b): + out={} + for (i,j),c in a.items(): + for (k,l),d in b.items(): out[i+k,j+l]=out.get((i+k,j+l),F(0))+c*d + return {ij:c for ij,c in out.items() if c} + + +def power(pol,n): + out={(0,0):F(1)} + for _ in range(n): out=mul(out,pol) + return out + + +def kernel_poly(): + # Coordinates are (e,x). This includes the original dv=6 de Jacobian. + return scale(mul(mul({(1,0):F(1),(0,2):F(-1)}, + {(1,0):F(1),(0,2):F(1),(0,1):F(2)}), + {(1,0):F(1),(1,1):F(2),(0,2):F(1)}),F(10368)) + + +def kernel(e,x): + e,x=rat(e),rat(x) + return F(10368)*(e-x*x)*(e+x*x+2*x)*(e+2*e*x+x*x) + + +def shape_moment(j): + """Exact unnormalized moment, integrating e first on two polynomial strips.""" + if type(j) is not int or not 0<=j<=8: raise ValueError('integer order 0..8 required') + pol={(i+j,k):v for (i,k),v in kernel_poly().items()} + total=F(0) + for left,right,low in ((F(-1),F(0),{(0,1):F(-2),(0,2):F(-1)}), + (F(0),F(1,2),{(0,2):F(3),(0,3):F(2)})): + integ={} + for (i,k),v in pol.items(): + part=add({(0,0):F(1)},scale(power(low,i+1),-1)) + integ=add(integ,scale(mul({(0,k):F(1)},part),v/F(i+1))) + total+=sum((v*(right**(k+1)-left**(k+1))/F(k+1) + for (i,k),v in integ.items()),F(0)) + if _MUTANT=='wrong-shape-normalization': total/=6 + return total + + +def in_support(e,x): + e,x=rat(e),rat(x) + return (0-2*x-x*x + and (x<=0 or e>3*x*x+2*x**3)) + + +def doublet(e,x): + if not in_support(e,x): raise ValueError('point outside strict elder shape') + if _MUTANT=='all-doublets-finite': return True + return x>0 and 2*x**3+3*e*x*x-e*e>0 + + +def companion(e,x): + """Other exact cubic root in (e_comp,x_comp,Z_comp/Z); not necessarily counted.""" + e,x=rat(e),rat(x) + u=-F(1,2)-x;v=6*(e+x);b=3-12*u*u + den=4*v*v-8*b*u*v+b*b + if den==0: return None + t=(4*v*v-b*b)/den + uc=(2*b*v-u*(4*v*v+b*b))/den;vc=v*t*t + return uc+F(1,2)+vc/6,-uc-F(1,2),t + + +def scaled_phi(delta,w): + delta,w=rat(delta),rat(w) + return (1-w*w)*(2*w+delta*(1+w*w))*(1+w*w+2*delta*w) + + +def w_density(w): + w=rat(w) + if not (w>0 and 3*w*w<1): return F(0) + return F(81,13)*w*(1-w**4) + + +def limit_w_even_moment(j): + if type(j) is not int or j<0: raise ValueError('nonnegative integer required') + return F(81,13)*(F(1,3**(j+1)*(2*j+2))-F(1,3**(j+3)*(2*j+6))) + + +def w_to_ratio(w): + w=rat(w) + if not (w>0 and 3*w*w<1): raise ValueError('0e:raise ValueError('elder height ordering') + cases+=1 + return cases + + +def result(): + cases=checks() + return {'passed':True,'scientific_effect':'NONE','mathematical_acceptance':False, + 'scope':'finite algebra and interval checks only', + 'rational_classifier_cases':cases, + 'source_shape_moments':{str(j):str(shape_moment(j)) for j in range(3)}, + 'small_lifetime_y_density':'4 y^3 on (0,1)', + 'small_lifetime_w_density':'(81/13) w (1-w^4) on (0,1/sqrt(3))', + 'singleton_probability_coefficient':'(486/169)*2^(-2/3)', + 'singleton_probability_exponent':'1/3', + 'limiting_companion_tail_coefficient':str(F(81,52)), + 'limiting_companion_moment_threshold':1, + 'finite_epsilon_companion_moment_threshold':13, + 'critical_mean_log_coefficient':str(F(27,52)), + 'moment_blowup_constants':{str(p):str(moment_blowup_constant(p)) for p in (4,7,10)}} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--mutant',choices=MUTANTS) + args=parser.parse_args();global _MUTANT;_MUTANT=args.mutant + try:data=result() + except ValueError as exc: + print(json.dumps({'passed':False,'error':str(exc)},sort_keys=True));raise SystemExit(1) + print(json.dumps(data,sort_keys=True,indent=2)) + +if __name__=='__main__':main() diff --git a/frontiers/small_lifetime_shape_20260930/test_jacobian.py b/frontiers/small_lifetime_shape_20260930/test_jacobian.py new file mode 100644 index 000000000..4fbd7f0a4 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/test_jacobian.py @@ -0,0 +1,45 @@ +"""Independent exact differentiation of the square-to-lifetime shape map.""" +from fractions import Fraction as F +import unittest +import shape + +class Dual: + def __init__(self,x,dr=0,dz=0):self.x,self.dr,self.dz=F(x),F(dr),F(dz) + @staticmethod + def cast(v):return v if isinstance(v,Dual) else Dual(v) + def __add__(self,v): + v=self.cast(v);return Dual(self.x+v.x,self.dr+v.dr,self.dz+v.dz) + __radd__=__add__ + def __neg__(self):return Dual(-self.x,-self.dr,-self.dz) + def __sub__(self,v):return self+-self.cast(v) + def __rsub__(self,v):return self.cast(v)+-self + def __mul__(self,v): + v=self.cast(v);return Dual(self.x*v.x,self.dr*v.x+self.x*v.dr,self.dz*v.x+self.x*v.dz) + __rmul__=__mul__ + def __truediv__(self,v): + v=self.cast(v);return Dual(self.x/v.x,(self.dr*v.x-self.x*v.dr)/v.x**2,(self.dz*v.x-self.x*v.dz)/v.x**2) + def __pow__(self,n): + ans=Dual(1) + for _ in range(n):ans=ans*self + return ans + +class JacobianTests(unittest.TestCase): + def test_direct_doublet_density_binding(self): + count=0 + for r0 in (F(1,100),F(1,5),F(1,2),F(4,5)): + for z0 in (F(1,7),F(2,5),F(3,4)): + r,z=Dual(r0,1,0),Dual(z0,0,1) + w=1+2*r*z/(1+r) + p=((1+r)*w*w+(1-r))/(4*w) + x=p-F(1,2) + e=r**3*z*z*(1+z)*(r*z+r+2)/((1+r)*(2*r*z+r+1)) + determinant=e.dr*x.dz-e.dz*x.dr + self.assertTrue(shape.in_support(e.x,x.x)) + self.assertTrue(shape.doublet(e.x,x.x)) + self.assertEqual(shape.kernel(e.x,x.x)*abs(determinant),shape.square_density(r0,z0)) + pair=shape.companion(e.x,x.x) + self.assertEqual(-pair[2],1/r0) + count+=1 + self.assertEqual(count,12) + +if __name__=='__main__':unittest.main() diff --git a/frontiers/small_lifetime_shape_20260930/test_shape.py b/frontiers/small_lifetime_shape_20260930/test_shape.py new file mode 100644 index 000000000..a47c361f0 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/test_shape.py @@ -0,0 +1,155 @@ +from fractions import Fraction as F +import unittest +import shape + +class InitialTests(unittest.TestCase): + def test_normalization(self): self.assertEqual(shape.shape_moment(0), F(888807,280)) + def test_first_moment(self): self.assertEqual(shape.shape_moment(1), F(3524743221,1361360)) + def test_shape_w_normalization(self): self.assertEqual(shape.limit_w_even_moment(0), 1) + def test_companion_survival(self): self.assertEqual(shape.ratio_survival(1), 1) + def test_companion_height_ratio(self): self.assertEqual(shape.height_ratio(2), F(32,5)) + def test_supercritical_four(self): self.assertEqual(shape.moment_blowup_constant(4), F(30,13)) + def test_supercritical_seven(self): self.assertEqual(shape.moment_blowup_constant(7), F(441,65)) + def test_supercritical_ten(self): self.assertEqual(shape.moment_blowup_constant(10), F(3270,91)) + + + +class GeometryTests(unittest.TestCase): + def test_rational_classifier_grid(self):self.assertEqual(shape.checks(),589) + def test_classifier_factor(self): + for e in (F(1,1000),F(1,10),F(1,2),F(9,10)): + for x in (F(-1,4),F(0),F(1,20),F(1,4),F(2,5)): + p=x+F(1,2);a=12*p*p-3;v=6*(e+x) + lhs=(v-a)**2*(2*v+a)-12*(v-a*p)**2 + self.assertEqual(lhs,432*(1-e)*(2*x**3+3*e*x*x-e*e)) + def test_no_finite_cutoff_doublet_certainty(self): + for e in (F(1,10),F(1,10000),F(1,10**8)): + self.assertTrue(shape.in_support(e,0)) + self.assertFalse(shape.doublet(e,0)) + def test_boundary_order_by_exact_brackets(self): + for e in (F(1,1000),F(1,10),F(1,2),F(9,10)): + c=shape.isolate(e*e,lambda x:2*x**3+3*e*x*x,F(0),F(1,2),100) + b=shape.isolate(e,lambda x:3*x*x+2*x**3,F(0),F(1,2),100) + self.assertTrue(01 and H>1);cases+=1 + self.assertEqual(cases,6) + def test_companion_limit_at_compact_shapes(self): + for w in (F(1,5),F(1,3),F(1,2)): + vals=[] + for d in (F(1,1000),F(1,10000),F(1,100000)): + v,h=shape.exact_scaled_companion(d,w) + err=abs(v-shape.w_to_ratio(w))+abs(h-shape.height_ratio(shape.w_to_ratio(w))) + vals.append(err) + self.assertTrue(vals[0]>vals[1]>vals[2]>0) + def test_scaled_kernel_identity(self): + for d in (F(1,3),F(1,10),F(1,100)): + for w in (F(-1,10),F(0),F(1,4),F(1,2)): + self.assertEqual(shape.kernel(d*d,d*w)*d,F(10368)*d**6*shape.scaled_phi(d,w)) + def test_selection_support_is_the_two_polynomial_strips(self): + for i in range(-19,10): + x=F(i,20) + for j in range(1,20): + e=F(j,20) + lower=-2*x-x*x if x<=0 else 3*x*x+2*x**3 + self.assertEqual(shape.in_support(e,x),lowererrors[1]>errors[2]>0) + def test_moment_constants_independent_binomial_integral(self): + # Integrate small rational polynomials by hand, without production helpers. + integrals={4:F(1,2)+F(1,3),7:F(1,4)+F(2,5)+F(1,6), + 10:F(1,6)+F(3,7)+F(3,8)+F(1,9)} + for p,val in integrals.items(): + k=F(2592,13*(13-p))*F(1,2)**((13-p)//3)*val + self.assertEqual(shape.moment_blowup_constant(p),k) + def test_uniform_square_comparisons_finite_grid(self): + for r in (F(1,1000),F(1,10),F(1,2),F(9,10)): + for z in (F(1,1000),F(1,10),F(1,2),F(9,10)): + a=shape.square_lifetime(r,z)/(r**3*z*z) + b=shape.square_density(r,z)/(165888*r**12*z**7) + self.assertTrue(F(1,4)<=a<=8) + self.assertTrue(F(1,2**23)<=b<=2**32) + def test_square_boundary_coefficients(self): + for r in (F(1,10),F(1,3),F(3,4)): + z=F(1,10**8) + kappa=r**3*(r+2)/(r+1)**2 + self.assertLess(abs(shape.square_lifetime(r,z)/(kappa*z*z)-1),10*z) + dens=shape.square_density(r,z)/(165888*r**12*z**7/(r+1)**7) + self.assertLess(abs(dens-1),100*z) + def test_invalid_inputs(self): + for val in (True,0.25,'1/2'): + with self.assertRaises(TypeError):shape.ratio_survival(val) + for j in (-1,9,True): + with self.assertRaises(ValueError):shape.shape_moment(j) + for p in (1,2,13,True): + with self.assertRaises(ValueError):shape.moment_blowup_constant(p) + with self.assertRaises(ValueError):shape.density_intervals(0) + with self.assertRaises(ValueError):shape.density_intervals(1) + with self.assertRaises(ValueError):shape.ratio_survival(F(1,2)) + def test_cli_both_modes_and_negative_controls(self): + import subprocess,sys + from pathlib import Path + script=str(Path(shape.__file__).resolve());baseline=None + for flags in (['-B','-S'],['-B','-O','-S']): + run=subprocess.run([sys.executable,*flags,script],capture_output=True,timeout=30) + self.assertEqual(run.returncode,0,run.stderr);self.assertEqual(run.stderr,b'') + if baseline is None:baseline=run.stdout + self.assertEqual(run.stdout,baseline) + for mutant in shape.MUTANTS: + bad=subprocess.run([sys.executable,*flags,script,'--mutant',mutant],capture_output=True,timeout=30) + self.assertEqual(bad.returncode,1,(mutant,bad.stdout,bad.stderr)) + bad=subprocess.run([sys.executable,*flags,script,'--mutant','unknown'],capture_output=True,timeout=30) + self.assertEqual(bad.returncode,2) + +if __name__=='__main__':unittest.main() diff --git a/frontiers/small_lifetime_shape_20260930/test_verify.py b/frontiers/small_lifetime_shape_20260930/test_verify.py new file mode 100644 index 000000000..acc836c2c --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/test_verify.py @@ -0,0 +1,109 @@ +"""Real local Git fixtures for source and packet custody, not upstream evidence.""" +import copy +import hashlib +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest +import verify + +def entry(path,data,**kw): + return dict(path=path,bytes=len(data),sha256=hashlib.sha256(data).hexdigest(), + git_blob=hashlib.sha1(b'blob '+str(len(data)).encode()+b'\0'+data).hexdigest(),**kw) + +class SourceTests(unittest.TestCase): + def setUp(self): + temp=tempfile.TemporaryDirectory();self.addCleanup(temp.cleanup);self.repo=Path(temp.name) + self.root=self.repo/'frontiers/packet';self.root.mkdir(parents=True) + self.git('init','-q');self.data=b'exact local fixture\n' + (self.repo/'imports').mkdir() + for label in ('E','C'):(self.repo/f'imports/{label}.md').write_bytes(self.data) + self.git('add','imports');self.git('commit','-qm','fixture') + self.commit=self.git('rev-parse','HEAD').decode().strip() + self.es=[entry(f'imports/{s}.md',self.data,id=s,commit=self.commit) for s in ('E','C')];self.write() + def git(self,*args): + env=os.environ.copy();env.pop('GIT_NO_REPLACE_OBJECTS',None) + return subprocess.run(['git','-c','user.name=Fixture','-c','user.email=fixture@example.invalid',*args], + cwd=self.repo,env=env,check=True,capture_output=True,timeout=15).stdout + def write(self,es=None): + (self.root/'SOURCES.json').write_text(json.dumps({'sources':self.es if es is None else es})) + def test_valid_nested_sources(self):self.assertEqual(verify.sources(self.root),2) + def test_required_identity_fields(self): + for key,val in (('sha256','0'*64),('git_blob','0'*40),('bytes',0),('bytes',True)): + es=copy.deepcopy(self.es);es[0][key]=val;self.write(es) + with self.subTest(key=key,val=val),self.assertRaises(ValueError):verify.sources(self.root) + es=copy.deepcopy(self.es);del es[0]['bytes'];self.write(es) + with self.assertRaises(ValueError):verify.sources(self.root) + def test_missing_duplicate_or_unexpected_source(self): + bad=[[],self.es[:-1],self.es+[self.es[0]],[dict(self.es[0],id='X'),self.es[1]]] + for es in bad: + self.write(es) + with self.subTest(es=es),self.assertRaises(ValueError):verify.sources(self.root) + def test_wrong_object_type(self): + self.git('tag','-a','fixture-tag','-m','tag') + for obj in ('HEAD^{tree}','HEAD:imports/E.md','fixture-tag'): + es=copy.deepcopy(self.es);es[0]['commit']=self.git('rev-parse',obj).decode().strip();self.write(es) + with self.subTest(obj=obj),self.assertRaises(ValueError):verify.sources(self.root) + def test_missing_or_unsafe_path(self): + for path in ('missing.md','../E.md','/imports/E.md','imports//E.md','imports/./E.md','imports/../E.md'): + es=copy.deepcopy(self.es);es[0]['path']=path;self.write(es) + with self.subTest(path=path),self.assertRaises(ValueError):verify.sources(self.root) + def test_bad_commit(self): + for commit in ('0'*40,'HEAD','A'*40): + es=copy.deepcopy(self.es);es[0]['commit']=commit;self.write(es) + with self.subTest(commit=commit),self.assertRaises(ValueError):verify.sources(self.root) + def test_leaf_symlink_rejected(self): + p=self.repo/'imports/E.md';p.unlink();p.symlink_to('C.md') + self.git('add','imports/E.md');self.git('commit','-qm','symlink') + es=copy.deepcopy(self.es);es[0]['commit']=self.git('rev-parse','HEAD').decode().strip();self.write(es) + with self.assertRaises(ValueError):verify.sources(self.root) + def test_ancestor_symlink_rejected(self): + (self.repo/'alias').symlink_to('imports',target_is_directory=True) + self.git('add','alias');self.git('commit','-qm','alias') + es=copy.deepcopy(self.es);es[0].update(commit=self.git('rev-parse','HEAD').decode().strip(),path='alias/E.md');self.write(es) + with self.assertRaises(ValueError):verify.sources(self.root) + def test_replacement_cannot_forge_or_invalidate(self): + changed=b'forged source\n';(self.repo/'imports/E.md').write_bytes(changed) + self.git('add','imports/E.md');self.git('commit','-qm','changed') + later=self.git('rev-parse','HEAD').decode().strip();self.git('replace',self.commit,later) + self.assertEqual(self.git('show',self.commit+':imports/E.md'),changed) + self.assertEqual(verify.sources(self.root),2) + es=copy.deepcopy(self.es);es[0].update(entry('imports/E.md',changed));self.write(es) + with self.assertRaises(ValueError):verify.sources(self.root) + def test_original_source_not_worktree(self): + (self.repo/'imports/E.md').write_bytes(b'worktree different\n') + self.assertEqual(verify.sources(self.root),2) + +class PacketTests(unittest.TestCase): + def setUp(self): + temp=tempfile.TemporaryDirectory();self.addCleanup(temp.cleanup);self.root=Path(temp.name) + self.data=b'proof fixture\n';(self.root/'PROOF.md').write_bytes(self.data) + self.es=[entry('PROOF.md',self.data)];self.write() + def write(self):(self.root/'MANIFEST.json').write_text(json.dumps({'files':self.es})) + def test_valid(self):self.assertEqual(verify.inventory(self.root),1) + def test_changed_payload(self): + (self.root/'PROOF.md').write_bytes(b'changed') + with self.assertRaises(ValueError):verify.inventory(self.root) + def test_extra_missing_payload(self): + (self.root/'extra').write_text('extra') + with self.assertRaises(ValueError):verify.inventory(self.root) + (self.root/'extra').unlink();(self.root/'PROOF.md').unlink() + with self.assertRaises(ValueError):verify.inventory(self.root) + def test_invalid_inventory(self): + for es in ([],self.es*2,[dict(self.es[0],path='a/PROOF.md')]): + self.es=es;self.write() + with self.assertRaises(ValueError):verify.inventory(self.root) + def test_symlink_payload_and_manifest(self): + (self.root/'PROOF.md').unlink();(self.root/'PROOF.md').symlink_to('MANIFEST.json') + with self.assertRaises(ValueError):verify.inventory(self.root) + (self.root/'PROOF.md').unlink();(self.root/'PROOF.md').write_bytes(self.data) + (self.root/'MANIFEST.json').rename(self.root/'real');(self.root/'MANIFEST.json').symlink_to('real') + with self.assertRaises(ValueError):verify.inventory(self.root) + def test_duplicate_json_and_nonobject(self): + for text in ('{"files":[],"files":[]}','[]'): + (self.root/'MANIFEST.json').write_text(text) + with self.assertRaises(ValueError):verify.inventory(self.root) + +if __name__=='__main__':unittest.main() diff --git a/frontiers/small_lifetime_shape_20260930/verify.py b/frontiers/small_lifetime_shape_20260930/verify.py new file mode 100644 index 000000000..3403814d2 --- /dev/null +++ b/frontiers/small_lifetime_shape_20260930/verify.py @@ -0,0 +1,108 @@ +"""Replay exact algebra and byte custody; --local-only excludes source Git objects.""" +import argparse +import hashlib +import json +import os +from pathlib import Path, PurePosixPath +import re +import subprocess +import sys + +IDS={'E','C'} +MUTANTS=('all-doublets-finite','wrong-shape-normalization','retain-exponent13', + 'lose-ratio-jacobian','wrong-height-ratio','lose-moment-crossover') + + +def read_json(path): + if path.is_symlink() or not path.is_file():raise ValueError('regular JSON file required') + def unique(pairs): + out={} + for key,value in pairs: + if key in out:raise ValueError('duplicate JSON key') + out[key]=value + return out + value=json.loads(path.read_text(encoding='utf-8'),object_pairs_hook=unique) + if not isinstance(value,dict):raise ValueError('JSON object required') + return value + + +def path_parts(path): + if not isinstance(path,str) or not path:raise ValueError('nonempty path required') + p=PurePosixPath(path) + if p.is_absolute() or str(p)!=path or any(x in ('.','..') or not re.fullmatch('[A-Za-z0-9_.-]+',x) for x in p.parts): + raise ValueError('unsafe or noncanonical path') + return p.parts + + +def identity(data,entry): + if type(entry.get('bytes')) is not int or entry['bytes']!=len(data):raise ValueError('missing or incorrect source size') + blob=hashlib.sha1(b'blob '+str(len(data)).encode()+b'\0'+data).hexdigest() + if entry.get('git_blob')!=blob or entry.get('sha256')!=hashlib.sha256(data).hexdigest(): + raise ValueError('identity mismatch: '+entry['path']) + + +def git(root,*args): + run=subprocess.run(['git','--no-replace-objects',*args],cwd=root, + env=dict(os.environ,GIT_NO_REPLACE_OBJECTS='1'), + capture_output=True,timeout=45) + if run.returncode:raise ValueError('Git object read failed: '+run.stderr.decode(errors='replace')[:160]) + return run.stdout + + +def sources(root): + entries=read_json(root/'SOURCES.json')['sources'] + if not isinstance(entries,list) or len(entries)!=len(IDS) or {e['id'] for e in entries}!=IDS: + raise ValueError('source inventory mismatch') + seen=set() + for e in entries: + ps=path_parts(e['path']);commit=e['commit'] + if not isinstance(commit,str) or not re.fullmatch('[0-9a-f]{40}',commit):raise ValueError('full commit required') + key=(commit,e['path']) + if key in seen:raise ValueError('duplicate source binding') + seen.add(key) + if git(root,'cat-file','-t',commit).strip()!=b'commit':raise ValueError('source object is not a commit') + for j in range(1,len(ps)+1): + prefix='/'.join(ps[:j]) + records=[x for x in git(root,'ls-tree','--full-tree','-z',commit,'--',prefix).split(b'\0') if x] + if len(records)!=1:raise ValueError('missing or ambiguous source path') + meta,name=records[0].split(b'\t',1);mode,kind,blob=meta.decode().split() + if name.decode()!=prefix:raise ValueError('source path mismatch') + if j