Download data/lean/OAI/Combinatorics/MatchingCount/Tapes/RunBits.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 17 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Tapes/RunBits.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Tapes/RunBits.lean
-
curl -L -o RunBits.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Tapes/RunBits.lean
17 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Graphs.Cumulative | |
| namespace OAI | |
| namespace MatchingFPRAS.FiniteChoice | |
| open Finset | |
| lemma tapeIndex_value (k : β) (bits : Fin k β Bool) : | |
| (tapeIndex k bits).val = β i, (if bits i then 1 else 0)*2^i.val := by | |
| change (finFunctionFinEquiv (fun i => finTwoEquiv.symm (bits i))).val = _ | |
| rw [finFunctionFinEquiv_apply] | |
| apply sum_congr rfl; intro i _ | |
| cases bits i <;> simp [finTwoEquiv] | |
| lemma tapeLaw_eq {r : β} (p : Fin r β β) (hs : β i, p i = 1) (k : β) : | |
| tapeLaw p hs k = outputLaw p hs (pow_pos (by norm_num : 0 < (2:β)) k) := by | |
| funext i | |
| have hcard : (univ.filter (fun bits : Fin k β Bool => chooseBits p hs k bits=i)).card = | |
| (univ.filter (fun J : Fin (2^k) => choose p hs (pow_pos (by norm_num : 0 < (2:β)) k) J=i)).card := by | |
| calc | |
| _ = β bits : Fin k β Bool, if chooseBits p hs k bits=i then (1:β) else 0 := by simp | |
| _ = β J : Fin (2^k), if choose p hs (pow_pos (by norm_num : 0 < (2:β)) k) J=i then (1:β) else 0 := | |
| by | |
| simp only [chooseBits] | |
| convert (tapeIndex k).sum_comp | |
| (fun J : Fin (2^k) => if choose p hs (pow_pos (by norm_num : 0 < (2:β)) k) J=i then (1:β) else 0) using 1 | |
| congr 3 | |
| _ = _ := by simp | |
| simp only [tapeLaw,outputLaw,hcard,Nat.cast_pow,Nat.cast_ofNat] | |
| end MatchingFPRAS.FiniteChoice | |
| namespace MatchingFPRAS.BoundedSimulation | |
| open Finset | |
| variable {Ξ© : Type*} [Fintype Ξ©] [DecidableEq Ξ©] | |
| def runBits {r : β} (z : Ξ©) (p : β β Ξ© β Fin r β β) | |
| (hs : β n s, β i, p n s i = 1) (next : β β Ξ© β Fin r β Ξ©) (k : β) : | |
| (n : β) β (Fin n β Fin k β Bool) β Ξ© | |
| | 0, _ => z | |
| | n+1, bits => | |
| let s := runBits z p hs next k n (Fin.init bits) | |
| next n s (MatchingFPRAS.FiniteChoice.chooseBits (p n s) (hs n s) k (bits (Fin.last n))) | |
| def pointMass (z : Ξ©) (s : Ξ©) : β := if z=s then 1 else 0 | |
| def uniformLaw {A : Type*} [Fintype A] (f : A β Ξ©) (s : Ξ©) : β := | |
| (β a, if f a=s then (1:β) else 0)/(Fintype.card A:β) | |
| omit [Fintype Ξ©] in | |
| lemma uniformLaw_equiv [Fintype Ξ©] {A B : Type*} [Fintype A] [Fintype B] (e : A β B) | |
| (f : B β Ξ©) (s : Ξ©) : uniformLaw (f β e) s=uniformLaw f s := by | |
| unfold uniformLaw | |
| rw [Fintype.card_congr e] | |
| congr 1 | |
| exact e.sum_comp (fun b => if f b=s then (1:β) else 0) | |
| lemma fiber_sum {A : Type*} [Fintype A] (f : A β Ξ©) (g : Ξ© β β) : | |
| (β s, (β a, if f a=s then (1:β) else 0)*g s) = β a, g (f a) := by | |
| simp_rw [sum_mul,ite_mul,one_mul,zero_mul] | |
| rw [sum_comm] | |
| simp only [sum_ite_eq,mem_univ,ite_true] | |
| lemma uniformLaw_map {A Ξ¨ : Type*} [Fintype A] [Fintype Ξ¨] [DecidableEq Ξ¨] | |
| (f : A β Ξ©) (g : Ξ© β Ξ¨) (t : Ξ¨) : | |
| uniformLaw (g β f) t = β s, uniformLaw f s*(if g s=t then 1 else 0) := by | |
| unfold uniformLaw | |
| simp only [Function.comp_apply,div_mul_eq_mul_div,β sum_div] | |
| rw [fiber_sum] | |
| lemma uniformLaw_prod {A B : Type*} [Fintype A] [Fintype B] | |
| (f : A β Ξ©) (g : Ξ© β B β Ξ©) (t : Ξ©) : | |
| uniformLaw (fun ab : AΓB => g (f ab.1) ab.2) t = | |
| β s, uniformLaw f s*uniformLaw (g s) t := by | |
| unfold uniformLaw | |
| simp only [Fintype.card_prod,Nat.cast_mul,div_mul_div_comm,β sum_div,Fintype.sum_prod_type] | |
| rw [fiber_sum] | |
| lemma uniformLaw_chooseBits {r : β} (p : Fin r β β) (hs : β i, p i=1) (k : β) (i : Fin r) : | |
| uniformLaw (MatchingFPRAS.FiniteChoice.chooseBits p hs k) i = | |
| MatchingFPRAS.FiniteChoice.outputLaw p hs (pow_pos (by norm_num : 0 < (2:β)) k) i := by | |
| rw [β MatchingFPRAS.FiniteChoice.tapeLaw_eq] | |
| simp [uniformLaw,MatchingFPRAS.FiniteChoice.tapeLaw] | |
| lemma uniformLaw_choice_step {r : β} (p : Fin r β β) (hs : β i, p i=1) (k : β) | |
| (next : Fin r β Ξ©) (t : Ξ©) : | |
| uniformLaw (fun bits => next (MatchingFPRAS.FiniteChoice.chooseBits p hs k bits)) t = | |
| β i, if next i=t then MatchingFPRAS.FiniteChoice.outputLaw p hs | |
| (pow_pos (by norm_num : 0 < (2:β)) k) i else 0 := by | |
| have h := uniformLaw_map (MatchingFPRAS.FiniteChoice.chooseBits p hs k) next t | |
| simp only [uniformLaw_chooseBits,mul_ite,mul_one,mul_zero] at h | |
| convert h using 1 | |
| congr 3 | |
| lemma runBits_law_succ {r : β} (z : Ξ©) (p : β β Ξ© β Fin r β β) | |
| (hs : β n s, β i, p n s i=1) (next : β β Ξ© β Fin r β Ξ©) (k n : β) (t : Ξ©) : | |
| uniformLaw (runBits z p hs next k (n+1)) t = | |
| categoricalStep (uniformLaw (runBits z p hs next k n)) | |
| (fun s => MatchingFPRAS.FiniteChoice.outputLaw (p n s) (hs n s) | |
| (pow_pos (by norm_num : 0 < (2:β)) k)) (next n) t := by | |
| let e : ((Fin n β Fin k β Bool) Γ (Fin k β Bool)) β (Fin (n+1) β Fin k β Bool) := | |
| (Equiv.prodComm _ _).trans (Fin.snocEquiv (fun _ => Fin k β Bool)) | |
| have hh := uniformLaw_equiv e (runBits z p hs next k (n+1)) t | |
| have hc : (runBits z p hs next k (n+1)) β e = | |
| (fun ab : ((Fin n β Fin k β Bool) Γ (Fin k β Bool)) => | |
| next n (runBits z p hs next k n ab.1) | |
| (MatchingFPRAS.FiniteChoice.chooseBits (p n (runBits z p hs next k n ab.1)) | |
| (hs n (runBits z p hs next k n ab.1)) k ab.2)) := by | |
| funext ab | |
| rcases ab with β¨pref, lastβ© | |
| change next n (runBits z p hs next k n (Fin.init (Fin.snoc (Ξ± := fun _ : Fin (n+1) => Fin k β Bool) pref last))) | |
| (MatchingFPRAS.FiniteChoice.chooseBits | |
| (p n (runBits z p hs next k n (Fin.init (Fin.snoc (Ξ± := fun _ : Fin (n+1) => Fin k β Bool) pref last)))) | |
| (hs n (runBits z p hs next k n (Fin.init (Fin.snoc (Ξ± := fun _ : Fin (n+1) => Fin k β Bool) pref last)))) k | |
| ((Fin.snoc (Ξ± := fun _ : Fin (n+1) => Fin k β Bool) pref last) (Fin.last n))) = _ | |
| simp only [Fin.init_snoc,Fin.snoc_last] | |
| rw [hc] at hh | |
| rw [β hh,uniformLaw_prod (runBits z p hs next k n) | |
| (fun s bits => next n s (MatchingFPRAS.FiniteChoice.chooseBits (p n s) (hs n s) k bits)) t] | |
| simp only [uniformLaw_choice_step,categoricalStep] | |
| lemma runBits_law {r : β} (z : Ξ©) (p : β β Ξ© β Fin r β β) | |
| (hs : β n s, β i, p n s i=1) (next : β β Ξ© β Fin r β Ξ©) (k n : β) : | |
| uniformLaw (runBits z p hs next k n) = bitRun (pointMass z) p hs next k n := by | |
| induction n with | |
| | zero => funext s; by_cases h : z=s <;> simp [runBits,bitRun,uniformLaw,pointMass,h] | |
| | succ n ih => funext s; rw [runBits_law_succ,ih]; rfl | |
| omit [Fintype Ξ©] in | |
| lemma pointMass_nonneg [Fintype Ξ©] (z : Ξ©) (s : Ξ©) : 0 β€ pointMass z s := by | |
| unfold pointMass; split_ifs <;> norm_num | |
| lemma pointMass_sum (z : Ξ©) : β s, pointMass z s=1 := by simp [pointMass] | |
| lemma fixed_tape_card (n k : β) : Fintype.card (Fin n β Fin k β Bool)=2^(n*k) := by | |
| simp only [Fintype.card_fun,Fintype.card_bool,Fintype.card_fin,β pow_mul,Nat.mul_comm k n] | |
| theorem fixed_tape_simulation {r : β} (z : Ξ©) (p : β β Ξ© β Fin r β β) | |
| (hp : β n s i, 0 β€ p n s i) (hs : β n s, β i, p n s i=1) | |
| (next : β β Ξ© β Fin r β Ξ©) (k n : β) : | |
| (β s, |uniformLaw (runBits z p hs next k n) s-idealRun (pointMass z) p next n s|)/2 β€ | |
| 2*n*r/(2:β)^k := by | |
| rw [runBits_law] | |
| exact finite_bit_simulation (pointMass z) (pointMass_nonneg z) (pointMass_sum z) p hp hs next k n | |
| end MatchingFPRAS.BoundedSimulation | |
| namespace MatchingFPRAS.Counting | |
| open Finset | |
| abbrev alpha : β := 1/100000 | |
| lemma others_nonempty {n : β} (hn : 2 β€ n) (i : Fin n) : (univ.erase i).Nonempty := by | |
| let j : Fin n := β¨if i.val=0 then 1 else 0, by split_ifs <;> omegaβ© | |
| refine β¨j,mem_erase.mpr β¨?_,mem_univ _β©β© | |
| apply Fin.ne_of_val_ne | |
| dsimp [j]; split_ifs <;> omega | |
| def rowMaximum {n : β} (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) (i : Fin n) : β := | |
| (univ.erase i).sup' (others_nonempty hn i) (fun j => G i j / v j) | |
| def scaleUpdate {n : β} (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) (i : Fin n) : Fin n β β := | |
| Function.update v i (rowMaximum hn G v i) | |
| def scalingTrace {n : β} (hn : 2 β€ n) (G : Fin n β Fin n β β) : β β Fin n β β | |
| | 0 => fun _ => 2 | |
| | k+1 => if hk : k<n then scaleUpdate hn G (scalingTrace hn G k) β¨k,hkβ© else scalingTrace hn G k | |
| open Finset | |
| variable {n : β} | |
| structure ScaleInvariant (G : Fin n β Fin n β β) (v : Fin n β β) : Prop where | |
| lower : β i, alpha/2 β€ v i | |
| upper : β i, v i β€ 2 | |
| feasible : β i j, iβ j β G i j β€ v i*v j | |
| lemma ScaleInvariant.pos {G : Fin n β Fin n β β} {v : Fin n β β} | |
| (hv : ScaleInvariant G v) (i) : 0 < v i := lt_of_lt_of_le (by norm_num [alpha]) (hv.lower i) | |
| lemma rowMaximum_le (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) | |
| (hv : ScaleInvariant G v) (i) : rowMaximum hn G v i β€ v i := by | |
| apply Finset.sup'_le | |
| intro j hj | |
| exact (div_le_iffβ (hv.pos j)).mpr (hv.feasible i j (mem_erase.mp hj).1.symm) | |
| lemma ratio_le_rowMaximum (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) | |
| (i j) (hji : jβ i) : G i j/v j β€ rowMaximum hn G v i := | |
| Finset.le_sup' (fun j => G i j/v j) (mem_erase.mpr β¨hji,mem_univ _β©) | |
| lemma rowMaximum_lower (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) | |
| (hG : β i j, iβ j β alpha β€ G i j) (hv : ScaleInvariant G v) (i) : | |
| alpha/2 β€ rowMaximum hn G v i := by | |
| obtain β¨j,hjβ© := others_nonempty hn i | |
| have hji := (mem_erase.mp hj).1 | |
| apply le_trans _ (ratio_le_rowMaximum hn G v i j hji) | |
| apply (le_div_iffβ (hv.pos j)).mpr | |
| have hGi := hG i j hji.symm | |
| have hvi := hv.upper j | |
| norm_num [alpha] at * | |
| linarith | |
| lemma scaleUpdate_le (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) | |
| (hv : ScaleInvariant G v) (i j) : scaleUpdate hn G v i j β€ v j := by | |
| by_cases hji : j=i | |
| Β· subst j; simpa [scaleUpdate] using rowMaximum_le hn G v hv i | |
| Β· simp [scaleUpdate,Function.update_of_ne hji] | |
| lemma scaleUpdate_invariant (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) | |
| (hsym : β i j, G i j=G j i) (hG : β i j, iβ j β alpha β€ G i j) | |
| (hv : ScaleInvariant G v) (i) : ScaleInvariant G (scaleUpdate hn G v i) := by | |
| constructor | |
| Β· intro j | |
| by_cases hji : j=i | |
| Β· subst j; simpa [scaleUpdate] using rowMaximum_lower hn G v hG hv i | |
| Β· simpa [scaleUpdate,Function.update_of_ne hji] using hv.lower j | |
| Β· intro j; exact (scaleUpdate_le hn G v hv i j).trans (hv.upper j) | |
| Β· intro a b hab | |
| by_cases hai : a=i | |
| Β· subst a | |
| have hb := (div_le_iffβ (hv.pos b)).mp (ratio_le_rowMaximum hn G v i b hab.symm) | |
| simpa [scaleUpdate,Function.update_of_ne hab.symm] using hb | |
| Β· by_cases hbi : b=i | |
| Β· subst b | |
| have ha := (div_le_iffβ (hv.pos a)).mp (ratio_le_rowMaximum hn G v i a hai) | |
| simpa [scaleUpdate,Function.update_of_ne hai,hsym i a,mul_comm] using ha | |
| Β· simpa [scaleUpdate,Function.update_of_ne hai,Function.update_of_ne hbi] using hv.feasible a b hab | |
| lemma scaleUpdate_tight (hn : 2 β€ n) (G : Fin n β Fin n β β) (v : Fin n β β) | |
| (hv : ScaleInvariant G v) (i) : | |
| β j, jβ i β§ scaleUpdate hn G v i i*scaleUpdate hn G v i j=G i j := by | |
| obtain β¨j,hj,heqβ© := Finset.exists_mem_eq_sup' (others_nonempty hn i) (fun j => G i j/v j) | |
| have hji := (mem_erase.mp hj).1 | |
| refine β¨j,hji,?_β© | |
| change rowMaximum hn G v i = G i j/v j at heq | |
| simp only [scaleUpdate,Function.update_self,Function.update_of_ne hji] | |
| rw [heq] | |
| exact div_mul_cancelβ _ (hv.pos j).ne' | |
| lemma tight_persists (G : Fin n β Fin n β β) (v v' : Fin n β β) | |
| (hv : ScaleInvariant G v) (hv' : ScaleInvariant G v') (hdown : β i, v' i β€ v i) | |
| (i j) (hji : jβ i) (hij : v i*v j=G i j) : v' i*v' j=G i j := by | |
| apply le_antisymm | |
| Β· calc | |
| _ β€ v i*v j := mul_le_mul (hdown i) (hdown j) (hv'.pos j).le (hv.pos i).le | |
| _ = _ := hij | |
| Β· exact hv'.feasible i j hji.symm | |
| lemma scalingTrace_invariant (hn : 2 β€ n) (G : Fin n β Fin n β β) | |
| (hsym : β i j, G i j=G j i) (hG : β i j, iβ j β alpha β€ G i j β§ G i j β€ 3) | |
| (k : β) : ScaleInvariant G (scalingTrace hn G k) β§ | |
| β i, i.val<k β β j, jβ i β§ scalingTrace hn G k i*scalingTrace hn G k j=G i j := by | |
| induction k with | |
| | zero => | |
| constructor | |
| Β· constructor | |
| Β· intro i; norm_num [scalingTrace,alpha] | |
| Β· intro i; simp [scalingTrace] | |
| Β· intro i j h; have := (hG i j h).2; simp only [scalingTrace]; linarith | |
| Β· intro i hi; omega | |
| | succ k ih => | |
| by_cases hk : k<n | |
| Β· let i : Fin n := β¨k,hkβ© | |
| have hinv := scaleUpdate_invariant hn G (scalingTrace hn G k) hsym (fun i j h => (hG i j h).1) ih.1 i | |
| have htrace : scalingTrace hn G (k+1)=scaleUpdate hn G (scalingTrace hn G k) i := by | |
| simp [scalingTrace,hk,i] | |
| rw [htrace] | |
| refine β¨hinv,?_β© | |
| intro a ha | |
| by_cases hak : a.val<k | |
| Β· obtain β¨j,hj,heβ© := ih.2 a hak | |
| refine β¨j,hj,?_β© | |
| exact tight_persists G _ _ ih.1 hinv (scaleUpdate_le hn G _ ih.1 i) a j hj he | |
| Β· have hai : a=i := Fin.ext (by dsimp [i]; omega) | |
| subst a | |
| exact scaleUpdate_tight hn G _ ih.1 i | |
| Β· have htrace : scalingTrace hn G (k+1)=scalingTrace hn G k := by simp [scalingTrace,hk] | |
| rw [htrace] | |
| refine β¨ih.1,?_β© | |
| intro i _ | |
| exact ih.2 i (by have := i.isLt; omega) | |
| open Finset | |
| theorem one_pass_scaling {n : β} (hn : 2 β€ n) (G : Fin n β Fin n β β) | |
| (hsym : β i j, G i j=G j i) (hG : β i j, iβ j β alpha β€ G i j β§ G i j β€ 3) : | |
| (β k i, scalingTrace hn G (k+1) i β€ scalingTrace hn G k i) β§ | |
| (β i, alpha/2 β€ scalingTrace hn G n i β§ scalingTrace hn G n i β€ 2) β§ | |
| (β i j, iβ j β G i j β€ scalingTrace hn G n i * scalingTrace hn G n j) β§ | |
| (β i, β j, jβ i β§ scalingTrace hn G n i * scalingTrace hn G n j=G i j) := by | |
| have htrace := scalingTrace_invariant hn G hsym hG | |
| refine β¨?_,(htrace n).1.lower |> fun h => ?_β© | |
| Β· intro k i | |
| by_cases hk : k<n | |
| Β· change (if h : k<n then scaleUpdate hn G (scalingTrace hn G k) β¨k,hβ© else scalingTrace hn G k) i β€ _ | |
| rw [dite_eq_left hk] | |
| exact scaleUpdate_le hn G _ (htrace k).1 β¨k,hkβ© i | |
| Β· simp [scalingTrace,hk] | |
| Β· refine β¨fun i => β¨h i,(htrace n).1.upper iβ©,(htrace n).1.feasible,?_β© | |
| intro i | |
| exact (htrace n).2 i i.isLt | |
| def rowPeak {n : β} (hn : 2 β€ n) (g : Fin n β Fin n β β) (i : Fin n) : β := | |
| (univ.erase i).sup' (others_nonempty hn i) (g i) | |
| def scaledHoleMatrix {n : β} (g : Fin n β Fin n β β) (v : Fin n β β) (i j : Fin n) : β := | |
| g i j/(v i*v j) | |
| def BalancedRows {n : β} (hn : 2 β€ n) (g : Fin n β Fin n β β) : Prop := | |
| β i, (1:β)/4 β€ rowPeak hn g i β§ rowPeak hn g i β€ 1 | |
| theorem one_pass_restores_balance {n : β} (hn : 2 β€ n) (g G : Fin n β Fin n β β) | |
| (hGsym : β i j, G i j=G j i) | |
| (hG : β i j, iβ j β alpha β€ G i j β§ G i j β€ 3) | |
| (hpre : β i, (1:β)/8 β€ rowPeak hn g i) | |
| (haccuracy : β i j, iβ j β g i j β€ G i j β§ G i j β€ g i j+2*alpha) : | |
| (β i, (1:β)/16 β€ scalingTrace hn G n i) β§ | |
| BalancedRows hn (scaledHoleMatrix g (scalingTrace hn G n)) := by | |
| let v := scalingTrace hn G n | |
| have hv := (scalingTrace_invariant hn G hGsym hG n).1 | |
| have hlow (i : Fin n) : (1:β)/16 β€ v i := by | |
| obtain β¨j,hj,heqβ© := Finset.exists_mem_eq_sup' (others_nonempty hn i) (g i) | |
| have hji := (mem_erase.mp hj).1 | |
| change rowPeak hn g i=g i j at heq | |
| have hgij : (1:β)/8 β€ g i j := by rw [β heq]; exact hpre i | |
| have hGi := (haccuracy i j hji.symm).1 | |
| have hfeas := hv.feasible i j hji.symm | |
| have hup := mul_le_mul_of_nonneg_left (hv.upper j) (hv.pos i).le | |
| dsimp [v] | |
| linarith | |
| refine β¨hlow,?_β© | |
| intro i | |
| constructor | |
| Β· obtain β¨j,hji,heqβ© := (one_pass_scaling hn G hGsym hG).2.2.2 i | |
| have hprod : (1:β)/256 β€ v i*v j := by | |
| calc | |
| (1:β)/256 = ((1:β)/16)*((1:β)/16) := by norm_num | |
| _ β€ v i*v j := mul_le_mul (hlow i) (hlow j) (by norm_num) (hv.pos i).le | |
| have hacc := (haccuracy i j hji.symm).2 | |
| have hg : (1:β)/4 β€ scaledHoleMatrix g v i j := by | |
| apply (le_div_iffβ (mul_pos (hv.pos i) (hv.pos j))).mpr | |
| change v i*v j=G i j at heq | |
| norm_num [alpha] at hacc | |
| nlinarith | |
| apply hg.trans | |
| exact Finset.le_sup' (scaledHoleMatrix g v i) (mem_erase.mpr β¨hji,mem_univ _β©) | |
| Β· apply Finset.sup'_le | |
| intro j hj | |
| have hji := (mem_erase.mp hj).1 | |
| apply (div_le_one (mul_pos (hv.pos i) (hv.pos j))).mpr | |
| exact ((haccuracy i j hji.symm).1).trans (hv.feasible i j hji.symm) | |
| def sigma (D K : β) (epsilon : β) : β := min (alpha/(100*D)) (epsilon/(1000*K)) | |
| def ratioEstimate (abar dbar : β) : β := if 0<abar then dbar/abar else 1 | |
| def upperEstimate (D : β) (dbar zbar : β) : β := | |
| if 0<dbar then max alpha (min 3 ((D:β)*zbar/dbar+alpha)) else 1 | |
| end MatchingFPRAS.Counting | |
| end OAI | |