construct_language_cl_norm_4_spec.tex
1 \documentclass[11pt]{article} 2 3 \usepackage[margin=1in]{geometry} 4 \usepackage{microtype} 5 \usepackage{booktabs} 6 \usepackage{longtable} 7 \usepackage[hidelinks]{hyperref} 8 \usepackage{amsmath} 9 10 \title{CL-NORM-4 --- Glyph-Bound Containment (Mask-Based Scope Inference)} 11 \author{} 12 \date{January 13, 2026} 13 14 \begin{document} 15 \maketitle 16 17 \section{Purpose} 18 19 CL-NORM-2 infers scope using a heuristic radius per type (frame/object/operator/etc.). 20 CL-NORM-4 replaces that coarse heuristic with a \textbf{glyph-bound mask library} so containment decisions are based on 21 actual per-glyph bounds (derived from the inventory), while still avoiding any natural-language structure. 22 23 \section{Mask Library (GML v0.1)} 24 25 A \textbf{Glyph Mask Library} (GML) provides per-glyph bounds information without embedding images. 26 It can be derived from the SVG inventory and shipped as JSON. 27 28 \subsection{Required per-glyph field} 29 30 For each glyph \(G\), GML provides a scale-1 radius \(r_0(G)\), defined as: 31 32 \[ 33 r_0(G) = \max_{c \in \text{bboxCorners}(G)} \|c - (32,32)\| + \text{pad} 34 \] 35 36 This is a rotation-invariant bound: it can be used as a safe containment proxy. 37 38 \subsection{Frame containment radius} 39 40 For frame glyphs, GML also provides a containment radius \(\rho_0(G)\) (circle policy), which represents the intended 41 semantic interior region for scope inference: 42 43 \[ 44 \rho_0(G) = \max(44,\ r_0(G) + 24) 45 \] 46 47 The extra slack aligns with CL-NORM-3 ring placement (ring step 24). 48 49 \section{Containment Test} 50 51 Given a candidate frame instance \(F\) and a candidate child instance \(X\), with scales \(s(F)\) and \(s(X)\): 52 53 \[ 54 \text{contains}(F, X) \iff \operatorname{dist}(F, X) \le \rho_0(G_F)\,s(F) - r_0(G_X)\,s(X) - m 55 \] 56 57 where: 58 \begin{itemize} 59 \item \(G_F\) is the glyph code of \(F\) 60 \item \(G_X\) is the glyph code of \(X\) 61 \item \(m\) is a small margin (e.g. \(m=2\)) 62 \end{itemize} 63 64 If \(F\) is not a frame glyph, \(\rho_0\) is not used. 65 66 \section{Scope Choice} 67 68 For each instance \(X\), compute the set of containing frames \(C(X)\). If empty, \(X\) is in root scope. 69 Otherwise choose the \textbf{deepest} scope (smallest \(\rho_0(G_F)s(F)\)): 70 71 \[ 72 \operatorname{scope}(X) = \arg\min_{F \in C(X)} \rho_0(G_F)\,s(F) 73 \] 74 75 \section{Integration with CL-NORM-3} 76 77 CL-NORM-3 may move instances into canonical polar slots. After layout normalization, scope inference must be rerun. 78 79 CL-NORM-4 is applied: 80 \begin{enumerate} 81 \item after CL-NORM-3 layout normalization, 82 \item and during any strict validation of scope consistency. 83 \end{enumerate} 84 85 \section{Notes} 86 87 GML v0.1 uses rotation-invariant radii for simplicity. A future GML v0.2 may provide convex hulls or signed-distance 88 fields for tighter bounds if needed. 89 90 \end{document}