cfahlgren1/math / lean /OAI /Computability /VPVNP /BalancedGrammar.lean
cfahlgren1's picture
download
raw
4.5 kB
import OAI.Computability.VPVNP.ParseGrammar
import OAI.Computability.VPVNP.GradedComponents
import Mathlib.RingTheory.Ideal.Operations
/-! # Balanced degree factors of a graded circuit grammar
Section 4.2 uses the ideal generated by states of degree between one third and
two thirds of the output degree. In a binary production above that interval, at
least one child reaches its lower endpoint. This expresses the output as a sum
of multiples of the balanced states. Homogeneous projection retains only the
complementary degree of each multiplier.
-/
namespace OAI
namespace Computability
namespace VPVNP
namespace ParseGrammar
open MvPolynomial
variable {R V H : Type*} [CommSemiring R] [Fintype V] [Fintype H] {n : ℕ}
/-- States whose declared degree lies in the balanced interval for `ℓ`. -/
abbrev BalancedIndex (n : ℕ) (H : Type*) (ℓ : ℕ) :=
{s : Fin n × H // ℓ ≤ 3 * (s.1.val + 1) ∧ 3 * (s.1.val + 1) ≤ 2 * ℓ}
/-- The ideal generated by all balanced states. -/
noncomputable def balancedIdeal (G : ParseGrammar R V H n) (ℓ : ℕ) : Ideal (MvPolynomial V R) :=
Ideal.span (Set.range (fun s : BalancedIndex n H ℓ => G.eval s.val.1 s.val.2))
/-- A state at or above the lower endpoint of the interval belongs to the balanced ideal. -/
theorem eval_mem_balancedIdeal (G : ParseGrammar R V H n) (ℓ : ℕ) (hℓ : 3 ≤ ℓ)
(d : Fin n) (h : H) (hdeg : ℓ ≤ 3 * (d.val + 1)) : G.eval d h ∈ G.balancedIdeal ℓ := by
induction d using (measure (fun d : Fin n => d.val)).wf.induction generalizing h with
| h d ih =>
by_cases upper : 3 * (d.val + 1) ≤ 2 * ℓ
· exact Ideal.subset_span ⟨⟨(d, h), hdeg, upper⟩, rfl⟩
· rw [G.eval_binary (by omega) h]
refine (G.balancedIdeal ℓ).sum_mem (fun b _ => (G.balancedIdeal ℓ).sum_mem
(fun i _ => (G.balancedIdeal ℓ).sum_mem (fun j _ => ?_)))
have sumDeg := split_degrees d b
by_cases left : ℓ ≤ 3 * ((leftDegree d b).val + 1)
· exact (G.balancedIdeal ℓ).mul_mem_right _
((G.balancedIdeal ℓ).mul_mem_left _ (ih _ (leftDegree_lt d b) i left))
· exact (G.balancedIdeal ℓ).mul_mem_left _ (ih _ (rightDegree_lt d b) j (by omega))
/-- Explicit linear combination indexed by the balanced states, with polynomial coefficients. -/
theorem exists_balanced_expansion (G : ParseGrammar R V H n) (ℓ : ℕ) (hℓ : 3 ≤ ℓ)
(d : Fin n) (h : H) (hdeg : ℓ ≤ 3 * (d.val + 1)) :
∃ m : BalancedIndex n H ℓ → MvPolynomial V R,
G.eval d h = ∑ b, m b * G.eval b.val.1 b.val.2 := by
obtain ⟨m, hm⟩ := Ideal.mem_span_range_iff_exists_fun.mp (G.eval_mem_balancedIdeal ℓ hℓ d h hdeg)
exact ⟨m, hm.symm⟩
omit [Fintype V] in
private theorem component_mul_homogeneous {p q : MvPolynomial V R} {j t : ℕ}
(hq : q.IsHomogeneous j) (hjt : j ≤ t) :
homogeneousComponent t (p * q) = homogeneousComponent (t - j) p * q := by
classical
rw [homogeneousComponent_mul, Finset.sum_eq_single (t - j, j)]
· rw [homogeneousComponent_eq_self hq]
· rintro ⟨a, b⟩ hab hneq
have hs : a + b = t := Finset.mem_antidiagonal.mp hab
have hb : b ≠ j := by rintro rfl; apply hneq; congr 1; omega
simp [homogeneousComponent_of_mem hq, hb]
· intro hn
exact (hn (Finset.mem_antidiagonal.mpr (by simpa using Nat.sub_add_cancel hjt))).elim
/-- Above the balanced interval, each multiplier may be taken homogeneous of
exactly the complementary degree. -/
theorem exists_homogeneous_balanced_expansion (G : ParseGrammar R V H n) (ℓ : ℕ) (hℓ : 3 ≤ ℓ)
(d : Fin n) (h : H) (high : 2 * ℓ < 3 * (d.val + 1)) :
∃ m : BalancedIndex n H ℓ → MvPolynomial V R,
(∀ b, (m b).IsHomogeneous (d.val + 1 - (b.val.1.val + 1))) ∧
G.eval d h = ∑ b, m b * G.eval b.val.1 b.val.2 := by
obtain ⟨m, hm⟩ := G.exists_balanced_expansion ℓ hℓ d h (by omega)
refine ⟨fun b => homogeneousComponent (d.val + 1 - (b.val.1.val + 1)) (m b),
fun _ => homogeneousComponent_isHomogeneous _ _, ?_⟩
calc
G.eval d h = homogeneousComponent (d.val + 1) (G.eval d h) :=
(homogeneousComponent_eq_self (G.eval_isHomogeneous d h)).symm
_ = ∑ b, homogeneousComponent (d.val + 1) (m b * G.eval b.val.1 b.val.2) := by
rw [hm, map_sum]
_ = _ := by
refine Finset.sum_congr rfl fun b _ => component_mul_homogeneous (G.eval_isHomogeneous ..) ?_
have := b.property.2
omega
end ParseGrammar
end VPVNP
end Computability
end OAI

Xet Storage Details

Size:
4.5 kB
·
Xet hash:
52603b8c78ffb987a0771a4b97a34aa57435325bc93e7180b274087ac2e9b70d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.