# Integration specification — corrected joint probability and settlement appendix **Item:** `protocol-reconciliation/joint-probability` · **Policy:** `imd-cmp-v1.0-proposed` (one versioned comparison policy for all sections) · **Checked:** 2026-11-29 UTC **Engine:** IMD Swarm only, existing budgets, permitted free sources, no paid API, no extra customer fee. This is a specification. It changes no production system. **Labels.** `[OBSERVED]` means stated in a handed input or a cited page. `[PROPOSED]` means a rule this section proposes. `[SYNTHETIC]` means an arithmetic fixture, not a real fixture, price or measured performance. `[UNKNOWN]` means not established here. **Inputs (handed data, not in Git):** `after-joint-probability` (JP), `after-bookmaker-comparison` (BC), `after-report-schema` (RS), `after-workflow` (WF), `after-calibration-qc` (CQ). Citations use the form "JP §12.3 ¶2", where the paragraph counts from the section heading. --- ## 1. One comparison policy `imd-cmp-v1.0-proposed` `[PROPOSED]` ```ts type ComparisonPolicy = { policy_version: "imd-cmp-v1.0-proposed"; max_quote_age_s: 300; // inclusive: 0 <= T_decision - effective_quote_time <= 300 max_intercheck_spread_s: 300; // inclusive: max(checked_at) - min(checked_at) <= 300 overrides: {sport: string; market_family: string; max_quote_age_s: number; // each <= 300 max_intercheck_spread_s: number; doc_ref: string}[]; // tighter only, documented min_confidence: "medium"; // validated evidence-confidence (CQ), not probability min_point_ev: number | null; // preregistered value; null = no point floor registered conservative_ev_rule: "lower_endpoint_over_bound_x_uncertainty_set"; }; type QuoteTimes = { source_quote_time_utc: string | null; // time printed by the operator/feed observed_at_utc: string; // our capture (checked_at) effective_quote_time_utc: string | null; // verified effective time; null if unverifiable }; ``` - `effective_quote_time_utc` is the source quote time when verified. Otherwise it is a verified live, uncached capture time. Otherwise it is `null` and the row gets `freshness_unknown`. All three times are stored separately. Any one of them may legitimately differ from the others. - **This replaces:** BC "Comparison and freshness" ¶3 (`max_quote_age_seconds=600`), JP §10 item 3 (180 s) and the "five-minute threshold" in BC ¶ after the table. The intercheck value of 300 in BC ¶3 is kept. An override may only tighten a limit, and it must cite its document. - **Probability lock.** The Swarm sporting probabilities, conditioning event, uncertainty set and joint method are frozen with `locked_at_utc` and a hash before any price is read. No price, repricing or quote failure may change them (this keeps BC "Probability, margin and value" ¶3 and ¶4). ## 2. Defect register (source → defect → replacement rule) | ID | Source section ¶ | Defect or conflict | Replacement | |---|---|---|---| | D1 | JP §12.3 ¶3 | **PQD sign error.** Under positive quadrant dependence, `P(A∧B) ≥ p_A·p_B`, so 0.3552 is a **lower** bound. The upper bound stays `min(p)=0.592`. JP wrote "`E[R] ≤ −7.65%` ⇒ certified no-bet". The correct range is `E[R] ∈ [−7.648%, +53.92%]` at 2.60. The breakeven 0.384615 falls inside, so the bound regime is **indeterminate**. The verdict is still `no_bet` because the conservative EV is negative, but it is **not certified** | R4, F7 | | D2 | JP §13 row n=14 | The text says "adding any leg with p<1 strictly decreases q_all". That is false: an implied leg leaves the intersection unchanged. The correct property is **non-increasing** | R3, F10 | | D3 | JP §8 rule 4 vs §11/§13 | `n>15` conflicts with the 1–14 range. The count also has to apply to the **quoted** slip, not to the slip after closure | R1, F1–F4 | | D4 | JP §3 rows Duplicate/Nested, §15 variant "Leg 3 duplicated" | "Keep the best price" and "keep only the stronger leg" edit the quoted contract. The variant result 0.255316 (=0.58·0.71·0.62) drops leg 3. If leg 3 is appended as a duplicate, q stays 0.13531748. If leg 4 is replaced by a duplicate of leg 3, q is 0.218254 | R2, F5 | | D5 | JP §15 variant "Leg 4 replaced by Team C loses" | Replacing leg 4 removes "Team C wins", so no exclusive pair exists. Only **appending** the complement creates one. `VOID_EXCLUSION` is also wrong as a label: the slip is not void, its full-win probability is a proven 0 | R2, F6 | | D6 | JP §5 G1/G4, §11 `G.pass_all` | The gate tests **pairs** only. Pairwise independence does not imply mutual independence | R3, F9 | | D7 | JP §2 ¶2–3, §11 `EV50=q50*Oc-1`, `q05 > 1/Oc` | Value is judged from all-win probability times price. That ignores void, half and repricing states. There is no confidence gate, no minimum EV and no conservative net EV | R5–R7, F11 | | D8 | JP §8 rule 1, §12.1 ¶2, §15 "constructed EV" | A bound or a product of single prices was treated as licensing value. A constructed product is not an offer | R7, F12 | | D9 | JP §14 | `q_05:0.1302, q_95:0.1522, verdict:"VALUE"` have no derivation, so they are invented values | R7, F13 | | D10 | RS `type Joint` | `definition:"all_positive_profit"` is the only definition. `verdict` and `value_status` are hard-coded to `no_bet` and `unknown`. This conflicts with JP's all-win headline and makes the value path unreachable | §3 types | | D11 | WF ¶"For a requested combined selection" | `joint_probability=null` is set even when a validated model exists elsewhere, and bounds are mixed in with uncertainty | R3, R4 | | D12 | JP §11 `G.shared_event → tier1_exact` | Tier 1 runs before validation and before the missing-marginal check for derived legs. It needs reproduction of the marginals and registered validation | R3 | | D13 | JP §2 `E[R]` formula | The subset notation is ambiguous (S indexes "no loss" but the product runs over `i∉S`). It has no half-states and no rule for repricing a non-product offer | R5, R6 | ## 3. Typed records `[PROPOSED]` ```ts type LegState = "W" | "HW" | "V" | "HL" | "L"; // P/U are not states: they block pricing type QuotedSlip = { // immutable, as offered operator: string; product: "acca"|"same_game"|"bet_builder"|"other"; legs: LegKey[]; // drafted order, duplicates retained offered_decimal: string; // exact decimal string, e.g. "7.85" times: QuoteTimes; rule_ids: string[]; // operator rule text hashes per leg repricing: "divide_out_leg"|"recompute_from_quoted_singles"|"void_slip"|"unknown"; duplicate_rule: "rejects"|"settles_each"|"unknown"; }; type JointResult = { n_quoted: number; n_irreducible: number | null; method: "identity"|"validated_scenarios"|"full_conditioning"|"registered_mutual_independence"|"bounds"|"none"; p_full_win: number | null; // all legs W (headline "all legs win") p_positive_profit: number | null; // payout > 1 under the slip's own rules p_no_loss: number | null; // payout >= 1 payout_dist: {gross: string; p: number}[] | null; // per unit stake, exhaustive proof_bounds: {low: number; high: number; basis: "frechet"|"pqd"|"nested"|"exclusive"} | null; uncertainty_interval: {low: number; high: number; level: number; method: string} | null; ev_point: number | null; ev_conservative: number | null; confidence: "low"|"medium"|"high"|null; verdict: "value"|"no_bet"; reasons: string[]; locked_at_utc: string; policy_version: string; }; ``` `proof_bounds` are mathematical consequences of the stated marginals and constraints. `uncertainty_interval` is a statistical statement about estimation. They must never share a field or a label. RS `Joint` gains the four quantities and `ev_*`, and `verdict` becomes `"value"|"no_bet"` (replaces D10). ## 4. Replacement rules `[PROPOSED]` **R1 — Count and immutability.** `n_quoted = slip.legs.length`, counted **before** closure. If `n_quoted ∉ [1,14]`, return `E_LEG_COUNT` with every numeric field `null`: no bounds, no truncation, no partial result. Simplifying a predicate (dropping a duplicate or implied leg to compute probability) never edits `QuotedSlip`. Payout, count and matching always use the quoted slip. **R2 — Relations.** (a) *Identical key:* the probability predicate is unchanged (A∧A=A). Payout follows `duplicate_rule`. `rejects` means `E_UNSUPPORTED`. `unknown` means `ev=null`, `reason=rules_unknown`. (b) *Implied leg* (`A_j ⇒ A_i`): the predicate keeps `A_j`. The quoted slip still pays both prices if the operator accepts it. (c) *Exclusive* (`A_i∧A_j=∅`): `p_full_win = 0` exactly with `proof_bounds={0,0,"exclusive"}`. The other three quantities are still computed from void states, because both legs may void together. Verdict `no_bet`, reason `exclusive_legs`. (d) *Append vs replace* is decided by diffing `legs` by key: an added key is append, and a removed key plus an added key is replace. **R3 — Joint estimation, in this order.** Stop at the first that applies. 1. Any leg lacks a locked calibrated marginal, or is in `P`/`U` → `p_* = null`, `proof_bounds=null`, `E_MISSING_MARGINAL`. Bounds need marginals. 2. `n_irreducible = 1` → `identity`. 3. **Validated joint scenarios:** a score/state simulation or matrix that reproduces every locked marginal within the registered tolerance and passed held-out joint validation (CQ ¶ on 1–14 events). Probabilities are summed over scenarios. 4. **Full conditioning:** `P(∩A_k) = Π_k P(A_k | A_1∩…∩A_{k−1})` [chain rule]. Each factor conditions on **all** earlier legs and is validated. Pairwise conditionals alone are insufficient for `k ≥ 3`. 5. **Registered mutual independence:** a documented argument covering every subset (no shared entity, latent factor or settlement coupling). Passing pairwise tests is not sufficient [pairwise independence]. 6. Otherwise `method="bounds"`, `p_full_win=null`, `proof_bounds` per R4, verdict `no_bet`, `dependency_unresolved`. Invariant: when a leg is appended, `p_full_win` is **non-increasing**, and it is strictly smaller only if `P(A_new | current) < 1`. **R4 — Proof bounds.** For `n` events, Fréchet gives `max(0, Σp_i − (n−1)) ≤ P(∧A_i) ≤ min p_i` [Fréchet]. If a pair is defensibly PQD, the lower bound rises to `p_A·p_B` [PQD]. If `A_j ⇒ A_i`, the joint equals `p_j`. Bounds are exact only given exact marginals. When marginals carry uncertainty, the conservative low is `FrechetLow(p_low)` and the high is `min(p_high)`, published as `proof_bounds` with `basis` plus a note that the endpoints come from an uncertainty set. **R5 — Four settlement quantities.** Enumerate exhaustive joint leg-state patterns `s` with `P(s)` from R3. `gross(s)` is the quoted slip's payout per unit stake under its rules (any `L` gives 0). Then `p_full_win = P(all W)`, `p_positive_profit = Σ P(s)·1[gross>1]`, `p_no_loss = Σ P(s)·1[gross≥1]`, `EV = Σ P(s)·gross(s) − 1`. With no void or half state, the first three coincide. They are still reported separately. **R6 — Payout model against an observed matching offer.** `gross(s)` uses `offered_decimal` and `repricing`: - `divide_out_leg`: a void leg divides its own quoted single price out of the offer. - `recompute_from_quoted_singles`: the product of the surviving legs' quoted singles. - `void_slip`: any V returns 1.00. - `unknown`: `EV=null`. Half states use `(D+1)/2` and `0.5` only where the operator rule says so (BC "Probability, margin and value" ¶3). Operator-specific rule text for Stake, BET99 and bet365 combined products was **not** verified `[UNKNOWN]`, so runtime must store `rule_ids`. **R7 — Value decision.** All of the following must hold, otherwise `no_bet`: 1. The offer is eligible and for the exact contract: same operator, product, edition and leg keys. A product of single prices is labelled `constructed` and never used as `offered_decimal`. 2. The offer is fresh under §1, with both inclusive 300 s checks. 3. The payout model is complete, so no `unknown` remains. 4. `confidence ≥ medium` (validated, CQ). 5. `ev_conservative > 0` strictly, taken as the minimum EV over `proof_bounds` × the uncertainty set. 6. `ev_point ≥ min_point_ev` when that value is registered. Without an eligible price, `ev_point = ev_conservative = null` with reason `no_eligible_price`, and the sporting probabilities stay unchanged. Bounds alone never produce `value` unless their conservative EV satisfies item 5 and items 1–4 also hold. Empirical thresholds or hit rates may be reported only with supporting settled data `[UNKNOWN: none exist yet]`. ## 5. Corrected pseudocode ``` JOINT(slip: QuotedSlip, locked: LockedForecast, policy, T_decision): n = len(slip.legs) # R1, before closure if n < 1 or n > 14: return ERR(E_LEG_COUNT, n_quoted=n, all numerics=null) if any(leg.state in {P,U} or locked.p[leg] is null for leg in slip.legs): return RES(method="none", p_*=null, proof_bounds=null, verdict=no_bet, E_MISSING_MARGINAL) pred = simplify_predicate(slip.legs) # A∧A=A, implied legs; slip untouched if pred.exclusive: pf = 0; pb = {0,0,"exclusive"}; reasons += exclusive_legs scen = locked.validated_scenarios(pred) # R3.3, else null or locked.full_conditioning(pred) # R3.4, all-prior conditioning or locked.registered_independence(pred) # R3.5, all subsets pb = pb or proof_bounds(pred, locked) # R4 (Frechet / PQD / nested) if scen is null: return RES(method="bounds", p_full_win=null, proof_bounds=pb, verdict=no_bet, reasons+=dependency_unresolved) q = settle_quantities(scen, slip) # R5 (needs slip rules for gross) # ---- prices are read only after this line; locked values are immutable ---- offer = eligible_offer(slip, policy, T_decision) # §1 age/spread, exact contract if offer is null: return RES(q, ev_point=null, ev_conservative=null, no_bet, no_eligible_price) if slip.repricing == unknown or slip.duplicate_rule == unknown (and duplicates present): return RES(q, ev=null, no_bet, rules_unknown) ev_pt = Σ_s P(s)·gross(s, offer) − 1 ev_low = min over scen ∈ uncertainty_set × pb of the same sum ok = locked.confidence ≥ medium and ev_low > 0 and (policy.min_point_ev is null or ev_pt ≥ policy.min_point_ev) return RES(q, ev_pt, ev_low, verdict = ok ? value : no_bet, policy_version, locked_at_utc) ``` ## 6. Fixtures `[SYNTHETIC]` (exact, reproducible with string/decimal math) Unless stated otherwise, legs are independent by registered argument, there are no void states, offers are eligible and fresh, and confidence is medium. | F | Case | Expected | |---|---|---| | F1 | `n_quoted=0` | `E_LEG_COUNT`, all numerics `null` | | F2 | `n=1`, p=0.62, offer 1.66 | `identity`. `p_full_win=p_positive_profit=p_no_loss=0.62`, bounds [0.62,0.62], `ev_point=0.62·1.66−1=+0.0292` | | F3 | `n=14`, each p=0.9 | `p_full_win=0.9^14=0.22876792454961`. Fréchet low `max(0,12.6−13)=0`, high 0.9 | | F4 | 15 quoted legs, two identical (irreducible 14) | `E_LEG_COUNT`, `n_quoted=15`. Deduplication cannot rescue the slip | | F5 | JP §15 base `p=(0.58,0.71,0.53,0.62)`. **Append** a duplicate of leg 3 / **replace** leg 4 by a duplicate of leg 3 | Append: `n_quoted=5`, `n_irr=4`, `p_full_win=0.13531748`, payout per `duplicate_rule` (`unknown` ⇒ EV null). Replace: `n_quoted=4`, `n_irr=3`, `p_full_win=0.58·0.71·0.53=0.218254`. JP's 0.255316 is wrong in both cases | | F6 | **Append** "Team C loses" (complement of leg 4) / **replace** leg 4 by it | Append: `p_full_win=0` (proof). Other quantities depend on joint void states. `no_bet`, `exclusive_legs`. Replace: no exclusion. Needs a locked p for "C loses". The draw/tie share is not 1−0.62, so if absent the result is `E_MISSING_MARGINAL`. With a synthetic p=0.36: 0.58·0.71·0.53·0.36 = 0.07857144 | | F7 | JP §12.3 pair p_A=0.600, p_B=0.592, offer 2.60, BE=1/2.6=0.384615… | Fréchet [0.192, 0.592] ⇒ EV [−0.5008, +0.5392]. PQD [0.3552, 0.592] ⇒ EV [−0.07648, +0.5392]. Indeterminate in both cases. `ev_conservative=−0.07648` ⇒ `no_bet` (not "certified") | | F8 | JP §12.2 full conditioning p_A=0.600, P(B∣A)=0.720, offer 2.60 | `p_full_win=0.432`, `ev_point=+0.1232`. With synthetic uncertainty p_A∈[0.58,0.62] and P(B∣A)∈[0.68,0.76]: q∈[0.3944,0.4712], `ev_conservative=0.3944·2.6−1=+0.02544>0`. Value only if R7 items 1–4 and 6 hold. The independence product 0.3552 (EV −0.07648) is not a lower bound unless PQD is established | | F9 | Three-way: A, B fair and independent, C=1[A=B] (each p=0.5, every pair P=0.25) | Pairwise gate passes, product 0.125. True `P(A∧B∧C)=P(A∧B)=0.25`. With C=1[A≠B] the true value is **0**. Fréchet [0,0.5]. R3.5 must reject pairwise-only evidence | | F10 | Non-increasing: A=home win p=0.60, append B=home win or draw p=0.80 | `A⇒B` gives P(A∧B)=0.60, unchanged although p_B<1. The test is `q(prefix k+1) ≤ q(prefix k)`, never strict | | F11 | Void and payout separation: L1 W/V/L=0.50/0.10/0.40 at 1.80. L2 0.55/0.05/0.40 at 1.60. Acca offer 2.88, `divide_out_leg` | Payout distribution: 2.88 w.p. 0.275, 1.80 w.p. 0.025, 1.60 w.p. 0.055, 1.00 w.p. 0.005, 0 w.p. 0.640. **full_win 0.275, positive_profit 0.355, no_loss 0.360, EV −0.0700.** The naive all-win view gives 0.275·2.88−1 = −0.2080. Same legs at offer 3.00 with `recompute_from_quoted_singles`: EV = 0.825+0.045+0.088+0.005−1 = −0.0370. With `repricing=unknown`: EV null | | F12 | JP §12.1 p=(0.62,0.55,0.48), singles (1.70,1.90,2.15) | q=0.16368. The constructed product 6.9445 is **not** an offer, so EV null. At an observed matching 6.10: EV = 0.16368·6.10−1 = −0.0015520 ⇒ `no_bet` | | F13 | JP §15 at observed matching 7.85 | q=0.13531748, BE 0.127388535…, `ev_point=+0.06224222`. JP's q_05/q_95 are unsupported ⇒ `null` until derived. With a synthetic ±0.02 box per leg: q∈[0.1182384,0.154176], `ev_conservative=−0.07182856` ⇒ `no_bet` despite positive point EV. Fréchet [0,0.53] alone gives EV low −1 | | F14 | Freshness at T=12:05:00 | Effective 12:00:00 (age 300 s) is eligible. 11:59:59 (301 s) is `stale`. Checks spanning 12:00:00–12:05:00 (300 s) pass. 12:00:00–12:05:01 is `outside_window`. A cached view keeps `observed_at` with `effective=null` and gets `freshness_unknown` | | F15 | Lock | p is locked at 11:58:00 with hash H. The offer moves 7.85→7.40 at 12:01. p and H are unchanged. Only EV is recomputed (0.13531748·7.40−1=+0.00134935) | ## 7. Recomputed JP §§8–15 | JP § | Original | Corrected | |---|---|---| | §8 rule 1 | Value when `q_lower > 1/O_c` | R7 only. A bound is one input to `ev_conservative` | | §8 rule 2 | Certified no value when `q_upper < 1/O_c` | Kept as a proof (valid when there are no void states). With void states, use the max-EV over the bounds | | §8 rule 4 | `n=0, n>15` | `n_quoted ∉ [1,14]` (R1) | | §9 | Void handled via `q_all`; postponement rule | Kept, plus the four quantities (R5) and the repricing enum (R6) | | §10 | 180 s, all eight tuple fields | §1 policy 300/300 inclusive; the leg tuple has **nine** fields (JP §1) | | §11 | Pseudocode | §5 above | | §12.1 | "Value on the constructed price" | F12: EV null on the constructed price, −0.155% at 6.10 | | §12.2 | +12.32% shown as value | Point is correct. Value needs F8's conservative check | | §12.3 | PQD "certified no-bet" | F7: PQD gives the lower bound 0.3552 and the upper 0.592. Indeterminate, `no_bet` by conservative EV | | §12.4 | E[R] −6.40% | Arithmetic is correct (0.891+0.045=0.936). Add `p_positive_profit=0.360`, `p_no_loss=0.360`, `p_full_win=0.330` (leg 2 has no void) | | §13 | Strictly decreasing; `q_all=0 iff exclusive` | Non-increasing (F10). `q=0` can also arise without a declared pairwise exclusion (F9 XOR, three-way) | | §14 | Invented q_05/q_95, `VALUE` | `null` until derived. Schema per §3 | | §15 | Duplicate/exclusive variants | F5, F6, F13 | ## 8. Cross-section reconciliation - **BC ↔ JP ↔ WF on freshness:** 600/180/"five-minute" become one 300/300 inclusive policy (§1). - **RS ↔ JP on definition:** RS uses "all_positive_profit" and JP uses "all legs win". Both are kept as separate fields. The headline is `p_full_win`, with the definition named in the view (RS §9 "Joint names its definition"). - **WF ↔ JP on null:** `joint_probability=null` applies only at R3.1 or R3.6. Validated scenarios or full conditioning yield a number with an uncertainty interval. - **CQ:** joint all-win targets are scored separately. A void leg does not redefine the forecast target. Settlement and payout are handled by R5/R6 (consistent with CQ ¶ on 1–14 events). - **BC value floor:** BC's "+0.02" is a proposed default, not a registered empirical threshold. Here it is `min_point_ev`, which stays `null` unless preregistered. ## 9. Unknowns and limitations - Operator rules for combined bets (void repricing, duplicate acceptance, same-game restrictions) at Stake, BET99 and bet365 are not verified here `[UNKNOWN]`. BC recorded unreadable BET99 rules and bet365 display-only hubs on its check date. - All fixtures are synthetic. No IMD joint calibration data exists, so no hit rate, threshold or performance claim is made. - PQD is a pairwise concept. Multivariate positive-dependence lower bounds for `n ≥ 3` legs are not specified here and fall back to Fréchet. - Gaussian/t-copula choices (JP §6) remain modelling assumptions. They are admissible only as R3.3 validated scenarios. ## 10. Method sources (checked 2026-11-29) - [Fréchet] Fréchet inequalities for conjunctions: https://en.wikipedia.org/wiki/Fr%C3%A9chet_inequalities ; copula bounds: https://en.wikipedia.org/wiki/Copula_(statistics) - [chain rule] https://en.wikipedia.org/wiki/Chain_rule_(probability) - [pairwise independence] XOR counterexample: https://en.wikipedia.org/wiki/Pairwise_independence - [PQD] Definition attributed to Lehmann (1966): https://arxiv.org/html/2509.12473