Merge pull request #98 from GTBarkley/monalisa

Monalisa
This commit is contained in:
ah1112 2023-06-16 17:47:09 -04:00 committed by GitHub
commit 431f188882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
@ -15,6 +15,7 @@ macro "obviously" : tactic =>
| simp; tauto; done; dbg_trace "it was simp tauto" | simp; tauto; done; dbg_trace "it was simp tauto"
| rfl; done; dbg_trace "it was rfl" | rfl; done; dbg_trace "it was rfl"
| norm_num; done; dbg_trace "it was norm_num" | norm_num; done; dbg_trace "it was norm_num"
| norm_cast; done; dbg_trace "it was norm_cast"
| /-change (@Eq _ _);-/ linarith; done; dbg_trace "it was linarith" | /-change (@Eq _ _);-/ linarith; done; dbg_trace "it was linarith"
-- | gcongr; done -- | gcongr; done
| ring; done; dbg_trace "it was ring" | ring; done; dbg_trace "it was ring"
@ -40,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 :
@ -50,11 +51,11 @@ 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
#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
@ -71,12 +72,10 @@ def Δ : () → → ()
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)
@ -84,22 +83,15 @@ lemma Polynomial_shifting (F : Polynomial ) (s : ) : ∃ (G : Polynomial
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⟩ have this1 : f (n + s) = Polynomial.eval (n + (s : )) F := by
use Poly rw [s1 (n + s) (by linarith)]; norm_cast
use N rw [←hfg n, this1]; exact (h1 n).symm
constructor
· intro n
specialize s1 (n + s)
intro hN
have this1 : f (n + s) = Polynomial.eval (n + s : ) F := by
sorry
sorry
· rw [h2, s2] · rw [h2, s2]
-- PolyType 0 = constant function -- PolyType 0 = constant function
@ -132,8 +124,8 @@ lemma PolyType_0 (f : ) : (PolyType f 0) ↔ (∃ (c : ), ∃ (N :
-- Δ of 0 times preserves the function -- Δ of 0 times preserves the function
lemma Δ_0 (f : ) : (Δ f 0) = f := by rfl lemma Δ_0 (f : ) : (Δ f 0) = f := by rfl
--simp only [Δ]
-- Δ of 1 times decreaes the polynomial type by one -- Δ of 1 times decreaes the polynomial type by one --can be golfed
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]
@ -186,53 +178,21 @@ lemma Δ_d_PolyType_d_to_PolyType_0 (f : ) (d : ): PolyType f d
-- 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 rintro ⟨P, N, ⟨h1, h2⟩⟩
simp only [PolyType, Nat.cast_add, Nat.cast_one, exists_and_right] 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) let G := fun (q : ) => f (N)
sorry sorry
lemma foo (d : ) : (f : ) → (∃ (c : ), ∃ (N : ), (∀ (n : ), N ≤ n →
lemma foo (d : ) : (f : ) → (∃ (c : ), ∃ (N : ), (∀ (n : ), N ≤ n → (Δ f d) (n) = c) ∧ c ≠ 0) → (PolyType f d) := by (Δ f d) (n) = c) ∧ c ≠ 0) → (PolyType f d) := by
induction' d with d hd induction' d with d hd
· rintro f ⟨c, N, hh⟩; rw [PolyType_0 f]; exact ⟨c, N, hh⟩
-- Base case · exact fun f ⟨c, N, ⟨H, c0⟩⟩ =>
· intro f Δ_1_ f d (hd (Δ f 1) ⟨c, N, fun n h => by rw [← H n h, Δ_1_s_equiv_Δ_s_1], c0⟩)
intro h
rcases h with ⟨c, N, hh⟩
rw [PolyType_0]
use c
use N
tauto
-- Induction step
· intro f
intro h
rcases h with ⟨c, N, h⟩
have this : PolyType f (d + 1) := by
rcases h with ⟨H,c0⟩
let g := (Δ f 1)
have this1 : (∃ (c : ), ∃ (N : ), (∀ (n : ), N ≤ n → (Δ g d) (n) = c) ∧ c ≠ 0) := by
use c; use N
constructor
· intro n
specialize H n
intro h
have this : Δ f (d + 1) n = c := by tauto
rw [←this]
rw [Δ_1_s_equiv_Δ_s_1]
· tauto
have this2 : PolyType g d := by
apply hd
tauto
exact Δ_1_ f d this2
exact this
-- [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 := fun h => (foo d f) h
sorry
-- [BH, 4.1.2] (a) <= (b) -- [BH, 4.1.2] (a) <= (b)
-- f is of polynomial type d → Δ^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
@ -241,6 +201,7 @@ lemma b_to_a (f : ) (d : ) (poly : PolyType f d) :
rw [←PolyType_0]; exact Δ_d_PolyType_d_to_PolyType_0 f d poly rw [←PolyType_0]; exact Δ_d_PolyType_d_to_PolyType_0 f d poly
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