October 2026 · Preprint

Lead-pattern potentials and exact values of merging networks

Abstract

Let M(m,n) be the least number of comparators in a network that merges sorted lists of lengths m and n. We prove M(5,7) = 18, M(6,8) = 22, M(6,9) = 25, M(7,9) = 27, M(8,9) = 29, M(5,15) = 35, M(5,10) = 25, M(5,11) = 27, M(5,12) = 29 and M(6,10) = 27. We also prove M(5,n) = C(5,n) for all n, where C(m,n) is the size of Batcher's odd-even merge, and M(6,8k) = 18k+4 for all k ≥ 1; these formulas give M(5,23) = 52 and M(6,24) = 58. For m = 7 we prove M(7,16) = 43 and M(7,24) = 62. Morohashi's 2009 thesis lists M(5,7), M(6,8), M(6,9), M(7,9), M(8,9), M(5,15), M(5,23), M(6,24) and M(7,24) as open, and for M(5,10), M(5,11), M(5,12), M(6,10) and M(7,16) we know of no published determination. The formula for M(6,8k) is new, and so is the one for M(5,n) when n ≡ 2, 3, 4, 7 (mod 8); for n ≡ 6 (mod 8) Amano and Maruoka sketched a proof, but we know of no complete published proof. In all these cases Batcher's odd-even merge is optimal. Each lead of a network computes a monotone Boolean function of its input, and a comparator replaces two such functions by their disjunction and conjunction, so a potential on these functions that grows by at most one at each comparator bounds the size of the network from below. The best such bound is the optimum of a linear program. For merging networks its solutions round to exact rational certificates, which are checked by two separately written programs. For sorting networks on six channels a sharper variant of the program attains the least size, 12, so a single certificate proves this lower bound. The ten values, the formulas and the values for m = 7 are also proved in Lean 4, where the checks run as compiled code; the formula for M(6,8k) and the formula for M(5,n) with n ≥ 5 and n ≡ 0, 1, 5, 6, 7 (mod 8) also have proofs checked by the kernel alone. Potentials in closed form, each proved feasible for every n of a residue class by a finite check, give these formulas and values. They also give new proofs of the formulas for M(2,n) and M(3,n); of Iwata's theorems on M(4,n) for odd n, on M(5,n) for n ≡ 0, 1, 5 (mod 8) and on M(6,8k+6); of the theorems of Morohashi and Iwata on M(6,8k+7) and M(7,8); and of Iwata's linear coefficient.

In plain words

A merging network combines two sorted lists into one sorted list by a fixed sequence of comparators, each of which swaps two values if they are out of order. Such networks suit hardware that sorts in parallel, and in 1968 Batcher published an efficient design, the odd-even merge. A table of selected list lengths in Morohashi’s 2009 thesis left the least number of comparators open for seventeen pairs. This paper settles nine of them, and for each of these pairs Batcher’s odd-even merge uses the fewest comparators possible.

Twelve horizontal wires, the top five starting with short teal segments and the bottom seven with short magenta segments, crossed by 18 vertical bars with round ends in yellow, green and orange, arranged in four layers.
Illustration of Batcher’s odd-even merging network for sorted lists of lengths 5 and 7. Its 18 comparators are the fewest possible: the paper proves M(5, 7) = 18. The first list enters on the five top wires (teal) and the second list enters on the seven bottom wires (magenta). Each vertical bar compares the values on its two wires and swaps them if they are out of order, and the bar colours mark the four layers, the first and last both yellow.

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.M_5_7

M(5, 7) = 18: with compiled code

theorem M_5_7 : MinMergeGen 5 7 18
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L50-L50.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L675-L687.

'LTP.M_5_7' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.D_M5_7.phi_val._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C00.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C01.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C02.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C03.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C04.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C05.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C06.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C07.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M5_7.C08.chunk._native.native_decide.ax_1_1]

LTP.Closed.M5m4.M5_all

Theorem 7.6, M(5, n) = C(5, n) for all n ≥ 1: with compiled code

