Skip to content

formal: a machine-checked theory of inverting box-filter rasterisation - #29

Merged
Stefatorus merged 80 commits into
mainfrom
ccr-73a29992-0f58d2
Oct 11, 2026
Merged

Stefatorus merged 80 commits into
mainfrom
ccr-73a29992-0f58d2

Conversation

@Stefatorus

Copy link
Copy Markdown
Member

Lean 4 + Mathlib (formal/InkvecTheory). Coverage is defined as the Lebesgue area of the
shape inside a pixel; everything else is proved from it:

  • column sums are the boundary's mean height over the column (Puckett's VOF identity,
    for every continuous graph and any number of rows);
  • the exact null space: the layer-cake fibre of a column, invisible ripples at every
    frequency, and the zigzag as the one invisible deformation of a polyline with a
    vertex on every pixel border (the boundary solve's "sawtooth");
  • polynomial boundaries of degree < n are determined by their pixels on n columns;
  • the cell-mean-to-point correction, exact on cubics, with its -3/640 f'''' defect;
    end to end from pixel areas, and the rational constants of planar/strip.rs;
  • the 1/2-crossing reading is biased by up to 3/2 - sqrt 2 px on a straight edge,
    sharp;
  • any reading of thresholded pixels is off by 1/2 px on some edge, through any
    L-level quantiser by 1/(2L);
  • sub-pixel strokes: exact inversion when they straddle a border, unidentifiable
    inside one row, and the coverage centroid's bias;
  • noise (unbiased, variance k sigma^2, face-value gain 25/36) and n x n supersampling
    (the midpoint rule to within 1/(2n)).

No sorry, no axiom of its own: lake build InkvecTheory.Audit reports
[propext, Classical.choice, Quot.sound] for all 38 headline theorems. The formal
workflow builds the library and fails on any other axiom, sorry or admit; it runs only
when formal/ changes.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6

claude added 30 commits October 10, 2026 01:41
Lean 4 + Mathlib (formal/InkvecTheory). Coverage is defined as the Lebesgue area of the
shape inside a pixel; everything else is proved from it:

- column sums are the boundary's mean height over the column (Puckett's VOF identity,
  for every continuous graph and any number of rows);
- the exact null space: the layer-cake fibre of a column, invisible ripples at every
  frequency, and the zigzag as the one invisible deformation of a polyline with a
  vertex on every pixel border (the boundary solve's "sawtooth");
- polynomial boundaries of degree < n are determined by their pixels on n columns;
- the cell-mean-to-point correction, exact on cubics, with its -3/640 f'''' defect;
  end to end from pixel areas, and the rational constants of planar/strip.rs;
- the 1/2-crossing reading is biased by up to 3/2 - sqrt 2 px on a straight edge,
  sharp;
- any reading of thresholded pixels is off by 1/2 px on some edge, through any
  L-level quantiser by 1/(2L);
- sub-pixel strokes: exact inversion when they straddle a border, unidentifiable
  inside one row, and the coverage centroid's bias;
- noise (unbiased, variance k sigma^2, face-value gain 25/36) and n x n supersampling
  (the midpoint rule to within 1/(2n)).

No sorry, no axiom of its own: `lake build InkvecTheory.Audit` reports
[propext, Classical.choice, Quot.sound] for all 38 headline theorems. The `formal`
workflow builds the library and fails on any other axiom, sorry or admit; it runs only
when formal/ changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…sed ring is refined

A column's coverages, summed from a pixel wholly in one face to a pixel wholly in the
other, are exactly the boundary's mean height over the column, whatever its slope or
curvature (column_sum_eq_average in formal/InkvecTheory). Four adjacent column means fix a
unique cubic (poly_eq_of_averages), which is the boundary wherever the boundary is a cubic.
Stage 07 now slides each vertex between two flat fills along its lattice normal onto that
cubic (planar/strip.rs) before trying the per-vertex probes. The probes needed a normal they
could only estimate from the lattice, and read two-probe brackets at the 1/2-crossing,
biased by up to 3/2 - sqrt 2 px on a straight edge. A corner (the one-sided cubics disagree
with the central one by more than 0.05 px), a junction or a third colour in a window makes
the strip reading decline, and the probes decide as before. The theorem
strip_reading_exact proves the reading's rational constants recover a cubic boundary from
its pixel areas exactly.

probe_chord clamped its neighbours at the ends of an edge, so the seam vertex of every
closed ring took a one-sided chord; on a horizontal run, a horizontal normal, and the vertex
stayed on the lattice (0.30 px off on an exact disc, kept by Fast). It now wraps round a
closed edge's seam, in planar/chord.rs (moved out of planar.rs, which the quality budget
holds to 1513 lines).

Stage-07 points against exactly known shapes (bench/theory): mean error 0.073 -> 0.011 px
on exact-area renders and 0.073 -> 0.016 px on 8x8 supersampled ones.

Regression gate against main (246 icons, Linux): dE00 -10.96 % fast-128ss, -8.70 %
fast-512ss, -9.83 % fast-512ssop, -4.51 % quality-128ss, -1.89 % quality-512ss, -1.36 %
quality-512ssop (non-inferior); turning better in Fast, level in Quality; parameters within
margin everywhere (+1.93 % quality-128ss, -2.72 % fast-128ss). Ablated, the strip reading
carries the whole gain; the seam fix is within noise. The Linux gate baseline is this
run's numbers. bench/cases: Quality 42/42; Fast 28/42, edge_axis newly passing (ratchet
tightened). Time unchanged (Fast median 22.3 -> 22.7 ms, Quality 538 -> 529 ms at 512 px).

