File size: 2,271 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import Mathlib.Combinatorics.Matroid.Closure
import OAI.Probability.MatroidProphet.Main
namespace OAI
namespace MatroidProphet.CandidateSpecification
open Finset
/-- Strict rounded-weight priority, including the fixed label tie-breaking rule. -/
def higher {n : β} (f : Fin n) (a : Option β€) (e : Fin n) (b : Option β€) : Prop :=
match a, b with
| some i, some j => j < i β¨ j = i β§ f < e
| some _, none => True
| _, _ => False
/-- Source candidate set: positive, unobserved, and not spanned by higher-priority
observed labels. The full candidate set is analytical, not given to the algorithm. -/
noncomputable def candidates {n : β} (M : Matroid (Fin n))
(a : Fin n β Option β€) (H : Finset (Fin n)) : Finset (Fin n) := by
classical
exact Finset.univ.filter fun e => a e β none β§ e β H β§
e β M.closure {f | f β H β§ higher f (a f) e (a e)}
/-- Positive priority-greedy on the entire ground set, characterized by failure
of the strictly higher-priority labels to span the current label. -/
noncomputable def greedy {n : β} (M : Matroid (Fin n))
(a : Fin n β Option β€) : Finset (Fin n) := by
classical
exact Finset.univ.filter fun e => a e β none β§
e β M.closure {f | higher f (a f) e (a e)}
/-- The source comparison independent set after sacrificing the fair mask. -/
noncomputable def survivors {n : β} (M : Matroid (Fin n))
(a : Fin n β Option β€) (H : Finset (Fin n)) : Finset (Fin n) :=
greedy M a \ H
/-- The complete mathematical assertion of Lemma `lem:filter`, stated solely
using the concrete source definitions and the finite independent fair-mask law. -/
def CandidateMass : Prop :=
β (n : β) (M : Matroid (Fin n)), M.E = Set.univ β β w : Weights n,
let a := fun e => roundedLevel weightBase (w e)
let u := fun e => roundedWeight weightBase (w e)
(β H, M.Indep (survivors M a H : Set (Fin n)) β§
survivors M a H β candidates M a H) β§
bitsExpectation (fun _ => (1 / 2 : β)) Finset.univ
(fun H => β e β survivors M a H, u e) = optimum M u / 2 β§
bitsExpectation (fun _ => (1 / 2 : β)) Finset.univ
(fun H => β e β candidates M a H, u e) β€ optimum M u
end MatroidProphet.CandidateSpecification
end OAI
|