"""Reproduce the HC3–HC9 proof diagram."""
from pathlib import Path
SVG='<svg xmlns="http://www.w3.org/2000/svg" width="1100" height="650" viewBox="0 0 1100 650" role="img" aria-labelledby="title desc">\n<title id="title">Exact corner repair, an increasing matrix chain, and diagonal index</title><desc id="desc">An approximate corner projection q is repaired to r with trace tau(p), then conjugated onto p. Full dyadic approximations build a nested chain whose trace-preserving Hilbert unitary gives pRp isomorphic to R. Isomorphic complementary corners give index one over t times one minus t.</desc>\n<rect width="1100" height="650" fill="#f7fafc"/><g font-family="Cambria, Georgia, serif" fill="#17364c">\n<text x="28" y="43" font-size="29">Every positive corner trace, including irrational traces</text>\n<text x="28" y="81" font-size="22">R = weak closure of ⋃ M₂⊗k;   τₚ = τ / τ(p);   0 &lt; τ(p) ≤ 1</text>\n<rect x="25" y="111" width="320" height="240" rx="12" fill="#e5effa" stroke="#7892a8"/><text x="42" y="147" font-size="25">Repair the corner exactly</text>\n<text x="42" y="185" font-size="22">q = 1[½,1](E_D(p))</text><text x="42" y="221" font-size="22">τ(r) = τ(p),   uru* = p</text><text x="42" y="257" font-size="22">‖u − 1‖₂ ≤ 2‖r − p‖₂</text><text x="42" y="294" font-size="22">uD₀u* ⊂ pRp, unit p</text><text x="42" y="333" font-size="20">HC3–HC4; (C5)–(C9)</text>\n<rect x="390" y="111" width="320" height="240" rx="12" fill="#e7f4ed" stroke="#7892a8"/><text x="407" y="147" font-size="25">Build nested full matrices</text>\n<text x="407" y="185" font-size="22">Bₙ ≅ M₂ᵏⁿ,   kₙ ≥ n</text><text x="407" y="221" font-size="22">Bₙ ⊂ Bₙ₊₁ ⊂ pRp</text><text x="407" y="257" font-size="22">dist₂(xⱼ, Bₙ) &lt; 2⁻ⁿ</text><text x="407" y="294" font-size="22">All xⱼ with j ≤ n</text><text x="407" y="333" font-size="20">HC5–HC6; (C10)–(C12)</text>\n<rect x="755" y="111" width="320" height="240" rx="12" fill="#fff1db" stroke="#7892a8"/><text x="772" y="147" font-size="25">Identify both closures</text>\n<text x="772" y="185" font-size="22">U x̂ = φ(x)̂</text><text x="772" y="221" font-size="22">U L(pRp) U* = L(R)</text><text x="772" y="257" font-size="22">φ preserves τₚ and τ</text><text x="772" y="294" font-size="22">pRp ≅ R for every p ≠ 0</text><text x="772" y="333" font-size="20">HC7–HC8; (C13)–(C14)</text>\n<g stroke="#526b7d" stroke-width="3" fill="#526b7d"><path d="M349 231H379"/><path d="M714 231H745"/><path d="M375 225L384 231L375 237Z"/><path d="M741 225L750 231L741 237Z"/></g>\n<rect x="25" y="382" width="1050" height="211" rx="12" fill="#edf0fa" stroke="#7892a8"/>\n<text x="43" y="419" font-size="25">Complementary corners realize every finite real d ≥ 4</text>\n<text x="43" y="458" font-size="23">τ(p) = t, q = 1 − p;   θ : pRp → qRq;   τ(θ(x)) = (1 − t)τ(x)/t</text>\n<text x="43" y="499" font-size="23">N = {x + θ(x)} ⊂ R;   [R:N] = 1/t + 1/(1 − t) = 1/[t(1 − t)]</text>\n<text x="43" y="540" font-size="23">t = (1 − √(1 − 4/d))/2 ∈ (0, ½];   d = 4 gives t = ½</text>\n<text x="43" y="574" font-size="20">HC9; (C15)–(C17). The corner proof itself does not use the index formula.</text>\n<text x="28" y="627" font-size="20">Proof mechanism; boxes are schematic. No finite-stage membership of p is assumed.</text>\n</g></svg>\n'
Path(__file__).with_suffix(".svg").write_text(SVG,encoding="utf-8")
