06/16 version

This commit is contained in:
chelseaandmadrid 2023-06-16 11:16:41 -07:00
parent ed83762764
commit b3332d77d7

View file

@ -44,24 +44,27 @@ example (f : Polynomial ) (hf : f = Polynomial.C (1 : )) : Polynomial.eval
-- degree of a constant function is ⊥ (is this same as -1 ???) -- degree of a constant function is ⊥ (is this same as -1 ???)
#print Polynomial.degree_zero #print Polynomial.degree_zero
def F : Polynomial := Polynomial.C (2 : ) def FF : Polynomial := Polynomial.C (2 : )
#print F #print FF
#check F #check FF
#check Polynomial.degree F #check Polynomial.degree FF
#check Polynomial.degree 0 #check Polynomial.degree 0
#check WithBot #check WithBot
-- #eval Polynomial.degree F -- #eval Polynomial.degree FF
#check Polynomial.eval 1 F #check Polynomial.eval 1 FF
example : Polynomial.eval (100 : ) F = (2 : ) := by example : Polynomial.eval (100 : ) FF = (2 : ) := by
refine Iff.mpr (Rat.ext_iff (Polynomial.eval 100 F) 2) ?_ refine Iff.mpr (Rat.ext_iff (Polynomial.eval 100 FF) 2) ?_
simp only [Rat.ofNat_num, Rat.ofNat_den] simp only [Rat.ofNat_num, Rat.ofNat_den]
rw [F] rw [FF]
simp simp
sorry
-- Treat polynomial f ∈ [X] as a function f : -- Treat polynomial f ∈ [X] as a function f :
#check CoeFun #check CoeFun
#check Polynomial.eval₂
#check Polynomial.comp
#check Polynomial.eval₂.comp
#check Polynomial.card_roots
end section end section
@ -106,8 +109,8 @@ section
-- | n+1, m => (add' n m) + 1 -- | n+1, m => (add' n m) + 1
-- #eval add' 5 10 -- #eval add' 5 10
#check Δ #check Δ
def f (n : ) := n def fff (n : ) := n
#eval (Δ f 1) 100 #eval (Δ fff 1) 100
-- #check (by (show_term unfold Δ) : Δ f 0=0) -- #check (by (show_term unfold Δ) : Δ f 0=0)
end section end section
@ -125,12 +128,30 @@ lemma Poly_constant (F : Polynomial ) (c : ) :
simp simp
· sorry · 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
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 : ) (hfg : ∀ (n : ), f (n + s) = g (n)) : PolyType g d := by
simp only [PolyType] simp only [PolyType]
rcases hf with ⟨F, hh⟩ rcases hf with ⟨F, hh⟩
rcases hh with ⟨N,ss⟩ 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
have this1 : f (n + s) = Polynomial.eval (n + s : ) F := by
sorry sorry
sorry
· rw [h2, s2]
-- PolyType 0 = constant function -- PolyType 0 = constant function
lemma PolyType_0 (f : ) : (PolyType f 0) ↔ (∃ (c : ), ∃ (N : ), (∀ (n : ), lemma PolyType_0 (f : ) : (PolyType f 0) ↔ (∃ (c : ), ∃ (N : ), (∀ (n : ),
@ -146,18 +167,18 @@ lemma PolyType_0 (f : ) : (PolyType f 0) ↔ (∃ (c : ), ∃ (N :
⟨f N, by simp [(Poly_constant Poly c).mp HHH N, H1 N (le_refl N)]⟩ ⟨f N, by simp [(Poly_constant Poly c).mp HHH N, H1 N (le_refl N)]⟩
cases' HHHH with d H5; exact ⟨d, by rw[← H5] at HHH; exact HHH⟩ cases' HHHH with d H5; exact ⟨d, by rw[← H5] at HHH; exact HHH⟩
rcases this2 with ⟨c, hthis2⟩ rcases this2 with ⟨c, hthis2⟩
use c; use N; intro n use c; use N; constructor
constructor · intro n
· have this4 : Polynomial.eval (n : ) Poly = c := by have this4 : Polynomial.eval (n : ) Poly = c := by
rw [hthis2]; simp only [map_intCast, Polynomial.eval_int_cast] rw [hthis2]; simp only [map_intCast, Polynomial.eval_int_cast]
exact fun HH1 => Iff.mp (Rat.coe_int_inj (f n) c) (by rw [←this4, H1 n HH1]) exact fun HH1 => Iff.mp (Rat.coe_int_inj (f n) c) (by rw [←this4, H1 n HH1])
· intro c0 · intro c0
simp only [hthis2, c0, Int.cast_zero, map_zero, Polynomial.degree_zero] simp only [hthis2, c0, Int.cast_zero, map_zero, Polynomial.degree_zero]
at this1 at this1
· rintro ⟨c, N, hh⟩ · rintro ⟨c, N, hh⟩
have H2 : (c : ) ≠ 0 := by simp only [ne_eq, Int.cast_eq_zero]; exact (hh 0).2 have H2 : (c : ) ≠ 0 := by simp only [ne_eq, Int.cast_eq_zero, hh]
exact ⟨Polynomial.C (c : ), N, fun n Nn exact ⟨Polynomial.C (c : ), N, fun n Nn
=> by rw [(hh n).1 Nn]; exact (((Poly_constant (Polynomial.C (c : )) => by rw [hh.1 n Nn]; exact (((Poly_constant (Polynomial.C (c : ))
(c : )).mp rfl) n).symm, by rw [Polynomial.degree_C H2]; rfl⟩ (c : )).mp rfl) n).symm, by rw [Polynomial.degree_C H2]; rfl⟩
-- Δ of 0 times preserves the function -- Δ of 0 times preserves the function
@ -167,13 +188,46 @@ lemma Δ_0 (f : ) : (Δ f 0) = f := by tauto
lemma Δ_1 (f : ) (d : ) : PolyType f (d + 1) → PolyType (Δ f 1) d := by lemma Δ_1 (f : ) (d : ) : PolyType f (d + 1) → PolyType (Δ f 1) d := by
intro h intro h
simp only [PolyType, Δ, Int.cast_sub, exists_and_right] simp only [PolyType, Δ, Int.cast_sub, exists_and_right]
rcases h with ⟨Poly, N, h⟩ rcases h with ⟨F, N, h⟩
rcases h with ⟨h1, h2⟩
have this : ∃ (G : Polynomial ), (∀ (x : ), Polynomial.eval x G = Polynomial.eval (x + 1) F) ∧ (Polynomial.degree G = Polynomial.degree F) := by
exact Polynomial_shifting F 1
rcases this with ⟨G, hG, hGG⟩
let Poly := G - F
use Poly
constructor
· use N
intro n hn
specialize hG n
norm_num
rw [hG]
let h3 := h1
specialize h3 n
have this1 : f n = Polynomial.eval (n : ) F := by tauto
have this2 : f (n + 1) = Polynomial.eval ((n + 1) : ) F := by
specialize h1 (n + 1)
have this3 : N ≤ n + 1 := by linarith
aesop
rw [←this1, ←this2]
· have this1 : Polynomial.degree Poly = d := by
have this2 : Polynomial.degree Poly ≤ d := by
sorry sorry
have this3 : Polynomial.degree Poly ≥ d := by
sorry
sorry
tauto
-- The "reverse" of Δ of 1 times increases the polynomial type by one -- The "reverse" of Δ of 1 times increases the polynomial type by one
lemma Δ_1_ (f : ) (d : ) : PolyType (Δ f 1) d → PolyType f (d + 1) := by lemma Δ_1_ (f : ) (d : ) : PolyType (Δ f 1) d → PolyType f (d + 1) := by
intro h
simp only [PolyType, Nat.cast_add, Nat.cast_one, exists_and_right]
rcases h with ⟨P, N, h⟩
rcases h with ⟨h1, h2⟩
let G := fun (q : ) => f (N)
sorry sorry
-- Δ of d times maps polynomial of degree d to polynomial of degree 0 -- Δ of d times maps polynomial of degree d to polynomial of degree 0
lemma Δ_1_s_equiv_Δ_s_1 (f : ) (s : ) : Δ (Δ f 1) s = (Δ f (s + 1)) := by lemma Δ_1_s_equiv_Δ_s_1 (f : ) (s : ) : Δ (Δ f 1) s = (Δ f (s + 1)) := by
induction' s with s hs induction' s with s hs
@ -183,19 +237,10 @@ lemma foofoo (d : ) : (f : ) → (PolyType f d) → (PolyType (Δ
induction' d with d hd induction' d with d hd
· intro f h · intro f h
rw [Δ_0] rw [Δ_0]
tauto exact h
· intro f hf · intro f hf
have this1 : PolyType f (d + 1) := by tauto have this4 := hd (Δ f 1) $ (Δ_1 f d) hf
have this2 : PolyType (Δ f (d + 1)) 0 := by rwa [Δ_1_s_equiv_Δ_s_1] at this4
have this3 : PolyType (Δ f 1) d := by
have this5 : PolyType f (d + 1) → PolyType (Δ f 1) d := Δ_1 f d
exact this5 this1
clear hf
specialize hd (Δ f 1)
have this4 : PolyType (Δ (Δ f 1) d) 0 := by tauto
rw [Δ_1_s_equiv_Δ_s_1] at this4
tauto
tauto
lemma Δ_d_PolyType_d_to_PolyType_0 (f : ) (d : ): PolyType f d → PolyType (Δ f d) 0 := fun h => (foofoo d f) h lemma Δ_d_PolyType_d_to_PolyType_0 (f : ) (d : ): PolyType f d → PolyType (Δ f d) 0 := fun h => (foofoo d f) h