theorem M5_all (n : Nat) (hn : 1 ≤ n) : MinMergeGen 5 n (C 5 n)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j
def C (m n : Nat) : Nat := batcherC (m + n) m n
def batcherC : Nat → Nat → Nat → Nat
  | 0, _, _ => 0
  | fuel + 1, m, n =>
    if m = 0 ∨ n = 0 then 0
    else if m = 1 ∧ n = 1 then 1
    else batcherC fuel ((m + 1) / 2) ((n + 1) / 2) + batcherC fuel (m / 2) (n / 2) + (m + n - 1) / 2

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M5m4.lean:L178-L178.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 280 more, for example LTP.Closed.M5.cfg_even._native.native_decide.ax_1_1, LTP.Closed.M5.cfg_odd._native.native_decide.ax_1_1 and LTP.Closed.M5.phi_even_6._native.native_decide.ax_1_1. Each of these 280 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_v4.out:L950-L1232.

LTP.Closed.M6K.M6_8k

Theorem 7.7 for n = 8k, M(6, 8k) = 18k + 4: kernel-only

theorem M6_8k (k : Nat) (hk : 1 ≤ k) : MinMergeGen 6 (8 * k) (18 * k + 4)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M6K.lean:L67-L67.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_v4.out:L6-L6.

'LTP.Closed.M6K.M6_8k' depends on axioms: [propext, Classical.choice, Quot.sound]
21 more formal statements

LTP.M_6_8

M(6, 8) = 22: with compiled code

theorem M_6_8 : MinMergeGen 6 8 22
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L51-L51.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L688-L701.

'LTP.M_6_8' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.D_M6_8.phi_val._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C00.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C01.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C02.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C03.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C04.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C05.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C06.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C07.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C08.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_8.C09.chunk._native.native_decide.ax_1_1]

LTP.M_6_9

M(6, 9) = 25: with compiled code

theorem M_6_9 : MinMergeGen 6 9 25
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L52-L52.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L702-L716.

'LTP.M_6_9' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.D_M6_9.phi_val._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C00.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C01.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C02.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C03.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C04.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C05.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C06.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C07.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C08.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C09.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_9.C10.chunk._native.native_decide.ax_1_1]

LTP.M_7_9

M(7, 9) = 27: with compiled code

theorem M_7_9 : MinMergeGen 7 9 27
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L55-L55.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 67 more, for example LTP.Certs.D2_M7_9.phi_val._native.native_decide.ax_1_1, LTP.Certs.D2_M7_9.C00_00.chunk._native.native_decide.ax_1_1 and LTP.Certs.D2_M7_9.C01_00.chunk._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:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L757-L826.

LTP.M_8_9

M(8, 9) = 29: with compiled code

theorem M_8_9 : MinMergeGen 8 9 29
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L57-L57.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 287 more, for example LTP.Certs.D3_M8_9.phi_val._native.native_decide.ax_1_1, LTP.Certs.D3_M8_9.C00_00_00.chunk._native.native_decide.ax_1_1 and LTP.Certs.D3_M8_9.C01_00_00.chunk._native.native_decide.ax_1_1. Each of these 287 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L984-L1273.

LTP.M_5_15

M(5, 15) = 35: with compiled code

theorem M_5_15 : MinMergeGen 5 15 35
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L56-L56.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 154 more, for example LTP.Certs.D2_M5_15.phi_val._native.native_decide.ax_1_1, LTP.Certs.D2_M5_15.C00_00.chunk._native.native_decide.ax_1_1 and LTP.Certs.D2_M5_15.C01_00.chunk._native.native_decide.ax_1_1. Each of these 154 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L827-L983.

LTP.M_5_10

M(5, 10) = 25: with compiled code

theorem M_5_10 : MinMergeGen 5 10 25
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L47-L47.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L660-L664.

'LTP.M_5_10' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.M5_10.check._native.native_decide.ax_1_1,
 LTP.Certs.M5_10.phi_val._native.native_decide.ax_1_1]

LTP.M_5_11

M(5, 11) = 27: with compiled code

theorem M_5_11 : MinMergeGen 5 11 27
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L48-L48.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L665-L669.

'LTP.M_5_11' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.M5_11.check._native.native_decide.ax_1_1,
 LTP.Certs.M5_11.phi_val._native.native_decide.ax_1_1]

LTP.M_5_12

M(5, 12) = 29: with compiled code

theorem M_5_12 : MinMergeGen 5 12 29
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L49-L49.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L670-L674.

'LTP.M_5_12' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.M5_12.check._native.native_decide.ax_1_1,
 LTP.Certs.M5_12.phi_val._native.native_decide.ax_1_1]

LTP.M_6_10

M(6, 10) = 27: with compiled code

theorem M_6_10 : MinMergeGen 6 10 27
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Main.lean:L53-L53.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_final_v2.out:L717-L732.

