finished refactoring

This commit is contained in:
Andre 2023-06-16 17:37:02 -04:00
parent 9e8e2860ca
commit 01fb5fbd8b

View file

@ -5,7 +5,7 @@ import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
set_option maxHeartbeats 0 set_option maxHeartbeats 0
macro "ls" : tactic => `(tactic|library_search) macro "ls" : tactic => `(tactic|library_search)
-- New tactic "obviously" -- From Kyle : New tactic "obviously"
macro "obviously" : tactic => macro "obviously" : tactic =>
`(tactic| ( `(tactic| (
first first
@ -41,7 +41,7 @@ example : Polynomial.eval (100 : ) F = (2 : ) := by
refine Iff.mpr (Rat.ext_iff (Polynomial.eval 100 F) 2) ?_ refine Iff.mpr (Rat.ext_iff (Polynomial.eval 100 F) 2) ?_
simp only [Rat.ofNat_num, Rat.ofNat_den] simp only [Rat.ofNat_num, Rat.ofNat_den]
rw [F] rw [F]
simp simp [simp]
-- Treat polynomial f ∈ [X] as a function f : -- Treat polynomial f ∈ [X] as a function f :
@ -51,7 +51,9 @@ end section
noncomputable section noncomputable section
-- Polynomial type of degree d -- Polynomial type of degree d
@[simp] @[simp]
def PolyType (f : ) (d : ) := ∃ Poly : Polynomial , ∃ (N : ), (∀ (n : ), N ≤ n → f n = Polynomial.eval (n : ) Poly) ∧ d = Polynomial.degree Poly def PolyType (f : ) (d : ) :=
∃ Poly : Polynomial , ∃ (N : ), (∀ (n : ), N ≤ n → f n = Polynomial.eval (n : ) Poly) ∧
d = Polynomial.degree Poly
section section
example (f : ) (hf : ∀ x, f x = x ^ 2) : PolyType f 2 := by example (f : ) (hf : ∀ x, f x = x ^ 2) : PolyType f 2 := by
@ -68,43 +70,30 @@ def Δ : () → → ()
-- (NO need to prove another direction) Constant polynomial function = constant function -- (NO need to prove another direction) Constant polynomial function = constant function
lemma Poly_constant (F : Polynomial ) (c : ) : lemma Poly_constant (F : Polynomial ) (c : ) :
(F = Polynomial.C (c : )) ↔ (∀ r : , (Polynomial.eval r F) = (c : )) := by (F = Polynomial.C (c : )) ↔ (∀ r : , (Polynomial.eval r F) = (c : )) := by
constructor constructor
· intro h · intro h r
rintro r
refine Iff.mpr (Rat.ext_iff (Polynomial.eval r F) c) ?_ refine Iff.mpr (Rat.ext_iff (Polynomial.eval r F) c) ?_
simp only [Rat.ofNat_num, Rat.ofNat_den] simp only [Rat.ofNat_num, Rat.ofNat_den]
rw [h] simp [h]
simp
· sorry · sorry
-- Get the polynomial G (X) = F (X + s) from the polynomial F(X) -- Get the polynomial G (X) = F (X + s) from the polynomial F(X)
lemma Polynomial_shifting (F : Polynomial ) (s : ) : ∃ (G : Polynomial ), (∀ (x : ), Polynomial.eval x G = Polynomial.eval (x + s) F) ∧ (Polynomial.degree G = Polynomial.degree F) := by lemma Polynomial_shifting (F : Polynomial ) (s : ) : ∃ (G : Polynomial ), (∀ (x : ),
Polynomial.eval x G = Polynomial.eval (x + s) F) ∧
(Polynomial.degree G = Polynomial.degree F) := by
sorry sorry
-- Shifting doesn't change the polynomial type -- Shifting doesn't change the polynomial type
lemma Poly_shifting (f : ) (g : ) (hf : PolyType f d) (s : ) (hfg : ∀ (n : ), f (n + s) = g (n)) : PolyType g d := by lemma Poly_shifting (f : ) (g : ) (hf : PolyType f d) (s : )
simp only [PolyType] (hfg : ∀ (n : ), f (n + s) = g (n)) : PolyType g d := by
rcases hf with ⟨F, hh⟩ rcases hf with ⟨F, ⟨N, s1, s2⟩⟩
rcases hh with ⟨N,s1, s2⟩ rcases (Polynomial_shifting F s) with ⟨Poly, h1, h2⟩
have this : ∃ (G : Polynomial ), (∀ (x : ), Polynomial.eval x G = Polynomial.eval (x + s) F) ∧ (Polynomial.degree G = Polynomial.degree F) := by use Poly, N; constructor
exact Polynomial_shifting F s · intro n hN
rcases this with ⟨Poly, h1, h2⟩
use Poly
use N
constructor
· intro n
specialize s1 (n + s)
intro hN
have this1 : f (n + s) = Polynomial.eval (n + (s : )) F := by have this1 : f (n + s) = Polynomial.eval (n + (s : )) F := by
have this2 : N ≤ n + s := by linarith rw [s1 (n + s) (by linarith)]; norm_cast
have this3 : ↑(f (n + ↑s)) = Polynomial.eval (↑(n + ↑s)) F := by tauto rw [←hfg n, this1]; exact (h1 n).symm
rw [this3]
norm_cast
specialize hfg n
rw [←hfg, this1]
specialize h1 n
tauto
· rw [h2, s2] · rw [h2, s2]
-- PolyType 0 = constant function -- PolyType 0 = constant function
@ -215,8 +204,6 @@ lemma b_to_a (f : ) (d : ) (poly : PolyType f d) :
end end
-- @Additive lemma of length for a SES -- @Additive lemma of length for a SES
-- Given a SES 0 → A → B → C → 0, then length (A) - length (B) + length (C) = 0 -- Given a SES 0 → A → B → C → 0, then length (A) - length (B) + length (C) = 0
section section