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
macro "ls" : tactic => `(tactic|library_search)
-- New tactic "obviously"
-- From Kyle : New tactic "obviously"
macro "obviously" : tactic =>
`(tactic| (
first
@ -41,7 +41,7 @@ example : Polynomial.eval (100 : ) F = (2 : ) := by
refine Iff.mpr (Rat.ext_iff (Polynomial.eval 100 F) 2) ?_
simp only [Rat.ofNat_num, Rat.ofNat_den]
rw [F]
simp
simp [simp]
-- Treat polynomial f ∈ [X] as a function f :
@ -51,7 +51,9 @@ end section
noncomputable section
-- Polynomial type of degree d
@[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
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
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
· intro h
rintro r
· intro h r
refine Iff.mpr (Rat.ext_iff (Polynomial.eval r F) c) ?_
simp only [Rat.ofNat_num, Rat.ofNat_den]
rw [h]
simp
simp [h]
· sorry
-- 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
-- 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
simp only [PolyType]
rcases hf with ⟨F, hh⟩
rcases hh with ⟨N,s1, s2⟩
have this : ∃ (G : Polynomial ), (∀ (x : ), Polynomial.eval x G = Polynomial.eval (x + s) F) ∧ (Polynomial.degree G = Polynomial.degree F) := by
exact Polynomial_shifting F s
rcases this with ⟨Poly, h1, h2⟩
use Poly
use N
constructor
· intro n
specialize s1 (n + s)
intro hN
lemma Poly_shifting (f : ) (g : ) (hf : PolyType f d) (s : )
(hfg : ∀ (n : ), f (n + s) = g (n)) : PolyType g d := by
rcases hf with ⟨F, ⟨N, s1, s2⟩⟩
rcases (Polynomial_shifting F s) with ⟨Poly, h1, h2⟩
use Poly, N; constructor
· intro n hN
have this1 : f (n + s) = Polynomial.eval (n + (s : )) F := by
have this2 : N ≤ n + s := by linarith
have this3 : ↑(f (n + ↑s)) = Polynomial.eval (↑(n + ↑s)) F := by tauto
rw [this3]
norm_cast
specialize hfg n
rw [←hfg, this1]
specialize h1 n
tauto
rw [s1 (n + s) (by linarith)]; norm_cast
rw [←hfg n, this1]; exact (h1 n).symm
· rw [h2, s2]
-- PolyType 0 = constant function
@ -215,8 +204,6 @@ lemma b_to_a (f : ) (d : ) (poly : PolyType f d) :
end
-- @Additive lemma of length for a SES
-- Given a SES 0 → A → B → C → 0, then length (A) - length (B) + length (C) = 0
section