refactored PolyType_0

This commit is contained in:
Andre 2023-06-15 22:09:13 -04:00
parent 300007621a
commit b8928c8d90

View file

@ -136,92 +136,27 @@ lemma Poly_shifting (f : ) (g : ) (hf : PolyType f d) (s :
-- set_option pp.all true in -- set_option pp.all true in
-- PolyType 0 = constant function -- PolyType 0 = constant function
lemma PolyType_0 (f : ) : (PolyType f 0) ↔ (∃ (c : ), ∃ (N : ), ∀ (n : ), (N ≤ n → f n = c) ∧ (c ≠ 0)) := by lemma PolyType_0 (f : ) : (PolyType f 0) ↔ (∃ (c : ), ∃ (N : ), ∀ (n : ),
(N ≤ n → f n = c) ∧ c ≠ 0) := by
constructor constructor
· intro h · rintro ⟨Poly, ⟨N, ⟨H1, H2⟩⟩⟩
rcases h with ⟨Poly, hN⟩ have this1 : Polynomial.degree Poly = 0 := by rw [← H2]; rfl
rcases hN with ⟨N, hh⟩
rcases hh with ⟨H1, H2⟩
-- have H1 := λ n=> (hh n).left
-- have H2 := λ n=> (hh n).right
have this1 : Polynomial.degree Poly = 0 := by
have : N ≤ N + 1 := by
norm_num
tauto
have this2 : ∃ (c : ), Poly = Polynomial.C (c : ) := by have this2 : ∃ (c : ), Poly = Polynomial.C (c : ) := by
have HH : ∃ (c : ), Poly = Polynomial.C (c : ) := by have HH : ∃ (c : ), Poly = Polynomial.C (c : ) := ⟨Poly.coeff 0, Polynomial.eq_C_of_degree_eq_zero (by rw[← H2]; rfl)⟩
use Poly.coeff 0
apply Polynomial.eq_C_of_degree_eq_zero
exact this1
cases' HH with c HHH cases' HH with c HHH
have HHHH : ∃ (d : ), d = c := by have HHHH : ∃ (d : ), d = c := ⟨f N, by simp [(Poly_constant Poly c).mp HHH N, H1 N (le_refl N)]⟩
have H3 := (Poly_constant Poly c).mp HHH N cases' HHHH with d H5; exact ⟨d, by rw[← H5] at HHH; exact HHH⟩
have H4 := H1 N (le_refl N)
rw[H3] at H4
exact ⟨f N, H4⟩
cases' HHHH with d H5
use d
rw [H5]
exact HHH
rcases this2 with ⟨c, hthis2⟩ rcases this2 with ⟨c, hthis2⟩
use c use c; use N; intro n
use N
intro n
specialize H1 n
constructor constructor
· intro HH1 · have this4 : Polynomial.eval (n : ) Poly = c := by
-- have H6 := H1 HH1 rw [hthis2]; simp only [map_intCast, Polynomial.eval_int_cast]
have this3 : f n = Polynomial.eval (n : ) Poly := by exact fun HH1 => Iff.mp (Rat.coe_int_inj (f n) c) (by rw [←this4, H1 n HH1])
tauto
have this4 : Polynomial.eval (n : ) Poly = c := by
rw [hthis2]
simp
have this5 : f n = (c : ) := by
rw [←this4, this3]
exact Iff.mp (Rat.coe_int_inj (f n) c) this5
· intro c0 · intro c0
-- have H7 := H2 (by norm_num) simp only [hthis2, c0, Int.cast_zero, map_zero, Polynomial.degree_zero] at this1
rw [hthis2] at this1 · rintro ⟨c, N, hh⟩
rw [c0] at this1 have H2 : (c : ) ≠ 0 := by simp only [ne_eq, Int.cast_eq_zero]; exact (hh 0).2
simp at this1 exact ⟨Polynomial.C (c : ), N, fun n Nn => by rw [(hh n).1 Nn]; exact (((Poly_constant (Polynomial.C (c : )) (c : )).mp rfl) n).symm, by rw [Polynomial.degree_C H2]; rfl⟩
· intro h
rcases h with ⟨c, N, hh⟩
let Poly := Polynomial.C (c : )
--unfold PolyType
use Poly
--simp at Poly
use N
have H1 := λ n=> (hh n).left
have H22 := λ n=> (hh n).right
have H2 : c ≠ 0 := by
exact H22 0
have H2 : (c : ) ≠ 0 := by
simp; tauto
clear H22
constructor
· intro n Nn
specialize H1 n
have this : f n = c := by
tauto
rw [this]
have this2 : Polynomial.eval (n : ) Poly = (c : ) := by
have this3 : ∀ r : , (Polynomial.eval r Poly) = (c : ) := (Poly_constant Poly (c : )).mp rfl
exact this3 n
exact this2.symm
· have this : Polynomial.degree Poly = 0 := by
simp only [map_intCast]
exact Polynomial.degree_C H2
tauto
-- Δ of 0 times preserve the function -- Δ of 0 times preserve the function
lemma Δ_0 (f : ) : (Δ f 0) = f := by lemma Δ_0 (f : ) : (Δ f 0) = f := by