Contract hashes re-blessed for x86_64-linux-gnu (INKVEC_BLESS=1, the other targets'
dropped as stale; CI's INKVEC_BLESS=add records them). The api test
restored_pixels_are_traced_with_soft_intake ripples at 12 levels: at 9 the plain and forced
traces differed only by a 0.01 px centre error on one of them, which the column sums no
longer make; at 12 forcing soft intake changes the palette, which the test is for.

The docs' planar.rs file:line references are re-mapped through the diff (89 of them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…easured

docs/theory/README.md: the mathematics behind reversing rasterisation (exact-area
rasterisers, volume-of-fluid reconstruction, the partial-area edge detector, finite-volume
histopolation, finite rate of innovation, precision limits, vectorisers), what of it had been
formalised (nothing found), what formal/InkvecTheory now proves, what the theorems say about
inkvec's stage 07, the measured effect of the strip reading, six further proposals ranked,
and the model's limits. On the site under "How it works".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…troke

Stroke detection (`Options::detect_strokes`) is now on by default in Quality mode;
`--no-detect-strokes` turns it off and `INKVEC_RIBBONS=0` does for benchmark builds.
Its cost, the reason it stayed opt-in, is 1.16x the trace at 512 px over the screen set
(1.23-1.31x on the line and glyph sets, the worst icon 0.8 s more).

Merges (ribbon/refine/merge.rs). After its splits the stroke solve runs them backwards:
each joint is offered the line through its outer ends, an arc on either neighbour's
circle (both's when they turn alike, or the three points'), and the cubic with the outer
tangents (Schneider's arms); each cubic and arc the line on its chord; a closed path of
arcs on one circle that circle. A merge is kept when the face's description length falls,
unsolved or after a short solve, drawable, and within the decision's fidelity bound
(`fit_face` now takes it as `chi2_cap`). The fitter's arcs stop at 120 degrees, so an
artist's 270-degree arc came back as three arcs and a short line at each cap; lucide
closed-caption and iteration-ccw now carry exactly the artist's structure. Arcs within 15
degrees of a half turn are written as the half circle on their chord, and the solve
refuses them otherwise (rounding the radius would move the drawn arc).

Faces that leave with a stroke. On an opaque page the inside of a stroked ring is its own
face, painted the page's colour over the ring's disc. A face the stroke face alone
encloses, painted exactly the colour beneath, now leaves with it and counts in the
decision: a ring on white is one stroke over the page, not two discs.

Regression gate against the committed baseline (all demonstrable gains; Fast identical):
dE00 -8.18 % quality-128ss, -8.57 % quality-512ss, -11.35 % quality-512ssop; parameter
ratio to the artist's files 1.495 -> 0.954, 1.728 -> 1.168, 1.967 -> 1.414; turning
-6.1 %, -6.0 %, -5.6 %. The baseline is tightened to this run.

Also: Naturality.lean (a merge that keeps the truth drawable never costs fidelity, for
every noise; four theorems, standard axioms only); bench/theory attribution, parameter and
naturality diagnostics; bindings regenerated for the new default; contract re-blessed;
doc line references remapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…nostic

docs/theory/optimal.md states what the best possible raster-to-vector tracer computes
(the most probable SVG under the exact rendering model and a prior over how people write
SVG), what is known about it (the picture is determined down to the anti-aliasing floor
for clean art; the program is not; the general problem is NP-hard), how far each inkvec
stage is from it, and the approximations to make next, ranked.

bench/theory/oracle_cost.py measures the split it proposes: for each icon, whether the
tracer's own objective (fit to the input's pixels plus lambda per parameter) prefers the
artist's file, which the search then missed, or the trace. At 512 px it prefers the
artist's file on 208 of 246 icons (216 on the opaque tier), robustly to the noise scale:
the remaining gap is mostly search. At 128 px it prefers the trace on 117: there the
choice is the prior's.

The page is on the site beside the theory page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…resentation)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
A fourth gated axis, by geometry rather than by colour. Both SVGs are drawn flat (no
anti-aliasing) at four times the input's size, every pixel takes the nearest of the
artist's colours (CIELAB plus alpha; shaded art clustered to 48 colours), and the area
where they disagree, divided by the artist's edge length (four-direction Cauchy-Crofton),
is the mean distance between the trace's edges and the artist's, in input pixels.

