Download spec/PROPERTIES.md from Snapkitty/foundry-j: direct link, hf CLI and curl.
- Browser
- Download file 13.4 kB
-
https://huggingface.co/Snapkitty/foundry-j/resolve/main/spec/PROPERTIES.md
- Command line
-
hf download hf://Snapkitty/foundry-j/spec/PROPERTIES.md
-
curl -L -o PROPERTIES.md https://huggingface.co/Snapkitty/foundry-j/resolve/main/spec/PROPERTIES.md
Foundry F1 β Pure-J Recreation Property Inventory
Extracted from cpp-foundry sources under /workspace/foundry-j/.
Every claim below is required to hold in a pure-J recreation of the mathematical surface.
Citations are file:line or README section. No invented numeric constants.
Preferred license for derivative pure-J work: AGPL-3.0 (sources do not ship a LICENSE file; this preference is inventory policy only).
A. Goldilocks prime and field carrier
Goldilocks prime (decimal).
( p = 2^{64} - 2^{32} + 1 = 18446744069414584321 ).
Cite: README.md Β§ "Goldilocks Field F_p" (lines 209β210).Goldilocks prime (hex / named constant).
GOLDILOCKS_PRIME = 0xFFFFFFFF00000001ULL, meaning ( 2^{64} - 2^{32} + 1 ).
Cite:include/types.h:17; README.md Β§ "Key Constants" (line 315);include/goldilocks.h:2,12.Field elements are u64 reduced mod p.
Carrier is unsigned 64-bit values always reduced modulo ( p ).
Cite: README.md Β§ "Goldilocks Field F_p" (line 212);include/goldilocks.h:14β18.Elem construction reduces.
Elem(x)storesreduce(x).
Cite:include/goldilocks.h:18.
B. Reduction identity and mulmod
Congruence ( 2^{64} \equiv 2^{32} - 1 \pmod{p} ).
Cite: README.md Β§ "Goldilocks Field F_p" (line 214);src/goldilocks.cpp:23.Fold constant EPSILON.
README namesEPSILON = 0xFFFFFFFFas ( 2^{32} - 1 ) (Goldilocks fold constant). Implementation uses the same literal aseps/hi_lomask.
Cite: README.md Β§ "Key Constants" (line 320);src/goldilocks.cpp:27,31.128-bit product split.
For ( a \cdot b ), form__uint128_t product, thenlo = product,hi = product >> 64.
Cite: README.md (line 213);src/goldilocks.cpp:20β25.hi split into 32-bit halves.
hi_lo = hi & 0xFFFFFFFF,hi_hi = hi >> 32.
Cite:src/goldilocks.cpp:27β28.Reduction identity (fold).
( x \equiv \mathrm{lo} + \mathrm{hi_lo}\cdot(2^{32}-1) - \mathrm{hi_hi} \pmod{p} ).
Cite: README.md Β§ "Goldilocks Field F_p" (line 216); implemented asfolded = lo + hi_lo * epsthen subtracthi_hiwith underflow handling (src/goldilocks.cpp:30β41).Underflow handling on fold.
Iffolded >= hi_hithenreduced = folded - hi_hi, elsereduced = folded + P - hi_hi.
Cite:src/goldilocks.cpp:36β41.Final conditional reduction after fold.
Ifreduced >= Pthenreduced -= P; result isuint64_t.
Cite:src/goldilocks.cpp:43β48.Single-limb reduce.
For ( x < 2^{64} ):reduce(x) = (x >= P) ? x - P : x.
Cite:src/goldilocks.cpp:12β16;include/goldilocks.h:35.
C. Field operations
Addition mod p.
( r = a.v + b.v ); if ( r \ge P ) then ( r -= P ). Result is in ( \mathbb{F}_p ).
Cite:src/goldilocks.cpp:51β55; asserted100+200=300insrc/test.cpp:33β39.Subtraction mod p.
Unsigned difference with conditional add of ( P ) on underflow (mask from high bit).
Cite:src/goldilocks.cpp:57β62; asserted100-50=50insrc/test.cpp:60β66.Multiplication via mulmod.
mul(a,b) = Elem(mulmod(a.v, b.v)).
Cite:src/goldilocks.cpp:64β66; asserted7*6=42insrc/test.cpp:42β48.Fermat inverse.
( a^{-1} = a^{p-2} \pmod{p} ) viainv(a) = pow(a, P-2).
Cite:include/goldilocks.h:27;src/goldilocks.cpp:68β70; README test legend (line 403); asserteda * inv(a) = 1fora=42insrc/test.cpp:51β57.Binary exponentiation.
pow(a,e): square-and-multiply fromresult=1,base=a.
Cite:src/goldilocks.cpp:73β81;include/goldilocks.h:28.Batch add/mul.
Elementwiseadd/mulover length-narrays.
Cite:include/goldilocks.h:31β32;src/goldilocks.cpp:84β96.
D. Named constants (non-field)
K_MAX.
K_MAX = 133144(README: max W8A8 accumulation).
Cite:include/types.h:18; README.md Β§ "Key Constants" (line 316).MAX_DRIFT.
MAX_DRIFT = 300000000000000000ULL(README: ( 3\times 10^{17} ), β0.3Ξ drift boundβ / β0.3Ξ in weiβ).
Cite:include/types.h:19; README.md Β§ "Key Constants" (line 317).PIRTM_MAGIC.
PIRTM_MAGIC = 0x7F504952(README:\x7FPIRbytecode magic).
Cite:include/types.h:20; README.md Β§ "Key Constants" (line 318); linker test bytessrc/test.cpp:371β372.PHI.
PHI = 1.618033988749895.
Cite:include/types.h:21. (Sources do not state further mathematical use in the UAC/recurrence core.)P_64 β first 64 primes.
Array of length 64:2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311.
Cite:include/types.h:24β30; README.md Β§ "Key Constants" (line 319).GENESIS_HASH_SIZE.
GENESIS_HASH_SIZE = 32.
Cite:include/types.h:22.Tier epsilons (contraction margins).
T1β0.10, T2β0.05, T3β0.02, T4β0.01; default fallback 0.10.
Cite:include/types.h:34β48.
E. PMAT / prime monomial facts
PMat entry shape.
Sparse entry is(sign, monomial, row, col)withsign β {Β±1}andSignature = (delta_source, delta_target).
Cite:include/pmat.h:10β15;include/types.h:103β112.Insert domain checks.
Insert fails ifrow β₯ rowsorcol β₯ cols, or ifsign β {1,-1}; else appends entry.
Cite:src/pmat.cpp:11β16; asserted insrc/test.cpp:71β77.Grading condition (stated).
Header/README narrative: grading conditiontgt_sig - src_sig = monomialis enforced on insertion / validated globally.
Cite:include/pmat.h:3,21β25.
Gap note:insertdoes not compare signatures to row/col grades;validate_gradingalways returnstrue(src/pmat.cpp:19β22). J must decide whether to enforce the stated condition or mirror the current C++ stub.Conservation theorem.
Product (componentwise sum) of all entry monomials equals accumulated(Ξ£ delta_source, Ξ£ delta_target).
Cite:include/pmat.h:27β28;src/pmat.cpp:25β33; asserted sums(6,8)for monomials{3,5}+{1,2}+{2,1}insrc/test.cpp:80β89.Composition preserves grading (stated).
Compose multiplies signs and accumulates monomials along matching mid-indices; result size(rows_, other.cols_).
Cite:include/pmat.h:30β31;src/pmat.cpp:36β66.Compose monomial accumulation rule (as coded).
On matchinga.col == b.row:sign_acc *= a.sign * b.sign;monom_acc.delta_source += a.monomial.delta_source;monom_acc.delta_target += b.monomial.delta_target.
Cite:src/pmat.cpp:51β55.Frobenius norm of PMat.
Each entry has magnitude 1; ( |M|_F = \sqrt{#\mathrm{entries}} ).
Cite:include/pmat.h:33β34;src/pmat.cpp:69β74.
F. Spectral governor (Gershgorin / contractive)
Gershgorin disk bound.
For each row ( i ): radius ( = \sum_{j\neq i}|J_{ij}| ); disk max ( = |J_{ii}| + \mathrm{radius} ); bound = max over rows.
Cite:src/spectral.cpp:10β24;include/spectral.h:36β37.Contractive test (Gershgorin).
contractive βΊ bound < (1.0 - epsilon).
Cite:src/spectral.cpp:27β36;include/spectral.h:17β18.Power iteration (Rayleigh).
Iterate ( v \leftarrow Jv/|Jv| ); eigenvalue β ( v^\top Jv ); return absolute value; default tolerance1e-12, defaultmax_iters=100.
Cite:include/spectral.h:29β30,40β41;src/spectral.cpp:39β86.Contractive test (power iteration).
Same predicate: dominant eigenvalue modulus ( < 1 - \epsilon ).
Cite:src/spectral.cpp:88β98.Analyze fallback policy.
Try Gershgorin first; if contractive butgershgorin_bound > (1-epsilon)*0.95, recheck with power iteration.
Cite:src/spectral.cpp:101β111;include/spectral.h:32β34.Tested contractive / expansive examples.
( J=\begin{bmatrix}0.2&0.1\0.05&0.15\end{bmatrix} ) with ( \epsilon=0.1 ) is contractive;
( J=\begin{bmatrix}0.9&0.3\0.3&0.95\end{bmatrix} ) with ( \epsilon=0.1 ) is not.
Cite:src/test.cpp:94β113.
G. Banach recurrence
Recurrence equation.
( x_{t+1} = \Xi_t \cdot x_t + \Lambda_t \cdot T(x_t) + g_t ).
Cite: README.md Β§ "Banach Contraction Mapping" (lines 226β232);include/recurrence.h:3;src/recurrence.cpp:105β110.Contraction condition.
( q_t = |\Xi_t| + |\Lambda_t| \cdot |T| < 1 - \varepsilon ).
Cite: README.md (lines 234β235, 280);include/recurrence.h:4;include/types.h:119.Unique fixed-point guarantee (narrative).
Strict Banach contraction β convergence to unique fixed point; spectral governor verifies a priori.
Cite: README.md Β§ "The Core Guarantee" (lines 282β284).q estimate in step (as coded).
( n_\Xi, n_\Lambda ) = max-abs of schedule vectors (length 2); ( n_T ) = max-abs of ( T(x) ) scaled by max-abs of ( x ) when ( |x|_\infty > 10^{-15} ); ( q = n_\Xi + n_\Lambda \cdot n_T ).
Cite:src/recurrence.cpp:66β87.Soft projection.
If ( q > 1 - \mathrm{tier_epsilon} ), scale Ξ and Ξ by ( (1-\varepsilon)/q ).
Cite:include/recurrence.h:60β63;src/recurrence.cpp:46β55,89β102.Weight budget split.
q_star = 1 - tier_epsilon(tier);xi_val = q_star * factor * 0.7;lam_val = q_star * factor * 0.3; Uniform/Harmonic/LogDecay factors as coded.
Cite:src/recurrence.cpp:21β42.Projector.
After affine update, applyp_op(example: clip to ([-1,1])).
Cite:include/recurrence.h:15β16;src/recurrence.cpp:113β114; test projectorsrc/test.cpp:133β135.Residual.
( \mathrm{residual} = |x_{next} - x_t|_2 ). Convergence when residual ( < )convergence_tol.
Cite:src/recurrence.cpp:116β122,159β161; test tol1e-6insrc/test.cpp:125,139.WORM / seal chain invariant (system-level).
( \forall k>0:\ \mathrm{hash}(\mathrm{seal}_{k-1}) = \mathrm{seal}_k.\mathrm{prev_hash} ) (README); Triple-Lock seals chain GuardianβExaminerβPublisher.
Cite: README.md Layer 8 (line 130), Quick Reference (line 525);src/test.cpp:300β324.
H. Emission / CSL / certification math (adjacent to contraction)
Emission Suppress.
If ( q \ge 1-\varepsilon ), emit zeros; else pass output.
Cite:include/types.h:63;src/gate.cpp:21β25;src/test.cpp:145β150.Emission Attenuate scale.
Scale by ( \max(0,\ 1-\varepsilon-q) ).
Cite:include/types.h:65;src/gate.cpp:34β40.CSL neutrality.
Pairwise: if ( |x_i-x_j|>10^{-15} ) and ( |T_i-T_j|/|x_i-x_j| > 1+\varepsilon ), fail neutrality.
Cite:src/gate.cpp:50β62;include/gate.h:34β37.CSL beneficence.
( |T(x)|_2 \le (1+\varepsilon)|x|_2 ) and residual ( \le (1+\varepsilon)|x|_2 ).
Cite:src/gate.cpp:65β86;include/gate.h:39β42.CSL commutation.
( |\mathrm{filter}(T(x)) - T(\mathrm{filter}(x))|_\infty \le \varepsilon ) (componentwise abs β€ Ξ΅).
Cite:src/gate.cpp:89β104;include/gate.h:44β48.AceCertificate safety margin.
safety_margin = (1 - epsilon) - max_q; certified iffmargin >= delta.
Cite:include/types.h:133β136;src/certify.cpp:44β45,35.AceCertificate tail bound.
Ifmax_q >= 1then ( +\infty ); elsetail_norm / (1 - max_q).
Cite:include/types.h:135;src/certify.cpp:48β50.Guardian spectral legality.
Reject ifspectral_radius >= 1.0or non-finite next state; reject status"PROVISIONAL".
Cite:src/gate.cpp:159β177;src/test.cpp:193β201,276β284.Consensus / false-positive bound (narrative).
Every claim requires all Triple-Lock parties; ( P(\mathrm{false\ positive}) \le 2^{-256} ).
Cite: README.md Triple-Lock (lines 272β273), Implications (line 451).
Gaps (sources silent β do not invent)
- Named C++ identifier
EPSILON: named only in README Key Constants; code uses literal0xFFFFFFFFULLin mulmod, not atypes.hsymbol. BARRITT_MU: defined equal toPand unused (src/goldilocks.cpp:9β10); no Barrett algorithm steps beyond the comment.- PMat per-entry grading vs indices: stated in
pmat.h:3but not checked ininsert/validate_grading. - Compose monomial rule vs βsum of both signaturesβ: coded as
a.delta_source+b.delta_targetonly (src/pmat.cpp:54β55), not full addition of both signatures from both factors. - PHI usage in UAC/recurrence math: constant present; no consuming identity in the cited math cpp files.
- Alapeno: out of scope; left untouched (
/workspace/alapeno).
Count
Numbered properties: 56