Download data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelTransport.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.41 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelTransport.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelTransport.lean
-
curl -L -o FiniteLabelTransport.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MatroidSecretary/Labels/FiniteLabelTransport.lean
6.41 kB
| import OAI.Probability.MatroidSecretary.Labels.FiniteLabelingModel | |
| import OAI.Probability.MatroidProphet.Main | |
| namespace OAI | |
| /-! | |
| Finite-label equivalence supporting the scope statement "every finite known | |
| labeled matroid". No positivity, nonempty-ground, or nonloop hypothesis occurs | |
| in the transport laws. The proof uses mathlib's actual matroid map, not a | |
| replacement independence predicate. | |
| -/ | |
| namespace MatroidProphet.Labeling | |
| open Finset | |
| variable {E F : Type*} [Fintype E] [Fintype F] | |
| theorem finiteOptimum_nonneg (M : Matroid E) (w : E β β) : | |
| 0 β€ finiteOptimum M w := by | |
| classical | |
| unfold finiteOptimum | |
| apply Finset.le_sup'_of_le _ (Finset.mem_univ β ) | |
| simp | |
| theorem sum_le_finiteOptimum (M : Matroid E) (w : E β β) | |
| (I : Finset E) (hI : M.Indep (I : Set E)) : | |
| (β e β I, w e) β€ finiteOptimum M w := by | |
| classical | |
| unfold finiteOptimum | |
| apply Finset.le_sup'_of_le _ (Finset.mem_univ I) | |
| simp [hI] | |
| omit [Fintype E] [Fintype F] in | |
| theorem mapEquiv_finset_indep (M : Matroid E) (e : E β F) (I : Finset E) : | |
| (M.mapEquiv e).Indep (I.map e.toEmbedding : Set F) β M.Indep (I : Set E) := by | |
| simp | |
| theorem finiteOptimum_mapEquiv (M : Matroid E) (e : E β F) (w : E β β) : | |
| finiteOptimum (M.mapEquiv e) (fun f => w (e.symm f)) = finiteOptimum M w := by | |
| classical | |
| apply le_antisymm | |
| Β· apply Finset.sup'_le | |
| intro I _ | |
| split_ifs with hI | |
| Β· have hi : M.Indep (I.map e.symm.toEmbedding : Set E) := by | |
| simpa using hI | |
| simpa using sum_le_finiteOptimum M w (I.map e.symm.toEmbedding) hi | |
| Β· exact finiteOptimum_nonneg M w | |
| Β· apply Finset.sup'_le | |
| intro I _ | |
| split_ifs with hI | |
| Β· have hi := (mapEquiv_finset_indep M e I).2 hI | |
| simpa using sum_le_finiteOptimum (M.mapEquiv e) (fun f => w (e.symm f)) | |
| (I.map e.toEmbedding) hi | |
| Β· exact finiteOptimum_nonneg (M.mapEquiv e) _ | |
| theorem finMatroid_ground (M : Matroid E) (hE : M.E = Set.univ) : | |
| (finMatroid M).E = Set.univ := by | |
| simp [finMatroid, hE] | |
| theorem finWeights_nonnegative_iff (w : E β β) : | |
| (β i, 0 β€ finWeights w i) β β e, 0 β€ w e := by | |
| constructor | |
| Β· intro h e | |
| simpa [finWeights] using h ((Fintype.equivFin E) e) | |
| Β· intro h i | |
| exact h _ | |
| theorem optimum_finMatroid (M : Matroid E) (w : E β β) : | |
| MatroidProphet.optimum (finMatroid M) (finWeights w) = finiteOptimum M w := | |
| finiteOptimum_mapEquiv M (Fintype.equivFin E) w | |
| section Online | |
| variable [MeasurableSpace E] [MeasurableSingletonClass E] {bits : β} | |
| /-- Conjugate an actual online rule by a fixed label enumeration. In particular, | |
| the translated rule does not receive a future order or a future value. -/ | |
| noncomputable def relabelRule (A : OnlineRule (Fintype.card E) bits) : | |
| LabeledOnlineRule E bits where | |
| decide k r s h := A.decide k r (finWeights s) | |
| (encodeHistory (Fintype.equivFin E) k h) | |
| measurable_decide k := by | |
| have hm : Measurable (fun x : Seed bits Γ | |
| ((E β β) Γ (Fin (k.val + 1) β E Γ β)) => | |
| (x.1, (finWeights x.2.1, encodeHistory (Fintype.equivFin E) k x.2.2))) := by | |
| apply Measurable.prodMk measurable_fst | |
| apply Measurable.prodMk | |
| Β· apply Measurable.of_eval | |
| intro i | |
| exact (measurable_pi_apply ((Fintype.equivFin E).symm i)).comp | |
| (measurable_fst.comp measurable_snd) | |
| Β· apply Measurable.of_eval | |
| intro j | |
| have hj : Measurable (fun x : Seed bits Γ | |
| ((E β β) Γ (Fin (k.val + 1) β E Γ β)) => x.2.2 j) := | |
| (measurable_pi_apply j).comp (measurable_snd.comp measurable_snd) | |
| exact ((measurable_of_countable (Fintype.equivFin E)).comp | |
| (measurable_fst.comp hj)).prodMk (measurable_snd.comp hj) | |
| exact (A.measurable_decide k).comp hm | |
| omit [MeasurableSpace E] [MeasurableSingletonClass E] in | |
| theorem encode_labeledHistory (v : E β β) (Ο : LabeledOrder E) | |
| (k : Fin (Fintype.card E)) : | |
| encodeHistory (Fintype.equivFin E) k (labeledHistory v Ο k) = | |
| history (finWeights v) (Ο.trans (Fintype.equivFin E)) k := by | |
| funext j | |
| simp [encodeHistory, labeledHistory, history, finWeights] | |
| theorem relabelRule_acceptedThrough (A : OnlineRule (Fintype.card E) bits) | |
| (r : Seed bits) (s v : E β β) (Ο : LabeledOrder E) (t : β) : | |
| (labeledAcceptedThrough (relabelRule A) r s v Ο t).map | |
| (Fintype.equivFin E).toEmbedding = | |
| acceptedThrough A r (finWeights s) (finWeights v) | |
| (Ο.trans (Fintype.equivFin E)) t := by | |
| classical | |
| ext index | |
| rw [Finset.mem_map_equiv] | |
| unfold labeledAcceptedThrough acceptedThrough | |
| rw [Finset.mem_filter, Finset.mem_filter] | |
| simp only [Finset.mem_univ, true_and, decisionAt, relabelRule, | |
| encode_labeledHistory] | |
| rfl | |
| theorem relabelRule_feasible (M : Matroid E) | |
| (A : OnlineRule (Fintype.card E) bits) (hA : Feasible (finMatroid M) A) | |
| (r : Seed bits) (s v : E β β) (Ο : LabeledOrder E) (t : β) | |
| (hs : β e, 0 β€ s e) (hv : β e, 0 β€ v e) : | |
| M.Indep (labeledAcceptedThrough (relabelRule A) r s v Ο t : Set E) := by | |
| have hi := hA r (finWeights s) (finWeights v) | |
| (Ο.trans (Fintype.equivFin E)) t | |
| ((finWeights_nonnegative_iff s).2 hs) ((finWeights_nonnegative_iff v).2 hv) | |
| rw [β relabelRule_acceptedThrough A r s v Ο t] at hi | |
| exact (mapEquiv_finset_indep M (Fintype.equivFin E) _).1 hi | |
| theorem relabelRule_reward (A : OnlineRule (Fintype.card E) bits) | |
| (r : Seed bits) (s v : E β β) (Ο : LabeledOrder E) : | |
| (β e β labeledAcceptedThrough (relabelRule A) r s v Ο (Fintype.card E), v e) = | |
| reward A r (finWeights s) (finWeights v) (Ο.trans (Fintype.equivFin E)) := by | |
| classical | |
| rw [reward, accepted, β relabelRule_acceptedThrough] | |
| simp [finWeights] | |
| /-- Any pointwise guarantee expressed in the actual `Fin n` model is unchanged | |
| by transporting both the selected reward and the offline benchmark. -/ | |
| theorem relabelRule_ratio_iff (M : Matroid E) | |
| (A : OnlineRule (Fintype.card E) bits) (c : β) | |
| (r : Seed bits) (s v : E β β) (Ο : LabeledOrder E) : | |
| (c * finiteOptimum M v β€ | |
| β e β labeledAcceptedThrough (relabelRule A) r s v Ο (Fintype.card E), v e) β | |
| c * MatroidProphet.optimum (finMatroid M) (finWeights v) β€ | |
| reward A r (finWeights s) (finWeights v) (Ο.trans (Fintype.equivFin E)) := by | |
| rw [relabelRule_reward, optimum_finMatroid] | |
| end Online | |
| end MatroidProphet.Labeling | |
| end OAI | |