'LTP.M_6_10' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Certs.D_M6_10.phi_val._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C00.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C01.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C02.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C03.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C04.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C05.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C06.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C07.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C08.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C09.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C10.chunk._native.native_decide.ax_1_1,
 LTP.Certs.D_M6_10.C11.chunk._native.native_decide.ax_1_1]

LTP.Closed.M7.M7_16

Theorem 7.8, M(7, 16) = 43: with compiled code

theorem M7_16 : MinMergeGen 7 16 43
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M7.lean:L61-L61.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 170 more, for example LTP.Closed.M7.phi_16._native.native_decide.ax_1_1, LTP.Closed.M7.P1.K00.all_0._native.native_decide.ax_1 and LTP.Closed.M7.P1.K01.all_1._native.native_decide.ax_1. Each of these 170 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_m7.out:L868-L1040.

LTP.Closed.M7.M7_24

Theorem 7.8, M(7, 24) = 62: with compiled code

theorem M7_24 : MinMergeGen 7 24 62
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M7.lean:L57-L57.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 170 more, for example LTP.Closed.M7.phi_24._native.native_decide.ax_1_1, LTP.Closed.M7.P1.K00.all_0._native.native_decide.ax_1 and LTP.Closed.M7.P1.K01.all_1._native.native_decide.ax_1. Each of these 170 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_m7.out:L695-L867.

LTP.Cube.B6.S6

S(6) = 12 for sorting networks on six channels: with compiled code

theorem S6 : (∀ N : Network 6, Sorts 6 N → 12 ≤ N.length) ∧ ∃ N : Network 6, Sorts 6 N ∧ N.length = 12
Definitions used in the statement
def Sorts (c : Nat) (N : Network c) : Prop := ∀ v : Nat → Nat, Sorted c (N.eval v)
abbrev Network (m : Nat) := List (Comparator m)
structure Comparator (m : Nat) where
  lo : Nat
  hi : Nat
  lt : lo < hi
  bound : hi < m
def 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 k
def Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Cube/B6.lean:L46-L46.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_cube.out:L13-L20.

'LTP.Cube.B6.S6' depends on axioms: [propext,
 Classical.choice,
 Quot.sound,
 LTP.Cube.B6.check_true._native.native_decide.ax_1_1,
 LTP.Cube.B6.coverOK_true._native.native_decide.ax_1_1,
 LTP.Cube.B6.invOK_true._native.native_decide.ax_1_1,
 LTP.Cube.B6.phi_eq._native.native_decide.ax_1_1,
 LTP.Cube.B6.repsOK_true._native.native_decide.ax_1_1]

LTP.Closed.upper

Batcher’s network merges any two sorted lists with C(a, b) comparators: kernel-only

theorem upper (a b : Nat) : ∃ N : Network (a + b), Merges a b N ∧ N.length = C a b
Definitions used in the statement
def C (m n : Nat) : Nat := batcherC (m + n) m n
def batcherC : Nat → Nat → Nat → Nat
  | 0, _, _ => 0
  | fuel + 1, m, n =>
    if m = 0 ∨ n = 0 then 0
    else if m = 1 ∧ n = 1 then 1
    else batcherC fuel ((m + 1) / 2) ((n + 1) / 2) + batcherC fuel (m / 2) (n / 2) + (m + n - 1) / 2
