Module

NatEqMacaulayPowLeMacaulayPow.lean

Nyll.SchemeTheory.RingTheory.Polynomial.NatEqMacaulayPowLeMacaulayPow
19 declarations indexed from sourceView source ↗

Nat exists forall eq macaulay Pow of forall le macaulay Pow

Imports24
  • Batteries.Tactic.Init
  • Mathlib.Algebra.Group.Monoid
  • Mathlib.Algebra.Group.Nat.Defs
  • Mathlib.Algebra.Group.Semigroup
  • Mathlib.Data.DFinsupp.WellFounded
  • Mathlib.Data.Fintype.Basic
  • Mathlib.Data.Fintype.EquivFin
  • Mathlib.Data.Nat.Basic
  • Mathlib.Data.Nat.Choose.Basic
  • Mathlib.Data.Nat.Find
  • Mathlib.Data.Nat.Init
  • Mathlib.Data.Set.Operations
  • Mathlib.Order.Basic
  • Mathlib.Order.Defs.LinearOrder
  • Mathlib.Order.Defs.PartialOrder
  • Mathlib.Order.Fin.Basic
  • Mathlib.Order.Monotone.Basic
  • Mathlib.Order.Monotone.Defs
  • Mathlib.Order.PiLex
  • Mathlib.Order.RelClasses
  • Mathlib.Order.WellFounded
  • Mathlib.Tactic.Push
  • Mathlib.Tactic.Set
  • Nyll.SchemeTheory.RingTheory.Polynomial.Macaulay
Imported by4

Declarations

AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec

The sequence obtained recursively from the top indices and remainders of the binomial expansion.

Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
def vec : ℕ → ℕ → ℕ → ℕ
  | 0, _, _ => 0
  | d + 1, a, 0 => top d a - d
  | d + 1, a, p + 1 => vec d (rem d a) p
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_zero
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_zero (a p : ℕ) : vec 0 a p = 0
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_succ_zero
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_succ_zero (d a : ℕ) : vec (d + 1) a 0 = top d a - d
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_succ_succ
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_succ_succ (d a p : ℕ) : vec (d + 1) a (p + 1) = vec d (rem d a) p
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_macaulayPow
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_macaulayPow : ∀ (d a : ℕ), vec (d + 1) (Nat.macaulayPow d a) = vec d a
  | 0, a => by
      funext p
      cases p with
      | zero =>
          simp only [macaulayPow_zero, vec_succ_zero, top_zero_right, Nat.sub_self, vec_zero]
      | succ p => simp only [vec_succ_succ, vec_zero]
  | d + 1, a => by
      funext p
      cases p with
      | zero =>
          simp only [vec_succ_zero, top_macaulayPow]
          omega
      | succ p =>
          simp only [vec_succ_succ, rem_macaulayPow]
          rw [vec_macaulayPow d (rem d a)]
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_eq_zero_of_le
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_eq_zero_of_le : ∀ (d a p : ℕ), d ≤ p → vec d a p = 0
  | 0, _, _, _ => rfl
  | d + 1, a, 0, h => by omega
  | d + 1, a, p + 1, h => by
      simp only [vec_succ_succ]; exact vec_eq_zero_of_le d _ p (by omega)
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_succ_le
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_succ_le : ∀ (d a p : ℕ), vec d a (p + 1) ≤ vec d a p
  | 0, _, _ => le_rfl
  | d + 1, a, p + 1 => by
      simp only [vec_succ_succ]; exact vec_succ_le d _ p
  | 0 + 1, a, 0 => Nat.zero_le _
  | (e + 1) + 1, a, 0 => by
      simp only [vec_succ_succ, vec_succ_zero]
      have h := rem_lt (e + 1) a
      have := top_lt_of_lt_choose e (rem (e + 1) a) (top (e + 1) a) h
      omega
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_antitone
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_antitone (d a : ℕ) : Antitone (vec d a)
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.lex_vec_of_lt
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem lex_vec_of_lt : ∀ (d : ℕ) {a b : ℕ}, a < b →
    Pi.Lex (· < ·) (fun {_} => (· < ·)) (vec (d + 1) a) (vec (d + 1) b)
  | 0, a, b, h => ⟨0, fun j hj => (Nat.not_lt_zero j hj).elim,
      by simpa only [vec_succ_zero, top_zero_left, Nat.sub_zero] using h⟩
  | d + 1, a, b, h => by
      rcases lt_trichotomy (top (d + 1) a) (top (d + 1) b) with ht | ht | ht
      · refine ⟨0, fun j hj => (Nat.not_lt_zero j hj).elim, ?_⟩
        have := d_le_top (d + 1) a
        simp only [vec_succ_zero]
        omega
      · have hrem : rem (d + 1) a < rem (d + 1) b := by
          have ha := rem_add_choose (d + 1) a
          have hb := rem_add_choose (d + 1) b
          rw [ht] at ha; omega
        obtain ⟨i, hi, hlt⟩ := lex_vec_of_lt d hrem
        refine ⟨i + 1, fun j hj => ?_, by simpa only [vec_succ_succ] using hlt⟩
        cases j with
        | zero => simp only [vec_succ_zero, ht]
        | succ j => simpa only [vec_succ_succ] using hi j (by omega)
      · exfalso
        have h1 := lt_choose_top_succ (d + 1) b
        have h2 : (top (d + 1) b + 1).choose (d + 1 + 1) ≤ (top (d + 1) a).choose (d + 1 + 1) :=
          Nat.choose_le_choose _ ht
        have h3 := choose_top_le (d + 1) a
        omega
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.not_lex_self
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem not_lex_self (x : ℕ → ℕ) : ¬ Pi.Lex (· < ·) (fun {_} => (· < ·)) x x := by
  rintro ⟨i, -, h⟩; exact lt_irrefl _ h
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.vec_injective
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem vec_injective (d : ℕ) {a b : ℕ} (h : vec (d + 1) a = vec (d + 1) b) : a = b
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.eq_or_lex_of_le
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem eq_or_lex_of_le (d : ℕ) {a b : ℕ} (h : a ≤ b) :
    vec (d + 1) a = vec (d + 1) b ∨
      Pi.Lex (· < ·) (fun {_} => (· < ·)) (vec (d + 1) a) (vec (d + 1) b) := by
  rcases h.eq_or_lt with h | h
  · exact Or.inl (by rw [h])
  · exact Or.inr (lex_vec_of_lt d h)
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.head_le_of_eq_or_lex
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem head_le_of_eq_or_lex {x y : ℕ → ℕ}
    (h : x = y ∨ Pi.Lex (· < ·) (fun {_} => (· < ·)) x y) : x 0 ≤ y 0 := by
  rcases h with h | ⟨i, hi, hlt⟩
  · rw [h]
  · cases i with
    | zero => exact hlt.le
    | succ i => exact (hi 0 (by omega)).le
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.cnt

