# Mathematical analysis Status: analytical derivations below are proved under their stated assumptions. They are not claims of new mathematics. No real-data performance claim has been verified. Numerical checks are reported separately in `results/`. ## A. What a conflict edge actually means Let C(X) be a finite candidate set, w_i a real score, and H=(C,E) a conflict graph. Maximum-weight independent selection is \[ \max_{z\in\{0,1\}^{|C|}}\sum_i w_i z_i,\qquad z_i+z_j\le1\quad(ij\in E). \] An edge is valid only if its endpoints cannot both be accepted under the task's definition of distinct true detections. Two alternative explanations of the *same* measurement can justify exclusivity when an explicit generative/association assumption establishes this. Spatial nearness, similar intensities, shared background, or a learned similarity alone cannot. **Necessary feasibility condition.** If T contains one correct candidate for each true object, all those detections can be retained only if H[T] is edgeless. This is also sufficient for T to be feasible, but not for an optimizer to select T. Proof: a single internal edge violates an inequality; without such edges all inequalities for the indicator of T hold. **Counterexample 1 (adjacency).** Two real targets at (10,10) and (10,12), scores 0.9 and 0.8, and a proximity-conflict radius of 3 force the output to contain at most one. Recall is at most 1/2, even with perfect candidate scores. **Counterexample 2 (valid graph does not guarantee recall).** A true candidate of weight 1 conflicts with a spurious alternative of weight 2. Even if the conflict is valid as a one-measurement association constraint, the optimal set selects the wrong hypothesis. Constraints ensure consistency, not correctness. A sufficient optimality condition is: T is independent, true weights are strictly positive, and all false weights strictly negative. Then T is the unique optimum. This assumption is essentially already-perfect classification and offers no realistic detection guarantee. Positive isolated false candidates are always selected; independent-set selection alone cannot reject them. ### Quadratic penalty and relaxation Consider F(z)=Σw_i z_i−λΣ_(ij∈E)z_i z_j. For λ>max(0,max_i w_i), every binary maximizer is independent. If a selected node has a selected neighbor, deleting it changes F by −w_i+λd_selected(i)>0. Thus a violating solution cannot maximize F. On independent sets the objectives coincide. This is an exact penalty result for binary optimization, not an efficient algorithm: general MWIS remains NP-hard. A triangle with edge constraints relaxed to z∈[0,1]^3 admits z=(1/2,1/2,1/2), objective 1.5 for unit weights, versus integral optimum 1. Clique inequalities improve this relaxation but do not generally describe the stable-set polytope. Rounding can break both feasibility and recall. Gumbel sampling, unrolled optimization, or implicit differentiation changes optimization mechanics, not the validity of edges. A straight-through gradient is biased and gives no discrete optimality guarantee. ### Defensible replacement Use a bipartite candidate-to-object/hypothesis assignment, or multi-source reconstruction y=Σ_j a_j h(·−μ_j)+b+ε, with a_j≥0 and a point-spread-function model. Distinct nearby μ_j are allowed. For training, ground truth supplies distinct identities; at inference that privilege disappears. Restrict hard conflict edges to verified duplicate measurement hypotheses and keep uncertain edges as soft learned features. Test on close pairs at separations 0.5,1,2,3,5 pixels, multiple amplitudes and PSF widths, with source-level labels. Below resolution, identifiability requires additional assumptions; coincident equal-PSF sources cannot be uniquely separated from their summed amplitude in one image. ## B. Define risk before choosing a loss For a prediction set S and true objects G, construct a bipartite eligibility graph using a fixed matching rule. Let ν(S,G) be maximum matching cardinality. Define \[ TP=\nu(S,G),\quad FP=|S|-\nu(S,G),\quad FN=|G|-\nu(S,G). \] Primary desired risk is R_count=E[FP per image], not pixel error, precision, false discovery rate, nor probability of any false alarm. Also report R_any=P(FP≥1). With a deterministic proposal cap K, R_any≤R_count≤K R_any. These quantities must never share an unlabeled “Fa” column. The ideal objective minimizes expected size-weighted missed objects subject to R_count≤α. This is nonconvex and nondifferentiable. Optimizing a surrogate constraint empirically does not prove the population constraint. Weighted BCE, Focal, Dice and IoU do not automatically solve the constrained problem. NWD compares Gaussian box surrogates and does not count spurious objects; changing from boxes to masks changes the task. ### Frozen object pool makes monotonicity well-defined Freeze the proposal generator, its base segmentation threshold, cap K, masks, centroids and eligibility rule. Learn a candidate gate score s_i. At threshold t retain the entire candidate if s_i≥t; never resegment its pixels as t changes. **Proposition B1 (matching deficiency monotonicity).** If S⊆T are subsets of the same frozen pool with unchanged eligibility, FP(S)≤FP(T). Adding one candidate increases maximum matching size by either 0 or 1, so |S|−ν changes by either 1 or 0. Induct over additions. TP also cannot decrease under addition. **Why a pixel threshold fails this assumption.** On an all-background image, three horizontally adjacent pixels with probabilities (0.9,0.6,0.9) form one false object at threshold 0.5 and two at threshold 0.8. Raising the threshold increases object FP. Thresholding pixels does not produce nested object sets. Generic monotone CRC cannot be applied without addressing this; finite-family LTT-style testing can handle nonmonotone risks with multiplicity correction. ### Differentiable upper bound tied to matching On each training image, choose a deterministic maximum matching in the full frozen pool. Designate the matched candidate endpoints as P, one distinct candidate per matched object, and all remaining candidates as N. Every subset of P remains injectively matchable. Consequently, for any selected S, \[ FP(S)\le |S\cap N|. \] At gate logit threshold b=0 (probability 0.5), use \[ U_\tau(s)=\sum_{i\in N}\frac{\operatorname{softplus}(s_i/\tau)}{\log 2}. \] Since softplus(u)≥log 2 for u≥0, 1{s_i≥0}≤softplus(s_i/τ)/log 2. Thus FP(S_0)≤U_τ pointwise. This includes duplicate detections, not just background-labeled pixels. Ordinary sigmoid soft counts are **not** upper bounds: σ(0)=1/2 while 1{0≥0}=1. Train with L_pos=Σ_(i∈P) w_i softplus(−s_i)/max(1,|P|), w_i=clip(1/√a_i,0.1,1), where a_i is the matched ground-truth component area in native pixels, and empirical mean constraint E_train U_τ≤α_train. The Lagrangian is L_pos+λ(E_train U_τ−α_train), λ≥0. A projected dual-ascent update increases λ on constraint violations; gradient descent updates gate parameters. No global convergence claim is made for a neural gate. The prototype uses an MLP; a GNN is an ablation, not an assumption. Limitations: canonical labels penalize alternative valid matches, possibly reducing recall. The assignment is frozen rather than differentiated. Empty or incomplete proposal pools limit attainable recall. A fully merged pair remains one candidate. Area weighting can amplify annotation noise. The pointwise bound is conservative and is only asserted at the training threshold; calibration measures actual FP at every chosen test threshold. Jointly changing the proposal backbone invalidates frozen assignments and the calibration certificate. This is a staged prototype, **not an end-to-end differentiable component extractor**. ### Finite-family calibration certificate (known statistical machinery) Freeze all learned parameters and preprocessing using training/development data. Before looking at calibration labels, fix M finite gate thresholds. Use n independent, identically distributed calibration images from the deployment distribution. For threshold j and k=1,…,K, let Z_ijk=1{FP_ij≥k}. Its mean p_jk is a Bernoulli tail probability. Obtain a one-sided Clopper–Pearson upper bound u_jk with error probability δ/(M K). Set \[ U_j=\sum_{k=1}^K u_{jk}. \] Because E FP_j=Σ_k p_jk and a union bound covers all MK pairs, with probability at least 1−δ over the calibration sample, **every** threshold j satisfies E FP_j≤U_j. Choose any j with U_j≤α, including a data-dependent utility maximizer within this certified set. This gives a PAC-style high-probability statement about population expected count; it is not a guarantee that each image has ≤α false objects. The CP formula is BetaQuantile(1−ε; r+1,n−r) for r0} is binomial under iid units; use its lower-tail CDF at alpha. Test each at delta. No CP binomial test is applied directly to fractional count observations. Endpoint alpha=0 yields no empirical certificate; alpha equal to the support bound is deterministically valid. **Verification of the guarantee.** Bounded Z satisfies E exp(-t Z) <= 1-mu+mu exp(-t), by the chord bound for a convex exponential, where mu=EZ. Independence and Markov's inequality then give P(zbar<=x) <= exp(-n kl(x,mu)) for xa this is at most the bound evaluated at a, yielding a valid lower-tail p-value. In the predetermined testing order, let j0 be the first unsafe threshold. Any unsafe acceptance requires accepting j0; this has probability at most delta. Dependence among threshold tests does not affect that implication. Choosing any accepted threshold is safe outside this event; if none pass, the explicit empty predictor has risk zero. This proof requires iid deployment units, a frozen pipeline and a bounded candidate count. It does not establish distribution-shift protection or a guarantee for a learned training loss. | Zero-event calculation, alpha=.01, delta=.05, K=64, M=101 | Required independent n | |---|---:| | Bonferroni any-alarm CP | 758 | | Fixed-sequence any-alarm exact test | 299 | | Bonferroni sum of K count-tail CP bounds | 75,321 | | Fixed-sequence normalized-count KL test | 19,172 | Thus 758 and 75,321 are not universal sample requirements. For the fixed-sequence zero case, n=ceil(log(delta)/log(1-alpha)) for any risk, or replace alpha by alpha/K for count risk. These calculations are executed in results/math_checks.json. They describe the all-zero data case, not expected power or observed detector performance. A remaining obstruction is rare bursts: FP=K with probability q and 0 otherwise. If q>alpha/K, mean count risk is unsafe, yet n samples are all zero with probability (1-q)^n. Any deterministic procedure that certifies this fixed detector on every all-zero observation must account for that event. This counterexample explains why the cap matters; it does not prove every adaptive procedure has the table's sample requirement. Reducing K changes the detector and may remove true targets. Do not inspect calibration results and then choose between Bonferroni and fixed sequence at full delta each. Predeclare the choice, or divide error across procedures. Fixed sequence returns a certified budget; it does not confer simultaneous confidence coverage on unused pointwise bounds.