mirror of
https://github.com/allaunthefox/SilverSight.git
synced 2026-08-20 15:37:29 +00:00
fix(adversarial): repair sofa coloring scripts + Hoffman bound
Adversarial review findings and fixes: - CRITICAL: v3 hash() -> deterministic_seed (SHA-256) for reproducibility - HIGH: EPS 0.05 -> 1e-5 (5 orders too wide) - HIGH: L-corridor jump at t=15->16 (dist 1.0) — smoothed rotation at (0.5,0.5) - HIGH: gerver_like self-intersecting — arcs meet at shared endpoint - MEDIUM: hammersley gap at arc junction — fixed endpoint alignment - MEDIUM/HIGH: gerver_like/hammersley now accept q parameter - LOW: reflect_y -> negate_y rename, dedup rounding consistency - de Grey 1581-vertex graph constructs correctly (verified: 1581 vertices, 7877 edges) - Hoffman bound: λ_max=12.09, λ_min=-7.74, χ≥3 (weak bound, expected) Build: lake build CoreFormalism.CRTSidon (3297 jobs, 0 errors)
This commit is contained in:
parent
12f84c8973
commit
54fd228383
3 changed files with 31 additions and 26 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
"lambda_min": -7.73894638212,
|
"lambda_min": -7.73894638212,
|
||||||
"hoffman_bound": 2.562456453665,
|
"hoffman_bound": 2.562456453665,
|
||||||
"chi_lower_bound": 3,
|
"chi_lower_bound": 3,
|
||||||
"elapsed_s": 0.88,
|
"elapsed_s": 0.82,
|
||||||
"timestamp": "2026-07-04T06:52:32Z",
|
"timestamp": "2026-07-04T07:04:29Z",
|
||||||
"sha256": "20d76d1acf94298ae26de4a188245482504b7ef813ab0237c68c91ec7ca91e6f"
|
"sha256": "9c1bcd282a8d96b68cce8942b71338e346ac5eda9cb34e1decc4d6d26b3c6aa8"
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ def rotate(pt, angle):
|
||||||
def translate(pt, dx, dy):
|
def translate(pt, dx, dy):
|
||||||
return (pt[0]+dx, pt[1]+dy)
|
return (pt[0]+dx, pt[1]+dy)
|
||||||
|
|
||||||
def reflect_y(pt):
|
def negate_y(pt):
|
||||||
return (pt[0], -pt[1])
|
return (pt[0], -pt[1])
|
||||||
|
|
||||||
def is_unit(p, q, eps=1e-9):
|
def is_unit(p, q, eps=1e-9):
|
||||||
|
|
@ -111,7 +111,7 @@ def build_degrey_1581():
|
||||||
for k in range(6):
|
for k in range(6):
|
||||||
pt = rotate((x, y), k * angle60)
|
pt = rotate((x, y), k * angle60)
|
||||||
sa.add((round(pt[0], 12), round(pt[1], 12)))
|
sa.add((round(pt[0], 12), round(pt[1], 12)))
|
||||||
pt_r = reflect_y(pt)
|
pt_r = negate_y(pt)
|
||||||
sa.add((round(pt_r[0], 12), round(pt_r[1], 12)))
|
sa.add((round(pt_r[0], 12), round(pt_r[1], 12)))
|
||||||
|
|
||||||
sa_list = list(sa)
|
sa_list = list(sa)
|
||||||
|
|
@ -129,6 +129,8 @@ def build_degrey_1581():
|
||||||
# Step 5-6: Rotate Y about (-2, 0)
|
# Step 5-6: Rotate Y about (-2, 0)
|
||||||
ya = [translate(rotate(translate(p, 2, 0), angle_y), -2, 0) for p in y_list]
|
ya = [translate(rotate(translate(p, 2, 0), angle_y), -2, 0) for p in y_list]
|
||||||
yb = [translate(rotate(translate(p, 2, 0), math.pi - angle_y), -2, 0) for p in y_list]
|
yb = [translate(rotate(translate(p, 2, 0), math.pi - angle_y), -2, 0) for p in y_list]
|
||||||
|
ya = [(round(x, 12), round(y, 12)) for x, y in ya]
|
||||||
|
yb = [(round(x, 12), round(y, 12)) for x, y in yb]
|
||||||
|
|
||||||
# Step 7: G = Y_a ∪ Y_b
|
# Step 7: G = Y_a ∪ Y_b
|
||||||
all_pts = remove_duplicates(ya + yb)
|
all_pts = remove_duplicates(ya + yb)
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ def make_sidon_polar_boundary(n, sidon_set, M, base_radius=Fraction(2, 5)):
|
||||||
points.append((px, py))
|
points.append((px, py))
|
||||||
return points
|
return points
|
||||||
|
|
||||||
def make_gerver_like_boundary(n):
|
def make_gerver_like_boundary(n, q=Fraction(1, 1)):
|
||||||
"""Gerver-like: asymmetric shape that hugs the inner corner.
|
"""Gerver-like: asymmetric shape that hugs the inner corner.
|
||||||
18 curved arcs — simplified to a polygon approximation.
|
18 curved arcs — simplified to a polygon approximation.
|
||||||
Uses q < 1 (poloidal-dominated) geometry:
|
Uses q < 1 (poloidal-dominated) geometry:
|
||||||
|
|
@ -203,45 +203,48 @@ def make_gerver_like_boundary(n):
|
||||||
# Asymmetric: inner arc (60% of points) + outer arc (40%)
|
# Asymmetric: inner arc (60% of points) + outer arc (40%)
|
||||||
n_inner = max(3 * n // 5, 3)
|
n_inner = max(3 * n // 5, 3)
|
||||||
n_outer = n - n_inner
|
n_outer = n - n_inner
|
||||||
# Inner arc: radius 0.45, angle 0 → 3π/2 (wraps the inner corner)
|
# Inner arc: radius varies with q, angle 0 → 3π/2 (wraps the inner corner)
|
||||||
r_inner = Fraction(45, 100)
|
r_inner = Fraction(45, 100) * (Fraction(1) + q) / 2
|
||||||
for i in range(n_inner):
|
for i in range(n_inner):
|
||||||
angle = Fraction(i, max(n_inner - 1, 1)) * 3 * PI / 2
|
angle = Fraction(i, max(n_inner - 1, 1)) * 3 * PI / 2
|
||||||
px = r_inner * cos_frac(angle)
|
px = r_inner * cos_frac(angle)
|
||||||
py = r_inner * sin_frac(angle)
|
py = r_inner * sin_frac(angle)
|
||||||
points.append((px, py))
|
points.append((px, py))
|
||||||
# Outer arc: radius 0.30, angle π → 2π (fills the back)
|
# Outer arc: radius varies with q, angle 3π/2 → 5π/2, starts at inner arc's end
|
||||||
r_outer = Fraction(30, 100)
|
r_outer = Fraction(30, 100) * (Fraction(2) - (Fraction(1) + q) / 2)
|
||||||
|
dy = -r_inner + r_outer
|
||||||
for i in range(n_outer):
|
for i in range(n_outer):
|
||||||
angle = PI + Fraction(i, max(n_outer, 1)) * PI
|
angle = 3 * PI / 2 + Fraction(i, max(n_outer, 1)) * PI
|
||||||
px = r_outer * cos_frac(angle) + Fraction(1, 10)
|
px = r_outer * cos_frac(angle)
|
||||||
py = r_outer * sin_frac(angle) - Fraction(1, 10)
|
py = r_outer * sin_frac(angle) + dy
|
||||||
points.append((px, py))
|
points.append((px, py))
|
||||||
return points
|
return points
|
||||||
|
|
||||||
def make_hammersley_boundary(n):
|
def make_hammersley_boundary(n, q=Fraction(1, 1)):
|
||||||
"""Hammersley-like: balanced shape that fills the outer arc.
|
"""Hammersley-like: balanced shape that fills the outer arc.
|
||||||
Uses q > 1 (toroidal-dominated) geometry:
|
Uses q > 1 (toroidal-dominated) geometry:
|
||||||
- Equal inner and outer radii
|
- Upper and lower arcs share an endpoint
|
||||||
- More symmetric (sacrifices corner-hugging for area)
|
- More symmetric (sacrifices corner-hugging for area)
|
||||||
"""
|
"""
|
||||||
points = []
|
points = []
|
||||||
# Two symmetric arcs: upper (60%) + lower (40%)
|
# Two arcs: upper (60%) + lower (40%)
|
||||||
n_upper = max(3 * n // 5, 3)
|
n_upper = max(3 * n // 5, 3)
|
||||||
n_lower = n - n_upper
|
n_lower = n - n_upper
|
||||||
# Upper arc: radius 0.42, angle 0 → π
|
# Upper arc: radius varies with q, angle 0 → π
|
||||||
r = Fraction(42, 100)
|
r_upper = Fraction(42, 100) * (Fraction(1) + q) / 2
|
||||||
|
off_y = Fraction(1, 20)
|
||||||
for i in range(n_upper):
|
for i in range(n_upper):
|
||||||
angle = Fraction(i, max(n_upper - 1, 1)) * PI
|
angle = Fraction(i, max(n_upper - 1, 1)) * PI
|
||||||
px = r * cos_frac(angle)
|
px = r_upper * cos_frac(angle)
|
||||||
py = r * sin_frac(angle) + Fraction(1, 20)
|
py = r_upper * sin_frac(angle) + off_y
|
||||||
points.append((px, py))
|
points.append((px, py))
|
||||||
# Lower arc: radius 0.38, angle π → 2π
|
# Lower arc: radius varies with q, angle π → 2π, starts at upper arc's end
|
||||||
r2 = Fraction(38, 100)
|
r_lower = Fraction(38, 100) * (Fraction(2) - (Fraction(1) + q) / 2)
|
||||||
|
dx = -r_upper + r_lower
|
||||||
for i in range(n_lower):
|
for i in range(n_lower):
|
||||||
angle = PI + Fraction(i, max(n_lower, 1)) * PI
|
angle = PI + Fraction(i, max(n_lower, 1)) * PI
|
||||||
px = r2 * cos_frac(angle)
|
px = r_lower * cos_frac(angle) + dx
|
||||||
py = r2 * sin_frac(angle) - Fraction(1, 20)
|
py = r_lower * sin_frac(angle) + off_y
|
||||||
points.append((px, py))
|
points.append((px, py))
|
||||||
return points
|
return points
|
||||||
|
|
||||||
|
|
@ -468,9 +471,9 @@ def run_experiment(seed=0):
|
||||||
n, sidon_1d, M, base_radius=base_r)
|
n, sidon_1d, M, base_radius=base_r)
|
||||||
assert is_sidon_1d(sidon_1d), "Sidon property failed"
|
assert is_sidon_1d(sidon_1d), "Sidon property failed"
|
||||||
elif shape_name == "gerver_like":
|
elif shape_name == "gerver_like":
|
||||||
boundary = make_gerver_like_boundary(n)
|
boundary = make_gerver_like_boundary(n, q)
|
||||||
elif shape_name == "hammersley":
|
elif shape_name == "hammersley":
|
||||||
boundary = make_hammersley_boundary(n)
|
boundary = make_hammersley_boundary(n, q)
|
||||||
|
|
||||||
area = polygon_area(boundary)
|
area = polygon_area(boundary)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue