Exact sizes of networks that select the three or four largest of n elements
Abstract
Let Ût(n) be the least number of comparators in a (t, n)-selection network, which moves the t largest of n inputs to t given lines in any order. Alekseev proved Ût(n) ≥ (n − t)⌈lg(t + 1)⌉. For t = 2k ≥ 4 we raise this bound by k − 1 for every n > t, and by 2k − 5 when t ≥ 32; as far as we know, these are the first improvements at powers of two. For t = 4 this gives Û4(n) ≥ 3n − 11 for all n ≥ 5. The proofs follow the weights of the lines, and a finer count over all levels gives a larger gain for t = 2k with 9 ≤ k ≤ 20, by computation. With a pruning step of Yao the bounds give Ût(n) ≥ (n − t)⌈lg(t + 1)⌉ + t − 2k + k − 1 + δk for every t ≥ 2, where k = ⌊lg t⌋ and δk = max(0, k − 4), and a sharper explicit bound that is Yao's lower bound for t = 3. For t = 4, 8, 16, 32 and 64 and large n, explicit sequences show that no argument on the weights alone gives a larger gain. In 1975 Yao proved 2n − 6 + ⌈lg⌈n/3⌉⌉ ≤ Û3(n) ≤ 2n − 5 + ⌊lg(n − 3)⌋ and asked for the exact value. We prove that his upper bound is exact for 4 ≤ n ≤ 18, so that Û3(n) = 2n − 2 for 11 ≤ n ≤ 18, and that Û3(n) ≥ 2n − 2 for all n ≥ 11, which improves his lower bound for 11 ≤ n ≤ 24. We also prove Û4(n) = 3n − 10 for 6 ≤ n ≤ 12. Knuth posed Û4(n) ≤ 3n − 10 as an exercise, credited its solution to a construction of M. W. Green, and expected equality; for n = 8 the result also settles a conjecture of Qu, Tasbihi and Kschischang. These exact values come from exhaustive searches by two separately written programs at a few sizes, and from the inequality Ût(n) ≥ Ût(n − 1) + 2 for t ≥ 2 and n ≥ t + 1. With it, Yao's question reduces to the sizes n = 2j + 3, where his upper bound grows by three, and the paper gives an exact criterion for each of them in terms of the optimal networks on 2j + 2 inputs. Lead-pattern potentials on the inputs of weights 2 and 3 give Û3(n) exactly for n ≤ 6, but for n = 7 only a bound of at most 10, which is less than Û3(7). The gains k − 1 and 2k − 5 at powers of two, the bound with δk for every t, the inequality, the two results on Û3 and the values of Û4(n) for 6 ≤ n ≤ 10 are also proved in Lean 4, those on Û3 and Û4 partly through compiled checks.
In plain words
A selection network uses comparisons fixed in advance to move a chosen number of the largest values in a list into designated positions, though not necessarily in order of size. Logic solvers use selection networks to impose limits like “at most three of these are true”. In 1975 Yao asked how few comparisons such a network needs to pick out the three largest. The paper answers this question for lists of 4 to 18 numbers. For picking out the four largest from lists of 7 to 12 numbers, it confirms the comparison counts that Knuth expected. It also raises Alekseev’s 1969 lower bound on how many comparisons are needed when the number of values picked out by the network is 4, 8, 16 or any larger power of two.
Formal statement and axioms
Each main result as stated in Lean, copied verbatim from the published package, with the axioms that the proof rests on. Lean v4.35.0-rc3. The package.
LTP.Select.select_lower_pow2
Theorem A: kernel-only
theorem select_lower_pow2 (k n : Nat) (hk : 2 ≤ k) (hn : 2 ^ k + 1 ≤ n) (N : Network n) (hN : Selects (2 ^ k) n N) :
(n - 2 ^ k) * (k + 1) + (k - 1) ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Alek2.lean:378-379.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_alek.out:4.
'LTP.Select.select_lower_pow2' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.select_lower_pow2_band
Theorem B: kernel-only
theorem select_lower_pow2_band (k n : Nat) (hk : 4 ≤ k) (hn : 2 ^ k + 1 ≤ n) (N : Network n)
(hN : Selects (2 ^ k) n N) : (n - 2 ^ k) * (k + 1) + (2 * k - 5) ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Alek5.lean:639-640.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_alek.out:9.
'LTP.Select.select_lower_pow2_band' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.step
Lemma 1.4, the step lemma, in network form: kernel-only
theorem step (t n : Nat) (ht : 2 ≤ t) (hn : t + 1 ≤ n) (N : Network n) (hN : Selects t n N) :
∃ N' : Network (n - 1), Selects t (n - 1) N' ∧ N'.length + 2 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Step.lean:618-619.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:2.
'LTP.Select.step' depends on axioms: [propext, Classical.choice, Quot.sound]13 more formal statements
LTP.Select.lower_step
Lemma 1.4, the step lemma, as a transfer of lower bounds: kernel-only
theorem lower_step (t n b : Nat) (ht : 2 ≤ t) (hn : t + 1 ≤ n)
(hb : ∀ N : Network (n - 1), Selects t (n - 1) N → b ≤ N.length) :
∀ N : Network n, Selects t n N → b + 2 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Step.lean:732-734.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:3.
'LTP.Select.lower_step' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.select_lower_general
Corollary D’s second bound with δ_k = 0, used for k = ⌊lg t⌋ ≤ 4: kernel-only
theorem select_lower_general (t n k : Nat) (hk : 1 ≤ k) (hkt : 2 ^ k ≤ t) (htk : t < 2 ^ (k + 1)) (hn : t + 1 ≤ n)
(N : Network n) (hN : Selects t n N) : (n - t) * (k + 1) + (t - 2 ^ k) + (k - 1) ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/MaxStep.lean:275-276.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_alek.out:6.
'LTP.Select.select_lower_general' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.select_lower_general_band
Corollary D’s second bound with δ_k = k − 4, for k = ⌊lg t⌋ ≥ 4: kernel-only
theorem select_lower_general_band (t n k : Nat) (hk : 4 ≤ k) (hkt : 2 ^ k ≤ t) (htk : t < 2 ^ (k + 1)) (hn : t + 1 ≤ n)
(N : Network n) (hN : Selects t n N) : (n - t) * (k + 1) + (t - 2 ^ k) + (2 * k - 5) ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Alek5.lean:871-872.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_alek.out:10.
'LTP.Select.select_lower_general_band' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.U3_upper
The upper bounds of Theorem 1.1, from Yao's networks: kernel-only
theorem U3_upper (n : Nat) (h4 : 4 ≤ n) (h18 : n ≤ 18) :
Selects 3 n (yao3 n) ∧ (yao3 n).length = 2 * n - 5 + Nat.log2 (n - 3)Definitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jdef yao3 (n : Nat) : Network n := mkNet n (yaoPairs n)def mkNet (n : Nat) (ps : List (Nat × Nat)) : Network n :=
ps.filterMap fun p => if h : p.1 < p.2 ∧ p.2 < n then some ⟨p.1, p.2, h.1, h.2⟩ else nonedef yaoPairs : Nat → List (Nat × Nat)
| 4 => [(0, 1), (2, 3), (0, 2)]
| 5 => [(0, 1), (2, 3), (0, 2), (1, 3), (2, 4), (1, 2)]
| 6 => [(0, 1), (2, 3), (4, 5), (0, 2), (2, 4), (1, 3), (4, 5), (1, 4)]
| 7 => [(0, 1), (2, 3), (4, 5), (0, 2), (2, 4), (1, 3), (5, 6), (1, 5), (3, 6), (4, 5), (3, 4)]
| 8 => [(0, 1), (2, 3), (4, 5), (6, 7), (0, 2), (2, 4), (4, 6), (1, 3), (5, 7), (1, 5), (3, 7), (5, 6), (3, 5)]
| 9 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (0, 2), (2, 4), (4, 6), (1, 3), (5, 7), (6, 8), (1, 5), (5, 6), (3, 7), (6, 8),
(3, 6)]
| 10 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (0, 2), (2, 4), (4, 6), (6, 8), (1, 3), (5, 7), (8, 9), (1, 5), (5, 8),
(3, 7), (8, 9), (3, 8)]
| 11 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (0, 2), (2, 4), (4, 6), (6, 8), (1, 3), (5, 7), (9, 10), (1, 5), (5, 9),
(3, 7), (8, 10), (3, 8), (7, 10), (8, 9), (7, 8)]
| 12 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (0, 2), (2, 4), (4, 6), (6, 8), (8, 10), (1, 3), (5, 7), (9,
11), (1, 5), (5, 9), (3, 7), (10, 11), (3, 10), (7, 11), (9, 10), (7, 9)]
| 13 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (0, 2), (2, 4), (4, 6), (6, 8), (8, 10), (1, 3), (5, 7), (9,
11), (10, 12), (1, 5), (5, 9), (9, 10), (3, 7), (11, 12), (3, 11), (7, 12), (10, 11), (7, 10)]
| 14 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (12, 13), (0, 2), (2, 4), (4, 6), (6, 8), (8, 10), (10, 12),
(1, 3), (5, 7), (9, 11), (12, 13), (1, 5), (5, 9), (9, 12), (3, 7), (11, 13), (3, 11), (7, 13), (11, 12), (7, 11)]
| 15 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (12, 13), (0, 2), (2, 4), (4, 6), (6, 8), (8, 10), (10, 12),
(1, 3), (5, 7), (9, 11), (13, 14), (1, 5), (5, 9), (9, 13), (3, 7), (11, 14), (12, 13), (3, 11), (11, 12), (7,
14), (12, 13), (7, 12)]
| 16 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (12, 13), (14, 15), (0, 2), (2, 4), (4, 6), (6, 8), (8, 10),
(10, 12), (12, 14), (1, 3), (5, 7), (9, 11), (13, 15), (1, 5), (5, 9), (9, 13), (3, 7), (11, 15), (13, 14), (3,
11), (11, 13), (7, 15), (13, 14), (7, 13)]
| 17 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (12, 13), (14, 15), (0, 2), (2, 4), (4, 6), (6, 8), (8, 10),
(10, 12), (12, 14), (1, 3), (5, 7), (9, 11), (13, 15), (14, 16), (1, 5), (5, 9), (9, 13), (13, 14), (3, 7), (11,
15), (14, 16), (3, 11), (11, 14), (7, 15), (14, 16), (7, 14)]
| 18 =>
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11), (12, 13), (14, 15), (16, 17), (0, 2), (2, 4), (4, 6), (6, 8),
(8, 10), (10, 12), (12, 14), (14, 16), (1, 3), (5, 7), (9, 11), (13, 15), (16, 17), (1, 5), (5, 9), (9, 13), (13,
16), (3, 7), (11, 15), (16, 17), (3, 11), (11, 16), (7, 15), (16, 17), (7, 16)]
| _ => []abbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Upper.lean:57-58.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:86.
'LTP.Select.U3_upper' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.U4_upper
The upper bounds of Theorem 1.3 for 6 ≤ n ≤ 12: kernel-only
theorem U4_upper (n : Nat) (h6 : 6 ≤ n) (h12 : n ≤ 12) :
Selects 4 n (sel4 n) ∧ (sel4 n).length = 3 * n - 10Definitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jdef sel4 (n : Nat) : Network n := mkNet n (sel4Pairs n)def mkNet (n : Nat) (ps : List (Nat × Nat)) : Network n :=
ps.filterMap fun p => if h : p.1 < p.2 ∧ p.2 < n then some ⟨p.1, p.2, h.1, h.2⟩ else nonedef sel4Pairs : Nat → List (Nat × Nat)
| 6 => [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (1, 5)]
| 7 => [(5, 6), (3, 4), (1, 2), (4, 6), (2, 4), (3, 5), (0, 1), (1, 5), (0, 3), (1, 2), (2, 3)]
| 8 => [(0, 4), (6, 7), (0, 5), (1, 2), (4, 6), (0, 4), (2, 6), (1, 5), (5, 7), (3, 5), (2, 3), (3, 5), (1, 3), (3, 4)]
| 9 =>
[(0, 4), (4, 5), (1, 8), (1, 5), (6, 7), (0, 3), (4, 7), (0, 4), (5, 7), (2, 8), (5, 8), (1, 6), (5, 6), (3, 6),
(2, 4), (3, 5), (4, 5)]
| 10 =>
[(2, 7), (6, 7), (4, 8), (0, 2), (7, 8), (4, 9), (0, 4), (2, 5), (7, 9), (6, 9), (1, 3), (3, 8), (5, 9), (3, 5),
(1, 4), (2, 7), (3, 6), (5, 7), (5, 6), (4, 6)]
| 11 =>
[(0, 1), (0, 2), (1, 2), (2, 3), (4, 5), (1, 2), (0, 4), (2, 5), (3, 6), (3, 7), (3, 4), (7, 8), (4, 9), (5, 8),
(4, 7), (2, 7), (5, 7), (6, 7), (1, 5), (5, 6), (6, 9), (5, 6), (6, 10)]
| 12 =>
[(0, 1), (2, 3), (0, 3), (1, 2), (2, 3), (4, 5), (0, 4), (2, 6), (5, 7), (4, 5), (8, 9), (1, 8), (2, 4), (10, 11),
(3, 11), (4, 10), (3, 10), (3, 8), (9, 10), (6, 10), (6, 8), (7, 8), (5, 6), (7, 9), (6, 11), (6, 9)]
| _ => []abbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Top4/Upper.lean:24-25.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:112.
'LTP.Select.U4_upper' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.lower_3_4
Û₃(4) ≥ 3, by a certificate: kernel-only
theorem lower_3_4 : ∀ N : Network 4, Selects 3 4 N → 3 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Lower.lean:20.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:8.
'LTP.Select.lower_3_4' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.lower_3_5
Û₃(5) ≥ 6, by a certificate: kernel-only
theorem lower_3_5 : ∀ N : Network 5, Selects 3 5 N → 6 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Lower.lean:23.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:9.
'LTP.Select.lower_3_5' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.lower_3_7
Û₃(7) ≥ 11, by a certificate: kernel-only
theorem lower_3_7 : ∀ N : Network 7, Selects 3 7 N → 11 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Lower.lean:26.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:10.
'LTP.Select.lower_3_7' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.lower_4_6
Û₄(6) ≥ 8, by a certificate: kernel-only
theorem lower_4_6 : ∀ N : Network 6, Selects 4 6 N → 8 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Top4/Lower.lean:20.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:113.
'LTP.Select.lower_4_6' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.lower_4_7
Û₄(7) ≥ 11, by a certificate: kernel-only
theorem lower_4_7 : ∀ N : Network 7, Selects 4 7 N → 11 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Top4/Lower.lean:23.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:114.
'LTP.Select.lower_4_7' depends on axioms: [propext, Classical.choice, Quot.sound]LTP.Select.U3_lower_ge11
Theorem 1.2: with compiled code
theorem U3_lower_ge11 (n : Nat) (h11 : 11 ≤ n) : ∀ N : Network n, Selects 3 n N → 2 * n - 2 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Lower.lean:94.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:61-85.
'LTP.Select.U3_lower_ge11' depends on axioms: [propext,
Classical.choice,
Quot.sound,
LTP.Select.n11_d0._native.native_decide.ax_1_1,
LTP.Select.n11_d1._native.native_decide.ax_1_1,
LTP.Select.n11_d10._native.native_decide.ax_1_1,
LTP.Select.n11_d11._native.native_decide.ax_1_1,
LTP.Select.n11_d12._native.native_decide.ax_1_1,
LTP.Select.n11_d13._native.native_decide.ax_1_1,
LTP.Select.n11_d14._native.native_decide.ax_1_1,
LTP.Select.n11_d15._native.native_decide.ax_1_1,
LTP.Select.n11_d16._native.native_decide.ax_1_1,
LTP.Select.n11_d17._native.native_decide.ax_1_1,
LTP.Select.n11_d18._native.native_decide.ax_1_1,
LTP.Select.n11_d19._native.native_decide.ax_1_1,
LTP.Select.n11_d2._native.native_decide.ax_1_1,
LTP.Select.n11_d3._native.native_decide.ax_1_1,
LTP.Select.n11_d4._native.native_decide.ax_1_1,
LTP.Select.n11_d5._native.native_decide.ax_1_1,
LTP.Select.n11_d6._native.native_decide.ax_1_1,
LTP.Select.n11_d7._native.native_decide.ax_1_1,
LTP.Select.n11_d8._native.native_decide.ax_1_1,
LTP.Select.n11_d9._native.native_decide.ax_1_1,
LTP.Select.n11_depths._native.native_decide.ax_1_1,
LTP.Select.n11_start._native.native_decide.ax_1_1]LTP.Select.U3_lower
The lower bounds of Theorem 1.1 for 4 ≤ n ≤ 18: with compiled code
theorem U3_lower (n : Nat) (h4 : 4 ≤ n) (h18 : n ≤ 18) :
∀ N : Network n, Selects 3 n N → 2 * n - 5 + Nat.log2 (n - 3) ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Lower.lean:41-42.
Axioms, as Lean reports them. Recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:36-60.
'LTP.Select.U3_lower' depends on axioms: [propext,
Classical.choice,
Quot.sound,
LTP.Select.n11_d0._native.native_decide.ax_1_1,
LTP.Select.n11_d1._native.native_decide.ax_1_1,
LTP.Select.n11_d10._native.native_decide.ax_1_1,
LTP.Select.n11_d11._native.native_decide.ax_1_1,
LTP.Select.n11_d12._native.native_decide.ax_1_1,
LTP.Select.n11_d13._native.native_decide.ax_1_1,
LTP.Select.n11_d14._native.native_decide.ax_1_1,
LTP.Select.n11_d15._native.native_decide.ax_1_1,
LTP.Select.n11_d16._native.native_decide.ax_1_1,
LTP.Select.n11_d17._native.native_decide.ax_1_1,
LTP.Select.n11_d18._native.native_decide.ax_1_1,
LTP.Select.n11_d19._native.native_decide.ax_1_1,
LTP.Select.n11_d2._native.native_decide.ax_1_1,
LTP.Select.n11_d3._native.native_decide.ax_1_1,
LTP.Select.n11_d4._native.native_decide.ax_1_1,
LTP.Select.n11_d5._native.native_decide.ax_1_1,
LTP.Select.n11_d6._native.native_decide.ax_1_1,
LTP.Select.n11_d7._native.native_decide.ax_1_1,
LTP.Select.n11_d8._native.native_decide.ax_1_1,
LTP.Select.n11_d9._native.native_decide.ax_1_1,
LTP.Select.n11_depths._native.native_decide.ax_1_1,
LTP.Select.n11_start._native.native_decide.ax_1_1]LTP.Select.U4_lower
The lower bounds of Theorem 1.3 for 6 ≤ n ≤ 10: with compiled code
theorem U4_lower (n : Nat) (h6 : 6 ≤ n) (h10 : n ≤ 10) :
∀ N : Network n, Selects 4 n N → 3 * n - 10 ≤ N.lengthDefinitions used in the statement
def Selects (t n : Nat) (N : Network n) : Prop :=
∀ v : Nat → Nat, ∀ i j : Nat, i < n - t → n - t ≤ j → j < n → N.eval v i ≤ N.eval v jabbrev Network (m : Nat) := List (Comparator m)structure Comparator (m : Nat) where
lo : Nat
hi : Nat
lt : lo < hi
bound : hi < mdef Comparator.apply (c : Comparator m) (v : Nat → Nat) : Nat → Nat :=
fun k => if k = c.lo then min (v c.lo) (v c.hi) else if k = c.hi then max (v c.lo) (v c.hi) else v kdef Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
N.foldl (fun w c => c.apply w) vSource: Zenodo record 23822160, sel_lean_record.tar.gz/sel_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Select/Top4/Lower.lean:36-37.
Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 67 more, for example LTP.Select.t4n10_d0_p0._native.native_decide.ax_1_1, LTP.Select.t4n10_d10_p0._native.native_decide.ax_1_1 and LTP.Select.t4n10_d10_p1._native.native_decide.ax_1_1. Each of these 67 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:23822160/sel_lean_record.tar.gz/sel_lean_record/axioms/axioms_select.out:191-260.