Download data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryCellSourcePort.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.69 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryCellSourcePort.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryCellSourcePort.lean
-
curl -L -o BinaryCellSourcePort.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryCellSourcePort.lean
4.69 kB
| import OAI.Combinatorics.EditApproximation.Binary.BinarySampledSourcePort | |
| import OAI.Combinatorics.EditApproximation.Binary.BinaryCellReads | |
| namespace OAI | |
| namespace EditApproximation.BinaryFraction | |
| section Cell | |
| variable {Ξ± : Type*} (source target : List Ξ±) {M : β} | |
| (parent : TargetInterval source.length) (b P F exponent Q : β) (hb : 0 < b) (hP : 0 < P) | |
| (tau a : BinaryFraction) | |
| (parentInitial : TargetInterval target.length β BinaryFraction Γ β) | |
| (child initial current : Fin M β TargetInterval target.length β BinaryFraction Γ β) | |
| (R C : β) (hr : β i q, (child i q).2 β€ R) (hi : β i q, (initial i q).2 β€ C) | |
| (raw : List BinaryFraction) (hraw : raw.map value = groupDyadicScales M b (nat F).value) | |
| (draw : β t : Fin (groupDyadicScales M b (nat F).value).length, | |
| Fin (groupSampleCount M Q b (groupDyadicScaleAt M b (nat F).value t)) β Fin M Γ β) | |
| /-- The same raw dyadic scale list and Fin-count indices as the original | |
| cell estimator, now with the cost of decoding every sampled coordinate. -/ | |
| def preparedCellGroupSourceWithWork (cell : β Γ β) : | |
| Option (BinaryBellmanAction (TargetInterval target.length) | |
| (Fin M Γ TargetInterval target.length) M) Γ β := | |
| let centers := cellCentersReadWithWork P F b a (inversePowerTwo exponent) parentInitial cell | |
| let members := filterMapWithWork | |
| (preparedUnskippedReadWithWork source target parent b P exponent hb hP tau (nat F) | |
| child initial R C hr hi) centers.1 | |
| if h : members.1 = [] then (none, centers.2 + members.2 + 1) else | |
| let selected := sampledGroupActionSourceWithWork source target parent b P exponent Q tau (nat F) | |
| (fun i q => (child i q).1) initial current (indexedGroupScales raw M b (nat F).value hraw) | |
| (fun t j => draw t (Fin.cast (congrArg (groupSampleCount M Q b) | |
| (indexedGroupScales_value raw M b (nat F).value hraw t)) j)) members.1 h | |
| (some selected.1, centers.2 + members.2 + selected.2 + 2) | |
| theorem preparedCellGroupSourceWithWork_eq_cost (cell : β Γ β) (S : β) | |
| (hs : β t i, (draw t i).2 β€ S) : | |
| (preparedCellGroupSourceWithWork source target parent b P F exponent Q hb hP tau a | |
| parentInitial child initial current R C hr hi raw hraw draw cell).1 = | |
| (preparedCellGroupReadWithWork source target parent b P F exponent Q hb hP tau a | |
| parentInitial child initial current R C hr hi raw hraw (fun t i => (draw t i).1) cell).1 β§ | |
| (preparedCellGroupSourceWithWork source target parent b P F exponent Q hb hP tau a | |
| parentInitial child initial current R C hr hi raw hraw draw cell).2 β€ | |
| (preparedCellGroupReadWithWork source target parent b P F exponent Q hb hP tau a | |
| parentInitial child initial current R C hr hi raw hraw (fun t i => (draw t i).1) cell).2 * (S + 4) := by | |
| let centers := cellCentersReadWithWork P F b a (inversePowerTwo exponent) parentInitial cell | |
| let members := filterMapWithWork | |
| (preparedUnskippedReadWithWork source target parent b P exponent hb hP tau (nat F) | |
| child initial R C hr hi) centers.1 | |
| unfold preparedCellGroupSourceWithWork preparedCellGroupReadWithWork | |
| dsimp only | |
| split_ifs with hempty | |
| Β· exact β¨rfl, by dsimp only; nlinarith only [Nat.zero_le S]β© | |
| Β· have h := sampledGroupActionSourceWithWork_eq_cost source target parent b P exponent Q tau (nat F) | |
| (fun i q => (child i q).1) initial current (indexedGroupScales raw M b (nat F).value hraw) | |
| (fun t j => draw t (Fin.cast (congrArg (groupSampleCount M Q b) | |
| (indexedGroupScales_value raw M b (nat F).value hraw t)) j)) members.1 hempty S | |
| (fun t j => hs t _) | |
| dsimp only [dyadicSampledGroupActionReadWithWork] | |
| rw [h.1] | |
| exact β¨rfl, by nlinarith only [h.2]β© | |
| theorem preparedCellGroupSourceWithWork_value (cell : β Γ β) : | |
| (preparedCellGroupSourceWithWork source target parent b P F exponent Q hb hP tau a | |
| parentInitial child initial current R C hr hi raw hraw draw cell).1 = | |
| (preparedCellGroupReadWithWork source target parent b P F exponent Q hb hP tau a | |
| parentInitial child initial current R C hr hi raw hraw (fun t i => (draw t i).1) cell).1 := by | |
| unfold preparedCellGroupSourceWithWork preparedCellGroupReadWithWork | |
| dsimp only | |
| split_ifs with hempty | |
| Β· rfl | |
| Β· apply congrArg some | |
| exact sampledGroupActionSourceWithWork_value source target parent b P exponent Q tau (nat F) | |
| (fun i q => (child i q).1) initial current (indexedGroupScales raw M b (nat F).value hraw) | |
| (fun t j => draw t (Fin.cast (congrArg (groupSampleCount M Q b) | |
| (indexedGroupScales_value raw M b (nat F).value hraw t)) j)) _ hempty | |
| end Cell | |
| end EditApproximation.BinaryFraction | |
| end OAI | |