Skip to Content
IntelligenceMath at a glance

Math at a Glance

This is the single-page cheat sheet for the intelligence layer. Every technique that appears in FrankenTUI’s runtime decisions is listed here with its consuming subsystem, canonical formula, and the performance property it buys. Use this table as a navigation hub — each row links to the full explanation.

For the motivation behind the whole layer, see intelligence/overview.

Bayesian inference

TechniqueWhere usedCore formulaPerformance impact
Bayes factorsCommand-palette scoringP(RE)P(¬RE)=P(R)P(¬R)iBFi\dfrac{P(R\mid E)}{P(\neg R\mid E)} = \dfrac{P(R)}{P(\neg R)} \prod_i \mathrm{BF}_iBetter ranking with fewer re-sorts
Evidence ledgerExplanations for probabilistic decisionslogP(RE)P(¬RE)=logP(R)P(¬R)+ilogBFi\log \dfrac{P(R\mid E)}{P(\neg R\mid E)} = \log \dfrac{P(R)}{P(\neg R)} + \sum_i \log \mathrm{BF}_iDebuggable, auditable scoring
Log-BF capability probeTerminal-capability detectionlogBF=logP(DH)P(D¬H)\log \mathrm{BF} = \log \dfrac{P(D \mid H)}{P(D \mid \neg H)}Robust detection from noisy probes
Log10-BF coalescerResize-scheduler evidence ledgerLBF=log10P(Eapply)P(Ecoalesce)\mathrm{LBF} = \log_{10} \dfrac{P(E \mid \text{apply})}{P(E \mid \text{coalesce})}Explainable, stable resize decisions
Bayesian hint rankingKeybinding-hint orderingVi=E[Ui]+wvoiVar(Ui)λCiV_i = E[U_i] + w_{\mathrm{voi}} \sqrt{\operatorname{Var}(U_i)} - \lambda C_iStable, utility-aware hints
Beta-BinomialDiff-strategy selectionpBeta(α,β)p \sim \operatorname{Beta}(\alpha, \beta) with binomial updatesAvoids slow strategies as workload shifts
Bayesian height predictorVirtualized-list preallocationμn=κ0μ0+nxˉκ0+n\mu_n = \dfrac{\kappa_0 \mu_0 + n \bar{x}}{\kappa_0 + n} + conformal q1αq_{1-\alpha}Fewer scroll jumps

Change detection and sequential testing

TechniqueWhere usedCore formulaPerformance impact
BOCPDResize coalescingRun-length posterior + hazard H(r)H(r)Fewer redundant renders during drags
Run-length posteriorBOCPD coreP(rt=rx1:t)P(r_t = r \mid x_{1:t}) recursionFast regime switches without thresholds
E-processBudget alerts, throttleWt=Wt1(1+λt(Xtμ0))W_t = W_{t-1}(1 + \lambda_t (X_t - \mu_0))Safe early exits under continuous monitoring
GRAPAAdaptive e-processλt+1=λt+ηλlogWt\lambda_{t+1} = \lambda_t + \eta \nabla_\lambda \log W_tSelf-tuning sensitivity
CUSUMBudget change detectionSt=max(0,St1+Xtμ0k)S_t = \max(0, S_{t-1} + X_t - \mu_0 - k)Fast drift detection
CUSUM hover stabilizerMouse hover jitterSt=max(0,St1+dtk)S_t = \max(0, S_{t-1} + d_t - k)Stable hover targets without lag
Alpha-investingSequential FDRE[V]/E[R]W0E[V]/E[R] \le W_0 (wealth process)Bounded false-alert rate across monitors

Conformal prediction

TechniqueWhere usedCore formulaPerformance impact
Vanilla conformalRisk boundsq=Quantile(1α)(n+1)(R)q = \operatorname{Quantile}_{\lceil (1-\alpha)(n+1) \rceil}(R)Stable thresholds without tuning
Mondrian conformalFrame-time risk gatingy^+=y^+q1α(r)\hat{y}^+ = \hat{y} + q_{1-\alpha}(\lvert r \rvert) per bucketSafe budget gating with sparse data
Conformal rank confidenceCommand-palette stabilitypi=1nj1[gjgi]p_i = \dfrac{1}{n} \sum_j \mathbf{1}[g_j \le g_i] (gap-based p-value)Deterministic tie-breaks, stable top-k

Value of information and sampling

TechniqueWhere usedCore formulaPerformance impact
VOI samplingExpensive measurementsVOI=Var(p)E[Var(psample)]\mathrm{VOI} = \operatorname{Var}(p) - E[\operatorname{Var}(p \mid \text{sample})]Lower overhead in steady state

Control theory and scheduling

TechniqueWhere usedCore formulaPerformance impact
PID / PIDegradation controlut=Kpet+Kies+KdΔetu_t = K_p e_t + K_i \sum e_s + K_d \Delta e_tSmooth frame-time stabilisation
MPC (evaluation)Controller checkminut:t+Hyt+ky2+ρut+k2\min_{u_{t:t+H}} \sum \lVert y_{t+k} - y^\star \rVert^2 + \rho \lVert u_{t+k} \rVert^2Confirms PI is sufficient
SOS barrierAdmissible-region proofB(x)=i+j6cijx1ix2j>0B(x) = \sum_{i+j\le 6} c_{ij} x_1^i x_2^j > 0Constant-time safe/unsafe classification
Jain’s fairnessInput guardF=(xi)2nxi2F = \dfrac{(\sum x_i)^2}{n \sum x_i^2}Prevents rendering from starving input
Smith’s rule + agingQueueing schedulerpriority=wr+await\text{priority} = \dfrac{w}{r} + a \cdot \text{wait}Fair throughput under load

Data structures with statistical guarantees

