Updated formatting

This commit is contained in:
Andre 2023-06-16 13:00:46 -04:00
parent 95ddb3c1ff
commit a8753a10f3

View file

@ -22,34 +22,20 @@ macro "obviously" : tactic =>
-- | nlinarith; done -- | nlinarith; done
| fail "No, this is not obvious.")) | fail "No, this is not obvious."))
-- Testing of Polynomial -- Testing of Polynomial
section Polynomial section Polynomial
noncomputable section noncomputable section
#check Polynomial
#check Polynomial ()
#check Polynomial.eval
example (f : Polynomial ) (hf : f = Polynomial.C (1 : )) : Polynomial.eval 2 f = 1 := by example (f : Polynomial ) (hf : f = Polynomial.C (1 : )) : Polynomial.eval 2 f = 1 := by
have : ∀ (q : ), Polynomial.eval q f = 1 := by have : ∀ (q : ), Polynomial.eval q f = 1 := by
sorry sorry
obviously
-- example (f : ) (hf : ∀ x, f x = x ^ 2) : Polynomial.eval 2 f = 4 := by
-- sorry
-- 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 F : Polynomial := Polynomial.C (2 : )
#print F
#check F
#check Polynomial.degree F
#check Polynomial.degree 0
#check WithBot
-- #eval Polynomial.degree F -- #eval Polynomial.degree F
#check Polynomial.eval 1 F
example : Polynomial.eval (100 : ) F = (2 : ) := by 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]
@ -57,42 +43,22 @@ example : Polynomial.eval (100 : ) F = (2 : ) := by
simp simp
-- Treat polynomial f ∈ [X] as a function f : -- Treat polynomial f ∈ [X] as a function f :
#check CoeFun
end section end section
-- @[BH, 4.1.2]
-- All the polynomials are in [X], all the functions are considered as -- All the polynomials are in [X], all the functions are considered as
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
-- structure PolyType (f : ) where
-- Poly : Polynomial
-- d :
-- N :
-- Poly_equal : ∀ n ∈ → f n = Polynomial.eval n : Poly
#check PolyType #check PolyType
example (f : ) (hf : ∀ x, f x = x ^ 2) : PolyType f 2 := by example (f : ) (hf : ∀ x, f x = x ^ 2) : PolyType f 2 := by
unfold PolyType unfold PolyType
sorry sorry
-- use Polynomial.monomial (2 : ) (1 : )
-- have' := hf 0; ring_nf at this
-- exact this
end section end section
-- Δ operator (of d times) -- Δ operator (of d times)
@ -101,22 +67,13 @@ def Δ : () → → ()
| f, 0 => f | f, 0 => f
| f, d + 1 => fun (n : ) ↦ (Δ f d) (n + 1) - (Δ f d) (n) | f, d + 1 => fun (n : ) ↦ (Δ f d) (n + 1) - (Δ f d) (n)
section section
-- def Δ (f : ) (d : ) := fun (n : ) ↦ f (n + 1) - f n
-- def add' :
-- | 0, m => m
-- | n+1, m => (add' n m) + 1
-- #eval add' 5 10
#check Δ #check Δ
def f (n : ) := n def f (n : ) := n
#eval (Δ f 1) 100 #eval (Δ f 1) 100
-- #check (by (show_term unfold Δ) : Δ f 0=0) -- #check (by (show_term unfold Δ) : Δ f 0=0)
end section end section
-- (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
@ -129,9 +86,6 @@ lemma Poly_constant (F : Polynomial ) (c : ) :
simp simp
· 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 : ) (hfg : ∀ (n : ), f (n + s) = g (n)) : PolyType g d := by
simp only [PolyType] simp only [PolyType]
@ -209,25 +163,6 @@ lemma foofoofoo (d : ) : (f : ) → (∃ (c : ), ∃ (N : ),
sorry sorry
tauto tauto
-- intro h
-- rcases h with ⟨c, N, hh⟩
-- have H1 := λ n => (hh n).left
-- have H2 := λ n => (hh n).right
-- clear hh
-- have H2 : c ≠ 0 := by
-- tauto
-- induction' d with d hd
-- -- Base case
-- · rw [PolyType_0]
-- use c
-- use N
-- tauto
-- -- Induction step
-- · sorry
-- [BH, 4.1.2] (a) => (b) -- [BH, 4.1.2] (a) => (b)
-- Δ^d f (n) = c for some nonzero integer c for n >> 0 → f is of polynomial type d -- Δ^d f (n) = c for some nonzero integer c for n >> 0 → f is of polynomial type d
lemma a_to_b (f : ) (d : ) : (∃ (c : ), ∃ (N : ), (∀ (n : ), N ≤ n → (Δ f d) (n) = c) ∧ c ≠ 0) → PolyType f d := by lemma a_to_b (f : ) (d : ) : (∃ (c : ), ∃ (N : ), (∀ (n : ), N ≤ n → (Δ f d) (n) = c) ∧ c ≠ 0) → PolyType f d := by