Lean / Reader
Lean reader

omega-finite-check.lean

80 lines6 declarationsno sorryimports OAI.LinearAlgebra.SpectralBooks.ExactExponent

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports OAI.LinearAlgebra.SpectralBooks.ExactExponent, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import OAI.LinearAlgebra.SpectralBooks.ExactExponent
  2. /-!
  3. # A finite-size lower bound for circuits with division
  4. My own derivation. Each step uses a theorem of the claimant, or a copy of
  5. five lines of a private proof of the claimant (I say which). The kernel of
  6. Lean checks each proof.
  7. The model is the model `MatrixExponent.Computes` of the claimant: a
  8. straight-line circuit with the gates add, sub, mul and div. Each gate counts 1.
  9. Constants and inputs cost nothing. The field is the field of rational
  10. functions in the entries of the two input matrices.
  11. -/
  12. set_option format.width 1000
  13. namespace MobiusOtter
  14. open OAI.LinearAlgebra
  15. open OAI.MatrixMultiplication.Foundation
  16. /-- Step 1. The theorem `bilinearize` of the claimant, in the square case.
  17. A circuit with `m` gates gives a decomposition with `2 * m` terms. -/
  18. theorem circuit_gives_rank {F : Type*} [Field F] {n m : ℕ} (h : MatrixExponent.Computes F n m) :
  19. MatrixExponent.RankLE (MatrixExponent.Rat F n) n (2 * m) :=
  20. MatrixExponent.Rectangle.bilinearize h
  21. /-- Step 2. A decomposition with `r` terms over `F` gives a decomposition of the matrix tensor
  22. into `r` simple tensors. This is the forward direction of the private theorem `square_rank_iff`
  23. of the claimant (`SquareRankModel.lean`, lines 14 to 21). I copy its five proof lines. -/
  24. theorem rankAtMost_of_RankLE {F : Type*} [Field F] {n r : ℕ} (h : MatrixExponent.RankLE F n r) :
  25. Tensor.RankAtMost (SpectralBooks.matrixTensor F n n n) r := by
  26. obtain ⟨a, b, c, h⟩ := h
  27. refine ⟨a, b, fun i z => c i z.swap, ?_⟩
  28. funext x y z
  29. simpa [SpectralBooks.matrixTensor, Tensor.matrixCoefficients, Tensor.rankOne, and_comm,
  30. and_left_comm, eq_comm] using (h x y z.swap).symm
  31. /-- Step 3. A circuit with `m` gates gives a tensor rank of at most `2 * m`. -/
  32. theorem tensorRank_le_two_mul_cost {F : Type*} [Field F] {n m : ℕ}
  33. (h : MatrixExponent.Computes F n m) :
  34. SpectralBooks.tensorRank (SpectralBooks.matrixTensor (MatrixExponent.Rat F n) n n n) ≤ 2 * m :=
  35. SpectralBooks.tensorRank_le_of_rankAtMost (rankAtMost_of_RankLE (circuit_gives_rank h))
  36. /-- Step 4. The finite-size lower bound in the model of Lean.
  37. For each side length `n ≥ 2`, such a circuit has at least `⌈n^(9/4) / 2⌉` gates. -/
  38. theorem circuit_lower_bound (F : Type*) [Field F] {n m : ℕ} (hn : 2 ≤ n)
  39. (h : MatrixExponent.Computes F n m) : ⌈(n : ℝ) ^ ((9 : ℝ) / 4) / 2⌉₊ ≤ m := by
  40. have h3 := SpectralBooks.rpow_formalOmega_le_tensorRank (MatrixExponent.Rat F n) hn
  41. rw [SpectralBooks.square_exponent] at h3
  42. have h4 : (n : ℝ) ^ ((9 : ℝ) / 4) ≤ ((2 * m : ℕ) : ℝ) :=
  43. le_trans h3 (Nat.cast_le.2 (tensorRank_le_two_mul_cost h))
  44. have h5 : (n : ℝ) ^ ((9 : ℝ) / 4) ≤ 2 * (m : ℝ) := by exact_mod_cast h4
  45. rw [Nat.ceil_le, div_le_iff₀ (by norm_num : (0 : ℝ) < 2)]
  46. linarith
  47. /-- The rank form, for any field: a decomposition of the matrix tensor over `F` with `r` terms
  48. has `r ≥ n^(9/4)` for `n ≥ 2`. -/
  49. theorem rank_decomposition_lower_bound (F : Type*) [Field F] {n r : ℕ} (hn : 2 ≤ n)
  50. (h : MatrixExponent.RankLE F n r) : (n : ℝ) ^ ((9 : ℝ) / 4) ≤ (r : ℝ) := by
  51. have h3 := SpectralBooks.rpow_formalOmega_le_tensorRank F hn
  52. rw [SpectralBooks.square_exponent] at h3
  53. exact le_trans h3 (Nat.cast_le.2 (SpectralBooks.tensorRank_le_of_rankAtMost (rankAtMost_of_RankLE h)))
  54. /-- The same with the ceiling: at least `⌈n^(9/4)⌉` terms. -/
  55. theorem rank_decomposition_ceiling_lower_bound (F : Type*) [Field F] {n r : ℕ} (hn : 2 ≤ n)
  56. (h : MatrixExponent.RankLE F n r) : ⌈(n : ℝ) ^ ((9 : ℝ) / 4)⌉₊ ≤ r :=
  57. Nat.ceil_le.2 (rank_decomposition_lower_bound F hn h)
  58. end MobiusOtter
  59. -- Axioms.
  60. #print axioms MobiusOtter.circuit_gives_rank
  61. #print axioms MobiusOtter.rankAtMost_of_RankLE
  62. #print axioms MobiusOtter.tensorRank_le_two_mul_cost
  63. #print axioms MobiusOtter.circuit_lower_bound
  64. #print axioms MobiusOtter.rank_decomposition_lower_bound
  65. #print axioms MobiusOtter.rank_decomposition_ceiling_lower_bound