TechniqueWhere usedCore formulaPerformance impact
Count-Min SketchWidth cache, timeline aggregationf^(x)=minjCj,hj(x)\hat{f}(x) = \min_j C_{j, h_j(x)}Fast approximate counts
W-TinyLFU admissionWidth-cache admissionadmit iff f^(x)f^(y)\hat{f}(x) \ge \hat{f}(y) (doorkeeper → CMS)Higher hit rate, fewer recomputes
PAC-BayesSketch calibrationeˉ+KL(qp)/(2n)\bar{e} + \sqrt{\operatorname{KL}(q \| p)/(2n)}Tighter error bounds
Fenwick treeVirtualized listsPrefix sums with i±(ii)i \pm (i \wedge -i)O(logn)O(\log n) scroll + height queries
Summed-area tableTile-skip diffSAT(x,y)=A(x,y)+SAT(x1,y)+SAT(x,y1)SAT(x1,y1)\mathrm{SAT}(x, y) = A(x, y) + \mathrm{SAT}(x-1, y) + \mathrm{SAT}(x, y-1) - \mathrm{SAT}(x-1, y-1)Skip empty tiles on large screens
S3-FIFO cacheHot-key cacheSmall (10%) + Main (90%) + Ghost FIFOsScan-resistant, better than LRU/ARC at lower overhead

Visual effects (deterministic math)

EffectCore equationWhat it produces
MetaballsF(x,y)=iri2(xxi)2+(yyi)2F(x, y) = \sum_i \dfrac{r_i^2}{(x - x_i)^2 + (y - y_i)^2}, iso-surface FτF \ge \tauSmooth, organic blob fields
Plasmav=16k=16sin(ϕk(x,y,t))v = \dfrac{1}{6} \sum_{k=1}^6 \sin(\phi_k(x, y, t))Psychedelic interference bands
Gray-Scotttu=Du2uuv2+F(1u);  tv=Dv2v+uv2(F+k)v\partial_t u = D_u \nabla^2 u - u v^2 + F(1 - u);\; \partial_t v = D_v \nabla^2 v + u v^2 - (F + k) vReaction-diffusion morphogenesis
Clifford attractorxt+1=sin(ayt)+ccos(axt);  yt+1=sin(bxt)+dcos(byt)x_{t+1} = \sin(a y_t) + c \cos(a x_t);\; y_{t+1} = \sin(b x_t) + d \cos(b y_t)Strange-attractor filaments
Mandelbrot / Juliazn+1=zn2+cz_{n+1} = z_n^2 + c (escape-time colouring)Fractal boundaries + deep zooms
Lissajous / harmonographx=Asin(at+δ);  y=Bsin(bt+ϕ)x = A \sin(a t + \delta);\; y = B \sin(b t + \phi)Phase-locked curves
Flow fieldv(x,y)=(cos2πN,  sin2πN);  pt+1=pt+vΔt\vec{v}(x, y) = (\cos 2\pi N,\; \sin 2\pi N);\; p_{t+1} = p_t + \vec{v} \Delta tParticle ribbons
Wave interferenceI(x,t)=isin(kixsiωit)I(x, t) = \sum_i \sin(k_i \lVert x - s_i \rVert - \omega_i t)Multi-source ripples
Spiral galaxyr=aebθ;  θ(t)=θ0+ωtr = a e^{b \theta};\; \theta(t) = \theta_0 + \omega tLogarithmic-spiral starfields
Spin lattice (LLG)dSdt=S×HαS×(S×H)\dfrac{d \vec{S}}{dt} = -\vec{S} \times \vec{H} - \alpha \vec{S} \times (\vec{S} \times \vec{H})Magnetic-domain dynamics

Animation and UI dynamics

TechniqueWhere usedCore formulaPerformance impact
Damped springAnimation transitionsx+cx+k(xx)=0x'' + c x' + k (x - x^\star) = 0Natural motion without frame-rate artefacts
Easing curvesFade/slide timingt2t^2, 1(1t)21 - (1 - t)^2, cubic variantsPredictable velocity shaping
Staggered cascadeList animationsoffseti=Dease(i/(n1))\text{offset}_i = D \cdot \text{ease}(i / (n - 1))Coordinated, non-uniform entrances
Sine pulseAttention pulsesp(t)=sin(πt)p(t) = \sin(\pi t)Smooth 0→1→0 emphasis
Perceived luminanceDark/light probeY=0.299R+0.587G+0.114BY = 0.299 R + 0.587 G + 0.114 BReliable theme defaults

Cross-cutting summaries

TechniqueWhere usedCore formulaPerformance impact
Rough-path signaturesWorkload fingerprinting, regression detectionS(X)i1ikk=dXi1dXikS(X)^k_{i_1 \ldots i_k} = \int dX^{i_1} \cdots dX^{i_k}Reparameterisation-invariant trace comparison
Incremental view maintenanceDerived-state updatesSigned deltas + bilinear join rule + 50% fallbackDerived views updated in O(Δ)O(\Delta)

Using this table

  • Each row linking to an explanation page is a live link; hover to see the preview, click to read the full motivation, math, worked example, Rust interface, and debugging notes.
  • Rows without links describe techniques whose primary explanation lives elsewhere (data-structure pages under /reference, effect pages under /extras, animation under /style). They are included here for completeness so the full mathematical surface of FrankenTUI is visible in one place.
  • The “performance impact” column is deliberately qualitative. Hard numbers are in the individual pages’ worked examples and in the benchmark reports referenced by /testing/benchmark-gate.

If a decision in FrankenTUI surprises you, grep this table for the subsystem. The corresponding intelligence page will have the evidence-sink event name and a jq one-liner. That’s usually a one-minute path from “huh?” to “oh, I see exactly why.”

Cross-references