README.md
11.0 kB · markdown
node-stack
- Stacks the nodes of a design instead of its ink: the EDGE set of a layer, the cell sides that separate an inked cell from a paper cell or from the outside, and the CORNER set, the vertices of its inked cells.
- A layer at scale
nis the design laid 1-periodically at period1/n; the parity carpet's cell grid at oddnisn x n, the base-3 carpet's atlevelis3^level non a side. The edge stack overn = 1..Nadds the layers' edge indicators as a measure on segments, the corner stack adds their corner indicators as a point measure, and a segment or point is lit by the number of layers containing it. - Parity carpet, cell
(i, j)inked iffiandjare both odd: the edge set is the interior grid lines restricted to the odd rows and columns,{k/n} x [j/n, (j+1)/n]for1 <= k <= n-1andjodd, and the border of the square carries no edge at oddn; the corner set is the full interior vertex set{(k/n, l/n) : 1 <= k, l <= n-1}(parity_edges_form,parity_corners_form). - Base-3 carpet, cell paper iff some digit pair of
(i, j)is(1, 1): a vertical grid line of layerncarries an edge iff its index is not a multiple of3^level, so the period boundariesk/nare never edge lines and the removed blocks' walls are the whole edge set (edge_residues,carpet_line_lit). - Brightness has a closed form in both designs, at line level and at segment level, and the lit line sets are exact Farey families (
parity_line_brightness,carpet_line_brightness,carpet_lines_reach).
RUN
uv run python research/lab/py/node-stack/node_stack.py- From the repo root. One core, under two seconds.
- Domain is the parity carpet at
N = 15literal andN = 31rendered, the base-3 carpet atN = 12, level 1andN = 6, level 2literal andN = 12, level 2rendered, the restricted Farey sizes atlevel 1andN = 1..30, and the Landau discrepancy atQ = 30, 60, 90. - Every count is exact: cells and sides are integer pairs, points and segment ends are
Fraction. The five PNGs beside this file are written; nothing else.
WHAT IT PRINTS
check_parity_edges,check_parity_corners: the literal edge and corner sets of every odd layer against the closed forms, as a mismatch count.parity_corner_stackagainstparity_corner_predicted: the literal corner stack atN = 15against the Farey closed form, with the count of points missed, invented and mis-valued, and both sides' sha256 digest of the sortedx,y:brightnesslist.check_line_brightness_parity,check_line_brightness_carpet: the number of lit lines and the number of form breaches, counting both wrong values on lit lines and nonzero predictions on unlit ones.parity_segment_check,carpet_segment_check: the segment forms tested at the midpoint of every elementary interval of the union of all layers' grids, on every lit line, with the breach count.edge_residues: the residue setJ_leveland, per residue, the rows in which the edge exists.carpet_lines_reachagainst literal union: the lit-line set at(N, level)from the reach form against the union of the layers' lines.top_segments: the top segment brightnesses with their exactxand[y0, y1].carpet_corner_stackagainstcarpet_corner_form: lit corner count, breach count, digest and the top brightnesses atN = 12, level 1, beside the plain Farey pair count atQ = 36.farey_sizes,landau: the size of the restricted family beside the plain Farey size atQ = 3N,N = 1..30, and the Landau sumsum_i |f_i - i/m|of each at threeQ, summed exactly as aFractionand printed to six places.
WHAT IT FINDS
- The parity edge law is exact: the literal edge set equals the interior grid lines restricted to odd rows and columns at every odd
n <= 15,0mismatches (check_parity_edges). A cell is inked iff both coordinates are odd, so crossingx = k/ninside an even row leaves paper on both sides, while inside an odd row it flips ink to paper for every interiork. - The parity corner set is the full interior vertex grid,
0mismatches at every oddn <= 15(check_parity_corners): the two columnsk-1, kcontain exactly one odd index for every1 <= k <= n-1, and none fork = 0ork = n. - The parity corner stack is the Farey field with an odd restriction. A point
(a/b, c/d)is lit iffbanddare odd andlcm(b, d) <= N, with brightness(floor(N/lcm(b, d)) + 1)/2rounded down, the count of odd multiples oflcm(b, d)up toN. AtN = 15the literal stack has536lit points and the closed form has536, none missed, none invented, no value mismatch, both on digest3dfbf194dcfc7dc08084acce38cfbf65b2ac63ef5a3de8f439411faeebcea9b6(parity_corner_stack,parity_corner_predicted). The top brightness is3, at the four points(1/3, 1/3), (1/3, 2/3), (2/3, 1/3), (2/3, 2/3). - The parity edge stack factors: a whole line
x = a/bis lit by(floor(N/b) + 1)/2rounded down layers for oddband by none for evenb,48lit lines and0breaches atN = 15, and the brightness at a point(a/b, y)of that line is the count of oddn <= Nwithb | nandfloor(n y)odd,2352midpoint tests and0breaches (check_line_brightness_parity,parity_segment_check). The edge stack is the line stack in one coordinate times the one-dimensional parity stack in the other. - The base-3 edge residues are every nonzero residue:
J_1 = {1, 2}with the edge in rowsr = 1 mod 3, andJ_2 = {1, ..., 8}with rows{1,4,7}atj = 1,2,7,8,{3,4,5}atj = 3,6and{1,7}atj = 4,5(edge_residues). The residue0is missing because the cells either side of a period boundary have all-2and all-0digits, which never collide, sox = k/nis never an edge line. - The base-3 line criterion is exact: a reduced
a/bis lit by layerniffb | 3^level nanda (3^level n / b) mod 3^levellies inJ_level, with0layer mismatches atN = 12, level 1and atN = 6, level 2(check_carpet_lines). - The criterion reduces to a denominator condition, since
J_levelmisses only0: writingsfor the exponent of3inb, the line is lit by some layern <= Niffs >= 1andb / 3^min(s, level) <= N, and its brightness isfloor(N / (b / 3^min(s, level))) - floor(N/b), a telescoping count of the layers whose3-adic valuation lands in[max(0, s-level), s-1]. Lit-line sets agree exactly,106lines atN = 12, level 1and100atN = 6, level 2, with0brightness breaches on either (carpet_lines_reach,check_line_brightness_carpet). - Segment brightness is smaller than line brightness and the study prints it exactly: at
N = 12, level 1the top is4, on{1/3} x [1/3, 11/30]and three mirror segments, against line brightness8atx = 1/3; atN = 6, level 2the top is3, on{1/9} x [7/36, 2/9]and seven others. The segment form, edge at(a/b, y)iff the column residue lies inJ_levelandfloor(3^level n y) mod 3^levellies in that residue's row set, passes14628midpoint tests atN = 12, level 1and10800atN = 6, level 2with0breaches (top_segments,carpet_segment_check). - The base-3 corner set at
level 1is every vertex of the3ngrid, because the two columnsk-1, kcontain at most one index congruent to1 mod 3, so at most one of a vertex's four cells is paper. The corner stack's brightness at(a/b, c/d)is thereforefloor(N / (m / gcd(m, 3)))withm = lcm(b, d): atN = 12the stack has5029lit corners with0breaches, digest66676fdc633f950b85a70783f194aa98278dd7817ff7a5438063c2b4627e0ae5, top brightness12at the denominator-3points (carpet_corner_stack,carpet_corner_form). Against it, the plain Farey pair count atQ = 3N = 36is|F_36|^2 = 157609: the corner stack lights5029of those157609pairs, the rest being pairs whose two denominators are unreachable together. - At
level >= 2the corner set is a proper subset of the vertex grid: of the100vertices of the level-2 tile,96are corners and the four points(4/9, 4/9), (4/9, 5/9), (5/9, 4/9), (5/9, 5/9)are not, each having all four of its cells carrying the digit pair(1, 1)at the first level, so they sit interior to the removed block (carpet_corners). - The lit-line family is a denominator-restricted Farey family, not a numerator-restricted one. At
level 1it is exactly{a/b in F_Q : 3 | b}atQ = 3N; at generallevelit is{a/b : 3 | b, b / 3^min(v_3(b), level) <= N}, which atlevel 2is the multiples of9up toQtogether with the denominators of valuation1up toQ/3. Sizes in(0, 1)atlevel 1,N = 1..30, against|F_Q|in(0, 1]:2, 4, 10, 14, 22, 28, 40, 48, 66, 74, 94, 106, 130, 142, 166, 182, 214, 232, 268, 284, 320, 340, 384, 408, 448, 472, 526, 550, 606, 630against4, 12, 28, 46, 72, 102, 140, 180, 230, 278, 344, 396, 474, 542, 628, 712, 806, 900, 1000, 1102, 1228, 1328, 1470, 1588, 1736, 1856, 2020, 2166, 2328, 2480(farey_sizes). - Its Landau sum
sum_i |f_i - i/m|runs0.784027, 1.557547, 1.962049atQ = 30, 60, 90, against1.298847, 1.710479, 2.153675for the plain Farey sequence at the sameQ(landau). Three points, no fit and no exponent is claimed. - The tree's Farey door restricts the denominator by a cutoff,
b <= Q; this family restricts it by a divisibility,3 | b, and a level-dependent cutoff. They are different objects and neither is a numerator restriction.
FIGURES
edges-parity.png: the parity edge stack over the odd scalesn <= 31, accumulated as hairlines on a1024raster and block-maximum reduced to512, peak raster count10,25733bytes (edge_raster,save_png).corners-parity.png: the parity corner stack atN = 31, each lit point a square of half-width1 + brightnesspixels at1024, peak brightness5,8085bytes (corner_raster). The white cross on the centre lines is the odd restriction: every point with an even denominator is dark.edges-carpet.png,corners-carpet.png: the base-3 carpet atlevel 2over scales1..12, peaks24and12,45760and22936bytes. The corner picture is a9 x 9lattice of Farey fields, one per level-2 cell.nodes-sheet.png: the four at256,63607bytes (contact_sheet).- Grey is monotone in brightness, the faintest lit value at grey
70and the peak at black, so a picture shows which nodes are bright but reads no exact value. A raster cannot show a coincidence: every count on this page is exact rational arithmetic and the pictures are illustrations of it.
WITNESSES
farey.mdWHERE THE LINES LAND: the line stack'sfloor(N/b)is the shadow of these two laws. The parity corner stack replaces it by(floor(N/lcm(b,d)) + 1)/2rounded down on pairs of odd denominators; the base-3 edge stack replaces it by a difference of two floors.farey.mdTHE STACK IS AN ADDRESS: brightness stays an address at the nodes as it is on the ink. Line brightness costs one gcd, segment brightness one pass over the layers dividing the denominator.core.md: the base-3 design here is the carpet, cell paper iff a digit pair equals(1, 1), at levels1and2.