The first index where the sequence falls below the threshold, or zero if there is no such index.

Source context 7 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
open Classical in
def cnt (t : ℕ) (x : ℕ → ℕ) : ℕ
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.cnt_eq
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem cnt_eq (t : ℕ) (x : ℕ → ℕ) (h : ∃ p, x p < t) : cnt t x = Nat.find h
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.cv

The finite vector of threshold-crossing indices for descending thresholds.

Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
def cv (M : ℕ) (x : ℕ → ℕ) : Fin M → ℕ
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.cv_lex
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem cv_lex {M : ℕ} {x y : ℕ → ℕ} (hy : Antitone y) (hyM : y 0 ≤ M) (hy0 : ∃ q, y q = 0)
    (h : Pi.Lex (· < ·) (fun {_} => (· < ·)) x y) :
    Pi.Lex (· < ·) (fun {_} => (· < ·)) (cv M x) (cv M y) := by
  obtain ⟨p, hp, hlt⟩ := h
  set t := y p with ht
  have ht1 : 1 ≤ t := by simp only [ht]; omega
  have htM : t ≤ M := (hy (Nat.zero_le p)).trans hyM
  refine ⟨⟨M - t, by omega⟩, fun j hj => ?_, ?_⟩
  · have hj' : (j : ℕ) < M - t := hj
    set t' := M - (j : ℕ) with ht'
    have htt' : t < t' := by omega
    have hey : ∃ q, y q < t' := ⟨p, by omega⟩
    change cnt t' x = cnt t' y
    rw [cnt_eq t' y hey]
    set c := Nat.find hey with hc
    have hcspec : y c < t' := Nat.find_spec hey
    have hcmin : ∀ q < c, ¬ y q < t' := fun q hq => Nat.find_min hey hq
    have hcp : c ≤ p := Nat.find_min' hey (show y p < t' by omega)
    have hex : ∃ q, x q < t' := ⟨c, by
      rcases hcp.eq_or_lt with h | h
      · rw [h]; omega
      · rw [hp c h]; exact hcspec⟩
    rw [cnt_eq t' x hex, Nat.find_eq_iff]
    refine ⟨?_, fun q hq => ?_⟩
    · rcases hcp.eq_or_lt with h | h
      · rw [h]; omega
      · rw [hp c h]; exact hcspec
    · rw [hp q (by omega)]; exact hcmin q hq
  · change cnt (M - (M - t)) x < cnt (M - (M - t)) y
    have hMt : M - (M - t) = t := by omega
    rw [hMt]
    have hex : ∃ q, x q < t := ⟨p, hlt⟩
    have hey : ∃ q, y q < t := by obtain ⟨q, hq⟩ := hy0; exact ⟨q, by omega⟩
    rw [cnt_eq t x hex, cnt_eq t y hey]
    have h1 : Nat.find hex = p := by
      rw [Nat.find_eq_iff]
      refine ⟨hlt, fun q hq => ?_⟩
      rw [hp q hq]
      have := hy hq.le
      omega
    rw [h1, Nat.lt_find_iff]
    intro q hq
    have := hy hq
    omega
AlgebraicCurves.Foundations.Algebra.Proofs.Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow.GotzNum.eventually_eq
Source context 6 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
namespace GotzNum
theorem eventually_eq (H : ℕ → ℕ) (d₀ : ℕ)
    (hH : ∀ d, d₀ ≤ d → H (d + 1) ≤ Nat.macaulayPow d (H d)) :
    ∃ D₀ : ℕ, ∀ e, D₀ ≤ e → H (e + 1) = Nat.macaulayPow e (H e)
Nat.exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
Source context 9 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
open _root_.Nat.Macaulay
namespace AlgebraicCurves.Foundations.Algebra.Proofs
namespace Nat_exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
attribute [local simp] GotzNum.vec_zero
attribute [local simp] GotzNum.vec_succ_zero
attribute [local simp] GotzNum.vec_succ_succ
open GotzNum in
theorem _root_.Nat.exists_forall_eq_macaulayPow_of_forall_le_macaulayPow
    (H : ℕ → ℕ) (d₀ : ℕ) (_hd₀ : 1 ≤ d₀)
    (hH : ∀ d, d₀ ≤ d → H (d + 1) ≤ Nat.macaulayPow d (H d)) :
    ∃ D₀ : ℕ, ∀ e, D₀ ≤ e → H (e + 1) = Nat.macaulayPow e (H e)