def Merges (a b : Nat) (N : Network (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (N.eval v)
abbrev Network (m : Nat) := List (Comparator m)
structure Comparator (m : Nat) where
  lo : Nat
  hi : Nat
  lt : lo < hi
  bound : hi < m
def 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 k
def Network.eval (N : Network m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/BatcherC.lean:L134-L134.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L16-L16.

'LTP.Closed.upper' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.KernelCerts.M_5_7

M(5, 7) = 18, second proof: kernel-only

theorem M_5_7 : MinMergeGen 5 7 18
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/KernelCerts/Values.lean:L17-L17.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L181-L181.

'LTP.KernelCerts.M_5_7' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M5K.M5_8k

Theorem 7.6 for n = 8k with k ≥ 1: kernel-only

theorem M5_8k (k : Nat) (hk : 1 ≤ k) : MinMergeGen 5 (8 * k) (17 * k + 3)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M5K.lean:L78-L78.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L146-L146.

'LTP.Closed.M5K.M5_8k' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M5K.M5_8k1

Theorem 7.6 for n = 8k + 1 with k ≥ 1: kernel-only

theorem M5_8k1 (k : Nat) (hk : 1 ≤ k) : MinMergeGen 5 (8 * k + 1) (17 * k + 5)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M5K.lean:L83-L83.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L147-L147.

'LTP.Closed.M5K.M5_8k1' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M5K.M5_8k5

Theorem 7.6 for n = 8k + 5: kernel-only

theorem M5_8k5 (k : Nat) : MinMergeGen 5 (8 * k + 5) (17 * k + 13)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M5K.lean:L88-L88.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L148-L148.

'LTP.Closed.M5K.M5_8k5' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M5K.M5_8k6

Theorem 7.6 for n = 8k + 6: kernel-only

theorem M5_8k6 (k : Nat) : MinMergeGen 5 (8 * k + 6) (17 * k + 16)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M5K.lean:L73-L73.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L145-L145.

'LTP.Closed.M5K.M5_8k6' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M5K.M5_8k7

Theorem 7.6 for n = 8k + 7: kernel-only

theorem M5_8k7 (k : Nat) : MinMergeGen 5 (8 * k + 7) (17 * k + 18)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M5K.lean:L68-L68.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_closed.out:L144-L144.

'LTP.Closed.M5K.M5_8k7' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M6K.M6_8k6

Theorem 7.7 for n = 8k + 6, M(6, 8k + 6) = 18k + 17: kernel-only

theorem M6_8k6 (k : Nat) : MinMergeGen 6 (8 * k + 6) (18 * k + 17)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M6K.lean:L72-L72.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_v4.out:L7-L7.

'LTP.Closed.M6K.M6_8k6' depends on axioms: [propext, Classical.choice, Quot.sound]

LTP.Closed.M6K.M6_8k7

Theorem 7.7 for n = 8k + 7, M(6, 8k + 7) = 18k + 20: kernel-only

theorem M6_8k7 (k : Nat) : MinMergeGen 6 (8 * k + 7) (18 * k + 20)
Definitions used in the statement
def MinMergeGen (a b s : Nat) : Prop :=
  (∀ σ ρ : Perm (a + b), ∀ N : GNetwork (a + b), GMerges a b σ ρ N → s ≤ N.length) ∧
  ∃ σ ρ : Perm (a + b), ∃ N : GNetwork (a + b), GMerges a b σ ρ N ∧ N.length = s
structure Perm (m : Nat) where
  f : Nat → Nat
  g : Nat → Nat
  hf : ∀ k, k < m → f k < m
  hg : ∀ k, k < m → g k < m
  gf : ∀ k, k < m → g (f k) = k
  fg : ∀ k, k < m → f (g k) = k
abbrev GNetwork (m : Nat) := List (GComparator m)
structure GComparator (m : Nat) where
  p : Nat
  q : Nat
  ne : p ≠ q
  hp : p < m
  hq : q < m
def GComparator.apply (c : GComparator m) (v : Nat → Nat) : Nat → Nat :=
  fun k => if k = c.p then min (v c.p) (v c.q) else if k = c.q then max (v c.p) (v c.q) else v k
def GNetwork.eval (N : GNetwork m) (v : Nat → Nat) : Nat → Nat :=
  N.foldl (fun w c => c.apply w) v
def GMerges (a b : Nat) (σ ρ : Perm (a + b)) (N : GNetwork (a + b)) : Prop :=
  ∀ v : Nat → Nat, TwoChain a b v → Sorted (a + b) (fun k => N.eval (fun c => v (σ.g c)) (ρ.f k))
def TwoChain (a b : Nat) (v : Nat → Nat) : Prop :=
  (∀ i j : Nat, i ≤ j → j < a → v i ≤ v j) ∧ (∀ i j : Nat, a ≤ i → i ≤ j → j < a + b → v i ≤ v j)
def Sorted (m : Nat) (v : Nat → Nat) : Prop :=
  ∀ i j : Nat, i ≤ j → j < m → v i ≤ v j

Source: Zenodo record 23756852, ltp_lean_record.tar.gz/ltp_lean_record/ltp_lean_src.tar.gz/ltp_lean/LTP/Closed/M6K.lean:L77-L77.

Axioms, as Lean reports them. Recorded in zenodo:23756852/ltp_lean_record.tar.gz/ltp_lean_record/axioms/axioms_v4.out:L8-L8.

'LTP.Closed.M6K.M6_8k7' depends on axioms: [propext, Classical.choice, Quot.sound]