Download data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelingModel.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.03 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelingModel.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelingModel.lean
-
curl -L -o FiniteLabelingModel.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelingModel.lean
3.03 kB
| import OAI.Probability.MatroidProphet.Main | |
| import Mathlib.Combinatorics.Matroid.Map | |
| namespace OAI | |
| namespace MatroidProphet.Labeling | |
| open Finset | |
| /-- The same offline maximum as `MatroidProphet.optimum`, on an arbitrary | |
| finite ground type. The empty independent set is among the competitors. -/ | |
| noncomputable def finiteOptimum {E : Type*} [Fintype E] | |
| (M : Matroid E) (w : E β β) : β := by | |
| classical | |
| exact Finset.univ.sup' Finset.univ_nonempty | |
| (fun I : Finset E => if M.Indep (I : Set E) then β e β I, w e else 0) | |
| /-- Relabel all elements, without restricting the matroid or dropping loops. -/ | |
| noncomputable def finMatroid {E : Type*} [Fintype E] (M : Matroid E) : | |
| Matroid (Fin (Fintype.card E)) := M.mapEquiv (Fintype.equivFin E) | |
| /-- Transport each weight along the inverse of the chosen enumeration. -/ | |
| noncomputable def finWeights {E : Type*} [Fintype E] (w : E β β) : | |
| Weights (Fintype.card E) := fun i => w ((Fintype.equivFin E).symm i) | |
| /-- A labeled arrival order uses arrival times `Fin |E|` and actual labels `E`. | |
| It is a bijection, so every label arrives exactly once. -/ | |
| abbrev LabeledOrder (E : Type*) [Fintype E] := Fin (Fintype.card E) β E | |
| /-- Arrival orders form a finite discrete measurable space, just as in the | |
| `Fin n` information model. -/ | |
| instance labeledOrderMeasurableSpace (E : Type*) [Fintype E] : | |
| MeasurableSpace (LabeledOrder E) := β€ | |
| instance labeledOrderMeasurableSingletonClass (E : Type*) [Fintype E] : | |
| MeasurableSingletonClass (LabeledOrder E) := β¨fun _ => trivialβ© | |
| /-- Only the label coordinates of a history are relabeled. -/ | |
| def encodeHistory {E : Type*} {n : β} (e : E β Fin n) (k : Fin n) | |
| (h : Fin (k.val + 1) β E Γ β) : History n k := | |
| fun j => (e (h j).1, (h j).2) | |
| /-- A rule on arbitrary finite labels has exactly the same information | |
| restriction as `OnlineRule`: seed, initial samples, and the observed prefix. -/ | |
| structure LabeledOnlineRule (E : Type*) [Fintype E] [MeasurableSpace E] | |
| (bits : β) where | |
| decide : (k : Fin (Fintype.card E)) β Seed bits β (E β β) β | |
| (Fin (k.val + 1) β E Γ β) β Bool | |
| measurable_decide : β k, Measurable | |
| (fun x : Seed bits Γ ((E β β) Γ (Fin (k.val + 1) β E Γ β)) => | |
| decide k x.1 x.2.1 x.2.2) | |
| /-- The actual observed history for an arbitrary labeled arrival order. -/ | |
| def labeledHistory {E : Type*} [Fintype E] (v : E β β) | |
| (Ο : LabeledOrder E) (k : Fin (Fintype.card E)) : | |
| Fin (k.val + 1) β E Γ β := | |
| fun j => let e := Ο (prefixIndex k j); (e, v e) | |
| /-- Accepted labels after `t` arrivals in the arbitrary-label model. -/ | |
| noncomputable def labeledAcceptedThrough {E : Type*} [Fintype E] [MeasurableSpace E] | |
| {bits : β} (A : LabeledOnlineRule E bits) (r : Seed bits) | |
| (s v : E β β) (Ο : LabeledOrder E) (t : β) : Finset E := by | |
| classical | |
| exact Finset.univ.filter fun e => (Ο.symm e).val < t β§ | |
| A.decide (Ο.symm e) r s (labeledHistory v Ο (Ο.symm e)) = true | |
| end MatroidProphet.Labeling | |
| end OAI | |