Download data/lean/OAI/NumberTheory/PiExponent/Polynomials/NatToIntGrading.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.62 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PiExponent/Polynomials/NatToIntGrading.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/PiExponent/Polynomials/NatToIntGrading.lean
-
curl -L -o NatToIntGrading.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PiExponent/Polynomials/NatToIntGrading.lean
5.62 kB
| import Mathlib | |
| namespace OAI | |
| namespace PiExponent.NatToIntGrading | |
| noncomputable section | |
| open DirectSum | |
| variable {M ΟM : Type*} [AddCommGroup M] [SetLike ΟM M] [AddSubgroupClass ΟM M] | |
| (π : β β ΟM) [DirectSum.Decomposition π] | |
| def piece : β€ β AddSubgroup M | |
| | .ofNat n => AddSubgroup.ofClass (π n) | |
| | .negSucc _ => β₯ | |
| def component (m : M) : β d, piece π d | |
| | .ofNat n => β¨DirectSum.decompose π m n, (DirectSum.decompose π m n).propertyβ© | |
| | .negSucc _ => 0 | |
| def support (m : M) : Finset β€ := by | |
| classical | |
| exact (DirectSum.decompose π m).support.image (fun n : β => (n : β€)) | |
| theorem component_eq_zero_of_not_mem (m : M) (d : β€) (hd : d β support π m) : | |
| component π m d = 0 := by | |
| classical | |
| cases d with | |
| | ofNat n => | |
| apply Subtype.ext | |
| have hn : n β (DirectSum.decompose π m).support := by | |
| intro hn | |
| exact hd (Finset.mem_image.mpr β¨n, hn, rflβ©) | |
| change (DirectSum.decompose π m n : M) = 0 | |
| rw [DFinsupp.notMem_support_iff.mp hn] | |
| rfl | |
| | negSucc n => rfl | |
| def decompositionMap : M β+ β¨ d, piece π d where | |
| toFun m := DFinsupp.mk' (component π m) (Trunc.mk | |
| β¨(support π m).val, fun d => by | |
| classical | |
| by_cases hd : d β support π m | |
| Β· exact Or.inl hd | |
| Β· exact Or.inr (component_eq_zero_of_not_mem π m d hd)β©) | |
| map_zero' := by | |
| apply DFinsupp.ext | |
| intro d | |
| apply Subtype.ext | |
| cases d with | |
| | ofNat n => | |
| change (DirectSum.decompose π (0 : M) n : M) = 0 | |
| rw [DirectSum.decompose_zero] | |
| rfl | |
| | negSucc n => rfl | |
| map_add' m n := by | |
| apply DFinsupp.ext | |
| intro d | |
| apply Subtype.ext | |
| cases d with | |
| | ofNat k => | |
| change (DirectSum.decompose π (m + n) k : M) = | |
| (DirectSum.decompose π m k : M) + (DirectSum.decompose π n k : M) | |
| rw [DirectSum.decompose_add] | |
| rfl | |
| | negSucc k => exact (zero_add (0 : M)).symm | |
| @[simp] theorem decompositionMap_nat (m : M) (n : β) : | |
| (decompositionMap π m (n : β€) : M) = (DirectSum.decompose π m n : M) := rfl | |
| theorem decompositionMap_injective : Function.Injective (decompositionMap π) := by | |
| intro m n h | |
| apply (DirectSum.decompose π).injective | |
| ext k | |
| exact congrArg (fun z : β¨ d, piece π d => (z (k : β€) : M)) h | |
| theorem decompositionMap_homogeneous (d : β€) (m : piece π d) : | |
| decompositionMap π m.val = DirectSum.of (fun d => piece π d) d m := by | |
| classical | |
| cases d with | |
| | negSucc n => | |
| have hm : m = 0 := Subtype.ext m.property | |
| subst m | |
| simp | |
| | ofNat n => | |
| apply DFinsupp.ext | |
| intro e | |
| apply Subtype.ext | |
| cases e with | |
| | negSucc k => | |
| rw [DirectSum.of_eq_of_ne _ _ _ (show Int.negSucc k β Int.ofNat n from by intro h; cases h)] | |
| rfl | |
| | ofNat k => | |
| by_cases hnk : n = k | |
| Β· subst k | |
| rw [DirectSum.of_eq_same] | |
| exact DirectSum.decompose_of_mem_same π m.property | |
| Β· rw [DirectSum.of_eq_of_ne _ _ _ (show Int.ofNat k β Int.ofNat n from | |
| fun h => hnk (Int.ofNat.inj h).symm)] | |
| exact DirectSum.decompose_of_mem_ne π m.property hnk | |
| instance decomposition : DirectSum.Decomposition (piece π) := by | |
| have hr : (decompositionMap π).comp (DirectSum.coeAddMonoidHom (piece π)) = AddMonoidHom.id _ := by | |
| apply DirectSum.addHom_ext | |
| intro d m | |
| simp only [AddMonoidHom.comp_apply, DirectSum.coeAddMonoidHom_of, | |
| AddMonoidHom.id_apply, decompositionMap_homogeneous] | |
| apply DirectSum.Decomposition.ofAddHom (piece π) (decompositionMap π) ?_ hr | |
| apply AddMonoidHom.ext | |
| intro m | |
| apply decompositionMap_injective π | |
| exact DFunLike.congr_fun hr (decompositionMap π m) | |
| @[simp] theorem decompose_nat (m : M) (n : β) : | |
| (DirectSum.decompose (piece π) m (n : β€) : M) = (DirectSum.decompose π m n : M) := rfl | |
| @[simp] theorem decompose_negSucc (m : M) (n : β) : | |
| (DirectSum.decompose (piece π) m (.negSucc n) : M) = 0 := rfl | |
| section Scalars | |
| variable {R ΟR : Type*} [Ring R] [Module R M] [SetLike ΟR R] [AddSubgroupClass ΟR R] | |
| (π : β β ΟR) [SetLike.GradedSMul π π] | |
| instance gradedSMul : SetLike.GradedSMul (piece π) (piece π) where | |
| smul_mem := by | |
| intro i j a m ha hm | |
| cases i with | |
| | negSucc n => | |
| have ha' : a = 0 := ha | |
| rw [ha', zero_smul] | |
| exact zero_mem _ | |
| | ofNat n => | |
| cases j with | |
| | negSucc k => | |
| have hm' : m = 0 := hm | |
| rw [hm', smul_zero] | |
| exact zero_mem _ | |
| | ofNat k => | |
| change a β’ m β π (n + k) | |
| exact SetLike.GradedSMul.smul_mem (show a β π n from ha) (show m β π k from hm) | |
| end Scalars | |
| section Ring | |
| variable {R ΟR : Type*} [Ring R] [SetLike ΟR R] [AddSubgroupClass ΟR R] | |
| (π : β β ΟR) [SetLike.GradedMonoid π] | |
| instance gradedMonoid : SetLike.GradedMonoid (piece π) where | |
| one_mem := by | |
| change (1 : R) β π 0 | |
| exact SetLike.GradedOne.one_mem | |
| mul_mem := by | |
| intro i j a b ha hb | |
| cases i with | |
| | negSucc n => | |
| have ha' : a = 0 := ha | |
| rw [ha', zero_mul] | |
| exact zero_mem _ | |
| | ofNat n => | |
| cases j with | |
| | negSucc k => | |
| have hb' : b = 0 := hb | |
| rw [hb', mul_zero] | |
| exact zero_mem _ | |
| | ofNat k => | |
| change a * b β π (n + k) | |
| exact SetLike.mul_mem_graded (show a β π n from ha) (show b β π k from hb) | |
| end Ring | |
| end | |
| end PiExponent.NatToIntGrading | |
| end OAI | |