Calibrated: an edge moved by delta reads delta in any colour (a disc grown by 0.1 px reads
0.097 in dark red and in pale grey; dE00 reads 0.021 and 0.0018), and the artist's own file
reads 0 (bench/theory/geom_calibration.py, geomatch's self-check). geom_far, the part more
than an input pixel from any artist edge (missing or extra features), is reported.

Gated at 2 %, family-macro. The baseline is re-recorded in format 2 / scorer version 4 for
the new axis, from the same build as before: every existing number in it is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…d of any description

Chain B of docs/theory/chains.md stated and argued informally in
docs/theory/chain-boundary.md: inks and mixtures (B1); the window identity, which scores
any candidate description exactly by areas, its variances under 8-bit quantisation and
point supersampling, and what column windows keep against per-pixel terms (B2); vertices
and thin features as proposals, identifiability and precision rather than decisions (B3);
the decomposition, null space, precision and tests the representation consumes (B4). Ends
with the interface proposal for the representation chain, the chain-shortening proposals,
open questions, and the phase-2 plan (Lean lemmas, Rust modules, measurements).

bench/theory/evidence_eval.py measures the claims on exact renders: window variances,
the information ratio, a wedge's vertex precision, and the smallest distinguishable fillet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…sign, counted priors, layers

Chain R of docs/theory/chains.md stated and argued informally in
docs/theory/chain-representation.md. R0: the objective is the posterior of the discrete
design with its free coordinates integrated out (Laplace / Wallace-Freeman evidence), which
prices each coordinate by its own precision and each constraint by its prior odds; today's
flat description length is its special case, and the lexicographic rule (fit, then fewest
free coordinates, then the prior) is proved to be its high-resolution limit; a slightly false
constraint costs at most what its test admitted. R1: free coordinates by rank (exact for the
linear constraints icons mostly use; ties by components; symmetry by the average character).
R2: Bayes-factor tests with error rates, consistency, contradiction-free sequential
acceptance, ties by an exact one-dimensional dynamic program, the grid on tie classes.
R3: the prior counted from 1,408 artist files. R4: layers decompose exactly given the paint
order (completion is the prior's choice inside an interval, invisible, and removes the
compositing seam); encoder optimality against the gate's count. Ends with the interface,
adopting the boundary chain's evidence and evaluator with amendments, answers to its
questions, verdicts on its shortening proposals, and the phase-2 plan.

bench/theory/design_prior.py counts the prior with exact rational arithmetic and simulates
grid inference, snapping and coordinate ties on the artists' numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…g apart

chains.md records what the boundary and representation owners agreed in phase 1 (areas,
not points, as the interface; B re-cut; R0, the objective, added to R; corners, joins,
gradients, strokes and layers decided by R; the amendments B delivers). verification.md
compares six ways of linking the Lean theorems to the Rust and chooses certified results:
free solvers, every result accepted by a checker generated from the Lean definition its
theorem is about, in exact arithmetic or rigorous intervals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…re about

The decision of docs/theory/verification.md, in place. formal/InkvecTheory/InkvecTheory/Gen/
holds a straight-line expression language with a real semantics (what theorems are about), an
exact rational one and an interval one, with their soundness theorems (evalQ_sound,
evalI_sound, nonneg_of_evalI; Lean's three axioms only, the IEEE 754 assumption stated as the
hypothesis Enclosing), and a printer to Rust. Emit.lean writes crates/inkvec-verified/src/
generated/; the formal CI job regenerates it and fails on any difference, so the Rust cannot
drift from the definitions. Generated modules are #[rustfmt::skip].

crates/inkvec-verified: no dependencies; the runtime (iv.rs, outward-rounded f64 intervals;
q.rs, checked i128 rationals with Euclid's overflow-free exact comparison) and the generated
kernels; coverage 97.9 % (floor recorded at 97).

First kernels (Gen/Strip.lean): strip.rs's cubic stencil is the generated one, bit for bit
the formula it replaced (outputs identical on 120 traces, Quality and Fast, 128 and 512 px);
and every vertex the strip reading moves is accepted only if the generated interval checker
proves the shift puts it on the cubic the column sums determine within 1e-9 px
(stripResidual_on_cubic), else it goes to the probes.

Also removes an import left unused by the emitter's Ribbons refactor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…rtified by the painter interval

A new emitter stage (crates/inkvec-cli/src/layers.rs) completes every opaque face that has
something painted over it: the cheapest shape E with L <= E <= V u U (V what the face shows,
U what is painted later, L V plus the half-pixel reach under U the seam underlap provides,
tapered at junctions as the underlap is). Candidates: a circle or ellipse through the owned
boundary, the rectangle round what shows, and the face's rings with each covered run replaced
by the corner its owned lines meet at, a chord reaching under the cover, an offset or a bulge.
Each is accepted only by the scan-line painter-interval check and only when it writes no more
numbers than the face (plus what the underlap would add). Completed faces keep their place in
the paint order and are not underlapped. Strokes from ribbons carry their geometry so faces
under them complete. Quality mode; INKVEC_LAYERS=0 turns it off.

The flag openmoji/1F3F4-E0069-E0074-E0062-E0061-E007F: 54 -> 20 parameters, the artist's own
count (a rectangle under two triangles under the stroked border).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…s, the intake's floor

The boundary chain's first milestone (docs/theory/chain-boundary.md, "Phase 2, milestone 1").
Nothing in the pipeline calls it yet; engine output is unchanged.

inkvec-core `likelihood`: the BoundaryLikelihood trait the representation chain scores
candidates with. Pieces (line, quadratic, cubic, elliptical arc); arcs drawn as usvg converts
them (kurbo 0.13.1 port); exact clamped window integrals that count every pass of a curve
through a strip (folds and curves crossing a column twice are scored correctly); chi2 with
the renderer floor's per-edge offset in Sherman-Morrison form; prefix moments for
least-squares polynomial graphs over any range; junction reports with arms in cyclic order
and candidate continuations; corner proposals; information density.

inkvec-trace `evidence`: builds it from the planar map, the image and the fills. Every
partial pixel between two flat inks is in exactly one column or row window (45 degrees
included). Windows the starting geometry does not cross once become per-pixel corner terms.
Junction neighbourhoods are kept per pixel, in colour. Thin strips and third-ink pixels are
set aside. No pure flanks, which bias one way. chi2/M is 0.97 at the truth over 442 windows
of exact 8-bit renders.

Lean: Windows.lean proves the window identity for any finite pixel set and any measurable
region, and the trapezoid integral. Gen/Evidence.lean defines the kernels trapezoid,
window_term, fourth_difference and corner_excess with their theorems; the audit shows the
three standard axioms only. Runs and corner proposals are accepted only through the
generated interval checkers.

bench/theory/renderer_floor.py measures what the corpus intake adds beyond quantisation,
per family and tier:
- Arcs drawn as usvg converts them matter on simple-icons.
- Replicating tiny-skia's 4x4 lattice brings straight fills down to quantisation; curves
  and strokes keep tiny-skia's flattening and stroker error.
- 44-86 % of the floor is a per-edge constant.
- The 512ss tier is stale against resvg 0.48.1, by up to 24 levels; 128ss reproduces
  exactly.
- Junction pixels need per-layer compositing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…s 1114 -> 1133)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…c-verified

Design/Layers.lean proves the painter's interval (painter_interval_iff), that each
face may be completed on its own (replace_in_interval) and the compositing identities
of the seam and junction residue. Gen/Design.lean defines the span-containment kernel
(span_within) with its meaning and the per-line fold; the layers stage now accepts a
completion only when the generated interval kernel certifies the solver's span cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
The gate's rasters were exact renders, noiseless but for 8-bit rounding.
The `web` tier is each screen icon as logos usually reach a tracer:
flattened onto white, resized 512 -> 400 px with bicubic interpolation and
saved as a JPEG at quality 80 with 4:2:0 chroma (blur, ringing, 8x8 block
quantisation, half-resolution colour; the practical degradation model of
Zhang et al. 2021 fixed at one setting). `bench/build_web_tier.py` writes
it and the 246 files are committed so every machine scores the same
bytes. `quality-web` and `fast-web` join the gate's conditions; until the
baseline holds them they are scored for information.

The scorer reads a `.jpg` intake, and compares a file with no alpha
channel over white, as an opaque tier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…al check

Merges the session branch (likelihood trait, evidence build, generated evidence
kernels) with the design kernels side by side. Adds span_link and chain_cover: a
lower span may be covered by a chain of upper spans whose widened ends touch, so the
cracks two regions leave where they meet do not refuse a completion. The checker's
slack is a tenth of a pixel per crossing, implied by the solver's own per-line test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
The Linux baseline gains quality-web and fast-web, recorded by this
branch's build at 9789ce2 (the other six conditions are unchanged). They
record the engine as it is on noisy input, so a change is now gated
there too: against the opaque 512 px tier, Quality's dE00 is 0.20
against 0.040, its geometric match 0.35 px against 0.097, and its
parameters 2.16x the artist's against 1.41x; Fast writes 7.2x the
artist's parameters against 3.5x (halo colours taken for inks).

bench/theory/noise_profile.py measures the web tier against the exact
raster it stands for. The JPEG's error sits at edges (4.5 levels of luma
within a pixel of one, 0.2 in interiors) where the engine's noise
estimate, read from flat regions, returns its floor of 0.5 levels on
every image. Column-window sums stay unbiased under the resampling and
the codec (every mean within 0.0004 px of area) while their spread grows
from 0.005 px (8-bit) to 0.066: the variance changes, not the identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…e by population

