"""Exact affine-A2 audit and TikZ data for the physical-chamber figure. Pure Python; no existing interval, slice, or boat engine is imported. The actual boat is formed by literal Coxeter-subword enumeration followed by subtraction of ALL smaller dominant parameters in the same Q^vee coset. The independent geometric description is then compared as sets of triangles. """ from __future__ import annotations from collections import Counter from pathlib import Path import json HERE = Path(__file__).resolve().parent FIGURES = HERE.parents[2] / "figures" # A point (x,y) denotes (,). # Euclidean embedding: (x,y) -> ((x-y)/2, sqrt(3)*(x+y)/2). IDENTITY = (1, 0, 0, 1, 0, 0) S1 = (-1, 0, 1, 1, 0, 0) S2 = (1, 1, 0, -1, 0, 0) S0 = (0, -1, -1, 0, -1, -1) GENERATORS = (S0, S1, S2) BASE = ((0, 0), (-1, 0), (0, -1)) HEXAGON = ((1, -1), (1, 0), (0, 1), (-1, 1), (-1, 0), (0, -1)) def mul(g, h): a, b, c, d, x, y = g e, f, k, l, u, v = h return (a*e+b*k, a*f+b*l, c*e+d*k, c*f+d*l, a*u+b*v+x, c*u+d*v+y) def act(g, point): a, b, c, d, x, y = g u, v = point return (a*u+b*v+x, c*u+d*v+y) def linear(g, point): return act(g[:4] + (0, 0), point) def inverse_linear(g, point): a, b, c, d = g[:4] det = a*d-b*c assert det in (-1, 1) x, y = point return ((d*x-b*y)//det, (-c*x+a*y)//det) W = ( ("e", IDENTITY, "PBblue", 90), ("s_2", S2, "PBteal", 30), ("s_2s_1", mul(S2, S1), "PBorange", -30), ("w_0", mul(mul(S1, S2), S1), "PBviolet", -90), ("s_1s_2", mul(S1, S2), "PBred", -150), ("s_1", S1, "PBgray", 150), ) assert len({g for _, g, _, _ in W}) == 6 def center3(g): # Three times the barycentre of g A^-. a, b, c, d, x, y = g return (-a-b+3*x, -c-d+3*y) def act_center3(g, point): a, b, c, d, x, y = g u, v = point return (a*u+b*v+3*x, c*u+d*v+3*y) def length_at_center3(point): # Count the affine root walls separating A^- and the target alcove. x, y = point assert all(t % 3 for t in (x, y, x+y)) return sum(abs(t//3+1) for t in (x, y, x+y)) def word_from_center3(point): target = point answer = [] ell = length_at_center3(point) while ell: for i, s in enumerate(GENERATORS): candidate = act_center3(s, point) if length_at_center3(candidate) == ell-1: answer.append(i) point = candidate ell -= 1 break else: raise AssertionError((point, ell)) assert point == (-1, -1) g = IDENTITY for i in answer: g = mul(g, GENERATORS[i]) assert center3(g) == target assert len(answer) == length_at_center3(target) return answer, g def full_interval(parameter): # theta_e(lambda) A^- = lambda + w_0 A^-. # The unique W_aff endpoint is obtained geometrically, so this also # handles the nontrivial Omega correction for lambda outside Q^vee. p, q = parameter word, endpoint = word_from_center3((3*p+1, 3*q+1)) result = {IDENTITY} for i in word: result |= {mul(g, GENERATORS[i]) for g in result} assert endpoint in result assert triangle(endpoint) == tuple(sorted(((p, q), (p+1, q), (p, q+1)))) return result, word def triangle(g): return tuple(sorted(act(g, v) for v in BASE)) def smaller_dominant_parameters(parameter): p, q = parameter result = [] for a in range((2*p+q)//2+1): for b in range((p+2*q)//2+1): if (a, b) == parameter: continue u, v = 2*(p-a)+(q-b), (p-a)+2*(q-b) if u >= 0 and v >= 0 and u % 3 == v % 3 == 0: result.append((a, b)) return result def chamber_of(vertices): center = tuple(sum(v[i] for v in vertices) for i in (0, 1)) matches = [] for name, h, _, _ in W: u, v = inverse_linear(h, center) if u > 0 and v > 0: assert all(min(inverse_linear(h, vertex)) >= 0 for vertex in vertices) matches.append(name) assert len(matches) == 1, (vertices, matches) return matches[0] def audit_parameter(parameter): top, top_word = full_interval(parameter) lower_union = set() lower_records = [] for lower in smaller_dominant_parameters(parameter): elements, reduced_word = full_interval(lower) assert elements <= top lower_union |= elements lower_records.append({"dynkin": lower, "size": len(elements), "reduced_endpoint_word": reduced_word}) boat = top - lower_union actual = {triangle(g) for g in boat} assert len(actual) == len(boat) == 36 predicted = set() for _, q, _, _ in W: for _, w, _, _ in W: location = linear(mul(q, w), parameter) predicted.add(tuple(sorted((location[0]+a, location[1]+b) for a, b in (linear(q, v) for v in BASE)))) assert predicted == actual groups = {name: sorted(t for t in actual if chamber_of(t) == name) for name, _, _, _ in W} assert Counter(map(chamber_of, actual)) == {name: 6 for name, _, _, _ in W} # Each chamber's actual six triangles form the full unit hexagon at h lambda. for name, h, _, _ in W: cx, cy = linear(h, parameter) expected_vertices = {(cx+x, cy+y) for x, y in HEXAGON} actual_vertices = {v for t in groups[name] for v in t} assert actual_vertices == expected_vertices | {(cx, cy)} edges = Counter(tuple(sorted((t[i], t[(i+1) % 3]))) for t in groups[name] for i in range(3)) assert sum(count == 1 for count in edges.values()) == 6 assert sum(count == 2 for count in edges.values()) == 6 return {"dynkin": parameter, "coweight_coset_mod_3": (parameter[0]-parameter[1]) % 3, "endpoint_reduced_word": top_word, "interval_size": len(top), "smaller_parameters": lower_records, "lower_union_size": len(lower_union), "boat_size": len(boat), "triangles_by_physical_chamber": groups} def xy(point): x, y = point return "({%d/2},{%d*sqrt(3)/2})" % (x-y, x+y) def path(points): return " -- ".join(xy(v) for v in points) + " -- cycle" def make_tikz(left, right): out = [r"% Generated by anc/figures/data/build_a2_chamber_translation.py.", r"% Exact Dynkin-coordinate alcoves; Euclidean omega_i embedding uses sqrt(3).", r"\begin{tikzpicture}[font=\scriptsize,>=Stealth]", r"\tikzset{PBalcove/.style={line width=.32pt,line join=round},", r" PBwall/.style={draw=black!45,line width=.45pt},", r" PBgrid/.style={draw=black!11,line width=.15pt}}"] for side, record, shift in (("left", left, -3.55), ("right", right, 3.55)): out.append(r"\begin{scope}[shift={(%.2fcm,0)},scale=.55]" % shift) out += [r"\begin{scope}", r"\clip (0,0) circle[radius=5.48];", r"\foreach \k in {-7,...,7}{", r" \draw[PBgrid] ({(\k+10)/2},{sqrt(3)*(\k-10)/2}) -- ({(\k-10)/2},{sqrt(3)*(\k+10)/2});", r" \draw[PBgrid] ({(-10-\k)/2},{sqrt(3)*(-10+\k)/2}) -- ({(10-\k)/2},{sqrt(3)*(10+\k)/2});", r" \draw[PBgrid] (-10,{sqrt(3)*\k/2}) -- (10,{sqrt(3)*\k/2});}", r"\foreach \angle in {0,60,120}{\draw[PBwall] (\angle:5.48)--(\angle+180:5.48);}", r"\end{scope}"] for name, _, color, _ in W: out.append("% Physical chamber: " + name) for vertices in record["triangles_by_physical_chamber"][name]: out.append(r"\path[PBalcove,draw=%s!80!black,fill=%s!44] %s;" % (color, color, path(vertices))) if side == "right": for name, h, _, _ in W: cx, cy = linear(h, left["dynkin"]) outline = [(cx+x, cy+y) for x, y in HEXAGON] out.append(r"\draw[white,line width=1.15pt] %s;" % path(outline)) out.append(r"\draw[black!65,line width=.42pt,dash pattern=on 2pt off 1.6pt] %s;" % path(outline)) start, finish = linear(h, left["dynkin"]), linear(h, right["dynkin"]) out.append(r"\draw[white,line width=2.1pt] %s -- %s;" % (xy(start), xy(finish))) out.append(r"\draw[-{Stealth[length=1.7mm,width=1.25mm]},black!90,line width=.65pt] %s -- %s;" % (xy(start), xy(finish))) out += [r"\fill[black!65] (0,0) circle[radius=.045];", r"\node[below=2pt,fill=white,inner sep=1pt] at (0,0) {$0$};"] for name, _, color, angle in W: chamber_label = "C^+" if name == "e" else name + "C^+" out.append(r"\node[text=%s!75!black,fill=white,inner sep=1.2pt] at (%d:5.94) {$%s$};" % (color, angle, chamber_label)) title = (r"\lambda=2\omega_1^\vee+2\omega_2^\vee" if side == "left" else r"\mu=3\omega_1^\vee+2\omega_2^\vee") out.append(r"\node[font=\small] at (0,7.04) {$%s$};" % title) out.append(r"\node at (0,-6.85) {$|\operatorname{PB}_{e,e}(%s)|=36$};" % (r"\lambda" if side == "left" else r"\mu")) out.append(r"\end{scope}") out += [r"\begin{scope}[shift={(0,-4.35)}]", r"\draw[black!65,line width=.45pt,dash pattern=on 2pt off 1.6pt] (-3.4,0)--(-2.85,0);", r"\node[right,inner sep=2pt] at (-2.8,0) {$\lambda$};", r"\draw[-{Stealth[length=1.7mm,width=1.25mm]},black!90,line width=.65pt] (-.95,0)--(-.4,0);", r"\node[right,inner sep=2pt] at (-.35,0) {$h\delta$};", r"\node at (2.25,0) {$\delta=\mu-\lambda=\omega_1^\vee$};", r"\end{scope}", r"\end{tikzpicture}"] return "\n".join(out) + "\n" def main(): left, right = audit_parameter((2, 2)), audit_parameter((3, 2)) arrows = [] for name, h, color, _ in W: start, finish = linear(h, (2, 2)), linear(h, (3, 2)) delta = linear(h, (1, 0)) translated = {tuple(sorted((x+delta[0], y+delta[1]) for x, y in t)) for t in left["triangles_by_physical_chamber"][name]} assert translated == set(right["triangles_by_physical_chamber"][name]) arrows.append({"chamber": name, "color": color, "from_h_lambda": start, "to_h_mu": finish, "h_delta": delta, "exact_chamber_triangle_translation_passed": True}) data = {"type": "A2", "factors": ["e", "e"], "outer_Omega": "e", "embedding": "omega1=(1/2,sqrt(3)/2), omega2=(-1/2,sqrt(3)/2)", "base_alcove_vertices_dynkin": BASE, "audit_method": "Literal affine Coxeter subwords, minus ALL smaller same-coset dominant intervals; exact triangle-set comparison", "parameters": [left, right], "arrows": arrows, "all_passed": True} (HERE / "a2_chamber_translation_exact.json").write_text(json.dumps(data, indent=2)+"\n", encoding="utf-8") (FIGURES / "a2_chamber_translation.tex").write_text(make_tikz(left, right), encoding="utf-8") print(json.dumps({"all_passed": True, "interval_sizes": [left["interval_size"], right["interval_size"]], "boat_sizes": [left["boat_size"], right["boat_size"]], "complete_intervals_enumerated": sum(1+len(row["smaller_parameters"]) for row in (left, right)), "chamber_translations_checked": len(arrows)}, indent=2)) if __name__ == "__main__": main()