Download data/lean/OAI/Combinatorics/Automata/Main.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.54 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/Automata/Main.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/Automata/Main.lean
-
curl -L -o Main.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/Automata/Main.lean
3.54 kB
| import OAI.Combinatorics.Automata.Recognition | |
| import OAI.Combinatorics.Automata.PathNFA | |
| namespace OAI | |
| namespace OneWayLiveness | |
| /-- The one-way nondeterministic upper bound and two-way deterministic lower bound, | |
| under both acceptance conventions. -/ | |
| theorem main_theorem (h : β) (hh : 2 β€ h) : | |
| (β N : NMachine (Alphabet h) (h + 3), N.NoLeft β§ | |
| β positive : Bool, N.Recognizes positive (OWL h)) β§ | |
| (β (positive : Bool) (s : β) (D : DMachine (Alphabet h) s), | |
| D.Recognizes positive (OWL h) β | |
| 2 ^ ((h - 2) / 31) β€ 4 * (s + if positive then 2 else 1) ^ 2) := | |
| β¨small_nfa h,deterministic_lower_bound h hhβ© | |
| open Filter Topology in | |
| /-- No alphabet-independent polynomial deterministic simulation exists, | |
| under either acceptance convention. -/ | |
| theorem no_polynomial_simulation (positive : Bool) : Β¬ PolynomialSimulation positive := by | |
| rintro β¨C,c,hC,_hc,hsimβ© | |
| obtain β¨m,hmβ© := exists_nat_ge c | |
| let B : β := 4 * (C * 36^m + 2)^2 | |
| have ht : Tendsto (fun k : β => B * (k : β)^(2*m) / (2 : β)^k) atTop (π 0) := by | |
| simpa only [mul_zero, mul_div_assoc] using | |
| (tendsto_const_nhds.mul (tendsto_pow_const_div_const_pow_of_one_lt (2*m) | |
| (by norm_num : (1 : β) < 2)) : | |
| Tendsto (fun k : β => B * ((k : β)^(2*m) / (2 : β)^k)) atTop (π (B*0))) | |
| obtain β¨k,hk,hk1β© := ((ht.eventually (gt_mem_nhds (by norm_num : (0 : β) < 1))).and | |
| (eventually_ge_atTop 1)).exists | |
| have hsmall : B * (k : β)^(2*m) < (2 : β)^k := | |
| (div_lt_one (pow_pos (by norm_num) k)).mp hk | |
| let h := 31*k+2 | |
| obtain β¨N,_hNL,hNβ© := small_nfa h | |
| let : Fintype (Alphabet h) := Fintype.ofFinite _ | |
| obtain β¨s,D,hs,hDβ© := hsim (Alphabet h) inferInstance (h+3) N | |
| have hrec : D.Recognizes positive (OWL h) := fun w => (hD w).trans (hN positive w) | |
| have hbound := deterministic_lower_bound h (by dsimp [h]; omega) positive s D hrec | |
| have hexp : (h-2)/31 = k := by dsimp [h]; omega | |
| rw [hexp] at hbound | |
| have hbR : (2 : β)^k β€ 4 * ((s : β) + if positive then 2 else 1)^2 := by | |
| exact_mod_cast hbound | |
| have hkR : (1 : β) β€ k := by exact_mod_cast hk1 | |
| have hn1 : (1 : β) β€ (h+3 : β) := by | |
| exact_mod_cast (show 1 β€ h+3 by omega) | |
| have hn36 : ((h+3 : β) : β) β€ 36*(k : β) := by | |
| dsimp [h] | |
| push_cast | |
| linarith | |
| have hpoly : ((h+3 : β) : β)^c β€ 36^m*(k : β)^m := by | |
| calc | |
| _ β€ ((h+3 : β) : β)^(m : β) := Real.rpow_le_rpow_of_exponent_le hn1 hm | |
| _ = ((h+3 : β) : β)^m := Real.rpow_natCast _ _ | |
| _ β€ (36*(k : β))^m := pow_le_pow_leftβ (by positivity) hn36 _ | |
| _ = _ := mul_pow _ _ _ | |
| have hsp : (s : β) β€ C*36^m*(k : β)^m := | |
| hs.trans (by simpa only [mul_assoc] using mul_le_mul_of_nonneg_left hpoly hC.le) | |
| have hkm : (1 : β) β€ (k : β)^m := one_le_powβ hkR | |
| have hΞ΄ : (if positive then 2 else 1 : β) β€ 2 := by cases positive <;> norm_num | |
| have hsq : (s : β) + (if positive then 2 else 1) β€ | |
| (C*36^m+2)*(k : β)^m := by nlinarith | |
| have hnon : (0 : β) β€ (s : β) + (if positive then 2 else 1) := by | |
| cases positive <;> positivity | |
| have hbig : (2 : β)^k β€ B*(k : β)^(2*m) := by | |
| calc | |
| _ β€ 4*((s : β)+(if positive then 2 else 1))^2 := hbR | |
| _ β€ 4*((C*36^m+2)*(k : β)^m)^2 := | |
| mul_le_mul_of_nonneg_left (pow_le_pow_leftβ hnon hsq 2) (by norm_num) | |
| _ = _ := by dsimp [B]; rw [mul_pow, β pow_mul, Nat.mul_comm m 2]; ring | |
| exact (not_lt_of_ge hbig) hsmall | |
| end OneWayLiveness | |
| end OAI | |