9789ce2 committed the web tier's files and scorer but not the gate's two
new conditions or the documentation that names them (lost from the index
before that commit): `quality-web` and `fast-web` now join `CONDITIONS`,
and the gate, CONTRIBUTING, the bench and root READMEs and the TODO say
eight conditions. The baseline already holds both (3f38c65).

docs/theory/noise.md: what resampling and JPEG add (measured by
bench/theory/noise_profile.py), why column-window sums stay unbiased
under a centred kernel (Fubini: the area profile convolved with the
kernel's horizontal marginal) while their variance grows thirteenfold,
what has to change (per-place noise, heavy tails, the blur in the forward
model, colour from luma, halos explained by their edge), why noise should
make the prior matter more, and where the engine stands on the web tier,
including that tracing it without gradients is worse (dE00 +62 %).

regularize::residual_sigmas returns the interior and edge populations
apart; residual_sigma is their maximum as before (output unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…notonicity in Lean

Completion now tries corner cuts inside a covered run: a chamfer between two lines
is dropped and the lines extended to meet under the cover. A blur-tolerance zone
round junctions (psf radius, zero on a clean intake) relaxes the interval where the
picture is not identifiable. A face already written as a primitive takes no tie, and
the rectangle candidate sits on the face's own geometry rather than on scan lines.
Design/Noise.lean: a constraint accepted at one noise level stays accepted at more
noise (accept_monotone); Huber is the Gaussian on inliers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…tter's adapter, A2

Milestone 2 of the boundary chain (docs/theory/chain-boundary.md, "Phase 2, milestone 2").

The noise model, per image and from its own edges. A window's error splits three ways, all
measured on the engine's own windows against exact truths (bench/theory/floor_selfcal.py,
examples/evidence_calibrate.rs):
- replicas: windows at the same sub-pixel phase repeat one measurement, so a stretch counts
  once;
- a rough part, read from the fourth differences of replica-free stencils;
- a smooth part, given one window's variance as a per-edge offset.

How the estimator reads it:
- Rounding is the base variance, alpha-aware for ink over the clear ground.
- The rough part is a winsorised moment: exact for normal errors, within 2 % for rounding's
  bounded ones.
- Geometry is gated out by a noise-scaled local bend, and a significance test guards against
  spurious extras.
- The tail is Student-t degrees of freedom; a point-sampling renderer's lattice is read from
  axis-aligned edges.
- The cost is Huber at kappa = min(3, sqrt(nu)) (agreed with the representation chain), on
  Kalman-standardised innovations.

Lossy and soft intakes:
- luma unmixing for 4:2:0;
- plateau-median inks;
- a reach and band windows that span the observed ramp;
- column or row chosen along the edge with hysteresis (a noisy diagonal had been cut into
  alternating fragments).

Validation, the truth scored with the evaluator's own score (chi2_floor per independent
measurement, Huber in brackets), first with rounding alone, then with the per-image model:

| input | rounding alone | per-image model |
|---|---|---|
| web | 150 | 3.1 (1.8) |
| exact | 0.97 | 0.72 |
| lattice | 14 | 1.8 |
| ss8 | 334 | 3.0 |
| resvg at 128 | 32 | 4.3 |
| committed 512ss | 206 | 9.9 |

resvg keeps a smooth curve error (flattening, arc cubics) that no difference sees and a fit
absorbs.

The blur forward model:
- RenderModel adds 1/2 mu2 A'' (mu2 = (w^2 - 1)/4 from ramp_evidence's width).
- RenderModel now draws arcs exactly by default; RenderModel::usvg() keeps usvg's cubics.
- Windows.lean proves window_sum_resampled, blur_affine_profile and blur_quadratic_profile.

In the engine:
- The noise is measured only on an intake the colour path finds soft or lossy, and reported
  as ColorTrace::noise (inkvec_core::noise::NoiseModel) above 3 levels of edge noise.
- Clean intakes are unchanged (quality-128ss identical on the gate).
- Folding it into the planar sigmas is opt-in (INKVEC_NOISE_FOLD=1): with today's fitter it
  trades fidelity for simplicity on web.
- strip.rs refuses a vertex as a corner only beyond max(SIDE_TOL, 3 sqrt(70 V)/12), which is
  unchanged on clean renders.

For the representation chain:
- EdgeScorer partitions windows by point index, wrapping on closed edges.
- O(1) best_graph and weight_moments; chi2 through the trait.
- Piece::from_svg_arc.
- A2: chi2_band scores stroke bands on thin-feature pixels; chi2_local_layers scores
  per-layer compositing at junctions.
- The local terms' flattening now follows exact arcs instead of dropping them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
… face's geometry

The completion's lower bound now counts the gap between a face and a stroke drawn
narrower than the face above's region in the map, which the underlap painted. The
rectangle candidate is tried round the lower bound first, each side put on the face's
own vertices, then on the sampled box. The stage's switch is INKVEC_COMPLETION (the
old INKVEC_LAYERS name belonged to the removed translucent-layer variable); its
margin is a constant. bench/theory/design_stats.py counts pieces, angles, grid and
ties of traces against the artists' files. The chain page gains R0.8 (noise and
constraints), the agreed interfaces and milestone 1's results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ke only)

