Download data/lean/OAI/Probability/LogConcave/OraclePrograms/RoutineKind.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/LogConcave/OraclePrograms/RoutineKind.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/LogConcave/OraclePrograms/RoutineKind.lean
-
curl -L -o RoutineKind.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/LogConcave/OraclePrograms/RoutineKind.lean
2.5 kB
| import Mathlib | |
| namespace OAI | |
| section | |
| noncomputable section | |
| namespace LogConcaveSampling.OracleCompiler | |
| open scoped Classical | |
| inductive RoutineKind where | |
| | mean | sample | |
| deriving DecidableEq | |
| structure RoutineLabel where | |
| kind : RoutineKind | |
| b : β | |
| p : β | |
| def RoutineLabel.terminal (L : RoutineLabel) : Prop := L.pβ€L.b | |
| inductive RoutineStep (t : β) : RoutineLabel β RoutineLabel β Prop where | |
| | meanFinal (b p : β) : RoutineStep t β¨.mean,b,pβ© β¨.mean,b+t,pβ© | |
| | sampleFinal (b p : β) : RoutineStep t β¨.sample,b,pβ© β¨.mean,b,pβ© | |
| | internal (k k' : RoutineKind) (b p : β) : | |
| RoutineStep t β¨k,b,pβ© β¨k',b-10*t,p-1/4β© | |
| def RoutineLabel.rank (t : β) (L : RoutineLabel) : β := | |
| 2*β(L.p-L.b)/tββ+(match L.kind with | .mean => 0 | .sample => 1) | |
| lemma ceil_gap_drop {t x y : β} (ht : 0<t) (hx : 0<x) (hy : yβ€x-t) : | |
| βy/tββ<βx/tββ := by | |
| have hp : 0<x/t := div_pos hx ht | |
| have hxy : y/tβ€x/t-1 := by | |
| simpa only [sub_div,div_self ht.ne'] using (div_le_div_of_nonneg_right hy ht.le) | |
| have hn : 0<βx/tββ := Nat.ceil_pos.mpr hp | |
| have hc := Nat.le_ceil (x/t) | |
| have hm : y/tβ€(βx/tββ-1:β) := by | |
| rw [Nat.cast_sub (by omega : 1β€βx/tββ),Nat.cast_one] | |
| linarith | |
| exact lt_of_le_of_lt (Nat.ceil_le.mpr hm) (Nat.sub_lt hn (by omega)) | |
| lemma RoutineStep.rank_lt {t : β} (ht : 0<t) (hs : tβ€1/44) | |
| {P C : RoutineLabel} (hP : Β¬P.terminal) (h : RoutineStep t P C) : | |
| C.rank t<P.rank t := by | |
| cases h with | |
| | meanFinal b p => | |
| have hd := ceil_gap_drop ht (show 0<p-b by simpa [RoutineLabel.terminal] using hP) | |
| (y:=p-(b+t)) (by linarith) | |
| simp only [RoutineLabel.rank] | |
| omega | |
| | sampleFinal b p => simp [RoutineLabel.rank] | |
| | internal k k' b p => | |
| have hd := ceil_gap_drop ht (show 0<p-b by simpa [RoutineLabel.terminal] using hP) | |
| (y:=p-1/4-(b-10*t)) (by linarith) | |
| cases k <;> cases k' <;> simp only [RoutineLabel.rank] <;> omega | |
| theorem routine_induction {t : β} (ht : 0<t) (hs : tβ€1/44) | |
| (P : RoutineLabel β Prop) (hbase : βL,L.terminal β P L) | |
| (hstep : βL,Β¬L.terminal β (βC,RoutineStep t L C β P C) β P L) : βL,P L := by | |
| intro L | |
| induction hn : L.rank t using Nat.strong_induction_on generalizing L with | |
| | h n ih => | |
| by_cases hL : L.terminal | |
| Β· exact hbase L hL | |
| Β· apply hstep L hL | |
| intro C hc | |
| exact ih _ (hn βΈ hc.rank_lt ht hs hL) C rfl | |
| end LogConcaveSampling.OracleCompiler | |
| end | |
| end | |
| end OAI | |