On the web tier (512 -> 400 px bicubic, JPEG quality 80, 4:2:0) Fast's palette took the
codec's halos for inks: a band two or three pixels wide whose chroma has bled across
independently of its luma lies 0.08-0.09 sRGB off the line between the two inks, twice
BLEND_TOL, so neither absorb_slivers nor absorb_rims took it, and twemoji/1f1fa came back
with four inks and 215 faces. The codec also splits one ink into variants a few dE00 apart
(openmoji/1F9D1's outline as #010101, #010009 and #080000), which tile it into fragments.

Two passes, on a lossy intake of an opaque image only:
- absorb_halos (fast/faces/halos.rs): in BT.601 YCbCr, a thin component (no 5x5 window of
  its own) whose mean lies channel by channel between two thick inks around it, or 20 %
  beyond, is their halo; each pixel goes to the ink it covers more of, read mostly from
  luma. A thin component of an ink with an area elsewhere must also be a strip within 0.04
  of the segment (keeps twemoji/1faa3's real rim). Flecks of a halo ink inside one ink
  go to it.
- merge_same_inks takes a thin component into a neighbouring ink within
  SOFT_SAME_INK_DE00; one with an interior keeps SAME_INK_DE00.

fast-web gate (246 icons): dE00 -11.83 %, turning -50.53 %, ratio -42.79 %, geom -6.84 %,
all demonstrable gains. Clean intakes take neither pass: no new work, same bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ntical

The noise-scaled side test in planar/strip.rs, max(SIDE_TOL, 3 sqrt(70 V)/12), is withdrawn.
V came from the trace's per-channel sigma over the pixel's contrast, and on a low-contrast
edge that passes SIDE_TOL on clean renders too. Against the previous build it changed 4 of
246 icons at quality-128ss and 14 at fast-128ss, mostly noto-emoji's shading. A clean intake
must keep its bytes. The planar refinement runs before the noise is measured and does not
know whether the intake is soft, so the test waits until that decision reaches it.

The colour path's noise measurement moves into evidence::with_noise, its last step, so lib.rs
carries only the field and one call.

With the fold off by default and nothing in the pipeline reading ColorTrace::noise yet, every
traced file is byte-identical to the previous build:
- the base build is d1e989f;
- all 246 icons were compared under each of the eight gate conditions;
- clean run times are within noise;
- no 128 px clean intake takes the measurement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
claude added 29 commits October 10, 2026 23:00
…t reads the container only

After the reorder, a clean input still paid for the probe trace's copy and for the ringing
score: fast-512ss +8.8 ms of CPU on 31 (median, 246 icons), quality-512ssop +12.8 on 937. The
probe is only needed by the residual, which only runs on evidence, so without evidence
`--restore auto` now makes no probe and the input takes the plain path: its trace is the plain
one by construction. Fast mode reads the container alone: the ringing score is 2.5 ms of a
31 ms Fast trace at 512 px (best of three), and it would be added to every clean PNG. What Fast
gives up is a JPEG re-saved as PNG; on the web tier's own pixels the score passes the gate on
186 of 246 icons, on the clean tiers on none, so no gate condition decides differently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…s drawn

Speed. An icon whose SVG is byte-identical to the baseline's is traced but not
scored again (it took the baseline's numbers anyway; --rescore scores it). The
artist's side of geom is cached by the file's hash; dE00 converts only the
sampled pixels where the renders differ; flat renders are coded and labelled
run by run; no render is saved when DISTS is off; one pool serves every
condition. CPU per icon, full set: quality-512ssop 3.99 s -> 2.84 cold, 2.15
warm, 1.43 when unchanged; fast-web 1.75 -> 1.03, 0.64, 0.35. Old and new
scorers on one binary gave identical per-icon rows, summaries and verdicts on
both conditions.

Human statistics. inkvec_bench/design.py reads a file once and takes 36
candidate statistics of its construction, each as a divergence from the
artist's file; 29 are kept after pruning at |Spearman rho| 0.7 over
quality-512ssop and quality-web. The gate reports them (console, report JSON,
artifact) without gating; bench/human_stats.py traces without rendering and
gives the per-family picture, the oddities, the correlation matrix and a paired
before/after comparison for tuning a build or a flag such as --editability.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…statistics

From the benchmark executor (worktree-agent-a7aac82e316966598, 92f2f65):

- Speed, with every gate number unchanged: proven old code against new on the full set
  under quality-512ssop and fast-web (246/246 rows and hashes identical, all summaries
  bitwise equal, all verdicts equal, cold and warm artist cache). An icon whose SVG is
  byte-identical to the baseline's is not scored again; the artist side of geomatch is
  cached; dE00 and geomatch take faster exact paths. CPU per icon, quality-512ssop
  3.99 s -> 2.84 s cold, 2.15 s warm, 1.43 s in a normal run; fast-web 1.75 -> 1.03 /
  0.64 / 0.35 s. What is left is mostly the tracer.
- Human statistics: inkvec_bench/design.py reads a file once and takes 36 candidate
  statistics of how it is drawn, each as a divergence from the artist's file; 29 are kept
  after pruning at |Spearman rho| 0.7 over quality-512ssop and quality-web, none above
  0.57 with a gate axis. The gate reports them, not gated; bench/human_stats.py gives the
  per-family picture, the oddities, the correlation matrix and a paired before/after for
  tuning a build or a flag such as --editability.

Checked here after the merge: the gate's tests, the scoring tests and the design tests
pass; a sampled run (13 icons, quality-128ss and fast-web) reads identical on every axis,
with all 26 icons byte-identical and not re-scored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…lone

A codec's error sits at the edges (on the web tier the RMS is 4.5 levels of luma and 6.5 of
chroma on the edge pixel, 0.2 and 0.35 in the interiors), and its ringing is a rim of residual
just inside every region. carve_residual_features cut that rim into extra regions along the
edges. On a lossy intake a pixel is now carved only when its whole 5x5 window lies in its
region (gradient::carve::CODEC_BAND = 2 px); a clean intake passes 0 and is byte-identical.

quality-web, 246 icons, the gate's distance axes against the recorded baseline:

  band  changed  dE00     turning_gap  ratio_gap  geom
  1 px  17       +0.21 %  -4.89 %      -0.58 %    -0.01 %
  2 px  18       -0.01 %  -5.38 %      -0.80 %    -0.10 %
  3 px  20       -0.03 %  -5.47 %      -0.82 %    +0.08 %

Two pixels is the one reach no axis reads worse at. The shipped code reproduces the measured
2 px prototype byte for byte on all 246 web icons. carve_residual_features_with_detail_noise
takes the band as a new last argument. Test: the_codec_band_along_an_edge_is_not_carved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…Quality intake

On a soft intake the strip reading now declines a vertex as a corner only beyond
max(SIDE_TOL, 3 sqrt(70 V)/12): three standard deviations of the one-sided fourth difference
(fourthDiff_side). V = widest * sigma^2 / |d|^2, a column mean's variance from the trace's
measured noise.

The test was withheld at milestone 2 because ungated it changed 4 clean icons at
quality-128ss and 14 at fast-128ss: shading's low contrast makes sigma/|d| large on clean
renders too. Now the front end's own soft-intake decision (wide edges, ringing or a lossy
container, read from the pixels) reaches the sub-pixel refinement as RefineCtx::soft, through
finish_color_trace_alpha and planar::measure_subpixel. A clean intake keeps SIDE_TOL by
construction.

Fast passes false. It measures no noise and refines against NOISE_FLOOR, so a scaled test
there moves the threshold by a constant. On fast-web it changed 12 icons, with dE00 and geom a
hair worse at the point estimate.

Measured against the session head d8a5646, base and new binaries on every gate input:
- quality-128ss, quality-512ss, quality-512ssop, fast-128ss, fast-512ss, fast-512ssop and
  fast-web: byte-identical, 246 of 246 icons each;
- clean run times match (Quality +0.1 to +1.0 %, Fast -6.2 to -0.0 %, interleaved);
- quality-web: 111 icons change, and every gated axis improves at its point estimate.
  The bound is the one-sided 95 % upper bound:
  - dE00 -0.14 % (bound +0.04 %);
  - turning_gap -0.02 % (+0.77 %);
  - ratio_gap -0.03 % (+0.35 %);
  - geom -0.03 % (+0.15 %);
  - the gate passes against both the base build and the committed baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
The chain page reports completion's effect on the battery (bench/human_stats.py).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ants go back to their inks

Quality's MDL palette founded the codec's tints of an ink as inks of their own: on
openmoji/E056 (web tier) it kept #000109, #080100 and #030801 beside #000000, a JPEG's
half-resolution chroma having tinted the black strokes over their whole width, and the trace
came back with 674 faces, 41 colours and 250 subpaths where the artist drew four colours. The
halos Fast's pass removes cut the strokes into fragments too.

On an opaque lossy intake the despeckled labels now go through fast/codec.rs before blend
absorption:
1. codec variants: an ink within 8 levels of a heavier ink in luma-weighted YCbCr (chroma at
   a quarter of luma's weight on squares) and within the soft floor is that ink;
2. Fast's halo pass, strict: every thin component held to the strip rule and the segment
   test (Fast passes false and is unchanged), since Quality admits a thin ink on evidence
   and a real strip, like noto's compass needle shadow, can lie on the segment;
3. Fast's soft merge of thin variants.

quality-web against the build before (246 icons, the gate's distance axes): dE00 -6.83 %,
turning_gap -36.57 %, ratio_gap -11.89 %, geom -3.73 %, all four better; 87 icons changed.
Per icon, openmoji's colours and subpaths 10.6 and 38.0 -> 5.7 and 12.8 (artists 3.9 and
11.7), noto-emoji's 15.6 and 32.3 -> 14.8 and 29.2 (9.0 and 25.0). The halo passes without
the variant merge read dE00 -4.69 %, turning_gap -25.8 %; Fast's looser halo test, dE00
-7.09 % and turning_gap -43.2 % but real strips lost. The shipped code matches the measured
prototype byte for byte on all 246 web icons, and fast-web is byte-identical. A clean intake
takes none of it. Tests: fast/codec/tests.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…tored)

The restorer pre-pass forces a lossy intake on its output, the configuration it was validated
in, so Quality's new codec clean-up ran on restored images too. There the codec's damage is
already gone, and on the restored path (quality-web, --restore on, the gate's 0.3 sample,
against the build before) it read dE00 +0.24 % (turning_gap -0.48 %, ratio_gap -0.14 %,
geom -0.30 %): openmoji/E30B's brown border strip, a real ink between the black outline and
the white sheet, went to the outline (+0.023 dE00).

ColorOptions gains `restored` (default false), set from a new internal Args field the CLI's
restorer pre-pass sets on the raster it hands on; the clean-up runs on `lossy_intake &&
!restored`. The palette still sees a lossy intake. Output without --restore is unchanged:
all 246 web icons byte-identical to the measured clean-up, and a restored openmoji/E30B is
now byte-identical to the build before the clean-up. The clean-up's diagnostic moved into
fast/codec.rs to keep lib.rs under its length budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
… nothing on clean input

From the front-end executor (worktree-agent-ae56fb28ed3e7e0ce, through 0982429):

- 6663eb0, 10207a0 cli: `--restore auto` and `--sr auto` ask for a sign of damage first
  (a lossy container, JPEG ringing; Fast reads the container flag only) and make no
  probe without one, so a clean input takes the plain path by construction. Overhead on
  clean input, auto minus off per icon: Fast none measurable (was +17 ms CPU, +56 %),
  Quality one ringing score, about 2.7 ms of a ~930 ms trace. Auto against off is
  byte-identical on all six clean conditions (6 x 246) with no restorer call; on JPEG
  input auto decides as before.
- 0982429 gradient: on a lossy intake the carve stage leaves the codec's 2 px band at a
  region's edge alone. quality-web: turning_gap -5.38 %, ratio_gap -0.80 % (better), dE00
  -0.01 %, geom -0.10 % (non-inferior); restored path every point estimate better; the
  other seven conditions identical (full 8-condition gate on 0982429).
- c39ac16 docs: why the soft same-ink exemption fails (the fitter chases 4:2:0 chroma
  bleed on low-contrast hue edges with a single image-wide sigma) and when to retry it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…se on soft Quality intakes

From the boundary chain agent (worktree-agent-a2797ed10afe7623e-side, 0f2f21a): the
noise-scaled side test withheld from milestone 2 now runs only on a soft Quality intake. The
soft decision reaches the refinement as RefineCtx::soft; Fast passes false (with the lossy
flag fast-web moved a hair worse at the point estimate, and Fast measures no noise).
Against the base, all 246 icons per condition: the six clean conditions and fast-web
byte-identical; quality-web 111 icons changed, every gated point estimate better (dE00
-0.14 %, turning_gap -0.02 %, ratio_gap -0.03 %, geom -0.03 %), gate passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…overs them

From the representation chain agent (worktree-agent-a514b1b680f4e6683, ca2892a). In Quality
mode a face partly hidden by a face or stroke painted after it is completed under the cover:
the cheapest certified shape E with L ⊆ E ⊆ V ∪ U, among a circle, ellipse or rect, or the
face's own rings with each covered run replaced by a corner, chord, offset, bulge, corner
cut or smooth G1 bridge. The painter's interval is proved in Lean (Design/Layers.lean) and
every completion is accepted only by generated interval kernels (span_within, span_link in
inkvec_verified::generated::design); a completion that would fill the image's frame is
refused. Design/Noise.lean proves that within the Laplace regime a constraint accepted at
one noise level stays accepted at more (accept_monotone; Huber is Gaussian on inliers).

Gate, all 8 conditions against the baseline (the agent's run on the merged tree at c53b7db):
quality-128ss dE00 -0.18 %, turning_gap -8.61 %, ratio_gap -0.12 %, geom -0.07 %;
quality-512ss -0.94 %, -10.77 %, -3.64 %, -0.02 %; quality-512ssop -1.51 %, -4.34 %,
-8.66 %, -0.01 %; quality-web -0.31 %, -3.84 %, -5.08 %, -0.00 %; Fast unchanged. The England
flag canary goes 54 -> 20 parameters at 512 px (the artist's 20). bench/theory/amodal_eval.py
scores completions against the artists' hidden geometry (121 emoji: closer in 60 %, further
in 19 %). `INKVEC_COMPLETION=0` switches the stage off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ver the merged layers code

The representation chain's merge left crates/inkvec-cli/src/emit.rs at 1601 lines (1607
after rustfmt), over the quality ratchet's longest-file cap of 1513, and its layers code
unformatted. complete_layers and element_count move unchanged into emit/completion.rs, a
child module reading emit.rs's private types (emit.rs 1478 lines), and cargo fmt is applied
to the merged files. No behaviour change. The ratchet passes and tightens test_functions
1166 -> 1183.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ers them

Type designers and icon artists put a curve's points at its x and y extrema,
with the handles there on an axis (Adobe, Type 1 Font Format, 1990, 4.1 and
4.2). The dynamic program can only put a node on a measured point with the
estimated direction, so it never offered one there. `inkvec_fit::extrema`
re-segments each smooth run after the merge: the cheapest chain through the
extrema (axis direction) and the old nodes (made G1), refined by a compass
search, arms polished on every point. It replaces the run only when
1/2 chi^2 + lambda * params is lower, crediting one parameter per anchored
node (the direction it does not write), and only when it writes exactly as
many numbers. Stroke centrelines are fitted inside `extrema::without`, so
the stroke decision is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ent fixed

- Circular arcs (a stroke's centreline too) are written as cubics cut at their
  x and y extrema, handles on the axes and 4/3 tan(d/4) r long (Riskus 2006);
  no cut within 1 px of an arc's end.
- Smooth runs are re-noded at their extrema with `inkvec_fit::extrema` at a
  stronger preference (3 parameters per node, count free).
- G1 within a ring for every join turning at most 30 degrees, next to a line
  along the line; across junctions at face-ring level (`editable/junctions.rs`).
- A smooth node's two handles snap together or not at all; two lines meeting
  within 0.5 degrees become one, judged against the two it replaces.
- A boundary with no junction (an open edge ending where it starts) has its
  closing join edited like any other.

Fixed: the G1 pass turned the incoming cubic's far control point instead of
the one at the join (since it was written), and node alignment left handles
behind, turning short ones into kinks.

Battery, --editability against the default trace, quality-512ssop: composite
0.9185 (0.9925 before); kinked -44.2 %, handle_axis -37.1 %, extremum -25.6 %,
smooth -22.3 %, collinear -4.0 % (+15.3 % before). Default output unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
Brings in the pushed base (this branch's work through 0982429, the representation chain's
completion stage, the boundary chain's side test and the faster gate) under 387212c and
0c28e5c, for quality-web to be re-gated on the merged tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
… polygon

The underlap's test that a moved edge does not cut into the lower face read
the nesting's polygon of that face, four points per curve. On a long curve
that turns far its chords stray by more than the half-pixel reach (0.55 px at
the middle of a cubic turning 74 degrees over 78 px), so where the curve bulged
into the lower face an edge moved the full reach outward still read as
cutting, and the whole run went unmoved: a visible seam. The lower ring is now
flattened to within 0.01 px of its curves for that test, and a point on its
outline is not inside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
The merged lib.rs read 1515 lines against the 1513 the quality ratchet allows. The codec
clean-up's opacity test moves into fast::codec::clean_labels, which now takes the image
(for its size) and the source alpha and does nothing when a pixel is below OPAQUE; the call
in lib.rs is three lines. Same decisions as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…nd carve-band merges

The combined 8-condition gate of the merged tree (b8ebd30, all 246 icons per condition,
against the previous baseline) passes with every gated point estimate better or level, so
the four Quality conditions are recorded and the gains cannot be given back:
- quality-128ss: dE00 -0.18 %, turning_gap -8.61 % (better), ratio_gap -0.12 %, geom -0.07 %;
- quality-512ss: dE00 -0.94 % (better), turning_gap -10.77 % (better), ratio_gap -3.64 %,
  geom -0.02 %;
- quality-512ssop: dE00 -1.51 %, turning_gap -4.34 %, ratio_gap -8.66 % (all better), geom
  -0.01 %;
- quality-web: dE00 -0.49 %, turning_gap -9.44 %, ratio_gap -6.03 % (all better), geom
  -0.14 %.
The four Fast conditions are byte-identical to their recorded rows and keep them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
`Args::restore` becomes an `Option`. Unset, `Args::restore_mode` resolves it to the mode's
default: `auto` in Quality mode when this build can restore (the network compiled in, or a
`--restore-command`), `off` in Fast and balanced, and `off` in a build with nothing to
restore with, so such a build traces exactly as `--restore off` does, stats included. A
given `--restore` value always wins, in every mode.

On a clean input `auto` asks for a sign of compression before it makes a probe, so the
default costs a clean PNG the ringing score alone (about 2.7 ms at 512 px). The gate's
builds carry no network, so its numbers do not move. The Studio passes its own setting
explicitly and keeps its behaviour. The restore option is not in the bindings' options
schema, so there is no contract to bless.

Help text, README, LIMITATIONS, PIPELINE_EXPLANATION, the intake chapter, the restore-model
release notes and the CHANGELOG say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…on the new base

The 8-condition gate passed on this branch (against the committed baseline,
and against the session base b8ebd30's own gate run), so the facade contract
is re-blessed for the changed traces (seven tiny cases).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…compound path

On an opaque page a counter was a page-coloured element painted over its glyph, and every
rectangle an element of its own (material-icons/border_left: 17 <rect> against the
artist's one path). emit/holes.rs:

- cut_ground_holes (stage 2b): a face in exactly the page's colour (the opaque face
  covering the frame) that fills a hole of a glyph on the page is dropped and written into
  the glyph as a hole. Only a glyph whose children are all page-coloured, and nothing
  written as a circle, ellipse or rounded rect (a hole would cost more numbers). The
  picture is unchanged by construction: Design/Layers.lean, cut_hole and cut_hole_pixel.
- plain_rect: a square-cornered rect, uncompleted or completed, joins its same-coloured
  siblings' compound path (three lines are a <rect>'s six numbers).

Gate, all 8 conditions against b8ebd30, --no-tighten: every verdict identical or
non-inferior. quality-512ssop dE00 -0.15 %, turning_gap -0.06 %, ratio_gap -0.15 %,
geom -0.0001 %; quality-web -0.0008 %, -0.05 %, -0.10 %, 0; quality-128ss and 512ss
ratio_gap -0.05 % and -0.06 %; fast-128ss and fast-512ss byte-identical; fast-512ssop and
fast-web dE00 -0.009 % and -0.004 %. Two point estimates rise, one icon each:
quality-512ss turning_gap +3e-7 (qr_code, a completion corner moved 0.01 px) and
fast-512ssop geom +7.8e-7 (admin_panel_settings, the renderer's edge coverage of a hole).
bench/human_stats.py, 246 icons: composite -3.1 % (512ssop) and -1.9 % (web); on 512ssop
primitives -24.7 %, elements -14.5 %, nested -12.7 %, stacked -10.3 %.

Tried and withdrawn (docs/theory/chain-representation.md, milestone 2): dropping
page-coloured faces that sit on the page, cutting rings of two circles into strokes,
joining same-paint islands to their ring, cutting over a painted ground; and the noise
fold with the Huber fit, which turned curves into polylines on the emoji families
(openmoji dE00 +11 %, geom +20 % on a web sample) and is not in the tree.
INKVEC_CUT_HOLES=0 paints counters over, as before. The quality ratchet tightens
test_functions 1183 -> 1189.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ty's default

From the front-end executor (worktree-agent-ae56fb28ed3e7e0ce, through 7d55440):

- 387212c, 0c28e5c quality: on a lossy intake the codec's colour variants, halos and thin
  variants go back to their inks (Fast's halo pass on Quality's labels, run strict, plus a
  luma-weighted YCbCr rule for JPEG-tinted inks); a restored image skips it. quality-web
  on the merged tree against b8ebd30: dE00 -6.63 %, turning_gap -36.98 %, ratio_gap
  -12.42 %, geom -3.70 %, all better (87 icons changed); restored path byte-identical
  (74/74); fast-web byte-identical. openmoji colours / subpaths 10.6 / 38.0 -> 5.7 / 12.8
  (artist 3.9 / 11.7).
- 7d55440 cli: `--restore auto` is the default in Quality mode when the build can restore
  (the network compiled in, or --restore-command); Fast, balanced and builds without the
  model default to off, so they trace exactly as before. An explicit --restore wins.
  Model build, 6 clean conditions: implicit default identical to --restore off (6 x 246);
  quality-web: dE00 -26.5 %, turning_gap -14.2 %, geom -23.8 % (better), ratio_gap -6.2 %
  (non-inferior), CPU about 1.9 -> 6.05 s per icon there because the restorer runs.
- 78fae36 trace lib.rs back to its 1513-line budget after the merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…ph, one path per fill

From the representation chain agent (worktree-agent-a514b1b680f4e6683, 0a7d00d). On an opaque
intake a face in exactly the page's colour that fills a hole of a glyph on the page is
written into the glyph as a hole instead of painted over it (only where every child of the
glyph is page-coloured and no primitive would cost fewer numbers; `cut_hole` in
Design/Layers.lean shows the picture is unchanged; INKVEC_CUT_HOLES=0 restores the old
writing), and square-cornered rectangles join their same-fill siblings' compound path
(material-icons/border_left 17 elements -> 1). Gate, all 8 conditions against the b8ebd30
build: every verdict identical or non-inferior, ratio_gap -0.05 to -0.15 % on the Quality
conditions; two point estimates worse by under 10^-6, one icon each (quality-512ss
turning_gap, material-icons/qr_code; fast-512ssop geom, material-icons/admin_panel_settings),
negligible under the project owner's rule. Human statistics on quality-512ssop: composite
-3.1 %, primitives -24.7 % (milestone 1's rise undone), elements -14.5 %, nested -12.7 %,
stacked -10.3 %, colours -16.9 %.

The noise fold with a Huber fit was built and withdrawn: on quality-web it made the emoji
families worse (openmoji dE00 +11.4 %), because a larger sigma makes every description
cheaper and curves become polylines; it waits for the style prior. Recorded in
docs/theory/chain-representation.md, "Phase 2, milestone 2".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…awing tools write, seams

From the node-placement executor (worktree-agent-ac316552117f9d52d, through 46aacb1):

- 189f61e fit: after the merge pass each smooth run is offered nodes at its x/y extrema with
  axis directions, taken only where ½χ² + λ·params is lower and the written count stays the
  same (an anchored node is credited the direction it no longer writes).
- e2ee543 --editability: arcs written as cubics cut at their extrema with axis handles, runs
  re-noded at extrema, G1 on joins up to 30° and across junctions, collinear lines merged;
  pass_g1 rotated the wrong control point, node alignment left handles behind, junction-free
  loops never had their closing join edited, and the collinear merge was judged wrongly:
  all fixed. Human battery, --editability against default: composite 0.9185 (was 0.9925),
  kinked -44 %, handle_axis -37 %, extremum -26 %, smooth -22 %.
- 67e7e46 seams: a cut is judged against the lower face's own outline flattened to 0.01 px,
  not its 4-point-per-curve nesting polygon, so runs along a high-turn cubic are moved
  under their neighbour and their seam no longer shows.

Gate against b8ebd30 (all 8 conditions): passed; dE00 better in quality-512ss (-1.13 %),
quality-512ssop (-1.36 %), quality-web (-0.33 %), fast-512ss (-0.46 %), fast-512ssop
(-0.49 %), geom equal or better everywhere; a few point estimates worse by at most +0.15 %
(turning_gap, ratio_gap; from the seam fix's taper vertices and the extremum pass on the
completion stage's outlines), accepted by the project owner as negligible where fidelity
improves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
… -> 1214)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
…cement merges; contract re-blessed

The combined 8-condition gate of the merged tree (6d8f0c8, 246 icons per condition, against
the previous baseline) passes:
- quality-web: dE00 -6.92 %, turning_gap -37.11 %, ratio_gap -12.47 %, geom -3.76 %, all
  better (the codec clean-up);
- quality-512ss and quality-512ssop: dE00 -1.13 % and -1.51 %, better (the seam fix);
  quality-128ss non-inferior on every axis;
- fast-512ss and fast-512ssop: dE00 -0.46 % and -0.50 %, better; fast-128ss and fast-web
  non-inferior.
Worse point estimates, all accepted by the project owner as negligible where fidelity
improves: quality-512ssop turning_gap +0.09 %; fast-512ss turning_gap +0.02 % and
ratio_gap +0.01 %; fast-512ssop ratio_gap +0.01 %; fast-web turning_gap +0.02 %;
fast-128ss turning_gap +0.004 %. All eight conditions are recorded.

bindings/contract/cases.json: the seven tiny_* cases' x86_64-linux-gnu hashes re-blessed
(outputs 2-4 % smaller: counters cut, rects joined into their fill's path, seams moved).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AZWMqqHhRQ337N5EWhNC6
@Stefatorus
Stefatorus merged commit fb1914a into main Oct 11, 2026
41 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants