{"binding":{"chosen_proof_sha256":"913d082c9208bb76bddc5c53143841e2bf0506c046fa9176c015a2e29cc88577","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6691fc38413ac60df3cee875c34ebc37bbbec195affc807e523adec04eeff356","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"a7e152ac7095d7f066dffa16e5ed09404a6c122ae0df9540aece7f1a11c28b41","source_sha256":"6e6693983d0a08af453285c1b35f1384fa1c0fbb8f0d7c6a8d695e28e681b638","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n dsimp only [MorphismProperty.HasCardinalLT]\n rw [MorphismProperty.toSet_max]\n exact hasCardinalLT_union hκ h₁ h₂","hard_negative":false,"metrics":{"chosen_tokens":22,"rejected_tokens":26,"token_jaccard":0.842105,"token_length_ratio":1.181818},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"00b556a5d0e4f2bf9417d4b28db475eb54601a0a44540c11b63f9501bb08eb90","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.SetTheory.Cardinal.HasCardinalLT\npublic import Mathlib.CategoryTheory.MorphismProperty.Basic\n\nNamespace:\nCategoryTheory.MorphismProperty\n\nLocal context:\n/-\nCopyright (c) 2025 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n/-!\n# Properties of morphisms that are bounded by a cardinal\n\nGiven `P : MorphismProperty C` and `κ : Cardinal`, we introduce a predicate\n`P.HasCardinalLT κ` saying that the cardinality of `P.toSet` is `< κ`.\n\n-/\n\npublic section\n\nuniverse w v u\n\nnamespace CategoryTheory\n\nvariable {C : Type u} [Category.{v} C]\n\nnamespace MorphismProperty\n\n/-- The property that the subtype of arrows satisfying a property `P : MorphismProperty C`\nis of cardinality `< κ`. -/\nprotected abbrev HasCardinalLT (P : MorphismProperty C) (κ : Cardinal.{w}) :=\n _root_.HasCardinalLT P.toSet κ\n\nlemma hasCardinalLT_ofHoms {C : Type*} [Category* C]\n {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) {κ : Cardinal}\n (h : HasCardinalLT ι κ) : (MorphismProperty.ofHoms f).HasCardinalLT κ :=\n h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by\n rintro ⟨f, hf⟩\n rw [MorphismProperty.mem_toSet_iff, MorphismProperty.ofHoms_iff] at hf\n obtain ⟨i, hf⟩ := hf\n obtain rfl : f = _ := hf\n exact ⟨i, rfl⟩)\n\nlemma HasCardinalLT.iSup\n {ι : Type*} {P : ι → MorphismProperty C} {κ : Cardinal.{w}} [Fact κ.IsRegular]\n (hP : ∀ i, (P i).HasCardinalLT κ) (hι : HasCardinalLT ι κ) :\n (⨆ i, P i).HasCardinalLT κ := by\n dsimp only [MorphismProperty.HasCardinalLT]\n rw [toSet_iSup]\n exact hasCardinalLT_iUnion _ hι hP\n\nTarget:\nlemma HasCardinalLT.sup\n {P₁ P₂ : MorphismProperty C} {κ : Cardinal.{w}}\n (h₁ : P₁.HasCardinalLT κ) (h₂ : P₂.HasCardinalLT κ)\n (hκ : Cardinal.aleph0 ≤ κ) :\n (P₁ ⊔ P₂).HasCardinalLT κ :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n dsimp only [MorphismProperty.HasCardinalLT]\n rw [MorphismProperty.toSet_max]\n exact hasCardinalLT_union hκ h₁ h₂","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/MorphismProperty","family_id":"hascardinallt","file_id":"mathlib/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean","sample_id":"a7e152ac7095d7f066dffa16e5ed09404a6c122ae0df9540aece7f1a11c28b41"},"split":"validation"} {"binding":{"chosen_proof_sha256":"897c172047eda794e8869be4ee35cff8b29b581623e6fe2b10f4a65fbcafe6c9","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c8be9266904e6908315c8f17b7f3334521bb868983890c3492e54f2795c88945","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"1480ca314344bbeedcc3024354388153952b9296e9277aaf7cb9b985c4279056","source_sha256":"f933354ffdad343f1f87876dd6cf99ec8b0c6f9434915fe785999e4c86761fe8","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rcases H with ⟨u, hu⟩; rwa [← u.mul_left_inj, Hg.comm u]","hard_negative":false,"metrics":{"chosen_tokens":22,"rejected_tokens":27,"token_jaccard":0.782609,"token_length_ratio":1.227273},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"03996dace82330aeb8b3732810b3fc581b3678182d2f0d93e3063c79caec499a","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Subgroup.Basic\npublic import Mathlib.GroupTheory.Submonoid.Center\n\nNamespace:\nIsConj\n\nLocal context:\n/-\nCopyright (c) 2020 Kexing Ying. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kexing Ying\n-/\n/-!\n# Centers of subgroups\n\n-/\n\n@[expose] public section\n\nassert_not_exists MonoidWithZero Multiset\n\nvariable {G : Type*} [Group G]\n\nnamespace Subgroup\n\nvariable (G)\n\n/-- The center of a group `G` is the set of elements that commute with everything in `G` -/\n@[to_additive\n /-- The center of an additive group `G` is the set of elements that commute with\n everything in `G` -/]\ndef center : Subgroup G where\n __ := Submonoid.center G\n inv_mem' := Set.inv_mem_center\n\n@[to_additive]\ntheorem coe_center : ↑(center G) = Set.center G :=\n rfl\n\n@[to_additive (attr := simp)]\ntheorem center_toSubmonoid : (center G).toSubmonoid = Submonoid.center G :=\n rfl\n\ninstance center.isMulCommutative : IsMulCommutative (center G) :=\n ⟨⟨fun a b => Subtype.ext (b.2.comm a).symm⟩⟩\n\nvariable {G} in\n/-- The center of isomorphic groups are isomorphic. -/\n@[to_additive (attr := simps!) /-- The center of isomorphic additive groups are isomorphic. -/]\ndef centerCongr {H} [Group H] (e : G ≃* H) : center G ≃* center H := Submonoid.centerCongr e\n\n/-- The center of a group is isomorphic to the center of its opposite. -/\n@[to_additive (attr := simps!)\n/-- The center of an additive group is isomorphic to the center of its opposite. -/]\ndef centerToMulOpposite : center G ≃* center Gᵐᵒᵖ := Submonoid.centerToMulOpposite\n\nvariable {G}\n\n@[to_additive]\ntheorem mem_center_iff {z : G} : z ∈ center G ↔ ∀ g, g * z = z * g := by\n rw [← Semigroup.mem_center_iff]\n exact Iff.rfl\n\ninstance decidableMemCenter (z : G) [Decidable (∀ g, g * z = z * g)] : Decidable (z ∈ center G) :=\n decidable_of_iff' _ mem_center_iff\n\n@[to_additive]\ninstance centerCharacteristic : (center G).Characteristic := by\n refine characteristic_iff_comap_le.mpr fun ϕ g hg => ?_\n rw [mem_center_iff]\n intro h\n rw [← ϕ.injective.eq_iff, map_mul, map_mul]\n exact (hg.comm (ϕ h)).symm\n\n@[to_additive]\ntheorem _root_.CommGroup.center_eq_top {G : Type*} [CommGroup G] : center G = ⊤ := by\n rw [eq_top_iff']\n intro x\n rw [Subgroup.mem_center_iff]\n intro y\n exact mul_comm y x\n\n@[to_additive]\ntheorem center_eq_top_iff : center G = ⊤ ↔ IsMulCommutative G := by\n simp [eq_top_iff', isMulCommutative_iff, mem_center_iff, eq_comm]\n\n@[to_additive]\ntheorem center_eq_top [hG : IsMulCommutative G] : center G = ⊤ :=\n center_eq_top_iff.mpr hG\n\n/-- A group is commutative if the center is the whole group. -/\n@[to_additive /-- An additive group is commutative if the center is the whole group. -/,\n implicit_reducible]\ndef _root_.Group.commGroupOfCenterEqTop (h : center G = ⊤) : CommGroup G :=\n { ‹Group G› with\n mul_comm := by\n rw [eq_top_iff'] at h\n intro x y\n apply Subgroup.mem_center_iff.mp _ x\n exact h y\n }\n\n@[to_additive]\nprotected theorem center_prod {H : Type*} [Group H] : center (G × H) = prod (center G) (center H) :=\n SetLike.coe_injective Set.center_prod\n\n@[to_additive]\nprotected theorem center_pi {η : Type*} {G : η → Type*} [Π i, Group (G i)] :\n center (Π i, G i) = pi .univ fun i ↦ center (G i) :=\n SetLike.coe_injective Set.center_pi\n\nvariable {H : Subgroup G}\n\nsection Normalizer\n\n@[to_additive]\ninstance instNormalCenter : (center G).Normal :=\n ⟨fun a ha b ↦ by simpa [mem_center_iff.mp ha b]⟩\n\n@[to_additive]\ntheorem center_le_normalizer (s : Set G) : center G ≤ normalizer s := by\n intro x hx y\n simp [← mem_center_iff.mp hx y]\n\nend Normalizer\n\nend Subgroup\n\nnamespace IsConj\n\nvariable {M : Type*} [Monoid M]\n\nTarget:\ntheorem eq_of_left_mem_center {g h : M} (H : IsConj g h) (Hg : g ∈ Set.center M) : g = h :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n rcases H with ⟨u, hu⟩; rwa [← u.mul_left_inj, Hg.comm u]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Subgroup","family_id":"eq_of_left_mem_center","file_id":"mathlib/Mathlib/GroupTheory/Subgroup/Center.lean","sample_id":"1480ca314344bbeedcc3024354388153952b9296e9277aaf7cb9b985c4279056"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f30b6b70ea73c803c2832616e5d9eb45020f66252ef17a3f00d8dbf888e5e9f2","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"57596c7226016462a23949e6ea93a54316af2221967ae24cad1a25b185f92483","source_sha256":"167cae25a064b15f836022f0441997349a236bd699ca87bcd93cf532b794529a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let b := chooseBasis R M₁\n rw [← LinearMap.charpoly_toMatrix φ b, ← LinearMap.charpoly_toMatrix (e.conj φ) (b.map e)]\n congr 1\n ext i j : 1\n simp [LinearMap.toMatrix]","hard_negative":false,"metrics":{"chosen_tokens":47,"rejected_tokens":3,"token_jaccard":0.03125,"token_length_ratio":0.06383},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"03c677899db665f8a69ce946e1aa8606feb3ad4c969d381fe905b80c9c86e6a3","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Charpoly.Basic\npublic import Mathlib.LinearAlgebra.Matrix.Basis\npublic import Mathlib.RingTheory.Finiteness.Prod\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Riccardo Brasca. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Riccardo Brasca\n-/\n/-!\n\n# Characteristic polynomial\n\n## Main result\n\n* `LinearMap.charpoly_toMatrix f` : `charpoly f` is the characteristic polynomial of the matrix\n of `f` in any basis.\n\n-/\n\npublic section\n\nnoncomputable section\n\nopen Module Free Polynomial Matrix\n\nuniverse u v w\n\nvariable {R M M₁ M₂ : Type*} [CommRing R]\nvariable [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M]\nvariable [AddCommGroup M₁] [Module R M₁] [Module.Finite R M₁] [Module.Free R M₁]\nvariable [AddCommGroup M₂] [Module R M₂] [Module.Finite R M₂] [Module.Free R M₂]\nvariable (f : M →ₗ[R] M)\n\nnamespace LinearMap\n\nsection Basic\n\n/-- `charpoly f` is the characteristic polynomial of the matrix of `f` in any basis. -/\n@[simp]\ntheorem charpoly_toMatrix {ι : Type w} [DecidableEq ι] [Fintype ι] (b : Basis ι R M) :\n (toMatrix b b f).charpoly = f.charpoly := by\n nontriviality R\n unfold LinearMap.charpoly\n set b' := chooseBasis R M\n rw [← basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix b b' b b']\n set P := b.toMatrix b'\n set A := toMatrix b' b' f\n set Q := b'.toMatrix b\n let e := Basis.indexEquiv b b'\n let ι' := ChooseBasisIndex R M\n let φ := reindexLinearEquiv R R e e\n let φ₁ := reindexLinearEquiv R R e (Equiv.refl ι')\n let φ₂ := reindexLinearEquiv R R (Equiv.refl ι') (Equiv.refl ι')\n let φ₃ := reindexLinearEquiv R R (Equiv.refl ι') e\n calc\n (P * A * Q).charpoly = (φ (P * A * Q)).charpoly := (charpoly_reindex ..).symm\n _ = (φ₁ P * φ₂ A * φ₃ Q).charpoly := by rw [reindexLinearEquiv_mul, reindexLinearEquiv_mul]\n _ = A.charpoly := by rw [charpoly_mul_comm, ← mul_assoc]; simp [P, Q, φ₁, φ₂, φ₃]\n\nlemma charpoly_prodMap (f₁ : M₁ →ₗ[R] M₁) (f₂ : M₂ →ₗ[R] M₂) :\n (f₁.prodMap f₂).charpoly = f₁.charpoly * f₂.charpoly := by\n let b₁ := chooseBasis R M₁\n let b₂ := chooseBasis R M₂\n let b := b₁.prod b₂\n rw [← charpoly_toMatrix f₁ b₁, ← charpoly_toMatrix f₂ b₂, ← charpoly_toMatrix (f₁.prodMap f₂) b,\n toMatrix_prodMap b₁ b₂ f₁ f₂, Matrix.charpoly_fromBlocks_zero₁₂]\n\nend Basic\n\nend LinearMap\n\n@[simp]\n\nTarget:\nlemma LinearEquiv.charpoly_conj (e : M₁ ≃ₗ[R] M₂) (φ : Module.End R M₁) :\n (e.conj φ).charpoly = φ.charpoly :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Charpoly","family_id":"linearequiv","file_id":"mathlib/Mathlib/LinearAlgebra/Charpoly/ToMatrix.lean","sample_id":"57596c7226016462a23949e6ea93a54316af2221967ae24cad1a25b185f92483"},"split":"validation"} {"binding":{"chosen_proof_sha256":"41505fad08a882f8dccf141cddf38335570092c30def0476a4e569bd96c364f0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"bd69b7d5cb06628b801d8387efe0b84d829dc938f07ddc5fb82dc0244e454ed1","source_sha256":"416697ad3bd8bcfb088a8e7c76c87ecb4d2a97671573839a13fb91b3527112b2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let e := MulEquivClass.toMulEquiv e\n exact ⟨comap_prime e e.symm fun a => by simp,\n fun h => (comap_prime e.symm e fun a => by simp) <| (e.symm_apply_apply p).substr h⟩","hard_negative":true,"metrics":{"chosen_tokens":48,"rejected_tokens":8,"token_jaccard":0.066667,"token_length_ratio":0.166667},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"0411ad80336325a3083cee048f76827355ddeb261e5428d876db94224961c7e9","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Divisibility.Hom\npublic import Mathlib.Algebra.Group.Irreducible.Lemmas\npublic import Mathlib.Algebra.GroupWithZero.Equiv\npublic import Mathlib.Algebra.Prime.Defs\npublic import Mathlib.Order.Monotone.Defs\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker\n-/\n/-!\n# Associated, prime, and irreducible elements.\n\nIn this file we define the predicate `Prime p`\nsaying that an element of a commutative monoid with zero is prime.\nNamely, `Prime p` means that `p` isn't zero, it isn't a unit,\nand `p ∣ a * b → p ∣ a ∨ p ∣ b` for all `a`, `b`;\n\nIn decomposition monoids (e.g., `ℕ`, `ℤ`), this predicate is equivalent to `Irreducible`,\nhowever this is not true in general.\n\nWe also define an equivalence relation `Associated`\nsaying that two elements of a monoid differ by a multiplication by a unit.\nThen we show that the quotient type `Associates` is a monoid\nand prove basic properties of this quotient.\n-/\n\npublic section\n\nassert_not_exists IsOrderedMonoid Multiset\n\nvariable {M N : Type*}\n\nsection Prime\n\nvariable [CommMonoidWithZero M]\n\nsection Map\n\nvariable [CommMonoidWithZero N] {F : Type*} {G : Type*} [FunLike F M N]\nvariable [MonoidWithZeroHomClass F M N] [FunLike G N M] [MulHomClass G N M]\nvariable (f : F) (g : G) {p : M}\n\ntheorem comap_prime (hinv : ∀ a, g (f a : N) = a) (hp : Prime (f p)) : Prime p :=\n ⟨fun h => hp.1 <| by simp [h], fun h => hp.2.1 <| h.map f, fun a b h => by\n refine\n (hp.2.2 (f a) (f b) <| by\n convert! map_dvd f h\n simp).imp\n ?_ ?_ <;>\n · intro h\n convert! ← map_dvd g h <;> apply hinv⟩\n\nTarget:\ntheorem MulEquiv.prime_iff {E : Type*} [EquivLike E M N] [MulEquivClass E M N] (e : E) :\n Prime (e p) ↔ Prime p :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"0033c2aaa3e94b418bcb215c6738f2ff058e61894dcf5fd3b4c25013d9e77288","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Prime","family_id":"mulequiv","file_id":"mathlib/Mathlib/Algebra/Prime/Lemmas.lean","sample_id":"bd69b7d5cb06628b801d8387efe0b84d829dc938f07ddc5fb82dc0244e454ed1"},"split":"validation"} {"binding":{"chosen_proof_sha256":"6bc12762f785864b83212cf83edd04640292f6138d0cd8b8ec222ff4cc1d9e74","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"1b197bec7cc9ad45972170737ea1e2f9049a4da7bfa4a7ad59597299aac7f908","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"631a5c27d359997eaffc49fbfaae20900df2d4b6394167040420c6ef9727e90c","source_sha256":"68837b163b389d23b448b42fd6a15b696bef3e8ca80152666170476a190f313d","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa [directSumLeft] using! lequivCongrLeft_lof S (by simp) _ _ rfl","hard_negative":true,"metrics":{"chosen_tokens":16,"rejected_tokens":3,"token_jaccard":0.0625,"token_length_ratio":0.1875},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"07f988ce7c22c7ade9a5589f92908cb745ea79644054e57fd9f31d581d6cd00c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.Algebra.DirectSum.Module\n\nNamespace:\nTensorProduct\n\nLocal context:\n/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Mario Carneiro, Eric Wieser\n-/\n/-!\n# Tensor products of direct sums\n\nThis file shows that taking `TensorProduct`s commutes with taking `DirectSum`s in both arguments.\n\n## Main results\n\n* `TensorProduct.directSum`\n* `TensorProduct.directSumLeft`\n* `TensorProduct.directSumRight`\n-/\n\n@[expose] public section\n\nuniverse u v₁ v₂ w₁ w₁' w₂ w₂'\n\nsection Ring\n\nnamespace TensorProduct\n\nopen TensorProduct\n\nopen DirectSum\n\nopen LinearMap\n\nattribute [local ext] TensorProduct.ext\n\nvariable (R : Type u) [CommSemiring R] (S) [Semiring S] [Algebra R S]\nvariable {ι₁ : Type v₁} {ι₂ : Type v₂}\nvariable [DecidableEq ι₁] [DecidableEq ι₂]\nvariable (M₁ : ι₁ → Type w₁) (M₁' : Type w₁') (M₂ : ι₂ → Type w₂) (M₂' : Type w₂')\nvariable [∀ i₁, AddCommMonoid (M₁ i₁)] [AddCommMonoid M₁']\nvariable [∀ i₂, AddCommMonoid (M₂ i₂)] [AddCommMonoid M₂']\nvariable [∀ i₁, Module R (M₁ i₁)] [Module R M₁'] [∀ i₂, Module R (M₂ i₂)] [Module R M₂']\nvariable [∀ i₁, Module S (M₁ i₁)] [∀ i₁, IsScalarTower R S (M₁ i₁)]\nvariable [Module S M₁'] [IsScalarTower R S M₁']\n\n/-- The linear equivalence `(⨁ i₁, M₁ i₁) ⊗ (⨁ i₂, M₂ i₂) ≃ (⨁ i₁, ⨁ i₂, M₁ i₁ ⊗ M₂ i₂)`, i.e.\n\"tensor product distributes over direct sum\". -/\nprotected def directSum :\n ((⨁ i₁, M₁ i₁) ⊗[R] ⨁ i₂, M₂ i₂) ≃ₗ[S] ⨁ i : ι₁ × ι₂, M₁ i.1 ⊗[R] M₂ i.2 := by\n refine LinearEquiv.ofLinear ?toFun ?invFun ?left ?right\n · exact AlgebraTensorModule.lift <|\n toModule S _ _ fun i₁ => flip <| toModule R _ _ fun i₂ => flip <| AlgebraTensorModule.curry <|\n DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂)\n · exact toModule S _ _ fun i => AlgebraTensorModule.map (lof S _ M₁ i.1) (lof R _ M₂ i.2)\n · ext ⟨i₁, i₂⟩ x₁ x₂ : 4\n simp only [coe_comp, Function.comp_apply, toModule_lof, AlgebraTensorModule.map_tmul,\n AlgebraTensorModule.lift_apply, lift.tmul, coe_restrictScalars, flip_apply,\n AlgebraTensorModule.curry_apply, curry_apply, id_comp]\n · ext i₁ i₂ x₁ x₂ : 5\n simp only [coe_comp, Function.comp_apply, AlgebraTensorModule.curry_apply, curry_apply,\n coe_restrictScalars, AlgebraTensorModule.lift_apply, lift.tmul, toModule_lof, flip_apply,\n AlgebraTensorModule.map_tmul, id_coe, id_eq]\n\n/-- Tensor products distribute over a direct sum on the left . -/\ndef directSumLeft : (⨁ i₁, M₁ i₁) ⊗[R] M₂' ≃ₗ[S] ⨁ i, M₁ i ⊗[R] M₂' :=\n TensorProduct.AlgebraTensorModule.congr 1 (DirectSum.lid _ _).symm ≪≫ₗ\n TensorProduct.directSum R S M₁ (fun _ : Unit ↦ M₂') ≪≫ₗ\n DirectSum.lequivCongrLeft S (Equiv.prodUnique _ _)\n\n/-- Tensor products distribute over a direct sum on the right. -/\ndef directSumRight : (M₁' ⊗[R] ⨁ i, M₂ i) ≃ₗ[S] ⨁ i, M₁' ⊗[R] M₂ i :=\n TensorProduct.AlgebraTensorModule.congr (DirectSum.lid _ _).symm 1 ≪≫ₗ\n TensorProduct.directSum R S (fun _ : Unit ↦ M₁') M₂ ≪≫ₗ\n DirectSum.lequivCongrLeft S (Equiv.uniqueProd _ _)\n\n@[deprecated (since := \"2026-03-04\")] alias directSumRight' := directSumRight\n\nvariable {M₁ M₁' M₂ M₂'}\n\n@[simp]\ntheorem directSum_lof_tmul_lof (i₁ : ι₁) (m₁ : M₁ i₁) (i₂ : ι₂) (m₂ : M₂ i₂) :\n TensorProduct.directSum R S M₁ M₂ (DirectSum.lof S ι₁ M₁ i₁ m₁ ⊗ₜ DirectSum.lof R ι₂ M₂ i₂ m₂) =\n DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂) (m₁ ⊗ₜ m₂) := by\n simp [TensorProduct.directSum]\n\n@[simp]\ntheorem directSum_symm_lof_tmul (i₁ : ι₁) (m₁ : M₁ i₁) (i₂ : ι₂) (m₂ : M₂ i₂) :\n (TensorProduct.directSum R S M₁ M₂).symm\n (DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂) (m₁ ⊗ₜ m₂)) =\n (DirectSum.lof S ι₁ M₁ i₁ m₁ ⊗ₜ DirectSum.lof R ι₂ M₂ i₂ m₂) := by\n rw [LinearEquiv.symm_apply_eq, directSum_lof_tmul_lof]\n\n@[simp]\n\nTarget:\ntheorem directSumLeft_tmul_lof (i : ι₁) (x : M₁ i) (y : M₂') :\n directSumLeft R S M₁ M₂' (DirectSum.lof S _ _ i x ⊗ₜ[R] y) =\n DirectSum.lof S _ _ i (x ⊗ₜ[R] y) :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_631a5c27d359","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"fc638d32338b95e83ff176cc8d80c61f63a9839f8c0c815dee6c52bb1807cab9","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/DirectSum","family_id":"directsumleft_tmul_lof","file_id":"mathlib/Mathlib/LinearAlgebra/DirectSum/TensorProduct.lean","sample_id":"631a5c27d359997eaffc49fbfaae20900df2d4b6394167040420c6ef9727e90c"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f57503c52a9b1e060292c072a271bc94ef8f6572828934221808d804a1a188fe","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"f377f388a9f5631d36b77098fdea6a51ebb5cbc45eadbe54df726bdfc782be4d","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"9eec81e091d440b4cd965592fdfb7b79b65254c69b28e5587ef953fdbdf0da3f","source_sha256":"8ffbc81a3567c29009e2b20cc3c4b3a75af8d50dc4bc70ce72316fca439dda83","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n nth_rw 1 [← Category.id_comp (𝟙 X)]\n simp only [P.map_comp]","hard_negative":true,"metrics":{"chosen_tokens":20,"rejected_tokens":3,"token_jaccard":0.052632,"token_length_ratio":0.15},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"08289f2fe563ba777d0de85bd93374268093907cede133a9686484442878b009","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Yoneda\n\nNamespace:\nCategoryTheory.ProfunctorCore\n\nLocal context:\n/-\nCopyright (c) 2026 Dagur Asgeirsson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Dagur Asgeirsson, Adam Topaz, Adrian Marti\n-/\n/-!\n\n# Profunctors\n\nA profunctor from a category `C` to a category `D` is a functor from `C` to a category of\npresheaves of sets on `D`. We define this as `Profunctor.{w} C D := C ⥤ Dᵒᵖ ⥤ Type w`.\n\nThis file provides convenient constructors `ProfunctorCore` and `ProfunctorCore.Hom` for profunctors\nand natural transformations between them. We also define the identity profunctor `Profunctor.id`\nas the Yoneda bifunctor, the opposite of a profunctor, the `ulift` of a profunctor, whiskering\nof a profunctor with functors, and the profunctors in both directions corresponding to a functor\n`C ⥤ D` (see `Functor.toProfunctor` and `Functor.toProfunctorFlip`).\n\n## Future work\n\n- Define composition of profunctors.\n- Define the bicategory of categories where the 1-morphisms are profunctors.\n-/\n\n@[expose] public section\n\nnamespace CategoryTheory\n\nopen Opposite\n\nuniverse w' w v₁ v₂ u₁ u₂\n\nvariable (C : Type u₁) (D : Type u₂) [Category.{v₁} C] [Category.{v₂} D]\n\n/-- Custom structure to construct profunctors, i.e. bifunctors `C ⥤ Dᵒᵖ ⥤ Type w`. -/\n@[pp_with_univ]\nstructure ProfunctorCore where\n /-- The object part -/\n obj : C → D → Type w\n /-- The morphism part -/\n map {X X' : C} {Y Y' : D} (f : X ⟶ X') (g : Y ⟶ Y') : obj X Y' ⟶ obj X' Y\n map_id (X : C) (Y : D) : map (𝟙 X) (𝟙 Y) = 𝟙 _ := by cat_disch\n map_comp {X₁ X₂ X₃ : C} {Y₁ Y₂ Y₃ : D} (f : X₁ ⟶ X₂) (f' : X₂ ⟶ X₃) (g : Y₁ ⟶ Y₂) (g' : Y₂ ⟶ Y₃) :\n map (f ≫ f') (g ≫ g') = map f g' ≫ map f' g := by cat_disch\n\nattribute [simp] ProfunctorCore.map_id ProfunctorCore.map_comp\n\n/-- A profunctor from C to D (`Profunctor.{w} C D`) is a bifunctor `C ⥤ Dᵒᵖ ⥤ Type w`. -/\n@[pp_with_univ]\nabbrev Profunctor := C ⥤ Dᵒᵖ ⥤ Type w\n\nvariable {C D}\n\n/-- Typecheck a bifunctor `C ⥤ Dᵒᵖ ⥤ Type w` as a profunctor. -/\nabbrev Functor.profunctor (F : C ⥤ Dᵒᵖ ⥤ Type w) : Profunctor.{w} C D := F\n\nnamespace ProfunctorCore\n\n/-- Custom structure to construct natural transformations between profunctors, see\n`CategoryTheory.Profunctor.ofHom`. -/\nstructure Hom (P Q : ProfunctorCore.{w} C D) where\n /-- The components of the natural transformation -/\n app (X : C) (Y : D) : P.obj X Y ⟶ Q.obj X Y\n naturality ⦃X X' : C⦄ ⦃Y Y' : D⦄ (f : X ⟶ X') (g : Y ⟶ Y') :\n P.map f g ≫ app X' Y = app X Y' ≫ Q.map f g := by cat_disch\n\nattribute [reassoc (attr := simp)] ProfunctorCore.Hom.naturality\n\n@[simp]\n\nTarget:\nlemma map_id_comp (P : ProfunctorCore.{w} C D) (X : C) {Y Y' Y'' : D}\n (g : Y ⟶ Y') (g' : Y' ⟶ Y'') :\n P.map (𝟙 X) (g ≫ g') = P.map (𝟙 X) g' ≫ P.map (𝟙 X) g :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_9eec81e091d4","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"8ec8a68ad9ab833b82e745117914621d764200d5466c49ac94c61fd9622ee850","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Profunctor","family_id":"map_id_comp","file_id":"mathlib/Mathlib/CategoryTheory/Profunctor/Basic.lean","sample_id":"9eec81e091d440b4cd965592fdfb7b79b65254c69b28e5587ef953fdbdf0da3f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"2e2a0ea703b7a3bfdb7e14e12a69aba635aaedc52b307b58fc0bc2f916eae48a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"34b667446c8715de32ab515941949dd3f64f2152c4708c69d3fe5b337f95673e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"93ce585b4eb43d761cd3a6e8a7821422241492ef2e0cddda81b97895591573f8","source_sha256":"4188929eaab00be25e03f370f903a35926218751914f9459e15da14f5b80289a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by grind\n\n/-!\n### Algebraic replacement rules\n\nA collection of lemmas to transfer associativity, commutativity, distributivity, ... of operations\nto the associativity, commutativity, distributivity, ... of `Option.map₂` of those operations.\nThe proof pattern is `map₂_lemma operation_lemma`. For example, `map₂_comm mul_comm` proves that\n`map₂ (*) a b = map₂ (*) g f` in a `CommSemigroup`.\n-/\n\nvariable {α' β' δ' ε ε' : Type*}","hard_negative":false,"metrics":{"chosen_tokens":112,"rejected_tokens":119,"token_jaccard":0.983333,"token_length_ratio":1.0625},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"0b4a26c3e93100a950c96db4c2211e803cd7db8887cfadd37b18808ea8252f29","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Init\n\nNamespace:\nOption\n\nLocal context:\n/-\nCopyright (c) 2022 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Binary map of options\n\nThis file defines the binary map of `Option`. This is mostly useful to define pointwise operations\non intervals.\n\n## Main declarations\n\n* `Option.map₂`: Binary map of options.\n\n## Notes\n\nThis file is very similar to the n-ary section of `Mathlib/Data/Set/Basic.lean`, to\n`Mathlib/Data/Finset/NAry.lean` and to `Mathlib/Order/Filter/NAry.lean`. Please keep them in sync.\n\nWe do not define `Option.map₃` as its only purpose so far would be to prove properties of\n`Option.map₂` and casing already fulfills this task.\n-/\n\n@[expose] public section\n\nuniverse u\n\nopen Function\n\nnamespace Option\n\n-- Allow `grind` to case split on `Option` in this file.\nattribute [local grind cases] Option\n\nvariable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ}\n\n/-- The image of a binary function `f : α → β → γ` as a function `Option α → Option β → Option γ`.\nMathematically this should be thought of as the image of the corresponding function `α × β → γ`. -/\ndef map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ :=\n a.bind fun a => b.map <| f a\n\n/-- `Option.map₂` in terms of monadic operations. Note that this can't be taken as the definition\nbecause of the lack of universe polymorphism. -/\ntheorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) :\n map₂ f a b = f <$> a <*> b := by\n cases a <;> rfl\n\n@[simp, grind =]\ntheorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl\n\ntheorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl\n\n@[simp, grind =]\ntheorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl\n\n@[simp, grind =]\ntheorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl\n\n@[simp]\ntheorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b :=\n rfl\n\n@[simp]\ntheorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) :\n map₂ f a b = a.map fun a => f a b := by grind\n\ntheorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by\n grind\n\n/-- `simp`-normal form of `mem_map₂_iff`. -/\n@[simp]\ntheorem map₂_eq_some_iff {c : γ} :\n map₂ f a b = some c ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by\n grind\n\n@[simp]\ntheorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by\n grind\n\ntheorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) :\n map₂ f a b = map₂ (fun a b => f b a) b a := by grind\n\ntheorem map_map₂ (f : α → β → γ) (g : γ → δ) :\n (map₂ f a b).map g = map₂ (fun a b => g (f a b)) a b := by grind\n\ntheorem map₂_map_left (f : γ → β → δ) (g : α → γ) :\n map₂ f (a.map g) b = map₂ (fun a b => f (g a) b) a b := by grind\n\ntheorem map₂_map_right (f : α → γ → δ) (g : β → γ) :\n map₂ f a (b.map g) = map₂ (fun a b => f a (g b)) a b := by grind\n\n@[simp]\ntheorem map₂_curry (f : α × β → γ) (a : Option α) (b : Option β) :\n map₂ (curry f) a b = Option.map f (map₂ Prod.mk a b) := by grind\n\n@[simp]\n\nTarget:\ntheorem map_uncurry (f : α → β → γ) (x : Option (α × β)) :\n x.map (uncurry f) = map₂ f (x.map Prod.fst) (x.map Prod.snd) :=\n\nProof body:\n","rejected":"```lean\nby grind\n\n/-!\n### Algebraic replacement rules\n\nA collection of lemmas to transfer associativity, commutativity, distributivity, ... of operations\nto the associativity, commutativity, distributivity, ... of `Option.map₂` of those operations.\nThe proof pattern is `map₂_lemma operation_lemma`. For example, `map₂_comm mul_comm` proves that\n`map₂ (*) a b = map₂ (*) g f` in a `CommSemigroup`.\n-/\n\nvariable {α' β' δ' ε ε' : Type*}\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Option","family_id":"map_uncurry","file_id":"mathlib/Mathlib/Data/Option/NAry.lean","sample_id":"93ce585b4eb43d761cd3a6e8a7821422241492ef2e0cddda81b97895591573f8"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3b7fa3516e478d4728064b8bda1b24dff6f3a5183e11f927859ac602fa9f1e65","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e4b57ae1ccf65ab819e0c71f178b2012f736f8de8ce428a937e1d98b639e4857","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"38819818442ade560648919a10c51ac14604fc55aa582b1d981d1de43c58a697","source_sha256":"a91a234de35e8af83e1c9528f7d4c26e495bd57861b8ea2191b34d48fc7888f5","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← IntermediateField.fixingSubgroup_bot, fixedField_fixingSubgroup]","hard_negative":false,"metrics":{"chosen_tokens":10,"rejected_tokens":15,"token_jaccard":0.666667,"token_length_ratio":1.5},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"0c18540493ba89235bb049c297f722e295353b2b7469f83270a7d59ac1cc34c0","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.FieldTheory.KrullTopology\npublic import Mathlib.FieldTheory.Galois.GaloisClosure\npublic import Mathlib.Topology.Algebra.Group.ClosedSubgroup\n\nNamespace:\nInfiniteGalois\n\nLocal context:\n/-\nCopyright (c) 2024 Nailin Guan. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Nailin Guan\n-/\n/-!\n\n# The Fundamental Theorem of Infinite Galois Theory\n\nIn this file, we prove the fundamental theorem of infinite Galois theory and the special case for\nopen subgroups and normal subgroups. We first verify that `IntermediateField.fixingSubgroup` and\n`IntermediateField.fixedField` are inverses of each other between intermediate fields and\nclosed subgroups of the Galois group.\n\n## Main definitions and results\n\nIn `K/k`, for any intermediate field `L` :\n\n* `fixingSubgroup_isClosed` : the subgroup fixing `L` (`Gal(K/L)`) is closed.\n\n* `fixedField_fixingSubgroup` : the field fixed by the\n subgroup fixing `L` is equal to `L` itself.\n\nFor any subgroup `H` of `Gal(K/k)` :\n\n* `restrict_fixedField` : For a Galois intermediate field `M`, the fixed field of the image of `H`\n restricted to `M` is equal to the fixed field of `H` intersected with `M`.\n* `fixingSubgroup_fixedField` : If `H` is closed, the fixing subgroup of the fixed field of `H`\n is equal to `H` itself.\n\nThe fundamental theorem of infinite Galois theory :\n\n* `IntermediateFieldEquivClosedSubgroup` : The order equivalence is given by mapping any\n intermediate field `L` to the subgroup fixing `L`, and the inverse maps any\n closed subgroup of `Gal(K/k)` `H` to the fixed field of `H`. The composition is equal to\n the identity as described in the lemmas above, and compatibility with the order follows easily.\n\nSpecial cases :\n\n* `isOpen_iff_finite` : The fixing subgroup of an intermediate field `L` is open if and only if\n `L` is finite-dimensional.\n\n* `normal_iff_isGalois` : The fixing subgroup of an intermediate field `L` is normal if and only if\n `L` is Galois.\n\n-/\n\n@[expose] public section\n\nvariable {k K : Type*} [Field k] [Field K] [Algebra k K]\n\nnamespace InfiniteGalois\n\nopen scoped Pointwise\nopen FiniteGaloisIntermediateField AlgEquiv\n--Note: The `adjoin`s below are `FiniteGaloisIntermediateField.adjoin`\n\nlemma fixingSubgroup_isClosed (L : IntermediateField k K) [IsGalois k K] :\n IsClosed (L.fixingSubgroup : Set Gal(K/k)) where\n isOpen_compl := isOpen_iff_mem_nhds.mpr fun σ h => by\n apply mem_nhds_iff.mpr\n rcases Set.not_subset.mp ((mem_fixingSubgroup_iff Gal(K/k)).not.mp h) with ⟨y, yL, ne⟩\n use σ • ((adjoin k {y}).1.fixingSubgroup : Set Gal(K/k))\n constructor\n · intro f hf\n rcases (Set.mem_smul_set.mp hf) with ⟨g, hg, eq⟩\n simp only [Set.mem_compl_iff, SetLike.mem_coe, ← eq]\n apply (mem_fixingSubgroup_iff Gal(K/k)).not.mpr\n push Not\n use y\n simp only [yL, smul_eq_mul, AlgEquiv.smul_def, AlgEquiv.mul_apply, ne_eq, true_and]\n have : g y = y := (mem_fixingSubgroup_iff Gal(K/k)).mp hg y <|\n adjoin_simple_le_iff.mp le_rfl\n simpa only [this, ne_eq, AlgEquiv.smul_def] using! ne\n · simp only [(IntermediateField.fixingSubgroup_isOpen (adjoin k {y}).1).smul σ, true_and]\n use 1\n simp only [SetLike.mem_coe, smul_eq_mul, mul_one, and_true, Subgroup.one_mem]\n\nlemma fixedField_fixingSubgroup (L : IntermediateField k K) [IsGalois k K] :\n IntermediateField.fixedField L.fixingSubgroup = L := by\n apply le_antisymm\n · intro x hx\n rw [IntermediateField.mem_fixedField_iff] at hx\n have mem : x ∈ (adjoin L {x}).1 := subset_adjoin _ _ rfl\n have : IntermediateField.fixedField (⊤ : Subgroup ((adjoin L {x}) ≃ₐ[L] (adjoin L {x}))) = ⊥ :=\n (IsGalois.tfae.out 0 1).mp (by infer_instance)\n have : ⟨x, mem⟩ ∈ (⊥ : IntermediateField L (adjoin L {x})) := by\n rw [← this, IntermediateField.mem_fixedField_iff]\n intro f _\n rcases restrictNormalHom_surjective K f with ⟨σ, hσ⟩\n apply Subtype.val_injective\n rw [← hσ, restrictNormalHom_apply (adjoin L {x}).1 σ ⟨x, mem⟩]\n have := hx ((IntermediateField.fixingSubgroupEquiv L).symm σ)\n simpa only [SetLike.coe_mem, true_implies]\n rcases IntermediateField.mem_bot.mp this with ⟨y, hy⟩\n obtain ⟨rfl⟩ : y = x := congrArg Subtype.val hy\n exact y.2\n · exact (IntermediateField.le_iff_le L.fixingSubgroup L).mpr le_rfl\n\nTarget:\nlemma fixedField_bot [IsGalois k K] :\n IntermediateField.fixedField (⊤ : Subgroup Gal(K/k)) = ⊥ :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n rw [← IntermediateField.fixingSubgroup_bot, fixedField_fixingSubgroup]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"FieldTheory/Galois","family_id":"fixedfield_bot","file_id":"mathlib/Mathlib/FieldTheory/Galois/Infinite.lean","sample_id":"38819818442ade560648919a10c51ac14604fc55aa582b1d981d1de43c58a697"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3b7fa3516e478d4728064b8bda1b24dff6f3a5183e11f927859ac602fa9f1e65","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"38819818442ade560648919a10c51ac14604fc55aa582b1d981d1de43c58a697","source_sha256":"a91a234de35e8af83e1c9528f7d4c26e495bd57861b8ea2191b34d48fc7888f5","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← IntermediateField.fixingSubgroup_bot, fixedField_fixingSubgroup]","hard_negative":true,"metrics":{"chosen_tokens":10,"rejected_tokens":8,"token_jaccard":0.0625,"token_length_ratio":0.8},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"0de432d0d912e9a6376fcd247ce1b9c8ba5d7e7156321e1dedb0cf072531633c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.FieldTheory.KrullTopology\npublic import Mathlib.FieldTheory.Galois.GaloisClosure\npublic import Mathlib.Topology.Algebra.Group.ClosedSubgroup\n\nNamespace:\nInfiniteGalois\n\nLocal context:\n/-\nCopyright (c) 2024 Nailin Guan. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Nailin Guan\n-/\n/-!\n\n# The Fundamental Theorem of Infinite Galois Theory\n\nIn this file, we prove the fundamental theorem of infinite Galois theory and the special case for\nopen subgroups and normal subgroups. We first verify that `IntermediateField.fixingSubgroup` and\n`IntermediateField.fixedField` are inverses of each other between intermediate fields and\nclosed subgroups of the Galois group.\n\n## Main definitions and results\n\nIn `K/k`, for any intermediate field `L` :\n\n* `fixingSubgroup_isClosed` : the subgroup fixing `L` (`Gal(K/L)`) is closed.\n\n* `fixedField_fixingSubgroup` : the field fixed by the\n subgroup fixing `L` is equal to `L` itself.\n\nFor any subgroup `H` of `Gal(K/k)` :\n\n* `restrict_fixedField` : For a Galois intermediate field `M`, the fixed field of the image of `H`\n restricted to `M` is equal to the fixed field of `H` intersected with `M`.\n* `fixingSubgroup_fixedField` : If `H` is closed, the fixing subgroup of the fixed field of `H`\n is equal to `H` itself.\n\nThe fundamental theorem of infinite Galois theory :\n\n* `IntermediateFieldEquivClosedSubgroup` : The order equivalence is given by mapping any\n intermediate field `L` to the subgroup fixing `L`, and the inverse maps any\n closed subgroup of `Gal(K/k)` `H` to the fixed field of `H`. The composition is equal to\n the identity as described in the lemmas above, and compatibility with the order follows easily.\n\nSpecial cases :\n\n* `isOpen_iff_finite` : The fixing subgroup of an intermediate field `L` is open if and only if\n `L` is finite-dimensional.\n\n* `normal_iff_isGalois` : The fixing subgroup of an intermediate field `L` is normal if and only if\n `L` is Galois.\n\n-/\n\n@[expose] public section\n\nvariable {k K : Type*} [Field k] [Field K] [Algebra k K]\n\nnamespace InfiniteGalois\n\nopen scoped Pointwise\nopen FiniteGaloisIntermediateField AlgEquiv\n--Note: The `adjoin`s below are `FiniteGaloisIntermediateField.adjoin`\n\nlemma fixingSubgroup_isClosed (L : IntermediateField k K) [IsGalois k K] :\n IsClosed (L.fixingSubgroup : Set Gal(K/k)) where\n isOpen_compl := isOpen_iff_mem_nhds.mpr fun σ h => by\n apply mem_nhds_iff.mpr\n rcases Set.not_subset.mp ((mem_fixingSubgroup_iff Gal(K/k)).not.mp h) with ⟨y, yL, ne⟩\n use σ • ((adjoin k {y}).1.fixingSubgroup : Set Gal(K/k))\n constructor\n · intro f hf\n rcases (Set.mem_smul_set.mp hf) with ⟨g, hg, eq⟩\n simp only [Set.mem_compl_iff, SetLike.mem_coe, ← eq]\n apply (mem_fixingSubgroup_iff Gal(K/k)).not.mpr\n push Not\n use y\n simp only [yL, smul_eq_mul, AlgEquiv.smul_def, AlgEquiv.mul_apply, ne_eq, true_and]\n have : g y = y := (mem_fixingSubgroup_iff Gal(K/k)).mp hg y <|\n adjoin_simple_le_iff.mp le_rfl\n simpa only [this, ne_eq, AlgEquiv.smul_def] using! ne\n · simp only [(IntermediateField.fixingSubgroup_isOpen (adjoin k {y}).1).smul σ, true_and]\n use 1\n simp only [SetLike.mem_coe, smul_eq_mul, mul_one, and_true, Subgroup.one_mem]\n\nlemma fixedField_fixingSubgroup (L : IntermediateField k K) [IsGalois k K] :\n IntermediateField.fixedField L.fixingSubgroup = L := by\n apply le_antisymm\n · intro x hx\n rw [IntermediateField.mem_fixedField_iff] at hx\n have mem : x ∈ (adjoin L {x}).1 := subset_adjoin _ _ rfl\n have : IntermediateField.fixedField (⊤ : Subgroup ((adjoin L {x}) ≃ₐ[L] (adjoin L {x}))) = ⊥ :=\n (IsGalois.tfae.out 0 1).mp (by infer_instance)\n have : ⟨x, mem⟩ ∈ (⊥ : IntermediateField L (adjoin L {x})) := by\n rw [← this, IntermediateField.mem_fixedField_iff]\n intro f _\n rcases restrictNormalHom_surjective K f with ⟨σ, hσ⟩\n apply Subtype.val_injective\n rw [← hσ, restrictNormalHom_apply (adjoin L {x}).1 σ ⟨x, mem⟩]\n have := hx ((IntermediateField.fixingSubgroupEquiv L).symm σ)\n simpa only [SetLike.coe_mem, true_implies]\n rcases IntermediateField.mem_bot.mp this with ⟨y, hy⟩\n obtain ⟨rfl⟩ : y = x := congrArg Subtype.val hy\n exact y.2\n · exact (IntermediateField.le_iff_le L.fixingSubgroup L).mpr le_rfl\n\nTarget:\nlemma fixedField_bot [IsGalois k K] :\n IntermediateField.fixedField (⊤ : Subgroup Gal(K/k)) = ⊥ :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"1ad148e5fa26ea030238391455dbafa2d8f0ee7d86721816bf9cdcce3fb7f314","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"FieldTheory/Galois","family_id":"fixedfield_bot","file_id":"mathlib/Mathlib/FieldTheory/Galois/Infinite.lean","sample_id":"38819818442ade560648919a10c51ac14604fc55aa582b1d981d1de43c58a697"},"split":"validation"} {"binding":{"chosen_proof_sha256":"96a4647d38d2be134bd0cbc054a26eb639ec9b413425186d651a50ebfb54c53a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"5b136b19dc293ad6ab3497a181ea0b31d603812b5e13b2ecdd886e040e632eba","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ced8639e1ca4d495f44ecd51985ed45400cfaa22445376bb03249bbf6ab81a02","source_sha256":"917f3cb2e1213b32d3e18dd0a2b54c8129085a11b702148659e7554792c22323","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine .of_continuous_injective_isClosedMap\n natUnionInftyEmbedding.continuous ?_ ?_\n · rintro (_ | n) (_ | m) h\n · rfl\n · simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, zero_eq_inv] at h\n assumption_mod_cast\n · simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, inv_eq_zero] at h\n assumption_mod_cast\n · simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, inv_inj, add_left_inj,\n Nat.cast_inj] at h\n rw [h]\n · exact fun _ hC => (hC.isCompact.image natUnionInftyEmbedding.continuous).isClosed","hard_negative":true,"metrics":{"chosen_tokens":104,"rejected_tokens":5,"token_jaccard":0.069767,"token_length_ratio":0.048077},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"0ebc7cc9fe4cca5319d54b1a6f9b0ccf07aecc66a54396580529b5799b5a91f8","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Compactification.OnePoint.Basic\npublic import Mathlib.Topology.Category.LightProfinite.Basic\n\nNamespace:\nLightProfinite\n\nLocal context:\n/-\nCopyright (c) 2024 Dagur Asgeirsson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Dagur Asgeirsson\n-/\n/-!\n\n# The light profinite set classifying convergent sequences\n\nThis file defines the light profinite set `ℕ∪{∞}`, defined as the one point compactification of\n`ℕ`.\n-/\n\n@[expose] public section\n\nopen CategoryTheory OnePoint TopologicalSpace Topology\n\nnamespace LightProfinite\n\n/-- The continuous map from `ℕ∪{∞}` to `ℝ` sending `n` to `1/(n+1)` and `∞` to `0`. -/\nnoncomputable def natUnionInftyEmbedding : C(OnePoint ℕ, ℝ) where\n toFun\n | ∞ => 0\n | OnePoint.some n => 1 / (n + 1 : ℝ)\n continuous_toFun := OnePoint.continuous_iff_from_nat _ |>.mpr\n tendsto_one_div_add_atTop_nhds_zero_nat\n\n/--\nThe continuous map from `ℕ∪{∞}` to `ℝ` sending `n` to `1/(n+1)` and `∞` to `0` is a closed\nembedding.\n-/\n\nTarget:\nlemma isClosedEmbedding_natUnionInftyEmbedding : IsClosedEmbedding natUnionInftyEmbedding :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_ced8639e1ca4","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"e455f32ec3c89c21a4cda9fafd5bef35071bf6a87a68b70467966c3909211b4b","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Category","family_id":"isclosedembedding_natunioninftyembedding","file_id":"mathlib/Mathlib/Topology/Category/LightProfinite/Sequence.lean","sample_id":"ced8639e1ca4d495f44ecd51985ed45400cfaa22445376bb03249bbf6ab81a02"},"split":"validation"} {"binding":{"chosen_proof_sha256":"eb8f944b0a010b198f031875958cb4d7deba167d646db8ab4e937c25eaaaba51","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"163ea97fc133a493f6d04ad2d7794aa07032a2f603459ef865194d9a5559d48c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"7e9891faa4cbd8996654fc0292fd355985af01408e265aec5eba539569823604","source_sha256":"6f616ab12827a9e368ac6aac43138d4ab446258d4ca70bd2bae4eb88fa4dfcff","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have := MorphismProperty.locallyCoverDense_forget_of_le (S := S) K H\n rw [toGrothendieck_comap_forget_eq_restrictedTopology _ H]\n exact Functor.coverPreserving_restrictedTopology (Over.forget P ⊤ S) (K.toGrothendieck.over S)\n\nvariable [HasFiniteWidePullbacks C] [P.HasOfPostcompProperty P] [P.IsStableUnderBaseChange]\n [P.ContainsIdentities]","hard_negative":true,"metrics":{"chosen_tokens":60,"rejected_tokens":5,"token_jaccard":0.090909,"token_length_ratio":0.083333},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"0f7522b671829c1621b6618ed73b3e574005eb25ee37bae03fdb34fd6708e10b","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.MorphismProperty.Comma\npublic import Mathlib.CategoryTheory.Limits.MorphismProperty\npublic import Mathlib.CategoryTheory.Sites.MorphismProperty\npublic import Mathlib.CategoryTheory.Sites.Over\n\nNamespace:\nCategoryTheory.MorphismProperty\n\nLocal context:\n/-\nCopyright (c) 2026 Christian Merten. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Christian Merten\n-/\n/-!\n\n# Sites on `P.Over ⊤ X`\n\nWe provide some API for proving properties of `P.Over ⊤ X` in relation to precoverages. Consider\na precoverage `K` on `C`.\n\n## Main results\n\n- `CategoryTheory.MorphismProperty.locallyCoverDense_forget_of_le`:\n The forgetful functor `P.Over ⊤ X ⥤ Over X` is locally cover dense if morphisms in `K`\n satisfy `P`.\n- `CategoryTheory.MorphismProperty.toGrothendieck_comap_forget_eq_restrictedTopology`: The topology\n generated by the precoverage induced from `K` via the composition `P.Over ⊤ X ⥤ Over X ⥤ C` is\n the induced topology from the forgetful functor `P.Over ⊤ X ⥤ Over X`.\n\n-/\n\npublic section\n\nuniverse v u\n\nopen CategoryTheory MorphismProperty Limits\n\nnamespace CategoryTheory.MorphismProperty\n\nvariable {C : Type*} [Category* C]\n\nvariable {P : MorphismProperty C} {S : C} [P.IsStableUnderComposition]\n\nset_option backward.defeqAttrib.useBackward true in\nlemma exists_map_eq_of_presieve (K : Precoverage C) (H : K ≤ P.precoverage)\n {X : P.Over ⊤ S} {R : Presieve ((MorphismProperty.Over.forget P ⊤ S).obj X)}\n (hR : R ∈ (K.comap <| CategoryTheory.Over.forget S) _) :\n ∃ T : Presieve X, T.map (MorphismProperty.Over.forget P ⊤ S) = R := by\n rw [Precoverage.mem_iff_exists_zeroHypercover] at hR\n obtain ⟨𝒰, rfl⟩ := hR\n let 𝒱 : PreZeroHypercover X :=\n ⟨𝒰.I₀, fun i ↦ Over.mk _ (𝒰.X i).hom ?_, fun i ↦ Over.homMk (𝒰.f i).left (by simp) trivial⟩\n · use 𝒱.presieve₀\n rw [Presieve.map_ofArrows]\n rfl\n · rw [← CategoryTheory.Over.w (𝒰.f i)]\n exact P.comp_mem _ _ (H _ 𝒰.mem₀ ⟨⟨i⟩⟩) X.prop\n\nvariable (K : Precoverage C) [K.HasIsos] [K.IsStableUnderBaseChange] [K.IsStableUnderComposition]\n [K.HasPullbacks]\n\nlemma locallyCoverDense_forget_of_le (H : K ≤ P.precoverage) :\n (MorphismProperty.Over.forget P ⊤ S).LocallyCoverDense (K.toGrothendieck.over S) := by\n rw [over_toGrothendieck_eq_toGrothendieck_comap_forget]\n apply Precoverage.locallyCoverDense_of_map_functorPullback_mem\n intro X R hR\n obtain ⟨R, rfl⟩ := MorphismProperty.exists_map_eq_of_presieve _ H hR\n simpa\n\nlemma toGrothendieck_comap_forget_eq_restrictedTopology\n (H : K ≤ P.precoverage) :\n (K.comap (MorphismProperty.Over.forget P ⊤ _ ⋙ CategoryTheory.Over.forget S)).toGrothendieck =\n (MorphismProperty.Over.forget P ⊤ _).restrictedTopology (K.toGrothendieck.over S) := by\n have : (Over.forget P ⊤ S).LocallyCoverDense\n (K.comap (CategoryTheory.Over.forget S)).toGrothendieck := by\n rw [← over_toGrothendieck_eq_toGrothendieck_comap_forget]\n exact MorphismProperty.locallyCoverDense_forget_of_le (S := S) K H\n rw [Precoverage.comap_comp]\n simp_rw [over_toGrothendieck_eq_toGrothendieck_comap_forget]\n apply Precoverage.toGrothendieck_comap_eq_restrictedTopology\n intro X R hR\n obtain ⟨T, rfl⟩ := MorphismProperty.exists_map_eq_of_presieve K H hR\n simpa\n\nTarget:\nlemma coverPreserving_comap_forget (H : K ≤ P.precoverage) :\n CoverPreserving\n (K.comap (MorphismProperty.Over.forget P ⊤ _ ⋙ CategoryTheory.Over.forget S)).toGrothendieck\n (K.toGrothendieck.over S)\n (MorphismProperty.Over.forget P ⊤ S) :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_7e9891faa4cb","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"03fa8468fc8dba1612b9128a2bef4c3d6fa2dd4ef070ba0c795fb96930de5d04","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/MorphismProperty","family_id":"coverpreserving_comap_forget","file_id":"mathlib/Mathlib/CategoryTheory/MorphismProperty/CommaSites.lean","sample_id":"7e9891faa4cbd8996654fc0292fd355985af01408e265aec5eba539569823604"},"split":"validation"} {"binding":{"chosen_proof_sha256":"cf5b01726404f68401d774f6cc71a346cea9861f63ade813243cdf554437b1c2","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"668e301e2d9a5bac725c8089587b67f83b503271c9ff4c27c75bb297efd654a8","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d39e27c5da6b9455030f6e2ddf71c0baeda0371c50ea57ee2c4fc4bafb382136","source_sha256":"40b3fe35a4f6ee6eaf5570fa9a5773e90967e90bbd65a7f661f7a527d47b82ae","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [BiTotal, leftTotal_empty, rightTotal_iff_isEmpty_right, true_and]","hard_negative":true,"metrics":{"chosen_tokens":12,"rejected_tokens":2,"token_jaccard":0.090909,"token_length_ratio":0.166667},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"10c4ef5b5251c1c1c2c24ed3a7dc2aa13285a7a1c4b15f834d991348c4f95042","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Logic.Function.Basic\npublic import Mathlib.Logic.IsEmpty.Defs\npublic import Mathlib.Logic.Relator\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Floris van Doorn. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Floris van Doorn\n-/\n/-!\nIn this file we prove some basic properties about the typeclass `IsEmpty`.\n-/\n\npublic section\n\nvariable {α β γ : Sort*}\n\n@[simp, push]\ntheorem not_nonempty_iff : ¬Nonempty α ↔ IsEmpty α :=\n ⟨fun h ↦ ⟨fun x ↦ h ⟨x⟩⟩, fun h1 h2 ↦ h2.elim h1.elim⟩\n\n@[simp, push]\ntheorem not_isEmpty_iff : ¬IsEmpty α ↔ Nonempty α :=\n not_iff_comm.mp not_nonempty_iff\n\n@[simp]\ntheorem isEmpty_Prop {p : Prop} : IsEmpty p ↔ ¬p := by\n simp only [← not_nonempty_iff, nonempty_prop]\n\n@[simp]\ntheorem isEmpty_pi {π : α → Sort*} : IsEmpty (∀ a, π a) ↔ ∃ a, IsEmpty (π a) := by\n simp only [← not_nonempty_iff, Classical.nonempty_pi, not_forall]\n\ntheorem isEmpty_fun : IsEmpty (α → β) ↔ Nonempty α ∧ IsEmpty β := by\n rw [isEmpty_pi, ← exists_true_iff_nonempty, ← exists_and_right, true_and]\n\n@[simp]\ntheorem nonempty_fun : Nonempty (α → β) ↔ IsEmpty α ∨ Nonempty β :=\n not_iff_not.mp <| by rw [not_or, not_nonempty_iff, not_nonempty_iff, isEmpty_fun, not_isEmpty_iff]\n\n@[simp]\ntheorem isEmpty_sigma {α} {E : α → Type*} : IsEmpty (Sigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_sigma, not_exists]\n\n@[simp]\ntheorem isEmpty_psigma {α} {E : α → Sort*} : IsEmpty (PSigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_psigma, not_exists]\n\ntheorem isEmpty_subtype (p : α → Prop) : IsEmpty (Subtype p) ↔ ∀ x, ¬p x := by\n simp only [← not_nonempty_iff, nonempty_subtype, not_exists]\n\n@[simp]\ntheorem isEmpty_prod {α β : Type*} : IsEmpty (α × β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_prod, not_and_or]\n\n@[simp]\ntheorem isEmpty_pprod : IsEmpty (PProd α β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_pprod, not_and_or]\n\n@[simp]\ntheorem isEmpty_sum {α β} : IsEmpty (α ⊕ β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_sum, not_or]\n\n@[simp]\ntheorem isEmpty_psum {α β} : IsEmpty (α ⊕' β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_psum, not_or]\n\n@[simp]\ntheorem isEmpty_ulift {α} : IsEmpty (ULift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_ulift]\n\n@[simp]\ntheorem isEmpty_plift {α} : IsEmpty (PLift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_plift]\n\ntheorem wellFounded_of_isEmpty {α} [IsEmpty α] (r : α → α → Prop) : WellFounded r :=\n ⟨isEmptyElim⟩\n\nvariable (α)\n\ntheorem isEmpty_or_nonempty : IsEmpty α ∨ Nonempty α :=\n (em <| IsEmpty α).elim Or.inl <| Or.inr ∘ not_isEmpty_iff.mp\n\n@[simp]\ntheorem not_isEmpty_of_nonempty [h : Nonempty α] : ¬IsEmpty α :=\n not_isEmpty_iff.mpr h\n\nvariable {α}\n\ntheorem Function.extend_of_isEmpty [IsEmpty α] (f : α → β) (g : α → γ) (h : β → γ) :\n Function.extend f g h = h :=\n funext fun _ ↦ (Function.extend_apply' _ _ _) fun ⟨a, _⟩ ↦ isEmptyElim a\n\nopen Relator\n\nvariable {α β : Type*} (R : α → β → Prop)\n\n@[simp]\ntheorem leftTotal_empty [IsEmpty α] : LeftTotal R := by\n simp only [LeftTotal, IsEmpty.forall_iff]\n\ntheorem leftTotal_iff_isEmpty_left [IsEmpty β] : LeftTotal R ↔ IsEmpty α := by\n simp only [LeftTotal, IsEmpty.exists_iff, isEmpty_iff]\n\n@[simp]\ntheorem rightTotal_empty [IsEmpty β] : RightTotal R := by\n simp only [RightTotal, IsEmpty.forall_iff]\n\ntheorem rightTotal_iff_isEmpty_right [IsEmpty α] : RightTotal R ↔ IsEmpty β := by\n simp only [RightTotal, IsEmpty.exists_iff, isEmpty_iff]\n\n@[simp]\ntheorem biTotal_empty [IsEmpty α] [IsEmpty β] : BiTotal R :=\n ⟨leftTotal_empty R, rightTotal_empty R⟩\n\nTarget:\ntheorem biTotal_iff_isEmpty_right [IsEmpty α] : BiTotal R ↔ IsEmpty β :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_d39e27c5da6b","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"ccba93e4650d45af9873dfb154590fe3d01d06e6e8e3d5efdfeca60e82a90a8c","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Logic/IsEmpty","family_id":"bitotal_iff_isempty_right","file_id":"mathlib/Mathlib/Logic/IsEmpty/Basic.lean","sample_id":"d39e27c5da6b9455030f6e2ddf71c0baeda0371c50ea57ee2c4fc4bafb382136"},"split":"validation"} {"binding":{"chosen_proof_sha256":"9bea1cf4eff001878af62be358ec2f27ebbedc4cae0a0d9ef061143d0875c48a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"72d649f84fa3e892f3fda48088b99bb6433270f096f36ca755815ced81e4358c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e5f8124606bef5403b341ced7b032022bbb79f88908d3b7d373b847dc8564c6b","source_sha256":"2565cfa070809a58a73096b7d4b24bc9767260f50405d346f360e28141b33728","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]\n tauto","hard_negative":true,"metrics":{"chosen_tokens":15,"rejected_tokens":5,"token_jaccard":0.125,"token_length_ratio":0.333333},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"1228e23c9948049e2cd3cf4ea88780b760b70239b924b4b0c11fb57fc3efa353","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Fintype.Powerset\npublic import Mathlib.Topology.Constructions\npublic import Mathlib.Topology.GDelta.Basic\npublic import Mathlib.Topology.Maps.OpenQuotient\npublic import Mathlib.Tactic.CrossRefAttribute\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2019 Sébastien Gouëzel. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Sébastien Gouëzel\n-/\n/-!\n# Baire spaces\n\nA topological space is called a *Baire space*\nif a countable intersection of dense open subsets is dense.\nBaire theorems say that all completely metrizable spaces\nand all locally compact regular spaces are Baire spaces.\nWe prove the theorems in `Mathlib/Topology/Baire/CompleteMetrizable`\nand `Mathlib/Topology/Baire/LocallyCompactRegular`.\n\nIn this file we prove some lemmas about Baire spaces.\n\nThe good concept underlying the theorems is that of a Gδ set, i.e., a countable intersection\nof open sets. Then Baire theorem can also be formulated as the fact that a countable\nintersection of dense Gδ sets is a dense Gδ set. We deduce this version from Baire property.\nWe also prove the important consequence that, if the space is\ncovered by a countable union of closed sets, then the union of their interiors is dense.\n\nWe also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set.\n-/\n\npublic section\n\n\nnoncomputable section\n\nopen scoped Topology\nopen Filter Set TopologicalSpace\n\nvariable {X α : Type*} {ι : Sort*}\n\nsection BaireTheorem\n\nvariable [TopologicalSpace X]\n\n/-- The intersection of finitely many open dense sets is dense. -/\ntheorem Set.Finite.dense_sInter {s : Set (Set X)} (hs : s.Finite)\n (ho : ∀ t ∈ s, IsOpen t) (hd : ∀ t ∈ s, Dense t) : Dense (⋂₀ s) := by\n induction s, hs using Set.Finite.induction_on with\n | empty => simp [sInter_empty]\n | insert ha hsf ih =>\n simp only [sInter_insert, forall_mem_insert] at hd ⊢\n refine hd.1.inter_of_isOpen_right ?_ (hsf.isOpen_sInter (fun y hy => ho y (Or.inr hy)))\n exact ih ((fun y hy => ho y (Or.inr hy))) (fun y hy => hd.2 y hy)\n\n/-- A finite set is Baire. -/\ntheorem baire_of_finite [Finite X] : BaireSpace X where\n baire_property f _ _ := sInter_range f ▸ (toFinite (range f)).dense_sInter (by grind) (by grind)\n\nvariable [BaireSpace X]\n\n/-- Definition of a Baire space. -/\ntheorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n))\n (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) :=\n BaireSpace.baire_property f ho hd\n\n/-- A dense Gδ subset of a Baire space is Baire. -/\ntheorem IsGδ.baireSpace_of_dense {s : Set X} (hG : IsGδ s) (hd : Dense s) : BaireSpace s := by\n constructor\n intro f hof hdf\n obtain ⟨V, hV⟩ : ∃ V : ℕ → Set X, (∀ n, IsOpen (V n)) ∧ s = ⋂ n, V n := eq_iInter_nat hG\n choose g hg1 hg2 hg3 using fun n => exists_open_dense_of_open_dense_subtype hd (hof n) (hdf n)\n have h_inter_dense : Dense (⋂ n, g n ∩ V n) := BaireSpace.baire_property (fun n ↦ g n ∩ V n)\n (fun n => (hg1 n).inter (hV.1 n))\n (fun n => (hg2 n).inter_of_isOpen_left (hd.mono (by simp [hV.2, iInter_subset])) (hg1 n))\n have h_inter_eq : ⋂ n, g n ∩ V n = ⋂ n, f n := by ext; simp_all; grind\n exact Subtype.dense_iff.mpr fun a _ ↦ h_inter_eq ▸ h_inter_dense a\n\n/-- If `p : Y → X` is an open embedding and `X` is a Baire space, then `Y` is a Baire space. -/\ntheorem Topology.IsOpenEmbedding.baireSpace {Y : Type*} [TopologicalSpace Y] {p : Y → X}\n (hp : Topology.IsOpenEmbedding p) : BaireSpace Y := by\n constructor\n intro f hof hdf\n let s := range p\n let c := fun n : ℕ => p '' f n ∪ (closure s)ᶜ\n have c_open (n : ℕ) : IsOpen (c n) := IsOpen.union (hp.isOpenMap (f n) (hof n))\n isClosed_closure.isOpen_compl\n have c_dense (n : ℕ) : Dense (c n) := by\n rw [dense_iff_closure_eq, subset_antisymm_iff]\n have : univ ⊆ closure (c n) := calc\n _ ⊆ (interior (closure s)) ∪ (interior (closure s))ᶜ := by grind\n _ ⊆ closure s ∪ (interior (closure s))ᶜ := by gcongr; exact interior_subset\n _ ⊆ closure (p '' f n) ∪ (interior (closure s))ᶜ := union_subset_union\n (closure_minimal (hp.continuous.range_subset_closure_image_dense (hdf n))\n isClosed_closure) (subset_refl (interior (closure s))ᶜ)\n _ ⊆ closure (p '' f n) ∪ closure ((closure s)ᶜ) := union_subset_union (by simp) (by simp)\n _ = closure (c n) := closure_union.symm\n grind\n have c_inter_dense : Dense (⋂ n, c n) := dense_iInter_of_isOpen_nat c_open c_dense\n have c_inter_eq : ⋂ n, f n = p ⁻¹' (⋂ n, c n) := by\n ext x\n simp only [mem_iInter, mem_preimage, mem_union, mem_compl_iff, c]\n refine ⟨fun h i => by grind, fun h i => ?_⟩\n exact hp.injective.mem_set_image.mp (imp_iff_or_not.mpr (h i)\n (subset_closure (mem_range_self x)))\n exact c_inter_eq ▸ Dense.preimage c_inter_dense hp.isOpenMap\n\n/-- An open subset of a Baire space is Baire. -/\ntheorem IsOpen.baireSpace {s : Set X} (hO : IsOpen s) : BaireSpace s :=\n hO.isOpenEmbedding_subtypeVal.baireSpace\n\n/-- If `f` is an open quotient map and `X` is Baire, then `Y` is Baire. -/\ntheorem IsOpenQuotientMap.baireSpace {Y : Type*} [TopologicalSpace Y] {f : X → Y}\n (hf : IsOpenQuotientMap f) : BaireSpace Y := by\n constructor\n intro u hou hdu\n have := dense_iInter_of_isOpen_nat (fun n => hf.continuous.isOpen_preimage (u n) (hou n))\n (fun n => (IsOpenQuotientMap.dense_preimage_iff hf).mpr (hdu n))\n simp_all [← preimage_iInter, IsOpenQuotientMap.dense_preimage_iff]\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/\ntheorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)\n (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by\n rcases S.eq_empty_or_nonempty with h | h\n · simp [h]\n · rcases hS.exists_eq_range h with ⟨f, rfl⟩\n exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd)\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable set in any type. -/\ntheorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s))\n (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by\n rw [← sInter_image]\n refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable type. -/\n@[wikidata Q1052678]\ntheorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i))\n (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) :=\n dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd)\n\n/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/\ntheorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by\n constructor\n · rw [mem_residual_iff]\n rintro ⟨S, hSo, hSd, Sct, Ss⟩\n refine ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, ?_⟩\n exact dense_sInter_of_isOpen hSo Sct hSd\n rintro ⟨t, ts, ho, hd⟩\n exact mem_of_superset (residual_of_dense_Gδ ho hd) ts\n\n/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/\n\nTarget:\ntheorem eventually_residual {p : X → Prop} :\n (∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_e5f8124606be","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"c5b579eeac7516995d0ab4d4528bf25f077f3b81f2e8999fb08092bab6b82b7f","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Baire","family_id":"eventually_residual","file_id":"mathlib/Mathlib/Topology/Baire/Lemmas.lean","sample_id":"e5f8124606bef5403b341ced7b032022bbb79f88908d3b7d373b847dc8564c6b"},"split":"validation"} {"binding":{"chosen_proof_sha256":"48ae0c5f114f77be432829afce557e82af1be4254dc52848688fd0c2e7a00f16","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"43616371d519c125784ace5f0302cde951ba9efa3fe80b67b5fe357495be3b9e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"97cc2dcead0110530410d02293d7f941e112d91ff180a713d803fd6582412f20","source_sha256":"c4da1021a79c09c7df686cb23d008cec3d659e62929e487ef02d24baa2e90a0f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [coe_coeMonoidHom]\n exact DFunLike.coe_injective","hard_negative":false,"metrics":{"chosen_tokens":9,"rejected_tokens":14,"token_jaccard":0.642857,"token_length_ratio":1.555556},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"126a68770fb7c081d2d9fd34fafe396c34e87338535a5372fe1c3aceb8db885d","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.FunLike.IsApply\npublic import Mathlib.Algebra.Group.InjSurj\npublic import Mathlib.Algebra.Group.Hom.Defs\npublic import Mathlib.Algebra.Group.Pi.Basic\n\nNamespace:\nFunLike\n\nLocal context:\n/-\nCopyright (c) 2026 Moritz Doll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Moritz Doll\n-/\n/-! # Group instances for `FunLike` types\nIn this file we define various instances related to groups for `FunLike` types.\n\nFor example given a `FunLike F α β` with `IsMulApply F α β` and `Semigroup β`, then `F` is naturally\na semigroup. Note that currently, these are not registered as instances, but only `abbrev`s to\navoid long typeclass searches.\n\nMoreover, we define the homomorphism `FunLike.coeMulHom : F →* α → β` that acts by coercion. This\ndefinition is mainly needed to define a module instance on `F`.\n\n-/\n\n@[expose] public section\n\nnamespace FunLike\n\nvariable {F α β : Type*} [FunLike F α β]\n\nsection CoercionHom\n\nsection MulHom\n\nvariable [Mul F] [Mul β] [IsMulApply F α β]\n\nvariable (F α β) in\n/-- Coercion as a multiplicative homomorphism. -/\n@[to_additive\n/-- Coercion as an additive homomorphism. -/]\ndef coeMulHom : F →ₙ* α → β where\n toFun f := f\n map_mul' := coe_mul\n\n@[to_additive (attr := simp)]\ntheorem coeMulHom_apply (f : F) : coeMulHom F α β f = f := rfl\n\n@[to_additive (attr := norm_cast)]\ntheorem coe_coeMulHom : (coeMulHom F α β : F → α → β) = DFunLike.coe := rfl\n\n@[to_additive]\ntheorem coeMulHom_injective : Function.Injective (coeMulHom F α β) := by\n rw [coe_coeMulHom]\n exact DFunLike.coe_injective\n\nend MulHom\n\nsection MonoidHom\n\nvariable [MulOne F] [MulOneClass β] [IsOneApply F α β] [IsMulApply F α β]\n\nvariable (F α β) in\n/-- Coercion as a monoid homomorphism. -/\n@[to_additive\n/-- Coercion as an additive monoid homomorphism. -/]\ndef coeMonoidHom : F →* α → β where\n toFun f := f\n map_one' := coe_one\n map_mul' := coe_mul\n\n@[to_additive (attr := simp)]\ntheorem coeMonoidHom_apply (f : F) : coeMonoidHom F α β f = f := rfl\n\n@[to_additive (attr := norm_cast)]\ntheorem coe_coeMonoidHom : (coeMonoidHom F α β : F → α → β) = DFunLike.coe := rfl\n\n@[to_additive (attr := norm_cast)]\ntheorem coe_coeMonoidHom' : (coeMonoidHom F α β : F →ₙ* α → β) = coeMulHom F α β := rfl\n\n@[to_additive]\n\nTarget:\ntheorem coeMonoidHom_injective : Function.Injective (coeMonoidHom F α β) :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n rw [coe_coeMonoidHom]\n exact DFunLike.coe_injective","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/FunLike","family_id":"coemonoidhom_injective","file_id":"mathlib/Mathlib/Data/FunLike/Group.lean","sample_id":"97cc2dcead0110530410d02293d7f941e112d91ff180a713d803fd6582412f20"},"split":"validation"} {"binding":{"chosen_proof_sha256":"23c55cca4aed493c49257296261d4b5d523dc34abeab85aa3e8f3b0acfe54ba4","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"608b3be37c4127d24339e07eb2fc5bb70504fc2b9e1be8d9e104771b03e3b6ae","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8c5474d5a748750311f34bb635b8469d911df14dd8f7a3cb5f4fb88ebf96dde7","source_sha256":"72b411c1082944ace2118b8714603a368d84839ae6de6aadd5f7075fc5a741e8","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_all [eq_zero_of_add_right hs₁ hs₂ h]","hard_negative":true,"metrics":{"chosen_tokens":10,"rejected_tokens":3,"token_jaccard":0.090909,"token_length_ratio":0.3},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"129e70ee453c88caf48b9b84da10092b1ba6c7e2453b3cafc758944749b2c3d9","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Ring.SumsOfSquares\npublic import Mathlib.RingTheory.Nilpotent.Basic\n\nNamespace:\nIsFormallyReal\n\nLocal context:\n/-\nCopyright (c) 2026 Artie Khovanov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Artie Khovanov\n-/\n/-!\n# Formally real rings\n\nA ring `R` is *formally real* if, whenever `∑ i, x i ^ 2 = 0`, in fact `x i = 0` for all `i`.\n\nWe define formally real rings in an index-free manner using the inductive predicate\n`IsSumNonzeroSq`, which asserts that an element is a finite sum of squares of nonzero elements.\nA ring is then formally real if `¬ IsSumNonzeroSq 0`.\n\n## Main declaration\n\n- `IsFormallyReal`: typeclass stating that a ring is formally real.\n\n-/\n\n@[expose] public section\n\nvariable {R : Type*}\n\nsection IsSumNonzeroSq\n\n/--\nThe property of being a sum of squares of nonzero elements (S) is defined inductively by:\n`a * a : R` is (S) for all nonzero `a`, and\nif `s : R` is (S), and `a ≠ 0`, then `a * a + s` is (S).\n-/\n@[mk_iff]\ninductive IsSumNonzeroSq [Mul R] [Add R] [Zero R] : R → Prop\n | sq {a : R} (ha : a ≠ 0) : IsSumNonzeroSq (a * a)\n | sq_add {a s : R} (ha : a ≠ 0) (hs : IsSumNonzeroSq s) : IsSumNonzeroSq (a * a + s)\n\nattribute [aesop 90%] IsSumNonzeroSq.sq\n\n@[aesop 90%]\ntheorem IsSumNonzeroSq.add [AddMonoid R] [Mul R] {s₁ s₂ : R}\n (h₁ : IsSumNonzeroSq s₁) (h₂ : IsSumNonzeroSq s₂) : IsSumNonzeroSq (s₁ + s₂) := by\n induction h₁ <;> simp_all [sq_add, add_assoc]\n\ntheorem IsSumNonzeroSq.isSumSq [AddMonoid R] [Mul R] {s : R}\n (h : IsSumNonzeroSq s) : IsSumSq s := by\n induction h <;> aesop\n\ntheorem isSumNonzeroSq_iff_isSumSq [NonUnitalNonAssocSemiring R] {s : R} (hs : s ≠ 0) :\n IsSumNonzeroSq s ↔ IsSumSq s where\n mp := IsSumNonzeroSq.isSumSq\n mpr h := by\n induction h with\n | zero => grind\n | @sq_add a s hs ih =>\n rcases eq_or_ne a 0 with (rfl | ne_a)\n · simp_all\n · rcases eq_or_ne s 0 with (rfl | ne_s)\n · simpa using IsSumNonzeroSq.sq ne_a\n · exact IsSumNonzeroSq.sq_add ne_a (ih ne_s)\n\nalias ⟨_, IsSumSq.isSumNonzeroSq_of_ne_zero⟩ := isSumNonzeroSq_iff_isSumSq\n\nnamespace AddSubsemigroup\n\nvariable [AddMonoid R] [Mul R] {s : R}\n\nvariable (R) in\n/-- The subsemigroup of sums of squares of nonzero elements. -/\n@[simps]\ndef sumNonzeroSq : AddSubsemigroup R where\n carrier := {s : R | IsSumNonzeroSq s}\n add_mem' := .add\n\nattribute [norm_cast] coe_sumNonzeroSq\n\n@[simp] theorem mem_sumNonzeroSq : s ∈ sumNonzeroSq R ↔ IsSumNonzeroSq s := .rfl\n\n@[simp]\ntheorem closure_mul_self : closure {x * x | x ≠ (0 : R)} = sumNonzeroSq R := by\n refine closure_eq_of_le (fun x hx ↦ by aesop) (fun x hx ↦ ?_)\n -- TODO : fix aesop timeout and change to `induction hx <;> aesop`\n induction hx with\n | sq ha => aesop\n | sq_add ha hs ih =>\n -- `aesop` times out\n apply add_mem\n · apply AddSubsemigroup.mem_closure_of_mem\n aesop\n aesop\n\nend AddSubsemigroup\n\nend IsSumNonzeroSq\n\nvariable (R) in\n/--\nA ring is formally real if, whenever `∑ i, x i ^ 2 = 0`, we in fact have `x i = 0` for all `i`.\n-/\nclass IsFormallyReal [AddCommMonoid R] [Mul R] : Prop where\n not_isSumNonzeroSq_zero : ¬ IsSumNonzeroSq (0 : R)\n\nnamespace IsFormallyReal\n\ntheorem of_eq_zero_of_mul_self_of_eq_zero_of_add [AddCommMonoid R] [Mul R]\n (hz : ∀ {a : R}, a * a = 0 → a = 0)\n (ha : ∀ {s₁ s₂ : R}, IsSumSq s₁ → IsSumSq s₂ → s₁ + s₂ = 0 → s₁ = 0) : IsFormallyReal R where\n not_isSumNonzeroSq_zero := by\n suffices ∀ (x : R), IsSumNonzeroSq x → x ≠ 0 by grind\n intro x hx\n induction hx with\n | sq ha => grind\n | @sq_add b s hb hs ih => grind [ha (IsSumSq.mul_self b) hs.isSumSq]\n\ntheorem of_eq_zero_of_eq_zero_of_mul_self_add [NonUnitalNonAssocSemiring R]\n (h : ∀ {s a : R}, IsSumSq s → a * a + s = 0 → a = 0) : IsFormallyReal R where\n not_isSumNonzeroSq_zero := by\n suffices ∀ (x : R), IsSumNonzeroSq x → x ≠ 0 by grind\n intro x hx\n induction hx with\n | sq ha => exact fun hc ↦ ha (h IsSumSq.zero (by simpa using hc))\n | sq_add ha hs ih => grind [hs.isSumSq]\n\ninstance [Ring R] [LinearOrder R] [IsStrictOrderedRing R] : IsFormallyReal R :=\n of_eq_zero_of_mul_self_of_eq_zero_of_add mul_self_eq_zero.mp <|\n fun hs₁ hs₂ h ↦ ((add_eq_zero_iff_of_nonneg (IsSumSq.nonneg hs₁) (IsSumSq.nonneg hs₂)).mp h).1\n\ninstance [Ring R] [IsFormallyReal R] : IsReduced R := by\n rw [isReduced_iff_pow_one_lt 2 (by lia)]\n intro x hx\n by_contra! hc\n exact not_isSumNonzeroSq_zero <| by simpa [← pow_two, hx] using IsSumNonzeroSq.sq hc\n\ntheorem eq_zero_of_add_right [NonUnitalNonAssocSemiring R] [IsFormallyReal R]\n {s₁ s₂ : R} (hs₁ : IsSumSq s₁) (hs₂ : IsSumSq s₂) (h : s₁ + s₂ = 0) : s₁ = 0 := by\n by_contra! h₁\n have h₂ : s₂ ≠ 0 := fun hc ↦ by simp_all\n rw [← isSumNonzeroSq_iff_isSumSq h₁] at hs₁\n rw [← isSumNonzeroSq_iff_isSumSq h₂] at hs₂\n exact not_isSumNonzeroSq_zero (h ▸ IsSumNonzeroSq.add hs₁ hs₂)\n\nTarget:\ntheorem eq_zero_of_add_left [NonUnitalNonAssocSemiring R] [IsFormallyReal R]\n {s₁ s₂ : R} (hs₁ : IsSumSq s₁) (hs₂ : IsSumSq s₂) (h : s₁ + s₂ = 0) : s₂ = 0 :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_8c5474d5a748","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"c09c200d009b145a10f7f97b817dccf292c8013fa027187bc50bae8dbdb103cc","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Ring","family_id":"eq_zero_of_add_left","file_id":"mathlib/Mathlib/Algebra/Ring/IsFormallyReal.lean","sample_id":"8c5474d5a748750311f34bb635b8469d911df14dd8f7a3cb5f4fb88ebf96dde7"},"split":"validation"} {"binding":{"chosen_proof_sha256":"ac4cef73e43e9d1cfba0acc787526dd60d60008c4d9916b90723478cab31821b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"b7e943a04bd53cb46b6eae75a9fee412935e361167923416781176c986ca628e","source_sha256":"b72e89b384020496bbd8393293edd2656c420f581416551d6887740dc5903234","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine (isDedekindFiniteMonoid_iff _).trans ⟨fun h x y z hxz hyz ↦ ?_, fun h x y eq ↦ ?_⟩\n · simpa [mul_assoc, h hyz] using congr_arg (· * y) hxz\n have := h _ (1 - y * x + x) _ eq <| by\n rw [add_mul, sub_mul, mul_assoc, eq, one_mul, mul_one, sub_self, zero_add]\n rwa [right_eq_add, sub_eq_zero, eq_comm] at this","hard_negative":false,"metrics":{"chosen_tokens":91,"rejected_tokens":2,"token_jaccard":0.02,"token_length_ratio":0.021978},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"141d36b368373186ef6de07af0f67d4e767600999cb9d3593844c3bc4f058e94","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Basic\npublic import Mathlib.Algebra.GroupWithZero.Regular\npublic import Mathlib.Algebra.Ring.Defs\n\nNamespace:\nIsDedekindFiniteMonoid\n\nLocal context:\n/-\nCopyright (c) 2014 Jeremy Avigad. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Yury Kudryashov, Neil Strickland\n-/\n/-!\n# Lemmas about regular elements in rings.\n-/\n\npublic section\n\n\nvariable {α : Type*}\n\n/-- Left `Mul` by a `k : α` over `[Ring α]` is injective, if `k` is not a zero divisor.\nThe typeclass that restricts all terms of `α` to have this property is `NoZeroDivisors`. -/\ntheorem isLeftRegular_of_non_zero_divisor [NonUnitalNonAssocRing α] (k : α)\n (h : ∀ x : α, k * x = 0 → x = 0) : IsLeftRegular k := by\n refine fun x y (h' : k * x = k * y) => sub_eq_zero.mp (h _ ?_)\n rw [mul_sub, sub_eq_zero, h']\n\n/-- Right `Mul` by a `k : α` over `[Ring α]` is injective, if `k` is not a zero divisor.\nThe typeclass that restricts all terms of `α` to have this property is `NoZeroDivisors`. -/\ntheorem isRightRegular_of_non_zero_divisor [NonUnitalNonAssocRing α] (k : α)\n (h : ∀ x : α, x * k = 0 → x = 0) : IsRightRegular k := by\n refine fun x y (h' : x * k = y * k) => sub_eq_zero.mp (h _ ?_)\n rw [sub_mul, sub_eq_zero, h']\n\ntheorem IsRegular.of_ne_zero' [NonUnitalNonAssocRing α] [NoZeroDivisors α] {k : α} (hk : k ≠ 0) :\n IsRegular k :=\n ⟨isLeftRegular_of_non_zero_divisor k fun _ h =>\n (NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h).resolve_left hk,\n isRightRegular_of_non_zero_divisor k fun _ h =>\n (NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h).resolve_right hk⟩\n\n@[deprecated (since := \"2026-01-21\")] alias isRegular_of_ne_zero' := IsRegular.of_ne_zero'\n\ntheorem isRegular_iff_ne_zero' [Nontrivial α] [NonUnitalNonAssocRing α] [NoZeroDivisors α]\n {k : α} : IsRegular k ↔ k ≠ 0 :=\n ⟨fun h => by\n rintro rfl\n exact not_not.mpr h.left not_isLeftRegular_zero, .of_ne_zero'⟩\n\n/-- A ring with no zero divisors is a cancellative `MonoidWithZero`.\n\nNote this is not an instance as it forms a typeclass loop. -/\nlemma NoZeroDivisors.toIsCancelMulZero [NonUnitalNonAssocRing α] [NoZeroDivisors α] :\n IsCancelMulZero α where\n mul_left_cancel_of_ne_zero ha := (IsRegular.of_ne_zero' ha).1\n mul_right_cancel_of_ne_zero hb := (IsRegular.of_ne_zero' hb).2\n\nnamespace IsDedekindFiniteMonoid\n\nvariable [Ring α]\n\n/-- A ring is Dedekind-finite if and only if every element has at most one right inverse. -/\ntheorem iff_eq_of_mul_left_eq_one :\n IsDedekindFiniteMonoid α ↔ ∀ x y z : α, x * y = 1 → x * z = 1 → y = z := by\n refine (isDedekindFiniteMonoid_iff _).trans ⟨fun h x y z hxy hxz ↦ ?_, fun h x y eq ↦ ?_⟩\n · simpa [← mul_assoc, h hxz] using congr_arg (z * ·) hxy\n have := h _ _ (1 - y * x + y) eq <| by\n rw [mul_add, mul_sub, ← mul_assoc, eq, mul_one, one_mul, sub_self, zero_add]\n rwa [right_eq_add, sub_eq_zero, eq_comm] at this\n\n/-- A ring is Dedekind-finite if and only if every element has at most one left inverse. -/\n\nTarget:\ntheorem iff_eq_of_mul_right_eq_one :\n IsDedekindFiniteMonoid α ↔ ∀ x y z : α, x * z = 1 → y * z = 1 → x = y :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Ring","family_id":"iff_eq_of_mul_right_eq_one","file_id":"mathlib/Mathlib/Algebra/Ring/Regular.lean","sample_id":"b7e943a04bd53cb46b6eae75a9fee412935e361167923416781176c986ca628e"},"split":"validation"} {"binding":{"chosen_proof_sha256":"6f2e2bdde9df65f7fae68f371268a13bea710dc9d3decb2f9cefb19f98606b56","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ca54e7316b6c0004a5665e1a2e5c8b8a7d3c31345e51a12dddf12e28aa2b50d2","source_sha256":"83e2601cf6c07c32f34aa34172516324d335356d2cf96b31eaf33c25cc9353c7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n constructor <;> intro H\n · exact ⟨H.continuous, fun Z ↦ H.universally_closed _⟩\n · rw [isProperMap_iff_isClosedMap_ultrafilter]\n exact ⟨H.1, H.2 _⟩","hard_negative":false,"metrics":{"chosen_tokens":38,"rejected_tokens":5,"token_jaccard":0.111111,"token_length_ratio":0.131579},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"157c49cf6b65de9fe57a0fe762fbf5bc495e06fa1dd82b7937bb1c3ffa7e2a6b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Compactification.StoneCech\npublic import Mathlib.Topology.Filter\npublic import Mathlib.Topology.Maps.Proper.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2023 Anatole Dedecker. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Anatole Dedecker, Etienne Marion\n-/\n/-!\n# A map is proper iff it is continuous and universally closed\n-/\n\npublic section\n\nopen Filter\n\nuniverse u v\n\n/-- A map `f : X → Y` is proper if and only if it is continuous and the map\n`(Prod.map f id : X × Filter X → Y × Filter X)` is closed. This is stronger than\n`isProperMap_iff_universally_closed` since it shows that there's only one space to check to get\nproperness, but in most cases it doesn't matter. -/\ntheorem isProperMap_iff_isClosedMap_filter {X : Type u} {Y : Type v} [TopologicalSpace X]\n [TopologicalSpace Y] {f : X → Y} :\n IsProperMap f ↔ Continuous f ∧ IsClosedMap\n (Prod.map f id : X × Filter X → Y × Filter X) := by\n constructor <;> intro H\n -- The direct implication is clear.\n · exact ⟨H.continuous, H.universally_closed _⟩\n · rw [isProperMap_iff_ultrafilter]\n -- Let `𝒰 : Ultrafilter X`, and assume that `f` tends to some `y` along `𝒰`.\n refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩\n -- In `X × Filter X`, consider the closed set `F := closure {(x, ℱ) | ℱ = pure x}`\n let F : Set (X × Filter X) := closure {xℱ | xℱ.2 = pure xℱ.1}\n -- Since `f × id` is closed, the set `(f × id) '' F` is also closed.\n have := H.2 F isClosed_closure\n -- Let us show that `(y, 𝒰) ∈ (f × id) '' F`.\n have : (y, ↑𝒰) ∈ Prod.map f id '' F :=\n -- Note that, by the properties of the topology on `Filter X`, the function `pure : X → Filter X`\n -- tends to the point `𝒰` of `Filter X` along the filter `𝒰` on `X`. Since `f` tends to `y` along\n -- `𝒰`, we get that the function `(f, pure) : X → (Y, Filter X)` tends to `(y, 𝒰)` along\n -- `𝒰`. Furthermore, each `(f, pure)(x) = (f × id)(x, pure x)` is clearly an element of\n -- the closed set `(f × id) '' F`, thus the limit `(y, 𝒰)` also belongs to that set.\n this.mem_of_tendsto (hy.prodMk_nhds (Filter.tendsto_pure_self (𝒰 : Filter X)))\n (Eventually.of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩)\n -- The above shows that `(y, 𝒰) = (f x, 𝒰)`, for some `x : X` such that `(x, 𝒰) ∈ F`.\n rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩\n -- We already know that `f x = y`, so to finish the proof we just have to check that `𝒰` tends\n -- to `x`. So, for `U ∈ 𝓝 x` arbitrary, let's show that `U ∈ 𝒰`. Since `𝒰` is an ultrafilter,\n -- it is enough to show that `Uᶜ` is not in `𝒰`.\n refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_notMem_iff.mp fun hUc ↦ ?_⟩\n rw [mem_closure_iff_nhds] at hx\n -- Indeed, if that was the case, the set `V := {𝒢 : Filter X | Uᶜ ∈ 𝒢}` would be a neighborhood\n -- of `𝒰` in `Filter X`, hence `U ×ˢ V` would be a neighborhood of `(x, 𝒰) : X × Filter X`.\n -- But recall that `(x, 𝒰) ∈ F = closure {(x, ℱ) | ℱ = pure x}`, so the neighborhood `U ×ˢ V`\n -- must contain some element of the form `(z, pure z)`. In other words, we have `z ∈ U` and\n -- `Uᶜ ∈ pure z`, which means `z ∈ Uᶜ` by the definition of pure.\n -- This is a contradiction, which completes the proof.\n rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU (isOpen_setOf_mem.mem_nhds hUc)) with\n ⟨⟨z, 𝒢⟩, ⟨⟨hz : z ∈ U, hz' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure z⟩⟩\n exact hz' hz\n\n/-- A map `f : X → Y` is proper if and only if it is continuous and the map\n`(Prod.map f id : X × Ultrafilter X → Y × Ultrafilter X)` is closed. This is stronger than\n`isProperMap_iff_universally_closed` since it shows that there's only one space to check to get\nproperness, but in most cases it doesn't matter. -/\ntheorem isProperMap_iff_isClosedMap_ultrafilter {X : Type u} {Y : Type v} [TopologicalSpace X]\n [TopologicalSpace Y] {f : X → Y} :\n IsProperMap f ↔ Continuous f ∧ IsClosedMap\n (Prod.map f id : X × Ultrafilter X → Y × Ultrafilter X) := by\n -- The proof is basically the same as above.\n constructor <;> intro H\n · exact ⟨H.continuous, H.universally_closed _⟩\n · rw [isProperMap_iff_ultrafilter]\n refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩\n let F : Set (X × Ultrafilter X) := closure {xℱ | xℱ.2 = pure xℱ.1}\n have := H.2 F isClosed_closure\n have : (y, 𝒰) ∈ Prod.map f id '' F :=\n this.mem_of_tendsto (hy.prodMk_nhds (Ultrafilter.tendsto_pure_self 𝒰))\n (Eventually.of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩)\n rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩\n refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_notMem_iff.mp fun hUc ↦ ?_⟩\n rw [mem_closure_iff_nhds] at hx\n rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU ((ultrafilter_isOpen_basic _).mem_nhds hUc))\n with ⟨⟨y, 𝒢⟩, ⟨⟨hy : y ∈ U, hy' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure y⟩⟩\n exact hy' hy\n\n/-- A map `f : X → Y` is proper if and only if it is continuous and **universally closed**, in the\nsense that for any topological space `Z`, the map `Prod.map f id : X × Z → Y × Z` is closed. Note\nthat `Z` lives in the same universe as `X` here, but `IsProperMap.universally_closed` does not\nhave this restriction.\n\nThis is taken as the definition of properness in\n[N. Bourbaki, *General Topology*][bourbaki1966]. -/\n\nTarget:\ntheorem isProperMap_iff_universally_closed {X : Type u} {Y : Type v} [TopologicalSpace X]\n [TopologicalSpace Y] {f : X → Y} :\n IsProperMap f ↔ Continuous f ∧ ∀ (Z : Type u) [TopologicalSpace Z],\n IsClosedMap (Prod.map f id : X × Z → Y × Z) :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Maps","family_id":"ispropermap_iff_universally_closed","file_id":"mathlib/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean","sample_id":"ca54e7316b6c0004a5665e1a2e5c8b8a7d3c31345e51a12dddf12e28aa2b50d2"},"split":"validation"} {"binding":{"chosen_proof_sha256":"40625d9f4d5e19cf093a34023a2ebfb722b1326dc7e8a44bd7188d00bdef2d83","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"4320899926fe7ec0422adb4e6f569adc4a6a798c6ae563de76ad671eb839d5fe","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"baef9f3c451e495d26f3d1cd7f38137bc951f99459b9821f931d562f764dcbce","source_sha256":"a5b9fd4ae26ed5eac524a8ce0f4aac28fccd2337d8a28d5e1bf35f99625bb1bd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rcases Module.equiv_directSum_of_isTorsion hM with ⟨ι, _, p, h, e, ⟨l⟩⟩\n haveI : ∀ i : ι, NeZero (p i ^ e i).natAbs := fun i =>\n ⟨Int.natAbs_ne_zero.mpr <| pow_ne_zero (e i) (h i).ne_zero⟩\n haveI : ∀ i : ι, _root_.Finite <| ℤ ⧸ Submodule.span ℤ {p i ^ e i} := fun i =>\n Finite.of_equiv _ (p i ^ e i).quotientSpanEquivZMod.symm.toEquiv\n haveI : _root_.Finite (⨁ i, ℤ ⧸ (Submodule.span ℤ {p i ^ e i} : Submodule ℤ ℤ)) :=\n Finite.of_equiv _ DFinsupp.equivFunOnFintype.symm\n exact Finite.of_equiv _ l.symm.toEquiv","hard_negative":true,"metrics":{"chosen_tokens":158,"rejected_tokens":2,"token_jaccard":0.019231,"token_length_ratio":0.012658},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"17d27a3037b57c0404054426bc83777e9c62c63a1baee3a7b1f963698b3d818e","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.PID\npublic import Mathlib.Algebra.Group.TypeTags.Finite\npublic import Mathlib.Data.ZMod.QuotientRing\n\nNamespace:\nModule\n\nLocal context:\n/-\nCopyright (c) 2022 Pierre-Alexandre Bazin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Pierre-Alexandre Bazin\n-/\n/-!\n# Structure of finite(ly generated) abelian groups\n\n* `AddCommGroup.equiv_free_prod_directSum_zmod` : Any finitely generated abelian group is the\n product of a power of `ℤ` and a direct sum of some `ZMod (p i ^ e i)` for some prime powers\n `p i ^ e i`.\n* `CommGroup.equiv_free_prod_prod_multiplicative_zmod` is a version for multiplicative groups.\n* `AddCommGroup.equiv_directSum_zmod_of_finite` : Any finite abelian group is a direct sum of\n some `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`.\n* `CommGroup.equiv_prod_multiplicative_zmod_of_finite` is a version for multiplicative groups.\n-/\n\n@[expose] public section\n\nopen scoped DirectSum\n\n/-\nTODO: Here's a more general approach to dropping trivial factors from a direct sum:\n\ndef DirectSum.congr {ι κ : Type*} {α : ι → Type*} {β : κ → Type*} [DecidableEq ι] [DecidableEq κ]\n [∀ i, DecidableEq (α i)] [∀ j, DecidableEq (β j)] [∀ i, AddCommMonoid (α i)]\n [∀ j, AddCommMonoid (β j)] (f : ∀ i, Nontrivial (α i) → κ) (g : ∀ j, Nontrivial (β j) → ι)\n (F : ∀ i hi, α i →+ β (f i hi)) (G : ∀ j hj, β j →+ α (g j hj))\n (hfg : ∀ i hi hj, g (f i hi) hj = i) (hgf : ∀ j hj hi, f (g j hj) hi = j)\n (hFG : ∀ i hi hj a, hfg i hi hj ▸ G _ hj (F i hi a) = a)\n (hGF : ∀ j hj hi b, hgf j hj hi ▸ F _ hi (G j hj b) = b) :\n (⨁ i, α i) ≃+ ⨁ j, β j where\n toFun x := x.sum fun i a ↦ if ha : a = 0 then 0 else DFinsupp.single (f i ⟨a, 0, ha⟩) (F _ _ a)\n invFun y := y.sum fun j b ↦ if hb : b = 0 then 0 else DFinsupp.single (g j ⟨b, 0, hb⟩) (G _ _ b)\n -- The two sorries here are probably doable with the existing machinery, but quite painful\n left_inv x := DFinsupp.ext fun i ↦ sorry\n right_inv y := DFinsupp.ext fun j ↦ sorry\n map_add' x₁ x₂ := by\n dsimp\n refine DFinsupp.sum_add_index (by simp) fun i a₁ a₂ ↦ ?_\n split_ifs\n any_goals simp_all\n rw [← DFinsupp.single_add, ← map_add, ‹a₁ + a₂ = 0›, map_zero, DFinsupp.single_zero]\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.congr\n (fun i _ ↦ i)\n (fun j hj ↦ ⟨j, fun h ↦ by simp [h, pow_zero, zmod_nontrivial] at hj⟩)\n (fun i _ ↦ AddMonoidHom.id _)\n (fun j _ ↦ AddMonoidHom.id _)\n (fun i hi hj ↦ rfl)\n (fun j hj hi ↦ rfl)\n (fun i hi hj a ↦ rfl)\n (fun j hj hi a ↦ rfl)\n-/\n\nprivate def directSumNeZeroMulHom {ι : Type} [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) →+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.toAddMonoid fun i ↦ DirectSum.of (fun i ↦ ZMod (p i ^ n i)) i\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) where\n toFun := directSumNeZeroMulHom p n\n invFun := DirectSum.toAddMonoid fun i ↦\n if h : n i = 0 then 0 else DirectSum.of (fun j : {i // n i ≠ 0} ↦ ZMod (p j ^ n j)) ⟨i, h⟩\n left_inv x := by\n induction x using DirectSum.induction_on with\n | zero => simp\n | of i x =>\n rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of, DirectSum.toAddMonoid_of,\n dif_neg i.prop]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n right_inv x := by\n induction x using DirectSum.induction_on with\n | zero => rw [map_zero, map_zero]\n | of i x =>\n rw [DirectSum.toAddMonoid_of]\n split_ifs with h\n · simp [(ZMod.subsingleton_iff.2 <| by rw [h, pow_zero]).elim x 0]\n · simp_rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n map_add' := map_add (directSumNeZeroMulHom p n)\n\nuniverse u\n\nnamespace Module\n\nvariable (M : Type u)\n\nTarget:\ntheorem finite_of_fg_torsion [AddCommGroup M] [Module ℤ M] [Module.Finite ℤ M]\n (hM : Module.IsTorsion ℤ M) : _root_.Finite M :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_baef9f3c451e","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"91ef2c317aac53b3d52439dc7d3557e9ff85e84f880cbba74717da40c2cc1f88","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/FiniteAbelian","family_id":"finite_of_fg_torsion","file_id":"mathlib/Mathlib/GroupTheory/FiniteAbelian/Basic.lean","sample_id":"baef9f3c451e495d26f3d1cd7f38137bc951f99459b9821f931d562f764dcbce"},"split":"validation"} {"binding":{"chosen_proof_sha256":"a480604e686ac85bbb8ba2d21f5c762b31805a73ad58401b0a0dd1b6b9facdfc","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6d8d5597f77b131d281e907f3a393c8dafcd0b13e93c4b306842ba4a0ddf8d19","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"29af87114d75888b1dfc659c3ad79f3eb2dadaa919600b6183181e8fe8177aae","source_sha256":"2d1ca9408fcd1765e9d2dc833c7f4cbefad14ad1a3c169f30ede2989831b39df","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [le_minOrder]\n refine ⟨fun h s hs hs' ↦ ?_, fun h a ha ha' ↦ ?_⟩\n · obtain ⟨a, has, ha⟩ := s.bot_or_exists_ne_one.resolve_left hs\n exact\n (h ha <| finite_zpowers.1 <| hs'.subset <| zpowers_le.2 has).trans\n (WithTop.coe_le_coe.2 <| s.orderOf_le_card hs' has)\n · simpa using h (zpowers_ne_bot.2 ha) ha'.finite_zpowers","hard_negative":true,"metrics":{"chosen_tokens":91,"rejected_tokens":5,"token_jaccard":0.065217,"token_length_ratio":0.054945},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"19918f2570c1aa7d5f1f2482545839e4443819c0b2225132684ba54f861993a9","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Torsion\npublic import Mathlib.Data.ENat.Lattice\npublic import Mathlib.Data.ZMod.QuotientGroup\n\nNamespace:\nMonoid\n\nLocal context:\n/-\nCopyright (c) 2023 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Minimum order of an element\n\nThis file defines the minimum order of an element of a monoid.\n\n## Main declarations\n\n* `Monoid.minOrder`: The minimum order of an element of a given monoid.\n* `Monoid.minOrder_eq_top`: The minimum order is infinite iff the monoid is torsion-free.\n* `ZMod.minOrder`: The minimum order of $ℤ/nℤ$ is the smallest factor of `n`, unless `n = 0, 1`.\n-/\n\n@[expose] public section\n\nopen Subgroup\n\nvariable {G α : Type*}\n\nnamespace Monoid\nsection Monoid\nvariable (α) [Monoid α]\n\n/-- The minimum order of a non-identity element. Also the minimum size of a nontrivial subgroup, see\n`Monoid.le_minOrder_iff_forall_subgroup`. Returns `∞` if the monoid is torsion-free. -/\n@[to_additive /-- The minimum order of a non-identity element. Also the minimum size of a nontrivial\nsubgroup, see `AddMonoid.le_minOrder_iff_forall_addSubgroup`. Returns `∞` if the monoid is\ntorsion-free. -/]\nnoncomputable def minOrder : ℕ∞ := ⨅ (a : α) (_ha : a ≠ 1) (_ha' : IsOfFinOrder a), orderOf a\n\nvariable {α} {a : α}\n\n@[to_additive (attr := simp)]\nlemma le_minOrder {n : ℕ∞} :\n n ≤ minOrder α ↔ ∀ ⦃a : α⦄, a ≠ 1 → IsOfFinOrder a → n ≤ orderOf a := by simp [minOrder]\n\n@[to_additive]\nlemma minOrder_le_orderOf (ha : a ≠ 1) (ha' : IsOfFinOrder a) : minOrder α ≤ orderOf a :=\n le_minOrder.1 le_rfl ha ha'\n\nend Monoid\n\nsection Group\nvariable [Group G] {s : Subgroup G}\n\n@[to_additive]\n\nTarget:\nlemma le_minOrder_iff_forall_subgroup {n : ℕ∞} :\n n ≤ minOrder G ↔ ∀ ⦃s : Subgroup G⦄, s ≠ ⊥ → (s : Set G).Finite → n ≤ Nat.card s :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_29af87114d75","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"bb88579c1a7795c829ab3c0171c70788c8257214d0255d5c5e72db7f7aeb22cc","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Order","family_id":"le_minorder_iff_forall_subgroup","file_id":"mathlib/Mathlib/GroupTheory/Order/Min.lean","sample_id":"29af87114d75888b1dfc659c3ad79f3eb2dadaa919600b6183181e8fe8177aae"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8c8fe3d67908f29401248fc1d369ee6c2299abf2cd6123278a19accbce24703a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"139d1cd56aaff47089121e13fce7ce6e2223eccd89ffee7924fe01306884e888","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"536b9c6a6a5b364cbf955e37e33716d32e57e801c918bfe11a1d15bd1faeaaf9","source_sha256":"d71fa3ee7da14cca634518b535c01bc451d796c261b03831d3a069160e1a02e2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨fun h a x ↦ ?_, fun h a b x y ↦ ?_⟩\n · obtain ⟨a, ma, rfl⟩ := x\n exact ⟨a.2, fun b x y ↦ by simpa [h (show ⟨b, y⟩ ≤ a by exact x) ma]⟩\n · have ma : a.1 ∈ Subtype.val '' s := by simp [a.2, y]\n simpa only [mem_image, Subtype.coe_inj, exists_eq_right] using (h ma).2 x b.2","hard_negative":true,"metrics":{"chosen_tokens":109,"rejected_tokens":3,"token_jaccard":0.045455,"token_length_ratio":0.027523},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"1a2d725544f19b2384e3250b0e5045c9816fb1d419355a2d3aee5071d4d48ec3","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Set.Image\npublic import Mathlib.Data.SetLike.Basic\npublic import Mathlib.Order.Interval.Set.Defs\npublic import Mathlib.Order.SetNotation\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Jeremy Tan. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jeremy Tan\n-/\n/-!\n# Properties of relative upper/lower sets\n\nThis file proves results on `IsRelUpperSet` and `IsRelLowerSet`.\n-/\n\npublic section\n\nopen Set\n\nvariable {α : Type*} {ι : Sort*} {κ : ι → Sort*} {s t : Set α} {a b : α} {P : α → Prop}\n\nsection LE\n\nvariable [LE α]\n\n@[simp] lemma isRelUpperSet_true_iff_isUpperSet :\n IsRelUpperSet s (fun _ ↦ True) ↔ IsUpperSet s := by\n grind [IsUpperSet, IsRelUpperSet]\n\n@[simp] lemma isRelLowerSet_true_iff_isLowerSet :\n IsRelLowerSet s (fun _ ↦ True) ↔ IsLowerSet s := by\n grind [IsLowerSet, IsRelLowerSet]\n\nvariable (P) in\nlemma IsUpperSet.isRelUpperSet_sep (hs : IsUpperSet s) : IsRelUpperSet {x ∈ s | P x} P :=\n fun _ h => ⟨h.2, fun _ ht hp => ⟨hs ht h.1, hp⟩⟩\nvariable (P) in\nlemma IsLowerSet.isRelLowerSet_sep (hs : IsLowerSet s) : IsRelLowerSet {x ∈ s | P x} P :=\n fun _ h => ⟨h.2, fun _ ht hp => ⟨hs ht h.1, hp⟩⟩\n\n/-- A subset that is a lower set is additionally a _relative_ lower set. -/\nlemma IsRelLowerSet.mono_isLowerSet (ht : IsRelLowerSet t P) (hs : IsLowerSet s) (hst : s ⊆ t) :\n IsRelLowerSet s P :=\n fun _ h => ⟨(ht (hst h)).1, fun _ ht _ => hs ht h⟩\n\n/-- A subset that is an upper set is additionally a _relative_ upper set. -/\nlemma IsRelUpperSet.mono_isUpperSet (ht : IsRelUpperSet t P) (hs : IsUpperSet s) (hst : s ⊆ t) :\n IsRelUpperSet s P :=\n fun _ h => ⟨(ht (hst h)).1, fun _ ht _ => hs ht h⟩\n\nlemma IsRelUpperSet.prop_of_mem (hs : IsRelUpperSet s P) (h : a ∈ s) : P a := (hs h).1\nlemma IsRelLowerSet.prop_of_mem (hs : IsRelLowerSet s P) (h : a ∈ s) : P a := (hs h).1\n\nlemma IsRelUpperSet.mem_of_le (hs : IsRelUpperSet s P) (h : a ∈ s) (h₁ : a ≤ b) (h₂ : P b) :\n b ∈ s := (hs h).2 h₁ h₂\nlemma IsRelLowerSet.mem_of_le (hs : IsRelLowerSet s P) (h : a ∈ s) (h₁ : b ≤ a) (h₂ : P b) :\n b ∈ s := (hs h).2 h₁ h₂\n\n@[simp] lemma isRelUpperSet_empty : IsRelUpperSet (∅ : Set α) P := fun _ ↦ False.elim\n@[simp] lemma isRelLowerSet_empty : IsRelLowerSet (∅ : Set α) P := fun _ ↦ False.elim\n\n@[simp] lemma isRelUpperSet_self : IsRelUpperSet s (· ∈ s) := fun _ b ↦ ⟨b, fun _ _ ↦ id⟩\n@[simp] lemma isRelLowerSet_self : IsRelLowerSet s (· ∈ s) := fun _ b ↦ ⟨b, fun _ _ ↦ id⟩\n\nlemma IsRelUpperSet.union (hs : IsRelUpperSet s P) (ht : IsRelUpperSet t P) :\n IsRelUpperSet (s ∪ t) P := fun b mb ↦ by\n cases mb with\n | inl h => exact ⟨(hs h).1, fun _ x y ↦ .inl ((hs h).2 x y)⟩\n | inr h => exact ⟨(ht h).1, fun _ x y ↦ .inr ((ht h).2 x y)⟩\n\nlemma IsRelLowerSet.union (hs : IsRelLowerSet s P) (ht : IsRelLowerSet t P) :\n IsRelLowerSet (s ∪ t) P := fun b mb ↦ by\n cases mb with\n | inl h => exact ⟨(hs h).1, fun _ x y ↦ .inl ((hs h).2 x y)⟩\n | inr h => exact ⟨(ht h).1, fun _ x y ↦ .inr ((ht h).2 x y)⟩\n\nlemma IsRelUpperSet.inter (hs : IsRelUpperSet s P) (ht : IsRelUpperSet t P) :\n IsRelUpperSet (s ∩ t) P := fun b ⟨bs, bt⟩ ↦ by\n simp_all only [IsRelUpperSet, true_and]\n exact fun _ x y ↦ ⟨(hs bs).2 x y, (ht bt).2 x y⟩\n\nlemma IsRelLowerSet.inter (hs : IsRelLowerSet s P) (ht : IsRelLowerSet t P) :\n IsRelLowerSet (s ∩ t) P := fun b ⟨bs, bt⟩ ↦ by\n simp_all only [IsRelLowerSet, true_and]\n exact fun _ x y ↦ ⟨(hs bs).2 x y, (ht bt).2 x y⟩\n\nprotected lemma IsRelUpperSet.sUnion {S : Set (Set α)} (hS : ∀ s ∈ S, IsRelUpperSet s P) :\n IsRelUpperSet (⋃₀ S) P := fun _ ⟨s, ms, mb⟩ ↦\n ⟨(hS s ms mb).1, fun _ x y ↦ ⟨s, ms, (hS s ms mb).2 x y⟩⟩\n\nprotected lemma IsRelLowerSet.sUnion {S : Set (Set α)} (hS : ∀ s ∈ S, IsRelLowerSet s P) :\n IsRelLowerSet (⋃₀ S) P := fun _ ⟨s, ms, mb⟩ ↦\n ⟨(hS s ms mb).1, fun _ x y ↦ ⟨s, ms, (hS s ms mb).2 x y⟩⟩\n\nprotected lemma IsRelUpperSet.iUnion {f : ι → Set α} (hf : ∀ i, IsRelUpperSet (f i) P) :\n IsRelUpperSet (⋃ i, f i) P :=\n .sUnion (forall_mem_range.2 hf)\n\nprotected lemma IsRelLowerSet.iUnion {f : ι → Set α} (hf : ∀ i, IsRelLowerSet (f i) P) :\n IsRelLowerSet (⋃ i, f i) P :=\n .sUnion (forall_mem_range.2 hf)\n\nprotected lemma IsRelUpperSet.iUnion₂ {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelUpperSet (f i j) P) :\n IsRelUpperSet (⋃ (i) (j), f i j) P :=\n .iUnion fun i ↦ .iUnion (hf i)\n\nprotected lemma IsRelLowerSet.iUnion₂ {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelLowerSet (f i j) P) :\n IsRelLowerSet (⋃ (i) (j), f i j) P :=\n .iUnion fun i ↦ .iUnion (hf i)\n\nprotected lemma IsRelUpperSet.sInter\n {S : Set (Set α)} (hS : S.Nonempty) (hf : ∀ s ∈ S, IsRelUpperSet s P) :\n IsRelUpperSet (⋂₀ S) P := fun b mb ↦ by\n obtain ⟨s₀, ms₀⟩ := hS\n refine ⟨(hf s₀ ms₀ (mb s₀ ms₀)).1, fun _ x y s ms ↦ (hf s ms (mb s ms)).2 x y⟩\n\nprotected lemma IsRelLowerSet.sInter\n {S : Set (Set α)} (hS : S.Nonempty) (hf : ∀ s ∈ S, IsRelLowerSet s P) :\n IsRelLowerSet (⋂₀ S) P := fun b mb ↦ by\n obtain ⟨s₀, ms₀⟩ := hS\n refine ⟨(hf s₀ ms₀ (mb s₀ ms₀)).1, fun _ x y s ms ↦ (hf s ms (mb s ms)).2 x y⟩\n\nprotected lemma IsRelUpperSet.iInter\n [Nonempty ι] {f : ι → Set α} (hf : ∀ i, IsRelUpperSet (f i) P) : IsRelUpperSet (⋂ i, f i) P :=\n .sInter (range_nonempty f) (forall_mem_range.2 hf)\n\nprotected lemma IsRelLowerSet.iInter\n [Nonempty ι] {f : ι → Set α} (hf : ∀ i, IsRelLowerSet (f i) P) : IsRelLowerSet (⋂ i, f i) P :=\n .sInter (range_nonempty f) (forall_mem_range.2 hf)\n\nprotected lemma IsRelUpperSet.iInter₂ [Nonempty ι] [∀ i, Nonempty (κ i)]\n {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelUpperSet (f i j) P) :\n IsRelUpperSet (⋂ (i) (j), f i j) P :=\n .iInter fun i ↦ .iInter (hf i)\n\nprotected lemma IsRelLowerSet.iInter₂ [Nonempty ι] [∀ i, Nonempty (κ i)]\n {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelLowerSet (f i j) P) :\n IsRelLowerSet (⋂ (i) (j), f i j) P :=\n .iInter fun i ↦ .iInter (hf i)\n\nlemma isUpperSet_subtype_iff_isRelUpperSet {s : Set { x // P x }} :\n IsUpperSet s ↔ IsRelUpperSet (Subtype.val '' s) P := by\n refine ⟨fun h a x ↦ ?_, fun h a b x y ↦ ?_⟩\n · obtain ⟨a, ma, rfl⟩ := x\n exact ⟨a.2, fun b x y ↦ by simpa [h (show a ≤ ⟨b, y⟩ by exact x) ma]⟩\n · have ma : a.1 ∈ Subtype.val '' s := by simp [a.2, y]\n simpa only [mem_image, Subtype.coe_inj, exists_eq_right] using (h ma).2 x b.2\n\nTarget:\nlemma isLowerSet_subtype_iff_isRelLowerSet {s : Set { x // P x }} :\n IsLowerSet s ↔ IsRelLowerSet (Subtype.val '' s) P :=\n\nProof body:\n","rejected":"by\n exact isLowerSet_subtype_iff_isRelLowerSet","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"79fffa489be36930109cf5a636f567bd0c1b563a4de94ff3ab23e7bbb41c9eef","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Order/UpperLower","family_id":"islowerset_subtype_iff_isrellowerset","file_id":"mathlib/Mathlib/Order/UpperLower/Relative.lean","sample_id":"536b9c6a6a5b364cbf955e37e33716d32e57e801c918bfe11a1d15bd1faeaaf9"},"split":"validation"} {"binding":{"chosen_proof_sha256":"be44aa8c9ebe00750f1b4f9b7a2c6e898434ab25d6c00ac01f949a805242eebf","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"ac353a3c3c7222605a30cd726a09a31adf3de0a47e166ddaa24b5d835db42c86","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d20e2d9f94a4dc03c88048c984242f00c47dbce5585aec58706852df3126e7c0","source_sha256":"3b1ebdbfe4d3947834e2865eb5db92b25f69737c310e197f1baeb59959f0efe4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← neg_right_iff] at h_comm\n rw [← isNilpotent_neg_iff] at hy\n rw [sub_eq_add_neg]\n exact h_comm.isNilpotent_add hx hy","hard_negative":true,"metrics":{"chosen_tokens":25,"rejected_tokens":3,"token_jaccard":0.125,"token_length_ratio":0.12},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"1a773f9afd4bae51a93103fd5bc211612b9bd2b561d5d89bb9cbb9a3209f1cee","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.BigOperators.Finprod\npublic import Mathlib.Algebra.FiniteSupport.Defs\npublic import Mathlib.Algebra.GroupWithZero.Action.Defs\npublic import Mathlib.Algebra.GroupWithZero.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.GeomSum\npublic import Mathlib.Data.Nat.Choose.Sum\npublic import Mathlib.Order.Lattice.Nat\npublic import Mathlib.RingTheory.Nilpotent.Defs\n\nNamespace:\nCommute\n\nLocal context:\n/-\nCopyright (c) 2021 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Nilpotent elements\n\nThis file develops the basic theory of nilpotent elements. In particular it shows that the\nnilpotent elements are closed under many operations.\n\nFor the definition of `nilradical`, see `Mathlib/RingTheory/Nilpotent/Lemmas.lean`.\n\n\n## Main definitions\n\n * `isNilpotent_neg_iff`\n * `Commute.isNilpotent_add`\n * `Commute.isNilpotent_sub`\n\n-/\n\npublic section\n\nuniverse u v\n\nopen Function Set\n\nvariable {R S : Type*} {x y : R}\n\ntheorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by\n obtain ⟨n, hn⟩ := h\n use n\n rw [neg_pow, hn, mul_zero]\n\n@[simp]\ntheorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x :=\n ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩\n\nlemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S]\n [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) :\n IsNilpotent (t • a) := by\n obtain ⟨k, ha⟩ := ha\n use k\n rw [smul_pow, ha, smul_zero]\n\ntheorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by\n obtain ⟨n, hn⟩ := hnil\n refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩\n · simp [mul_geom_sum, hn]\n · simp [geom_sum_mul, hn]\n\ntheorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by\n rw [← IsUnit.neg_iff, neg_sub]\n exact isUnit_sub_one hnil\n\ntheorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by\n rw [← IsUnit.neg_iff, neg_add']\n exact isUnit_sub_one hnil.neg\n\ntheorem IsNilpotent.isUnit_one_add [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 + r) :=\n add_comm r 1 ▸ isUnit_add_one hnil\n\ntheorem IsNilpotent.isUnit_add_left_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (u + r) := by\n rw [← Units.isUnit_mul_units _ hu.unit⁻¹, add_mul, IsUnit.mul_val_inv]\n replace h_comm : Commute r (↑hu.unit⁻¹) := Commute.units_inv_right h_comm\n refine IsNilpotent.isUnit_one_add ?_\n exact (hu.unit⁻¹.isUnit.isNilpotent_mul_unit_of_commute_iff h_comm).mpr hnil\n\ntheorem IsNilpotent.isUnit_add_right_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (r + u) :=\n add_comm r u ▸ hnil.isUnit_add_left_of_commute hu h_comm\n\nlemma IsUnit.not_isNilpotent [Ring R] [Nontrivial R] {x : R} (hx : IsUnit x) :\n ¬ IsNilpotent x := by\n intro H\n simpa using H.isUnit_add_right_of_commute hx.neg (by simp)\n\nlemma IsNilpotent.not_isUnit [Ring R] [Nontrivial R] {x : R} (hx : IsNilpotent x) :\n ¬ IsUnit x :=\n mt IsUnit.not_isNilpotent (by simpa only [not_not] using hx)\n\nlemma IsIdempotentElem.eq_zero_of_isNilpotent [MonoidWithZero R] {e : R}\n (idem : IsIdempotentElem e) (nilp : IsNilpotent e) : e = 0 := by\n obtain ⟨rfl | n, hn⟩ := nilp\n · rw [pow_zero] at hn; rw [← one_mul e, hn, zero_mul]\n · rw [← hn, idem.pow_succ_eq]\n\nalias IsNilpotent.eq_zero_of_isIdempotentElem := IsIdempotentElem.eq_zero_of_isNilpotent\n\ninstance [Zero R] [Pow R ℕ] [Zero S] [Pow S ℕ] [IsReduced R] [IsReduced S] : IsReduced (R × S) where\n eq_zero _ := fun ⟨n, hn⟩ ↦ have hn := Prod.ext_iff.1 hn\n Prod.ext (IsReduced.eq_zero _ ⟨n, hn.1⟩) (IsReduced.eq_zero _ ⟨n, hn.2⟩)\n\ntheorem Prime.isRadical [CommMonoidWithZero R] {y : R} (hy : Prime y) : IsRadical y :=\n fun _ _ ↦ hy.dvd_of_dvd_pow\n\ntheorem zero_isRadical_iff [MonoidWithZero R] : IsRadical (0 : R) ↔ IsReduced R := by\n simp_rw [isReduced_iff, IsNilpotent, exists_imp, ← zero_dvd_iff]\n exact forall_comm\n\ntheorem isReduced_iff_pow_one_lt [MonoidWithZero R] (k : ℕ) (hk : 1 < k) :\n IsReduced R ↔ ∀ x : R, x ^ k = 0 → x = 0 := by\n simp_rw [← zero_isRadical_iff, isRadical_iff_pow_one_lt k hk, zero_dvd_iff]\n\ntheorem IsRadical.of_dvd [CommMonoidWithZero R] [IsCancelMulZero R] {x y : R} (hy : IsRadical y)\n (h0 : y ≠ 0) (hxy : x ∣ y) : IsRadical x := (isRadical_iff_pow_one_lt 2 one_lt_two).2 <| by\n obtain ⟨z, rfl⟩ := hxy\n refine fun w dvd ↦ ((mul_dvd_mul_iff_right <| right_ne_zero_of_mul h0).mp <| hy 2 _ ?_)\n rw [mul_pow]\n gcongr\n exact dvd_pow_self _ two_ne_zero\n\nnamespace Commute\n\nsection Semiring\n\nvariable [Semiring R]\n\ntheorem add_pow_eq_zero_of_add_le_succ_of_pow_eq_zero (h_comm : Commute x y) {m n k : ℕ}\n (hx : x ^ m = 0) (hy : y ^ n = 0) (h : m + n ≤ k + 1) :\n (x + y) ^ k = 0 := by\n rw [h_comm.add_pow']\n apply Finset.sum_eq_zero\n rintro ⟨i, j⟩ hij\n suffices x ^ i * y ^ j = 0 by simp only [this, nsmul_eq_mul, mul_zero]\n by_cases hi : m ≤ i\n · rw [pow_eq_zero_of_le hi hx, zero_mul]\n rw [pow_eq_zero_of_le ?_ hy, mul_zero]\n linarith [Finset.mem_antidiagonal.mp hij]\n\ntheorem add_pow_add_eq_zero_of_pow_eq_zero (h_comm : Commute x y) {m n : ℕ}\n (hx : x ^ m = 0) (hy : y ^ n = 0) :\n (x + y) ^ (m + n - 1) = 0 :=\n h_comm.add_pow_eq_zero_of_add_le_succ_of_pow_eq_zero hx hy <| by rw [← Nat.sub_le_iff_le_add]\n\ntheorem isNilpotent_add (h_comm : Commute x y) (hx : IsNilpotent x) (hy : IsNilpotent y) :\n IsNilpotent (x + y) := by\n obtain ⟨n, hn⟩ := hx\n obtain ⟨m, hm⟩ := hy\n exact ⟨_, add_pow_add_eq_zero_of_pow_eq_zero h_comm hn hm⟩\n\nprotected lemma isNilpotent_sum {ι : Type*} {s : Finset ι} {f : ι → R}\n (hnp : ∀ i ∈ s, IsNilpotent (f i)) (h_comm : ∀ i j, i ∈ s → j ∈ s → Commute (f i) (f j)) :\n IsNilpotent (∑ i ∈ s, f i) := by\n classical\n induction s using Finset.induction with\n | empty => simp\n | insert j s hj ih => ?_\n rw [Finset.sum_insert hj]\n apply Commute.isNilpotent_add\n · exact Commute.sum_right _ _ _ (fun i hi ↦ h_comm _ _ (by simp) (by simp [hi]))\n · apply hnp; simp\n · exact ih (fun i hi ↦ hnp i (by simp [hi]))\n (fun i j hi hj ↦ h_comm i j (by simp [hi]) (by simp [hj]))\n\ntheorem isNilpotent_finsum {ι : Type*} {f : ι → R}\n (hf : ∀ b, IsNilpotent (f b)) (h_comm : ∀ i j, Commute (f i) (f j)) :\n IsNilpotent (finsum f) := by\n classical\n by_cases h : HasFiniteSupport f\n · rw [finsum_def, dif_pos h]\n exact Commute.isNilpotent_sum (fun b _ ↦ hf b) (fun _ _ _ _ ↦ h_comm _ _)\n · simp only [finsum_def, dif_neg h, IsNilpotent.zero]\n\nprotected lemma isNilpotent_mul_right_iff (h_comm : Commute x y) (hy : y ∈ nonZeroDivisorsRight R) :\n IsNilpotent (x * y) ↔ IsNilpotent x := by\n refine ⟨?_, h_comm.isNilpotent_mul_right⟩\n rintro ⟨k, hk⟩\n rw [mul_pow h_comm] at hk\n exact ⟨k, (nonZeroDivisorsRight R).pow_mem hy k _ hk⟩\n\nprotected lemma isNilpotent_mul_left_iff (h_comm : Commute x y) (hx : x ∈ nonZeroDivisorsLeft R) :\n IsNilpotent (x * y) ↔ IsNilpotent y := by\n refine ⟨?_, h_comm.isNilpotent_mul_left⟩\n rintro ⟨k, hk⟩\n rw [mul_pow h_comm] at hk\n exact ⟨k, (nonZeroDivisorsLeft R).pow_mem hx k _ hk⟩\n\nend Semiring\n\nsection Ring\n\nvariable [Ring R]\n\nTarget:\ntheorem isNilpotent_sub (h_comm : Commute x y) (hx : IsNilpotent x) (hy : IsNilpotent y) :\n IsNilpotent (x - y) :=\n\nProof body:\n","rejected":"by\n exact isNilpotent_sub","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"e7efb2afbdbdd0257eabf5f765a679c4bf1a358b977fe05347842b7346cc8f87","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Nilpotent","family_id":"isnilpotent_sub","file_id":"mathlib/Mathlib/RingTheory/Nilpotent/Basic.lean","sample_id":"d20e2d9f94a4dc03c88048c984242f00c47dbce5585aec58706852df3126e7c0"},"split":"validation"} {"binding":{"chosen_proof_sha256":"135e538224b478b7321478a8ed534f854e5bf945d2b74633ee4f900703a86e8f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"553441baaa635096c335f03a69853e486818cf4c8b20fee538c5f43d28aa2a32","source_sha256":"8776202ae66e6a5502d495e8a86b902f1a12ad7e893cebc8ed41f328fff5f0dd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp [binomialRandom_apply', setBernoulli_apply, ← Set.image_comp]","hard_negative":false,"metrics":{"chosen_tokens":12,"rejected_tokens":3,"token_jaccard":0.076923,"token_length_ratio":0.25},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"1af4e76bce189d254d0a271df6df3c4f893fcd261d7d26f6b3eee07fe95ad449","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Sym.Card\npublic import Mathlib.MeasureTheory.Constructions.SimpleGraph\npublic import Mathlib.Probability.Distributions.SetBernoulli\n\nNamespace:\nSimpleGraph\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Binomial random graphs\n\nThis file constructs the binomial distribution with parameter `p` on simple graphs with\nvertices `V`. This is the law `G(V, p)` of binomial random graphs with probability `p`.\n\n## TODO\n\nAdd the characteristic predicate for a random graph to follow the binomial random distribution.\n\n## Historical note\n\nThis is usually called the Erdős–Rényi model, but this name is historically inaccurate as Erdős and\nRényi introduced a closely related but different model. We therefore choose the name\n\"binomial random graph\" to avoid confusion with this other model and because it is a more\ndescriptive name.\n\n## Tags\n\nErdős-Rényi graph, Erdős-Renyi graph, Erdös-Rényi graph, Erdös-Renyi graph, Erdos-Rényi graph,\nErdos-Renyi graph\n-/\n\npublic section\n\nopen MeasureTheory Measure ProbabilityTheory unitInterval\nopen scoped Finset\n\nnamespace SimpleGraph\nvariable {V : Type*} {p : I}\n\nvariable (V p) in\n/-- The binomial distribution with parameter `p` on simple graphs with vertices `V`. -/\n@[expose]\nnoncomputable def binomialRandom : Measure (SimpleGraph V) :=\n setBer(Sym2.diagSetᶜ, p).comap edgeSet\n\n@[inherit_doc] scoped notation \"G(\" V \", \" p \")\" => binomialRandom V p\n\nsection Countable\nvariable [Countable V]\n\nvariable (V p) in\nlemma binomialRandom_eq_map : G(V, p) = map fromEdgeSet setBer(Sym2.diagSetᶜ, p) := by\n refine (map_eq_comap measurable_fromEdgeSet measurableEmbedding_edgeSet ?_\n fromEdgeSet_edgeSet).symm\n filter_upwards [setBernoulli_ae_subset] with S hS\n exact ⟨fromEdgeSet S, by simpa [← Set.compl_setOf, Set.subset_compl_iff_disjoint_right] using hS⟩\n\nvariable (p) in\nlemma binomialRandom_apply' (S : Set (SimpleGraph V)) :\n G(V, p) S = setBer(Sym2.diagSetᶜ, p) (edgeSet '' S) := by\n rw [binomialRandom, measurableEmbedding_edgeSet.comap_apply]\n\nvariable (p) in\n\nTarget:\nlemma binomialRandom_apply (S : Set (SimpleGraph V)) :\n G(V, p) S = infinitePi\n (fun e : Sym2 V ↦ toNNReal p • .dirac (¬ e.IsDiag) + toNNReal (σ p) • .dirac False)\n ((fun G e ↦ e ∈ G.edgeSet) '' S) :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Probability/Combinatorics","family_id":"binomialrandom_apply","file_id":"mathlib/Mathlib/Probability/Combinatorics/BinomialRandomGraph/Defs.lean","sample_id":"553441baaa635096c335f03a69853e486818cf4c8b20fee538c5f43d28aa2a32"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3ec32b9923c396411fc7331af67fe6487d8a0df4c759f04b5d8ad92f87c6243d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"760fe1c7d47cdad6b2200c5e2a14bfb8fb79a00ce22d06653d4add4ff8342421","source_sha256":"881ac4e04220671a354c0ff67112160cf9fcb67e5dd46f3a36a0eeb47ad8a23f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨fun _ ↦ ⟨F.ringFilterBasis, rfl⟩, fun ⟨B, hB⟩ ↦ ⟨fun {I} hI a ↦ ?_⟩⟩\n obtain ⟨V, hbasis, hsub⟩ := B.mul_right a (U := I) (hB.ge (by simpa))\n obtain ⟨J, hJ, rfl⟩ := hB.le hbasis\n exact Order.PFilter.mem_of_le (fun x hx ↦ by simpa using (hsub hx)) hJ","hard_negative":false,"metrics":{"chosen_tokens":93,"rejected_tokens":5,"token_jaccard":0.069767,"token_length_ratio":0.053763},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"1c141670b3554358e70661102e5561b13df53bdb8535bbe2e480ccd6b298c786","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.IdealFilter.Basic\npublic import Mathlib.Topology.Algebra.LinearTopology\npublic import Mathlib.Topology.Algebra.FilterBasis\n\nNamespace:\nIdealFilter\n\nLocal context:\n/-\nCopyright (c) 2025 Blake Farman. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Blake Farman\n-/\n/-!\n# Topologies associated to ideal filters\n\nThis file constructs topological structures on a ring from an `IdealFilter` and characterizes\nuniform ideal filters in terms of ring filter bases.\n\n## Main definitions\n* `WithIdealFilter`: Type synonym for a ring that depends on a choice of ideal filter. This can be\n used to assign and infer instances on a ring that depend on an ideal filter.\n* `IdealFilter.addGroupFilterBasis`: the `AddGroupFilterBasis` with sets the ideals of `F`.\n* `IdealFilter.ringFilterBasis`: under `[F.IsUniform]`, the `RingFilterBasis` with sets the ideals\n of `F`.\n\n## Main statements\n\n* `IdealFilter.isUniform_iff_exists_ringFilterBasis`: An `IdealFilter` on a ring `A` is uniform if\n and only if its ideals form a `RingFilterBasis` for `A`.\n\n## References\n\n* [nLab: Uniform filter](https://ncatlab.org/nlab/show/uniform+filter)\n\n## Tags\n\nring theory, ideal, filter, linear topology\n-/\n\n@[expose] public section\n\nopen scoped Pointwise Topology\n\nnamespace IdealFilter\n\n/-- The additive-group filter basis whose sets are the ideals belonging to the ideal filter `F`. -/\n@[implicit_reducible]\ndef addGroupFilterBasis {A : Type*} [Ring A] (F : IdealFilter A) : AddGroupFilterBasis A where\n sets := {(I : Set A) | I ∈ F}\n nonempty := ⟨_, ⟨_, F.nonempty.choose_spec, rfl⟩⟩\n inter_sets := by\n rintro s t ⟨I, hI, rfl⟩ ⟨J, hJ, rfl⟩\n exact ⟨I ⊓ J, ⟨I ⊓ J, Order.PFilter.inf_mem hI hJ, rfl⟩, fun _ h ↦ h⟩\n zero' := by aesop\n add' := by aesop\n neg' := by aesop\n conj' := by aesop\n\n/-- Under `[F.IsUniform]`, the ring filter basis obtained from `addGroupFilterBasis`. -/\n@[simps! -isSimp sets, implicit_reducible]\ndef ringFilterBasis {A : Type*} [Ring A] {F : IdealFilter A} [F.IsUniform] :\n RingFilterBasis A where\n __ := F.addGroupFilterBasis\n mul' := by\n rintro U ⟨I, hI, rfl⟩\n exact ⟨I, ⟨I, hI, rfl⟩, Set.mul_subset_iff.mpr fun _ h₁ _ h₂ ↦ mul_mem h₁ h₂⟩\n mul_left' := by\n rintro x₀ U ⟨I, hI, rfl⟩\n exact ⟨I, ⟨I, hI, rfl⟩, fun a ha ↦ Ideal.mul_mem_left I x₀ ha⟩\n mul_right' := by\n rintro x₀ U ⟨I, hI, rfl⟩\n refine ⟨I.colon {x₀}, ⟨I.colon {x₀}, IsUniform.colon_mem hI x₀, rfl⟩,\n fun a ha ↦ Set.mem_preimage.mpr (Submodule.mem_colon_singleton.mp ha)⟩\n\n/-- An `IdealFilter` on a ring `A` is uniform if and only if its ideals form a `RingFilterBasis`\nfor `A`. -/\n\nTarget:\ntheorem isUniform_iff_exists_ringFilterBasis {A : Type*} [Ring A] {F : IdealFilter A} :\n F.IsUniform ↔ ∃ B : RingFilterBasis A, B.sets = {(I : Set A) | I ∈ F} :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/IdealFilter","family_id":"isuniform_iff_exists_ringfilterbasis","file_id":"mathlib/Mathlib/RingTheory/IdealFilter/Topology.lean","sample_id":"760fe1c7d47cdad6b2200c5e2a14bfb8fb79a00ce22d06653d4add4ff8342421"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d17056e186bd79690508d18b6329d6c92ea961f832d0039698b9d039eb61df32","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"76312ddc9dafbaae34dae79b8aca11a511df9c7bcfa230c91295519054debb76","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"037105a9185d2ca0fdabf9757094f361dead96d5e688d56f64a1c2e0e30938cf","source_sha256":"b5ead3699b586fdde3d03deabff500efd9a58e49d2069d0a294c0b57a2c4dc0d","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← pow_smul_eq_iff_period_dvd, Monoid.pow_exponent_eq_one, one_smul]","hard_negative":true,"metrics":{"chosen_tokens":12,"rejected_tokens":5,"token_jaccard":0.142857,"token_length_ratio":0.416667},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"1c16406ba5f48507e1eea556ce1d2ce09070256b14637d1cb573539b840182d1","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Dynamics.PeriodicPts.Lemmas\npublic import Mathlib.GroupTheory.Exponent\npublic import Mathlib.GroupTheory.GroupAction.Basic\n\nNamespace:\nMulAction\n\nLocal context:\n/-\nCopyright (c) 2024 Emilie Burgun. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Emilie Burgun\n-/\n/-!\n# Period of a group action\n\nThis module defines some helpful lemmas around [`MulAction.period`] and [`AddAction.period`].\nThe period of a point `a` by a group element `g` is the smallest `m` such that `g ^ m • a = a`\n(resp. `(m • g) +ᵥ a = a`) for a given `g : G` and `a : α`.\n\nIf such an `m` does not exist,\nthen by convention `MulAction.period` and `AddAction.period` return 0.\n-/\n\npublic section\n\nnamespace MulAction\n\nuniverse u v\nvariable {α : Type v}\nvariable {G : Type u} [Group G] [MulAction G α]\nvariable {M : Type u} [Monoid M] [MulAction M α]\n\n/-- If the action is periodic, then a lower bound for its period can be computed. -/\n@[to_additive /-- If the action is periodic, then a lower bound for its period can be computed. -/]\ntheorem le_period {m : M} {a : α} {n : ℕ} (period_pos : 0 < period m a)\n (moved : ∀ k, 0 < k → k < n → m ^ k • a ≠ a) : n ≤ period m a :=\n le_of_not_gt fun period_lt_n =>\n moved _ period_pos period_lt_n <| pow_period_smul m a\n\n/-- If for some `n`, `m ^ n • a = a`, then `period m a ≤ n`. -/\n@[to_additive /-- If for some `n`, `(n • m) +ᵥ a = a`, then `period m a ≤ n`. -/]\ntheorem period_le_of_fixed {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (fixed : m ^ n • a = a) :\n period m a ≤ n :=\n (isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_le n_pos\n\n/-- If for some `n`, `m ^ n • a = a`, then `0 < period m a`. -/\n@[to_additive /-- If for some `n`, `(n • m) +ᵥ a = a`, then `0 < period m a`. -/]\ntheorem period_pos_of_fixed {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (fixed : m ^ n • a = a) :\n 0 < period m a :=\n (isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_pos n_pos\n\n@[to_additive]\ntheorem period_eq_one_iff {m : M} {a : α} : period m a = 1 ↔ m • a = a :=\n ⟨fun eq_one => pow_one m ▸ eq_one ▸ pow_period_smul m a,\n fun fixed => le_antisymm\n (period_le_of_fixed one_pos (by simpa))\n (period_pos_of_fixed one_pos (by simpa))⟩\n\n/-- For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `m ^ n`. -/\n@[to_additive\n/-- For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `n • m`. -/]\ntheorem pow_smul_ne_of_lt_period {m : M} {a : α} {n : ℕ} (n_pos : 0 < n)\n (n_lt_period : n < period m a) : m ^ n • a ≠ a := fun a_fixed =>\n not_le_of_gt n_lt_period <| period_le_of_fixed n_pos a_fixed\n\nsection Identities\n\n/-! ### `MulAction.period` for common group elements\n-/\n\nvariable (M) in\n@[to_additive (attr := simp)]\ntheorem period_one (a : α) : period (1 : M) a = 1 := period_eq_one_iff.mpr (one_smul M a)\n\n@[to_additive (attr := simp)]\ntheorem period_inv (g : G) (a : α) : period g⁻¹ a = period g a := by\n simp only [period_eq_minimalPeriod, Function.minimalPeriod_eq_minimalPeriod_iff,\n isPeriodicPt_smul_iff]\n intro n\n rw [smul_eq_iff_eq_inv_smul, eq_comm, ← zpow_natCast, inv_zpow, inv_inv, zpow_natCast]\n\nend Identities\n\nsection MonoidExponent\n\n/-! ### `MulAction.period` and group exponents\n\nThe period of a given element `m : M` can be bounded by the `Monoid.exponent M` or `orderOf m`.\n-/\n\n@[to_additive]\ntheorem period_dvd_orderOf (m : M) (a : α) : period m a ∣ orderOf m := by\n rw [← pow_smul_eq_iff_period_dvd, pow_orderOf_eq_one, one_smul]\n\n@[to_additive]\ntheorem period_pos_of_orderOf_pos {m : M} (order_pos : 0 < orderOf m) (a : α) :\n 0 < period m a :=\n Nat.pos_of_dvd_of_pos (period_dvd_orderOf m a) order_pos\n\n@[to_additive]\ntheorem period_le_orderOf {m : M} (order_pos : 0 < orderOf m) (a : α) :\n period m a ≤ orderOf m :=\n Nat.le_of_dvd order_pos (period_dvd_orderOf m a)\n\n@[to_additive]\n\nTarget:\ntheorem period_dvd_exponent (m : M) (a : α) : period m a ∣ Monoid.exponent M :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_037105a9185d","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"30fe04343e25dcf7ba0bad4361b5661bd2288d286c7f92d1f35d739308ae7f77","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/GroupAction","family_id":"period_dvd_exponent","file_id":"mathlib/Mathlib/GroupTheory/GroupAction/Period.lean","sample_id":"037105a9185d2ca0fdabf9757094f361dead96d5e688d56f64a1c2e0e30938cf"},"split":"validation"} {"binding":{"chosen_proof_sha256":"fff0c136fa1018c43a5ab47ca0d1ac8e9ab63d604c861043055fb4b685b8a934","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"00b4cd471b08e6c8c4615ed8bbd424a95161b41f7e2636de119bdc0607d6cea6","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"5d7de265aaadb8918c3c49b38682eec68ccfac621445255fa00eca0ce57eac91","source_sha256":"03792f6e84a5ba12e3c2c48b0b57be56c9a721f9a7e26774b731337c63e84688","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← smul_eq_mul (a := x), idempotent, ← Submodule.coe_smul, ← smul_apply, ← decompose_smul,\n smul_eq_mul, mul_one]","hard_negative":true,"metrics":{"chosen_tokens":28,"rejected_tokens":5,"token_jaccard":0.090909,"token_length_ratio":0.178571},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"1c86a59140e1ef6cac1e4113a7bcc78ec492179b250f7281bc5873566e9c6f19","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Idempotents\npublic import Mathlib.Algebra.DirectSum.Decomposition\n\nNamespace:\nDirectSum\n\nLocal context:\n/-\nCopyright (c) 2025 Yunzhou Xie. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yunzhou Xie, Jujian Zhang, Andrew Yang\n-/\n/-!\n# Decomposition of the identity of a semiring into orthogonal idempotents\n\nIn this file we show that if a semiring `R` can be decomposed into a direct sum\nof (left) ideals `R = V₁ ⊕ V₂ ⊕ ⋯ ⊕ Vₙ` then in the corresponding decomposition\n`1 = e₁ + e₂ + ⋯ + eₙ` with `eᵢ ∈ Vᵢ`, each `eᵢ` is an idempotent and the\n`eᵢ`'s form a family of complete orthogonal idempotents.\n-/\n\n@[expose] public section\n\nnamespace DirectSum\n\nsection OrthogonalIdempotents\n\nvariable {R I : Type*} [Semiring R] [DecidableEq I] (V : I → Ideal R) [Decomposition V]\n\n/-- The decomposition of `(1 : R)` where `1 = e₁ + e₂ + ⋯ + eₙ` which is induced by\n the decomposition of the semiring `R = V1 ⊕ V2 ⊕ ⋯ ⊕ Vn`. -/\ndef idempotent (i : I) : R :=\n decompose V 1 i\n\nTarget:\nlemma decompose_eq_mul_idempotent (x : R) (i : I) : decompose V x i = x * idempotent V i :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_5d7de265aaad","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"24268f7320fdfcc6a39abf761bf09baf2aefdefccc70e36969bb694b8ca7f56b","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/DirectSum","family_id":"decompose_eq_mul_idempotent","file_id":"mathlib/Mathlib/Algebra/DirectSum/Idempotents.lean","sample_id":"5d7de265aaadb8918c3c49b38682eec68ccfac621445255fa00eca0ce57eac91"},"split":"validation"} {"binding":{"chosen_proof_sha256":"cde53003a415aef5d70ce6568aecc668a9190aa46283839d3c48157c4162f290","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"3f6e79d4a8cf00fa0e3c8c44aa582fa6cc9878ef4a7dd0281ecedf79e00d6127","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"a5a791618fc035b41c36a0f1781e389de02739d5549a62e74aaae3ffec4ea8e8","source_sha256":"3b1ebdbfe4d3947834e2865eb5db92b25f69737c310e197f1baeb59959f0efe4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n intro H\n simpa using H.isUnit_add_right_of_commute hx.neg (by simp)","hard_negative":false,"metrics":{"chosen_tokens":15,"rejected_tokens":20,"token_jaccard":0.75,"token_length_ratio":1.333333},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"1cebe593b992cdf360045634c10eea02e78cf70e86fc8ee3e3f2d05e348d0122","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.BigOperators.Finprod\npublic import Mathlib.Algebra.FiniteSupport.Defs\npublic import Mathlib.Algebra.GroupWithZero.Action.Defs\npublic import Mathlib.Algebra.GroupWithZero.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.GeomSum\npublic import Mathlib.Data.Nat.Choose.Sum\npublic import Mathlib.Order.Lattice.Nat\npublic import Mathlib.RingTheory.Nilpotent.Defs\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Nilpotent elements\n\nThis file develops the basic theory of nilpotent elements. In particular it shows that the\nnilpotent elements are closed under many operations.\n\nFor the definition of `nilradical`, see `Mathlib/RingTheory/Nilpotent/Lemmas.lean`.\n\n\n## Main definitions\n\n * `isNilpotent_neg_iff`\n * `Commute.isNilpotent_add`\n * `Commute.isNilpotent_sub`\n\n-/\n\npublic section\n\nuniverse u v\n\nopen Function Set\n\nvariable {R S : Type*} {x y : R}\n\ntheorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by\n obtain ⟨n, hn⟩ := h\n use n\n rw [neg_pow, hn, mul_zero]\n\n@[simp]\ntheorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x :=\n ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩\n\nlemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S]\n [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) :\n IsNilpotent (t • a) := by\n obtain ⟨k, ha⟩ := ha\n use k\n rw [smul_pow, ha, smul_zero]\n\ntheorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by\n obtain ⟨n, hn⟩ := hnil\n refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩\n · simp [mul_geom_sum, hn]\n · simp [geom_sum_mul, hn]\n\ntheorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by\n rw [← IsUnit.neg_iff, neg_sub]\n exact isUnit_sub_one hnil\n\ntheorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by\n rw [← IsUnit.neg_iff, neg_add']\n exact isUnit_sub_one hnil.neg\n\ntheorem IsNilpotent.isUnit_one_add [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 + r) :=\n add_comm r 1 ▸ isUnit_add_one hnil\n\ntheorem IsNilpotent.isUnit_add_left_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (u + r) := by\n rw [← Units.isUnit_mul_units _ hu.unit⁻¹, add_mul, IsUnit.mul_val_inv]\n replace h_comm : Commute r (↑hu.unit⁻¹) := Commute.units_inv_right h_comm\n refine IsNilpotent.isUnit_one_add ?_\n exact (hu.unit⁻¹.isUnit.isNilpotent_mul_unit_of_commute_iff h_comm).mpr hnil\n\ntheorem IsNilpotent.isUnit_add_right_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (r + u) :=\n add_comm r u ▸ hnil.isUnit_add_left_of_commute hu h_comm\n\nTarget:\nlemma IsUnit.not_isNilpotent [Ring R] [Nontrivial R] {x : R} (hx : IsUnit x) :\n ¬ IsNilpotent x :=\n\nProof body:\n","rejected":"by\n intro H\n simpa using H.isUnit_add_right_of_commute hx.neg (by simp)\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Nilpotent","family_id":"isunit","file_id":"mathlib/Mathlib/RingTheory/Nilpotent/Basic.lean","sample_id":"a5a791618fc035b41c36a0f1781e389de02739d5549a62e74aaae3ffec4ea8e8"},"split":"validation"} {"binding":{"chosen_proof_sha256":"34370117cf1af66983b4a01919919b3775cd8065b450b0e261d20b1099f20daf","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"cb2365703352e5ca49b402315ebea124f6dbbad950df2652decd3f46a4758121","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"53e0ba607316ade5e9bd1d0ce5d67c6f506005e9671a13d827f6883bfdc1d4a0","source_sha256":"768b3331f9549aba216af332031e1c95a6da433745e06e2b8d9e582387e161ea","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [IsSymmetricAlgebra, lift_ι]\n exact Function.Involutive.bijective (congrFun rfl)","hard_negative":true,"metrics":{"chosen_tokens":18,"rejected_tokens":2,"token_jaccard":0.055556,"token_length_ratio":0.111111},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"1d80e9bc3390c287c7362173a89c395a4717d2981bd6f4811345f94f80afea63","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.TensorAlgebra.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Raphael Douglas Giles. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Raphael Douglas Giles, Zhixuan Dai, Zhenyan Fu, Yiming Fu, Jingting Wang, Eric Wieser\n-/\n/-!\n# Symmetric Algebras\n\nGiven a commutative semiring `R`, and an `R`-module `M`, we construct the symmetric algebra of `M`.\nThis is the free commutative `R`-algebra generated (`R`-linearly) by the module `M`.\n\n## Notation\n\n* `SymmetricAlgebra R M`: a concrete construction of the symmetric algebra defined as a\n quotient of the tensor algebra. It is endowed with an R-algebra structure and a commutative\n ring structure.\n* `SymmetricAlgebra.ι R`: the canonical R-linear map `M →ₗ[R] SymmetricAlgebra R M`.\n* Given a morphism `ι : M →ₗ[R] A`, `IsSymmetricAlgebra ι` is a proposition saying that the algebra\n homomorphism from `SymmetricAlgebra R M` to `A` lifted from `ι` is bijective.\n* Given a linear map `f : M →ₗ[R] A'` to a commutative R-algebra `A'`, and a morphism\n `ι : M →ₗ[R] A` with `p : IsSymmetricAlgebra ι`, `IsSymmetricAlgebra.lift p f`\n is the lift of `f` to an `R`-algebra morphism `A →ₐ[R] A'`.\n\n## Note\n\nSee `SymAlg R` instead if you are looking for the symmetrized algebra, which gives a commutative\nmultiplication on `R` by $a \\circ b = \\frac{1}{2}(ab + ba)$.\n-/\n\n@[expose] public section\n\nvariable (R M : Type*) [CommSemiring R] [AddCommMonoid M] [Module R M]\n\n/-- Relation on the tensor algebra which will yield the symmetric algebra when\nquotiented out by. -/\ninductive TensorAlgebra.SymRel : TensorAlgebra R M → TensorAlgebra R M → Prop where\n | mul_comm (x y : M) : SymRel (ι R x * ι R y) (ι R y * ι R x)\n\nopen TensorAlgebra\n\n/-- Concrete construction of the symmetric algebra of `M` by quotienting out\nthe tensor algebra by the commutativity relation. -/\nabbrev SymmetricAlgebra := RingQuot (SymRel R M)\n\nnamespace SymmetricAlgebra\n\n/-- Algebra homomorphism from the tensor algebra over `M` to the symmetric algebra over `M`. -/\nabbrev algHom : TensorAlgebra R M →ₐ[R] SymmetricAlgebra R M := RingQuot.mkAlgHom R (SymRel R M)\n\nlemma algHom_surjective : Function.Surjective (algHom R M) :=\n RingQuot.mkAlgHom_surjective _ _\n\n/-- Canonical inclusion of `M` into the symmetric algebra `SymmetricAlgebra R M`. -/\ndef ι : M →ₗ[R] SymmetricAlgebra R M := algHom R M ∘ₗ TensorAlgebra.ι R\n\n@[elab_as_elim]\ntheorem induction {motive : SymmetricAlgebra R M → Prop}\n (algebraMap : ∀ r, motive (algebraMap R (SymmetricAlgebra R M) r)) (ι : ∀ x, motive (ι R M x))\n (mul : ∀ a b, motive a → motive b → motive (a * b))\n (add : ∀ a b, motive a → motive b → motive (a + b))\n (a : SymmetricAlgebra R M) : motive a := by\n rcases algHom_surjective _ _ a with ⟨a, rfl⟩\n induction a using TensorAlgebra.induction with\n | algebraMap r => rw [AlgHom.commutes]; exact algebraMap r\n | ι x => exact ι x\n | mul x y hx hy => rw [map_mul]; exact mul _ _ hx hy\n | add x y hx hy => rw [map_add]; exact add _ _ hx hy\n\nopen TensorAlgebra in\ninstance : CommSemiring (SymmetricAlgebra R M) where\n mul_comm a b := by\n change Commute a b\n induction b using SymmetricAlgebra.induction with\n | algebraMap r => exact Algebra.commute_algebraMap_right _ _\n | ι x => induction a using SymmetricAlgebra.induction with\n | algebraMap r => exact Algebra.commute_algebraMap_left _ _\n | ι y => simp [commute_iff_eq, ι, ← map_mul, RingQuot.mkAlgHom_rel _ (SymRel.mul_comm x y)]\n | mul a b ha hb => exact ha.mul_left hb\n | add a b ha hb => exact ha.add_left hb\n | mul b c hb hc => exact hb.mul_right hc\n | add b c hb hc => exact hb.add_right hc\n\ninstance (R M) [CommRing R] [AddCommMonoid M] [Module R M] : CommRing (SymmetricAlgebra R M) where\n __ := (inferInstance : CommSemiring (SymmetricAlgebra R M))\n __ := (inferInstance : Ring (RingQuot (SymRel R M)))\n\nvariable {R M} {A : Type*} [CommSemiring A] [Algebra R A]\n\n/-- For any linear map `f : M →ₗ[R] A`, `SymmetricAlgebra.lift f` lifts the linear map to an\nR-algebra homomorphism from `SymmetricAlgebra R M` to `A`. -/\ndef lift : (M →ₗ[R] A) ≃ (SymmetricAlgebra R M →ₐ[R] A) := by\n let equiv : (TensorAlgebra R M →ₐ[R] A) ≃\n {f : TensorAlgebra R M →ₐ[R] A // ∀ {x y}, (TensorAlgebra.SymRel R M) x y → f x = f y} := by\n refine (Equiv.subtypeUnivEquiv fun h _ _ h' ↦ ?_).symm\n induction h' with | mul_comm x y => rw [map_mul, map_mul, mul_comm]\n exact (TensorAlgebra.lift R).trans <| equiv.trans <| RingQuot.liftAlgHom R\n\nvariable (f : M →ₗ[R] A)\n\n@[simp]\nlemma lift_ι_apply (a : M) : lift f (ι R M a) = f a := by\n simp [lift, ι, algHom]\n\n@[simp]\nlemma lift_comp_ι : lift f ∘ₗ ι R M = f := LinearMap.ext <| lift_ι_apply f\n\n@[ext 1100]\ntheorem algHom_ext {F G : SymmetricAlgebra R M →ₐ[R] A}\n (h : F ∘ₗ ι R M = (G ∘ₗ ι R M : M →ₗ[R] A)) : F = G := by\n ext x\n exact congr($h x)\n\n@[simp]\nlemma lift_ι : lift (ι R M) = .id R (SymmetricAlgebra R M) := by\n apply algHom_ext\n rw [lift_comp_ι]\n ext\n simp\n\n/-- The left-inverse of `algebraMap`. -/\ndef algebraMapInv : SymmetricAlgebra R M →ₐ[R] R :=\n lift (0 : M →ₗ[R] R)\n\ntheorem algebraMapInv_ι (x : M) : algebraMapInv (ι R M x) = 0 := lift_ι_apply 0 x\n\nvariable (M)\n\ntheorem algebraMap_leftInverse :\n Function.LeftInverse algebraMapInv (algebraMap R <| SymmetricAlgebra R M) := fun x => by\n simp [algebraMapInv]\n\n@[simp]\ntheorem algebraMap_inj (x y : R) :\n algebraMap R (SymmetricAlgebra R M) x = algebraMap R (SymmetricAlgebra R M) y ↔ x = y :=\n (algebraMap_leftInverse M).injective.eq_iff\n\n@[simp]\ntheorem algebraMap_eq_zero_iff (x : R) : algebraMap R (SymmetricAlgebra R M) x = 0 ↔ x = 0 :=\n map_eq_zero_iff (algebraMap _ _) (algebraMap_leftInverse _).injective\n\n@[simp]\ntheorem algebraMap_eq_one_iff (x : R) : algebraMap R (SymmetricAlgebra R M) x = 1 ↔ x = 1 :=\n map_eq_one_iff (algebraMap _ _) (algebraMap_leftInverse _).injective\n\n/-- A `SymmetricAlgebra` over a nontrivial semiring is nontrivial. -/\ninstance [Nontrivial R] : Nontrivial (SymmetricAlgebra R M) :=\n (algebraMap_leftInverse M).injective.nontrivial\n\nend SymmetricAlgebra\n\nvariable {A : Type*} [CommSemiring A] [Algebra R A] (f : M →ₗ[R] A)\nvariable {R} {M}\n\n/-- Given a morphism `f : M →ₗ[R] A`, `IsSymmetricAlgebra f` is a proposition saying that the\nalgebra homomorphism from `SymmetricAlgebra R M` to `A` is bijective. -/\ndef IsSymmetricAlgebra (f : M →ₗ[R] A) : Prop :=\n Function.Bijective (SymmetricAlgebra.lift f)\n\nTarget:\ntheorem SymmetricAlgebra.isSymmetricAlgebra_ι : IsSymmetricAlgebra (ι R M) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_53e0ba607316","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"3dfea2bdc452be9309fe900e649ff5017b9924a1c2b7cf8477bafaffa3b81e8e","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/SymmetricAlgebra","family_id":"symmetricalgebra","file_id":"mathlib/Mathlib/LinearAlgebra/SymmetricAlgebra/Basic.lean","sample_id":"53e0ba607316ade5e9bd1d0ce5d67c6f506005e9671a13d827f6883bfdc1d4a0"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c120e07c261cd67269cea538f4c7ccb1bc3a2527d99f089de93bbe04845d9af0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"a05a02cd0b16353d4b89547359ec7506bfa58b1f92c78c3263db5eab3201f7ff","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"fd45dddb8988ba3b9116f4f7b98fb641ee4cd9d3cf5b927e3a4de51bd4ee0673","source_sha256":"23a89f22442052ad0849b9a7e975a80ac54445633e48bc3ba85a63e141112a3b","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n constructor\n · intro h x\n have := (forget C X ⋙ stalkFunctor C x).exact_tfae.out 2 1\n exact this.mp inferInstance S h\n intro h\n simp_rw [ShortComplex.exact_iff_isZero_homology] at h\n rw [ShortComplex.exact_iff_isZero_homology, isZero_iff_stalkFunctor_obj_isZero S.homology]\n exact fun x => (h x).of_iso\n (ShortComplex.mapHomologyIso S (forget C X ⋙ stalkFunctor C x)).symm","hard_negative":true,"metrics":{"chosen_tokens":78,"rejected_tokens":2,"token_jaccard":0.02439,"token_length_ratio":0.025641},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"1da8f513d1d093dd7804a90ae0bff2aa5571fbe6b6dd56f6d39f8f25083c4e64","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Category.Grp.AB\npublic import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Sheaf\npublic import Mathlib.CategoryTheory.Functor.ReflectsIso.Balanced\npublic import Mathlib.Topology.Sheaves.Limits\npublic import Mathlib.Topology.Sheaves.Skyscraper\n\nNamespace:\nTopCat.Sheaf\n\nLocal context:\n/-\nCopyright (c) 2026 Brian Nugent. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Brian Nugent\n-/\n/-!\n# Sheaves over Abelian categories\nWe provide instances for categories of sheaves over Abelian categories.\n\n## Main Results\n\n* `TopCat.Sheaf.exact_iff_stalkFunctor_map_exact`: A complex of sheaves over a concrete abelian\n category is exact if and only if it is exact on stalks.\n\n-/\n\npublic section\n\nuniverse u v v₁ v₂\n\nopen TopologicalSpace CategoryTheory Limits\n\nnamespace TopCat\n\nvariable {X : TopCat.{u}}\n\nsection\n\nvariable {C : Type v₁} [Category.{v₂} C] [HasSheafify (Opens.grothendieckTopology X) C] [Abelian C]\n\nnoncomputable instance : Abelian (Presheaf C X) := inferInstanceAs (Abelian (_ ⥤ _))\n\nnamespace Sheaf\n\nnoncomputable instance : Abelian (Sheaf C X) :=\n inferInstanceAs (Abelian (CategoryTheory.Sheaf _ _))\n\ninstance : (Sheaf.forget C X).Additive where\n\ninstance {D : Type*} [Category.{u} D] [Abelian D] [IsGrothendieckAbelian.{u} D]\n [HasSheafify (Opens.grothendieckTopology X) D] : IsGrothendieckAbelian.{u} (Sheaf D X) :=\n inferInstanceAs (IsGrothendieckAbelian (CategoryTheory.Sheaf _ _))\n\nend Sheaf\n\nend\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The stalk functor is additive -/\ninstance (p₀ : X) {C : Type v} [Category.{u} C] [Abelian C] [HasColimits C] :\n (Presheaf.stalkFunctor C p₀).Additive := by\n dsimp [Presheaf.stalkFunctor]\n have : ((Functor.whiskeringLeft _ _ C).obj (OpenNhds.inclusion p₀).op).Additive := ⟨by cat_disch⟩\n infer_instance\n\nnamespace Sheaf\n\nopen Presheaf\n\nvariable {C : Type v} [Category.{u} C] [HasColimits C] [HasLimits C]\n {FC : C → C → Type*} {CC : C → Type u} [∀ X Y, FunLike (FC X Y) (CC X) (CC Y)]\n [instCC : ConcreteCategory C FC] [PreservesFilteredColimits (CategoryTheory.forget C)]\n [PreservesLimits (CategoryTheory.forget C)] [Abelian C]\n {X : TopCat.{u}} (p₀ : X)\n\ninstance : Limits.PreservesFiniteLimits (forget C X ⋙ stalkFunctor C p₀) :=\n have : (forget C X ⋙ stalkFunctor C p₀).PreservesHomology := by\n simp only [(forget C X ⋙ stalkFunctor C p₀).exact_tfae.out 2 0]\n intro S h\n have := ((forget C X ⋙ stalkFunctor C p₀).preservesFiniteColimits_tfae.out 3 0).mp\n (inferInstance : (PreservesFiniteColimits _))\n refine ShortComplex.ShortExact.mk' (this S h).left ?_ (this S h).right\n have := h.2\n exact Functor.map_mono (forget C X ⋙ stalkFunctor C p₀) _\n (forget C X ⋙ stalkFunctor C p₀).preservesFiniteLimits_of_preservesHomology\n\nopen ZeroObject\n\ninclude instCC in\n/-- A sheaf is zero if and only if its stalks are all zero. -/\nlemma isZero_iff_stalkFunctor_obj_isZero (F : Sheaf C X) :\n IsZero F ↔ ∀ x : X, IsZero ((forget C X ⋙ stalkFunctor C x).obj F) := by\n refine ⟨fun h _ => Functor.map_isZero _ h, ?_⟩\n intro h\n let f : F ⟶ 0 := (isZero_zero (Sheaf C X)).from_ F\n have : IsIso f := by\n rw [Presheaf.isIso_iff_stalkFunctor_map_iso]\n exact fun x => isIso_of_source_target_iso_zero _ (h x).isoZero\n ((forget C X ⋙ stalkFunctor C x).map_isZero (isZero_zero _)).isoZero\n exact (isZero_zero _).of_iso (asIso f)\n\ninclude instCC in\n/-- Exactness can be checked on stalks for complexes of sheaves. -/\n\nTarget:\ntheorem exact_iff_stalkFunctor_map_exact (S : ShortComplex (Sheaf C X)) :\n S.Exact ↔ ∀ x : X, (S.map (forget C X ⋙ stalkFunctor C x)).Exact :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_fd45dddb8988","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"560114b154a5afbb1aa6f3956f114d9520ebb78223fd973cd89736548146964c","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Sheaves","family_id":"exact_iff_stalkfunctor_map_exact","file_id":"mathlib/Mathlib/Topology/Sheaves/Abelian.lean","sample_id":"fd45dddb8988ba3b9116f4f7b98fb641ee4cd9d3cf5b927e3a4de51bd4ee0673"},"split":"validation"} {"binding":{"chosen_proof_sha256":"ae90afea975d466a86f226f9c1d1cbf95f542b52a7a48dcd083f95788078e8f8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"537b839d4d179ae06b973d3c6beadf96c30eedcd31679faa1560869a67c1fd11","source_sha256":"642b30fa88305a90316a98480946140fe1b161fdab4cf2ed2c8aff299abae1bf","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by grind [cases Bool]","hard_negative":false,"metrics":{"chosen_tokens":6,"rejected_tokens":2,"token_jaccard":0.142857,"token_length_ratio":0.333333},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"1dddb512801841bec594a509cdd185cbe50f49ed320d34d5e8a4f4a3225ac754","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Set.Insert\n\nNamespace:\nBool\n\nLocal context:\n/-\nCopyright (c) 2021 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Booleans and set operations\n\nThis file contains three trivial lemmas about `Bool`, `Set.univ`, and `Set.range`.\n-/\n\npublic section\n\n\nopen Set\n\nnamespace Bool\n\n@[simp]\ntheorem univ_eq : (univ : Set Bool) = {false, true} := by grind\n\n@[simp, grind =]\n\nTarget:\ntheorem range_eq {α : Type*} (f : Bool → α) : range f = {f false, f true} :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Bool","family_id":"range_eq","file_id":"mathlib/Mathlib/Data/Bool/Set.lean","sample_id":"537b839d4d179ae06b973d3c6beadf96c30eedcd31679faa1560869a67c1fd11"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3569f9995c2f461be224720681d9bacc336a2e6c2c89a7c63108e6bccdf4c0b9","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9457652ae60a0aed492e9cb4571651b96bad9a342fb8d6b0f1750cb67eff985f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"07c876892178670acdeeaab7ec0d3ad63e5a2e38d1a63ac2e7af11a1da270537","source_sha256":"f490af4c1079c734f5d4f0c49ae6b1779c2dfde5bdc100f11e3ed4a71ecf708a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [h.1]","hard_negative":false,"metrics":{"chosen_tokens":7,"rejected_tokens":11,"token_jaccard":0.7,"token_length_ratio":1.571429},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"1e3810c151edf3ea9323650914cdc294536df0cd460cf145c66f1fe42149a008","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Order.Ring.Nat\npublic import Mathlib.Data.Nat.Dist\npublic import Mathlib.Data.Ordmap.Ordnode\npublic import Mathlib.Tactic.Abel\n\nNamespace:\nOrdnode\n\nLocal context:\n/-\nCopyright (c) 2017 Mario Carneiro. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Mario Carneiro\n-/\n/-!\n# Invariants for the verification of `Ordnode`\n\nAn `Ordnode`, defined in `Mathlib/Data/Ordmap/Ordnode.lean`, is an inductive type which describes a\ntree which stores the `size` at internal nodes.\n\nIn this file we define the correctness invariant of an `Ordnode`, comprising:\n\n* `Ordnode.Sized t`: All internal `size` fields must match the actual measured\n size of the tree. (This is not hard to satisfy.)\n* `Ordnode.Balanced t`: Unless the tree has the form `()` or `((a) b)` or `(a (b))`\n (that is, nil or a single singleton subtree), the two subtrees must satisfy\n `size l ≤ δ * size r` and `size r ≤ δ * size l`, where `δ := 3` is a global\n parameter of the data structure (and this property must hold recursively at subtrees).\n This is why we say this is a \"size balanced tree\" data structure.\n* `Ordnode.Bounded lo hi t`: The members of the tree must be in strictly increasing order,\n meaning that if `a` is in the left subtree and `b` is the root, then `a ≤ b` and\n `¬(b ≤ a)`. We enforce this using `Ordnode.Bounded` which includes also a global\n upper and lower bound.\n\nThis whole file is in the `Ordnode` namespace, because we first have to prove the correctness of\nall the operations (and defining what correctness means here is somewhat subtle).\nThe actual `Ordset` operations are in `Mathlib/Data/Ordmap/Ordset.lean`.\n\n## TODO\n\nThis file is incomplete, in the sense that the intent is to have verified\nversions and lemmas about all the definitions in `Ordnode.lean`, but at the moment only\na few operations are verified (the hard part should be out of the way, but still).\nContributors are encouraged to pick this up and finish the job, if it appeals to you.\n\n## Tags\n\nordered map, ordered set, data structure, verified programming\n-/\n\n@[expose] public section\n\n\nvariable {α : Type*}\n\nnamespace Ordnode\n\n/-! ### delta and ratio -/\n\n\ntheorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 :=\n not_le_of_gt H\n\ntheorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False :=\n not_le_of_gt (lt_trans (mul_lt_mul_of_pos_left h₁ <| by decide) h₂) <| by\n simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta)\n\n/-! ### `singleton` -/\n\n\n/-! ### `size` and `empty` -/\n\n\n/-- O(n). Computes the actual number of elements in the set, ignoring the cached `size` field. -/\ndef realSize : Ordnode α → ℕ\n | nil => 0\n | node _ l _ r => realSize l + realSize r + 1\n\n/-! ### `Sized` -/\n\n\n/-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the\nrespective subtrees. -/\ndef Sized : Ordnode α → Prop\n | nil => True\n | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r\n\ntheorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) :=\n ⟨rfl, hl, hr⟩\n\nTarget:\ntheorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n rw [h.1]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Ordmap","family_id":"sized","file_id":"mathlib/Mathlib/Data/Ordmap/Invariants.lean","sample_id":"07c876892178670acdeeaab7ec0d3ad63e5a2e38d1a63ac2e7af11a1da270537"},"split":"validation"} {"binding":{"chosen_proof_sha256":"2628a130253968a8a686af97d98eddb2b162e209ea731c0dcd4d454971dcc9b6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8d343aa127f197e818f22279e907f55b3532ba43d07e558d0fa74795d9b604ed","source_sha256":"09dd13e02db05fd527f00c9f33b3add6a1ffc3bbffe4376f55a8c13248c9fdd4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by intro; rfl) :\n ContinuousEvalConst F' α X where\n continuous_eval_const x := by simpa only [← hf] using! (continuous_eval_const x).comp hc","hard_negative":false,"metrics":{"chosen_tokens":30,"rejected_tokens":2,"token_jaccard":0.037037,"token_length_ratio":0.066667},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"1e4511cfb698b3d115af1a30308a1bfb19df50034327ae03fe18146d95912fda","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Constructions\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Bundled morphisms with continuous evaluation at a point\n\nIn this file we define a typeclass\nsaying that `F` is a type of bundled morphisms (in the sense of `DFunLike`)\nwith a topology on `F` such that evaluation at a point is continuous in `f : F`.\n\n## Implementation Notes\n\nFor now, we define the typeclass for non-dependent bundled functions only.\nWhenever we add a type of bundled dependent functions with a topology having this property,\nwe may decide to generalize from `FunLike` to `DFunLike`.\n-/\n\npublic section\n\nopen scoped Topology\nopen Filter\n\n/-- A typeclass saying that `F` is a type of bundled morphisms (in the sense of `DFunLike`)\nwith a topology on `F` such that evaluation at a point is continuous in `f : F`. -/\nclass ContinuousEvalConst (F : Type*) (α X : outParam Type*) [FunLike F α X]\n [TopologicalSpace F] [TopologicalSpace X] : Prop where\n continuous_eval_const (x : α) : Continuous fun f : F ↦ f x\n\nexport ContinuousEvalConst (continuous_eval_const)\n\nsection ContinuousEvalConst\n\nvariable {F α X Z : Type*} [FunLike F α X] [TopologicalSpace F] [TopologicalSpace X]\n [ContinuousEvalConst F α X] [TopologicalSpace Z] {f : Z → F} {s : Set Z} {z : Z}\n\n/-- If a type `F'` of bundled morphisms admits a continuous projection\nto a type satisfying `ContinuousEvalConst`,\nthen `F'` satisfies this predicate too.\n\nThe word \"forget\" in the name is motivated by the term \"forgetful functor\". -/\n\nTarget:\ntheorem ContinuousEvalConst.of_continuous_forget {F' : Type*} [FunLike F' α X] [TopologicalSpace F']\n {f : F' → F} (hc : Continuous f) (hf : ∀ g, ⇑(f g) = g :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Hom","family_id":"continuousevalconst","file_id":"mathlib/Mathlib/Topology/Hom/ContinuousEvalConst.lean","sample_id":"8d343aa127f197e818f22279e907f55b3532ba43d07e558d0fa74795d9b604ed"},"split":"validation"} {"binding":{"chosen_proof_sha256":"26d182abc6389dc84737bf95d2c21225b0cb78d6127fc29126a79ec54ffdff6d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"17ab99d88f3159acc51fcb88c8e22eb4d3de8ba70b49195f93bcc423dd341c5f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"1699f9d464a20fd86e8564bc21d776b528e7683831049e1312c46a1ab479c935","source_sha256":"086cc329dd922787bf3d118bbc69bcad4d5fdd250cd32d7601cc5afc35a9bebe","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n algebraize [f.toRingHom]\n refine lt_of_le_of_ne (Ideal.map_le_iff_le_comap.mpr ?_) fun e ↦ ?_\n · rw [Ideal.comap_comap, ← algebraMap_eq, f.comp_algebraMap]\n let := Localization.AtPrime.algebraOfLiesOver (P.under R) (P.under R[X])\n let := Localization.AtPrime.algebraOfLiesOver (P.under R[X]) P\n let := Localization.AtPrime.algebraOfLiesOver (P.under R) P\n have : Module.Finite (Ideal.under R P).ResidueField P.ResidueField :=\n Algebra.WeaklyQuasiFiniteAt.finite_residueField ..\n have : Module.Finite (P.under R).ResidueField (P.under R[X]).ResidueField :=\n .of_injective (IsScalarTower.toAlgHom _ _ P.ResidueField).toLinearMap\n (algebraMap (P.under R[X]).ResidueField P.ResidueField).injective\n have : Module.Finite (P.under R).ResidueField (RatFunc (P.under R).ResidueField) :=\n .of_surjective (residueFieldMapCAlgEquiv _ (P.under _) e.symm).toLinearMap\n (residueFieldMapCAlgEquiv _ (P.under _) e.symm).surjective\n exact RatFunc.transcendental_X (K := (P.under R).ResidueField)\n (Algebra.IsIntegral.isIntegral _).isAlgebraic","hard_negative":false,"metrics":{"chosen_tokens":256,"rejected_tokens":263,"token_jaccard":0.967742,"token_length_ratio":1.027344},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"1f1da332304a1d40519b5c715f92e6eeca1ffd1610e84d5c62cb382fdc2d10f4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.LocalRing.ResidueField.Polynomial\npublic import Mathlib.RingTheory.QuasiFinite.Weakly\n\nNamespace:\nPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Andrew Yang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Andrew Yang\n-/\n/-! # Quasi-finite primes in polynomial algebras -/\n\n@[expose] public section\n\nvariable {R S T : Type*} [CommRing R] [CommRing S] [CommRing T]\n [Algebra R S] [Algebra R T] [Algebra S T] [IsScalarTower R S T]\n\nnamespace Polynomial\n\nattribute [local instance] Algebra.WeaklyQuasiFiniteAt.finite_locoalization in\nlemma not_weaklyQuasiFiniteAt (P : Ideal R[X]) [P.IsPrime] : ¬ Algebra.WeaklyQuasiFiniteAt R P := by\n intro H\n wlog hR : IsField R\n · let p := P.under R\n obtain ⟨Q, hQ⟩ := (PrimeSpectrum.preimageEquivFiber R R[X]\n ⟨p, inferInstance⟩).symm.surjective ⟨⟨P, ‹_›⟩, rfl⟩\n have inst : Algebra.WeaklyQuasiFiniteAt p.ResidueField Q.asIdeal :=\n .baseChange P Q.asIdeal congr($(hQ.symm).1.1)\n exact this (Q.asIdeal.comap (polyEquivTensor' R p.ResidueField).toRingHom)\n inferInstance (Field.toIsField _)\n let := hR.toField\n have := Module.Finite.of_injective\n (IsScalarTower.toAlgHom R R[X] (Localization.AtPrime P)).toLinearMap\n (IsLocalization.injective _ P.primeCompl_le_nonZeroDivisors)\n exact transcendental_X R (Algebra.IsIntegral.isIntegral X).isAlgebraic\n\n/-- `R[X]` is not quasi-finite over `R` at any prime. -/\nlemma not_quasiFiniteAt (P : Ideal R[X]) [P.IsPrime] : ¬ Algebra.QuasiFiniteAt R P :=\n fun _ ↦ not_weaklyQuasiFiniteAt P inferInstance\n\nTarget:\nlemma map_under_lt_comap_of_weaklyQuasiFiniteAt\n (f : R[X] →ₐ[R] S) (P : Ideal S) [P.IsPrime] [Algebra.WeaklyQuasiFiniteAt R P] :\n (P.under R).map C < P.comap (f : R[X] →+* S) :=\n\nProof body:\n","rejected":"```lean\nby\n algebraize [f.toRingHom]\n refine lt_of_le_of_ne (Ideal.map_le_iff_le_comap.mpr ?_) fun e ↦ ?_\n · rw [Ideal.comap_comap, ← algebraMap_eq, f.comp_algebraMap]\n let := Localization.AtPrime.algebraOfLiesOver (P.under R) (P.under R[X])\n let := Localization.AtPrime.algebraOfLiesOver (P.under R[X]) P\n let := Localization.AtPrime.algebraOfLiesOver (P.under R) P\n have : Module.Finite (Ideal.under R P).ResidueField P.ResidueField :=\n Algebra.WeaklyQuasiFiniteAt.finite_residueField ..\n have : Module.Finite (P.under R).ResidueField (P.under R[X]).ResidueField :=\n .of_injective (IsScalarTower.toAlgHom _ _ P.ResidueField).toLinearMap\n (algebraMap (P.under R[X]).ResidueField P.ResidueField).injective\n have : Module.Finite (P.under R).ResidueField (RatFunc (P.under R).ResidueField) :=\n .of_surjective (residueFieldMapCAlgEquiv _ (P.under _) e.symm).toLinearMap\n (residueFieldMapCAlgEquiv _ (P.under _) e.symm).surjective\n exact RatFunc.transcendental_X (K := (P.under R).ResidueField)\n (Algebra.IsIntegral.isIntegral _).isAlgebraic\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/QuasiFinite","family_id":"map_under_lt_comap_of_weaklyquasifiniteat","file_id":"mathlib/Mathlib/RingTheory/QuasiFinite/Polynomial.lean","sample_id":"1699f9d464a20fd86e8564bc21d776b528e7683831049e1312c46a1ab479c935"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1a230b9602a6125d0fa7430a4612f1c8aad565aed5808bbe2d3a11ec566dd25a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"083cef0ea1ae16c500c533e862fb73584a69be052421720e75cafcd104766478","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"00a02bddf3a5d934532b0f2822ba59542bf0ae28af1479b5acc90c557fd9c040","source_sha256":"426555287cadea427db46f434f2427413a3069f543392fbabfda474ad97429a1","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by ext; simp [h.symm]","hard_negative":false,"metrics":{"chosen_tokens":9,"rejected_tokens":14,"token_jaccard":0.642857,"token_length_ratio":1.555556},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"1f291e67c6a6bf66421a3485eac4d7fb1974e6226d4a617c905ee04c8a79254a","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.Equiv.Defs\npublic import Mathlib.Algebra.Module.LinearMap.End\npublic import Mathlib.Algebra.Module.Pi\npublic import Mathlib.Data.Finsupp.SMul\n\nNamespace:\nFinsupp\n\nLocal context:\n/-\nCopyright (c) 2019 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl\n-/\n/-!\n# Properties of the module `α →₀ M`\n\nGiven an `R`-module `M`, the `R`-module structure on `α →₀ M` is defined in\n`Mathlib/Data/Finsupp/SMul.lean`.\n\nIn this file we define `LinearMap` versions of various maps:\n\n* `Finsupp.lsingle a : M →ₗ[R] ι →₀ M`: `Finsupp.single a` as a linear map;\n* `Finsupp.lapply a : (ι →₀ M) →ₗ[R] M`: the map `fun f ↦ f a` as a linear map;\n* `Finsupp.lsubtypeDomain (s : Set α) : (α →₀ M) →ₗ[R] (s →₀ M)`: restriction to a subtype as a\n linear map;\n* `Finsupp.restrictDom`: `Finsupp.filter` as a linear map to `Finsupp.supported s`;\n* `Finsupp.lmapDomain`: a linear map version of `Finsupp.mapDomain`;\n\n## Tags\n\nfunction with finite support, module, linear algebra\n-/\n\n@[expose] public section\n\nassert_not_exists Submodule\n\nnoncomputable section\n\nopen Set LinearMap\n\nnamespace Finsupp\n\nvariable {α : Type*} {M : Type*} {N : Type*} {P : Type*} {R R₂ R₃ : Type*} {S : Type*}\nvariable [Semiring R] [Semiring R₂] [Semiring R₃] [Semiring S]\nvariable [AddCommMonoid M] [Module R M]\nvariable [AddCommMonoid N] [Module R₂ N]\nvariable [AddCommMonoid P] [Module R₃ P]\nvariable {σ₁₂ : R →+* R₂} {σ₂₁ : R₂ →+* R}\nvariable {σ₂₃ : R₂ →+* R₃} {σ₃₂ : R₃ →+* R₂}\nvariable {σ₁₃ : R →+* R₃} {σ₃₁ : R₃ →+* R}\nvariable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [RingHomCompTriple σ₃₂ σ₂₁ σ₃₁]\n\nsection LinearEquivFunOnFinite\n\nvariable (R : Type*) {S : Type*} (M : Type*) (α : Type*)\nvariable [Finite α] [AddCommMonoid M] [Semiring R] [Module R M]\n\n/-- Given `Finite α`, `linearEquivFunOnFinite R` is the natural `R`-linear equivalence between\n`α →₀ β` and `α → β`. -/\n@[simps apply]\nnoncomputable def linearEquivFunOnFinite : (α →₀ M) ≃ₗ[R] α → M :=\n { equivFunOnFinite with\n toFun := (⇑)\n map_add' := fun _ _ => rfl\n map_smul' := fun _ _ => rfl }\n\n@[simp]\ntheorem linearEquivFunOnFinite_single [DecidableEq α] (x : α) (m : M) :\n (linearEquivFunOnFinite R M α) (single x m) = Pi.single x m :=\n equivFunOnFinite_single x m\n\n@[simp]\ntheorem linearEquivFunOnFinite_symm_single [DecidableEq α] (x : α) (m : M) :\n (linearEquivFunOnFinite R M α).symm (Pi.single x m) = single x m :=\n equivFunOnFinite_symm_single x m\n\n@[simp]\ntheorem linearEquivFunOnFinite_symm_coe (f : α →₀ M) : (linearEquivFunOnFinite R M α).symm f = f :=\n (linearEquivFunOnFinite R M α).symm_apply_apply f\n\n@[simp]\ntheorem linearEquivFunOnFinite_symm_apply (f : α → M) : (linearEquivFunOnFinite R M α).symm f = f :=\n rfl\n\nend LinearEquivFunOnFinite\n\n/-- Interpret `Finsupp.single a` as a linear map. -/\ndef lsingle (a : α) : M →ₗ[R] α →₀ M :=\n { Finsupp.singleAddHom a with map_smul' := fun _ _ => (smul_single _ _ _).symm }\n\n/-- Two `R`-linear maps from `Finsupp X M` which agree on each `single x y` agree everywhere. -/\ntheorem lhom_ext ⦃φ ψ : (α →₀ M) →ₛₗ[σ₁₂] N⦄ (h : ∀ a b, φ (single a b) = ψ (single a b)) : φ = ψ :=\n LinearMap.toAddMonoidHom_injective <| addHom_ext h\n\n/-- Two `R`-linear maps from `Finsupp X M` which agree on each `single x y` agree everywhere.\n\nWe formulate this fact using equality of linear maps `φ.comp (lsingle a)` and `ψ.comp (lsingle a)`\nso that the `ext` tactic can apply a type-specific extensionality lemma to prove equality of these\nmaps. E.g., if `M = R`, then it suffices to verify `φ (single a 1) = ψ (single a 1)`. -/\n-- The priority should be higher than `LinearMap.ext`.\n@[ext high]\ntheorem lhom_ext' ⦃φ ψ : (α →₀ M) →ₛₗ[σ₁₂] N⦄ (h : ∀ a, φ.comp (lsingle a) = ψ.comp (lsingle a)) :\n φ = ψ :=\n lhom_ext fun a => LinearMap.congr_fun (h a)\n\n/-- Interpret `fun f : α →₀ M ↦ f a` as a linear map. -/\ndef lapply (a : α) : (α →₀ M) →ₗ[R] M :=\n { Finsupp.applyAddHom a with map_smul' := fun _ _ => rfl }\n\ninstance [Nonempty α] [FaithfulSMul R M] : FaithfulSMul R (α →₀ M) :=\n .of_injective (Finsupp.lsingle <| Classical.arbitrary _) (Finsupp.single_injective _)\n\nsection LSubtypeDomain\n\nvariable (s : Set α)\n\n/-- Interpret `Finsupp.subtypeDomain s` as a linear map. -/\ndef lsubtypeDomain : (α →₀ M) →ₗ[R] s →₀ M where\n toFun := subtypeDomain fun x => x ∈ s\n map_add' _ _ := subtypeDomain_add\n map_smul' _ _ := ext fun _ => rfl\n\ntheorem lsubtypeDomain_apply (f : α →₀ M) :\n (lsubtypeDomain s : (α →₀ M) →ₗ[R] s →₀ M) f = subtypeDomain (fun x => x ∈ s) f :=\n rfl\n\nend LSubtypeDomain\n\n@[simp]\ntheorem lsingle_apply (a : α) (b : M) : (lsingle a : M →ₗ[R] α →₀ M) b = single a b :=\n rfl\n\n@[simp]\ntheorem lapply_apply (a : α) (f : α →₀ M) : (lapply a : (α →₀ M) →ₗ[R] M) f = f a :=\n rfl\n\n@[simp]\ntheorem lapply_comp_lsingle_same (a : α) : lapply a ∘ₗ lsingle a = (.id : M →ₗ[R] M) := by ext; simp\n\n@[simp]\n\nTarget:\ntheorem lapply_comp_lsingle_of_ne (a a' : α) (h : a ≠ a') :\n lapply a ∘ₗ lsingle a' = (0 : M →ₗ[R] M) :=\n\nProof body:\n","rejected":"Here is the proof:\nby ext; simp [h.symm]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Finsupp","family_id":"lapply_comp_lsingle_of_ne","file_id":"mathlib/Mathlib/LinearAlgebra/Finsupp/Defs.lean","sample_id":"00a02bddf3a5d934532b0f2822ba59542bf0ae28af1479b5acc90c557fd9c040"},"split":"validation"} {"binding":{"chosen_proof_sha256":"35fb3e5225b5ae3bcc5f024a70671c5bc50fd8637e443747459aa51529cbdfba","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e2e78cf6c6c3b426821ebe7410a77ffc7a51f224dfaba93fb803df83ee8ffba4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"73672596677ce937c3dfceeee8632043e3afb7312baf0799c4172ab87d016c2b","source_sha256":"15f4267aebdd955e889db0e8eeeb1b1b795e84a4db28bdd55809c3f802e3c9e1","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa only [hom_ext_iff, comp_f] using P.idem","hard_negative":true,"metrics":{"chosen_tokens":12,"rejected_tokens":2,"token_jaccard":0.076923,"token_length_ratio":0.166667},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"1fb0a5b33a2db994d43e7dfc64d13a124630fbf9106af01876d1cdd01fa37f9b","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Idempotents.Karoubi\n\nNamespace:\nCategoryTheory.Idempotents.KaroubiKaroubi\n\nLocal context:\n/-\nCopyright (c) 2022 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n/-!\n# Idempotence of the Karoubi envelope\n\nIn this file, we construct the equivalence of categories\n`KaroubiKaroubi.equivalence C : Karoubi C ≌ Karoubi (Karoubi C)` for any category `C`.\n\n-/\n\n@[expose] public section\n\n\nopen CategoryTheory.Category\n\nopen CategoryTheory.Idempotents.Karoubi\n\nnamespace CategoryTheory\n\nnamespace Idempotents\n\nnamespace KaroubiKaroubi\n\nvariable (C : Type*) [Category* C]\n\n@[reassoc (attr := simp)]\n\nTarget:\nlemma idem_f (P : Karoubi (Karoubi C)) : P.p.f ≫ P.p.f = P.p.f :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_73672596677c","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"e04f7f768cdf76edd82216a659777d79503ceec816b7bbc25a44088a33408935","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Idempotents","family_id":"idem_f","file_id":"mathlib/Mathlib/CategoryTheory/Idempotents/KaroubiKaroubi.lean","sample_id":"73672596677ce937c3dfceeee8632043e3afb7312baf0799c4172ab87d016c2b"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b8d1db559ed288931688616e45bd02cafe9b1c740aa4a316f84ac74fadc1c00b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"bc1f60dd366a987c00f122b8e085f862c7e2ab01ef0c446a8af5c59800adb447","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"5f5e11bafd29c1492084efefb2f57eace02f504e0597ae9279dc244be57bcca1","source_sha256":"7b41359792b40f76bcf80d23a2f7b1f052f8b7ecd79ed0b1b094081cc7b863dd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n subst_hom_lift p f' φ'; clear a b R S\n have : p.IsHomLift (g ≫ f) φ' := (hf' ▸ inferInstance)\n apply IsStronglyCartesian.universal_property' f","hard_negative":true,"metrics":{"chosen_tokens":35,"rejected_tokens":3,"token_jaccard":0.033333,"token_length_ratio":0.085714},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"2026311c1abcb238d036afafa81b2661c15f50a296b79b842feea30df9c50b4c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.FiberedCategory.HomLift\n\nNamespace:\nCategoryTheory.Functor.IsStronglyCartesian\n\nLocal context:\n/-\nCopyright (c) 2024 Calle Sönne. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Paul Lezeau, Calle Sönne\n-/\n/-!\n# Cartesian morphisms\n\nThis file defines Cartesian resp. strongly Cartesian morphisms with respect to a functor\n`p : 𝒳 ⥤ 𝒮`.\n\nThis file has been adapted to `Mathlib/CategoryTheory/FiberedCategory/Cocartesian.lean`,\nplease try to change them in sync.\n\n## Main definitions\n\n`IsCartesian p f φ` expresses that `φ` is a Cartesian morphism lying over `f` with respect to `p` in\nthe sense of SGA 1 VI 5.1. This means that for any morphism `φ' : a' ⟶ b` lying over `f` there is\na unique morphism `τ : a' ⟶ a` lying over `𝟙 R`, such that `φ' = τ ≫ φ`.\n\n`IsStronglyCartesian p f φ` expresses that `φ` is a strongly Cartesian morphism lying over `f` with\nrespect to `p`, see .\n\n## Implementation\n\nThe constructor of `IsStronglyCartesian` has been named `universal_property'`, and is mainly\nintended to be used for constructing instances of this class. To use the universal property, we\ngenerally recommended to use the lemma `IsStronglyCartesian.universal_property` instead. The\ndifference between the two is that the latter is more flexible with respect to non-definitional\nequalities.\n\n## References\n* [A. Grothendieck, M. Raynaud, *SGA 1*](https://arxiv.org/abs/math/0206203)\n* [Stacks: Fibred Categories](https://stacks.math.columbia.edu/tag/02XJ)\n-/\n\n@[expose] public section\n\nuniverse v₁ v₂ u₁ u₂\n\nopen CategoryTheory Functor Category IsHomLift\n\nnamespace CategoryTheory.Functor\n\nvariable {𝒮 : Type u₁} {𝒳 : Type u₂} [Category.{v₁} 𝒮] [Category.{v₂} 𝒳] (p : 𝒳 ⥤ 𝒮)\n\nsection\n\nvariable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b)\n\n/-- A morphism `φ : a ⟶ b` in `𝒳` lying over `f : R ⟶ S` in `𝒮` is Cartesian if for all\nmorphisms `φ' : a' ⟶ b`, also lying over `f`, there exists a unique morphism `χ : a' ⟶ a` lifting\n`𝟙 R` such that `φ' = χ ≫ φ`.\n\nSee SGA 1 VI 5.1. -/\nclass IsCartesian : Prop where\n [toIsHomLift : IsHomLift p f φ]\n universal_property {a' : 𝒳} (φ' : a' ⟶ b) [IsHomLift p f φ'] :\n ∃! χ : a' ⟶ a, IsHomLift p (𝟙 R) χ ∧ χ ≫ φ = φ'\nattribute [instance] IsCartesian.toIsHomLift\n\n/-- A morphism `φ : a ⟶ b` in `𝒳` lying over `f : R ⟶ S` in `𝒮` is strongly Cartesian if for\nall morphisms `φ' : a' ⟶ b` and all diagrams of the form\n```\na' a --φ--> b\n| | |\nv v v\nR' --g--> R --f--> S\n```\nsuch that `φ'` lifts `g ≫ f`, there exists a lift `χ` of `g` such that `φ' = χ ≫ φ`. -/\n@[stacks 02XK]\nclass IsStronglyCartesian : Prop where\n [toIsHomLift : IsHomLift p f φ]\n universal_property' {a' : 𝒳} (g : p.obj a' ⟶ R) (φ' : a' ⟶ b) [IsHomLift p (g ≫ f) φ'] :\n ∃! χ : a' ⟶ a, IsHomLift p g χ ∧ χ ≫ φ = φ'\nattribute [instance] IsStronglyCartesian.toIsHomLift\n\nend\n\nnamespace IsCartesian\n\nvariable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b) [IsCartesian p f φ]\n\nsection\n\nvariable {a' : 𝒳} (φ' : a' ⟶ b) [IsHomLift p f φ']\n\n/-- Given a Cartesian morphism `φ : a ⟶ b` lying over `f : R ⟶ S` in `𝒳`, and another morphism\n`φ' : a' ⟶ b` which also lifts `f`, then `IsCartesian.map f φ φ'` is the morphism `a' ⟶ a` lifting\n`𝟙 R` obtained from the universal property of `φ`. -/\nprotected noncomputable def map : a' ⟶ a :=\n Classical.choose <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ'\n\ninstance map_isHomLift : IsHomLift p (𝟙 R) (IsCartesian.map p f φ φ') :=\n (Classical.choose_spec <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ').1.1\n\n@[reassoc (attr := simp)]\nlemma fac : IsCartesian.map p f φ φ' ≫ φ = φ' :=\n (Classical.choose_spec <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ').1.2\n\n/-- Given a Cartesian morphism `φ : a ⟶ b` lying over `f : R ⟶ S` in `𝒳`, and another morphism\n`φ' : a' ⟶ b` which also lifts `f`. Then any morphism `ψ : a' ⟶ a` lifting `𝟙 R` such that\n`g ≫ ψ = φ'` must equal the map induced from the universal property of `φ`. -/\nlemma map_uniq (ψ : a' ⟶ a) [IsHomLift p (𝟙 R) ψ] (hψ : ψ ≫ φ = φ') :\n ψ = IsCartesian.map p f φ φ' :=\n (Classical.choose_spec <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ').2\n ψ ⟨inferInstance, hψ⟩\n\nend\n\n/-- Given a Cartesian morphism `φ : a ⟶ b` lying over `f : R ⟶ S` in `𝒳`, and two morphisms\n`ψ ψ' : a' ⟶ a` such that `ψ ≫ φ = ψ' ≫ φ`. Then we must have `ψ = ψ'`. -/\nprotected lemma ext (φ : a ⟶ b) [IsCartesian p f φ] {a' : 𝒳} (ψ ψ' : a' ⟶ a)\n [IsHomLift p (𝟙 R) ψ] [IsHomLift p (𝟙 R) ψ'] (h : ψ ≫ φ = ψ' ≫ φ) : ψ = ψ' := by\n rw [map_uniq p f φ (ψ ≫ φ) ψ rfl, map_uniq p f φ (ψ ≫ φ) ψ' h.symm]\n\n@[simp]\nlemma map_self : IsCartesian.map p f φ φ = 𝟙 a := by\n subst_hom_lift p f φ; symm\n apply map_uniq\n simp only [id_comp]\n\ninstance of_comp_iso {b' : 𝒳} (φ' : b ≅ b') [IsHomLift p (𝟙 S) φ'.hom] :\n IsCartesian p f (φ ≫ φ'.hom) where\n universal_property := by\n intro c ψ hψ\n use IsCartesian.map p f φ (ψ ≫ φ'.inv)\n refine ⟨⟨inferInstance, by simp only [fac_assoc, assoc, Iso.inv_hom_id, comp_id]⟩, ?_⟩\n rintro τ ⟨hτ₁, hτ₂⟩\n apply map_uniq\n rw [Iso.eq_comp_inv]\n simp only [assoc, hτ₂]\n\n/-- The canonical isomorphism between the domains of two Cartesian arrows\nlying over the same object. -/\n@[simps]\nnoncomputable def domainUniqueUpToIso {a' : 𝒳} (φ' : a' ⟶ b) [IsCartesian p f φ'] : a' ≅ a where\n hom := IsCartesian.map p f φ φ'\n inv := IsCartesian.map p f φ' φ\n hom_inv_id := by\n subst_hom_lift p f φ'\n apply IsCartesian.ext p (p.map φ') φ'\n simp only [assoc, fac, id_comp]\n inv_hom_id := by\n subst_hom_lift p f φ\n apply IsCartesian.ext p (p.map φ) φ\n simp only [assoc, fac, id_comp]\n\ninstance domainUniqueUpToIso_inv_isHomLift {a' : 𝒳} (φ' : a' ⟶ b) [IsCartesian p f φ'] :\n IsHomLift p (𝟙 R) (domainUniqueUpToIso p f φ φ').hom :=\n domainUniqueUpToIso_hom p f φ φ' ▸ IsCartesian.map_isHomLift p f φ φ'\n\ninstance domainUniqueUpToIso_hom_isHomLift {a' : 𝒳} (φ' : a' ⟶ b) [IsCartesian p f φ'] :\n IsHomLift p (𝟙 R) (domainUniqueUpToIso p f φ φ').inv :=\n domainUniqueUpToIso_inv p f φ φ' ▸ IsCartesian.map_isHomLift p f φ' φ\n\n/-- Precomposing a Cartesian morphism with an isomorphism lifting the identity is Cartesian. -/\ninstance of_iso_comp {a' : 𝒳} (φ' : a' ≅ a) [IsHomLift p (𝟙 R) φ'.hom] :\n IsCartesian p f (φ'.hom ≫ φ) where\n universal_property := by\n intro c ψ hψ\n use IsCartesian.map p f φ ψ ≫ φ'.inv\n refine ⟨⟨inferInstance, by simp⟩, ?_⟩\n rintro τ ⟨hτ₁, hτ₂⟩\n rw [Iso.eq_comp_inv]\n apply map_uniq\n simp only [assoc, hτ₂]\n\nend IsCartesian\n\nnamespace IsStronglyCartesian\n\nsection\n\nvariable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b) [IsStronglyCartesian p f φ]\n\n/-- The universal property of a strongly Cartesian morphism.\n\nThis lemma is more flexible with respect to non-definitional equalities than the field\n`universal_property'` of `IsStronglyCartesian`. -/\n\nTarget:\nlemma universal_property {R' : 𝒮} {a' : 𝒳} (g : R' ⟶ R) (f' : R' ⟶ S) (hf' : f' = g ≫ f)\n (φ' : a' ⟶ b) [IsHomLift p f' φ'] : ∃! χ : a' ⟶ a, IsHomLift p g χ ∧ χ ≫ φ = φ' :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_5f5e11bafd29","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"c612f9c79732297a7a5eeabcee8e0cfcf63e7357cccd2d88215fef948c1d18b6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/FiberedCategory","family_id":"universal_property","file_id":"mathlib/Mathlib/CategoryTheory/FiberedCategory/Cartesian.lean","sample_id":"5f5e11bafd29c1492084efefb2f57eace02f504e0597ae9279dc244be57bcca1"},"split":"validation"} {"binding":{"chosen_proof_sha256":"ba1c0657c4e5e36007d59095474142624479cfd95c5fb8093a43086d67daaefd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"56c6df649346558336fcdd97050caff0c104fb3b97bee43f36f79390439c9ff4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"03fe8452e8dda77fc756d2e905200f9aad50ed00b4f4dff36617d12d1800c918","source_sha256":"72a74d5e8415d17ef93928b2484d6fb73612e69b72912e573cba6662ce324b48","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n intro x hx\n obtain ⟨J, hJ⟩ := F.nonempty\n exact ⟨J, hJ, le_of_le_of_eq le_top (by simpa [eq_comm])⟩","hard_negative":true,"metrics":{"chosen_tokens":30,"rejected_tokens":5,"token_jaccard":0.12,"token_length_ratio":0.166667},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"23e5873bccab125bef64078bb383887d0d5278186f0346ed121f7c6e2253208a","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Order.PFilter\npublic import Mathlib.RingTheory.Ideal.Colon\n\nNamespace:\nIdealFilter\n\nLocal context:\n/-\nCopyright (c) 2025 Blake Farman. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Blake Farman\n-/\n/-!\n# Ideal Filters\n\nAn **ideal filter** is a filter in the lattice of ideals of a ring `A`.\n\n## Main definitions\n\n* `IdealFilter A`: the type of an ideal filter on a ring `A`.\n* `IsUniform F` : a filter `F` is uniform if whenever `I` is an ideal in the filter, then for all\n `a : A`, the colon ideal `I.colon {a}` is in `F`.\n* `IsTorsionElem` : Given a filter `F`, an element, `m`, of an `A`-module, `M`, is `F`-torsion if\n there exists an ideal `L` in `F` that annihilates `m`.\n* `IsTorsion` : Given a filter `F`, an `A`-module, `M`, is `F`-torsion if every element is torsion.\n* `gabrielComposition` : Given two filters `F` and `G`, the Gabriel composition of `F` and `G` is\n the set of ideals `L` of `A` such that there exists an ideal `K` in `G` with `K/L` `F`-torsion.\n This is again a filter.\n* `IsGabriel F` : a filter `F` is a Gabriel filter if it is uniform and satisfies axiom T4:\n for all `I : Ideal A`, if there exists `J ∈ F` such that for all `a ∈ J` the colon ideal\n `I.colon {a}` is in `F`, then `I ∈ F`.\n\n## Main statements\n\n* `isGabriel_iff`: a filter is Gabriel iff it is uniform and `F • F = F`.\n\n## Notation\n\n* `F • G`: the Gabriel composition of ideal filters `F` and `G`, defined by\n `gabrielComposition F G`.\n\n## Implementation notes\n\nIn the classical literature (e.g. Stenström), *right linear topologies* on a ring are often\ndescribed via filters of open **right** ideals, and the terminology is frequently abused by\nidentifying the topology with its filter of ideals.\n\nIn this development we work systematically with **left ideals**. Accordingly, Stenström’s\nright-ideal construction `(L : a) = {x ∈ A | a * x ∈ L}` is replaced by the left ideal\n`L.colon {a} = {a | x * a ∈ L}`.\n\nWith this convention, uniform filters correspond to linear (additive) topologies, while the\nadditional Gabriel condition (axiom T4) imposes an algebraic saturation property that does not\nchange the induced topology.\n\n## References\n\n* [Bo Stenström, *Rings and Modules of Quotients*][stenstrom1971]\n* [Bo Stenström, *Rings of Quotients*][stenstrom1975]\n* [nLab: Uniform filter](https://ncatlab.org/nlab/show/uniform+filter)\n* [nLab: Gabriel filter](https://ncatlab.org/nlab/show/Gabriel+filter)\n* [nLab: Gabriel composition](https://ncatlab.org/nlab/show/Gabriel+composition+of+filters)\n\n## Tags\n\nring theory, ideal, filter, uniform filter, Gabriel filter, torsion theory\n-/\n\n@[expose] public section\n\nopen scoped Pointwise\n\n/-- `IdealFilter A` is the type of `Order.PFilter`s on the lattice of ideals of `A`. -/\nabbrev IdealFilter (A : Type*) [Ring A] := Order.PFilter (Ideal A)\n\nnamespace IdealFilter\n\nvariable {A : Type*} [Ring A]\n\n/-- A filter of ideals is *uniform* if it is closed under colon by singletons. -/\nclass IsUniform (F : IdealFilter A) : Prop where\n /-- **Axiom T3.** See [stenstrom1975]. -/\n colon_mem {I : Ideal A} (hI : I ∈ F) (a : A) : I.colon {a} ∈ F\n\n/-- We say that an element `m : M` is `F`-torsion if it is annihilated by some ideal belonging to\nthe filter `F`. -/\ndef IsTorsionElem (F : IdealFilter A)\n {M : Type*} [AddCommMonoid M] [Module A M] (m : M) : Prop :=\n ∃ L ∈ F, ∀ a ∈ L, a • m = 0\n\n/-- Module-level `F`-torsion: every element is `F`-torsion. -/\ndef IsTorsion (F : IdealFilter A)\n (M : Type*) [AddCommMonoid M] [Module A M] : Prop :=\n ∀ m : M, IsTorsionElem F m\n\n/-- We say that the quotient `K/L` is `F`-torsion if every element `k ∈ K` is annihilated\n(modulo `L`) by some ideal in `F`. Equivalently, for each `k ∈ K` there exists `I ∈ F`\nsuch that `I ≤ L.colon {k}`. This formulation avoids forming the quotient module explicitly. -/\ndef IsTorsionQuot (F : IdealFilter A) (L K : Ideal A) : Prop :=\n ∀ k ∈ K, ∃ I ∈ F, I ≤ L.colon {k}\n\n/-- Intersecting the left ideal with `K` does not change `IsTorsionQuot` on the right.\nIn particular, `IsTorsionQuot F L K` need not require `L ≤ K` for it is equivalent to asserting\nthe quotient `K / (L ⊓ K)` is `F`-torsion. -/\nlemma isTorsionQuot_inter_left_iff {F : IdealFilter A} {L K : Ideal A} :\n IsTorsionQuot F (L ⊓ K) K ↔ IsTorsionQuot F L K := by\n constructor <;>\n · intro h k hk\n rcases h k hk with ⟨I, hI, hI_le⟩\n have hcol : (L ⊓ K).colon {k} = Submodule.colon L {k} :=\n Submodule.colon_inf_eq_left_of_subset (Set.singleton_subset_iff.mpr hk)\n exact ⟨I, hI, (by simpa [hcol] using hI_le)⟩\n\n\n@[simp] lemma isTorsion_def (F : IdealFilter A) (M : Type*) [AddCommMonoid M] [Module A M] :\n IsTorsion F M ↔ ∀ m : M, IsTorsionElem F m :=\n Iff.rfl\n\n@[simp] lemma isTorsionQuot_def {F : IdealFilter A} {L K : Ideal A} :\n IsTorsionQuot F L K ↔ ∀ k ∈ (K : Set A), ∃ I ∈ F, I ≤ L.colon {k} :=\n Iff.rfl\n\nTarget:\nlemma isTorsionQuot_self (F : IdealFilter A) (I : Ideal A) :\n IsTorsionQuot F I I :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_03fe8452e8dd","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"9fd83a1284daccf3a5eee86baa1a4bd88acaa90373395df7577a42567b46d68d","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/IdealFilter","family_id":"istorsionquot_self","file_id":"mathlib/Mathlib/RingTheory/IdealFilter/Basic.lean","sample_id":"03fe8452e8dda77fc756d2e905200f9aad50ed00b4f4dff36617d12d1800c918"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3383ebb0329b7960caad6f2c85d824f9357853fa6469e3040a3b6e0669cd33e8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4a382e437502a9bb0307e27b749e96cfdbb0864b5f7a450aafd30eb1aef16a23","source_sha256":"35229697683d4b1be4d41972c9213be8e6e9f0f207028d46330db6ff5671f9c3","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n ext k\n by_cases h : k = c.index j\n · rw [h]\n let r : Fin (c.blocksFun (c.index j)) → Fin n := c.embedding (c.index j)\n simp only [Function.update_self]\n change p (c.blocksFun (c.index j)) (Function.update v j z ∘ r) = _\n let j' := c.invEmbedding j\n suffices B : Function.update v j z ∘ r = Function.update (v ∘ r) j' z by rw [B]\n suffices C : Function.update v (r j') z ∘ r = Function.update (v ∘ r) j' z by\n convert! C; exact (c.embedding_comp_inv j).symm\n exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _\n · simp only [h, Function.update_of_ne, Ne, not_false_iff]\n let r : Fin (c.blocksFun k) → Fin n := c.embedding k\n change p (c.blocksFun k) (Function.update v j z ∘ r) = p (c.blocksFun k) (v ∘ r)\n suffices B : Function.update v j z ∘ r = v ∘ r by rw [B]\n apply Function.update_comp_eq_of_notMem_range\n rwa [c.mem_range_embedding_iff']","hard_negative":true,"metrics":{"chosen_tokens":258,"rejected_tokens":8,"token_jaccard":0.04918,"token_length_ratio":0.031008},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"245d76289b31b49ac39889a9c49f12b29bc97061cf01c5b1dcce95a026042c4b","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Analytic.Basic\npublic import Mathlib.Analysis.Analytic.CPolynomialDef\npublic import Mathlib.Combinatorics.Enumerative.Composition\n\nNamespace:\nFormalMultilinearSeries\n\nLocal context:\n/-\nCopyright (c) 2020 Sébastien Gouëzel. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Sébastien Gouëzel, Johan Commelin\n-/\n/-!\n# Composition of analytic functions\n\nIn this file we prove that the composition of analytic functions is analytic.\n\nThe argument is the following. Assume `g z = ∑' qₙ (z, ..., z)` and `f y = ∑' pₖ (y, ..., y)`. Then\n\n`g (f y) = ∑' qₙ (∑' pₖ (y, ..., y), ..., ∑' pₖ (y, ..., y))\n= ∑' qₙ (p_{i₁} (y, ..., y), ..., p_{iₙ} (y, ..., y))`.\n\nFor each `n` and `i₁, ..., iₙ`, define a `i₁ + ... + iₙ` multilinear function mapping\n`(y₀, ..., y_{i₁ + ... + iₙ - 1})` to\n`qₙ (p_{i₁} (y₀, ..., y_{i₁-1}), p_{i₂} (y_{i₁}, ..., y_{i₁ + i₂ - 1}), ..., p_{iₙ} (....)))`.\nThen `g ∘ f` is obtained by summing all these multilinear functions.\n\nTo formalize this, we use compositions of an integer `N`, i.e., its decompositions into\na sum `i₁ + ... + iₙ` of positive integers. Given such a composition `c` and two formal\nmultilinear series `q` and `p`, let `q.compAlongComposition p c` be the above multilinear\nfunction. Then the `N`-th coefficient in the power series expansion of `g ∘ f` is the sum of these\nterms over all `c : Composition N`.\n\nTo complete the proof, we need to show that this power series has a positive radius of convergence.\nThis follows from the fact that `Composition N` has cardinality `2^(N-1)` and estimates on\nthe norm of `qₙ` and `pₖ`, which give summability. We also need to show that it indeed converges to\n`g ∘ f`. For this, we note that the composition of partial sums converges to `g ∘ f`, and that it\ncorresponds to a part of the whole sum, on a subset that increases to the whole space. By\nsummability of the norms, this implies the overall convergence.\n\n## Main results\n\n* `q.comp p` is the formal composition of the formal multilinear series `q` and `p`.\n* `HasFPowerSeriesAt.comp` states that if two functions `g` and `f` admit power series expansions\n `q` and `p`, then `g ∘ f` admits a power series expansion given by `q.comp p`.\n* `AnalyticAt.comp` states that the composition of analytic functions is analytic.\n* `FormalMultilinearSeries.comp_assoc` states that composition is associative on formal\n multilinear series.\n\n## Implementation details\n\nThe main technical difficulty is to write down things. In particular, we need to define precisely\n`q.compAlongComposition p c` and to show that it is indeed a continuous multilinear\nfunction. This requires a whole interface built on the class `Composition`. Once this is set,\nthe main difficulty is to reorder the sums, writing the composition of the partial sums as a sum\nover some subset of `Σ n, Composition n`. We need to check that the reordering is a bijection,\nrunning over difficulties due to the dependent nature of the types under consideration, that are\ncontrolled thanks to the interface for `Composition`.\n\nThe associativity of composition on formal multilinear series is a nontrivial result: it does not\nfollow from the associativity of composition of analytic functions, as there is no uniqueness for\nthe formal multilinear series representing a function (and also, it holds even when the radius of\nconvergence of the series is `0`). Instead, we give a direct proof, which amounts to reordering\ndouble sums in a careful way. The change of variables is a canonical (combinatorial) bijection\n`Composition.sigmaEquivSigmaPi` between `(Σ (a : Composition n), Composition a.length)` and\n`(Σ (c : Composition n), Π (i : Fin c.length), Composition (c.blocksFun i))`, and is described\nin more details below in the paragraph on associativity.\n-/\n\n@[expose] public section\n\n\nnoncomputable section\n\nvariable {𝕜 : Type*} {E F G H : Type*}\n\nopen Filter List\n\nopen scoped Topology NNReal ENNReal\n\nsection Topological\n\nvariable [CommRing 𝕜] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]\nvariable [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 G]\nvariable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]\n\n/-! ### Composing formal multilinear series -/\n\n\nnamespace FormalMultilinearSeries\n\nvariable [IsTopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]\nvariable [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]\nvariable [IsTopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]\n\n/-!\nIn this paragraph, we define the composition of formal multilinear series, by summing over all\npossible compositions of `n`.\n-/\n\n\n/-- Given a formal multilinear series `p`, a composition `c` of `n` and the index `i` of a\nblock of `c`, we may define a function on `Fin n → E` by picking the variables in the `i`-th block\nof `n`, and applying the corresponding coefficient of `p` to these variables. This function is\ncalled `p.applyComposition c v i` for `v : Fin n → E` and `i : Fin c.length`. -/\ndef applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n) :\n (Fin n → E) → Fin c.length → F := fun v i => p (c.blocksFun i) (v ∘ c.embedding i)\n\ntheorem applyComposition_ones (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :\n p.applyComposition (Composition.ones n) = fun v i =>\n p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by\n funext v i\n apply p.congr (Composition.ones_blocksFun _ _)\n intro j hjn hj1\n obtain rfl : j = 0 := by lia\n refine congr_arg v ?_\n rw [Fin.ext_iff, Fin.val_castLE, Composition.ones_embedding, Fin.val_mk]\n\ntheorem applyComposition_single (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : 0 < n)\n (v : Fin n → E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by\n ext j\n refine p.congr (by simp) fun i hi1 hi2 => ?_\n dsimp\n congr 1\n convert! Composition.single_embedding hn ⟨i, hi2⟩ using 1\n obtain ⟨j_val, j_property⟩ := j\n have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)\n rw! [this]\n rfl\n\n@[simp]\ntheorem removeZero_applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}\n (c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by\n ext v i\n simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]\n\n/-- Technical lemma stating how `p.applyComposition` commutes with updating variables. This\nwill be the key point to show that functions constructed from `applyComposition` retain\nmultilinearity. -/\n\nTarget:\ntheorem applyComposition_update (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n)\n (j : Fin n) (v : Fin n → E) (z : E) :\n p.applyComposition c (Function.update v j z) =\n Function.update (p.applyComposition c v) (c.index j)\n (p (c.blocksFun (c.index j))\n (Function.update (v ∘ c.embedding (c.index j)) (c.invEmbedding j) z)) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"ab3665d25acd287cc7e4a9092645803b57008d0a28d8ec2bc6acfa9a3e7fddae","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Analytic","family_id":"applycomposition_update","file_id":"mathlib/Mathlib/Analysis/Analytic/Composition.lean","sample_id":"4a382e437502a9bb0307e27b749e96cfdbb0864b5f7a450aafd30eb1aef16a23"},"split":"validation"} {"binding":{"chosen_proof_sha256":"bbb9a226483231d82067eec87f43e12d83aad6e5c91ff3e5b6a9caf4c654cffd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"071da6c001a660cdfd73e6b0d949c8634a046ae85daad91a8bddf2722505eed9","source_sha256":"37f17dacd5bcc157b99a90651c7281496dc8bcf5b9fd1ba77727f58502e618cc","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n convert! dif_pos hq\n simp [Algebra.algebra_ext_iff, Localization.AtPrime.IsLiesOverAlgebra.algebraMap_eq]","hard_negative":false,"metrics":{"chosen_tokens":19,"rejected_tokens":3,"token_jaccard":0.055556,"token_length_ratio":0.157895},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"2573278e191262aaf56198eb9ef82473fcab06ff8bbcbcdb78a10c5ceeb9b492","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.NumberTheory.RamificationInertia.Inertia\npublic import Mathlib.RingTheory.QuasiFinite.Basic\n\nNamespace:\nIdeal\n\nLocal context:\n/-\nCopyright (c) 2026 Thomas Browning. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Thomas Browning\n-/\n/-!\n# Inertia degree\n\nGiven a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\n## Main definitions\n\n* `Ideal.inertiaDeg' q R`: The inertia degree of `q` over `R`.\n\n## Main statements\n\n* `inertiaDeg_eq_inertiaDeg'`: The inertia degree agrees with the usual definition in the case of\n maximal ideals.\n* `inertiaDeg'_tower`: Inertia degree is multiplicative in towers.\n-/\n\n@[expose] public section\n\nnamespace Ideal\n\nsection\n\nvariable {S : Type*} [CommRing S] (q : Ideal S) (R : Type*) [CommRing R] [Algebra R S]\n\nopen Classical in\n/-- Given a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\nWhen `q` is not prime, we use a junk value of `0`.\n\nThis will eventually replace the existing definition of `Ideal.inertiaDeg`. -/\nnoncomputable def inertiaDeg' : ℕ :=\n if _ : q.IsPrime then\n letI := Localization.AtPrime.algebraOfLiesOver (q.under R) q\n Module.finrank (q.under R).ResidueField q.ResidueField else 0\n\nTarget:\ntheorem inertiaDeg'_def [hq : q.IsPrime]\n [Algebra (Localization.AtPrime (q.under R)) (Localization.AtPrime q)]\n [Localization.AtPrime.IsLiesOverAlgebra (q.under R) q] :\n q.inertiaDeg' R = Module.finrank (q.under R).ResidueField q.ResidueField :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/RamificationInertia","family_id":"inertiadeg'_def","file_id":"mathlib/Mathlib/RingTheory/RamificationInertia/Inertia.lean","sample_id":"071da6c001a660cdfd73e6b0d949c8634a046ae85daad91a8bddf2722505eed9"},"split":"validation"} {"binding":{"chosen_proof_sha256":"cde53003a415aef5d70ce6568aecc668a9190aa46283839d3c48157c4162f290","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"8d4ba8091424801d3599cda730071f54de436e15bb1df5cc960f16fe24cac8ce","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"a5a791618fc035b41c36a0f1781e389de02739d5549a62e74aaae3ffec4ea8e8","source_sha256":"3b1ebdbfe4d3947834e2865eb5db92b25f69737c310e197f1baeb59959f0efe4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n intro H\n simpa using H.isUnit_add_right_of_commute hx.neg (by simp)","hard_negative":true,"metrics":{"chosen_tokens":15,"rejected_tokens":5,"token_jaccard":0.133333,"token_length_ratio":0.333333},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"2660ecabfd1428ce9d2c8a946b4138ceeaf195fe23a732376084cddc8f29dffe","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.BigOperators.Finprod\npublic import Mathlib.Algebra.FiniteSupport.Defs\npublic import Mathlib.Algebra.GroupWithZero.Action.Defs\npublic import Mathlib.Algebra.GroupWithZero.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.GeomSum\npublic import Mathlib.Data.Nat.Choose.Sum\npublic import Mathlib.Order.Lattice.Nat\npublic import Mathlib.RingTheory.Nilpotent.Defs\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Nilpotent elements\n\nThis file develops the basic theory of nilpotent elements. In particular it shows that the\nnilpotent elements are closed under many operations.\n\nFor the definition of `nilradical`, see `Mathlib/RingTheory/Nilpotent/Lemmas.lean`.\n\n\n## Main definitions\n\n * `isNilpotent_neg_iff`\n * `Commute.isNilpotent_add`\n * `Commute.isNilpotent_sub`\n\n-/\n\npublic section\n\nuniverse u v\n\nopen Function Set\n\nvariable {R S : Type*} {x y : R}\n\ntheorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by\n obtain ⟨n, hn⟩ := h\n use n\n rw [neg_pow, hn, mul_zero]\n\n@[simp]\ntheorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x :=\n ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩\n\nlemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S]\n [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) :\n IsNilpotent (t • a) := by\n obtain ⟨k, ha⟩ := ha\n use k\n rw [smul_pow, ha, smul_zero]\n\ntheorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by\n obtain ⟨n, hn⟩ := hnil\n refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩\n · simp [mul_geom_sum, hn]\n · simp [geom_sum_mul, hn]\n\ntheorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by\n rw [← IsUnit.neg_iff, neg_sub]\n exact isUnit_sub_one hnil\n\ntheorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by\n rw [← IsUnit.neg_iff, neg_add']\n exact isUnit_sub_one hnil.neg\n\ntheorem IsNilpotent.isUnit_one_add [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 + r) :=\n add_comm r 1 ▸ isUnit_add_one hnil\n\ntheorem IsNilpotent.isUnit_add_left_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (u + r) := by\n rw [← Units.isUnit_mul_units _ hu.unit⁻¹, add_mul, IsUnit.mul_val_inv]\n replace h_comm : Commute r (↑hu.unit⁻¹) := Commute.units_inv_right h_comm\n refine IsNilpotent.isUnit_one_add ?_\n exact (hu.unit⁻¹.isUnit.isNilpotent_mul_unit_of_commute_iff h_comm).mpr hnil\n\ntheorem IsNilpotent.isUnit_add_right_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (r + u) :=\n add_comm r u ▸ hnil.isUnit_add_left_of_commute hu h_comm\n\nTarget:\nlemma IsUnit.not_isNilpotent [Ring R] [Nontrivial R] {x : R} (hx : IsUnit x) :\n ¬ IsNilpotent x :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_a5a791618fc0","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"4dc4d68ac357aef155323d9eec8de7d80449b32386e8cad9023ea9a3dbd86ad0","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Nilpotent","family_id":"isunit","file_id":"mathlib/Mathlib/RingTheory/Nilpotent/Basic.lean","sample_id":"a5a791618fc035b41c36a0f1781e389de02739d5549a62e74aaae3ffec4ea8e8"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8efa52167af4dc6aed9cad04396233409251247d3b8dc17d938fdbd5acce7285","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4ac347a989fd8ea5e6ec0e3b87556922074b79295b78f1810c14980222c16f8c","source_sha256":"6dfadbed89161d0363647ee7f6757fe09c64d28a6da281daa18f41608b61c825","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n apply natTrans_ext <;> ext <;> simp [mapCompRight]","hard_negative":false,"metrics":{"chosen_tokens":14,"rejected_tokens":2,"token_jaccard":0.083333,"token_length_ratio":0.142857},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"27891a4175c3b267e3d9a2ecce3b9d9496c81fc833d37f28070281bee65dd7a4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Join.Basic\npublic import Mathlib.CategoryTheory.Bicategory.Functor.Pseudofunctor\n\nNamespace:\nCategoryTheory.Join\n\nLocal context:\n/-\nCopyright (c) 2025 Robin Carlier. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Robin Carlier\n-/\n/-!\n# Pseudofunctoriality of categorical joins\n\nIn this file, we promote the join construction to two pseudofunctors\n`Join.pseudofunctorLeft` and `Join.pseudofunctorRight`, expressing its pseudofunctoriality in\neach variable.\n\n-/\n\n@[expose] public section\n\nuniverse v₁ v₂ u₁ u₂\n\nnamespace CategoryTheory.Join\n\nopen Bicategory Functor\n\n-- The proof gets too slow if we put it in a single `pseudofunctor` constructor,\n-- so we break down the component proofs for the pseudofunctors over several lemmas.\n\nsection\nvariable {A B C D : Type*} [Category* A] [Category* B] [Category* C] [Category* D]\n\n\nvariable (A) in\n/-- The structural isomorphism for composition of `pseudofunctorRight`. -/\ndef mapCompRight (F : B ⥤ C) (G : C ⥤ D) :\n mapPair (𝟭 A) (F ⋙ G) ≅ mapPair (𝟭 A) F ⋙ mapPair (𝟭 A) G :=\n mapIsoWhiskerRight (Functor.leftUnitor _).symm _ ≪≫ mapPairComp (𝟭 A) F (𝟭 A) G\n\nvariable (D) in\n/-- The structural isomorphism for composition of `pseudofunctorLeft`. -/\ndef mapCompLeft (F : A ⥤ B) (G : B ⥤ C) :\n mapPair (F ⋙ G) (𝟭 D) ≅ mapPair F (𝟭 D) ⋙ mapPair G (𝟭 D) :=\n mapIsoWhiskerLeft _ (Functor.leftUnitor _).symm ≪≫ mapPairComp F (𝟭 D) G (𝟭 D)\n\nset_option backward.defeqAttrib.useBackward true in\nvariable (A) in\n@[reassoc]\n\nTarget:\nlemma mapWhiskerLeft_whiskerLeft (F : B ⥤ C) {G H : C ⥤ D} (η : G ⟶ H) :\n mapWhiskerLeft _ (whiskerLeft F η) =\n (mapCompRight A F G).hom ≫ whiskerLeft (mapPair (𝟭 A) F) (mapWhiskerLeft _ η) ≫\n (mapCompRight A F H).inv :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Join","family_id":"mapwhiskerleft_whiskerleft","file_id":"mathlib/Mathlib/CategoryTheory/Join/Pseudofunctor.lean","sample_id":"4ac347a989fd8ea5e6ec0e3b87556922074b79295b78f1810c14980222c16f8c"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b8941c02b0897c37b31620cc121225fb927353bbafa09db8fe3efcfc10020c86","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"084dfac048a127a79332bc112fe2f72333d8d2887a13c44a99cdfe63db896832","source_sha256":"13145f44ead8d985879a371c864031f8e21ad289ea2a17320dc811b9f8e0a0fb","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [isClosed_iff]\n intro F hF\n exact cl_cl _ ⟨F, hF, rfl⟩","hard_negative":false,"metrics":{"chosen_tokens":18,"rejected_tokens":5,"token_jaccard":0.176471,"token_length_ratio":0.277778},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"28d4949958b3e3f265527af0d8aff823553be3edc871c3b5155b8f20512106cc","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Monad.Types\npublic import Mathlib.CategoryTheory.Monad.Limits\npublic import Mathlib.CategoryTheory.Equivalence\npublic import Mathlib.Topology.Category.CompHaus.Basic\npublic import Mathlib.Topology.Category.Profinite.Basic\npublic import Mathlib.Data.Set.Constructions\n\nNamespace:\nCompactum\n\nLocal context:\n/-\nCopyright (c) 2020 Adam Topaz. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Adam Topaz\n-/\n/-!\n\n# Compacta and Compact Hausdorff Spaces\n\nRecall that, given a monad `M` on `Type*`, an *algebra* for `M` consists of the following data:\n- A type `X : Type*`\n- A \"structure\" map `M X → X`.\n\nThis data must also satisfy a distributivity and unit axiom, and algebras for `M` form a category\nin an evident way.\n\nSee the file `Mathlib/CategoryTheory/Monad/Algebra.lean` for a general version, as well as the\nfollowing link.\nhttps://ncatlab.org/nlab/show/monad\n\nThis file proves the equivalence between the category of *compact Hausdorff topological spaces*\nand the category of algebras for the *ultrafilter monad*.\n\n## Notation:\n\nHere are the main objects introduced in this file.\n- `Compactum` is the type of compacta, which we define as algebras for the ultrafilter monad.\n- `compactumToCompHaus` is the functor `Compactum ⥤ CompHaus`. Here `CompHaus` is the usual\n category of compact Hausdorff spaces.\n- `compactumToCompHaus.isEquivalence` is a term of type `IsEquivalence compactumToCompHaus`.\n\nThe proof of this equivalence is a bit technical. But the idea is quite simply that the structure\nmap `Ultrafilter X → X` for an algebra `X` of the ultrafilter monad should be considered as the map\nsending an ultrafilter to its limit in `X`. The topology on `X` is then defined by mimicking the\ncharacterization of open sets in terms of ultrafilters.\n\nAny `X : Compactum` is endowed with a coercion to `Type*`, as well as the following instances:\n- `TopologicalSpace X`.\n- `CompactSpace X`.\n- `T2Space X`.\n\nAny morphism `f : X ⟶ Y` of is endowed with a coercion to a function `X → Y`, which is shown to\nbe continuous in `continuous_of_hom`.\n\nThe function `Compactum.ofTopologicalSpace` can be used to construct a `Compactum` from a\ntopological space which satisfies `CompactSpace` and `T2Space`.\n\nWe also add wrappers around structures which already exist. Here are the main ones, all in the\n`Compactum` namespace:\n\n- `forget : Compactum ⥤ Type*` is the forgetful functor, which induces a `ConcreteCategory`\n instance for `Compactum`.\n- `free : Type* ⥤ Compactum` is the left adjoint to `forget`, and the adjunction is in `adj`.\n- `str : Ultrafilter X → X` is the structure map for `X : Compactum`.\n The notation `X.str` is preferred.\n- `join : Ultrafilter (Ultrafilter X) → Ultrafilter X` is the monadic join for `X : Compactum`.\n Again, the notation `X.join` is preferred.\n- `incl : X → Ultrafilter X` is the unit for `X : Compactum`. The notation `X.incl` is preferred.\n\n## References\n\n- E. Manes, Algebraic Theories, Graduate Texts in Mathematics 26, Springer-Verlag, 1976.\n- https://ncatlab.org/nlab/show/ultrafilter\n\n-/\n\n@[expose] public section\n\nuniverse u\n\nopen CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter\nopen scoped Topology\n\nlocal notation \"β\" => ofTypeMonad Ultrafilter\n\n/-- The type `Compactum` of Compacta, defined as algebras for the ultrafilter monad. -/\ndef Compactum :=\n Monad.Algebra β deriving Category, Inhabited\n\nnamespace Compactum\n\n/-- The forgetful functor to TypeCat -/\ndef forget : Compactum ⥤ Type _ :=\n Monad.forget _\n\ninstance : forget.Faithful :=\n show (Monad.forget _).Faithful from inferInstance\n\nnoncomputable instance : CreatesLimits forget :=\n show CreatesLimits <| Monad.forget _ from inferInstance\n\n/-- The \"free\" Compactum functor. -/\ndef free : Type _ ⥤ Compactum :=\n Monad.free _\n\n/-- The adjunction between `free` and `forget`. -/\ndef adj : free ⊣ forget :=\n Monad.adj _\n\ninstance : CoeSort Compactum Type* :=\n ⟨fun X => X.A⟩\n\ninstance {X Y : Compactum} : FunLike (X ⟶ Y) X Y where\n coe f := f.f\n coe_injective _ _ h := (Monad.forget_faithful β).map_injective (by aesop)\n\n-- Basic instances\ninstance : ConcreteCategory Compactum (· ⟶ ·) where\n hom f := f\n ofHom f := f\n\ninstance : HasLimits Compactum :=\n hasLimits_of_hasLimits_createsLimits forget\n\n/-- The structure map for a compactum, essentially sending an ultrafilter to its limit. -/\ndef str (X : Compactum) : Ultrafilter X → X :=\n X.a\n\n/-- The monadic join. -/\ndef join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X :=\n (β).μ.app _\n\n/-- The inclusion of `X` into `Ultrafilter X`. -/\ndef incl (X : Compactum) : X → Ultrafilter X :=\n (β).η.app _\n\n@[simp]\ntheorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by\n change ((β).η.app _ ≫ X.a) _ = _\n rw [Monad.Algebra.unit]\n rfl\n\n@[simp]\ntheorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) :\n f (X.str xs) = Y.str (map f xs) := by\n change (X.a ≫ f.f) _ = _\n rw [← f.h]\n rfl\n\n@[simp]\ntheorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) :\n X.str (X.join uux) = X.str (map X.str uux) := by\n change ((β).μ.app _ ≫ X.a) _ = _\n rw [Monad.Algebra.assoc]\n rfl\n\ninstance {X : Compactum} : TopologicalSpace X where\n IsOpen U := ∀ F : Ultrafilter X, X.str F ∈ U → U ∈ F\n isOpen_univ _ _ := Filter.univ_sets _\n isOpen_inter _ _ h3 h4 _ h6 := Filter.inter_sets _ (h3 _ h6.1) (h4 _ h6.2)\n isOpen_sUnion := fun _ h1 _ ⟨T, hT, h2⟩ =>\n mem_of_superset (h1 T hT _ h2) (Set.subset_sUnion_of_mem hT)\n\ntheorem isClosed_iff {X : Compactum} (S : Set X) :\n IsClosed S ↔ ∀ F : Ultrafilter X, S ∈ F → X.str F ∈ S := by\n rw [← isOpen_compl_iff]\n constructor\n · intro cond F h\n by_contra c\n specialize cond F c\n rw [compl_mem_iff_notMem] at cond\n contradiction\n · intro h1 F h2\n specialize h1 F\n rcases F.mem_or_compl_mem S with h | h\n exacts [absurd (h1 h) h2, h]\n\ninstance {X : Compactum} : CompactSpace X := by\n constructor\n rw [isCompact_iff_ultrafilter_le_nhds]\n intro F _\n refine ⟨X.str F, by tauto, ?_⟩\n rw [le_nhds_iff]\n intro S h1 h2\n exact h2 F h1\n\n/-- A local definition used only in the proofs. -/\nprivate def basic {X : Compactum} (A : Set X) : Set (Ultrafilter X) :=\n { F | A ∈ F }\n\nset_option backward.privateInPublic true in\n/-- A local definition used only in the proofs. -/\nprivate def cl {X : Compactum} (A : Set X) : Set X :=\n X.str '' basic A\n\nprivate theorem basic_inter {X : Compactum} (A B : Set X) : basic (A ∩ B) = basic A ∩ basic B := by\n ext G\n constructor\n · intro hG\n constructor <;> filter_upwards [hG] with _\n exacts [And.left, And.right]\n · rintro ⟨h1, h2⟩\n exact inter_mem h1 h2\n\nprivate theorem subset_cl {X : Compactum} (A : Set X) : A ⊆ cl A := fun a ha =>\n ⟨X.incl a, ha, by simp⟩\n\nprivate theorem cl_cl {X : Compactum} (A : Set X) : cl (cl A) ⊆ cl A := by\n rintro _ ⟨F, hF, rfl⟩\n -- Notation to be used in this proof.\n let fsu := Finset (Set (Ultrafilter X))\n let ssu := Set (Set (Ultrafilter X))\n let ι : fsu → ssu := fun x ↦ ↑x\n let C0 : ssu := { Z | ∃ B ∈ F, X.str ⁻¹' B = Z }\n let AA := { G : Ultrafilter X | A ∈ G }\n let C1 := insert AA C0\n let C2 := finiteInterClosure C1\n -- C0 is closed under intersections.\n have claim1 : ∀ (B) (_ : B ∈ C0) (C) (_ : C ∈ C0), B ∩ C ∈ C0 := by\n rintro B ⟨Q, hQ, rfl⟩ C ⟨R, hR, rfl⟩\n use Q ∩ R\n simp only [and_true, Set.preimage_inter]\n exact inter_sets _ hQ hR\n -- All sets in C0 are nonempty.\n have claim2 : ∀ B ∈ C0, Set.Nonempty B := by\n rintro B ⟨Q, hQ, rfl⟩\n obtain ⟨q⟩ := Filter.nonempty_of_mem hQ\n use X.incl q\n simpa\n -- The intersection of AA with every set in C0 is nonempty.\n have claim3 : ∀ B ∈ C0, (AA ∩ B).Nonempty := by\n rintro B ⟨Q, hQ, rfl⟩\n have : (Q ∩ cl A).Nonempty := Filter.nonempty_of_mem (inter_mem hQ hF)\n rcases this with ⟨q, hq1, P, hq2, hq3⟩\n refine ⟨P, hq2, ?_⟩\n rw [← hq3] at hq1\n simpa\n -- Suffices to show that the intersection of any finite subcollection of C1 is nonempty.\n suffices ∀ T : fsu, ι T ⊆ C1 → (⋂₀ ι T).Nonempty by\n obtain ⟨G, h1⟩ := exists_ultrafilter_of_finite_inter_nonempty _ this\n use X.join G\n have : G.map X.str = F := Ultrafilter.coe_le_coe.1 fun S hS => h1 (Or.inr ⟨S, hS, rfl⟩)\n rw [join_distrib, this]\n exact ⟨h1 (Or.inl rfl), rfl⟩\n -- C2 is closed under finite intersections (by construction!).\n have claim4 := finiteInterClosure_finiteInter C1\n -- C0 is closed under finite intersections by claim1.\n have claim5 : FiniteInter C0 := ⟨⟨_, univ_mem, Set.preimage_univ⟩, claim1⟩\n -- Every element of C2 is nonempty.\n have claim6 : ∀ P ∈ C2, (P : Set (Ultrafilter X)).Nonempty := by\n suffices ∀ P ∈ C2, P ∈ C0 ∨ ∃ Q ∈ C0, P = AA ∩ Q by\n intro P hP\n rcases this P hP with h | h\n · exact claim2 _ h\n · rcases h with ⟨Q, hQ, rfl⟩\n exact claim3 _ hQ\n intro P hP\n exact claim5.finiteInterClosure_insert _ hP\n intro T hT\n -- Suffices to show that the intersection of the T's is contained in C2.\n suffices ⋂₀ ι T ∈ C2 by exact claim6 _ this\n -- Finish\n apply claim4.finiteInter_mem T\n intro t ht\n exact finiteInterClosure.basic (@hT t ht)\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n\nTarget:\ntheorem isClosed_cl {X : Compactum} (A : Set X) : IsClosed (cl A) :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Category","family_id":"isclosed_cl","file_id":"mathlib/Mathlib/Topology/Category/Compactum.lean","sample_id":"084dfac048a127a79332bc112fe2f72333d8d2887a13c44a99cdfe63db896832"},"split":"validation"} {"binding":{"chosen_proof_sha256":"6ee7f737e8c2d4671ff94ca3332e31fcc1949203f2cecbaf3edb19973b3febab","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"fe55296aea5bde9496f9cd5ecb058d7549370ad611fd4269d0f019b90fc2166d","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"c52c64e1c712585df638ea3219bbaa16560e618aef9929691fab84e789b3af69","source_sha256":"790acd992586304a23c30f7c64c4cbe1862b5710e414e5488a2b139adb1423f5","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨p, hp⟩ := Algebra.adjoin_eq_exists_aeval _ x a\n grind","hard_negative":false,"metrics":{"chosen_tokens":15,"rejected_tokens":20,"token_jaccard":0.789474,"token_length_ratio":1.333333},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"2ac6718219203f2c1f282d67ce63b12a2ea438b24c2b5273b7c340e5da77d4b7","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Polynomial.AlgebraMap\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2018 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes, Johannes Hölzl, Kim Morrison, Jens Wagemaker\n-/\n/-!\n# Polynomials and adjoining roots\n\n## Main results\n\n* `Algebra.instCommSemiringAdjoinSingleton, Algebra.instCommRingAdjoinSingleton`:\n adjoining an element to a commutative (semi)ring gives a commutative (semi)ring\n* `Algebra.adjoin_singleton_induction`:\n proving a fact about `a : adjoin R {x}` is the same as proving it for `aeval x p` where `p`\n is an arbitrary polynomial\n-/\n\npublic section\n\nnoncomputable section\n\nopen Finset\n\nopen Polynomial\n\nnamespace Algebra\n\nuniverse u v w z\n\nvariable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {A' B : Type*} {a b : R} {n : ℕ}\n\nsection aeval\n\nopen Algebra\n\nvariable [CommSemiring R] [Semiring A] [CommSemiring A'] [Semiring B]\nvariable [Algebra R A] [Algebra R B]\nvariable {p q : R[X]} (x : A)\n\n@[simp]\ntheorem _root_.Polynomial.adjoin_X : adjoin R ({X} : Set R[X]) = ⊤ := by\n refine top_unique fun p _hp => ?_\n set S := adjoin R ({X} : Set R[X])\n rw [← sum_monomial_eq p]; simp only [← smul_X_eq_monomial]\n exact S.sum_mem fun n _hn => S.smul_mem (S.pow_mem (subset_adjoin rfl) _) _\n\nvariable (R)\ntheorem adjoin_singleton_eq_range_aeval (x : A) :\n adjoin R {x} = (aeval x).range := by\n rw [← Algebra.map_top, ← adjoin_X, AlgHom.map_adjoin, Set.image_singleton, aeval_X]\n\n@[simp]\ntheorem _root_.Polynomial.aeval_mem_adjoin_singleton : aeval x p ∈ adjoin R {x} := by\n simp [adjoin_singleton_eq_range_aeval]\n\ninstance {A B : Type*} [CommSemiring A] [Semiring B] [Algebra A B] (x : B) (p : Polynomial A) :\n CoeDep B (p.aeval x) (Algebra.adjoin A {x}) where\n coe := ⟨p.aeval x, aeval_mem_adjoin_singleton A x⟩\n\ntheorem adjoin_mem_exists_aeval {a : A} (h : a ∈ R[x]) :\n ∃ p : R[X], aeval x p = a := by\n rw [Algebra.adjoin_singleton_eq_range_aeval] at h\n simp_all\n\ntheorem adjoin_eq_exists_aeval (a : R[x]) :\n ∃ p : R[X], aeval x p = a := by\n have : (a : A) ∈ R[x] := by simp\n set y := (a : A) with h\n rw [Algebra.adjoin_singleton_eq_range_aeval] at this\n simp_all\n\n/--\nProving a fact about `a : adjoin R {x}` is the same as proving it for\n`aeval x p` where `p`is an arbitrary polynomial. -/\n@[elab_as_elim]\n\nTarget:\ntheorem adjoin_singleton_induction {M : (adjoin R {x}) → Prop}\n (a : adjoin R {x}) (f : ∀ (p : Polynomial R), M (aeval x p : adjoin R {x})) : M a :=\n\nProof body:\n","rejected":"by\n obtain ⟨p, hp⟩ := Algebra.adjoin_eq_exists_aeval _ x a\n grind\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Adjoin","family_id":"adjoin_singleton_induction","file_id":"mathlib/Mathlib/RingTheory/Adjoin/Polynomial/Basic.lean","sample_id":"c52c64e1c712585df638ea3219bbaa16560e618aef9929691fab84e789b3af69"},"split":"validation"} {"binding":{"chosen_proof_sha256":"40918c6c4e621adbec13d515addfa93b0b2bfcf79f1d67ac9e52d74a6819d7b6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"84bb31def4fdb76e648f62ee3689a3746d794d8a7403c6086ecfe4c6446694f8","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"69c1472eb4fcac7f75367d274023840a7d509a9012ba86d8696aa01e223abc4f","source_sha256":"3faa405bdd543132812264268c6e4b51083d5c127ac14d512f81647196fa8418","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n classical\n induction S using Finset.induction generalizing n with\n | empty =>\n simp\n | insert a S' ha hind =>\n have : (∀ (n : ℕ), Subsingleton {r | r ∈ S' ∧ (x r).coeff n ≠ 0}) := by\n refine fun n ↦ ⟨fun b c ↦ ?_⟩\n ext\n exact congrArg (fun x ↦ x.1) <|\n (h n).allEq ⟨b.1, S'.subset_insert a b.2.1, b.2.2⟩ ⟨c.1, S'.subset_insert a c.2.1, c.2.2⟩\n replace hind := hind this\n simp only [ha, not_false_eq_true, Finset.sum_insert]\n have : ∀ (n : ℕ), (x a).coeff n = 0 ∨ (∑ s ∈ S', x s).coeff n = 0 := by\n simp only [hind]\n by_contra! ⟨m, hma, hmS'⟩\n have := Finset.sum_eq_zero.mt hmS'\n push Not at this\n choose b hb hb' using this\n have : a = b :=\n congrArg (fun x ↦ x.1) <|\n (h m).allEq ⟨a, S'.mem_insert_self a, hma⟩ ⟨b, S'.mem_insert_of_mem hb, hb'⟩\n exact ha (this ▸ hb)\n rw [coeff_add_of_disjoint n _ _ this, hind n]\n\nvariable [CharP R p]","hard_negative":false,"metrics":{"chosen_tokens":276,"rejected_tokens":281,"token_jaccard":0.956522,"token_length_ratio":1.018116},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"2cb5dfa92e119fb16ccfb8890b4c775f6e1e84dc517433e70b174a62f7896c84","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.WittVector.Complete\npublic import Mathlib.RingTheory.WittVector.Teichmuller\n\nNamespace:\nWittVector\n\nLocal context:\n/-\nCopyright (c) 2025 Jiedong Jiang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jiedong Jiang\n-/\n/-!\n# Teichmuller Series\n\nLet `R` be a characteristic `p` perfect ring. In this file, we show that\nevery element `x` of the Witt vectors `𝕎 R` can be written as the\n(`p`-adic) summation of Teichmuller series, namely\n`∑ i, (teichmuller p\n (((frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i)`\n\n## Main theorems\n\n* `WittVector.dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff` : `p ^ (n + 1)` divides\n `x` minus the summation of the first `n + 1` terms of the Teichmuller series.\n* `WittVector.eq_of_apply_teichmuller_eq` : Given a ring `S` such that `p` is nilpotent in `S`\n and two ring maps `f g : 𝕎 R →+* S`, if they coincide on the teichmuller representatives,\n then they are equal.\n\n## TODO\nShow that the Teichmuller series is unique.\n-/\n\npublic section\n\nopen Ideal Quotient\nnamespace WittVector\n\nvariable {p : ℕ} [hp : Fact (Nat.Prime p)]\n\nlocal notation \"𝕎\" => WittVector p\n\nvariable {R : Type*} [CommRing R]\n\nTarget:\ntheorem sum_coeff_eq_coeff_sum {α : Type*} {S : Finset α} (x : α → 𝕎 R)\n (h : ∀ (n : ℕ), Subsingleton {r | r ∈ S ∧ (x r).coeff n ≠ 0}) (n : ℕ) :\n (∑ s ∈ S, x s).coeff n = ∑ (s ∈ S), (x s).coeff n :=\n\nProof body:\n","rejected":"by\n classical\n induction S using Finset.induction generalizing n with\n | empty =>\n simp\n | insert a S' ha hind =>\n have : (∀ (n : ℕ), Subsingleton {r | r ∈ S' ∧ (x r).coeff n ≠ 0}) := by\n refine fun n ↦ ⟨fun b c ↦ ?_⟩\n ext\n exact congrArg (fun x ↦ x.1) <|\n (h n).allEq ⟨b.1, S'.subset_insert a b.2.1, b.2.2⟩ ⟨c.1, S'.subset_insert a c.2.1, c.2.2⟩\n replace hind := hind this\n simp only [ha, not_false_eq_true, Finset.sum_insert]\n have : ∀ (n : ℕ), (x a).coeff n = 0 ∨ (∑ s ∈ S', x s).coeff n = 0 := by\n simp only [hind]\n by_contra! ⟨m, hma, hmS'⟩\n have := Finset.sum_eq_zero.mt hmS'\n push Not at this\n choose b hb hb' using this\n have : a = b :=\n congrArg (fun x ↦ x.1) <|\n (h m).allEq ⟨a, S'.mem_insert_self a, hma⟩ ⟨b, S'.mem_insert_of_mem hb, hb'⟩\n exact ha (this ▸ hb)\n rw [coeff_add_of_disjoint n _ _ this, hind n]\n\nvariable [CharP R p]\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/WittVector","family_id":"sum_coeff_eq_coeff_sum","file_id":"mathlib/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean","sample_id":"69c1472eb4fcac7f75367d274023840a7d509a9012ba86d8696aa01e223abc4f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"10ba54006687c2b7e6f732fee598b0c4a553147a83075f347459d76efce387f4","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"8a6a7d699b6ae48d5f58c550aafef2f8288559cd14b5c60f97de85040a396b7c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e0350996ace6f5bb6ffdfea13052fe1c261fffef52814e8799c3ea28bbca08fa","source_sha256":"bb71b66c224daa22efed5bcd0fc9ee7f7a942970f55bb7db3d3841c492eaec13","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n unfold partialSum\n fun_prop","hard_negative":false,"metrics":{"chosen_tokens":4,"rejected_tokens":11,"token_jaccard":0.666667,"token_length_ratio":2.75},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"2d0cffc5e6409d90486f6904543a747714e6624ee22895646276d32eb1e4f73b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Calculus.FormalMultilinearSeries\npublic import Mathlib.Analysis.SpecificLimits.Normed\n\nNamespace:\nFormalMultilinearSeries\n\nLocal context:\n/-\nCopyright (c) 2020 Sébastien Gouëzel. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Sébastien Gouëzel, Yury Kudryashov\n-/\n/-!\n# Radius of convergence of a power series\n\nThis file introduces the notion of the radius of convergence of a power series.\n\n## Main definitions\n\nLet `p` be a formal multilinear series from `E` to `F`, i.e., `p n` is a multilinear map on `E^n`\nfor `n : ℕ`.\n\n* `p.radius`: the largest `r : ℝ≥0∞` such that `‖p n‖ * r^n` grows subexponentially.\n* `p.le_radius_of_bound`, `p.le_radius_of_bound_nnreal`, `p.le_radius_of_isBigO`: if `‖p n‖ * r ^ n`\n is bounded above, then `r ≤ p.radius`;\n* `p.isLittleO_of_lt_radius`, `p.norm_mul_pow_le_mul_pow_of_lt_radius`,\n `p.isLittleO_one_of_lt_radius`,\n `p.norm_mul_pow_le_of_lt_radius`, `p.nnnorm_mul_pow_le_of_lt_radius`: if `r < p.radius`, then\n `‖p n‖ * r ^ n` tends to zero exponentially;\n* `p.lt_radius_of_isBigO`: if `r ≠ 0` and `‖p n‖ * r ^ n = O(a ^ n)` for some `-1 < a < 1`, then\n `r < p.radius`;\n* `p.partialSum n x`: the sum `∑_{i = 0}^{n-1} pᵢ xⁱ`.\n* `p.sum x`: the sum `∑'_{i = 0}^{∞} pᵢ xⁱ`.\n\n## Implementation details\n\nWe only introduce the radius of convergence of a power series, as `p.radius`.\nFor a power series in finitely many dimensions, there is a finer (directional, coordinate-dependent)\nnotion, describing the polydisk of convergence. This notion is more specific, and not necessary to\nbuild the general theory. We do not define it here.\n-/\n\n@[expose] public section\n\nnoncomputable section\n\nvariable {𝕜 E F G : Type*}\n\nopen Topology NNReal Filter ENNReal Set Asymptotics\nopen scoped Pointwise\n\nnamespace FormalMultilinearSeries\n\nvariable [Semiring 𝕜] [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F]\nvariable [TopologicalSpace E] [TopologicalSpace F]\nvariable [ContinuousAdd E] [ContinuousAdd F]\nvariable [ContinuousConstSMul 𝕜 E] [ContinuousConstSMul 𝕜 F]\n\n/-- Given a formal multilinear series `p` and a vector `x`, then `p.sum x` is the sum `Σ pₙ xⁿ`. A\npriori, it only behaves well when `‖x‖ < p.radius`. -/\nprotected def sum (p : FormalMultilinearSeries 𝕜 E F) (x : E) : F :=\n ∑' n : ℕ, p n fun _ => x\n\ntheorem sum_mem {S : Type*} {s : S} [SetLike S F] [AddSubmonoidClass S F]\n (h_closed : IsClosed (s : Set F)) (p : FormalMultilinearSeries 𝕜 E F) (x : E)\n (h : ∀ k, p k (fun _ : Fin k => x) ∈ s) :\n p.sum x ∈ s :=\n tsum_mem h_closed h\n\n/-- Given a formal multilinear series `p` and a vector `x`, then `p.partialSum n x` is the sum\n`Σ pₖ xᵏ` for `k ∈ {0,..., n-1}`. -/\ndef partialSum (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) (x : E) : F :=\n ∑ k ∈ Finset.range n, p k fun _ : Fin k => x\n\n/-- The partial sums of a formal multilinear series are continuous. -/\n\nTarget:\ntheorem partialSum_continuous (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :\n Continuous (p.partialSum n) :=\n\nProof body:\n","rejected":"```lean\nby\n unfold partialSum\n fun_prop\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Analytic","family_id":"partialsum_continuous","file_id":"mathlib/Mathlib/Analysis/Analytic/ConvergenceRadius.lean","sample_id":"e0350996ace6f5bb6ffdfea13052fe1c261fffef52814e8799c3ea28bbca08fa"},"split":"validation"} {"binding":{"chosen_proof_sha256":"003c7137d8f39c95cfb963dbfb8ac5ad5441c59f308f866f4ef0c9c064fd613c","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d50160855c625da7415eee57149ace92f06cf602558579127af061f9ab017580","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"fb5d05e1c691263e6393a77e6911275e45ee8c79ddf11e44423f0af313684105","source_sha256":"524b5816b6e1293bba6fd67e900de566ae101a2425218c9665aa3b48d126279e","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine le_antisymm (fun m hm ↦ mem_eigenspace_iff.mpr ?_) (f.genEigenspace μ |>.mono ?_)\n · apply apply_eq_of_mem_of_comm_of_isFinitelySemisimple_of_isNil hm rfl hf\n simp\n · exact Order.one_le_iff_pos.mpr hk","hard_negative":true,"metrics":{"chosen_tokens":41,"rejected_tokens":2,"token_jaccard":0.032258,"token_length_ratio":0.04878},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"2d57821c85ea8ba587c8442aaca09046c641c61cc8097adb55206ce187fb4f9b","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Eigenspace.Basic\npublic import Mathlib.LinearAlgebra.Eigenspace.Triangularizable\npublic import Mathlib.LinearAlgebra.Semisimple\n\nNamespace:\nModule.End\n\nLocal context:\n/-\nCopyright (c) 2024 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Eigenspaces of semisimple linear endomorphisms\n\nThis file contains basic results relevant to the study of eigenspaces of semisimple linear\nendomorphisms.\n\n## Main definitions / results\n\n* `Module.End.IsFinitelySemisimple.genEigenspace_eq_eigenspace`: for a semisimple endomorphism,\n a generalized eigenspace is an eigenspace.\n* `Module.End.IsSemisimple.iSup_eigenspace_eq_top`: over an algebraically closed field,\n the eigenspaces of a semisimple endomorphism span the whole space.\n* `Module.End.IsSemisimple.eq_zero_iff_forall_eigenvalue`: a semisimple endomorphism over\n an algebraically closed field is zero iff all eigenvalues are zero.\n\n-/\n\npublic section\n\nopen Function Set\n\nnamespace Module.End\n\nvariable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] {f g : End R M}\n\nlemma apply_eq_of_mem_of_comm_of_isFinitelySemisimple_of_isNil\n {μ : R} {k : ℕ∞} {m : M} (hm : m ∈ f.genEigenspace μ k)\n (hfg : Commute f g) (hss : g.IsFinitelySemisimple) (hnil : IsNilpotent (f - g)) :\n g m = μ • m := by\n rw [f.mem_genEigenspace] at hm\n obtain ⟨l, -, hm⟩ := hm\n rw [← f.mem_genEigenspace_nat] at hm\n set p := f.genEigenspace μ l\n have h₁ : MapsTo g p p := mapsTo_genEigenspace_of_comm hfg μ l\n have h₂ : MapsTo (g - algebraMap R (End R M) μ) p p :=\n mapsTo_genEigenspace_of_comm (hfg.sub_right <| Algebra.commute_algebraMap_right μ f) μ l\n have h₃ : MapsTo (f - g) p p :=\n mapsTo_genEigenspace_of_comm (Commute.sub_right rfl hfg) μ l\n have h₄ : MapsTo (f - algebraMap R (End R M) μ) p p :=\n mapsTo_genEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ l\n replace hfg : Commute (f - algebraMap R (End R M) μ) (f - g) :=\n (Commute.sub_right rfl hfg).sub_left <| Algebra.commute_algebraMap_left μ (f - g)\n suffices IsNilpotent ((g - algebraMap R (End R M) μ).restrict h₂) by\n replace this : g.restrict h₁ - algebraMap R (End R p) μ = 0 :=\n eq_zero_of_isNilpotent_of_isFinitelySemisimple this (by simpa using hss.restrict _)\n simpa [LinearMap.restrict_apply, sub_eq_zero] using LinearMap.congr_fun this ⟨m, hm⟩\n simpa [LinearMap.restrict_sub h₄ h₃] using (LinearMap.restrict_commute hfg h₄ h₃).isNilpotent_sub\n (f.isNilpotent_restrict_sub_algebraMap μ l) (Module.End.isNilpotent.restrict h₃ hnil)\n\nTarget:\nlemma IsFinitelySemisimple.genEigenspace_eq_eigenspace\n (hf : f.IsFinitelySemisimple) (μ : R) {k : ℕ∞} (hk : 0 < k) :\n f.genEigenspace μ k = f.eigenspace μ :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_fb5d05e1c691","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"ab38a7c96b7f4e97e3aaab898d6648d7ca347ee7d3fac8de26df96c82ae48bd4","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Eigenspace","family_id":"isfinitelysemisimple","file_id":"mathlib/Mathlib/LinearAlgebra/Eigenspace/Semisimple.lean","sample_id":"fb5d05e1c691263e6393a77e6911275e45ee8c79ddf11e44423f0af313684105"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b8d1db559ed288931688616e45bd02cafe9b1c740aa4a316f84ac74fadc1c00b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"5f5e11bafd29c1492084efefb2f57eace02f504e0597ae9279dc244be57bcca1","source_sha256":"7b41359792b40f76bcf80d23a2f7b1f052f8b7ecd79ed0b1b094081cc7b863dd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n subst_hom_lift p f' φ'; clear a b R S\n have : p.IsHomLift (g ≫ f) φ' := (hf' ▸ inferInstance)\n apply IsStronglyCartesian.universal_property' f","hard_negative":false,"metrics":{"chosen_tokens":35,"rejected_tokens":3,"token_jaccard":0.033333,"token_length_ratio":0.085714},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"2e101c8d2511dea4cddfee548999f01e680ff57bb46a1da97325b4c806330e95","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.FiberedCategory.HomLift\n\nNamespace:\nCategoryTheory.Functor.IsStronglyCartesian\n\nLocal context:\n/-\nCopyright (c) 2024 Calle Sönne. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Paul Lezeau, Calle Sönne\n-/\n/-!\n# Cartesian morphisms\n\nThis file defines Cartesian resp. strongly Cartesian morphisms with respect to a functor\n`p : 𝒳 ⥤ 𝒮`.\n\nThis file has been adapted to `Mathlib/CategoryTheory/FiberedCategory/Cocartesian.lean`,\nplease try to change them in sync.\n\n## Main definitions\n\n`IsCartesian p f φ` expresses that `φ` is a Cartesian morphism lying over `f` with respect to `p` in\nthe sense of SGA 1 VI 5.1. This means that for any morphism `φ' : a' ⟶ b` lying over `f` there is\na unique morphism `τ : a' ⟶ a` lying over `𝟙 R`, such that `φ' = τ ≫ φ`.\n\n`IsStronglyCartesian p f φ` expresses that `φ` is a strongly Cartesian morphism lying over `f` with\nrespect to `p`, see .\n\n## Implementation\n\nThe constructor of `IsStronglyCartesian` has been named `universal_property'`, and is mainly\nintended to be used for constructing instances of this class. To use the universal property, we\ngenerally recommended to use the lemma `IsStronglyCartesian.universal_property` instead. The\ndifference between the two is that the latter is more flexible with respect to non-definitional\nequalities.\n\n## References\n* [A. Grothendieck, M. Raynaud, *SGA 1*](https://arxiv.org/abs/math/0206203)\n* [Stacks: Fibred Categories](https://stacks.math.columbia.edu/tag/02XJ)\n-/\n\n@[expose] public section\n\nuniverse v₁ v₂ u₁ u₂\n\nopen CategoryTheory Functor Category IsHomLift\n\nnamespace CategoryTheory.Functor\n\nvariable {𝒮 : Type u₁} {𝒳 : Type u₂} [Category.{v₁} 𝒮] [Category.{v₂} 𝒳] (p : 𝒳 ⥤ 𝒮)\n\nsection\n\nvariable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b)\n\n/-- A morphism `φ : a ⟶ b` in `𝒳` lying over `f : R ⟶ S` in `𝒮` is Cartesian if for all\nmorphisms `φ' : a' ⟶ b`, also lying over `f`, there exists a unique morphism `χ : a' ⟶ a` lifting\n`𝟙 R` such that `φ' = χ ≫ φ`.\n\nSee SGA 1 VI 5.1. -/\nclass IsCartesian : Prop where\n [toIsHomLift : IsHomLift p f φ]\n universal_property {a' : 𝒳} (φ' : a' ⟶ b) [IsHomLift p f φ'] :\n ∃! χ : a' ⟶ a, IsHomLift p (𝟙 R) χ ∧ χ ≫ φ = φ'\nattribute [instance] IsCartesian.toIsHomLift\n\n/-- A morphism `φ : a ⟶ b` in `𝒳` lying over `f : R ⟶ S` in `𝒮` is strongly Cartesian if for\nall morphisms `φ' : a' ⟶ b` and all diagrams of the form\n```\na' a --φ--> b\n| | |\nv v v\nR' --g--> R --f--> S\n```\nsuch that `φ'` lifts `g ≫ f`, there exists a lift `χ` of `g` such that `φ' = χ ≫ φ`. -/\n@[stacks 02XK]\nclass IsStronglyCartesian : Prop where\n [toIsHomLift : IsHomLift p f φ]\n universal_property' {a' : 𝒳} (g : p.obj a' ⟶ R) (φ' : a' ⟶ b) [IsHomLift p (g ≫ f) φ'] :\n ∃! χ : a' ⟶ a, IsHomLift p g χ ∧ χ ≫ φ = φ'\nattribute [instance] IsStronglyCartesian.toIsHomLift\n\nend\n\nnamespace IsCartesian\n\nvariable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b) [IsCartesian p f φ]\n\nsection\n\nvariable {a' : 𝒳} (φ' : a' ⟶ b) [IsHomLift p f φ']\n\n/-- Given a Cartesian morphism `φ : a ⟶ b` lying over `f : R ⟶ S` in `𝒳`, and another morphism\n`φ' : a' ⟶ b` which also lifts `f`, then `IsCartesian.map f φ φ'` is the morphism `a' ⟶ a` lifting\n`𝟙 R` obtained from the universal property of `φ`. -/\nprotected noncomputable def map : a' ⟶ a :=\n Classical.choose <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ'\n\ninstance map_isHomLift : IsHomLift p (𝟙 R) (IsCartesian.map p f φ φ') :=\n (Classical.choose_spec <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ').1.1\n\n@[reassoc (attr := simp)]\nlemma fac : IsCartesian.map p f φ φ' ≫ φ = φ' :=\n (Classical.choose_spec <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ').1.2\n\n/-- Given a Cartesian morphism `φ : a ⟶ b` lying over `f : R ⟶ S` in `𝒳`, and another morphism\n`φ' : a' ⟶ b` which also lifts `f`. Then any morphism `ψ : a' ⟶ a` lifting `𝟙 R` such that\n`g ≫ ψ = φ'` must equal the map induced from the universal property of `φ`. -/\nlemma map_uniq (ψ : a' ⟶ a) [IsHomLift p (𝟙 R) ψ] (hψ : ψ ≫ φ = φ') :\n ψ = IsCartesian.map p f φ φ' :=\n (Classical.choose_spec <| IsCartesian.universal_property (p := p) (f := f) (φ := φ) φ').2\n ψ ⟨inferInstance, hψ⟩\n\nend\n\n/-- Given a Cartesian morphism `φ : a ⟶ b` lying over `f : R ⟶ S` in `𝒳`, and two morphisms\n`ψ ψ' : a' ⟶ a` such that `ψ ≫ φ = ψ' ≫ φ`. Then we must have `ψ = ψ'`. -/\nprotected lemma ext (φ : a ⟶ b) [IsCartesian p f φ] {a' : 𝒳} (ψ ψ' : a' ⟶ a)\n [IsHomLift p (𝟙 R) ψ] [IsHomLift p (𝟙 R) ψ'] (h : ψ ≫ φ = ψ' ≫ φ) : ψ = ψ' := by\n rw [map_uniq p f φ (ψ ≫ φ) ψ rfl, map_uniq p f φ (ψ ≫ φ) ψ' h.symm]\n\n@[simp]\nlemma map_self : IsCartesian.map p f φ φ = 𝟙 a := by\n subst_hom_lift p f φ; symm\n apply map_uniq\n simp only [id_comp]\n\ninstance of_comp_iso {b' : 𝒳} (φ' : b ≅ b') [IsHomLift p (𝟙 S) φ'.hom] :\n IsCartesian p f (φ ≫ φ'.hom) where\n universal_property := by\n intro c ψ hψ\n use IsCartesian.map p f φ (ψ ≫ φ'.inv)\n refine ⟨⟨inferInstance, by simp only [fac_assoc, assoc, Iso.inv_hom_id, comp_id]⟩, ?_⟩\n rintro τ ⟨hτ₁, hτ₂⟩\n apply map_uniq\n rw [Iso.eq_comp_inv]\n simp only [assoc, hτ₂]\n\n/-- The canonical isomorphism between the domains of two Cartesian arrows\nlying over the same object. -/\n@[simps]\nnoncomputable def domainUniqueUpToIso {a' : 𝒳} (φ' : a' ⟶ b) [IsCartesian p f φ'] : a' ≅ a where\n hom := IsCartesian.map p f φ φ'\n inv := IsCartesian.map p f φ' φ\n hom_inv_id := by\n subst_hom_lift p f φ'\n apply IsCartesian.ext p (p.map φ') φ'\n simp only [assoc, fac, id_comp]\n inv_hom_id := by\n subst_hom_lift p f φ\n apply IsCartesian.ext p (p.map φ) φ\n simp only [assoc, fac, id_comp]\n\ninstance domainUniqueUpToIso_inv_isHomLift {a' : 𝒳} (φ' : a' ⟶ b) [IsCartesian p f φ'] :\n IsHomLift p (𝟙 R) (domainUniqueUpToIso p f φ φ').hom :=\n domainUniqueUpToIso_hom p f φ φ' ▸ IsCartesian.map_isHomLift p f φ φ'\n\ninstance domainUniqueUpToIso_hom_isHomLift {a' : 𝒳} (φ' : a' ⟶ b) [IsCartesian p f φ'] :\n IsHomLift p (𝟙 R) (domainUniqueUpToIso p f φ φ').inv :=\n domainUniqueUpToIso_inv p f φ φ' ▸ IsCartesian.map_isHomLift p f φ' φ\n\n/-- Precomposing a Cartesian morphism with an isomorphism lifting the identity is Cartesian. -/\ninstance of_iso_comp {a' : 𝒳} (φ' : a' ≅ a) [IsHomLift p (𝟙 R) φ'.hom] :\n IsCartesian p f (φ'.hom ≫ φ) where\n universal_property := by\n intro c ψ hψ\n use IsCartesian.map p f φ ψ ≫ φ'.inv\n refine ⟨⟨inferInstance, by simp⟩, ?_⟩\n rintro τ ⟨hτ₁, hτ₂⟩\n rw [Iso.eq_comp_inv]\n apply map_uniq\n simp only [assoc, hτ₂]\n\nend IsCartesian\n\nnamespace IsStronglyCartesian\n\nsection\n\nvariable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b) [IsStronglyCartesian p f φ]\n\n/-- The universal property of a strongly Cartesian morphism.\n\nThis lemma is more flexible with respect to non-definitional equalities than the field\n`universal_property'` of `IsStronglyCartesian`. -/\n\nTarget:\nlemma universal_property {R' : 𝒮} {a' : 𝒳} (g : R' ⟶ R) (f' : R' ⟶ S) (hf' : f' = g ≫ f)\n (φ' : a' ⟶ b) [IsHomLift p f' φ'] : ∃! χ : a' ⟶ a, IsHomLift p g χ ∧ χ ≫ φ = φ' :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/FiberedCategory","family_id":"universal_property","file_id":"mathlib/Mathlib/CategoryTheory/FiberedCategory/Cartesian.lean","sample_id":"5f5e11bafd29c1492084efefb2f57eace02f504e0597ae9279dc244be57bcca1"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c120e07c261cd67269cea538f4c7ccb1bc3a2527d99f089de93bbe04845d9af0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"48fb0d81c7cb107daa4ea6d8bbdbb652fcedec704183806206a7a995d2807d7c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"fd45dddb8988ba3b9116f4f7b98fb641ee4cd9d3cf5b927e3a4de51bd4ee0673","source_sha256":"23a89f22442052ad0849b9a7e975a80ac54445633e48bc3ba85a63e141112a3b","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n constructor\n · intro h x\n have := (forget C X ⋙ stalkFunctor C x).exact_tfae.out 2 1\n exact this.mp inferInstance S h\n intro h\n simp_rw [ShortComplex.exact_iff_isZero_homology] at h\n rw [ShortComplex.exact_iff_isZero_homology, isZero_iff_stalkFunctor_obj_isZero S.homology]\n exact fun x => (h x).of_iso\n (ShortComplex.mapHomologyIso S (forget C X ⋙ stalkFunctor C x)).symm","hard_negative":false,"metrics":{"chosen_tokens":78,"rejected_tokens":85,"token_jaccard":0.952381,"token_length_ratio":1.089744},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"2ec350dd3fe04e90f1e7aba3c09462dfa267d7be03f77037152907702c8de784","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Category.Grp.AB\npublic import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Sheaf\npublic import Mathlib.CategoryTheory.Functor.ReflectsIso.Balanced\npublic import Mathlib.Topology.Sheaves.Limits\npublic import Mathlib.Topology.Sheaves.Skyscraper\n\nNamespace:\nTopCat.Sheaf\n\nLocal context:\n/-\nCopyright (c) 2026 Brian Nugent. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Brian Nugent\n-/\n/-!\n# Sheaves over Abelian categories\nWe provide instances for categories of sheaves over Abelian categories.\n\n## Main Results\n\n* `TopCat.Sheaf.exact_iff_stalkFunctor_map_exact`: A complex of sheaves over a concrete abelian\n category is exact if and only if it is exact on stalks.\n\n-/\n\npublic section\n\nuniverse u v v₁ v₂\n\nopen TopologicalSpace CategoryTheory Limits\n\nnamespace TopCat\n\nvariable {X : TopCat.{u}}\n\nsection\n\nvariable {C : Type v₁} [Category.{v₂} C] [HasSheafify (Opens.grothendieckTopology X) C] [Abelian C]\n\nnoncomputable instance : Abelian (Presheaf C X) := inferInstanceAs (Abelian (_ ⥤ _))\n\nnamespace Sheaf\n\nnoncomputable instance : Abelian (Sheaf C X) :=\n inferInstanceAs (Abelian (CategoryTheory.Sheaf _ _))\n\ninstance : (Sheaf.forget C X).Additive where\n\ninstance {D : Type*} [Category.{u} D] [Abelian D] [IsGrothendieckAbelian.{u} D]\n [HasSheafify (Opens.grothendieckTopology X) D] : IsGrothendieckAbelian.{u} (Sheaf D X) :=\n inferInstanceAs (IsGrothendieckAbelian (CategoryTheory.Sheaf _ _))\n\nend Sheaf\n\nend\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The stalk functor is additive -/\ninstance (p₀ : X) {C : Type v} [Category.{u} C] [Abelian C] [HasColimits C] :\n (Presheaf.stalkFunctor C p₀).Additive := by\n dsimp [Presheaf.stalkFunctor]\n have : ((Functor.whiskeringLeft _ _ C).obj (OpenNhds.inclusion p₀).op).Additive := ⟨by cat_disch⟩\n infer_instance\n\nnamespace Sheaf\n\nopen Presheaf\n\nvariable {C : Type v} [Category.{u} C] [HasColimits C] [HasLimits C]\n {FC : C → C → Type*} {CC : C → Type u} [∀ X Y, FunLike (FC X Y) (CC X) (CC Y)]\n [instCC : ConcreteCategory C FC] [PreservesFilteredColimits (CategoryTheory.forget C)]\n [PreservesLimits (CategoryTheory.forget C)] [Abelian C]\n {X : TopCat.{u}} (p₀ : X)\n\ninstance : Limits.PreservesFiniteLimits (forget C X ⋙ stalkFunctor C p₀) :=\n have : (forget C X ⋙ stalkFunctor C p₀).PreservesHomology := by\n simp only [(forget C X ⋙ stalkFunctor C p₀).exact_tfae.out 2 0]\n intro S h\n have := ((forget C X ⋙ stalkFunctor C p₀).preservesFiniteColimits_tfae.out 3 0).mp\n (inferInstance : (PreservesFiniteColimits _))\n refine ShortComplex.ShortExact.mk' (this S h).left ?_ (this S h).right\n have := h.2\n exact Functor.map_mono (forget C X ⋙ stalkFunctor C p₀) _\n (forget C X ⋙ stalkFunctor C p₀).preservesFiniteLimits_of_preservesHomology\n\nopen ZeroObject\n\ninclude instCC in\n/-- A sheaf is zero if and only if its stalks are all zero. -/\nlemma isZero_iff_stalkFunctor_obj_isZero (F : Sheaf C X) :\n IsZero F ↔ ∀ x : X, IsZero ((forget C X ⋙ stalkFunctor C x).obj F) := by\n refine ⟨fun h _ => Functor.map_isZero _ h, ?_⟩\n intro h\n let f : F ⟶ 0 := (isZero_zero (Sheaf C X)).from_ F\n have : IsIso f := by\n rw [Presheaf.isIso_iff_stalkFunctor_map_iso]\n exact fun x => isIso_of_source_target_iso_zero _ (h x).isoZero\n ((forget C X ⋙ stalkFunctor C x).map_isZero (isZero_zero _)).isoZero\n exact (isZero_zero _).of_iso (asIso f)\n\ninclude instCC in\n/-- Exactness can be checked on stalks for complexes of sheaves. -/\n\nTarget:\ntheorem exact_iff_stalkFunctor_map_exact (S : ShortComplex (Sheaf C X)) :\n S.Exact ↔ ∀ x : X, (S.map (forget C X ⋙ stalkFunctor C x)).Exact :=\n\nProof body:\n","rejected":"```lean\nby\n constructor\n · intro h x\n have := (forget C X ⋙ stalkFunctor C x).exact_tfae.out 2 1\n exact this.mp inferInstance S h\n intro h\n simp_rw [ShortComplex.exact_iff_isZero_homology] at h\n rw [ShortComplex.exact_iff_isZero_homology, isZero_iff_stalkFunctor_obj_isZero S.homology]\n exact fun x => (h x).of_iso\n (ShortComplex.mapHomologyIso S (forget C X ⋙ stalkFunctor C x)).symm\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Sheaves","family_id":"exact_iff_stalkfunctor_map_exact","file_id":"mathlib/Mathlib/Topology/Sheaves/Abelian.lean","sample_id":"fd45dddb8988ba3b9116f4f7b98fb641ee4cd9d3cf5b927e3a4de51bd4ee0673"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3569f9995c2f461be224720681d9bacc336a2e6c2c89a7c63108e6bccdf4c0b9","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"7183e8b187c9d498915fddc9bc981a72f278fe4e7abba490b001a4db4c6ea6d1","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"07c876892178670acdeeaab7ec0d3ad63e5a2e38d1a63ac2e7af11a1da270537","source_sha256":"f490af4c1079c734f5d4f0c49ae6b1779c2dfde5bdc100f11e3ed4a71ecf708a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [h.1]","hard_negative":true,"metrics":{"chosen_tokens":7,"rejected_tokens":5,"token_jaccard":0.2,"token_length_ratio":0.714286},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"2f35e87d0bfa79f9a992c84b011abd6d0af13f44c542b1056b7353805ab811c1","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Order.Ring.Nat\npublic import Mathlib.Data.Nat.Dist\npublic import Mathlib.Data.Ordmap.Ordnode\npublic import Mathlib.Tactic.Abel\n\nNamespace:\nOrdnode\n\nLocal context:\n/-\nCopyright (c) 2017 Mario Carneiro. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Mario Carneiro\n-/\n/-!\n# Invariants for the verification of `Ordnode`\n\nAn `Ordnode`, defined in `Mathlib/Data/Ordmap/Ordnode.lean`, is an inductive type which describes a\ntree which stores the `size` at internal nodes.\n\nIn this file we define the correctness invariant of an `Ordnode`, comprising:\n\n* `Ordnode.Sized t`: All internal `size` fields must match the actual measured\n size of the tree. (This is not hard to satisfy.)\n* `Ordnode.Balanced t`: Unless the tree has the form `()` or `((a) b)` or `(a (b))`\n (that is, nil or a single singleton subtree), the two subtrees must satisfy\n `size l ≤ δ * size r` and `size r ≤ δ * size l`, where `δ := 3` is a global\n parameter of the data structure (and this property must hold recursively at subtrees).\n This is why we say this is a \"size balanced tree\" data structure.\n* `Ordnode.Bounded lo hi t`: The members of the tree must be in strictly increasing order,\n meaning that if `a` is in the left subtree and `b` is the root, then `a ≤ b` and\n `¬(b ≤ a)`. We enforce this using `Ordnode.Bounded` which includes also a global\n upper and lower bound.\n\nThis whole file is in the `Ordnode` namespace, because we first have to prove the correctness of\nall the operations (and defining what correctness means here is somewhat subtle).\nThe actual `Ordset` operations are in `Mathlib/Data/Ordmap/Ordset.lean`.\n\n## TODO\n\nThis file is incomplete, in the sense that the intent is to have verified\nversions and lemmas about all the definitions in `Ordnode.lean`, but at the moment only\na few operations are verified (the hard part should be out of the way, but still).\nContributors are encouraged to pick this up and finish the job, if it appeals to you.\n\n## Tags\n\nordered map, ordered set, data structure, verified programming\n-/\n\n@[expose] public section\n\n\nvariable {α : Type*}\n\nnamespace Ordnode\n\n/-! ### delta and ratio -/\n\n\ntheorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 :=\n not_le_of_gt H\n\ntheorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False :=\n not_le_of_gt (lt_trans (mul_lt_mul_of_pos_left h₁ <| by decide) h₂) <| by\n simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta)\n\n/-! ### `singleton` -/\n\n\n/-! ### `size` and `empty` -/\n\n\n/-- O(n). Computes the actual number of elements in the set, ignoring the cached `size` field. -/\ndef realSize : Ordnode α → ℕ\n | nil => 0\n | node _ l _ r => realSize l + realSize r + 1\n\n/-! ### `Sized` -/\n\n\n/-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the\nrespective subtrees. -/\ndef Sized : Ordnode α → Prop\n | nil => True\n | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r\n\ntheorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) :=\n ⟨rfl, hl, hr⟩\n\nTarget:\ntheorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r :=\n\nProof body:\n","rejected":"by\n exact Sized.eq_node","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"aaaba38536efa2dd478c61c0817bc2cf56f687b79c6e9f25bf3f66ec8cd9ecf8","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Ordmap","family_id":"sized","file_id":"mathlib/Mathlib/Data/Ordmap/Invariants.lean","sample_id":"07c876892178670acdeeaab7ec0d3ad63e5a2e38d1a63ac2e7af11a1da270537"},"split":"validation"} {"binding":{"chosen_proof_sha256":"12b867465765bd4788b2d1528e1b00d3edd8d271a080e6c4c48fad1872abe444","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"f737c4eafcf7cde903df04875325836e1223b80333863a297d0f7a725eb57cdf","source_sha256":"b241b4d50c8705f60930b08595330ff34c9b5c145562a6cf542e2e8a9982512f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n -- We use a standard ε / 2 argument to deduce the result from the approximation for\n -- continuous compactly supported functions.\n have hε₂ : 0 < ε / 2 := by positivity\n have hε₂' : 0 < ENNReal.ofReal (ε / 2) := by positivity\n obtain ⟨g, hg₁, hg₂, hg₃, hg₄⟩ := hf.exists_hasCompactSupport_eLpNorm_sub_le hp hε₂'.ne'\n obtain ⟨g', hg'₁, hg'₂, hg'₃⟩ := hg₁.exist_eLpNorm_sub_le_of_continuous μ hε₂ hg₃\n refine ⟨g', hg'₁, hg'₂, ?_⟩\n have : f - g' = (f - g) - (g' - g) := by simp\n grw [this, eLpNorm_sub_le (hf.aestronglyMeasurable.sub hg₄.aestronglyMeasurable)\n (hg'₂.continuous.aestronglyMeasurable.sub hg₄.aestronglyMeasurable) hp₂, hg₂,\n eLpNorm_sub_comm, hg'₃, ← ENNReal.ofReal_add hε₂.le hε₂.le, add_halves]","hard_negative":true,"metrics":{"chosen_tokens":200,"rejected_tokens":8,"token_jaccard":0.054795,"token_length_ratio":0.04},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"2fd4bc33854ff89bcde8fc0ed635518a9722c8042a459a12becb41bffdbc47f1","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Calculus.ContDiff.Defs\npublic import Mathlib.LinearAlgebra.FiniteDimensional.Defs\npublic import Mathlib.MeasureTheory.Function.LpSpace.Basic\nimport Mathlib.Geometry.Manifold.SmoothApprox\nimport Mathlib.MeasureTheory.Function.ContinuousMapDense\n\nNamespace:\nMeasureTheory.MemLp\n\nLocal context:\n/-\nCopyright (c) 2025 Moritz Doll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Moritz Doll\n-/\n/-!\n\n# Density of smooth compactly supported functions in `Lp`\n\nIn this file, we prove that `Lp` functions can be approximated by smooth compactly supported\nfunctions for `p < ∞`.\n\nThis result is recorded in `MeasureTheory.MemLp.exist_sub_eLpNorm_le`.\n-/\n\npublic section\n\nvariable {α β E F : Type*} [MeasurableSpace E] [NormedAddCommGroup F]\n\nopen scoped Nat NNReal ContDiff\nopen MeasureTheory Pointwise ENNReal\n\nnamespace HasCompactSupport\n\nvariable [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [BorelSpace E]\n [NormedSpace ℝ F]\n\n/-- For every continuous compactly supported function `f` there exists a smooth compactly supported\nfunction `g` such that `f - g` is arbitrary small in the `Lp`-norm for `p < ∞`. -/\ntheorem exist_eLpNorm_sub_le_of_continuous (μ : Measure E := by volume_tac)\n [IsFiniteMeasureOnCompacts μ] {p : ℝ≥0∞} {ε : ℝ} (hε : 0 < ε) {f : E → F}\n (h₁ : HasCompactSupport f) (h₂ : Continuous f) :\n ∃ (g : E → F), HasCompactSupport g ∧ ContDiff ℝ ∞ g ∧\n eLpNorm (f - g) p μ ≤ ENNReal.ofReal ε := by\n rcases eq_or_ne p ∞ with rfl | hp\n · obtain ⟨g, hg₁, hg₂, hg₃⟩ := h₂.exists_contDiff_approx ⊤ (ε := fun _ ↦ ε) (by fun_prop)\n (by intro; positivity)\n refine ⟨g, h₁.mono hg₃, hg₁, eLpNormEssSup_le_of_ae_bound (.of_forall fun x ↦ ?_)⟩\n simpa [← dist_eq_norm_sub'] using (hg₂ x).le\n by_cases hf : f =ᵐ[μ] 0\n -- We will need that the support is non-empty, so we treat the trivial case `f = 0` first.\n · use 0\n simpa [HasCompactSupport.zero, eLpNorm_congr_ae hf] using! contDiff_const\n have hs₁ : μ (tsupport f) ≠ ⊤ := h₁.measure_lt_top.ne\n have hs₂ : 0 < (μ <| tsupport f).toReal := by\n -- Since `f` is not the zero function `tsupport f` has positive measure\n rw [← Measure.measure_support_eq_zero_iff _] at hf\n exact toReal_pos (pos_mono (subset_tsupport f) (pos_of_ne_zero hf)).ne' hs₁\n set ε' := ε * (μ <| tsupport f).toReal ^ (-(1 / p.toReal)) with ε'_def\n have hε' : 0 < ε' := by positivity\n have hε₂ : ENNReal.ofReal ε' * μ (tsupport f) ^ (1 / p.toReal) ≤ ENNReal.ofReal ε := by\n rw [← ofReal_toReal hs₁, ofReal_rpow_of_pos hs₂, ← ofReal_mul hε'.le,\n ofReal_le_ofReal_iff hε.le, ε'_def, mul_assoc, ← Real.rpow_add hs₂, neg_add_cancel,\n Real.rpow_zero, mul_one]\n obtain ⟨g, hg₁, hg₂, hg₃⟩ := h₂.exists_contDiff_approx ⊤ (ε := fun _ ↦ ε') (by fun_prop)\n (by intro; positivity)\n refine ⟨g, h₁.mono hg₃, hg₁, (eLpNorm_sub_le_of_dist_bdd μ hp h₁.measurableSet hε'.le ?_\n (subset_tsupport f) (hg₃.trans (subset_tsupport f))).trans hε₂⟩\n intro x\n rw [dist_comm]\n exact (hg₂ x).le\n\nend HasCompactSupport\n\nnamespace MeasureTheory.MemLp\n\nvariable [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [BorelSpace E]\n [NormedSpace ℝ F]\n {μ : Measure E} [IsFiniteMeasureOnCompacts μ]\n\n/-- Every `Lp` function can be approximated by a smooth compactly supported function provided that\n`p < ∞`. -/\n\nTarget:\ntheorem exist_eLpNorm_sub_le {p : ℝ≥0∞} (hp : p ≠ ⊤) (hp₂ : 1 ≤ p) {f : E → F} (hf : MemLp f p μ)\n {ε : ℝ} (hε : 0 < ε) :\n ∃ g, HasCompactSupport g ∧ ContDiff ℝ ∞ g ∧ eLpNorm (f - g) p μ ≤ ENNReal.ofReal ε :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"22601c9abb6d10b26f322da1e1f43c23a2f4ea3474cdd65b6d53133dac2b98ca","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Normed","family_id":"exist_elpnorm_sub_le","file_id":"mathlib/Mathlib/Analysis/Normed/Lp/SmoothApprox.lean","sample_id":"f737c4eafcf7cde903df04875325836e1223b80333863a297d0f7a725eb57cdf"},"split":"validation"} {"binding":{"chosen_proof_sha256":"10ba54006687c2b7e6f732fee598b0c4a553147a83075f347459d76efce387f4","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"bb32eeceb35808a1f2940c13997c6ce296a70cb58a3c8dd0b256d43fe285be66","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e0350996ace6f5bb6ffdfea13052fe1c261fffef52814e8799c3ea28bbca08fa","source_sha256":"bb71b66c224daa22efed5bcd0fc9ee7f7a942970f55bb7db3d3841c492eaec13","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n unfold partialSum\n fun_prop","hard_negative":true,"metrics":{"chosen_tokens":4,"rejected_tokens":2,"token_jaccard":0.2,"token_length_ratio":0.5},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"31aaccd5dbc0bc3f6af03a1b9f67a7504a7acc29982d2e64bdb5904664afb690","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Calculus.FormalMultilinearSeries\npublic import Mathlib.Analysis.SpecificLimits.Normed\n\nNamespace:\nFormalMultilinearSeries\n\nLocal context:\n/-\nCopyright (c) 2020 Sébastien Gouëzel. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Sébastien Gouëzel, Yury Kudryashov\n-/\n/-!\n# Radius of convergence of a power series\n\nThis file introduces the notion of the radius of convergence of a power series.\n\n## Main definitions\n\nLet `p` be a formal multilinear series from `E` to `F`, i.e., `p n` is a multilinear map on `E^n`\nfor `n : ℕ`.\n\n* `p.radius`: the largest `r : ℝ≥0∞` such that `‖p n‖ * r^n` grows subexponentially.\n* `p.le_radius_of_bound`, `p.le_radius_of_bound_nnreal`, `p.le_radius_of_isBigO`: if `‖p n‖ * r ^ n`\n is bounded above, then `r ≤ p.radius`;\n* `p.isLittleO_of_lt_radius`, `p.norm_mul_pow_le_mul_pow_of_lt_radius`,\n `p.isLittleO_one_of_lt_radius`,\n `p.norm_mul_pow_le_of_lt_radius`, `p.nnnorm_mul_pow_le_of_lt_radius`: if `r < p.radius`, then\n `‖p n‖ * r ^ n` tends to zero exponentially;\n* `p.lt_radius_of_isBigO`: if `r ≠ 0` and `‖p n‖ * r ^ n = O(a ^ n)` for some `-1 < a < 1`, then\n `r < p.radius`;\n* `p.partialSum n x`: the sum `∑_{i = 0}^{n-1} pᵢ xⁱ`.\n* `p.sum x`: the sum `∑'_{i = 0}^{∞} pᵢ xⁱ`.\n\n## Implementation details\n\nWe only introduce the radius of convergence of a power series, as `p.radius`.\nFor a power series in finitely many dimensions, there is a finer (directional, coordinate-dependent)\nnotion, describing the polydisk of convergence. This notion is more specific, and not necessary to\nbuild the general theory. We do not define it here.\n-/\n\n@[expose] public section\n\nnoncomputable section\n\nvariable {𝕜 E F G : Type*}\n\nopen Topology NNReal Filter ENNReal Set Asymptotics\nopen scoped Pointwise\n\nnamespace FormalMultilinearSeries\n\nvariable [Semiring 𝕜] [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F]\nvariable [TopologicalSpace E] [TopologicalSpace F]\nvariable [ContinuousAdd E] [ContinuousAdd F]\nvariable [ContinuousConstSMul 𝕜 E] [ContinuousConstSMul 𝕜 F]\n\n/-- Given a formal multilinear series `p` and a vector `x`, then `p.sum x` is the sum `Σ pₙ xⁿ`. A\npriori, it only behaves well when `‖x‖ < p.radius`. -/\nprotected def sum (p : FormalMultilinearSeries 𝕜 E F) (x : E) : F :=\n ∑' n : ℕ, p n fun _ => x\n\ntheorem sum_mem {S : Type*} {s : S} [SetLike S F] [AddSubmonoidClass S F]\n (h_closed : IsClosed (s : Set F)) (p : FormalMultilinearSeries 𝕜 E F) (x : E)\n (h : ∀ k, p k (fun _ : Fin k => x) ∈ s) :\n p.sum x ∈ s :=\n tsum_mem h_closed h\n\n/-- Given a formal multilinear series `p` and a vector `x`, then `p.partialSum n x` is the sum\n`Σ pₖ xᵏ` for `k ∈ {0,..., n-1}`. -/\ndef partialSum (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) (x : E) : F :=\n ∑ k ∈ Finset.range n, p k fun _ : Fin k => x\n\n/-- The partial sums of a formal multilinear series are continuous. -/\n\nTarget:\ntheorem partialSum_continuous (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :\n Continuous (p.partialSum n) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_e0350996ace6","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"d967bd6d0885f2b4637e984fec8d8dfc038ac88be84e1119a5ba68199efd3ade","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Analytic","family_id":"partialsum_continuous","file_id":"mathlib/Mathlib/Analysis/Analytic/ConvergenceRadius.lean","sample_id":"e0350996ace6f5bb6ffdfea13052fe1c261fffef52814e8799c3ea28bbca08fa"},"split":"validation"} {"binding":{"chosen_proof_sha256":"fb5dc0789692c1f3dd83aa85e8dac3ff1639f8dacb771677d6236aef176544dd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"fccdf4fd0295315b0e180e437b0d62564ce17e9003cd4718072237285590d530","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"be0f886f926c49126c6e084f51ebb26dfff9d4b6c035deb38fb27982b8fe0abe","source_sha256":"ce37053811c57628f9bd81f1b38b031dbcbd1939b1f8ff81c3cd361080cc2a0b","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa [Algebra.TensorProduct.one_def] using mul_antipode_rTensor_comul_apply (R := R) (1 : A)","hard_negative":true,"metrics":{"chosen_tokens":21,"rejected_tokens":3,"token_jaccard":0.052632,"token_length_ratio":0.142857},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"332ddb80561ad6d7bcbcc7ddc8e3c8984a66d0faaf942e9a0abb6cb3f25b3dd3","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Bialgebra.Basic\npublic import Mathlib.RingTheory.Coalgebra.Convolution\n\nNamespace:\nHopfAlgebra\n\nLocal context:\n/-\nCopyright (c) 2024 Ali Ramsey. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Ali Ramsey\n-/\n/-!\n# Hopf algebras\n\nIn this file we define `HopfAlgebra`, and provide instances for:\n\n* Commutative semirings: `CommSemiring.toHopfAlgebra`\n\n## Main definitions\n\n* `HopfAlgebra R A` : the Hopf algebra structure on an `R`-bialgebra `A`.\n* `HopfAlgebra.antipode` : the `R`-linear map `A →ₗ[R] A`.\n* `HopfAlgebra.ofConvInverse` : construct a Hopf algebra from a two-sided convolution inverse\n of the identity.\n* `HopfAlgebra.ofAlgHom` : the same for commutative `A`, with `AlgHom` hypotheses.\n\n## Main results\n\n* `HopfAlgebra.antipode_one` : the antipode of the unit is the unit.\n* `HopfAlgebra.antipode_mul` : the antipode is an antihomomorphism: `S(ab) = S(b)S(a)`.\n\n## TODO\n\n* Uniqueness of Hopf algebra structure on a bialgebra (i.e. if the algebra and coalgebra structures\n agree then the antipodes must also agree).\n\n* If `A` is commutative then `antipode` is an algebra homomorphism.\n\n* If `A` is commutative then `antipode` is necessarily a bijection and its square is\n the identity.\n\n(Note that all three facts have been proved for Hopf bimonoids in an arbitrary braided category,\nso we could deduce the facts here from an equivalence `HopfAlgCat R ≌ Hopf (ModuleCat R)`.)\n\n## References\n\n* \n\n* [C. Kassel, *Quantum Groups* (§III.3)][Kassel1995]\n\n\n-/\n\npublic section\n\nopen Bialgebra\n\nuniverse u v w\n\n/-- Isolates the antipode of a Hopf algebra, to allow API to be constructed before proving the\nHopf algebra axioms. See `HopfAlgebra` for documentation. -/\nclass HopfAlgebraStruct (R : Type u) (A : Type v) [CommSemiring R] [Semiring A]\n extends Bialgebra R A where\n /-- The antipode of the Hopf algebra. -/\n antipode (R) : A →ₗ[R] A\n\n/-- A Hopf algebra over a commutative (semi)ring `R` is a bialgebra over `R` equipped with an\n`R`-linear endomorphism `antipode` satisfying the antipode axioms. -/\nclass HopfAlgebra (R : Type u) (A : Type v) [CommSemiring R] [Semiring A] extends\n HopfAlgebraStruct R A where\n /-- One of the antipode axioms for a Hopf algebra. -/\n mul_antipode_rTensor_comul :\n LinearMap.mul' R A ∘ₗ antipode.rTensor A ∘ₗ comul = (Algebra.linearMap R A) ∘ₗ counit\n /-- One of the antipode axioms for a Hopf algebra. -/\n mul_antipode_lTensor_comul :\n LinearMap.mul' R A ∘ₗ antipode.lTensor A ∘ₗ comul = (Algebra.linearMap R A) ∘ₗ counit\n\nnamespace HopfAlgebra\n\nexport HopfAlgebraStruct (antipode)\n\nvariable {R : Type u} {A : Type v} {ι : Type*} [CommSemiring R] [Semiring A] [HopfAlgebra R A]\n {a : A}\n\n@[simp]\ntheorem mul_antipode_rTensor_comul_apply (a : A) :\n LinearMap.mul' R A ((antipode R).rTensor A (Coalgebra.comul a)) =\n algebraMap R A (Coalgebra.counit a) :=\n LinearMap.congr_fun mul_antipode_rTensor_comul a\n\n@[simp]\ntheorem mul_antipode_lTensor_comul_apply (a : A) :\n LinearMap.mul' R A ((antipode R).lTensor A (Coalgebra.comul a)) =\n algebraMap R A (Coalgebra.counit a) :=\n LinearMap.congr_fun mul_antipode_lTensor_comul a\n\n@[simp]\n\nTarget:\ntheorem antipode_one :\n HopfAlgebra.antipode R (1 : A) = 1 :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_be0f886f926c","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"acd1a3a48cdc2b49c6ffd5e58b8207e476e2f8a9343ccb2640e9e1b855240f9f","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/HopfAlgebra","family_id":"antipode_one","file_id":"mathlib/Mathlib/RingTheory/HopfAlgebra/Basic.lean","sample_id":"be0f886f926c49126c6e084f51ebb26dfff9d4b6c035deb38fb27982b8fe0abe"},"split":"validation"} {"binding":{"chosen_proof_sha256":"42ef2c7b63e4668d7678c6f88e876f724173a0548ef02c484242defea7ec90d9","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"cd5eefd2051037aa1d3cfc0ae07fc27231575ffdbfbd934224e5cb490f198640","source_sha256":"40b3fe35a4f6ee6eaf5570fa9a5773e90967e90bbd65a7f661f7a527d47b82ae","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [RightTotal, IsEmpty.forall_iff]","hard_negative":false,"metrics":{"chosen_tokens":10,"rejected_tokens":2,"token_jaccard":0.090909,"token_length_ratio":0.2},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"359bd5784a4f3ce8548b5baa9ff5068d75db5f3932bb6a2e5ee52f2bfb8bea24","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Logic.Function.Basic\npublic import Mathlib.Logic.IsEmpty.Defs\npublic import Mathlib.Logic.Relator\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Floris van Doorn. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Floris van Doorn\n-/\n/-!\nIn this file we prove some basic properties about the typeclass `IsEmpty`.\n-/\n\npublic section\n\nvariable {α β γ : Sort*}\n\n@[simp, push]\ntheorem not_nonempty_iff : ¬Nonempty α ↔ IsEmpty α :=\n ⟨fun h ↦ ⟨fun x ↦ h ⟨x⟩⟩, fun h1 h2 ↦ h2.elim h1.elim⟩\n\n@[simp, push]\ntheorem not_isEmpty_iff : ¬IsEmpty α ↔ Nonempty α :=\n not_iff_comm.mp not_nonempty_iff\n\n@[simp]\ntheorem isEmpty_Prop {p : Prop} : IsEmpty p ↔ ¬p := by\n simp only [← not_nonempty_iff, nonempty_prop]\n\n@[simp]\ntheorem isEmpty_pi {π : α → Sort*} : IsEmpty (∀ a, π a) ↔ ∃ a, IsEmpty (π a) := by\n simp only [← not_nonempty_iff, Classical.nonempty_pi, not_forall]\n\ntheorem isEmpty_fun : IsEmpty (α → β) ↔ Nonempty α ∧ IsEmpty β := by\n rw [isEmpty_pi, ← exists_true_iff_nonempty, ← exists_and_right, true_and]\n\n@[simp]\ntheorem nonempty_fun : Nonempty (α → β) ↔ IsEmpty α ∨ Nonempty β :=\n not_iff_not.mp <| by rw [not_or, not_nonempty_iff, not_nonempty_iff, isEmpty_fun, not_isEmpty_iff]\n\n@[simp]\ntheorem isEmpty_sigma {α} {E : α → Type*} : IsEmpty (Sigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_sigma, not_exists]\n\n@[simp]\ntheorem isEmpty_psigma {α} {E : α → Sort*} : IsEmpty (PSigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_psigma, not_exists]\n\ntheorem isEmpty_subtype (p : α → Prop) : IsEmpty (Subtype p) ↔ ∀ x, ¬p x := by\n simp only [← not_nonempty_iff, nonempty_subtype, not_exists]\n\n@[simp]\ntheorem isEmpty_prod {α β : Type*} : IsEmpty (α × β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_prod, not_and_or]\n\n@[simp]\ntheorem isEmpty_pprod : IsEmpty (PProd α β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_pprod, not_and_or]\n\n@[simp]\ntheorem isEmpty_sum {α β} : IsEmpty (α ⊕ β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_sum, not_or]\n\n@[simp]\ntheorem isEmpty_psum {α β} : IsEmpty (α ⊕' β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_psum, not_or]\n\n@[simp]\ntheorem isEmpty_ulift {α} : IsEmpty (ULift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_ulift]\n\n@[simp]\ntheorem isEmpty_plift {α} : IsEmpty (PLift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_plift]\n\ntheorem wellFounded_of_isEmpty {α} [IsEmpty α] (r : α → α → Prop) : WellFounded r :=\n ⟨isEmptyElim⟩\n\nvariable (α)\n\ntheorem isEmpty_or_nonempty : IsEmpty α ∨ Nonempty α :=\n (em <| IsEmpty α).elim Or.inl <| Or.inr ∘ not_isEmpty_iff.mp\n\n@[simp]\ntheorem not_isEmpty_of_nonempty [h : Nonempty α] : ¬IsEmpty α :=\n not_isEmpty_iff.mpr h\n\nvariable {α}\n\ntheorem Function.extend_of_isEmpty [IsEmpty α] (f : α → β) (g : α → γ) (h : β → γ) :\n Function.extend f g h = h :=\n funext fun _ ↦ (Function.extend_apply' _ _ _) fun ⟨a, _⟩ ↦ isEmptyElim a\n\nopen Relator\n\nvariable {α β : Type*} (R : α → β → Prop)\n\n@[simp]\ntheorem leftTotal_empty [IsEmpty α] : LeftTotal R := by\n simp only [LeftTotal, IsEmpty.forall_iff]\n\ntheorem leftTotal_iff_isEmpty_left [IsEmpty β] : LeftTotal R ↔ IsEmpty α := by\n simp only [LeftTotal, IsEmpty.exists_iff, isEmpty_iff]\n\n@[simp]\n\nTarget:\ntheorem rightTotal_empty [IsEmpty β] : RightTotal R :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Logic/IsEmpty","family_id":"righttotal_empty","file_id":"mathlib/Mathlib/Logic/IsEmpty/Basic.lean","sample_id":"cd5eefd2051037aa1d3cfc0ae07fc27231575ffdbfbd934224e5cb490f198640"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f6c05bed3bd1dc1d35c7dcaf41a5b689d1f98e6093c3d8b8ddedbb3618871526","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"33db20d0df73cda6fdd5ef409edc51536e54c9ef0a852652f01759ec27af1468","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"deab4978ab61ffa92fe0ea887bf9f48eb34e04fc641fbbe7de68cc3d78525e4a","source_sha256":"75ccbd34ea3edfdafe52ae0a8bd4f555b75dadeb010c82c074c4516aa0fe19cd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Std.Symm fun x y ↦ ¬(x, y) ∈ R := { symm _ _ := mt R.symm }\n simpa [not_imp_not, IsSeparated] using pairwise_insert_of_symm (r := fun x y ↦ ¬(x, y) ∈ R)","hard_negative":true,"metrics":{"chosen_tokens":53,"rejected_tokens":3,"token_jaccard":0.03125,"token_length_ratio":0.056604},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"374f6233bd9a2986ac1f3039488ea7f48bd0435b962219ff42876607dd4c40ea","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Set.Pairwise.Basic\npublic import Mathlib.Data.Rel\n\nNamespace:\nSetRel\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Uniform separation\n\nThis file defines a notion of separation of a set relative to a relation.\n\nFor a relation `R`, an `R`-separated set `s` is a set such that every pair of elements of `s` is\n`R`-unrelated.\n\nThe concept of uniformly separated sets is used to define two further notions of separation:\n* Metric separation: `Metric.IsSeparated`, defined using the small distance relation.\n* Dynamical nets: `Dynamics.IsDynNetIn`, defined using the dynamical relation.\n\n## TODO\n\n* Actually use `SetRel.IsSeparated` to define the above two notions.\n* Link to the notion of separation given by pairwise disjoint balls.\n-/\n\n@[expose] public section\n\nopen Set\n\nnamespace SetRel\nvariable {X : Type*} {R S : SetRel X X} {s t : Set X} {x : X}\n\n/-- Given a relation `R`, a set `s` is `R`-separated if its elements are pairwise `R`-unrelated from\neach other. -/\ndef IsSeparated (R : SetRel X X) (s : Set X) : Prop := s.Pairwise fun x y ↦ ¬ x ~[R] y\n\nprotected lemma IsSeparated.empty : IsSeparated R (∅ : Set X) := pairwise_empty _\nprotected lemma IsSeparated.singleton : IsSeparated R {x} := pairwise_singleton ..\n\n@[simp] lemma IsSeparated.of_subsingleton (hs : s.Subsingleton) : IsSeparated R s := hs.pairwise _\n\nalias _root_.Set.Subsingleton.relIsSeparated := IsSeparated.of_subsingleton\n\nnonrec lemma IsSeparated.mono_left (hUV : R ⊆ S) (hs : IsSeparated S s) : IsSeparated R s :=\n hs.mono' fun _x _y hxy h ↦ hxy <| hUV h\n\nlemma IsSeparated.mono_right (hst : s ⊆ t) (ht : IsSeparated R t) : IsSeparated R s := ht.mono hst\n\nlemma isSeparated_insert' :\n IsSeparated R (insert x s) ↔ IsSeparated R s ∧ (∀ y ∈ s, x ~[R] y → x = y) ∧\n ∀ y ∈ s, y ~[R] x → x = y := by\n simp [IsSeparated, pairwise_insert, not_imp_comm (a := _ = _), -not_and, forall_and]\n\nTarget:\nlemma isSeparated_insert [R.IsSymm] :\n IsSeparated R (insert x s) ↔ IsSeparated R s ∧ ∀ y ∈ s, x ~[R] y → x = y :=\n\nProof body:\n","rejected":"by\n exact isSeparated_insert","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"c707af5e0d04aaf2a90cf50e635bf32db14ea162e1e1384982e04b4fd1d2d16a","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Rel","family_id":"isseparated_insert","file_id":"mathlib/Mathlib/Data/Rel/Separated.lean","sample_id":"deab4978ab61ffa92fe0ea887bf9f48eb34e04fc641fbbe7de68cc3d78525e4a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1dfee187098f4e71767368c6bf2eb4d6d4ede55b380ff1008273ff1577a4b0dd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"280ed999a86106fffb16aab2e79a6c832e59bdfefd48ae578c3a01f9d5191c9a","source_sha256":"618e7239951cc7765754a4794bf1f2c21ea3746c3fcde7d3df65fe9efa57a542","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨?_, ?_⟩\n · rintro ⟨ab, ba⟩\n exact ⟨ba.of_mul, ab.of_mul⟩\n · rintro ⟨ha, hb⟩\n exact ⟨ha.mul hb, hb.mul ha⟩","hard_negative":false,"metrics":{"chosen_tokens":45,"rejected_tokens":3,"token_jaccard":0.176471,"token_length_ratio":0.066667},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"37a78f3f0027a7cf777bacf80720b11ebc0115dd6d24a39132bfbf537766b23f","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Units.Defs\npublic import Mathlib.Algebra.GroupWithZero.Action.Defs\npublic import Mathlib.Tactic.Convert\npublic import Mathlib.Tactic.Push\n\nNamespace:\nIsSMulRegular\n\nLocal context:\n/-\nCopyright (c) 2021 Damiano Testa. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Damiano Testa\n-/\n/-!\n# Action of regular elements on a module\n\nWe introduce `M`-regular elements, in the context of an `R`-module `M`. The corresponding\npredicate is called `IsSMulRegular`.\n\nThere are very limited typeclass assumptions on `R` and `M`, but the \"mathematical\" case of interest\nis a commutative ring `R` acting on a module `M`. Since the properties are \"multiplicative\", there\nis no actual requirement of having an addition, but there is a zero in both `R` and `M`.\nScalar multiplications involving `0` are, of course, all trivial.\n\nThe defining property is that an element `a ∈ R` is `M`-regular if the scalar multiplication map\n`M → M`, defined by `m ↦ a • m`, is injective.\n\nThis property is the direct generalization to modules of the property `IsLeftRegular` defined in\n`Algebra/Regular`. Lemma `isLeftRegular_iff` shows that indeed the two notions\ncoincide.\n-/\n\n@[expose] public section\n\n\nvariable {R S : Type*} (M : Type*) {a b : R} {s : S}\n\n/-- An `M`-regular element is an element `c` such that multiplication on the left by `c` is an\ninjective map `M → M`. -/\ndef IsSMulRegular [SMul R M] (c : R) :=\n Function.Injective ((c • ·) : M → M)\n\ntheorem IsLeftRegular.isSMulRegular [Mul R] {c : R} (h : IsLeftRegular c) : IsSMulRegular R c :=\n h\n\n/-- Left-regular multiplication on `R` is equivalent to `R`-regularity of `R` itself. -/\ntheorem isLeftRegular_iff [Mul R] {a : R} : IsLeftRegular a ↔ IsSMulRegular R a :=\n Iff.rfl\n\ntheorem IsRightRegular.isSMulRegular [Mul R] {c : R} (h : IsRightRegular c) :\n IsSMulRegular R (MulOpposite.op c) :=\n h\n\n/-- Right-regular multiplication on `R` is equivalent to `Rᵐᵒᵖ`-regularity of `R` itself. -/\ntheorem isRightRegular_iff [Mul R] {a : R} :\n IsRightRegular a ↔ IsSMulRegular R (MulOpposite.op a) :=\n Iff.rfl\n\nvariable {M}\n\nlemma isSMulRegular_map [SMul R M] [SMul S M] (f : R → S) (smul : ∀ m : M, f a • m = a • m) :\n IsSMulRegular M (f a) ↔ IsSMulRegular M a := by simp [IsSMulRegular, smul]\n\nprotected alias ⟨IsSMulRegular.of_map, IsSMulRegular.map⟩ := isSMulRegular_map\n\nnamespace IsSMulRegular\n\n@[simp] theorem natAbs_iff [SubtractionMonoid M] {n : ℤ} :\n IsSMulRegular M n.natAbs ↔ IsSMulRegular M n := by\n simp_rw [IsSMulRegular, Function.Injective]\n conv_rhs => rw [← n.sign_mul_natAbs]\n obtain h | h | h := n.sign_trichotomy\n · simp [h]\n · simp [Int.sign_eq_zero_iff_zero.mp h]\n · simp [h, neg_zsmul]\n\nsection SMul\n\nvariable [SMul R M] [SMul R S] [SMul S M] [IsScalarTower R S M]\n\n/-- The product of `M`-regular elements is `M`-regular. -/\ntheorem smul (ra : IsSMulRegular M a) (rs : IsSMulRegular M s) : IsSMulRegular M (a • s) :=\n fun _ _ ab => rs (ra ((smul_assoc _ _ _).symm.trans (ab.trans (smul_assoc _ _ _))))\n\n/-- If an element `b` becomes `M`-regular after multiplying it on the left by an `M`-regular\nelement, then `b` is `M`-regular. -/\ntheorem of_smul (a : R) (ab : IsSMulRegular M (a • s)) : IsSMulRegular M s :=\n @Function.Injective.of_comp _ _ _ (fun m : M => a • m) _ fun c d cd => by\n dsimp only [Function.comp_def] at cd\n rw [← smul_assoc, ← smul_assoc] at cd\n exact ab cd\n\n/-- An element is `M`-regular if and only if multiplying it on the left by an `M`-regular element\nis `M`-regular. -/\n@[simp]\ntheorem smul_iff (b : S) (ha : IsSMulRegular M a) : IsSMulRegular M (a • b) ↔ IsSMulRegular M b :=\n ⟨of_smul _, ha.smul⟩\n\ntheorem isLeftRegular [Mul R] {a : R} (h : IsSMulRegular R a) : IsLeftRegular a :=\n h\n\ntheorem isRightRegular [Mul R] {a : R} (h : IsSMulRegular R (MulOpposite.op a)) :\n IsRightRegular a :=\n h\n\ntheorem mul [Mul R] [IsScalarTower R R M] (ra : IsSMulRegular M a) (rb : IsSMulRegular M b) :\n IsSMulRegular M (a * b) :=\n ra.smul rb\n\ntheorem of_mul [Mul R] [IsScalarTower R R M] (ab : IsSMulRegular M (a * b)) :\n IsSMulRegular M b := by\n rw [← smul_eq_mul] at ab\n exact ab.of_smul _\n\n@[simp]\ntheorem mul_iff_right [Mul R] [IsScalarTower R R M] (ha : IsSMulRegular M a) :\n IsSMulRegular M (a * b) ↔ IsSMulRegular M b :=\n ⟨of_mul, ha.mul⟩\n\n/-- Two elements `a` and `b` are `M`-regular if and only if both products `a * b` and `b * a`\nare `M`-regular. -/\n\nTarget:\ntheorem mul_and_mul_iff [Mul R] [IsScalarTower R R M] :\n IsSMulRegular M (a * b) ∧ IsSMulRegular M (b * a) ↔ IsSMulRegular M a ∧ IsSMulRegular M b :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Regular","family_id":"mul_and_mul_iff","file_id":"mathlib/Mathlib/Algebra/Regular/SMul.lean","sample_id":"280ed999a86106fffb16aab2e79a6c832e59bdfefd48ae578c3a01f9d5191c9a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4dacf2aed3011dd313380ff94e829dbf4569a37fb51cb289a73f3a0d9653d731","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"1e76a6937ef7eed199c024ad2570137983c4d386f4cd87e171a864689afcb800","source_sha256":"34350a16580be8156d160cc3af1b21b173a7989c542045e07884d27af6d9ea99","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n ext U\n change IsOpen (p ⁻¹' U) ↔ ∃ V, _\n simp_rw [hf.isOpen_iff,\n (Set.image_surjective.mpr hq.surjective).exists,\n ← hq.isQuotientMap.isOpen_preimage]\n constructor\n · rintro ⟨V, hV, e⟩\n refine ⟨V, hq.continuous.1 _ (hq.isOpenMap _ hV), ?_⟩\n ext x\n obtain ⟨x, rfl⟩ := hp x\n constructor\n · rintro ⟨y, hy, e'⟩\n obtain ⟨y, rfl⟩ := H ⟨_, ⟨x, rfl⟩, (e'.trans (congr_fun h x)).symm⟩\n rw [← hg ((congr_fun h y).trans e')]\n exact e.le hy\n · intro H\n exact ⟨f x, e.ge H, congr_fun h.symm x⟩\n · rintro ⟨V, hV, rfl⟩\n refine ⟨_, hV, ?_⟩\n simp_rw [← Set.preimage_comp, h]","hard_negative":false,"metrics":{"chosen_tokens":191,"rejected_tokens":2,"token_jaccard":0.03125,"token_length_ratio":0.010471},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"3971b9710f76c211d84fe4588cd5e7552f8a167d0443b8528213bb5db9715da7","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Maps.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Open quotient maps\n\nAn open quotient map is an open map `f : X → Y` which is both an open map and a quotient map.\nEquivalently, it is a surjective continuous open map.\nWe use the latter characterization as a definition.\n\nMany important quotient maps are open quotient maps, including\n\n- the quotient map from a topological space to its quotient by the action of a group;\n- the quotient map from a topological group to its quotient by a normal subgroup;\n- the quotient map from a topological space to its separation quotient.\n\nContrary to general quotient maps,\nthe category of open quotient maps is closed under `Prod.map`.\n-/\n\npublic section\n\nopen Filter Function Set Topology\n\nvariable {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] {f : X → Y}\n\nnamespace IsOpenQuotientMap\n\nprotected theorem id : IsOpenQuotientMap (id : X → X) := ⟨surjective_id, continuous_id, .id⟩\n\n/-- An open quotient map is a quotient map. -/\ntheorem isQuotientMap (h : IsOpenQuotientMap f) : IsQuotientMap f :=\n h.isOpenMap.isQuotientMap h.continuous h.surjective\n\ntheorem iff_isOpenMap_isQuotientMap : IsOpenQuotientMap f ↔ IsOpenMap f ∧ IsQuotientMap f :=\n ⟨fun h ↦ ⟨h.isOpenMap, h.isQuotientMap⟩, fun ⟨ho, hq⟩ ↦ ⟨hq.surjective, hq.continuous, ho⟩⟩\n\ntheorem of_isOpenMap_isQuotientMap (ho : IsOpenMap f) (hq : IsQuotientMap f) :\n IsOpenQuotientMap f :=\n iff_isOpenMap_isQuotientMap.2 ⟨ho, hq⟩\n\ntheorem comp {g : Y → Z} (hg : IsOpenQuotientMap g) (hf : IsOpenQuotientMap f) :\n IsOpenQuotientMap (g ∘ f) :=\n ⟨.comp hg.1 hf.1, .comp hg.2 hf.2, .comp hg.3 hf.3⟩\n\ntheorem map_nhds_eq (h : IsOpenQuotientMap f) (x : X) : map f (𝓝 x) = 𝓝 (f x) :=\n le_antisymm h.continuous.continuousAt <| h.isOpenMap.nhds_le _\n\ntheorem continuous_comp_iff (h : IsOpenQuotientMap f) {g : Y → Z} :\n Continuous (g ∘ f) ↔ Continuous g :=\n h.isQuotientMap.continuous_iff.symm\n\ntheorem continuousAt_comp_iff (h : IsOpenQuotientMap f) {g : Y → Z} {x : X} :\n ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) := by\n simp only [ContinuousAt, ← h.map_nhds_eq, tendsto_map'_iff, comp_def]\n\ntheorem dense_preimage_iff (h : IsOpenQuotientMap f) {s : Set Y} : Dense (f ⁻¹' s) ↔ Dense s :=\n ⟨fun hs ↦ h.surjective.denseRange.dense_of_mapsTo h.continuous hs (mapsTo_preimage _ _),\n fun hs ↦ hs.preimage h.isOpenMap⟩\n\nend IsOpenQuotientMap\n\ntheorem Topology.IsInducing.isOpenQuotientMap_of_surjective (ind : IsInducing f)\n (surj : Function.Surjective f) : IsOpenQuotientMap f where\n surjective := surj\n continuous := ind.continuous\n isOpenMap U U_open := by\n obtain ⟨V, hV, rfl⟩ := ind.isOpen_iff.mp U_open\n rwa [V.image_preimage_eq surj]\n\ntheorem Topology.IsInducing.isQuotientMap_of_surjective (ind : IsInducing f)\n (surj : Function.Surjective f) : IsQuotientMap f :=\n (ind.isOpenQuotientMap_of_surjective surj).isQuotientMap\n\nsection Subquotient\n\nvariable {A B C D : Type*}\nvariable [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] [TopologicalSpace D]\nvariable (f : A → B) (g : C → D) (p : A → C) (q : B → D)\n\nomit [TopologicalSpace C] in\n/--\nGiven the following diagram with `f` inducing, `p` surjective,\n`q` an open quotient map, and `g` injective. Suppose the image of `A` in `B` is stable\nunder the equivalence mod `q`, then the coinduced topology on `C` (from `A`)\ncoincides with the induced topology (from `D`).\n```\nA -f→ B\n∣ ∣\np q\n↓ ↓\nC -g→ D\n```\n\nA typical application is when `K ≤ H` are subgroups of `G`, then the quotient topology on `H/K`\nis also the subspace topology from `G/K`.\n-/\n\nTarget:\nlemma coinduced_eq_induced_of_isOpenQuotientMap_of_isInducing\n (h : g ∘ p = q ∘ f)\n (hf : IsInducing f) (hp : Function.Surjective p)\n (hq : IsOpenQuotientMap q) (hg : Function.Injective g)\n (H : q ⁻¹' q '' Set.range f ⊆ Set.range f) :\n ‹TopologicalSpace A›.coinduced p = ‹TopologicalSpace D›.induced g :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Maps","family_id":"coinduced_eq_induced_of_isopenquotientmap_of_isinducing","file_id":"mathlib/Mathlib/Topology/Maps/OpenQuotient.lean","sample_id":"1e76a6937ef7eed199c024ad2570137983c4d386f4cd87e171a864689afcb800"},"split":"validation"} {"binding":{"chosen_proof_sha256":"fe1bc9d7a63b3bd7a030d94b9bf18b412ceb748c63fe6302088785bc851f6792","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"91ce7db28ad7a157d7479c6f4f282517d1541de9eb032652af516b5e19816905","source_sha256":"167cae25a064b15f836022f0441997349a236bd699ca87bcd93cf532b794529a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let b₁ := chooseBasis R M₁\n let b₂ := chooseBasis R M₂\n let b := b₁.prod b₂\n rw [← charpoly_toMatrix f₁ b₁, ← charpoly_toMatrix f₂ b₂, ← charpoly_toMatrix (f₁.prodMap f₂) b,\n toMatrix_prodMap b₁ b₂ f₁ f₂, Matrix.charpoly_fromBlocks_zero₁₂]","hard_negative":false,"metrics":{"chosen_tokens":70,"rejected_tokens":3,"token_jaccard":0.038462,"token_length_ratio":0.042857},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"39f406d139d79d0d2dc44d3de5a6e175f4212ebf1d953500593c06bf84638b41","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Charpoly.Basic\npublic import Mathlib.LinearAlgebra.Matrix.Basis\npublic import Mathlib.RingTheory.Finiteness.Prod\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\nCopyright (c) 2021 Riccardo Brasca. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Riccardo Brasca\n-/\n/-!\n\n# Characteristic polynomial\n\n## Main result\n\n* `LinearMap.charpoly_toMatrix f` : `charpoly f` is the characteristic polynomial of the matrix\n of `f` in any basis.\n\n-/\n\npublic section\n\nnoncomputable section\n\nopen Module Free Polynomial Matrix\n\nuniverse u v w\n\nvariable {R M M₁ M₂ : Type*} [CommRing R]\nvariable [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M]\nvariable [AddCommGroup M₁] [Module R M₁] [Module.Finite R M₁] [Module.Free R M₁]\nvariable [AddCommGroup M₂] [Module R M₂] [Module.Finite R M₂] [Module.Free R M₂]\nvariable (f : M →ₗ[R] M)\n\nnamespace LinearMap\n\nsection Basic\n\n/-- `charpoly f` is the characteristic polynomial of the matrix of `f` in any basis. -/\n@[simp]\ntheorem charpoly_toMatrix {ι : Type w} [DecidableEq ι] [Fintype ι] (b : Basis ι R M) :\n (toMatrix b b f).charpoly = f.charpoly := by\n nontriviality R\n unfold LinearMap.charpoly\n set b' := chooseBasis R M\n rw [← basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix b b' b b']\n set P := b.toMatrix b'\n set A := toMatrix b' b' f\n set Q := b'.toMatrix b\n let e := Basis.indexEquiv b b'\n let ι' := ChooseBasisIndex R M\n let φ := reindexLinearEquiv R R e e\n let φ₁ := reindexLinearEquiv R R e (Equiv.refl ι')\n let φ₂ := reindexLinearEquiv R R (Equiv.refl ι') (Equiv.refl ι')\n let φ₃ := reindexLinearEquiv R R (Equiv.refl ι') e\n calc\n (P * A * Q).charpoly = (φ (P * A * Q)).charpoly := (charpoly_reindex ..).symm\n _ = (φ₁ P * φ₂ A * φ₃ Q).charpoly := by rw [reindexLinearEquiv_mul, reindexLinearEquiv_mul]\n _ = A.charpoly := by rw [charpoly_mul_comm, ← mul_assoc]; simp [P, Q, φ₁, φ₂, φ₃]\n\nTarget:\nlemma charpoly_prodMap (f₁ : M₁ →ₗ[R] M₁) (f₂ : M₂ →ₗ[R] M₂) :\n (f₁.prodMap f₂).charpoly = f₁.charpoly * f₂.charpoly :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Charpoly","family_id":"charpoly_prodmap","file_id":"mathlib/Mathlib/LinearAlgebra/Charpoly/ToMatrix.lean","sample_id":"91ce7db28ad7a157d7479c6f4f282517d1541de9eb032652af516b5e19816905"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8f91837b0f741684782f03ea72ade4773b8cba68773efaed8c9a404060c04662","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"770e88b9c97be4c5be3f5a4285b314064ce2ba98ff38c450bf2951de9691a491","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"04e30d75a20649a4e8af1e3fb2c4664deed6136b7d405220d3f62537dac223d3","source_sha256":"fee0a2b95796c84709e51646b2725c39adb38b453000ce9df0ea97a95ddddeaf","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_rw [scalar_apply, ← smul_eq_diagonal_mul, ← op_smul_eq_mul_diagonal]","hard_negative":true,"metrics":{"chosen_tokens":11,"rejected_tokens":5,"token_jaccard":0.076923,"token_length_ratio":0.454545},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"3a7fa600df80f7517de9ff148c2846103fd72521d033f195e5026b55ef1502af","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Opposite\npublic import Mathlib.Algebra.Algebra.Pi\npublic import Mathlib.Algebra.BigOperators.RingEquiv\npublic import Mathlib.Data.Finite.Prod\npublic import Mathlib.Data.Matrix.Mul\npublic import Mathlib.LinearAlgebra.Pi\npublic import Mathlib.GroupTheory.DedekindFinite\n\nNamespace:\nMatrix\n\nLocal context:\n/-\nCopyright (c) 2018 Ellen Arlt. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Ellen Arlt, Blair Shi, Sean Leather, Mario Carneiro, Johan Commelin, Lu-Ming Zhang\n-/\n/-!\n# Matrices\n\nThis file contains basic results on matrices including bundled versions of matrix operators.\n\n## Implementation notes\n\nFor convenience, `Matrix m n α` is defined as `m → n → α`, as this allows elements of the matrix\nto be accessed with `A i j`. However, it is not advisable to _construct_ matrices using terms of the\nform `fun i j ↦ _` or even `(fun i j ↦ _ : Matrix m n α)`, as these are not recognized by Lean\nas having the right type. Instead, `Matrix.of` should be used.\n\n## TODO\n\nUnder various conditions, multiplication of infinite matrices makes sense.\nThese have not yet been implemented.\n-/\n\n@[expose] public section\n\nassert_not_exists TrivialStar\n\nuniverse u u' v w\n\nvariable {l m n o : Type*} {m' : o → Type*} {n' : o → Type*}\nvariable {R S T A α β γ : Type*}\n\nnamespace Matrix\n\ninstance decidableEq [DecidableEq α] [Fintype m] [Fintype n] : DecidableEq (Matrix m n α) :=\n Fintype.decidablePiFintype\n\ninstance {n m} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] (α) [Fintype α] :\n Fintype (Matrix m n α) := inferInstanceAs (Fintype (m → n → α))\n\ninstance {n m} [Finite m] [Finite n] (α) [Finite α] :\n Finite (Matrix m n α) := inferInstanceAs (Finite (m → n → α))\n\ninstance (priority := low) [Semiring α] [Finite α] : IsStablyFiniteRing α := ⟨inferInstance⟩\n\nsection\nvariable (R)\n\n/-- This is `Matrix.of` bundled as a linear equivalence. -/\ndef ofLinearEquiv [Semiring R] [AddCommMonoid α] [Module R α] : (m → n → α) ≃ₗ[R] Matrix m n α where\n __ := ofAddEquiv\n map_smul' _ _ := rfl\n\n@[simp] lemma coe_ofLinearEquiv [Semiring R] [AddCommMonoid α] [Module R α] :\n ⇑(ofLinearEquiv _ : (m → n → α) ≃ₗ[R] Matrix m n α) = of := rfl\n@[simp] lemma coe_ofLinearEquiv_symm [Semiring R] [AddCommMonoid α] [Module R α] :\n ⇑((ofLinearEquiv _).symm : Matrix m n α ≃ₗ[R] (m → n → α)) = of.symm := rfl\n\nend\n\ntheorem sum_apply [AddCommMonoid α] (i : m) (j : n) (s : Finset β) (g : β → Matrix m n α) :\n (∑ c ∈ s, g c) i j = ∑ c ∈ s, g c i j :=\n (congr_fun (s.sum_apply i g) j).trans (s.sum_apply j _)\n\nend Matrix\n\nopen Matrix\n\nnamespace Matrix\n\nsection Diagonal\n\nvariable [DecidableEq n]\n\nvariable (n α)\n\n/-- `Matrix.diagonal` as an `AddMonoidHom`. -/\n@[simps]\ndef diagonalAddMonoidHom [AddZeroClass α] : (n → α) →+ Matrix n n α where\n toFun := diagonal\n map_zero' := diagonal_zero\n map_add' x y := (diagonal_add x y).symm\n\nvariable (R)\n\n/-- `Matrix.diagonal` as a `LinearMap`. -/\n@[simps]\ndef diagonalLinearMap [Semiring R] [AddCommMonoid α] [Module R α] : (n → α) →ₗ[R] Matrix n n α :=\n { diagonalAddMonoidHom n α with map_smul' := diagonal_smul }\n\nvariable {n α R}\n\nsection One\n\nvariable [Zero α] [One α]\n\nlemma zero_le_one_elem [Preorder α] [ZeroLEOneClass α] (i j : n) :\n 0 ≤ (1 : Matrix n n α) i j := by\n by_cases hi : i = j\n · subst hi\n simp\n · simp [hi]\n\nlemma zero_le_one_row [Preorder α] [ZeroLEOneClass α] (i : n) :\n 0 ≤ (1 : Matrix n n α) i :=\n zero_le_one_elem i\n\nend One\n\nend Diagonal\n\nsection Diag\n\nvariable (n α)\n\n/-- `Matrix.diag` as an `AddMonoidHom`. -/\n@[simps]\ndef diagAddMonoidHom [AddZeroClass α] : Matrix n n α →+ n → α where\n toFun := diag\n map_zero' := diag_zero\n map_add' := diag_add\n\nvariable (R)\n\n/-- `Matrix.diag` as a `LinearMap`. -/\n@[simps]\ndef diagLinearMap [Semiring R] [AddCommMonoid α] [Module R α] : Matrix n n α →ₗ[R] n → α :=\n { diagAddMonoidHom n α with map_smul' := diag_smul }\n\nvariable {n α R}\n\n@[simp]\ntheorem diag_list_sum [AddMonoid α] (l : List (Matrix n n α)) : diag l.sum = (l.map diag).sum :=\n map_list_sum (diagAddMonoidHom n α) l\n\n@[simp]\ntheorem diag_multiset_sum [AddCommMonoid α] (s : Multiset (Matrix n n α)) :\n diag s.sum = (s.map diag).sum :=\n map_multiset_sum (diagAddMonoidHom n α) s\n\n@[simp]\ntheorem diag_sum {ι} [AddCommMonoid α] (s : Finset ι) (f : ι → Matrix n n α) :\n diag (∑ i ∈ s, f i) = ∑ i ∈ s, diag (f i) :=\n map_sum (diagAddMonoidHom n α) f s\n\nend Diag\n\nopen Matrix\n\nsection NonAssocSemiring\n\nvariable [NonAssocSemiring α]\n\nvariable (α n)\n\n/-- `Matrix.diagonal` as a `RingHom`. -/\n@[simps]\ndef diagonalRingHom [Fintype n] [DecidableEq n] : (n → α) →+* Matrix n n α :=\n { diagonalAddMonoidHom n α with\n toFun := diagonal\n map_one' := diagonal_one\n map_mul' := fun _ _ => (diagonal_mul_diagonal' _ _).symm }\n\nend NonAssocSemiring\n\nsection Semiring\n\nvariable [Semiring α]\n\ntheorem diagonal_pow [Fintype n] [DecidableEq n] (v : n → α) (k : ℕ) :\n diagonal v ^ k = diagonal (v ^ k) :=\n (map_pow (diagonalRingHom n α) v k).symm\n\n/-- The ring homomorphism `α →+* Matrix n n α`\nsending `a` to the diagonal matrix with `a` on the diagonal.\n-/\ndef scalar (n : Type u) [DecidableEq n] [Fintype n] : α →+* Matrix n n α :=\n (diagonalRingHom n α).comp <| Pi.constRingHom n α\n\nsection Scalar\n\nvariable [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m]\n\n@[simp]\ntheorem scalar_apply (a : α) : scalar n a = diagonal fun _ => a :=\n rfl\n\ntheorem scalar_inj [Nonempty n] {r s : α} : scalar n r = scalar n s ↔ r = s :=\n (diagonal_injective.comp Function.const_injective).eq_iff\n\n/-- A version of `Matrix.scalar_commute_iff` for rectangular matrices. -/\n\nTarget:\ntheorem scalar_comm_iff {r : α} {M : Matrix m n α} :\n scalar m r * M = M * scalar n r ↔ r • M = MulOpposite.op r • M :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_04e30d75a206","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"c4d50f01efe2fb8d7d6e0e6d6bd148e0a485ecba36464d8d0b8ad1c579d464a5","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Matrix","family_id":"scalar_comm_iff","file_id":"mathlib/Mathlib/Data/Matrix/Basic.lean","sample_id":"04e30d75a20649a4e8af1e3fb2c4664deed6136b7d405220d3f62537dac223d3"},"split":"validation"} {"binding":{"chosen_proof_sha256":"eb8f944b0a010b198f031875958cb4d7deba167d646db8ab4e937c25eaaaba51","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"214ac1aec342f97ba211fa387792bcb5bfa0c7ce53549d9153fa5ec3ae96ac63","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"7e9891faa4cbd8996654fc0292fd355985af01408e265aec5eba539569823604","source_sha256":"6f616ab12827a9e368ac6aac43138d4ab446258d4ca70bd2bae4eb88fa4dfcff","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have := MorphismProperty.locallyCoverDense_forget_of_le (S := S) K H\n rw [toGrothendieck_comap_forget_eq_restrictedTopology _ H]\n exact Functor.coverPreserving_restrictedTopology (Over.forget P ⊤ S) (K.toGrothendieck.over S)\n\nvariable [HasFiniteWidePullbacks C] [P.HasOfPostcompProperty P] [P.IsStableUnderBaseChange]\n [P.ContainsIdentities]","hard_negative":false,"metrics":{"chosen_tokens":60,"rejected_tokens":65,"token_jaccard":0.885714,"token_length_ratio":1.083333},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"3cafe013b6eaf62d84973ccbae5b210110848a9985e1f1b09f630b10bd05813e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.MorphismProperty.Comma\npublic import Mathlib.CategoryTheory.Limits.MorphismProperty\npublic import Mathlib.CategoryTheory.Sites.MorphismProperty\npublic import Mathlib.CategoryTheory.Sites.Over\n\nNamespace:\nCategoryTheory.MorphismProperty\n\nLocal context:\n/-\nCopyright (c) 2026 Christian Merten. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Christian Merten\n-/\n/-!\n\n# Sites on `P.Over ⊤ X`\n\nWe provide some API for proving properties of `P.Over ⊤ X` in relation to precoverages. Consider\na precoverage `K` on `C`.\n\n## Main results\n\n- `CategoryTheory.MorphismProperty.locallyCoverDense_forget_of_le`:\n The forgetful functor `P.Over ⊤ X ⥤ Over X` is locally cover dense if morphisms in `K`\n satisfy `P`.\n- `CategoryTheory.MorphismProperty.toGrothendieck_comap_forget_eq_restrictedTopology`: The topology\n generated by the precoverage induced from `K` via the composition `P.Over ⊤ X ⥤ Over X ⥤ C` is\n the induced topology from the forgetful functor `P.Over ⊤ X ⥤ Over X`.\n\n-/\n\npublic section\n\nuniverse v u\n\nopen CategoryTheory MorphismProperty Limits\n\nnamespace CategoryTheory.MorphismProperty\n\nvariable {C : Type*} [Category* C]\n\nvariable {P : MorphismProperty C} {S : C} [P.IsStableUnderComposition]\n\nset_option backward.defeqAttrib.useBackward true in\nlemma exists_map_eq_of_presieve (K : Precoverage C) (H : K ≤ P.precoverage)\n {X : P.Over ⊤ S} {R : Presieve ((MorphismProperty.Over.forget P ⊤ S).obj X)}\n (hR : R ∈ (K.comap <| CategoryTheory.Over.forget S) _) :\n ∃ T : Presieve X, T.map (MorphismProperty.Over.forget P ⊤ S) = R := by\n rw [Precoverage.mem_iff_exists_zeroHypercover] at hR\n obtain ⟨𝒰, rfl⟩ := hR\n let 𝒱 : PreZeroHypercover X :=\n ⟨𝒰.I₀, fun i ↦ Over.mk _ (𝒰.X i).hom ?_, fun i ↦ Over.homMk (𝒰.f i).left (by simp) trivial⟩\n · use 𝒱.presieve₀\n rw [Presieve.map_ofArrows]\n rfl\n · rw [← CategoryTheory.Over.w (𝒰.f i)]\n exact P.comp_mem _ _ (H _ 𝒰.mem₀ ⟨⟨i⟩⟩) X.prop\n\nvariable (K : Precoverage C) [K.HasIsos] [K.IsStableUnderBaseChange] [K.IsStableUnderComposition]\n [K.HasPullbacks]\n\nlemma locallyCoverDense_forget_of_le (H : K ≤ P.precoverage) :\n (MorphismProperty.Over.forget P ⊤ S).LocallyCoverDense (K.toGrothendieck.over S) := by\n rw [over_toGrothendieck_eq_toGrothendieck_comap_forget]\n apply Precoverage.locallyCoverDense_of_map_functorPullback_mem\n intro X R hR\n obtain ⟨R, rfl⟩ := MorphismProperty.exists_map_eq_of_presieve _ H hR\n simpa\n\nlemma toGrothendieck_comap_forget_eq_restrictedTopology\n (H : K ≤ P.precoverage) :\n (K.comap (MorphismProperty.Over.forget P ⊤ _ ⋙ CategoryTheory.Over.forget S)).toGrothendieck =\n (MorphismProperty.Over.forget P ⊤ _).restrictedTopology (K.toGrothendieck.over S) := by\n have : (Over.forget P ⊤ S).LocallyCoverDense\n (K.comap (CategoryTheory.Over.forget S)).toGrothendieck := by\n rw [← over_toGrothendieck_eq_toGrothendieck_comap_forget]\n exact MorphismProperty.locallyCoverDense_forget_of_le (S := S) K H\n rw [Precoverage.comap_comp]\n simp_rw [over_toGrothendieck_eq_toGrothendieck_comap_forget]\n apply Precoverage.toGrothendieck_comap_eq_restrictedTopology\n intro X R hR\n obtain ⟨T, rfl⟩ := MorphismProperty.exists_map_eq_of_presieve K H hR\n simpa\n\nTarget:\nlemma coverPreserving_comap_forget (H : K ≤ P.precoverage) :\n CoverPreserving\n (K.comap (MorphismProperty.Over.forget P ⊤ _ ⋙ CategoryTheory.Over.forget S)).toGrothendieck\n (K.toGrothendieck.over S)\n (MorphismProperty.Over.forget P ⊤ S) :=\n\nProof body:\n","rejected":"by\n have := MorphismProperty.locallyCoverDense_forget_of_le (S := S) K H\n rw [toGrothendieck_comap_forget_eq_restrictedTopology _ H]\n exact Functor.coverPreserving_restrictedTopology (Over.forget P ⊤ S) (K.toGrothendieck.over S)\n\nvariable [HasFiniteWidePullbacks C] [P.HasOfPostcompProperty P] [P.IsStableUnderBaseChange]\n [P.ContainsIdentities]\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/MorphismProperty","family_id":"coverpreserving_comap_forget","file_id":"mathlib/Mathlib/CategoryTheory/MorphismProperty/CommaSites.lean","sample_id":"7e9891faa4cbd8996654fc0292fd355985af01408e265aec5eba539569823604"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b241e0635e41f0c595053feb2941666d4f69302f772b6a38e5cff5f2bc9d298a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"58d55a7ec458b1df7c91f0b2aa0549c57274811f8e3fa2ec69d9ada0e2729189","source_sha256":"a5b9fd4ae26ed5eac524a8ce0f4aac28fccd2337d8a28d5e1bf35f99625bb1bd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨n, ι, inst, x, p, e, equiv⟩ := AddCommGroup.equiv_free_prod_directSum_zmod (Additive G)\n exact ⟨ι, Fin n, inst, inferInstance, x, p, e, ⟨MulEquiv.toAdditive.symm <| equiv.some.trans <|\n ((Finsupp.addEquivFunOnFinite.trans <| ((AddEquiv.piAdditive _).trans <|\n (AddEquiv.additiveMultiplicative ℤ).arrowCongr (Equiv.refl _)).symm).prodCongr\n (DirectSum.addEquivProd _ )).trans <| (AddEquiv.prodAdditive _ _).symm⟩⟩","hard_negative":false,"metrics":{"chosen_tokens":119,"rejected_tokens":2,"token_jaccard":0.022222,"token_length_ratio":0.016807},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"3d0adc4da49f910e42476bc6f212afac44677a835ba45b7aa9e9006e58bf8108","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.PID\npublic import Mathlib.Algebra.Group.TypeTags.Finite\npublic import Mathlib.Data.ZMod.QuotientRing\n\nNamespace:\nCommGroup\n\nLocal context:\n/-\nCopyright (c) 2022 Pierre-Alexandre Bazin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Pierre-Alexandre Bazin\n-/\n/-!\n# Structure of finite(ly generated) abelian groups\n\n* `AddCommGroup.equiv_free_prod_directSum_zmod` : Any finitely generated abelian group is the\n product of a power of `ℤ` and a direct sum of some `ZMod (p i ^ e i)` for some prime powers\n `p i ^ e i`.\n* `CommGroup.equiv_free_prod_prod_multiplicative_zmod` is a version for multiplicative groups.\n* `AddCommGroup.equiv_directSum_zmod_of_finite` : Any finite abelian group is a direct sum of\n some `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`.\n* `CommGroup.equiv_prod_multiplicative_zmod_of_finite` is a version for multiplicative groups.\n-/\n\n@[expose] public section\n\nopen scoped DirectSum\n\n/-\nTODO: Here's a more general approach to dropping trivial factors from a direct sum:\n\ndef DirectSum.congr {ι κ : Type*} {α : ι → Type*} {β : κ → Type*} [DecidableEq ι] [DecidableEq κ]\n [∀ i, DecidableEq (α i)] [∀ j, DecidableEq (β j)] [∀ i, AddCommMonoid (α i)]\n [∀ j, AddCommMonoid (β j)] (f : ∀ i, Nontrivial (α i) → κ) (g : ∀ j, Nontrivial (β j) → ι)\n (F : ∀ i hi, α i →+ β (f i hi)) (G : ∀ j hj, β j →+ α (g j hj))\n (hfg : ∀ i hi hj, g (f i hi) hj = i) (hgf : ∀ j hj hi, f (g j hj) hi = j)\n (hFG : ∀ i hi hj a, hfg i hi hj ▸ G _ hj (F i hi a) = a)\n (hGF : ∀ j hj hi b, hgf j hj hi ▸ F _ hi (G j hj b) = b) :\n (⨁ i, α i) ≃+ ⨁ j, β j where\n toFun x := x.sum fun i a ↦ if ha : a = 0 then 0 else DFinsupp.single (f i ⟨a, 0, ha⟩) (F _ _ a)\n invFun y := y.sum fun j b ↦ if hb : b = 0 then 0 else DFinsupp.single (g j ⟨b, 0, hb⟩) (G _ _ b)\n -- The two sorries here are probably doable with the existing machinery, but quite painful\n left_inv x := DFinsupp.ext fun i ↦ sorry\n right_inv y := DFinsupp.ext fun j ↦ sorry\n map_add' x₁ x₂ := by\n dsimp\n refine DFinsupp.sum_add_index (by simp) fun i a₁ a₂ ↦ ?_\n split_ifs\n any_goals simp_all\n rw [← DFinsupp.single_add, ← map_add, ‹a₁ + a₂ = 0›, map_zero, DFinsupp.single_zero]\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.congr\n (fun i _ ↦ i)\n (fun j hj ↦ ⟨j, fun h ↦ by simp [h, pow_zero, zmod_nontrivial] at hj⟩)\n (fun i _ ↦ AddMonoidHom.id _)\n (fun j _ ↦ AddMonoidHom.id _)\n (fun i hi hj ↦ rfl)\n (fun j hj hi ↦ rfl)\n (fun i hi hj a ↦ rfl)\n (fun j hj hi a ↦ rfl)\n-/\n\nprivate def directSumNeZeroMulHom {ι : Type} [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) →+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.toAddMonoid fun i ↦ DirectSum.of (fun i ↦ ZMod (p i ^ n i)) i\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) where\n toFun := directSumNeZeroMulHom p n\n invFun := DirectSum.toAddMonoid fun i ↦\n if h : n i = 0 then 0 else DirectSum.of (fun j : {i // n i ≠ 0} ↦ ZMod (p j ^ n j)) ⟨i, h⟩\n left_inv x := by\n induction x using DirectSum.induction_on with\n | zero => simp\n | of i x =>\n rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of, DirectSum.toAddMonoid_of,\n dif_neg i.prop]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n right_inv x := by\n induction x using DirectSum.induction_on with\n | zero => rw [map_zero, map_zero]\n | of i x =>\n rw [DirectSum.toAddMonoid_of]\n split_ifs with h\n · simp [(ZMod.subsingleton_iff.2 <| by rw [h, pow_zero]).elim x 0]\n · simp_rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n map_add' := map_add (directSumNeZeroMulHom p n)\n\nuniverse u\n\nnamespace Module\n\nvariable (M : Type u)\n\ntheorem finite_of_fg_torsion [AddCommGroup M] [Module ℤ M] [Module.Finite ℤ M]\n (hM : Module.IsTorsion ℤ M) : _root_.Finite M := by\n rcases Module.equiv_directSum_of_isTorsion hM with ⟨ι, _, p, h, e, ⟨l⟩⟩\n haveI : ∀ i : ι, NeZero (p i ^ e i).natAbs := fun i =>\n ⟨Int.natAbs_ne_zero.mpr <| pow_ne_zero (e i) (h i).ne_zero⟩\n haveI : ∀ i : ι, _root_.Finite <| ℤ ⧸ Submodule.span ℤ {p i ^ e i} := fun i =>\n Finite.of_equiv _ (p i ^ e i).quotientSpanEquivZMod.symm.toEquiv\n haveI : _root_.Finite (⨁ i, ℤ ⧸ (Submodule.span ℤ {p i ^ e i} : Submodule ℤ ℤ)) :=\n Finite.of_equiv _ DFinsupp.equivFunOnFintype.symm\n exact Finite.of_equiv _ l.symm.toEquiv\n\nend Module\n\nvariable (G : Type u)\n\nnamespace AddCommGroup\n\nvariable [AddCommGroup G]\n\n/-- **Structure theorem of finitely generated abelian groups** : Any finitely generated abelian\ngroup is the product of a power of `ℤ` and a direct sum of some `ZMod (p i ^ e i)` for some\nprime powers `p i ^ e i`. -/\ntheorem equiv_free_prod_directSum_zmod [hG : AddGroup.FG G] :\n ∃ (n : ℕ) (ι : Type) (_ : Fintype ι) (p : ι → ℕ) (_ : ∀ i, Nat.Prime <| p i) (e : ι → ℕ),\n Nonempty <| G ≃+ (Fin n →₀ ℤ) × ⨁ i : ι, ZMod (p i ^ e i) := by\n obtain ⟨n, ι, fι, p, hp, e, ⟨f⟩⟩ :=\n @Module.equiv_free_prod_directSum _ _ _ _ _ _ _ (Module.Finite.iff_addGroup_fg.mpr hG)\n refine ⟨n, ι, fι, fun i => (p i).natAbs, fun i => ?_, e, ⟨?_⟩⟩\n · rw [← Int.prime_iff_natAbs_prime, ← irreducible_iff_prime]; exact hp i\n exact\n f.toAddEquiv.trans\n ((AddEquiv.refl _).prodCongr <|\n DFinsupp.mapRange.addEquiv fun i =>\n ((Int.quotientSpanEquivZMod _).trans <|\n ZMod.ringEquivCongr <| (p i).natAbs_pow _).toAddEquiv)\n\n/-- **Structure theorem of finite abelian groups** : Any finite abelian group is a direct sum of\nsome `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`. -/\ntheorem equiv_directSum_zmod_of_finite [Finite G] :\n ∃ (ι : Type) (_ : Fintype ι) (p : ι → ℕ) (_ : ∀ i, Nat.Prime <| p i) (e : ι → ℕ),\n Nonempty <| G ≃+ ⨁ i : ι, ZMod (p i ^ e i) := by\n cases nonempty_fintype G\n obtain ⟨n, ι, fι, p, hp, e, ⟨f⟩⟩ := equiv_free_prod_directSum_zmod G\n rcases n with - | n\n · have : Unique (Fin Nat.zero →₀ ℤ) :=\n { uniq := by subsingleton }\n exact ⟨ι, fι, p, hp, e, ⟨f.trans AddEquiv.uniqueProd⟩⟩\n · haveI := @Fintype.prodLeft _ _ _ (Fintype.ofEquiv G f.toEquiv) _\n exact\n (Fintype.ofSurjective (fun f : Fin n.succ →₀ ℤ => f 0) fun a =>\n ⟨Finsupp.single 0 a, Finsupp.single_eq_same⟩).false.elim\n\n/-- **Structure theorem of finite abelian groups** : Any finite abelian group is a direct sum of\nsome `ZMod (n i)` for some natural numbers `n i > 1`. -/\nlemma equiv_directSum_zmod_of_finite' (G : Type*) [AddCommGroup G] [Finite G] :\n ∃ (ι : Type) (_ : Fintype ι) (n : ι → ℕ),\n (∀ i, 1 < n i) ∧ Nonempty (G ≃+ ⨁ i, ZMod (n i)) := by\n classical\n obtain ⟨ι, hι, p, hp, n, ⟨e⟩⟩ := AddCommGroup.equiv_directSum_zmod_of_finite G\n refine ⟨{i : ι // n i ≠ 0}, inferInstance, fun i ↦ p i ^ n i, ?_,\n ⟨e.trans (directSumNeZeroMulEquiv ι _ _).symm⟩⟩\n rintro ⟨i, hi⟩\n exact one_lt_pow₀ (hp _).one_lt hi\n\ntheorem finite_of_fg_torsion [hG' : AddGroup.FG G] (hG : AddMonoid.IsTorsion G) : Finite G :=\n @Module.finite_of_fg_torsion _ _ _ (Module.Finite.iff_addGroup_fg.mpr hG') <|\n AddMonoid.isTorsion_iff_isTorsion_int.mp hG\n\nend AddCommGroup\n\nnamespace CommGroup\n\ntheorem finite_of_fg_torsion [CommGroup G] [Group.FG G] (hG : Monoid.IsTorsion G) : Finite G :=\n @Finite.of_equiv _ _ (AddCommGroup.finite_of_fg_torsion (Additive G) hG) Multiplicative.ofAdd\n\n/-- The **Structure Theorem For Finite Abelian Groups** in a multiplicative version:\nA finite commutative group `G` is isomorphic to a finite product of finite cyclic groups. -/\ntheorem equiv_prod_multiplicative_zmod_of_finite (G : Type*) [CommGroup G] [Finite G] :\n ∃ (ι : Type) (_ : Fintype ι) (n : ι → ℕ),\n (∀ (i : ι), 1 < n i) ∧ Nonempty (G ≃* ((i : ι) → Multiplicative (ZMod (n i)))) := by\n obtain ⟨ι, inst, n, h₁, h₂⟩ := AddCommGroup.equiv_directSum_zmod_of_finite' (Additive G)\n exact ⟨ι, inst, n, h₁, ⟨MulEquiv.toAdditive.symm <| h₂.some.trans <|\n (DirectSum.addEquivProd _).trans (MulEquiv.piMultiplicative _).toAdditiveRight⟩⟩\n\n/-- The **Structure theorem of finitely generated abelian groups** in a multiplicative version :\n Any finitely generated abelian group is the product of a power of `ℤ`\n and a direct product of some `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`. -/\n\nTarget:\ntheorem equiv_free_prod_prod_multiplicative_zmod (G : Type*) [CommGroup G] [hG : Group.FG G] :\n ∃ (ι j : Type) (_ : Fintype ι) (_ : Fintype j) (p : ι → ℕ)\n (_ : ∀ i, Nat.Prime <| p i) (e : ι → ℕ),\n Nonempty <| G ≃* (j → Multiplicative ℤ) × ((i : ι) → Multiplicative (ZMod (p i ^ e i))) :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/FiniteAbelian","family_id":"equiv_free_prod_prod_multiplicative_zmod","file_id":"mathlib/Mathlib/GroupTheory/FiniteAbelian/Basic.lean","sample_id":"58d55a7ec458b1df7c91f0b2aa0549c57274811f8e3fa2ec69d9ada0e2729189"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4c8ef71d2d3a0df5c3ff062f63a8d6e4733682a05b9b2f1a5b20db0e2ca01950","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"158c96cb525dd366a2b1c82328ad6502b252c5ef73940a36b58b7500b6ce72ae","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"643830388682a53e868db5ec2cba5c60e896fb2e575f108745f92ba08a54ea20","source_sha256":"8b79e0352e627153fad48283e58e6ec415c2eeb49cc3fdb956c3554f13241fca","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n convert! if_pos rfl","hard_negative":true,"metrics":{"chosen_tokens":5,"rejected_tokens":2,"token_jaccard":0.166667,"token_length_ratio":0.4},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"3d53284a985b46463f609885a4f1742291bfe63f1215fdb3f87b96e043c7d291","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.MeanInequalities\npublic import Mathlib.Analysis.Normed.Lp.WithLp\n\nNamespace:\nWithLp\n\nLocal context:\n/-\nCopyright (c) 2023 Moritz Doll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Moritz Doll, Sébastien Gouëzel, Jireh Loreaux\n-/\n/-!\n# `L^p` distance on products of two metric spaces\nGiven two metric spaces, one can put the max distance on their product, but there is also\na whole family of natural distances, indexed by a parameter `p : ℝ≥0∞`, that also induce\nthe product topology. We define them in this file. For `0 < p < ∞`, the distance on `α × β`\nis given by\n$$\nd(x, y) = \\left(d(x_1, y_1)^p + d(x_2, y_2)^p\\right)^{1/p}.\n$$\nFor `p = ∞` the distance is the supremum of the distances and `p = 0` the distance is the\ncardinality of the elements that are not equal.\n\nWe give instances of this construction for emetric spaces, metric spaces, normed groups and normed\nspaces.\n\nTo avoid conflicting instances, all these are defined on a copy of the original Prod-type, named\n`WithLp p (α × β)`. The assumption `[Fact (1 ≤ p)]` is required for the metric and normed space\ninstances.\n\nWe ensure that the topology, bornology and uniform structure on `WithLp p (α × β)` are (defeq to)\nthe product topology, product bornology and product uniformity, to be able to use freely continuity\nstatements for the coordinate functions, for instance.\n\nIf you wish to endow a type synonym of `α × β` with the `L^p` distance, you can use\n`pseudoMetricSpaceToProd` and the declarations below that one.\n\n\n## Implementation notes\n\nThis file is a straight-forward adaptation of `Mathlib/Analysis/Normed/Lp/PiLp.lean`.\n\n## TODO\n\nTODO: the results about uniformity and bornology in the `Aux` section should be using the tools in\n`Mathlib.Topology.MetricSpace.Bilipschitz`, so that they can be inlined in the next section and\nthe only remaining results are about `Lipschitz` and `Antilipschitz`.\n\n-/\n\n@[expose] public section\n\nopen Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal\n\nnoncomputable section\n\nvariable (p : ℝ≥0∞) (𝕜 α β : Type*)\n\nnamespace WithLp\n\nsection algebra\n\n/- Register simplification lemmas for the applications of `WithLp p (α × β)` elements, as the usual\nlemmas for `Prod` will not trigger. -/\n\nvariable {p 𝕜 α β}\nvariable [Semiring 𝕜] [AddCommGroup α] [AddCommGroup β]\nvariable (x y : WithLp p (α × β)) (c : 𝕜)\n\n/-- The projection on the first coordinate in `WithLp`. -/\nprotected def fst (x : WithLp p (α × β)) : α := (ofLp x).fst\n\n/-- The projection on the second coordinate in `WithLp`. -/\nprotected def snd (x : WithLp p (α × β)) : β := (ofLp x).snd\n\n@[simp]\ntheorem zero_fst : (0 : WithLp p (α × β)).fst = 0 :=\n rfl\n\n@[simp]\ntheorem zero_snd : (0 : WithLp p (α × β)).snd = 0 :=\n rfl\n\n@[simp]\ntheorem add_fst : (x + y).fst = x.fst + y.fst :=\n rfl\n\n@[simp]\ntheorem add_snd : (x + y).snd = x.snd + y.snd :=\n rfl\n\n@[simp]\ntheorem sub_fst : (x - y).fst = x.fst - y.fst :=\n rfl\n\n@[simp]\ntheorem sub_snd : (x - y).snd = x.snd - y.snd :=\n rfl\n\n@[simp]\ntheorem neg_fst : (-x).fst = -x.fst :=\n rfl\n\n@[simp]\ntheorem neg_snd : (-x).snd = -x.snd :=\n rfl\n\nvariable [Module 𝕜 α] [Module 𝕜 β]\n\n@[simp]\ntheorem smul_fst : (c • x).fst = c • x.fst :=\n rfl\n\n@[simp]\ntheorem smul_snd : (c • x).snd = c • x.snd :=\n rfl\n\nvariable (p 𝕜 α β)\n\n/-- `WithLp.fst` as a linear map. -/\n@[simps]\ndef fstₗ : WithLp p (α × β) →ₗ[𝕜] α where\n toFun := WithLp.fst\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\n/-- `WithLp.snd` as a linear map. -/\n@[simps]\ndef sndₗ : WithLp p (α × β) →ₗ[𝕜] β where\n toFun := WithLp.snd\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\nend algebra\n\n/-! Note that the unapplied versions of these lemmas are deliberately omitted, as they break\nthe use of the type synonym. -/\n\nsection equiv\n\nvariable {p α β}\n\n@[simp] lemma toLp_fst (x : α × β) : (toLp p x).fst = x.fst := rfl\n@[simp] lemma toLp_snd (x : α × β) : (toLp p x).snd = x.snd := rfl\n@[simp] lemma ofLp_fst (x : WithLp p (α × β)) : (ofLp x).fst = x.fst := rfl\n@[simp] lemma ofLp_snd (x : WithLp p (α × β)) : (ofLp x).snd = x.snd := rfl\n\nend equiv\n\nsection DistNorm\n\n/-!\n### Definition of `edist`, `dist` and `norm` on `WithLp p (α × β)`\n\nIn this section we define the `edist`, `dist` and `norm` functions on `WithLp p (α × β)` without\nassuming `[Fact (1 ≤ p)]` or metric properties of the spaces `α` and `β`. This allows us to provide\nthe rewrite lemmas for each of three cases `p = 0`, `p = ∞` and `0 < p.toReal`.\n-/\n\n\nsection EDist\n\nvariable [EDist α] [EDist β]\n\nopen scoped Classical in\n/-- Endowing the space `WithLp p (α × β)` with the `L^p` edistance. We register this instance\nseparate from `WithLp.instProdPseudoEMetric` since the latter requires the type class hypothesis\n`[Fact (1 ≤ p)]` in order to prove the triangle inequality.\n\nRegistering this separately allows for a future emetric-like structure on `WithLp p (α × β)` for\n`p < 1` satisfying a relaxed triangle inequality. The terminology for this varies throughout the\nliterature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/\ninstance instProdEDist : EDist (WithLp p (α × β)) where\n edist f g :=\n if _hp : p = 0 then\n (if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1)\n else if p = ∞ then\n edist f.fst g.fst ⊔ edist f.snd g.snd\n else\n (edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal)\n\nvariable {p α β}\n\n@[simp]\n\nTarget:\ntheorem prod_edist_eq_card (f g : WithLp 0 (α × β)) :\n edist f g =\n (if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_643830388682","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"ad8584cb2599399aa4405cd82a5cb935caab823da0f5a7183e8635ef4f21c719","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Normed","family_id":"prod_edist_eq_card","file_id":"mathlib/Mathlib/Analysis/Normed/Lp/ProdLp.lean","sample_id":"643830388682a53e868db5ec2cba5c60e896fb2e575f108745f92ba08a54ea20"},"split":"validation"} {"binding":{"chosen_proof_sha256":"96d926c0b11cee78eb87e06307d4e766a9d61eb46c5c0169a1f563540c85f0bf","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ce15a4338d0332eed734e41e9bcacaff09b24a76f31b01c98ebde55874522ad0","source_sha256":"61c6b8c956c45819c5a62aa885cad329c13f10279b91e08994009dca1da68c85","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by simpa using (Quotient.eq' p : mk x = 0 ↔ _)","hard_negative":false,"metrics":{"chosen_tokens":16,"rejected_tokens":2,"token_jaccard":0.058824,"token_length_ratio":0.125},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"3d841bd83c048f31c7d244fda6cb0cab43e2f4f08075865f4ee207712fd5221f","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.Equiv.Defs\npublic import Mathlib.Algebra.Module.Submodule.Defs\npublic import Mathlib.GroupTheory.QuotientGroup.Defs\npublic import Mathlib.Logic.Small.Basic\n\nNamespace:\nSubmodule.Quotient\n\nLocal context:\n/-\nCopyright (c) 2017 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Mario Carneiro, Kevin Buzzard, Yury Kudryashov\n-/\n/-!\n# Quotients by submodules\n\n* If `p` is a submodule of `M`, `M ⧸ p` is the quotient of `M` with respect to `p`:\n that is, elements of `M` are identified if their difference is in `p`. This is itself a module.\n\n## Main definitions\n\n* `Submodule.Quotient.mk`: a function sending an element of `M` to `M ⧸ p`\n* `Submodule.Quotient.module`: `M ⧸ p` is a module\n* `Submodule.Quotient.mkQ`: a linear map sending an element of `M` to `M ⧸ p`\n* `Submodule.quotEquivOfEq`: if `p` and `p'` are equal, their quotients are equivalent\n\n-/\n\n@[expose] public section\n\n-- For most of this file we work over a noncommutative ring\nsection Ring\n\nnamespace Submodule\n\nvariable {R M : Type*} {r : R} {x y : M} [Ring R] [AddCommGroup M] [Module R M]\nvariable (p p' : Submodule R M)\n\nopen QuotientAddGroup\n\n/-- The equivalence relation associated to a submodule `p`, defined by `x ≈ y` iff `-x + y ∈ p`.\n\nNote this is equivalent to `y - x ∈ p`, but defined this way to be defeq to the `AddSubgroup`\nversion, where commutativity can't be assumed. -/\ndef quotientRel : Setoid M :=\n QuotientAddGroup.leftRel p.toAddSubgroup\n\ntheorem quotientRel_def {x y : M} : p.quotientRel x y ↔ x - y ∈ p :=\n Iff.trans\n (by\n rw [quotientRel, leftRel_apply, sub_eq_add_neg, neg_add, neg_neg]\n rfl)\n neg_mem_iff\n\n/-- The quotient of a module `M` by a submodule `p ⊆ M`. -/\ninstance hasQuotient : HasQuotient M (Submodule R M) :=\n ⟨fun p => Quotient (quotientRel p)⟩\n\nnamespace Quotient\n/-- Map associating to an element of `M` the corresponding element of `M/p`,\nwhen `p` is a submodule of `M`. -/\ndef mk {p : Submodule R M} : M → M ⧸ p :=\n Quotient.mk''\n\ntheorem mk'_eq_mk' {p : Submodule R M} (x : M) :\n @Quotient.mk' _ (quotientRel p) x = mk x :=\n rfl\n\ntheorem mk''_eq_mk {p : Submodule R M} (x : M) : (Quotient.mk'' x : M ⧸ p) = mk x :=\n rfl\n\ntheorem quot_mk_eq_mk {p : Submodule R M} (x : M) : (Quot.mk _ x : M ⧸ p) = mk x :=\n rfl\n\ntheorem quotientAddGroupMk_eq_mk {p : Submodule R M} (x : M) :\n (QuotientAddGroup.mk x : M ⧸ p) = mk x :=\n rfl\n\nprotected theorem eq' {x y : M} : (mk x : M ⧸ p) = mk y ↔ -x + y ∈ p :=\n QuotientAddGroup.eq\n\nprotected theorem eq {x y : M} : (mk x : M ⧸ p) = mk y ↔ x - y ∈ p :=\n (Submodule.Quotient.eq' p).trans (leftRel_apply.symm.trans p.quotientRel_def)\n\ninstance : Zero (M ⧸ p) where\n -- Use Quotient.mk'' instead of mk here because mk is not reducible.\n -- This would lead to non-defeq diamonds.\n -- See also the same comment at the One instance for Con.\n zero := Quotient.mk'' 0\n\ninstance : Inhabited (M ⧸ p) :=\n ⟨0⟩\n\n@[simp]\ntheorem mk_zero : mk 0 = (0 : M ⧸ p) :=\n rfl\n\n@[simp]\n\nTarget:\ntheorem mk_eq_zero : (mk x : M ⧸ p) = 0 ↔ x ∈ p :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Quotient","family_id":"mk_eq_zero","file_id":"mathlib/Mathlib/LinearAlgebra/Quotient/Defs.lean","sample_id":"ce15a4338d0332eed734e41e9bcacaff09b24a76f31b01c98ebde55874522ad0"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c2d1b36b47fcd7b47b6135d0086a29b0331665d9175ab2341352e4ceeb8b56e6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"13ff775f4d82f815741502e8f749c57138d039bac39dd4e71a59e8a02adc837f","source_sha256":"dfcdfb7def47f0bcbcab37ea254b17db55b5da584b38ce7ceb07bc11e4db6c04","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]","hard_negative":false,"metrics":{"chosen_tokens":15,"rejected_tokens":2,"token_jaccard":0.071429,"token_length_ratio":0.133333},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"40ccbc8df5ceae6ec5f1bf1e51d258a8e236936e97b2172b897bc8c2f181944d","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Control.Bitraversable.Basic\n\nNamespace:\nBitraversable\n\nLocal context:\n/-\nCopyright (c) 2019 Simon Hudon. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Simon Hudon\n-/\n/-!\n# Bitraversable Lemmas\n\n## Main definitions\n * tfst - traverse on first functor argument\n * tsnd - traverse on second functor argument\n\n## Lemmas\n\nCombination of\n * bitraverse\n * tfst\n * tsnd\n\nwith the applicatives `id` and `comp`\n\n## References\n\n* Hackage: \n\n## Tags\n\ntraversable bitraversable functor bifunctor applicative\n\n\n-/\n\npublic section\n\n\nuniverse u\n\nvariable {t : Type u → Type u → Type u} [Bitraversable t]\nvariable {β : Type u}\n\nnamespace Bitraversable\n\nopen Functor LawfulApplicative\n\nvariable {F G : Type u → Type u} [Applicative F] [Applicative G]\n\n/-- traverse on the first functor argument -/\nabbrev tfst {α α'} (f : α → F α') : t α β → F (t α' β) :=\n bitraverse f pure\n\n/-- traverse on the second functor argument -/\nabbrev tsnd {α α'} (f : α → F α') : t β α → F (t β α') :=\n bitraverse pure f\n\nvariable [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G]\n\n@[higher_order tfst_id]\ntheorem id_tfst : ∀ {α β} (x : t α β), tfst (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tsnd_id]\ntheorem id_tsnd : ∀ {α β} (x : t α β), tsnd (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tfst_comp_tfst]\ntheorem comp_tfst {α₀ α₁ α₂ β} (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β) :\n Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, tfst, map_pure, Pure.pure]\n\n@[higher_order tfst_comp_tsnd]\ntheorem tfst_tsnd {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tfst f <$> tsnd f' x)\n = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n\n@[higher_order tsnd_comp_tfst]\n\nTarget:\ntheorem tsnd_tfst {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tsnd f' <$> tfst f x)\n = bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Control/Bitraversable","family_id":"tsnd_tfst","file_id":"mathlib/Mathlib/Control/Bitraversable/Lemmas.lean","sample_id":"13ff775f4d82f815741502e8f749c57138d039bac39dd4e71a59e8a02adc837f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c4f543325c92b1afeb9ee11a4321852898e6c86dd317fd6fb3fdffc5380013bc","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e92641cfda45171d81f3a9074a8af1cf6cc6038b79ace7dcdde9b2db9866360a","source_sha256":"cc2967dc8d7641f0817b378e7e53dcbd89d3d9b349ad605c7f1a8d10ea3bf1f7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Nontrivial V := IsSimpleModule.nontrivial A V\n obtain ⟨v, v_nz⟩ := exists_ne (0 : V)\n set U : Submodule A V := { Submodule.span k {v} with\n smul_mem' a w hw := by\n have ⟨t, ht⟩ := (IsSimpleModule.algebraMap_end_bijective_of_isAlgClosed k).2\n (Module.toModuleEnd A V a)\n simpa only [← show _ = a • w from congr($ht w)] using! (k ∙ v).smul_mem t hw }\n obtain hU | hU := eq_bot_or_eq_top U\n · exact (v_nz <| hU.le <| Submodule.mem_span_singleton_self v).elim\n · rw [finrank_eq_one_iff_of_nonzero v v_nz]\n rwa [← top_le_iff] at hU ⊢","hard_negative":false,"metrics":{"chosen_tokens":139,"rejected_tokens":3,"token_jaccard":0.028571,"token_length_ratio":0.021583},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"41e52d4f0f3bad2e966ef00a6c1bf9de49b09f9a8ea2743a29410dacbd8c526e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Lie.OfAssociative\npublic import Mathlib.FieldTheory.IsAlgClosed.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Stepan Nesterov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Stepan Nesterov\n-/\n/-!\n# Basic facts about algebra representations\n\nThis file collects basic general facts about algebra representations. The purpose of this file is\nto have general results so that when we prove a corresponding fact about group representations\n(or Lie algebra representations etc), we can deduce them as special cases of facts from this file.\n\n-/\n\npublic section\n\nvariable {A V : Type*} (k : Type*) [Field k] [Ring A] [Algebra k A] [AddCommGroup V] [Module k V]\n [Module A V] [IsScalarTower k A V]\n [IsSimpleModule A V] [FiniteDimensional k V] [IsAlgClosed k]\n\n/-- Schur's Lemma: If `V` is a representation of an algebra `A` over an algebraically closed field\n`k`, then any endomorphism of `V` is scalar. -/\ntheorem IsSimpleModule.algebraMap_end_bijective_of_isAlgClosed :\n Function.Bijective (algebraMap k (Module.End A V)) := by\n have : Module.Finite k (Module.End A V) := .of_injective (LinearMap.restrictScalarsₗ k A V V k) <|\n LinearMap.restrictScalars_injective _\n classical exact IsAlgClosed.algebraMap_bijective_of_isIntegral (k := k)\n\nvariable (A V)\n\nopen scoped IsMulCommutative in\n/-- Any finite-dimensional irreducible representation of a commutative algebra over an algebraically\nclosed field is one-dimensional. -/\n\nTarget:\ntheorem IsSimpleModule.finrank_eq_one_of_isMulCommutative [IsMulCommutative A] :\n Module.finrank k V = 1 :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RepresentationTheory/AlgebraRepresentation","family_id":"issimplemodule","file_id":"mathlib/Mathlib/RepresentationTheory/AlgebraRepresentation/Basic.lean","sample_id":"e92641cfda45171d81f3a9074a8af1cf6cc6038b79ace7dcdde9b2db9866360a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"e88cf4a4f386ebfb13d5ed22bf47cebfaf0a1724ee715664128c6ec868913295","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"493907e4aadff9257cbabefb8ba6347dac4027d881c0a58b0276ce9f92c49c15","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"241bad5eead6304b5dad8995bfd64a55289b8ca73fadc3ab52727f053689be63","source_sha256":"a8213893d9c236d1a671ab5169947332278178a687596e25984d183adf271e48","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp [binaryCoproductIso]\n aesop","hard_negative":true,"metrics":{"chosen_tokens":6,"rejected_tokens":3,"token_jaccard":0.125,"token_length_ratio":0.5},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"4368b3bb9e3619324307625f55b3b252b8d6323dc7ca28043bd0251ca91b5709","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic\npublic import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts\npublic import Mathlib.CategoryTheory.Limits.Types.Limits\npublic import Mathlib.CategoryTheory.Limits.Types.Colimits\n\nNamespace:\nCategoryTheory.FunctorToTypes\n\nLocal context:\n/-\nCopyright (c) 2024 Jack McKoen. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jack McKoen\n-/\n/-!\n# Binary (co)products of type-valued functors\n\nDefines an explicit construction of binary products and coproducts of type-valued functors.\n\nAlso defines isomorphisms to the categorical product and coproduct, respectively.\n-/\n\n@[expose] public section\n\n\nopen CategoryTheory Limits ConcreteCategory\n\nuniverse w v u\n\nnamespace CategoryTheory.FunctorToTypes\n\nvariable {C : Type u} [Category.{v} C]\nvariable (F G : C ⥤ Type w)\n\nsection prod\n\n/-- `prod F G` is the explicit binary product of type-valued functors `F` and `G`. -/\n@[simps obj map]\ndef prod : C ⥤ Type w where\n obj a := F.obj a × G.obj a\n map f := ↾fun a ↦ (F.map f a.1, G.map f a.2)\n\nvariable {F G}\n\n/-- The first projection of `prod F G`, onto `F`. -/\n@[simps app]\ndef prod.fst : prod F G ⟶ F where\n app _ := ↾fun a ↦ a.1\n\n/-- The second projection of `prod F G`, onto `G`. -/\n@[simps app]\ndef prod.snd : prod F G ⟶ G where\n app _ := ↾fun a ↦ a.2\n\n/-- Given natural transformations `F ⟶ F₁` and `F ⟶ F₂`, construct\na natural transformation `F ⟶ prod F₁ F₂`. -/\n@[simps]\ndef prod.lift {F₁ F₂ : C ⥤ Type w} (τ₁ : F ⟶ F₁) (τ₂ : F ⟶ F₂) :\n F ⟶ prod F₁ F₂ where\n app x := ↾fun y ↦ ⟨τ₁.app x y, τ₂.app x y⟩\n\n@[simp]\nlemma prod.lift_fst {F₁ F₂ : C ⥤ Type w} (τ₁ : F ⟶ F₁) (τ₂ : F ⟶ F₂) :\n prod.lift τ₁ τ₂ ≫ prod.fst = τ₁ := rfl\n\n@[simp]\nlemma prod.lift_snd {F₁ F₂ : C ⥤ Type w} (τ₁ : F ⟶ F₁) (τ₂ : F ⟶ F₂) :\n prod.lift τ₁ τ₂ ≫ prod.snd = τ₂ := rfl\n\nvariable (F G)\n\n/-- The binary fan whose point is `prod F G`. -/\n@[simps!]\ndef binaryProductCone : BinaryFan F G :=\n BinaryFan.mk prod.fst prod.snd\n\n/-- `prod F G` is a limit cone. -/\n@[simps]\ndef binaryProductLimit : IsLimit (binaryProductCone F G) where\n lift (s : BinaryFan F G) := prod.lift s.fst s.snd\n fac _ := fun ⟨j⟩ ↦ WalkingPair.casesOn j rfl rfl\n uniq _ _ h := by\n simp only [← h ⟨WalkingPair.right⟩, ← h ⟨WalkingPair.left⟩]\n congr\n\n/-- `prod F G` is a binary product for `F` and `G`. -/\ndef binaryProductLimitCone : Limits.LimitCone (pair F G) :=\n ⟨_, binaryProductLimit F G⟩\n\n/-- The categorical binary product of type-valued functors is `prod F G`. -/\nnoncomputable def binaryProductIso : F ⨯ G ≅ prod F G :=\n limit.isoLimitCone (binaryProductLimitCone F G)\n\n@[simp]\nlemma binaryProductIso_hom_comp_fst :\n (binaryProductIso F G).hom ≫ prod.fst = Limits.prod.fst := rfl\n\n@[simp]\nlemma binaryProductIso_hom_comp_snd :\n (binaryProductIso F G).hom ≫ prod.snd = Limits.prod.snd := rfl\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\nlemma binaryProductIso_inv_comp_fst :\n (binaryProductIso F G).inv ≫ Limits.prod.fst = prod.fst := by\n simp [binaryProductIso, binaryProductLimitCone]\n\n@[simp]\nlemma binaryProductIso_inv_comp_fst_apply (a : C) (z : (prod F G).obj a) :\n dsimp% (Limits.prod.fst (X := F)).app a ((binaryProductIso F G).inv.app a z) = z.1 :=\n congr_hom (congr_app (binaryProductIso_inv_comp_fst F G) a) z\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\nlemma binaryProductIso_inv_comp_snd :\n (binaryProductIso F G).inv ≫ Limits.prod.snd = prod.snd := by\n simp [binaryProductIso, binaryProductLimitCone]\n\n@[simp]\nlemma binaryProductIso_inv_comp_snd_apply (a : C) (z : (prod F G).obj a) :\n dsimp% (Limits.prod.snd (X := F)).app a ((binaryProductIso F G).inv.app a z) = z.2 :=\n congr_hom (congr_app (binaryProductIso_inv_comp_snd F G) a) z\n\nvariable {F G}\n\n/-- Construct an element of `(F ⨯ G).obj a` from an element of `F.obj a` and\nan element of `G.obj a`. -/\nnoncomputable\ndef prodMk {a : C} (x : F.obj a) (y : G.obj a) : (F ⨯ G).obj a :=\n ((binaryProductIso F G).inv).app a ⟨x, y⟩\n\n@[simp]\nlemma prodMk_fst {a : C} (x : F.obj a) (y : G.obj a) :\n (Limits.prod.fst (X := F)).app a (prodMk x y) = x := by\n simp [prodMk]\n\n@[simp]\nlemma prodMk_snd {a : C} (x : F.obj a) (y : G.obj a) :\n (Limits.prod.snd (X := F)).app a (prodMk x y) = y := by\n simp [prodMk]\n\n@[ext]\nlemma prod_ext {a : C} (z w : (prod F G).obj a) (h1 : z.1 = w.1) (h2 : z.2 = w.2) :\n z = w := Prod.ext h1 h2\n\nvariable (F G)\n\n/-- `(F ⨯ G).obj a` is in bijection with the product of `F.obj a` and `G.obj a`. -/\n@[simps]\nnoncomputable\ndef binaryProductEquiv (a : C) : (F ⨯ G).obj a ≃ (F.obj a) × (G.obj a) where\n toFun z := ⟨((binaryProductIso F G).hom.app a z).1, ((binaryProductIso F G).hom.app a z).2⟩\n invFun z := prodMk z.1 z.2\n left_inv _ := by simp [-prod_obj, prodMk]\n right_inv _ := by simp [-prod_obj, prodMk]\n\n@[ext]\nlemma prod_ext' (a : C) (z w : (F ⨯ G).obj a)\n (h1 : (Limits.prod.fst (X := F)).app a z = (Limits.prod.fst (X := F)).app a w)\n (h2 : (Limits.prod.snd (X := F)).app a z = (Limits.prod.snd (X := F)).app a w) :\n z = w := by\n apply Equiv.injective (binaryProductEquiv F G a)\n aesop\n\nend prod\n\nsection coprod\n\n/-- `coprod F G` is the explicit binary coproduct of type-valued functors `F` and `G`. -/\n@[simps obj map]\ndef coprod : C ⥤ Type w where\n obj a := F.obj a ⊕ G.obj a\n map f := ↾(Sum.map (F.map f) (G.map f))\n map_id _ := by ext ⟨⟩ <;> simp\n map_comp _ _ := by ext ⟨⟩ <;> simp\n\nvariable {F G}\n\n/-- The left inclusion of `F` into `coprod F G`. -/\n@[simps]\ndef coprod.inl : F ⟶ coprod F G where\n app _ := ↾fun x ↦ .inl x\n\n/-- The right inclusion of `G` into `coprod F G`. -/\n@[simps]\ndef coprod.inr : G ⟶ coprod F G where\n app _ := ↾fun x ↦ .inr x\n\nset_option backward.defeqAttrib.useBackward true in\n/-- Given natural transformations `F₁ ⟶ F` and `F₂ ⟶ F`, construct\na natural transformation `coprod F₁ F₂ ⟶ F`. -/\n@[simps]\ndef coprod.desc {F₁ F₂ : C ⥤ Type w} (τ₁ : F₁ ⟶ F) (τ₂ : F₂ ⟶ F) :\n coprod F₁ F₂ ⟶ F where\n app a := ↾(Sum.elim (τ₁.app a) (τ₂.app a))\n naturality _ _ _ := by ext ⟨⟩ <;> simp\n\n@[simp]\nlemma coprod.desc_inl {F₁ F₂ : C ⥤ Type w} (τ₁ : F₁ ⟶ F) (τ₂ : F₂ ⟶ F) :\n coprod.inl ≫ coprod.desc τ₁ τ₂ = τ₁ := rfl\n\n@[simp]\nlemma coprod.desc_inr {F₁ F₂ : C ⥤ Type w} (τ₁ : F₁ ⟶ F) (τ₂ : F₂ ⟶ F) :\n coprod.inr ≫ coprod.desc τ₁ τ₂ = τ₂ := rfl\n\nvariable (F G)\n\n/-- The binary cofan whose point is `coprod F G`. -/\n@[simps!]\ndef binaryCoproductCocone : BinaryCofan F G :=\n BinaryCofan.mk coprod.inl coprod.inr\n\nset_option backward.defeqAttrib.useBackward true in\n/-- `coprod F G` is a colimit cocone. -/\n@[simps]\ndef binaryCoproductColimit : IsColimit (binaryCoproductCocone F G) where\n desc (s : BinaryCofan F G) := coprod.desc s.inl s.inr\n fac _ := fun ⟨j⟩ ↦ WalkingPair.casesOn j rfl rfl\n uniq _ _ h := by\n ext _ x\n cases x with | _ => simp [← h ⟨WalkingPair.right⟩, ← h ⟨WalkingPair.left⟩]\n\n/-- `coprod F G` is a binary coproduct for `F` and `G`. -/\ndef binaryCoproductColimitCocone : Limits.ColimitCocone (pair F G) :=\n ⟨_, binaryCoproductColimit F G⟩\n\n/-- The categorical binary coproduct of type-valued functors is `coprod F G`. -/\nnoncomputable def binaryCoproductIso : F ⨿ G ≅ coprod F G :=\n colimit.isoColimitCocone (binaryCoproductColimitCocone F G)\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\nlemma inl_comp_binaryCoproductIso_hom :\n Limits.coprod.inl ≫ (binaryCoproductIso F G).hom = coprod.inl := by\n simp only [binaryCoproductIso]\n aesop\n\n@[simp]\nlemma inl_comp_binaryCoproductIso_hom_apply (a : C) (x : F.obj a) :\n dsimp% (binaryCoproductIso F G).hom.app a ((Limits.coprod.inl (X := F)).app a x) = .inl x :=\n congr_hom (congr_app (inl_comp_binaryCoproductIso_hom F G) a) x\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\n\nTarget:\nlemma inr_comp_binaryCoproductIso_hom :\n Limits.coprod.inr ≫ (binaryCoproductIso F G).hom = coprod.inr :=\n\nProof body:\n","rejected":"by\n exact inr_comp_binaryCoproductIso_hom","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"4470899a0e6b87883616bab5621b7ec356125bfdda88b364826cc506c82d5433","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Limits","family_id":"inr_comp_binarycoproductiso_hom","file_id":"mathlib/Mathlib/CategoryTheory/Limits/Shapes/FunctorToTypes.lean","sample_id":"241bad5eead6304b5dad8995bfd64a55289b8ca73fadc3ab52727f053689be63"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1d0ec81d029f062c72e75fa8be2f1729cc3c1eb96a4a2c9cdc3e3806c3732cb0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"408060ae3a28659f83cb4e62e2bf39c8fd83d7e7e19911f46e717649bdbc5d13","source_sha256":"484b555447ac93535ee86f92f767ea9e12d384105ac74c26fe8c77249c716290","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n letI := hf.mulActionFiber x\n have := hf.mulActionFiber_isPretransitive x\n obtain ⟨g, rfl⟩ := MulAction.IsPretransitive.exists_smul_eq e e' (M := G)\n use g\n ext\n simp","hard_negative":false,"metrics":{"chosen_tokens":36,"rejected_tokens":2,"token_jaccard":0.035714,"token_length_ratio":0.055556},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"44137bbdac0cbef5662b4dcbfa225f8fd783ef76d6cde1369322c8ba8c76ee83","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.Coset.Defs\npublic import Mathlib.Topology.Algebra.ConstMulAction\npublic import Mathlib.Topology.Algebra.Group.Quotient\npublic import Mathlib.Topology.Covering.Basic\n\nNamespace:\nIsQuotientCoveringMap\n\nLocal context:\n/-\nCopyright (c) 2025 Junyan Xu. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Junyan Xu\n-/\n/-!\n# Covering maps to quotients by free and properly discontinuous group actions\n-/\n\n@[expose] public section\n\nvariable {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] (f : E → X)\nvariable (G : Type*) [Group G] [MulAction G E]\n\nopen Topology\n\n/-- A function from a topological space `E` with an action by a discrete group to another\ntopological space `X` is a quotient covering map if it is a quotient map, the action is\ncontinuous and transitive on fibers, and every point of `E` has a neighborhood whose translates\nby the group elements are pairwise disjoint. -/\nstructure IsAddQuotientCoveringMap (G) [AddGroup G] [AddAction G E] : Prop\n extends IsQuotientMap f, ContinuousConstVAdd G E where\n apply_eq_iff_mem_orbit {e₁ e₂} : f e₁ = f e₂ ↔ e₁ ∈ AddAction.orbit G e₂\n disjoint (e : E) : ∃ U ∈ 𝓝 e, ∀ g : G, ((g +ᵥ ·) '' U ∩ U).Nonempty → g = 0\n\n/-- A function from a topological space `E` with an action by a discrete group to another\ntopological space `X` is a quotient covering map if it is a quotient map, the action is\ncontinuous and transitive on fibers, and every point of `E` has a neighborhood whose translates\nby the group elements are pairwise disjoint. -/\n@[mk_iff, to_additive]\nstructure IsQuotientCoveringMap : Prop extends IsQuotientMap f, ContinuousConstSMul G E where\n apply_eq_iff_mem_orbit {e₁ e₂} : f e₁ = f e₂ ↔ e₁ ∈ MulAction.orbit G e₂\n disjoint (e : E) : ∃ U ∈ 𝓝 e, ∀ g : G, ((g • ·) '' U ∩ U).Nonempty → g = 1\n\nattribute [to_additive] isQuotientCoveringMap_iff\n\nnamespace IsQuotientCoveringMap\n\n@[to_additive] theorem subgroup_congr (S S' : Subgroup G) (eq : S = S') :\n IsQuotientCoveringMap f S ↔ IsQuotientCoveringMap f S' := by rw [eq]\n\nvariable {f G} (hf : IsQuotientCoveringMap f G)\ninclude hf\n\n@[to_additive] protected theorem map_smul (g : G) {e : E} : f (g • e) = f e :=\n hf.apply_eq_iff_mem_orbit.mpr ⟨g, rfl⟩\n\n/-- The group action on the domain of a quotient covering map is free. -/\n@[to_additive] theorem isCancelSMul : IsCancelSMul G E where\n right_cancel' g g' e eq := by\n have ⟨U, heU, hU⟩ := hf.disjoint e\n simpa [inv_mul_eq_one, eq_comm] using hU (g'⁻¹ * g)\n ⟨e, ⟨e, mem_of_mem_nhds heU, by simpa [mul_smul, inv_smul_eq_iff]⟩, mem_of_mem_nhds heU⟩\n\n@[to_additive] theorem homeomorph_comp {Y} [TopologicalSpace Y]\n (φ : X ≃ₜ Y) : IsQuotientCoveringMap (φ ∘ f) G where\n __ := φ.isQuotientMap.comp hf.toIsQuotientMap\n continuous_const_smul := hf.continuous_const_smul\n apply_eq_iff_mem_orbit := by simpa using @hf.apply_eq_iff_mem_orbit\n disjoint := hf.disjoint\n\nomit hf in\n@[to_additive (attr := simp)] theorem homeomorph_comp_iff {Y} [TopologicalSpace Y]\n (φ : X ≃ₜ Y) : IsQuotientCoveringMap (φ ∘ f) G ↔ IsQuotientCoveringMap f G where\n mp h := by convert! h.homeomorph_comp φ.symm; ext; simp\n mpr h := h.homeomorph_comp φ\n\n/-- Fibers of a quotient covering map by a group G is a G-torsor. -/\n@[to_additive /-- Fibers of a quotient covering map by an additive group G is a G-torsor. -/]\nnoncomputable def fiberEquivGroup {x : X} (e : f ⁻¹' {x}) : f ⁻¹' {x} ≃ G :=\n have := hf.isCancelSMul\n .symm <| .ofBijective (fun g ↦ ⟨g • e, (hf.map_smul g).trans e.2⟩)\n ⟨fun _ _ eq ↦ IsCancelSMul.right_cancel _ _ e.1 congr($eq), fun e' ↦\n have ⟨g, eq⟩ := hf.apply_eq_iff_mem_orbit.mp (e'.2.trans e.2.symm); ⟨g, Subtype.ext eq⟩⟩\n\n@[simp] theorem fiberEquivGroup_self {x : X} (e : f ⁻¹' {x}) : hf.fiberEquivGroup e e = 1 :=\n (Equiv.apply_eq_iff_eq_symm_apply _).mpr <| Subtype.ext (one_smul ..).symm\n\n@[simp] theorem fiberEquivGroup_eq_iff {x : X} (e e' : f ⁻¹' {x}) (g : G) :\n hf.fiberEquivGroup e e' = g ↔ e' = g • (e : E) := by\n rw [fiberEquivGroup, Equiv.symm_apply_eq, Equiv.ofBijective_apply, Subtype.mk.injEq]\n\n@[simp] theorem fiberEquivGroup_smul_self {x : X} (e : f ⁻¹' {x}) {e' : f ⁻¹' {x}} :\n hf.fiberEquivGroup e e' • (e : E) = (e' : E) :=\n congr($((hf.fiberEquivGroup e).symm_apply_apply e'))\n\n/-- The action of `G` restricted to the fiber. -/\n@[implicit_reducible] def mulActionFiber (x : X) : MulAction G (f ⁻¹' {x}) :=\n SubMulAction.mulAction ⟨f ⁻¹' {x}, fun g _ h ↦ (hf.map_smul g).trans h⟩\n\n@[simp] lemma coe_mulActionFiber_smul (x : X) (g : G) (e : f ⁻¹' {x}) :\n letI := hf.mulActionFiber x\n (↑(g • e) : E) = g • (e : E) :=\n rfl\n\nlemma mulActionFiber_isPretransitive (x : X) :\n letI := hf.mulActionFiber x\n MulAction.IsPretransitive G (f ⁻¹' {x}) := by\n letI := hf.mulActionFiber x\n constructor\n intro e e'\n obtain ⟨g, hg⟩ := hf.apply_eq_iff_mem_orbit.mp (e'.2.trans e.2.symm)\n exact ⟨g, Subtype.ext hg⟩\n\n/-- A quotient covering map `f` induces a permutation action on each fiber. -/\n@[simps!] def toPermFiber (x : X) : G →* Equiv.Perm (f ⁻¹' {x}) :=\n (hf.mulActionFiber x).toPermHom\n\ntheorem toPermFiber_ext (x : X) (e : f ⁻¹' {x}) {g g' : G}\n (eq : hf.toPermFiber x g e = hf.toPermFiber x g' e) : g = g' :=\n have := hf.isCancelSMul\n IsCancelSMul.right_cancel _ _ e.1 congr($eq)\n\ntheorem toPermFiber_injective (x : X) : Function.Injective (hf.toPermFiber x) :=\n have ⟨e, he⟩ := hf.surjective x\n fun _ _ eq ↦ hf.toPermFiber_ext x ⟨e, he⟩ congr($eq _)\n\nTarget:\ntheorem exists_toPermFiber_eq {x : X} (e e' : f ⁻¹' {x}) : ∃ g, hf.toPermFiber x g e = e' :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Covering","family_id":"exists_topermfiber_eq","file_id":"mathlib/Mathlib/Topology/Covering/Quotient.lean","sample_id":"408060ae3a28659f83cb4e62e2bf39c8fd83d7e7e19911f46e717649bdbc5d13"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c4f543325c92b1afeb9ee11a4321852898e6c86dd317fd6fb3fdffc5380013bc","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"988b782ce29b046269459f4c8e093dab7ba5e5448ab13397c1d556d5eadc79d7","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e92641cfda45171d81f3a9074a8af1cf6cc6038b79ace7dcdde9b2db9866360a","source_sha256":"cc2967dc8d7641f0817b378e7e53dcbd89d3d9b349ad605c7f1a8d10ea3bf1f7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Nontrivial V := IsSimpleModule.nontrivial A V\n obtain ⟨v, v_nz⟩ := exists_ne (0 : V)\n set U : Submodule A V := { Submodule.span k {v} with\n smul_mem' a w hw := by\n have ⟨t, ht⟩ := (IsSimpleModule.algebraMap_end_bijective_of_isAlgClosed k).2\n (Module.toModuleEnd A V a)\n simpa only [← show _ = a • w from congr($ht w)] using! (k ∙ v).smul_mem t hw }\n obtain hU | hU := eq_bot_or_eq_top U\n · exact (v_nz <| hU.le <| Submodule.mem_span_singleton_self v).elim\n · rw [finrank_eq_one_iff_of_nonzero v v_nz]\n rwa [← top_le_iff] at hU ⊢","hard_negative":true,"metrics":{"chosen_tokens":139,"rejected_tokens":5,"token_jaccard":0.057143,"token_length_ratio":0.035971},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"45d0acc4520093d06d076c6966df3c71bc366c7529830cd30234cb3692c83786","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Lie.OfAssociative\npublic import Mathlib.FieldTheory.IsAlgClosed.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Stepan Nesterov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Stepan Nesterov\n-/\n/-!\n# Basic facts about algebra representations\n\nThis file collects basic general facts about algebra representations. The purpose of this file is\nto have general results so that when we prove a corresponding fact about group representations\n(or Lie algebra representations etc), we can deduce them as special cases of facts from this file.\n\n-/\n\npublic section\n\nvariable {A V : Type*} (k : Type*) [Field k] [Ring A] [Algebra k A] [AddCommGroup V] [Module k V]\n [Module A V] [IsScalarTower k A V]\n [IsSimpleModule A V] [FiniteDimensional k V] [IsAlgClosed k]\n\n/-- Schur's Lemma: If `V` is a representation of an algebra `A` over an algebraically closed field\n`k`, then any endomorphism of `V` is scalar. -/\ntheorem IsSimpleModule.algebraMap_end_bijective_of_isAlgClosed :\n Function.Bijective (algebraMap k (Module.End A V)) := by\n have : Module.Finite k (Module.End A V) := .of_injective (LinearMap.restrictScalarsₗ k A V V k) <|\n LinearMap.restrictScalars_injective _\n classical exact IsAlgClosed.algebraMap_bijective_of_isIntegral (k := k)\n\nvariable (A V)\n\nopen scoped IsMulCommutative in\n/-- Any finite-dimensional irreducible representation of a commutative algebra over an algebraically\nclosed field is one-dimensional. -/\n\nTarget:\ntheorem IsSimpleModule.finrank_eq_one_of_isMulCommutative [IsMulCommutative A] :\n Module.finrank k V = 1 :=\n\nProof body:\n","rejected":"by\n exact IsSimpleModule.finrank_eq_one_of_isMulCommutative","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"76ee592bfc2c098dae548a65f2d636ea32e7217640714b7ede933ea326ad3f77","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RepresentationTheory/AlgebraRepresentation","family_id":"issimplemodule","file_id":"mathlib/Mathlib/RepresentationTheory/AlgebraRepresentation/Basic.lean","sample_id":"e92641cfda45171d81f3a9074a8af1cf6cc6038b79ace7dcdde9b2db9866360a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"caa002cb212c353282864e9f564bff6c16a1207fabe9e0633a1a9b9782cc3cf8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"b1be8c25175294dc1c04ff1ce7bf75503ac22bd9b28d0049949d83e76a154742","source_sha256":"c60b869c723c3c91f9b10ffc01a437f63b4e5c04e61a58398bcd9e9d0ac2e64f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [sum_def', SkewMonoidAlgebra.sum_sum_index (fun a ↦ h_zero (toAdd a))\n (fun a ↦ h_add (toAdd a))]","hard_negative":true,"metrics":{"chosen_tokens":30,"rejected_tokens":8,"token_jaccard":0.041667,"token_length_ratio":0.266667},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"4ae9947d786e05e1a8393841fe731013c14ceec935206ec409dbf5d76accca93","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Single\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Support\n\nNamespace:\nSkewPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Xavier Généreux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Xavier Généreux, María Inés de Frutos-Fernández\n-/\n/-!\n# Univariate skew polynomials\n\nGiven a ring `R` and an endomorphism `φ` on `R` the skew polynomials over `R`\nare polynomials\n$$\\sum_{i= 0}^n a_iX^n, n\\geq 0, a_i\\in R$$\nwhere the addition is the usual addition of polynomials\n$$\\sum_{i= 0}^n a_iX^n + \\sum_{i= 0}^n b_iX^n= \\sum_{i= 0}^n (a_i + b_i)X^n.$$\nThe multiplication, however, is determined by\n$$Xa = \\varphi (a)X$$\nby extending it to all polynomials in the obvious way.\n\nSkew polynomials are represented as `SkewMonoidAlgebra R (Multiplicative ℕ)`,\nwhere `R` is usually at least a Semiring. In this file, we define `SkewPolynomial`\nand provide basic instances.\n\n**Note**: To register the endomorphism `φ` see notation below.\n\n## Notation\n\nThe endomorphism `φ` is implemented using some action of `Multiplicative ℕ` on `R`.\nFrom this action, `φ` is an `abbrev` denoting $(\\text{ofAdd } 1) \\cdot a := \\varphi(a)$.\n\nUsers that want to work with a specific map `φ` should introduce an action of\n`Multiplicative ℕ` on `R`. Specifying that this action is a `MulSemiringAction` amounts\nto saying that `φ` is an endomorphism.\n\nFurthermore, with this notation `φ^[n](a) = (ofAdd n) • a`, see `φ_iterate_apply`.\n\n## Main definitions\n\n* `SkewPolynomial.monomial n a` is the skew polynomial `a X ^ n`. Note that\n `SkewPolynomial.monomial n` is defined as an `R`-linear map.\n* `SkewPolynomial.C a` is the constant skew polynomial `a`. Note that `C` is defined as an additive\n homomorphism.\n* `SkewPolynomial.CRingHom a` is the constant skew polynomial `a`, as a ring homomorphism. This\n requires to assume `[MulSemiringAction (Multiplicative ℕ) R]`.\n* `SkewPolynomial.X` is the skew polynomial `X`, i.e., `SkewPolynomial.monomial 1 1`.\n* `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`.\n* `SkewPolynomial.coeff p n` is the coefficient of `X ^ n` in `p`.\n* `SkewPolynomial.erase p n` is the skew polynomial `p` in which one removes the monomial in\n degree `n`.\n* `SkewPolynomial.update p n a` is the skew polynomial obtained by replacing the coefficient of\n degree `n` by a given value `a : R`. If `a = 0`, this is equal to `p.erase n` If\n `p.natDegree < n` and `a ≠ 0`, this increases the degree of `p` to `n`.\n\n## Implementation notes\n\nThe implementation uses `Multiplicative ℕ` instead of `ℕ`, since Mathlib does not contain an\nadditive version of `SkewMonoidAlgebra`.\n\nThis decision was made because we use the type class `MulSemiringAction` to specify the properties\nthe action needs to respect for associativity. There is no version of this in Mathlib that\nuses an acting `AddMonoid M` and so we need to use `Multiplicative ℕ` for the action.\n\nFor associativity to hold, there should be an instance of\n`MulSemiringAction (Multiplicative ℕ) R` present in the context.\nFor example, in the context of $\\mathbb{F}_q$-linear polynomials, this can be the\n$q$-th Frobenius endomorphism - so $\\varphi(a) = a^q$.\n\n## Reference\n\nThe definition is inspired by Chapter 3 of [Papikian2023].\n\n## Tags\n\nSkew Polynomials, Twisted Polynomials.\n\nNote that [ore33] proposes a more general definition of skew polynomial ring, where the\nmultiplication is determined by $Xa = \\varphi (a)X + δ (a)$, where `φ` is as above and\n`δ` is a derivation.\n\n-/\n\n@[expose] public section\n\nnoncomputable section\n\nopen Function Multiplicative SkewMonoidAlgebra\n\n/-- The skew polynomials over `R` is the type of univariate polynomials over `R`\nendowed with a skewed convolution product. -/\nabbrev SkewPolynomial (R : Type*) [AddCommMonoid R] := SkewMonoidAlgebra R (Multiplicative ℕ)\n\nnamespace SkewPolynomial\n\nvariable {R : Type*} {m n : ℕ}\n\nsection Semiring\n\nvariable [Semiring R] {p q : SkewPolynomial R}\n\n\nlemma zero_def : (0 : SkewPolynomial R) = (0 : SkewMonoidAlgebra R (Multiplicative ℕ)) := rfl\n\nvariable {S S₁ S₂ : Type*}\n\n/--\nThe set of all `n` such that `X^n` has a non-zero coefficient.\n-/\ndef support (p : SkewPolynomial R) : Finset ℕ :=\n Finset.map ⟨toAdd, toAdd.injective⟩ (SkewMonoidAlgebra.support p)\n\n/-- Though `SkewPolynomial.support` is not definiyionally equal to `SkewMonoidAlgebra.support` we\n can relate them using the following lemma. -/\nlemma support_eq_skewMonoidAlgebra_support (p : SkewPolynomial R) :\n p.support = Finset.map (Multiplicative.toAdd (α := ℕ)) (SkewMonoidAlgebra.support p) := by\n simp only [support]\n\n@[simp] lemma support_zero : (0 : SkewPolynomial R).support = ∅ := rfl\n\n@[simp] lemma support_eq_empty : p.support = ∅ ↔ p = 0 := by simp [support]\n\nlemma card_support_eq_zero : p.support.card = 0 ↔ p = 0 := by simp\n\nlemma support_add : (p + q).support ⊆ p.support ∪ q.support := by\n simpa [support, ← Finset.map_union, Finset.map_subset_map] using SkewMonoidAlgebra.support_add\n\n/-- `coeff p n` is the coefficient of `X ^ n` in `p`. -/\ndef coeff (p : SkewPolynomial R) : ℕ → R := fun n ↦ (SkewMonoidAlgebra.coeff p (ofAdd n))\n\n@[simp]\nlemma mem_support_iff : n ∈ p.support ↔ p.coeff n ≠ 0 := by\n simp [support, coeff]\n\nlemma notMem_support_iff : n ∉ p.support ↔ p.coeff n = 0 := by simp\n\n/-- `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`. -/\ndef sum {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) : S :=\n SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r)\n\n/-- For a skew polynomial `p`, `p.sum f` can be written in terms of `SkewMonoidAlgebra.sum p`. -/\nlemma sum_def' {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r) := rfl\n\nlemma sum_def {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = ∑ n ∈ p.support, f n (p.coeff n) := by\n simp only [sum_def', SkewMonoidAlgebra.sum_def, Finsupp.sum, toFinsupp_apply]\n apply Finset.sum_of_injOn (toAdd) (Injective.injOn fun ⦃a₁ a₂⦄ a ↦ a) (fun _ ↦ ?_) <;>\n simp +contextual [coeff]\n\nTarget:\nlemma sum_sum_index {R' P : Type*} [AddCommMonoid P] [Semiring R']\n {f : SkewPolynomial R} {g : ℕ → R → SkewPolynomial R'} {h : ℕ → R' → P}\n (h_zero : ∀ (a : ℕ), h a 0 = 0)\n (h_add : ∀ (a : ℕ) (b₁ b₂ : R'), h a (b₁ + b₂) = h a b₁ + h a b₂) :\n sum (sum f g) h = sum f fun (a : ℕ) (b : R) ↦ sum (g a b) h :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"e4f842143ffd329c5f8781837756ca10c4ca54db22ff9b7575b81044b490eecc","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/SkewPolynomial","family_id":"sum_sum_index","file_id":"mathlib/Mathlib/Algebra/SkewPolynomial/Basic.lean","sample_id":"b1be8c25175294dc1c04ff1ce7bf75503ac22bd9b28d0049949d83e76a154742"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4c8ef71d2d3a0df5c3ff062f63a8d6e4733682a05b9b2f1a5b20db0e2ca01950","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"2079b24ed65d697960d8a8126f39d72ebec4eff6297786b653f24cc555d8224b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"643830388682a53e868db5ec2cba5c60e896fb2e575f108745f92ba08a54ea20","source_sha256":"8b79e0352e627153fad48283e58e6ec415c2eeb49cc3fdb956c3554f13241fca","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n convert! if_pos rfl","hard_negative":false,"metrics":{"chosen_tokens":5,"rejected_tokens":12,"token_jaccard":0.714286,"token_length_ratio":2.4},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"4b335be0f1e17f1c187ce529e639d44c5fd5d4ddca624067dcc5c5206ca26d1a","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.MeanInequalities\npublic import Mathlib.Analysis.Normed.Lp.WithLp\n\nNamespace:\nWithLp\n\nLocal context:\n/-\nCopyright (c) 2023 Moritz Doll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Moritz Doll, Sébastien Gouëzel, Jireh Loreaux\n-/\n/-!\n# `L^p` distance on products of two metric spaces\nGiven two metric spaces, one can put the max distance on their product, but there is also\na whole family of natural distances, indexed by a parameter `p : ℝ≥0∞`, that also induce\nthe product topology. We define them in this file. For `0 < p < ∞`, the distance on `α × β`\nis given by\n$$\nd(x, y) = \\left(d(x_1, y_1)^p + d(x_2, y_2)^p\\right)^{1/p}.\n$$\nFor `p = ∞` the distance is the supremum of the distances and `p = 0` the distance is the\ncardinality of the elements that are not equal.\n\nWe give instances of this construction for emetric spaces, metric spaces, normed groups and normed\nspaces.\n\nTo avoid conflicting instances, all these are defined on a copy of the original Prod-type, named\n`WithLp p (α × β)`. The assumption `[Fact (1 ≤ p)]` is required for the metric and normed space\ninstances.\n\nWe ensure that the topology, bornology and uniform structure on `WithLp p (α × β)` are (defeq to)\nthe product topology, product bornology and product uniformity, to be able to use freely continuity\nstatements for the coordinate functions, for instance.\n\nIf you wish to endow a type synonym of `α × β` with the `L^p` distance, you can use\n`pseudoMetricSpaceToProd` and the declarations below that one.\n\n\n## Implementation notes\n\nThis file is a straight-forward adaptation of `Mathlib/Analysis/Normed/Lp/PiLp.lean`.\n\n## TODO\n\nTODO: the results about uniformity and bornology in the `Aux` section should be using the tools in\n`Mathlib.Topology.MetricSpace.Bilipschitz`, so that they can be inlined in the next section and\nthe only remaining results are about `Lipschitz` and `Antilipschitz`.\n\n-/\n\n@[expose] public section\n\nopen Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal\n\nnoncomputable section\n\nvariable (p : ℝ≥0∞) (𝕜 α β : Type*)\n\nnamespace WithLp\n\nsection algebra\n\n/- Register simplification lemmas for the applications of `WithLp p (α × β)` elements, as the usual\nlemmas for `Prod` will not trigger. -/\n\nvariable {p 𝕜 α β}\nvariable [Semiring 𝕜] [AddCommGroup α] [AddCommGroup β]\nvariable (x y : WithLp p (α × β)) (c : 𝕜)\n\n/-- The projection on the first coordinate in `WithLp`. -/\nprotected def fst (x : WithLp p (α × β)) : α := (ofLp x).fst\n\n/-- The projection on the second coordinate in `WithLp`. -/\nprotected def snd (x : WithLp p (α × β)) : β := (ofLp x).snd\n\n@[simp]\ntheorem zero_fst : (0 : WithLp p (α × β)).fst = 0 :=\n rfl\n\n@[simp]\ntheorem zero_snd : (0 : WithLp p (α × β)).snd = 0 :=\n rfl\n\n@[simp]\ntheorem add_fst : (x + y).fst = x.fst + y.fst :=\n rfl\n\n@[simp]\ntheorem add_snd : (x + y).snd = x.snd + y.snd :=\n rfl\n\n@[simp]\ntheorem sub_fst : (x - y).fst = x.fst - y.fst :=\n rfl\n\n@[simp]\ntheorem sub_snd : (x - y).snd = x.snd - y.snd :=\n rfl\n\n@[simp]\ntheorem neg_fst : (-x).fst = -x.fst :=\n rfl\n\n@[simp]\ntheorem neg_snd : (-x).snd = -x.snd :=\n rfl\n\nvariable [Module 𝕜 α] [Module 𝕜 β]\n\n@[simp]\ntheorem smul_fst : (c • x).fst = c • x.fst :=\n rfl\n\n@[simp]\ntheorem smul_snd : (c • x).snd = c • x.snd :=\n rfl\n\nvariable (p 𝕜 α β)\n\n/-- `WithLp.fst` as a linear map. -/\n@[simps]\ndef fstₗ : WithLp p (α × β) →ₗ[𝕜] α where\n toFun := WithLp.fst\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\n/-- `WithLp.snd` as a linear map. -/\n@[simps]\ndef sndₗ : WithLp p (α × β) →ₗ[𝕜] β where\n toFun := WithLp.snd\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\nend algebra\n\n/-! Note that the unapplied versions of these lemmas are deliberately omitted, as they break\nthe use of the type synonym. -/\n\nsection equiv\n\nvariable {p α β}\n\n@[simp] lemma toLp_fst (x : α × β) : (toLp p x).fst = x.fst := rfl\n@[simp] lemma toLp_snd (x : α × β) : (toLp p x).snd = x.snd := rfl\n@[simp] lemma ofLp_fst (x : WithLp p (α × β)) : (ofLp x).fst = x.fst := rfl\n@[simp] lemma ofLp_snd (x : WithLp p (α × β)) : (ofLp x).snd = x.snd := rfl\n\nend equiv\n\nsection DistNorm\n\n/-!\n### Definition of `edist`, `dist` and `norm` on `WithLp p (α × β)`\n\nIn this section we define the `edist`, `dist` and `norm` functions on `WithLp p (α × β)` without\nassuming `[Fact (1 ≤ p)]` or metric properties of the spaces `α` and `β`. This allows us to provide\nthe rewrite lemmas for each of three cases `p = 0`, `p = ∞` and `0 < p.toReal`.\n-/\n\n\nsection EDist\n\nvariable [EDist α] [EDist β]\n\nopen scoped Classical in\n/-- Endowing the space `WithLp p (α × β)` with the `L^p` edistance. We register this instance\nseparate from `WithLp.instProdPseudoEMetric` since the latter requires the type class hypothesis\n`[Fact (1 ≤ p)]` in order to prove the triangle inequality.\n\nRegistering this separately allows for a future emetric-like structure on `WithLp p (α × β)` for\n`p < 1` satisfying a relaxed triangle inequality. The terminology for this varies throughout the\nliterature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/\ninstance instProdEDist : EDist (WithLp p (α × β)) where\n edist f g :=\n if _hp : p = 0 then\n (if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1)\n else if p = ∞ then\n edist f.fst g.fst ⊔ edist f.snd g.snd\n else\n (edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal)\n\nvariable {p α β}\n\n@[simp]\n\nTarget:\ntheorem prod_edist_eq_card (f g : WithLp 0 (α × β)) :\n edist f g =\n (if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) :=\n\nProof body:\n","rejected":"```lean\nby\n convert! if_pos rfl\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Normed","family_id":"prod_edist_eq_card","file_id":"mathlib/Mathlib/Analysis/Normed/Lp/ProdLp.lean","sample_id":"643830388682a53e868db5ec2cba5c60e896fb2e575f108745f92ba08a54ea20"},"split":"validation"} {"binding":{"chosen_proof_sha256":"23c55cca4aed493c49257296261d4b5d523dc34abeab85aa3e8f3b0acfe54ba4","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8c5474d5a748750311f34bb635b8469d911df14dd8f7a3cb5f4fb88ebf96dde7","source_sha256":"72b411c1082944ace2118b8714603a368d84839ae6de6aadd5f7075fc5a741e8","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_all [eq_zero_of_add_right hs₁ hs₂ h]","hard_negative":false,"metrics":{"chosen_tokens":10,"rejected_tokens":2,"token_jaccard":0.1,"token_length_ratio":0.2},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"4c51bf5500c632770678f6cf5bac308b2be5a22b5dc4e26e292f469be60c4243","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Ring.SumsOfSquares\npublic import Mathlib.RingTheory.Nilpotent.Basic\n\nNamespace:\nIsFormallyReal\n\nLocal context:\n/-\nCopyright (c) 2026 Artie Khovanov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Artie Khovanov\n-/\n/-!\n# Formally real rings\n\nA ring `R` is *formally real* if, whenever `∑ i, x i ^ 2 = 0`, in fact `x i = 0` for all `i`.\n\nWe define formally real rings in an index-free manner using the inductive predicate\n`IsSumNonzeroSq`, which asserts that an element is a finite sum of squares of nonzero elements.\nA ring is then formally real if `¬ IsSumNonzeroSq 0`.\n\n## Main declaration\n\n- `IsFormallyReal`: typeclass stating that a ring is formally real.\n\n-/\n\n@[expose] public section\n\nvariable {R : Type*}\n\nsection IsSumNonzeroSq\n\n/--\nThe property of being a sum of squares of nonzero elements (S) is defined inductively by:\n`a * a : R` is (S) for all nonzero `a`, and\nif `s : R` is (S), and `a ≠ 0`, then `a * a + s` is (S).\n-/\n@[mk_iff]\ninductive IsSumNonzeroSq [Mul R] [Add R] [Zero R] : R → Prop\n | sq {a : R} (ha : a ≠ 0) : IsSumNonzeroSq (a * a)\n | sq_add {a s : R} (ha : a ≠ 0) (hs : IsSumNonzeroSq s) : IsSumNonzeroSq (a * a + s)\n\nattribute [aesop 90%] IsSumNonzeroSq.sq\n\n@[aesop 90%]\ntheorem IsSumNonzeroSq.add [AddMonoid R] [Mul R] {s₁ s₂ : R}\n (h₁ : IsSumNonzeroSq s₁) (h₂ : IsSumNonzeroSq s₂) : IsSumNonzeroSq (s₁ + s₂) := by\n induction h₁ <;> simp_all [sq_add, add_assoc]\n\ntheorem IsSumNonzeroSq.isSumSq [AddMonoid R] [Mul R] {s : R}\n (h : IsSumNonzeroSq s) : IsSumSq s := by\n induction h <;> aesop\n\ntheorem isSumNonzeroSq_iff_isSumSq [NonUnitalNonAssocSemiring R] {s : R} (hs : s ≠ 0) :\n IsSumNonzeroSq s ↔ IsSumSq s where\n mp := IsSumNonzeroSq.isSumSq\n mpr h := by\n induction h with\n | zero => grind\n | @sq_add a s hs ih =>\n rcases eq_or_ne a 0 with (rfl | ne_a)\n · simp_all\n · rcases eq_or_ne s 0 with (rfl | ne_s)\n · simpa using IsSumNonzeroSq.sq ne_a\n · exact IsSumNonzeroSq.sq_add ne_a (ih ne_s)\n\nalias ⟨_, IsSumSq.isSumNonzeroSq_of_ne_zero⟩ := isSumNonzeroSq_iff_isSumSq\n\nnamespace AddSubsemigroup\n\nvariable [AddMonoid R] [Mul R] {s : R}\n\nvariable (R) in\n/-- The subsemigroup of sums of squares of nonzero elements. -/\n@[simps]\ndef sumNonzeroSq : AddSubsemigroup R where\n carrier := {s : R | IsSumNonzeroSq s}\n add_mem' := .add\n\nattribute [norm_cast] coe_sumNonzeroSq\n\n@[simp] theorem mem_sumNonzeroSq : s ∈ sumNonzeroSq R ↔ IsSumNonzeroSq s := .rfl\n\n@[simp]\ntheorem closure_mul_self : closure {x * x | x ≠ (0 : R)} = sumNonzeroSq R := by\n refine closure_eq_of_le (fun x hx ↦ by aesop) (fun x hx ↦ ?_)\n -- TODO : fix aesop timeout and change to `induction hx <;> aesop`\n induction hx with\n | sq ha => aesop\n | sq_add ha hs ih =>\n -- `aesop` times out\n apply add_mem\n · apply AddSubsemigroup.mem_closure_of_mem\n aesop\n aesop\n\nend AddSubsemigroup\n\nend IsSumNonzeroSq\n\nvariable (R) in\n/--\nA ring is formally real if, whenever `∑ i, x i ^ 2 = 0`, we in fact have `x i = 0` for all `i`.\n-/\nclass IsFormallyReal [AddCommMonoid R] [Mul R] : Prop where\n not_isSumNonzeroSq_zero : ¬ IsSumNonzeroSq (0 : R)\n\nnamespace IsFormallyReal\n\ntheorem of_eq_zero_of_mul_self_of_eq_zero_of_add [AddCommMonoid R] [Mul R]\n (hz : ∀ {a : R}, a * a = 0 → a = 0)\n (ha : ∀ {s₁ s₂ : R}, IsSumSq s₁ → IsSumSq s₂ → s₁ + s₂ = 0 → s₁ = 0) : IsFormallyReal R where\n not_isSumNonzeroSq_zero := by\n suffices ∀ (x : R), IsSumNonzeroSq x → x ≠ 0 by grind\n intro x hx\n induction hx with\n | sq ha => grind\n | @sq_add b s hb hs ih => grind [ha (IsSumSq.mul_self b) hs.isSumSq]\n\ntheorem of_eq_zero_of_eq_zero_of_mul_self_add [NonUnitalNonAssocSemiring R]\n (h : ∀ {s a : R}, IsSumSq s → a * a + s = 0 → a = 0) : IsFormallyReal R where\n not_isSumNonzeroSq_zero := by\n suffices ∀ (x : R), IsSumNonzeroSq x → x ≠ 0 by grind\n intro x hx\n induction hx with\n | sq ha => exact fun hc ↦ ha (h IsSumSq.zero (by simpa using hc))\n | sq_add ha hs ih => grind [hs.isSumSq]\n\ninstance [Ring R] [LinearOrder R] [IsStrictOrderedRing R] : IsFormallyReal R :=\n of_eq_zero_of_mul_self_of_eq_zero_of_add mul_self_eq_zero.mp <|\n fun hs₁ hs₂ h ↦ ((add_eq_zero_iff_of_nonneg (IsSumSq.nonneg hs₁) (IsSumSq.nonneg hs₂)).mp h).1\n\ninstance [Ring R] [IsFormallyReal R] : IsReduced R := by\n rw [isReduced_iff_pow_one_lt 2 (by lia)]\n intro x hx\n by_contra! hc\n exact not_isSumNonzeroSq_zero <| by simpa [← pow_two, hx] using IsSumNonzeroSq.sq hc\n\ntheorem eq_zero_of_add_right [NonUnitalNonAssocSemiring R] [IsFormallyReal R]\n {s₁ s₂ : R} (hs₁ : IsSumSq s₁) (hs₂ : IsSumSq s₂) (h : s₁ + s₂ = 0) : s₁ = 0 := by\n by_contra! h₁\n have h₂ : s₂ ≠ 0 := fun hc ↦ by simp_all\n rw [← isSumNonzeroSq_iff_isSumSq h₁] at hs₁\n rw [← isSumNonzeroSq_iff_isSumSq h₂] at hs₂\n exact not_isSumNonzeroSq_zero (h ▸ IsSumNonzeroSq.add hs₁ hs₂)\n\nTarget:\ntheorem eq_zero_of_add_left [NonUnitalNonAssocSemiring R] [IsFormallyReal R]\n {s₁ s₂ : R} (hs₁ : IsSumSq s₁) (hs₂ : IsSumSq s₂) (h : s₁ + s₂ = 0) : s₂ = 0 :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Ring","family_id":"eq_zero_of_add_left","file_id":"mathlib/Mathlib/Algebra/Ring/IsFormallyReal.lean","sample_id":"8c5474d5a748750311f34bb635b8469d911df14dd8f7a3cb5f4fb88ebf96dde7"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f9238a33c34df8d596e122a93a4a0a65af65fcc20ce9465e0bb19ab23680a8d8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"3a5159a426e3e438f8eda25f6b5ac56ba00ce8718349d15489854bb2d9f5b1a1","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"2c264d6adec184e75e8a764edc47b951a871ff4312cbef2af23ae57c61d62767","source_sha256":"ad68699b4540dc5df6f32705a5ebbd4937fbb699df2546854b29d6ff60827576","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n apply Finset.eq_univ_of_card\n rw [card_four']\n repeat rw [card_insert_of_notMem]\n on_goal 4 => simpa using mul_notMem_of_exponent_two (by simp) hx hy hxy\n all_goals simp_all","hard_negative":true,"metrics":{"chosen_tokens":29,"rejected_tokens":3,"token_jaccard":0.037037,"token_length_ratio":0.103448},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"4dade941d29999e28b844a224b9d4afa4b463ddef75595a145de0b23fd2ccbbf","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.SpecificGroups.Cyclic\n\nNamespace:\nIsKleinFour\n\nLocal context:\n/-\nCopyright (c) 2023 Newell Jensen. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Newell Jensen\n-/\n/-!\n# Klein Four Group\n\nThe Klein (Vierergruppe) four-group is a non-cyclic abelian group with four elements, in which\neach element is self-inverse and in which composing any two of the three non-identity elements\nproduces the third one.\n\n## Main definitions\n\n* `IsKleinFour` : A mixin class which states that the group has order four and exponent two.\n* `mulEquiv'` : An equivalence between a Klein four-group and a group of exponent two which\n preserves the identity is in fact an isomorphism.\n* `mulEquiv`: Any two Klein four-groups are isomorphic via any identity-preserving equivalence.\n\n## References\n\n* https://en.wikipedia.org/wiki/Klein_four-group\n* https://en.wikipedia.org/wiki/Alternating_group\n\n## TODO\n\n* Prove an `IsKleinFour` group is isomorphic to the normal subgroup of `alternatingGroup (Fin 4)`\n with the permutation cycles `V = {(), (1 2)(3 4), (1 3)(2 4), (1 4)(2 3)}`. This is the kernel\n of the surjection of `alternatingGroup (Fin 4)` onto `alternatingGroup (Fin 3) ≃ (ZMod 3)`.\n In other words, we have the exact sequence `V → A₄ → A₃`.\n\n* The outer automorphism group of `A₆` is the Klein four-group `V = (ZMod 2) × (ZMod 2)`,\n and is related to the outer automorphism of `S₆`. The extra outer automorphism in `A₆`\n swaps the 3-cycles (like `(1 2 3)`) with elements of shape `3²` (like `(1 2 3)(4 5 6)`).\n\n## Tags\nnon-cyclic abelian group\n-/\n\n@[expose] public section\n\n/-! ### Klein four-groups as a mixin class -/\n\n/-- An (additive) Klein four-group is an (additive) group of cardinality four and exponent two. -/\nclass IsAddKleinFour (G : Type*) [AddGroup G] : Prop where\n card_four : Nat.card G = 4\n exponent_two : AddMonoid.exponent G = 2\n\n/-- A Klein four-group is a group of cardinality four and exponent two. -/\n@[to_additive existing IsAddKleinFour]\nclass IsKleinFour (G : Type*) [Group G] : Prop where\n card_four : Nat.card G = 4\n exponent_two : Monoid.exponent G = 2\n\nattribute [simp] IsKleinFour.card_four IsKleinFour.exponent_two\n IsAddKleinFour.card_four IsAddKleinFour.exponent_two\n\ninstance : IsAddKleinFour (ZMod 2 × ZMod 2) where\n card_four := by simp\n exponent_two := by simp [AddMonoid.exponent_prod]\n\ninstance {G : Type*} [Group G] [IsKleinFour G] : IsAddKleinFour (Additive G) where\n card_four := by rw [← IsKleinFour.card_four (G := G)]; congr!\n exponent_two := by simp\n\ninstance {G : Type*} [AddGroup G] [IsAddKleinFour G] : IsKleinFour (Multiplicative G) where\n card_four := by rw [← IsAddKleinFour.card_four (G := G)]; congr!\n exponent_two := by simp\n\nnamespace IsKleinFour\n\n@[to_additive]\ntheorem isMulCommutative {G : Type*} [Group G] [IsKleinFour G] :\n IsMulCommutative G where\n is_comm.comm := mul_comm_of_exponent_two exponent_two\n\n/-- This instance is scoped, because it always applies (which makes linting and typeclass inference\npotentially *a lot* slower). -/\n@[to_additive]\nscoped instance instFinite {G : Type*} [Group G] [IsKleinFour G] : Finite G :=\n Nat.finite_of_card_ne_zero <| by simp [IsKleinFour.card_four]\n\n@[to_additive (attr := simp)]\nlemma card_four' {G : Type*} [Group G] [Fintype G] [IsKleinFour G] :\n Fintype.card G = 4 :=\n Nat.card_eq_fintype_card (α := G).symm ▸ IsKleinFour.card_four\n\nopen Finset\n\nvariable {G : Type*} [Group G] [IsKleinFour G]\n\n@[to_additive]\nlemma not_isCyclic : ¬IsCyclic G :=\n fun h ↦ by simpa using h.exponent_eq_card\n\n@[to_additive]\nlemma inv_eq_self (x : G) : x⁻¹ = x := inv_eq_self_of_exponent_two (by simp) x\n\n/- this is not an appropriate global `simp` lemma for a `Prop`-mixin class. Indeed, if it were\nthen every time Lean sees `·⁻¹` it would try to apply `inv_eq_self` which would trigger\ntype class inference to try and synthesize an `IsKleinFour` instance. -/\nscoped[IsKleinFour] attribute [simp] inv_eq_self\nscoped[IsAddKleinFour] attribute [simp] neg_eq_self\n\n@[to_additive]\nlemma mul_self (x : G) : x * x = 1 := by\n rw [mul_eq_one_iff_eq_inv, inv_eq_self]\n\n@[to_additive]\n\nTarget:\nlemma eq_finset_univ [Fintype G] [DecidableEq G]\n {x y : G} (hx : x ≠ 1) (hy : y ≠ 1) (hxy : x ≠ y) : {x * y, x, y, (1 : G)} = Finset.univ :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_2c264d6adec1","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"26cc3c6837224743b965b2bc386833bb376cec3f6ca40cc64d51e2e0bff7bed8","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/SpecificGroups","family_id":"eq_finset_univ","file_id":"mathlib/Mathlib/GroupTheory/SpecificGroups/KleinFour.lean","sample_id":"2c264d6adec184e75e8a764edc47b951a871ff4312cbef2af23ae57c61d62767"},"split":"validation"} {"binding":{"chosen_proof_sha256":"845472be762363f8188a78d60f0ef615671098268d2ad9069b2712b4f3303d4a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"50966eace999e99ad2449d9d407d4abff95647b70ec657c1002b13cfbf1961c9","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"9b6478b4919383ee6445b9686b547108af18f08223f8c2558e2e146246f56c84","source_sha256":"3ae5f7aeff9efeae8bf5ccb60171899d1b7a3a6014b3b22c1122b0a75f50ca6c","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa only [← preimage_smul_inv] using! h_qmp.ae_eq h_ae_eq","hard_negative":true,"metrics":{"chosen_tokens":13,"rejected_tokens":3,"token_jaccard":0.066667,"token_length_ratio":0.230769},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"4f0bd70687858684c2f5bd95de3bfd9d0f05480702423a6c85e85bea3995f4f7","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.MeasureTheory.Measure.AbsolutelyContinuous\npublic import Mathlib.MeasureTheory.OuterMeasure.BorelCantelli\n\nNamespace:\nMeasureTheory.Measure.QuasiMeasurePreserving\n\nLocal context:\n/-\nCopyright (c) 2017 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Mario Carneiro\n-/\n/-!\n# Quasi-Measure-Preserving Functions\n\nA map `f : α → β` is said to be *quasi-measure-preserving* (a.k.a. non-singular) w.r.t. measures\n`μa` and `μb` if it is measurable and `μb s = 0` implies `μa (f ⁻¹' s) = 0`.\nThat last condition can also be written `μa.map f ≪ μb` (the map of `μa` by `f` is\nabsolutely continuous with respect to `μb`).\n\n## Main definitions\n\n* `MeasureTheory.Measure.QuasiMeasurePreserving f μa μb`: `f` is quasi-measure-preserving with\n respect to `μa` and `μb`.\n\n-/\n\npublic section\n\nvariable {α β γ δ : Type*}\n\nnamespace MeasureTheory\n\nopen Set Function ENNReal\nopen Filter hiding map\n\nvariable {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}\n {μ ν : Measure α} {s : Set α}\n\nnamespace Measure\n\n/-- A map `f : α → β` is said to be *quasi-measure-preserving* (a.k.a. non-singular) w.r.t. measures\n`μa` and `μb` if it is measurable and `μb s = 0` implies `μa (f ⁻¹' s) = 0`. -/\n@[fun_prop]\nstructure QuasiMeasurePreserving {m0 : MeasurableSpace α} (f : α → β)\n (μa : Measure α := by volume_tac)\n (μb : Measure β := by volume_tac) : Prop where\n protected measurable : Measurable f\n protected absolutelyContinuous : μa.map f ≪ μb\n\nattribute [fun_prop] QuasiMeasurePreserving.measurable\n\nnamespace QuasiMeasurePreserving\n\n@[fun_prop]\nprotected theorem id {_m0 : MeasurableSpace α} (μ : Measure α) : QuasiMeasurePreserving id μ μ :=\n ⟨measurable_id, map_id.absolutelyContinuous⟩\n\nvariable {μa μa' : Measure α} {μb μb' : Measure β} {μc : Measure γ} {f : α → β}\n\nprotected theorem _root_.Measurable.quasiMeasurePreserving\n {_m0 : MeasurableSpace α} (hf : Measurable f) (μ : Measure α) :\n QuasiMeasurePreserving f μ (μ.map f) :=\n ⟨hf, AbsolutelyContinuous.rfl⟩\n\ntheorem mono_left (h : QuasiMeasurePreserving f μa μb) (ha : μa' ≪ μa) :\n QuasiMeasurePreserving f μa' μb :=\n ⟨h.1, (ha.map h.1).trans h.2⟩\n\ntheorem mono_right (h : QuasiMeasurePreserving f μa μb) (ha : μb ≪ μb') :\n QuasiMeasurePreserving f μa μb' :=\n ⟨h.1, h.2.trans ha⟩\n\n@[gcongr, mono]\ntheorem mono (ha : μa' ≪ μa) (hb : μb ≪ μb') (h : QuasiMeasurePreserving f μa μb) :\n QuasiMeasurePreserving f μa' μb' :=\n (h.mono_left ha).mono_right hb\n\n@[fun_prop]\nprotected theorem comp {g : β → γ} {f : α → β} (hg : QuasiMeasurePreserving g μb μc)\n (hf : QuasiMeasurePreserving f μa μb) : QuasiMeasurePreserving (g ∘ f) μa μc :=\n ⟨hg.measurable.comp hf.measurable, by\n rw [← map_map hg.1 hf.1]\n exact (hf.2.map hg.1).trans hg.2⟩\n\nprotected theorem iterate {f : α → α} (hf : QuasiMeasurePreserving f μa μa) :\n ∀ n, QuasiMeasurePreserving f^[n] μa μa\n | 0 => QuasiMeasurePreserving.id μa\n | n + 1 => (hf.iterate n).comp hf\n\nprotected theorem aemeasurable (hf : QuasiMeasurePreserving f μa μb) : AEMeasurable f μa :=\n hf.1.aemeasurable\n\nprotected theorem congr (hf : QuasiMeasurePreserving f μa μb) {f' : α → β} (hf' : Measurable f')\n (h : f =ᵐ[μa] f') : QuasiMeasurePreserving f' μa μb := by\n refine ⟨hf', ?_⟩\n rw [Measure.map_congr h.symm]\n exact hf.absolutelyContinuous\n\ntheorem smul_measure {R : Type*} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]\n (hf : QuasiMeasurePreserving f μa μb) (c : R) : QuasiMeasurePreserving f (c • μa) (c • μb) :=\n ⟨hf.1, by rw [Measure.map_smul]; exact hf.2.smul c⟩\n\ntheorem ae_map_le (h : QuasiMeasurePreserving f μa μb) : ae (μa.map f) ≤ ae μb :=\n h.2.ae_le\n\ntheorem tendsto_ae (h : QuasiMeasurePreserving f μa μb) : Tendsto f (ae μa) (ae μb) :=\n (tendsto_ae_map h.aemeasurable).mono_right h.ae_map_le\n\ntheorem ae (h : QuasiMeasurePreserving f μa μb) {p : β → Prop} (hg : ∀ᵐ x ∂μb, p x) :\n ∀ᵐ x ∂μa, p (f x) :=\n h.tendsto_ae hg\n\n@[gcongr]\ntheorem ae_eq (h : QuasiMeasurePreserving f μa μb) {g₁ g₂ : β → δ} (hg : g₁ =ᵐ[μb] g₂) :\n g₁ ∘ f =ᵐ[μa] g₂ ∘ f :=\n h.ae hg\n\ntheorem preimage_null (h : QuasiMeasurePreserving f μa μb) {s : Set β} (hs : μb s = 0) :\n μa (f ⁻¹' s) = 0 :=\n preimage_null_of_map_null h.aemeasurable (h.2 hs)\n\ntheorem preimage_mono_ae {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s ≤ᵐ[μb] t) :\n f ⁻¹' s ≤ᵐ[μa] f ⁻¹' t :=\n eventually_map.mp <|\n Eventually.filter_mono (tendsto_ae_map hf.aemeasurable) (Eventually.filter_mono hf.ae_map_le h)\n\ntheorem preimage_ae_eq {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s =ᵐ[μb] t) :\n f ⁻¹' s =ᵐ[μa] f ⁻¹' t :=\n EventuallyLE.antisymm (hf.preimage_mono_ae h.le) (hf.preimage_mono_ae h.symm.le)\n\n/-- The preimage of a null measurable set under a (quasi-)measure-preserving map is a null\nmeasurable set. -/\ntheorem _root_.MeasureTheory.NullMeasurableSet.preimage {s : Set β} (hs : NullMeasurableSet s μb)\n (hf : QuasiMeasurePreserving f μa μb) : NullMeasurableSet (f ⁻¹' s) μa :=\n let ⟨t, htm, hst⟩ := hs\n ⟨f ⁻¹' t, hf.measurable htm, hf.preimage_ae_eq hst⟩\n\ntheorem preimage_iterate_ae_eq {s : Set α} {f : α → α} (hf : QuasiMeasurePreserving f μ μ) (k : ℕ)\n (hs : f ⁻¹' s =ᵐ[μ] s) : f^[k] ⁻¹' s =ᵐ[μ] s := by\n induction k with\n | zero => rfl\n | succ k ih =>\n rw [iterate_succ, preimage_comp]\n exact EventuallyEq.trans (hf.preimage_ae_eq ih) hs\n\ntheorem image_zpow_ae_eq {s : Set α} {e : α ≃ α} (he : QuasiMeasurePreserving e μ μ)\n (he' : QuasiMeasurePreserving e.symm μ μ) (k : ℤ) (hs : e '' s =ᵐ[μ] s) :\n (⇑(e ^ k)) '' s =ᵐ[μ] s := by\n rw [Equiv.image_eq_preimage_symm]\n obtain ⟨k, rfl | rfl⟩ := k.eq_nat_or_neg\n · replace hs : (⇑e⁻¹) ⁻¹' s =ᵐ[μ] s := by rwa [Equiv.image_eq_preimage_symm] at hs\n replace he' : (⇑e⁻¹)^[k] ⁻¹' s =ᵐ[μ] s := he'.preimage_iterate_ae_eq k hs\n rwa [Equiv.Perm.iterate_eq_pow e⁻¹ k, inv_pow e k] at he'\n · rw [zpow_neg, zpow_natCast]\n replace hs : e ⁻¹' s =ᵐ[μ] s := by\n convert! he.preimage_ae_eq hs.symm\n rw [Equiv.preimage_image]\n replace he : (⇑e)^[k] ⁻¹' s =ᵐ[μ] s := he.preimage_iterate_ae_eq k hs\n rwa [Equiv.Perm.iterate_eq_pow e k] at he\n\n-- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941\ntheorem limsup_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ)\n (hs : f ⁻¹' s =ᵐ[μ] s) : limsup (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s :=\n limsup_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by\n simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs\n\n-- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941\ntheorem liminf_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ)\n (hs : f ⁻¹' s =ᵐ[μ] s) : liminf (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s :=\n liminf_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by\n simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs\n\n/-- For a quasi-measure-preserving self-map `f`, if a null measurable set `s` is a.e. invariant,\nthen it is a.e. equal to a measurable invariant set.\n-/\ntheorem exists_preimage_eq_of_preimage_ae {f : α → α} (h : QuasiMeasurePreserving f μ μ)\n (hs : NullMeasurableSet s μ) (hs' : f ⁻¹' s =ᵐ[μ] s) :\n ∃ t : Set α, MeasurableSet t ∧ t =ᵐ[μ] s ∧ f ⁻¹' t = t := by\n obtain ⟨t, htm, ht⟩ := hs\n refine ⟨limsup (f^[·] ⁻¹' t) atTop, ?_, ?_, ?_⟩\n · exact .measurableSet_limsup fun n ↦ h.measurable.iterate n htm\n · have : f ⁻¹' t =ᵐ[μ] t := (h.preimage_ae_eq ht.symm).trans (hs'.trans ht)\n exact limsup_ae_eq_of_forall_ae_eq _ fun n ↦ .trans (h.preimage_iterate_ae_eq _ this) ht.symm\n · simp only [Set.preimage_iterate_eq]\n exact CompleteLatticeHom.apply_limsup_iterate (CompleteLatticeHom.setPreimage f) t\n\nopen scoped Pointwise\n\n@[to_additive]\n\nTarget:\ntheorem smul_ae_eq_of_ae_eq {G α : Type*} [Group G] [MulAction G α] {_ : MeasurableSpace α}\n {s t : Set α} {μ : Measure α} (g : G)\n (h_qmp : QuasiMeasurePreserving (g⁻¹ • · : α → α) μ μ)\n (h_ae_eq : s =ᵐ[μ] t) : (g • s : Set α) =ᵐ[μ] (g • t : Set α) :=\n\nProof body:\n","rejected":"by\n exact smul_ae_eq_of_ae_eq","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"0935afda88670aefb49aa57aed5e24bcdaae4cd97e02528a9bc6dd4f7904aba6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"MeasureTheory/Measure","family_id":"smul_ae_eq_of_ae_eq","file_id":"mathlib/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean","sample_id":"9b6478b4919383ee6445b9686b547108af18f08223f8c2558e2e146246f56c84"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4d490ee977d0711ff39cddfe60d9377a386905836bcdbc6ae1adf757c990a11f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"bc07bb82c8f8d221755d780a7179de96b8ab83cd5e719f06bd426981db8fd8bc","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"b9bcc9b05e97a301d57ec6e78a354a9ce63b36fcde5e8307f55c930a1a5524a5","source_sha256":"57f2efe792830f667cc2c077aed3a9c4921545c3176de30e03066c364104267f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rintro x hx\n by_contra! h\n simpa [U.rfl] using h _ <| hN.2 (y := insert x N) ⟨by simp [insert_subset_iff, hx, hN.1.1],\n hN.1.2.insert fun y hy hxy ↦ (h y hy hxy).elim⟩ (subset_insert _ _) (mem_insert _ _)","hard_negative":true,"metrics":{"chosen_tokens":74,"rejected_tokens":3,"token_jaccard":0.025,"token_length_ratio":0.040541},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"514f916f94c51ab1449df607970ae7dd51cb37ff0da72d9d3c1ab5d459860a3f","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Rel.Separated\n\nNamespace:\nSetRel\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Covers in a uniform space\n\nThis file defines covers, aka nets, which are a quantitative notion of compactness given an\nentourage.\n\nA `U`-cover of a set `s` is a set `N` such that every element of `s` is `U`-close to some element of\n`N`.\n\nThe concept of uniform covers is used to define two further notions of covering:\n* Metric covers: `Metric.IsCover`, defined using the distance entourage.\n* Dynamical covers: `Dynamics.IsDynCoverOf`, defined using the dynamical entourage.\n\n## References\n\n[R. Vershynin, *High Dimensional Probability*][vershynin2018high], Section 4.2.\n-/\n\n@[expose] public section\n\nopen Set\n\nnamespace SetRel\nvariable {X : Type*} {U V : SetRel X X} {s t N N₁ N₂ : Set X} {x : X}\n\n/-- For an entourage `U`, a set `N` is a *`U`-cover* of a set `s` if every point of `s` is `U`-close\nto some point of `N`.\n\nThis is also called a *`U`-net* in the literature.\n\n[R. Vershynin, *High Dimensional Probability*][vershynin2018high], 4.2.1. -/\ndef IsCover (U : SetRel X X) (s N : Set X) : Prop := ∀ ⦃x⦄, x ∈ s → ∃ y ∈ N, x ~[U] y\n\n@[simp] lemma IsCover.empty : IsCover U ∅ N := by simp [IsCover]\n\n@[simp] lemma isCover_empty_right : IsCover U s ∅ ↔ s = ∅ := by\n simp [IsCover, eq_empty_iff_forall_notMem]\n\nprotected nonrec lemma IsCover.nonempty (hsN : IsCover U s N) (hs : s.Nonempty) : N.Nonempty :=\n let ⟨_x, hx⟩ := hs; let ⟨y, hy, _⟩ := hsN hx; ⟨y, hy⟩\n\n@[simp] lemma IsCover.refl (U : SetRel X X) [U.IsRefl] (s : Set X) : IsCover U s s :=\n fun a ha ↦ ⟨a, ha, U.rfl⟩\n\nlemma IsCover.rfl {U : SetRel X X} [U.IsRefl] {s : Set X} : IsCover U s s := refl U s\n\n@[simp] protected lemma isCover_univ : IsCover univ s N ↔ (s.Nonempty → N.Nonempty) := by\n simp [IsCover, Set.Nonempty]\n\nlemma IsCover.mono (hN : N₁ ⊆ N₂) (h₁ : IsCover U s N₁) : IsCover U s N₂ :=\n fun _x hx ↦ let ⟨y, hy, hxy⟩ := h₁ hx; ⟨y, hN hy, hxy⟩\n\nlemma IsCover.anti (hst : s ⊆ t) (ht : IsCover U t N) : IsCover U s N := fun _x hx ↦ ht <| hst hx\n\nlemma IsCover.mono_entourage (hUV : U ⊆ V) (hU : IsCover U s N) : IsCover V s N :=\n fun _x hx ↦ let ⟨y, hy, hxy⟩ := hU hx; ⟨y, hy, hUV hxy⟩\n\nlemma IsCover.union (hs : IsCover U s N₁) (ht : IsCover U t N₂) : IsCover U (s ∪ t) (N₁ ∪ N₂) := fun\n | _x, .inl hx => let ⟨y, hy, hxy⟩ := hs hx; ⟨y, .inl hy, hxy⟩\n | _x, .inr hx => let ⟨y, hy, hxy⟩ := ht hx; ⟨y, .inr hy, hxy⟩\n\n/-- A maximal `U`-separated subset of a set `s` is a `U`-cover of `s`.\n\n[R. Vershynin, *High Dimensional Probability*][vershynin2018high], 4.2.6. -/\n\nTarget:\nlemma IsCover.of_maximal_isSeparated [U.IsRefl] [U.IsSymm]\n (hN : Maximal (fun N ↦ N ⊆ s ∧ IsSeparated U N) N) : IsCover U s N :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_b9bcc9b05e97","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"4a10e196b9fef76eea37fb51fdf0de540c04e573f57e5137641f54c9ed55c49c","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Rel","family_id":"iscover","file_id":"mathlib/Mathlib/Data/Rel/Cover.lean","sample_id":"b9bcc9b05e97a301d57ec6e78a354a9ce63b36fcde5e8307f55c930a1a5524a5"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b241e0635e41f0c595053feb2941666d4f69302f772b6a38e5cff5f2bc9d298a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"2bd7ce91fba1cd5ae97fe6dca18b257babdd5ae2b56acb46720f22960d5b8e62","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"58d55a7ec458b1df7c91f0b2aa0549c57274811f8e3fa2ec69d9ada0e2729189","source_sha256":"a5b9fd4ae26ed5eac524a8ce0f4aac28fccd2337d8a28d5e1bf35f99625bb1bd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨n, ι, inst, x, p, e, equiv⟩ := AddCommGroup.equiv_free_prod_directSum_zmod (Additive G)\n exact ⟨ι, Fin n, inst, inferInstance, x, p, e, ⟨MulEquiv.toAdditive.symm <| equiv.some.trans <|\n ((Finsupp.addEquivFunOnFinite.trans <| ((AddEquiv.piAdditive _).trans <|\n (AddEquiv.additiveMultiplicative ℤ).arrowCongr (Equiv.refl _)).symm).prodCongr\n (DirectSum.addEquivProd _ )).trans <| (AddEquiv.prodAdditive _ _).symm⟩⟩","hard_negative":true,"metrics":{"chosen_tokens":119,"rejected_tokens":3,"token_jaccard":0.044444,"token_length_ratio":0.02521},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"52811ec7806fedae2993b4bdda9ed84a10512166b29ce53e31803f2941ecc98c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.PID\npublic import Mathlib.Algebra.Group.TypeTags.Finite\npublic import Mathlib.Data.ZMod.QuotientRing\n\nNamespace:\nCommGroup\n\nLocal context:\n/-\nCopyright (c) 2022 Pierre-Alexandre Bazin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Pierre-Alexandre Bazin\n-/\n/-!\n# Structure of finite(ly generated) abelian groups\n\n* `AddCommGroup.equiv_free_prod_directSum_zmod` : Any finitely generated abelian group is the\n product of a power of `ℤ` and a direct sum of some `ZMod (p i ^ e i)` for some prime powers\n `p i ^ e i`.\n* `CommGroup.equiv_free_prod_prod_multiplicative_zmod` is a version for multiplicative groups.\n* `AddCommGroup.equiv_directSum_zmod_of_finite` : Any finite abelian group is a direct sum of\n some `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`.\n* `CommGroup.equiv_prod_multiplicative_zmod_of_finite` is a version for multiplicative groups.\n-/\n\n@[expose] public section\n\nopen scoped DirectSum\n\n/-\nTODO: Here's a more general approach to dropping trivial factors from a direct sum:\n\ndef DirectSum.congr {ι κ : Type*} {α : ι → Type*} {β : κ → Type*} [DecidableEq ι] [DecidableEq κ]\n [∀ i, DecidableEq (α i)] [∀ j, DecidableEq (β j)] [∀ i, AddCommMonoid (α i)]\n [∀ j, AddCommMonoid (β j)] (f : ∀ i, Nontrivial (α i) → κ) (g : ∀ j, Nontrivial (β j) → ι)\n (F : ∀ i hi, α i →+ β (f i hi)) (G : ∀ j hj, β j →+ α (g j hj))\n (hfg : ∀ i hi hj, g (f i hi) hj = i) (hgf : ∀ j hj hi, f (g j hj) hi = j)\n (hFG : ∀ i hi hj a, hfg i hi hj ▸ G _ hj (F i hi a) = a)\n (hGF : ∀ j hj hi b, hgf j hj hi ▸ F _ hi (G j hj b) = b) :\n (⨁ i, α i) ≃+ ⨁ j, β j where\n toFun x := x.sum fun i a ↦ if ha : a = 0 then 0 else DFinsupp.single (f i ⟨a, 0, ha⟩) (F _ _ a)\n invFun y := y.sum fun j b ↦ if hb : b = 0 then 0 else DFinsupp.single (g j ⟨b, 0, hb⟩) (G _ _ b)\n -- The two sorries here are probably doable with the existing machinery, but quite painful\n left_inv x := DFinsupp.ext fun i ↦ sorry\n right_inv y := DFinsupp.ext fun j ↦ sorry\n map_add' x₁ x₂ := by\n dsimp\n refine DFinsupp.sum_add_index (by simp) fun i a₁ a₂ ↦ ?_\n split_ifs\n any_goals simp_all\n rw [← DFinsupp.single_add, ← map_add, ‹a₁ + a₂ = 0›, map_zero, DFinsupp.single_zero]\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.congr\n (fun i _ ↦ i)\n (fun j hj ↦ ⟨j, fun h ↦ by simp [h, pow_zero, zmod_nontrivial] at hj⟩)\n (fun i _ ↦ AddMonoidHom.id _)\n (fun j _ ↦ AddMonoidHom.id _)\n (fun i hi hj ↦ rfl)\n (fun j hj hi ↦ rfl)\n (fun i hi hj a ↦ rfl)\n (fun j hj hi a ↦ rfl)\n-/\n\nprivate def directSumNeZeroMulHom {ι : Type} [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) →+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.toAddMonoid fun i ↦ DirectSum.of (fun i ↦ ZMod (p i ^ n i)) i\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) where\n toFun := directSumNeZeroMulHom p n\n invFun := DirectSum.toAddMonoid fun i ↦\n if h : n i = 0 then 0 else DirectSum.of (fun j : {i // n i ≠ 0} ↦ ZMod (p j ^ n j)) ⟨i, h⟩\n left_inv x := by\n induction x using DirectSum.induction_on with\n | zero => simp\n | of i x =>\n rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of, DirectSum.toAddMonoid_of,\n dif_neg i.prop]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n right_inv x := by\n induction x using DirectSum.induction_on with\n | zero => rw [map_zero, map_zero]\n | of i x =>\n rw [DirectSum.toAddMonoid_of]\n split_ifs with h\n · simp [(ZMod.subsingleton_iff.2 <| by rw [h, pow_zero]).elim x 0]\n · simp_rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n map_add' := map_add (directSumNeZeroMulHom p n)\n\nuniverse u\n\nnamespace Module\n\nvariable (M : Type u)\n\ntheorem finite_of_fg_torsion [AddCommGroup M] [Module ℤ M] [Module.Finite ℤ M]\n (hM : Module.IsTorsion ℤ M) : _root_.Finite M := by\n rcases Module.equiv_directSum_of_isTorsion hM with ⟨ι, _, p, h, e, ⟨l⟩⟩\n haveI : ∀ i : ι, NeZero (p i ^ e i).natAbs := fun i =>\n ⟨Int.natAbs_ne_zero.mpr <| pow_ne_zero (e i) (h i).ne_zero⟩\n haveI : ∀ i : ι, _root_.Finite <| ℤ ⧸ Submodule.span ℤ {p i ^ e i} := fun i =>\n Finite.of_equiv _ (p i ^ e i).quotientSpanEquivZMod.symm.toEquiv\n haveI : _root_.Finite (⨁ i, ℤ ⧸ (Submodule.span ℤ {p i ^ e i} : Submodule ℤ ℤ)) :=\n Finite.of_equiv _ DFinsupp.equivFunOnFintype.symm\n exact Finite.of_equiv _ l.symm.toEquiv\n\nend Module\n\nvariable (G : Type u)\n\nnamespace AddCommGroup\n\nvariable [AddCommGroup G]\n\n/-- **Structure theorem of finitely generated abelian groups** : Any finitely generated abelian\ngroup is the product of a power of `ℤ` and a direct sum of some `ZMod (p i ^ e i)` for some\nprime powers `p i ^ e i`. -/\ntheorem equiv_free_prod_directSum_zmod [hG : AddGroup.FG G] :\n ∃ (n : ℕ) (ι : Type) (_ : Fintype ι) (p : ι → ℕ) (_ : ∀ i, Nat.Prime <| p i) (e : ι → ℕ),\n Nonempty <| G ≃+ (Fin n →₀ ℤ) × ⨁ i : ι, ZMod (p i ^ e i) := by\n obtain ⟨n, ι, fι, p, hp, e, ⟨f⟩⟩ :=\n @Module.equiv_free_prod_directSum _ _ _ _ _ _ _ (Module.Finite.iff_addGroup_fg.mpr hG)\n refine ⟨n, ι, fι, fun i => (p i).natAbs, fun i => ?_, e, ⟨?_⟩⟩\n · rw [← Int.prime_iff_natAbs_prime, ← irreducible_iff_prime]; exact hp i\n exact\n f.toAddEquiv.trans\n ((AddEquiv.refl _).prodCongr <|\n DFinsupp.mapRange.addEquiv fun i =>\n ((Int.quotientSpanEquivZMod _).trans <|\n ZMod.ringEquivCongr <| (p i).natAbs_pow _).toAddEquiv)\n\n/-- **Structure theorem of finite abelian groups** : Any finite abelian group is a direct sum of\nsome `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`. -/\ntheorem equiv_directSum_zmod_of_finite [Finite G] :\n ∃ (ι : Type) (_ : Fintype ι) (p : ι → ℕ) (_ : ∀ i, Nat.Prime <| p i) (e : ι → ℕ),\n Nonempty <| G ≃+ ⨁ i : ι, ZMod (p i ^ e i) := by\n cases nonempty_fintype G\n obtain ⟨n, ι, fι, p, hp, e, ⟨f⟩⟩ := equiv_free_prod_directSum_zmod G\n rcases n with - | n\n · have : Unique (Fin Nat.zero →₀ ℤ) :=\n { uniq := by subsingleton }\n exact ⟨ι, fι, p, hp, e, ⟨f.trans AddEquiv.uniqueProd⟩⟩\n · haveI := @Fintype.prodLeft _ _ _ (Fintype.ofEquiv G f.toEquiv) _\n exact\n (Fintype.ofSurjective (fun f : Fin n.succ →₀ ℤ => f 0) fun a =>\n ⟨Finsupp.single 0 a, Finsupp.single_eq_same⟩).false.elim\n\n/-- **Structure theorem of finite abelian groups** : Any finite abelian group is a direct sum of\nsome `ZMod (n i)` for some natural numbers `n i > 1`. -/\nlemma equiv_directSum_zmod_of_finite' (G : Type*) [AddCommGroup G] [Finite G] :\n ∃ (ι : Type) (_ : Fintype ι) (n : ι → ℕ),\n (∀ i, 1 < n i) ∧ Nonempty (G ≃+ ⨁ i, ZMod (n i)) := by\n classical\n obtain ⟨ι, hι, p, hp, n, ⟨e⟩⟩ := AddCommGroup.equiv_directSum_zmod_of_finite G\n refine ⟨{i : ι // n i ≠ 0}, inferInstance, fun i ↦ p i ^ n i, ?_,\n ⟨e.trans (directSumNeZeroMulEquiv ι _ _).symm⟩⟩\n rintro ⟨i, hi⟩\n exact one_lt_pow₀ (hp _).one_lt hi\n\ntheorem finite_of_fg_torsion [hG' : AddGroup.FG G] (hG : AddMonoid.IsTorsion G) : Finite G :=\n @Module.finite_of_fg_torsion _ _ _ (Module.Finite.iff_addGroup_fg.mpr hG') <|\n AddMonoid.isTorsion_iff_isTorsion_int.mp hG\n\nend AddCommGroup\n\nnamespace CommGroup\n\ntheorem finite_of_fg_torsion [CommGroup G] [Group.FG G] (hG : Monoid.IsTorsion G) : Finite G :=\n @Finite.of_equiv _ _ (AddCommGroup.finite_of_fg_torsion (Additive G) hG) Multiplicative.ofAdd\n\n/-- The **Structure Theorem For Finite Abelian Groups** in a multiplicative version:\nA finite commutative group `G` is isomorphic to a finite product of finite cyclic groups. -/\ntheorem equiv_prod_multiplicative_zmod_of_finite (G : Type*) [CommGroup G] [Finite G] :\n ∃ (ι : Type) (_ : Fintype ι) (n : ι → ℕ),\n (∀ (i : ι), 1 < n i) ∧ Nonempty (G ≃* ((i : ι) → Multiplicative (ZMod (n i)))) := by\n obtain ⟨ι, inst, n, h₁, h₂⟩ := AddCommGroup.equiv_directSum_zmod_of_finite' (Additive G)\n exact ⟨ι, inst, n, h₁, ⟨MulEquiv.toAdditive.symm <| h₂.some.trans <|\n (DirectSum.addEquivProd _).trans (MulEquiv.piMultiplicative _).toAdditiveRight⟩⟩\n\n/-- The **Structure theorem of finitely generated abelian groups** in a multiplicative version :\n Any finitely generated abelian group is the product of a power of `ℤ`\n and a direct product of some `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`. -/\n\nTarget:\ntheorem equiv_free_prod_prod_multiplicative_zmod (G : Type*) [CommGroup G] [hG : Group.FG G] :\n ∃ (ι j : Type) (_ : Fintype ι) (_ : Fintype j) (p : ι → ℕ)\n (_ : ∀ i, Nat.Prime <| p i) (e : ι → ℕ),\n Nonempty <| G ≃* (j → Multiplicative ℤ) × ((i : ι) → Multiplicative (ZMod (p i ^ e i))) :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_58d55a7ec458","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"aa6d8ad2fab78965be81b0d03a7f1e0993d459d5174b5aa8d3d5c5d094de76cf","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/FiniteAbelian","family_id":"equiv_free_prod_prod_multiplicative_zmod","file_id":"mathlib/Mathlib/GroupTheory/FiniteAbelian/Basic.lean","sample_id":"58d55a7ec458b1df7c91f0b2aa0549c57274811f8e3fa2ec69d9ada0e2729189"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1dfee187098f4e71767368c6bf2eb4d6d4ede55b380ff1008273ff1577a4b0dd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"cc0d207fe2b95223fcffb96fa4df6924eb27788b13d381a7e5771cd8f2beb091","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"280ed999a86106fffb16aab2e79a6c832e59bdfefd48ae578c3a01f9d5191c9a","source_sha256":"618e7239951cc7765754a4794bf1f2c21ea3746c3fcde7d3df65fe9efa57a542","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨?_, ?_⟩\n · rintro ⟨ab, ba⟩\n exact ⟨ba.of_mul, ab.of_mul⟩\n · rintro ⟨ha, hb⟩\n exact ⟨ha.mul hb, hb.mul ha⟩","hard_negative":true,"metrics":{"chosen_tokens":45,"rejected_tokens":3,"token_jaccard":0.111111,"token_length_ratio":0.066667},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"53592112b5ca8d393ba029aee3945e45c82c3b11821991d8f4bfc60329804128","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Units.Defs\npublic import Mathlib.Algebra.GroupWithZero.Action.Defs\npublic import Mathlib.Tactic.Convert\npublic import Mathlib.Tactic.Push\n\nNamespace:\nIsSMulRegular\n\nLocal context:\n/-\nCopyright (c) 2021 Damiano Testa. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Damiano Testa\n-/\n/-!\n# Action of regular elements on a module\n\nWe introduce `M`-regular elements, in the context of an `R`-module `M`. The corresponding\npredicate is called `IsSMulRegular`.\n\nThere are very limited typeclass assumptions on `R` and `M`, but the \"mathematical\" case of interest\nis a commutative ring `R` acting on a module `M`. Since the properties are \"multiplicative\", there\nis no actual requirement of having an addition, but there is a zero in both `R` and `M`.\nScalar multiplications involving `0` are, of course, all trivial.\n\nThe defining property is that an element `a ∈ R` is `M`-regular if the scalar multiplication map\n`M → M`, defined by `m ↦ a • m`, is injective.\n\nThis property is the direct generalization to modules of the property `IsLeftRegular` defined in\n`Algebra/Regular`. Lemma `isLeftRegular_iff` shows that indeed the two notions\ncoincide.\n-/\n\n@[expose] public section\n\n\nvariable {R S : Type*} (M : Type*) {a b : R} {s : S}\n\n/-- An `M`-regular element is an element `c` such that multiplication on the left by `c` is an\ninjective map `M → M`. -/\ndef IsSMulRegular [SMul R M] (c : R) :=\n Function.Injective ((c • ·) : M → M)\n\ntheorem IsLeftRegular.isSMulRegular [Mul R] {c : R} (h : IsLeftRegular c) : IsSMulRegular R c :=\n h\n\n/-- Left-regular multiplication on `R` is equivalent to `R`-regularity of `R` itself. -/\ntheorem isLeftRegular_iff [Mul R] {a : R} : IsLeftRegular a ↔ IsSMulRegular R a :=\n Iff.rfl\n\ntheorem IsRightRegular.isSMulRegular [Mul R] {c : R} (h : IsRightRegular c) :\n IsSMulRegular R (MulOpposite.op c) :=\n h\n\n/-- Right-regular multiplication on `R` is equivalent to `Rᵐᵒᵖ`-regularity of `R` itself. -/\ntheorem isRightRegular_iff [Mul R] {a : R} :\n IsRightRegular a ↔ IsSMulRegular R (MulOpposite.op a) :=\n Iff.rfl\n\nvariable {M}\n\nlemma isSMulRegular_map [SMul R M] [SMul S M] (f : R → S) (smul : ∀ m : M, f a • m = a • m) :\n IsSMulRegular M (f a) ↔ IsSMulRegular M a := by simp [IsSMulRegular, smul]\n\nprotected alias ⟨IsSMulRegular.of_map, IsSMulRegular.map⟩ := isSMulRegular_map\n\nnamespace IsSMulRegular\n\n@[simp] theorem natAbs_iff [SubtractionMonoid M] {n : ℤ} :\n IsSMulRegular M n.natAbs ↔ IsSMulRegular M n := by\n simp_rw [IsSMulRegular, Function.Injective]\n conv_rhs => rw [← n.sign_mul_natAbs]\n obtain h | h | h := n.sign_trichotomy\n · simp [h]\n · simp [Int.sign_eq_zero_iff_zero.mp h]\n · simp [h, neg_zsmul]\n\nsection SMul\n\nvariable [SMul R M] [SMul R S] [SMul S M] [IsScalarTower R S M]\n\n/-- The product of `M`-regular elements is `M`-regular. -/\ntheorem smul (ra : IsSMulRegular M a) (rs : IsSMulRegular M s) : IsSMulRegular M (a • s) :=\n fun _ _ ab => rs (ra ((smul_assoc _ _ _).symm.trans (ab.trans (smul_assoc _ _ _))))\n\n/-- If an element `b` becomes `M`-regular after multiplying it on the left by an `M`-regular\nelement, then `b` is `M`-regular. -/\ntheorem of_smul (a : R) (ab : IsSMulRegular M (a • s)) : IsSMulRegular M s :=\n @Function.Injective.of_comp _ _ _ (fun m : M => a • m) _ fun c d cd => by\n dsimp only [Function.comp_def] at cd\n rw [← smul_assoc, ← smul_assoc] at cd\n exact ab cd\n\n/-- An element is `M`-regular if and only if multiplying it on the left by an `M`-regular element\nis `M`-regular. -/\n@[simp]\ntheorem smul_iff (b : S) (ha : IsSMulRegular M a) : IsSMulRegular M (a • b) ↔ IsSMulRegular M b :=\n ⟨of_smul _, ha.smul⟩\n\ntheorem isLeftRegular [Mul R] {a : R} (h : IsSMulRegular R a) : IsLeftRegular a :=\n h\n\ntheorem isRightRegular [Mul R] {a : R} (h : IsSMulRegular R (MulOpposite.op a)) :\n IsRightRegular a :=\n h\n\ntheorem mul [Mul R] [IsScalarTower R R M] (ra : IsSMulRegular M a) (rb : IsSMulRegular M b) :\n IsSMulRegular M (a * b) :=\n ra.smul rb\n\ntheorem of_mul [Mul R] [IsScalarTower R R M] (ab : IsSMulRegular M (a * b)) :\n IsSMulRegular M b := by\n rw [← smul_eq_mul] at ab\n exact ab.of_smul _\n\n@[simp]\ntheorem mul_iff_right [Mul R] [IsScalarTower R R M] (ha : IsSMulRegular M a) :\n IsSMulRegular M (a * b) ↔ IsSMulRegular M b :=\n ⟨of_mul, ha.mul⟩\n\n/-- Two elements `a` and `b` are `M`-regular if and only if both products `a * b` and `b * a`\nare `M`-regular. -/\n\nTarget:\ntheorem mul_and_mul_iff [Mul R] [IsScalarTower R R M] :\n IsSMulRegular M (a * b) ∧ IsSMulRegular M (b * a) ↔ IsSMulRegular M a ∧ IsSMulRegular M b :=\n\nProof body:\n","rejected":"by\n exact mul_and_mul_iff","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"4ef4d7045f62dc2d05ff775f3be59e87b89fca157f5f64013460bf046103b30c","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Regular","family_id":"mul_and_mul_iff","file_id":"mathlib/Mathlib/Algebra/Regular/SMul.lean","sample_id":"280ed999a86106fffb16aab2e79a6c832e59bdfefd48ae578c3a01f9d5191c9a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"e88cf4a4f386ebfb13d5ed22bf47cebfaf0a1724ee715664128c6ec868913295","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e35c177722670e4dd395e326e01bad1b5e873696d6d194efcdc756923de43b14","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"241bad5eead6304b5dad8995bfd64a55289b8ca73fadc3ab52727f053689be63","source_sha256":"a8213893d9c236d1a671ab5169947332278178a687596e25984d183adf271e48","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp [binaryCoproductIso]\n aesop","hard_negative":false,"metrics":{"chosen_tokens":6,"rejected_tokens":10,"token_jaccard":0.6,"token_length_ratio":1.666667},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"54770489a8a85a40e0479f3efa9ee843d6840c987d1341fc3063e95a6aa93e0f","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic\npublic import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts\npublic import Mathlib.CategoryTheory.Limits.Types.Limits\npublic import Mathlib.CategoryTheory.Limits.Types.Colimits\n\nNamespace:\nCategoryTheory.FunctorToTypes\n\nLocal context:\n/-\nCopyright (c) 2024 Jack McKoen. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jack McKoen\n-/\n/-!\n# Binary (co)products of type-valued functors\n\nDefines an explicit construction of binary products and coproducts of type-valued functors.\n\nAlso defines isomorphisms to the categorical product and coproduct, respectively.\n-/\n\n@[expose] public section\n\n\nopen CategoryTheory Limits ConcreteCategory\n\nuniverse w v u\n\nnamespace CategoryTheory.FunctorToTypes\n\nvariable {C : Type u} [Category.{v} C]\nvariable (F G : C ⥤ Type w)\n\nsection prod\n\n/-- `prod F G` is the explicit binary product of type-valued functors `F` and `G`. -/\n@[simps obj map]\ndef prod : C ⥤ Type w where\n obj a := F.obj a × G.obj a\n map f := ↾fun a ↦ (F.map f a.1, G.map f a.2)\n\nvariable {F G}\n\n/-- The first projection of `prod F G`, onto `F`. -/\n@[simps app]\ndef prod.fst : prod F G ⟶ F where\n app _ := ↾fun a ↦ a.1\n\n/-- The second projection of `prod F G`, onto `G`. -/\n@[simps app]\ndef prod.snd : prod F G ⟶ G where\n app _ := ↾fun a ↦ a.2\n\n/-- Given natural transformations `F ⟶ F₁` and `F ⟶ F₂`, construct\na natural transformation `F ⟶ prod F₁ F₂`. -/\n@[simps]\ndef prod.lift {F₁ F₂ : C ⥤ Type w} (τ₁ : F ⟶ F₁) (τ₂ : F ⟶ F₂) :\n F ⟶ prod F₁ F₂ where\n app x := ↾fun y ↦ ⟨τ₁.app x y, τ₂.app x y⟩\n\n@[simp]\nlemma prod.lift_fst {F₁ F₂ : C ⥤ Type w} (τ₁ : F ⟶ F₁) (τ₂ : F ⟶ F₂) :\n prod.lift τ₁ τ₂ ≫ prod.fst = τ₁ := rfl\n\n@[simp]\nlemma prod.lift_snd {F₁ F₂ : C ⥤ Type w} (τ₁ : F ⟶ F₁) (τ₂ : F ⟶ F₂) :\n prod.lift τ₁ τ₂ ≫ prod.snd = τ₂ := rfl\n\nvariable (F G)\n\n/-- The binary fan whose point is `prod F G`. -/\n@[simps!]\ndef binaryProductCone : BinaryFan F G :=\n BinaryFan.mk prod.fst prod.snd\n\n/-- `prod F G` is a limit cone. -/\n@[simps]\ndef binaryProductLimit : IsLimit (binaryProductCone F G) where\n lift (s : BinaryFan F G) := prod.lift s.fst s.snd\n fac _ := fun ⟨j⟩ ↦ WalkingPair.casesOn j rfl rfl\n uniq _ _ h := by\n simp only [← h ⟨WalkingPair.right⟩, ← h ⟨WalkingPair.left⟩]\n congr\n\n/-- `prod F G` is a binary product for `F` and `G`. -/\ndef binaryProductLimitCone : Limits.LimitCone (pair F G) :=\n ⟨_, binaryProductLimit F G⟩\n\n/-- The categorical binary product of type-valued functors is `prod F G`. -/\nnoncomputable def binaryProductIso : F ⨯ G ≅ prod F G :=\n limit.isoLimitCone (binaryProductLimitCone F G)\n\n@[simp]\nlemma binaryProductIso_hom_comp_fst :\n (binaryProductIso F G).hom ≫ prod.fst = Limits.prod.fst := rfl\n\n@[simp]\nlemma binaryProductIso_hom_comp_snd :\n (binaryProductIso F G).hom ≫ prod.snd = Limits.prod.snd := rfl\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\nlemma binaryProductIso_inv_comp_fst :\n (binaryProductIso F G).inv ≫ Limits.prod.fst = prod.fst := by\n simp [binaryProductIso, binaryProductLimitCone]\n\n@[simp]\nlemma binaryProductIso_inv_comp_fst_apply (a : C) (z : (prod F G).obj a) :\n dsimp% (Limits.prod.fst (X := F)).app a ((binaryProductIso F G).inv.app a z) = z.1 :=\n congr_hom (congr_app (binaryProductIso_inv_comp_fst F G) a) z\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\nlemma binaryProductIso_inv_comp_snd :\n (binaryProductIso F G).inv ≫ Limits.prod.snd = prod.snd := by\n simp [binaryProductIso, binaryProductLimitCone]\n\n@[simp]\nlemma binaryProductIso_inv_comp_snd_apply (a : C) (z : (prod F G).obj a) :\n dsimp% (Limits.prod.snd (X := F)).app a ((binaryProductIso F G).inv.app a z) = z.2 :=\n congr_hom (congr_app (binaryProductIso_inv_comp_snd F G) a) z\n\nvariable {F G}\n\n/-- Construct an element of `(F ⨯ G).obj a` from an element of `F.obj a` and\nan element of `G.obj a`. -/\nnoncomputable\ndef prodMk {a : C} (x : F.obj a) (y : G.obj a) : (F ⨯ G).obj a :=\n ((binaryProductIso F G).inv).app a ⟨x, y⟩\n\n@[simp]\nlemma prodMk_fst {a : C} (x : F.obj a) (y : G.obj a) :\n (Limits.prod.fst (X := F)).app a (prodMk x y) = x := by\n simp [prodMk]\n\n@[simp]\nlemma prodMk_snd {a : C} (x : F.obj a) (y : G.obj a) :\n (Limits.prod.snd (X := F)).app a (prodMk x y) = y := by\n simp [prodMk]\n\n@[ext]\nlemma prod_ext {a : C} (z w : (prod F G).obj a) (h1 : z.1 = w.1) (h2 : z.2 = w.2) :\n z = w := Prod.ext h1 h2\n\nvariable (F G)\n\n/-- `(F ⨯ G).obj a` is in bijection with the product of `F.obj a` and `G.obj a`. -/\n@[simps]\nnoncomputable\ndef binaryProductEquiv (a : C) : (F ⨯ G).obj a ≃ (F.obj a) × (G.obj a) where\n toFun z := ⟨((binaryProductIso F G).hom.app a z).1, ((binaryProductIso F G).hom.app a z).2⟩\n invFun z := prodMk z.1 z.2\n left_inv _ := by simp [-prod_obj, prodMk]\n right_inv _ := by simp [-prod_obj, prodMk]\n\n@[ext]\nlemma prod_ext' (a : C) (z w : (F ⨯ G).obj a)\n (h1 : (Limits.prod.fst (X := F)).app a z = (Limits.prod.fst (X := F)).app a w)\n (h2 : (Limits.prod.snd (X := F)).app a z = (Limits.prod.snd (X := F)).app a w) :\n z = w := by\n apply Equiv.injective (binaryProductEquiv F G a)\n aesop\n\nend prod\n\nsection coprod\n\n/-- `coprod F G` is the explicit binary coproduct of type-valued functors `F` and `G`. -/\n@[simps obj map]\ndef coprod : C ⥤ Type w where\n obj a := F.obj a ⊕ G.obj a\n map f := ↾(Sum.map (F.map f) (G.map f))\n map_id _ := by ext ⟨⟩ <;> simp\n map_comp _ _ := by ext ⟨⟩ <;> simp\n\nvariable {F G}\n\n/-- The left inclusion of `F` into `coprod F G`. -/\n@[simps]\ndef coprod.inl : F ⟶ coprod F G where\n app _ := ↾fun x ↦ .inl x\n\n/-- The right inclusion of `G` into `coprod F G`. -/\n@[simps]\ndef coprod.inr : G ⟶ coprod F G where\n app _ := ↾fun x ↦ .inr x\n\nset_option backward.defeqAttrib.useBackward true in\n/-- Given natural transformations `F₁ ⟶ F` and `F₂ ⟶ F`, construct\na natural transformation `coprod F₁ F₂ ⟶ F`. -/\n@[simps]\ndef coprod.desc {F₁ F₂ : C ⥤ Type w} (τ₁ : F₁ ⟶ F) (τ₂ : F₂ ⟶ F) :\n coprod F₁ F₂ ⟶ F where\n app a := ↾(Sum.elim (τ₁.app a) (τ₂.app a))\n naturality _ _ _ := by ext ⟨⟩ <;> simp\n\n@[simp]\nlemma coprod.desc_inl {F₁ F₂ : C ⥤ Type w} (τ₁ : F₁ ⟶ F) (τ₂ : F₂ ⟶ F) :\n coprod.inl ≫ coprod.desc τ₁ τ₂ = τ₁ := rfl\n\n@[simp]\nlemma coprod.desc_inr {F₁ F₂ : C ⥤ Type w} (τ₁ : F₁ ⟶ F) (τ₂ : F₂ ⟶ F) :\n coprod.inr ≫ coprod.desc τ₁ τ₂ = τ₂ := rfl\n\nvariable (F G)\n\n/-- The binary cofan whose point is `coprod F G`. -/\n@[simps!]\ndef binaryCoproductCocone : BinaryCofan F G :=\n BinaryCofan.mk coprod.inl coprod.inr\n\nset_option backward.defeqAttrib.useBackward true in\n/-- `coprod F G` is a colimit cocone. -/\n@[simps]\ndef binaryCoproductColimit : IsColimit (binaryCoproductCocone F G) where\n desc (s : BinaryCofan F G) := coprod.desc s.inl s.inr\n fac _ := fun ⟨j⟩ ↦ WalkingPair.casesOn j rfl rfl\n uniq _ _ h := by\n ext _ x\n cases x with | _ => simp [← h ⟨WalkingPair.right⟩, ← h ⟨WalkingPair.left⟩]\n\n/-- `coprod F G` is a binary coproduct for `F` and `G`. -/\ndef binaryCoproductColimitCocone : Limits.ColimitCocone (pair F G) :=\n ⟨_, binaryCoproductColimit F G⟩\n\n/-- The categorical binary coproduct of type-valued functors is `coprod F G`. -/\nnoncomputable def binaryCoproductIso : F ⨿ G ≅ coprod F G :=\n colimit.isoColimitCocone (binaryCoproductColimitCocone F G)\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\nlemma inl_comp_binaryCoproductIso_hom :\n Limits.coprod.inl ≫ (binaryCoproductIso F G).hom = coprod.inl := by\n simp only [binaryCoproductIso]\n aesop\n\n@[simp]\nlemma inl_comp_binaryCoproductIso_hom_apply (a : C) (x : F.obj a) :\n dsimp% (binaryCoproductIso F G).hom.app a ((Limits.coprod.inl (X := F)).app a x) = .inl x :=\n congr_hom (congr_app (inl_comp_binaryCoproductIso_hom F G) a) x\n\nset_option backward.isDefEq.respectTransparency false in\n@[simp]\n\nTarget:\nlemma inr_comp_binaryCoproductIso_hom :\n Limits.coprod.inr ≫ (binaryCoproductIso F G).hom = coprod.inr :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n simp [binaryCoproductIso]\n aesop","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Limits","family_id":"inr_comp_binarycoproductiso_hom","file_id":"mathlib/Mathlib/CategoryTheory/Limits/Shapes/FunctorToTypes.lean","sample_id":"241bad5eead6304b5dad8995bfd64a55289b8ca73fadc3ab52727f053689be63"},"split":"validation"} {"binding":{"chosen_proof_sha256":"43eac99e6ff24deb0ba10140dd3aec655d975a7a41be8091f0170271beadb564","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"2149422fd191070c41fdb652a238d300b74f0cc5d511790cda4cc5a2a6d17c90","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8bb499a671c32e380f5df66c53b463bdf8374724765f939c60ac58a4b60f1cfd","source_sha256":"ba496f1ae5e19ce25b587823e7f362d29c16e3b0a774157842c947dfc9e38545","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_rw [(neg_sub _ x).symm, isNilpotent_neg_iff]\n refine existsUnique_of_exists_of_unique ?_ fun r₁ r₂ ⟨hr₁, hr₁'⟩ ⟨hr₂, hr₂'⟩ ↦ ?_\n · -- Existence\n obtain ⟨n, hn⟩ := id h\n refine ⟨P.newtonMap^[n] x, isNilpotent_iterate_newtonMap_sub_of_isNilpotent h n, ?_⟩\n rw [← zero_dvd_iff, ← pow_eq_zero_of_le (n.lt_two_pow_self).le hn]\n exact aeval_pow_two_pow_dvd_aeval_iterate_newtonMap h h' n\n · -- Uniqueness\n have ⟨u, hu⟩ := binomExpansion (P.map (algebraMap R S)) r₁ (r₂ - r₁)\n suffices IsUnit (aeval r₁ (derivative P) + u * (r₂ - r₁)) by\n rwa [derivative_map, eval_map_algebraMap, eval_map_algebraMap, eval_map_algebraMap,\n add_sub_cancel, hr₂', hr₁', zero_add, pow_two, ← mul_assoc, ← add_mul, eq_comm,\n this.mul_right_eq_zero, sub_eq_zero, eq_comm] at hu\n have : IsUnit (aeval r₁ (derivative P)) :=\n isUnit_aeval_of_isUnit_aeval_of_isNilpotent_sub h' hr₁\n rw [← sub_sub_sub_cancel_right r₂ r₁ x]\n refine IsNilpotent.isUnit_add_left_of_commute ?_ this (Commute.all _ _)\n exact (Commute.all _ _).isNilpotent_mul_left <| (Commute.all _ _).isNilpotent_sub hr₂ hr₁","hard_negative":true,"metrics":{"chosen_tokens":254,"rejected_tokens":2,"token_jaccard":0.011494,"token_length_ratio":0.007874},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"54e9e0b77fe7b29629e5fdd2b5f2f5888bc0494f2e86bb602524f57c21387ec7","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Polynomial.Nilpotent\n\nNamespace:\nPolynomial\n\nLocal context:\n/-\nCopyright (c) 2024 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Antoine Chambert-Loir, Oliver Nash\n-/\n/-!\n# Newton-Raphson method\n\nGiven a single-variable polynomial `P` with derivative `P'`, Newton's method concerns iteration of\nthe rational map: `x ↦ x - P(x) / P'(x)`.\n\nOver a field, it can serve as a root-finding algorithm. It is also useful in proving results such\nas Hensel's lemma and the Jordan-Chevalley decomposition.\n\n## Main definitions / results:\n\n* `Polynomial.newtonMap`: the map `x ↦ x - P(x) / P'(x)`, where `P'` is the derivative of the\n polynomial `P`.\n* `Polynomial.isFixedPt_newtonMap_of_isUnit_iff`: `x` is a fixed point for Newton iteration iff\n it is a root of `P` (provided `P'(x)` is a unit).\n* `Polynomial.existsUnique_nilpotent_sub_and_aeval_eq_zero`: if `x` is almost a root of `P` in the\n sense that `P(x)` is nilpotent (and `P'(x)` is a unit) then we may write `x` as a sum\n `x = n + r` where `n` is nilpotent and `r` is a root of `P`. This can be used to prove the\n Jordan-Chevalley decomposition of linear endomorphisms.\n\n-/\n\n@[expose] public section\n\nopen Set Function\n\nnoncomputable section\n\nnamespace Polynomial\n\nvariable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] (P : R[X]) {x : S}\n\n/-- Given a single-variable polynomial `P` with derivative `P'`, this is the map:\n`x ↦ x - P(x) / P'(x)`. When `P'(x)` is not a unit we use a junk-value pattern and send `x ↦ x`. -/\ndef newtonMap (x : S) : S :=\n x - (Ring.inverse <| aeval x (derivative P)) * aeval x P\n\ntheorem newtonMap_apply :\n P.newtonMap x = x - (Ring.inverse <| aeval x (derivative P)) * (aeval x P) :=\n rfl\n\nvariable {P}\n\ntheorem newtonMap_apply_of_isUnit (h : IsUnit <| aeval x (derivative P)) :\n P.newtonMap x = x - h.unit⁻¹ * aeval x P := by\n simp [newtonMap_apply, Ring.inverse, h]\n\ntheorem newtonMap_apply_of_not_isUnit (h : ¬ (IsUnit <| aeval x (derivative P))) :\n P.newtonMap x = x := by\n simp [newtonMap_apply, Ring.inverse, h]\n\ntheorem isNilpotent_iterate_newtonMap_sub_of_isNilpotent (h : IsNilpotent <| aeval x P) (n : ℕ) :\n IsNilpotent <| P.newtonMap^[n] x - x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [iterate_succ', comp_apply, newtonMap_apply, sub_right_comm]\n refine (Commute.all _ _).isNilpotent_sub ih <| (Commute.all _ _).isNilpotent_mul_left ?_\n simpa using Commute.isNilpotent_add (Commute.all _ _)\n (isNilpotent_aeval_sub_of_isNilpotent_sub P ih) h\n\ntheorem isFixedPt_newtonMap_of_aeval_eq_zero (h : aeval x P = 0) :\n IsFixedPt P.newtonMap x := by\n rw [IsFixedPt, newtonMap_apply, h, mul_zero, sub_zero]\n\ntheorem isFixedPt_newtonMap_of_isUnit_iff (h : IsUnit <| aeval x (derivative P)) :\n IsFixedPt P.newtonMap x ↔ aeval x P = 0 := by\n rw [IsFixedPt, newtonMap_apply, sub_eq_self, Ring.inverse_mul_eq_iff_eq_mul _ _ _ h, mul_zero]\n\n/-- This is really an auxiliary result, en route to\n`Polynomial.existsUnique_nilpotent_sub_and_aeval_eq_zero`. -/\ntheorem aeval_pow_two_pow_dvd_aeval_iterate_newtonMap\n (h : IsNilpotent (aeval x P)) (h' : IsUnit (aeval x <| derivative P)) (n : ℕ) :\n (aeval x P) ^ (2 ^ n) ∣ aeval (P.newtonMap^[n] x) P := by\n induction n with\n | zero => simp\n | succ n ih =>\n have ⟨d, hd⟩ := binomExpansion (P.map (algebraMap R S)) (P.newtonMap^[n] x)\n (-Ring.inverse (aeval (P.newtonMap^[n] x) <| derivative P) * aeval (P.newtonMap^[n] x) P)\n rw [eval_map_algebraMap, eval_map_algebraMap] at hd\n rw [iterate_succ', comp_apply, newtonMap_apply, sub_eq_add_neg, neg_mul_eq_neg_mul, hd]\n refine dvd_add ?_ (dvd_mul_of_dvd_right ?_ _)\n · convert! dvd_zero _\n have : IsUnit (aeval (P.newtonMap^[n] x) <| derivative P) :=\n isUnit_aeval_of_isUnit_aeval_of_isNilpotent_sub h' <|\n isNilpotent_iterate_newtonMap_sub_of_isNilpotent h n\n rw [derivative_map, eval_map_algebraMap, ← mul_assoc, mul_neg, Ring.mul_inverse_cancel _ this,\n neg_mul, one_mul, add_neg_cancel]\n · rw [neg_mul, even_two.neg_pow, mul_pow, pow_succ, pow_mul]\n exact dvd_mul_of_dvd_right (pow_dvd_pow_of_dvd ih 2) _\n\n/-- If `x` is almost a root of `P` in the sense that `P(x)` is nilpotent (and `P'(x)` is a\nunit) then we may write `x` as a sum `x = n + r` where `n` is nilpotent and `r` is a root of `P`.\nMoreover, `n` and `r` are unique.\n\nThis can be used to prove the Jordan-Chevalley decomposition of linear endomorphisms. -/\n\nTarget:\ntheorem existsUnique_nilpotent_sub_and_aeval_eq_zero\n (h : IsNilpotent (aeval x P)) (h' : IsUnit (aeval x <| derivative P)) :\n ∃! r, IsNilpotent (x - r) ∧ aeval r P = 0 :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_8bb499a671c3","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"4c003b4f584d69059854618a91c3e47c0b1885ab7d5e0ad8e4a77b279a5ce59a","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Dynamics","family_id":"existsunique_nilpotent_sub_and_aeval_eq_zero","file_id":"mathlib/Mathlib/Dynamics/Newton.lean","sample_id":"8bb499a671c32e380f5df66c53b463bdf8374724765f939c60ac58a4b60f1cfd"},"split":"validation"} {"binding":{"chosen_proof_sha256":"913d082c9208bb76bddc5c53143841e2bf0506c046fa9176c015a2e29cc88577","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6f2e5d9b556fcb80e6fe3e3ec023b7f0843a5a38d89b1e624de51f9015b0b288","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"a7e152ac7095d7f066dffa16e5ed09404a6c122ae0df9540aece7f1a11c28b41","source_sha256":"6e6693983d0a08af453285c1b35f1384fa1c0fbb8f0d7c6a8d695e28e681b638","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n dsimp only [MorphismProperty.HasCardinalLT]\n rw [MorphismProperty.toSet_max]\n exact hasCardinalLT_union hκ h₁ h₂","hard_negative":true,"metrics":{"chosen_tokens":22,"rejected_tokens":5,"token_jaccard":0.235294,"token_length_ratio":0.227273},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"5516a9f59cfe3a58c8e246d2176962a4b72fff4e4dfa69dafd201e3529f7f729","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.SetTheory.Cardinal.HasCardinalLT\npublic import Mathlib.CategoryTheory.MorphismProperty.Basic\n\nNamespace:\nCategoryTheory.MorphismProperty\n\nLocal context:\n/-\nCopyright (c) 2025 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n/-!\n# Properties of morphisms that are bounded by a cardinal\n\nGiven `P : MorphismProperty C` and `κ : Cardinal`, we introduce a predicate\n`P.HasCardinalLT κ` saying that the cardinality of `P.toSet` is `< κ`.\n\n-/\n\npublic section\n\nuniverse w v u\n\nnamespace CategoryTheory\n\nvariable {C : Type u} [Category.{v} C]\n\nnamespace MorphismProperty\n\n/-- The property that the subtype of arrows satisfying a property `P : MorphismProperty C`\nis of cardinality `< κ`. -/\nprotected abbrev HasCardinalLT (P : MorphismProperty C) (κ : Cardinal.{w}) :=\n _root_.HasCardinalLT P.toSet κ\n\nlemma hasCardinalLT_ofHoms {C : Type*} [Category* C]\n {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) {κ : Cardinal}\n (h : HasCardinalLT ι κ) : (MorphismProperty.ofHoms f).HasCardinalLT κ :=\n h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by\n rintro ⟨f, hf⟩\n rw [MorphismProperty.mem_toSet_iff, MorphismProperty.ofHoms_iff] at hf\n obtain ⟨i, hf⟩ := hf\n obtain rfl : f = _ := hf\n exact ⟨i, rfl⟩)\n\nlemma HasCardinalLT.iSup\n {ι : Type*} {P : ι → MorphismProperty C} {κ : Cardinal.{w}} [Fact κ.IsRegular]\n (hP : ∀ i, (P i).HasCardinalLT κ) (hι : HasCardinalLT ι κ) :\n (⨆ i, P i).HasCardinalLT κ := by\n dsimp only [MorphismProperty.HasCardinalLT]\n rw [toSet_iSup]\n exact hasCardinalLT_iUnion _ hι hP\n\nTarget:\nlemma HasCardinalLT.sup\n {P₁ P₂ : MorphismProperty C} {κ : Cardinal.{w}}\n (h₁ : P₁.HasCardinalLT κ) (h₂ : P₂.HasCardinalLT κ)\n (hκ : Cardinal.aleph0 ≤ κ) :\n (P₁ ⊔ P₂).HasCardinalLT κ :=\n\nProof body:\n","rejected":"by\n exact HasCardinalLT.sup","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"241625f7ab1a6771845fb7d69b6beb3194f888bb54797ce136402f7c229441c0","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/MorphismProperty","family_id":"hascardinallt","file_id":"mathlib/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean","sample_id":"a7e152ac7095d7f066dffa16e5ed09404a6c122ae0df9540aece7f1a11c28b41"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4a4930020165d85951ea7218cf3532f4a238f279f18a1e79774e7569b91912bb","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ca02ea81322f1fc81778a460bde26244fe65ec5faeb54e8c6ade9ea5e475356d","source_sha256":"7af9ae814fef6855524f2289979442060289c7085e449c49d2dbe6db43c90104","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← MonoidHom.mem_ker, ← S.range_inl_eq_ker_rightHom, MonoidHom.mem_range]\n exact exists_apply_eq_apply S.inl n","hard_negative":false,"metrics":{"chosen_tokens":23,"rejected_tokens":2,"token_jaccard":0.058824,"token_length_ratio":0.086957},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"5527ae1e12994d979572941aeb9dfcb2d60f64ee3dd015c3cb2442d762fb895b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.GroupAction.ConjAct\npublic import Mathlib.GroupTheory.SemidirectProduct\n\nNamespace:\nGroupExtension\n\nLocal context:\n/-\nCopyright (c) 2024 Yudai Yamazaki. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yudai Yamazaki\n-/\n/-!\n# Group Extensions\n\nThis file defines extensions of multiplicative and additive groups and their associated structures\nsuch as splittings and equivalences.\n\n## Main definitions\n\n- `(Add?)GroupExtension N E G`: structure for extensions of `G` by `N` as short exact sequences\n `1 → N → E → G → 1` (`0 → N → E → G → 0` for additive groups)\n- `(Add?)GroupExtension.Equiv S S'`: structure for equivalences of two group extensions `S` and `S'`\n as specific homomorphisms `E → E'` such that each diagram below is commutative\n\n```text\nFor multiplicative groups:\n ↗ E ↘\n1 → N ↓ G → 1\n ↘ E' ↗\n\nFor additive groups:\n ↗ E ↘\n0 → N ↓ G → 0\n ↘ E' ↗\n```\n\n- `(Add?)GroupExtension.Section S`: structure for right inverses to `rightHom` of a group extension\n `S` of `G` by `N`\n- `(Add?)GroupExtension.Splitting S`: structure for section homomorphisms of a group extension `S`\n of `G` by `N`\n- `SemidirectProduct.toGroupExtension φ`: the multiplicative group extension associated to the\n semidirect product coming from `φ : G →* MulAut N`, `1 → N → N ⋊[φ] G → G → 1`\n\n## TODO\n\nIf `N` is abelian,\n\n- there is a bijection between `N`-conjugacy classes of\n `(SemidirectProduct.toGroupExtension φ).Splitting` and `groupCohomology.H1`\n (which will be available in the planned file `Mathlib/GroupTheory/GroupExtension/Abelian.lean` to\n be added in a later PR).\n- there is a bijection between equivalence classes of group extensions and `groupCohomology.H2`\n (which is also stated as a TODO in `Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean`).\n-/\n\n@[expose] public section\n\nvariable (N E G : Type*)\n\n/-- `AddGroupExtension N E G` is a short exact sequence of additive groups `0 → N → E → G → 0`. -/\nstructure AddGroupExtension [AddGroup N] [AddGroup E] [AddGroup G] where\n /-- The inclusion homomorphism `N →+ E` -/\n inl : N →+ E\n /-- The projection homomorphism `E →+ G` -/\n rightHom : E →+ G\n /-- The inclusion map is injective. -/\n inl_injective : Function.Injective inl\n /-- The range of the inclusion map is equal to the kernel of the projection map. -/\n range_inl_eq_ker_rightHom : inl.range = rightHom.ker\n /-- The projection map is surjective. -/\n rightHom_surjective : Function.Surjective rightHom\n\n/-- `GroupExtension N E G` is a short exact sequence of groups `1 → N → E → G → 1`. -/\n@[to_additive]\nstructure GroupExtension [Group N] [Group E] [Group G] where\n /-- The inclusion homomorphism `N →* E` -/\n inl : N →* E\n /-- The projection homomorphism `E →* G` -/\n rightHom : E →* G\n /-- The inclusion map is injective. -/\n inl_injective : Function.Injective inl\n /-- The range of the inclusion map is equal to the kernel of the projection map. -/\n range_inl_eq_ker_rightHom : inl.range = rightHom.ker\n /-- The projection map is surjective. -/\n rightHom_surjective : Function.Surjective rightHom\n\nvariable {N E G}\n\nnamespace AddGroupExtension\n\nvariable [AddGroup N] [AddGroup E] [AddGroup G] (S : AddGroupExtension N E G)\n\n/-- `AddGroupExtension`s are equivalent iff there is an isomorphism making a commuting diagram.\n Use `AddGroupExtension.Equiv.ofMonoidHom` in `Mathlib/GroupTheory/GroupExtension/Basic.lean` to\n construct an equivalence without providing the inverse map. -/\nstructure Equiv {E' : Type*} [AddGroup E'] (S' : AddGroupExtension N E' G) extends E ≃+ E' where\n /-- The left-hand side of the diagram commutes. -/\n inl_comm : toAddEquiv ∘ S.inl = S'.inl\n /-- The right-hand side of the diagram commutes. -/\n rightHom_comm : S'.rightHom ∘ toAddEquiv = S.rightHom\n\n/-- `Section` of an additive group extension is a right inverse to `S.rightHom`. -/\nstructure Section where\n /-- The underlying function -/\n toFun : G → E\n /-- `Section` is a right inverse to `S.rightHom` -/\n rightInverse_rightHom : Function.RightInverse toFun S.rightHom\n\n/-- `Splitting` of an additive group extension is a section homomorphism. -/\nstructure Splitting extends G →+ E, S.Section\n\n/-- A splitting of an additive group extension as a (set-theoretic) section. -/\nadd_decl_doc Splitting.toSection\n\nend AddGroupExtension\n\nnamespace GroupExtension\n\nvariable [Group N] [Group E] [Group G] (S : GroupExtension N E G)\n\n/-- The range of the inclusion map is a normal subgroup. -/\n@[to_additive /-- The range of the inclusion map is a normal additive subgroup. -/]\ninstance normal_inl_range : S.inl.range.Normal :=\n S.range_inl_eq_ker_rightHom ▸ S.rightHom.normal_ker\n\n@[to_additive (attr := simp)]\n\nTarget:\ntheorem rightHom_inl (n : N) : S.rightHom (S.inl n) = 1 :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/GroupExtension","family_id":"righthom_inl","file_id":"mathlib/Mathlib/GroupTheory/GroupExtension/Defs.lean","sample_id":"ca02ea81322f1fc81778a460bde26244fe65ec5faeb54e8c6ade9ea5e475356d"},"split":"validation"} {"binding":{"chosen_proof_sha256":"fb5dc0789692c1f3dd83aa85e8dac3ff1639f8dacb771677d6236aef176544dd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"be0f886f926c49126c6e084f51ebb26dfff9d4b6c035deb38fb27982b8fe0abe","source_sha256":"ce37053811c57628f9bd81f1b38b031dbcbd1939b1f8ff81c3cd361080cc2a0b","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa [Algebra.TensorProduct.one_def] using mul_antipode_rTensor_comul_apply (R := R) (1 : A)","hard_negative":false,"metrics":{"chosen_tokens":21,"rejected_tokens":3,"token_jaccard":0.052632,"token_length_ratio":0.142857},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"5665cf4a1c46f70e6d255f9f7529551f56e7c2c8f811489490bf3b09b74cad14","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Bialgebra.Basic\npublic import Mathlib.RingTheory.Coalgebra.Convolution\n\nNamespace:\nHopfAlgebra\n\nLocal context:\n/-\nCopyright (c) 2024 Ali Ramsey. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Ali Ramsey\n-/\n/-!\n# Hopf algebras\n\nIn this file we define `HopfAlgebra`, and provide instances for:\n\n* Commutative semirings: `CommSemiring.toHopfAlgebra`\n\n## Main definitions\n\n* `HopfAlgebra R A` : the Hopf algebra structure on an `R`-bialgebra `A`.\n* `HopfAlgebra.antipode` : the `R`-linear map `A →ₗ[R] A`.\n* `HopfAlgebra.ofConvInverse` : construct a Hopf algebra from a two-sided convolution inverse\n of the identity.\n* `HopfAlgebra.ofAlgHom` : the same for commutative `A`, with `AlgHom` hypotheses.\n\n## Main results\n\n* `HopfAlgebra.antipode_one` : the antipode of the unit is the unit.\n* `HopfAlgebra.antipode_mul` : the antipode is an antihomomorphism: `S(ab) = S(b)S(a)`.\n\n## TODO\n\n* Uniqueness of Hopf algebra structure on a bialgebra (i.e. if the algebra and coalgebra structures\n agree then the antipodes must also agree).\n\n* If `A` is commutative then `antipode` is an algebra homomorphism.\n\n* If `A` is commutative then `antipode` is necessarily a bijection and its square is\n the identity.\n\n(Note that all three facts have been proved for Hopf bimonoids in an arbitrary braided category,\nso we could deduce the facts here from an equivalence `HopfAlgCat R ≌ Hopf (ModuleCat R)`.)\n\n## References\n\n* \n\n* [C. Kassel, *Quantum Groups* (§III.3)][Kassel1995]\n\n\n-/\n\npublic section\n\nopen Bialgebra\n\nuniverse u v w\n\n/-- Isolates the antipode of a Hopf algebra, to allow API to be constructed before proving the\nHopf algebra axioms. See `HopfAlgebra` for documentation. -/\nclass HopfAlgebraStruct (R : Type u) (A : Type v) [CommSemiring R] [Semiring A]\n extends Bialgebra R A where\n /-- The antipode of the Hopf algebra. -/\n antipode (R) : A →ₗ[R] A\n\n/-- A Hopf algebra over a commutative (semi)ring `R` is a bialgebra over `R` equipped with an\n`R`-linear endomorphism `antipode` satisfying the antipode axioms. -/\nclass HopfAlgebra (R : Type u) (A : Type v) [CommSemiring R] [Semiring A] extends\n HopfAlgebraStruct R A where\n /-- One of the antipode axioms for a Hopf algebra. -/\n mul_antipode_rTensor_comul :\n LinearMap.mul' R A ∘ₗ antipode.rTensor A ∘ₗ comul = (Algebra.linearMap R A) ∘ₗ counit\n /-- One of the antipode axioms for a Hopf algebra. -/\n mul_antipode_lTensor_comul :\n LinearMap.mul' R A ∘ₗ antipode.lTensor A ∘ₗ comul = (Algebra.linearMap R A) ∘ₗ counit\n\nnamespace HopfAlgebra\n\nexport HopfAlgebraStruct (antipode)\n\nvariable {R : Type u} {A : Type v} {ι : Type*} [CommSemiring R] [Semiring A] [HopfAlgebra R A]\n {a : A}\n\n@[simp]\ntheorem mul_antipode_rTensor_comul_apply (a : A) :\n LinearMap.mul' R A ((antipode R).rTensor A (Coalgebra.comul a)) =\n algebraMap R A (Coalgebra.counit a) :=\n LinearMap.congr_fun mul_antipode_rTensor_comul a\n\n@[simp]\ntheorem mul_antipode_lTensor_comul_apply (a : A) :\n LinearMap.mul' R A ((antipode R).lTensor A (Coalgebra.comul a)) =\n algebraMap R A (Coalgebra.counit a) :=\n LinearMap.congr_fun mul_antipode_lTensor_comul a\n\n@[simp]\n\nTarget:\ntheorem antipode_one :\n HopfAlgebra.antipode R (1 : A) = 1 :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/HopfAlgebra","family_id":"antipode_one","file_id":"mathlib/Mathlib/RingTheory/HopfAlgebra/Basic.lean","sample_id":"be0f886f926c49126c6e084f51ebb26dfff9d4b6c035deb38fb27982b8fe0abe"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5f4ec1fadc34891847a7da527835fa28eb9845877c9dd8ef226bb8cf0f4991f0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"250df88c40a9c38c53c756c9f0a6070ff564fcc606b5665c05481b0f1e5a0c17","source_sha256":"ecc7ed823eab4701ef04e2817ef37a969189071935536b0da6ae40027d388081","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [UniformSpace.mem_nhds_iff]\n constructor\n · rintro ⟨V, V_in, V_sub⟩\n rw [IsUltraUniformity.hasBasis.mem_iff'] at V_in\n obtain ⟨U, ⟨U_in, U_sym, U_trans⟩, U_sub⟩ := V_in\n refine ⟨U, U_in, U_sym, U_trans, (UniformSpace.ball_mono U_sub _).trans V_sub⟩\n · rintro ⟨V, V_in, _, _, V_sub⟩\n exact ⟨V, V_in, V_sub⟩","hard_negative":true,"metrics":{"chosen_tokens":85,"rejected_tokens":8,"token_jaccard":0.051282,"token_length_ratio":0.094118},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"56d5f240457d649f1d4432fd18f6e0c52fb25a5d949a0f7dc3907da4a0edf991","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.UniformSpace.Defs\npublic import Mathlib.Topology.Bases\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Yakov Pechersky. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yakov Pechersky\n-/\n/-!\n# Ultrametric (nonarchimedean) uniform spaces\n\nUltrametric (nonarchimedean) uniform spaces are ones that generalize ultrametric spaces by\nhaving a uniformity based on equivalence relations.\n\n## Main definitions\n\nIn this file we define `IsUltraUniformity`, a Prop mixin typeclass.\n\n## Main results\n\n* `TopologicalSpace.isTopologicalBasis_clopens`: a uniform space with a nonarchimedean uniformity\n has a topological basis of clopen sets in the topology, meaning that it is topologically\n zero-dimensional.\n\n## Implementation notes\n\nAs in the `Mathlib/Topology/UniformSpace/Defs.lean` file, we do not reuse `Mathlib/Data/Rel.lean`\nbut rather extend the relation properties as needed.\n\n## TODOs\n\n* Prove that `IsUltraUniformity` iff metrizable by `IsUltrametricDist` on a `PseudoMetricSpace`\n under a countable system/basis condition\n* Generalize `IsUltrametricDist` to `IsUltrametricUniformity`\n* Provide `IsUltraUniformity` for the uniformity in a `Valued` ring\n* Generalize results about open/closed balls and spheres in `IsUltraUniformity` to\n combine applications for `MetricSpace.ball` and valued \"balls\"\n* Use `IsUltraUniformity` to work with profinite/totally separated spaces\n\n## References\n\n* [D. Windisch, *Equivalent characterizations of non-Archimedean uniform spaces*][windisch2021]\n* [A. C. M. van Rooij, *Non-Archimedean uniformities*][vanrooij1970]\n\n-/\n\n@[expose] public section\n\nopen Set Filter Topology\nopen scoped SetRel Uniformity\n\nvariable {X : Type*}\n\nlemma IsTransitiveRel.prod_subset_trans {s : SetRel X X} {t u v : Set X} [s.IsTrans]\n (htu : t ×ˢ u ⊆ s) (huv : u ×ˢ v ⊆ s) (hu : u.Nonempty) :\n t ×ˢ v ⊆ s := by\n rintro ⟨a, b⟩ hab\n simp only [mem_prod] at hab\n obtain ⟨x, hx⟩ := hu\n exact s.trans (@htu ⟨a, x⟩ ⟨hab.left, hx⟩) (@huv ⟨x, b⟩ ⟨hx, hab.right⟩)\n\nlemma IsTransitiveRel.mem_filter_prod_trans {s : SetRel X X} {f g h : Filter X} [g.NeBot]\n [s.IsTrans] (hfg : s ∈ f ×ˢ g) (hgh : s ∈ g ×ˢ h) :\n s ∈ f ×ˢ h :=\n Eventually.trans_prod (p := (fun x y ↦ (x, y) ∈ s)) (q := (fun x y ↦ (x, y) ∈ s))\n (r := (fun x y ↦ (x, y) ∈ s)) hfg hgh fun _ _ _ ↦ s.trans\n\nopen UniformSpace\n\nlemma ball_subset_of_mem {V : SetRel X X} [V.IsTrans] {x y : X} (hy : y ∈ ball x V) :\n ball y V ⊆ ball x V :=\n ball_subset_of_comp_subset hy SetRel.comp_subset_self\n\nlemma ball_eq_of_mem {V : SetRel X X} [V.IsSymm] [V.IsTrans] {x y : X} (hy : y ∈ ball x V) :\n ball x V = ball y V := by\n refine le_antisymm (ball_subset_of_mem ?_) (ball_subset_of_mem hy)\n rwa [← mem_ball_symmetry]\n\nvariable [UniformSpace X]\n\nvariable (X) in\n/-- A uniform space is ultrametric if the uniformity `𝓤 X` has a basis of equivalence relations. -/\nclass IsUltraUniformity : Prop where\n hasBasis : (𝓤 X).HasBasis\n (fun s : SetRel X X => s ∈ 𝓤 X ∧ SetRel.IsSymm s ∧ SetRel.IsTrans s) id\n\nlemma IsUltraUniformity.mk_of_hasBasis {ι : Type*} {p : ι → Prop} {s : ι → SetRel X X}\n (h_basis : (𝓤 X).HasBasis p s) (h_symm : ∀ i, p i → SetRel.IsSymm (s i))\n (h_trans : ∀ i, p i → SetRel.IsTrans (s i)) :\n IsUltraUniformity X where\n hasBasis := h_basis.to_hasBasis'\n (fun i hi ↦ ⟨s i, ⟨h_basis.mem_of_mem hi, h_symm i hi, h_trans i hi⟩, subset_rfl⟩)\n (fun _ hs ↦ hs.1)\n\nTarget:\nlemma IsUltraUniformity.mem_nhds_iff_symm_trans [IsUltraUniformity X] {x : X} {s : Set X} :\n s ∈ 𝓝 x ↔ ∃ V ∈ 𝓤 X, SetRel.IsSymm V ∧ SetRel.IsTrans V ∧ UniformSpace.ball x V ⊆ s :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"dbf42c73017fb1743e8aea21e37baae037ceaa5bc2030f5c1e75be4d73e8c508","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/UniformSpace","family_id":"isultrauniformity","file_id":"mathlib/Mathlib/Topology/UniformSpace/Ultra/Basic.lean","sample_id":"250df88c40a9c38c53c756c9f0a6070ff564fcc606b5665c05481b0f1e5a0c17"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5660265bd323109b39095dd42345d8988e67e51883994445e37df5a94fa9fb63","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d8110384edcce73ee0537dec0226055f3d4105f8818cf6f6da88a02894ba6ac4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d033ac08ff0773d8cd710d59db4143a19c0a7bdc12fd0e5323510cd8f78442b6","source_sha256":"8a3ed8c4958576dfb64a5b6e4797c98f6e40ab96e7622412ed9830183a729b69","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n revert x y\n rw [isSymm_iff_eq_flip]\n aesop\n\nvariable (A) in\n/-- The base change of a bilinear map (also known as \"extension of scalars\"). -/\nprotected def baseChange (B : BilinMap R M₂ N₂) : BilinMap A (A ⊗[R] M₂) (A ⊗[R] N₂) :=\n BilinMap.tmul (R := R) (A := A) (M₁ := A) (M₂ := M₂) (LinearMap.mul A A) B","hard_negative":true,"metrics":{"chosen_tokens":106,"rejected_tokens":5,"token_jaccard":0.040816,"token_length_ratio":0.04717},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"56da0c4524a726d545119615a1d698d4420cad021e8bc7b4d6d0a6c84c060337","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.BilinearForm.Hom\npublic import Mathlib.LinearAlgebra.Dual.Lemmas\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.RingTheory.TensorProduct.Finite\n\nNamespace:\nLinearMap.BilinMap\n\nLocal context:\n/-\nCopyright (c) 2023 Eric Wieser. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Eric Wieser\n-/\n/-!\n# The bilinear form on a tensor product\n\n## Main definitions\n\n* `LinearMap.BilinMap.tensorDistrib (B₁ ⊗ₜ B₂)`: the bilinear form on `M₁ ⊗ M₂` constructed by\n applying `B₁` on `M₁` and `B₂` on `M₂`.\n* `LinearMap.BilinMap.tensorDistribEquiv`: `BilinForm.tensorDistrib` as an equivalence on finite\n free modules.\n\n-/\n\n@[expose] public section\n\nuniverse u v w uR uA uM₁ uM₂ uN₁ uN₂\n\nvariable {R : Type uR} {A : Type uA} {M₁ : Type uM₁} {M₂ : Type uM₂} {N₁ : Type uN₁} {N₂ : Type uN₂}\n\nopen TensorProduct\n\nnamespace LinearMap\n\nopen LinearMap (BilinMap BilinForm)\n\nsection CommSemiring\n\nvariable [CommSemiring R] [CommSemiring A]\nvariable [AddCommMonoid M₁] [AddCommMonoid M₂] [AddCommMonoid N₁] [AddCommMonoid N₂]\nvariable [Algebra R A] [Module R M₁] [Module A M₁] [Module R N₁] [Module A N₁]\nvariable [SMulCommClass R A M₁] [IsScalarTower R A M₁]\nvariable [SMulCommClass R A N₁] [IsScalarTower R A N₁]\nvariable [Module R M₂] [Module R N₂]\n\nnamespace BilinMap\n\nvariable (R A) in\n/-- The tensor product of two bilinear maps injects into bilinear maps on tensor products.\n\nNote this is heterobasic; the bilinear map on the left can take values in a module over a\n(commutative) algebra over the ring of the module in which the right bilinear map is valued. -/\ndef tensorDistrib :\n (BilinMap A M₁ N₁ ⊗[R] BilinMap R M₂ N₂) →ₗ[A] BilinMap A (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂) :=\n (TensorProduct.lift.equiv (.id A) (M₁ ⊗[R] M₂) (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂)).symm.toLinearMap ∘ₗ\n ((LinearMap.llcomp A _ _ _).flip\n (TensorProduct.AlgebraTensorModule.tensorTensorTensorComm R R A A M₁ M₂ M₁ M₂).toLinearMap)\n ∘ₗ TensorProduct.AlgebraTensorModule.homTensorHomMap R _ _ _ _ _ _\n ∘ₗ (TensorProduct.AlgebraTensorModule.congr\n (TensorProduct.lift.equiv (.id A) M₁ M₁ N₁)\n (TensorProduct.lift.equiv (.id R) _ _ _)).toLinearMap\n\n@[simp]\ntheorem tensorDistrib_tmul (B₁ : BilinMap A M₁ N₁) (B₂ : BilinMap R M₂ N₂) (m₁ : M₁) (m₂ : M₂)\n (m₁' : M₁) (m₂' : M₂) :\n tensorDistrib R A (B₁ ⊗ₜ B₂) (m₁ ⊗ₜ m₂) (m₁' ⊗ₜ m₂')\n = B₁ m₁ m₁' ⊗ₜ B₂ m₂ m₂' :=\n rfl\n\n/-- The tensor product of two bilinear forms, a shorthand for dot notation. -/\nprotected abbrev tmul (B₁ : BilinMap A M₁ N₁) (B₂ : BilinMap R M₂ N₂) :\n BilinMap A (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂) :=\n tensorDistrib R A (B₁ ⊗ₜ[R] B₂)\n\nattribute [local ext] TensorProduct.ext in\n/-- A tensor product of symmetric bilinear maps is symmetric. -/\n\nTarget:\nlemma tmul_isSymm {B₁ : BilinMap A M₁ N₁} {B₂ : BilinMap R M₂ N₂}\n (hB₁ : ∀ x y, B₁ x y = B₁ y x) (hB₂ : ∀ x y, B₂ x y = B₂ y x)\n (x y : M₁ ⊗[R] M₂) :\n B₁.tmul B₂ x y = B₁.tmul B₂ y x :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_d033ac08ff07","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"3982a107934fffeb75d49381882ded266fd6550c4afeb1201510eb2331b3dd21","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/BilinearForm","family_id":"tmul_issymm","file_id":"mathlib/Mathlib/LinearAlgebra/BilinearForm/TensorProduct.lean","sample_id":"d033ac08ff0773d8cd710d59db4143a19c0a7bdc12fd0e5323510cd8f78442b6"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4a65cc27fbfccb0962f2b40b6449adb7efeb1278751be2fe5962887d4998e66f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"5c1296024d73041c2e9ac87ac6504f674e25b0b3b2856611d884ec3f696c5e60","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"970944dc1afd0e0eb6c4cb55334bce3e1ad8e6505f9f7729235cd49cf2489634","source_sha256":"766299eabb61515bf61321e63a62728ce040d606e2774c9023e11c0ba06c287b","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis hB hB']","hard_negative":true,"metrics":{"chosen_tokens":21,"rejected_tokens":3,"token_jaccard":0.055556,"token_length_ratio":0.142857},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"570975f17b8be802ed47c7f8f5baea993ab4b5b802b48905847695cbe216f298","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.BilinearForm.Properties\n\nNamespace:\nLinearMap.BilinForm\n\nLocal context:\n/-\nCopyright (c) 2018 Andrew Yang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Andrew Yang\n-/\n/-!\n\n# Dual submodule with respect to a bilinear form.\n\n## Main definitions and results\n- `BilinForm.dualSubmodule`: The dual submodule with respect to a bilinear form.\n- `BilinForm.dualSubmodule_span_of_basis`: The dual of a lattice is spanned by the dual basis.\n\n## TODO\nProperly develop the material in the context of lattices.\n-/\n\n@[expose] public section\n\nopen LinearMap (BilinForm)\nopen Module\n\nvariable {R S M} [CommRing R] [Field S] [AddCommGroup M]\nvariable [Algebra R S] [Module R M] [Module S M] [IsScalarTower R S M]\n\nnamespace LinearMap\n\nnamespace BilinForm\n\nvariable (B : BilinForm S M)\n\n/-- The dual submodule of a submodule with respect to a bilinear form. -/\ndef dualSubmodule (N : Submodule R M) : Submodule R M where\n carrier := { x | ∀ y ∈ N, B x y ∈ (1 : Submodule R S) }\n add_mem' {a b} ha hb y hy := by simpa using add_mem (ha y hy) (hb y hy)\n zero_mem' y _ := by rw [B.zero_left]; exact zero_mem _\n smul_mem' r a ha y hy := by\n convert! (1 : Submodule R S).smul_mem r (ha y hy)\n rw [← IsScalarTower.algebraMap_smul S r a]\n simp only [algebraMap_smul, map_smul_of_tower, LinearMap.smul_apply]\n\nlemma mem_dualSubmodule {N : Submodule R M} {x} :\n x ∈ B.dualSubmodule N ↔ ∀ y ∈ N, B x y ∈ (1 : Submodule R S) := Iff.rfl\n\nlemma le_flip_dualSubmodule {N₁ N₂ : Submodule R M} :\n N₁ ≤ B.flip.dualSubmodule N₂ ↔ N₂ ≤ B.dualSubmodule N₁ := by\n change (∀ (x : M), x ∈ N₁ → _) ↔ ∀ (x : M), x ∈ N₂ → _\n simp only [mem_dualSubmodule, Submodule.mem_one, flip_apply]\n exact forall₂_comm\n\n/-- The natural paring of `B.dualSubmodule N` and `N`.\nThis is bundled as a bilinear map in `BilinForm.dualSubmoduleToDual`. -/\nnoncomputable\ndef dualSubmoduleParing {N : Submodule R M} (x : B.dualSubmodule N) (y : N) : R :=\n (Submodule.mem_one.mp <| x.prop y y.prop).choose\n\n@[simp]\nlemma dualSubmoduleParing_spec {N : Submodule R M} (x : B.dualSubmodule N) (y : N) :\n algebraMap R S (B.dualSubmoduleParing x y) = B x y :=\n (Submodule.mem_one.mp <| x.prop y y.prop).choose_spec\n\n/-- The natural paring of `B.dualSubmodule N` and `N`. -/\n-- TODO: Show that this is perfect when `N` is a lattice and `B` is nondegenerate.\n@[simps]\nnoncomputable\ndef dualSubmoduleToDual [IsDomain R] [IsTorsionFree R S] (N : Submodule R M) :\n B.dualSubmodule N →ₗ[R] Module.Dual R N :=\n { toFun := fun x ↦\n { toFun := B.dualSubmoduleParing x\n map_add' := fun x y ↦ FaithfulSMul.algebraMap_injective R S (by simp)\n map_smul' := fun r m ↦ FaithfulSMul.algebraMap_injective R S\n (by simp [← Algebra.smul_def]) }\n map_add' := fun x y ↦ LinearMap.ext fun z ↦ FaithfulSMul.algebraMap_injective R S\n (by simp)\n map_smul' := fun r x ↦ LinearMap.ext fun y ↦ FaithfulSMul.algebraMap_injective R S\n (by simp [← Algebra.smul_def]) }\n\nlemma dualSubmoduleToDual_injective [IsDomain R] (hB : B.Nondegenerate) [IsTorsionFree R S]\n (N : Submodule R M) (hN : Submodule.span S (N : Set M) = ⊤) :\n Function.Injective (B.dualSubmoduleToDual N) := by\n intro x y e\n ext\n apply LinearMap.ker_eq_bot.mp hB.ker_eq_bot\n apply LinearMap.ext_on hN\n intro z hz\n simpa using congr_arg (algebraMap R S) (LinearMap.congr_fun e ⟨z, hz⟩)\n\nlemma dualSubmodule_span_of_basis {ι} [Finite ι] [DecidableEq ι]\n (hB : B.Nondegenerate) (b : Basis ι S M) :\n B.dualSubmodule (Submodule.span R (Set.range b)) =\n Submodule.span R (Set.range <| B.dualBasis hB b) := by\n cases nonempty_fintype ι\n apply le_antisymm\n · intro x hx\n rw [← (B.dualBasis hB b).sum_repr x]\n apply sum_mem\n rintro i -\n obtain ⟨r, hr⟩ := Submodule.mem_one.mp <| hx (b i) (Submodule.subset_span ⟨_, rfl⟩)\n simp only [dualBasis_repr_apply, ← hr, algebraMap_smul]\n apply Submodule.smul_mem\n exact Submodule.subset_span ⟨_, rfl⟩\n · rw [Submodule.span_le]\n rintro _ ⟨i, rfl⟩ y hy\n obtain ⟨f, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun _).mp hy\n simp only [map_sum]\n apply sum_mem\n rintro j -\n rw [← IsScalarTower.algebraMap_smul S (f j), map_smul]\n simp_rw [apply_dualBasis_left]\n rw [smul_eq_mul, mul_ite, mul_one, mul_zero, ← (algebraMap R S).map_zero, ← apply_ite]\n exact Submodule.mem_one.mpr ⟨_, rfl⟩\n\nlemma dualSubmodule_dualSubmodule_flip_of_basis {ι : Type*} [Finite ι]\n (hB : B.Nondegenerate) (b : Basis ι S M) :\n B.dualSubmodule (B.flip.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis _ hB.flip, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis_flip hB]\n\nlemma dualSubmodule_flip_dualSubmodule_of_basis {ι : Type*} [Finite ι]\n (hB : B.Nondegenerate) (b : Basis ι S M) :\n B.flip.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis _ hB.flip,\n dualBasis_flip_dualBasis hB]\n\nTarget:\nlemma dualSubmodule_dualSubmodule_of_basis\n {ι} [Finite ι] (hB : B.Nondegenerate) (hB' : B.IsSymm) (b : Basis ι S M) :\n B.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) :=\n\nProof body:\n","rejected":"by\n exact dualSubmodule_dualSubmodule_of_basis","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"d8bb50efbc19626236e4683d60f8a2264ec66a69a69c266ffbc3cdbb25c76dac","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/BilinearForm","family_id":"dualsubmodule_dualsubmodule_of_basis","file_id":"mathlib/Mathlib/LinearAlgebra/BilinearForm/DualLattice.lean","sample_id":"970944dc1afd0e0eb6c4cb55334bce3e1ad8e6505f9f7729235cd49cf2489634"},"split":"validation"} {"binding":{"chosen_proof_sha256":"7b2cd5f189e96fc3c6ef12149fbbfa2d1c134c7953b7aff3fba3bef5f976115c","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"5e6eb2dab9c66f5a3e012302b6e6bb4bc0e2b813a07952c1556d414e581121cb","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"56519afacc2d5e31a7ff13d1e323f4ff97057c4f9bf2c94c8477e3390f8a82cd","source_sha256":"8b292ad45fd299df1a3eb89f8cf5e64c099eea0affd6d1888191f3d1a85a5932","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ArithmeticFunction.LSeriesSummable_mul (LSeriesSummable_zeta_iff.mpr hs) <|\n LSeriesSummable_of_bounded_of_one_lt_re (m := 1) (fun n hn ↦ ?_) hs\n simpa only [toArithmeticFunction, coe_mk, hn, ↓reduceIte]\n using norm_le_one χ _","hard_negative":true,"metrics":{"chosen_tokens":44,"rejected_tokens":2,"token_jaccard":0.028571,"token_length_ratio":0.045455},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"57ec3d8e4e0742062fa858c395cb4cc1a548c5b33116ce7afd71bc86836e8683","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds\npublic import Mathlib.NumberTheory.Harmonic.ZetaAsymp\npublic import Mathlib.NumberTheory.LSeries.Dirichlet\npublic import Mathlib.NumberTheory.LSeries.DirichletContinuation\npublic import Mathlib.NumberTheory.LSeries.Positivity\n\nNamespace:\nDirichletCharacter\n\nLocal context:\n/-\nCopyright (c) 2024 Michael Stoll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Michael Stoll, David Loeffler\n-/\n/-!\n# The L-function of a Dirichlet character does not vanish on Re(s) ≥ 1\n\nThe main result in this file is `DirichletCharacter.LFunction_ne_zero_of_one_le_re`:\nif `χ` is a Dirichlet character, `s ∈ ℂ` with `1 ≤ s.re`, and either `χ` is nontrivial or `s ≠ 1`,\nthen the L-function of `χ` does not vanish at `s`.\n\nAs a consequence, we have the corresponding statement for the Riemann ζ function:\n`riemannZeta_ne_zero_of_one_le_re` (which does not require `s ≠ 1`, since the junk value at `s = 1`\nhappens to be non-zero).\n\nThese results are prerequisites for the **Prime Number Theorem** and\n**Dirichlet's Theorem** on primes in arithmetic progressions.\n\n## Outline of proofs\n\nWe split into two cases: first, the special case of (non-trivial) quadratic characters at `s = 1`;\nthen the remaining case when either `s ≠ 1` or `χ ^ 2 ≠ 1`.\n\nThe first case is handled using a positivity argument applied to the series `L χ s * ζ s`: we show\nthat this function has non-negative Dirichlet coefficients, is strictly positive for `s ≫ 0`, but\nvanishes at `s = -2`, so it must have a pole somewhere in between.\n\nThe second case is dealt with using the product\n`L(χ^0, 1 + x)^3 L(χ, 1 + x + I * y)^4 L(χ^2, 1 + x + 2 * I * y)`, which\nwe show has absolute value `≥ 1` for all positive `x` and real `y`; if `L(χ, 1 + I * y) = 0` then\nthis product would have to tend to 0 as `x → 0`, which is a contradiction.\n-/\n\n@[expose] public section\n\n/- NB: Many lemmas (and some defs) in this file are private, since they concern properties of\nhypothetical objects which we eventually deduce cannot exist. We have only made public the lemmas\nwhose hypotheses do not turn out to be contradictory.\n-/\n\nopen Complex Asymptotics Topology Filter\nopen ArithmeticFunction hiding log\n\n-- We use the ordering on `ℂ` given by comparing real parts for fixed imaginary part\nopen scoped ComplexOrder\n\nvariable {N : ℕ}\n\nnamespace DirichletCharacter\n\nsection quadratic\n\n/-!\n### Convolution of a Dirichlet character with ζ\n\nWe define `DirichletCharacter.zetaMul χ` to be the arithmetic function obtained by\ntaking the product (as arithmetic functions = Dirichlet convolution) of the\narithmetic function `ζ` with `χ`.\n\nWe then show that for a quadratic character `χ`, this arithmetic function is multiplicative\nand takes nonnegative real values.\n-/\n\n/-- The complex-valued arithmetic function that is the convolution of the constant\nfunction `1` with `χ`. -/\nnoncomputable def zetaMul (χ : DirichletCharacter ℂ N) : ArithmeticFunction ℂ :=\n .zeta * toArithmeticFunction (χ ·)\n\n/-- The arithmetic function `zetaMul χ` is multiplicative. -/\nlemma isMultiplicative_zetaMul (χ : DirichletCharacter ℂ N) : χ.zetaMul.IsMultiplicative :=\n isMultiplicative_zeta.natCast.mul <| isMultiplicative_toArithmeticFunction χ\n\nTarget:\nlemma LSeriesSummable_zetaMul (χ : DirichletCharacter ℂ N) {s : ℂ} (hs : 1 < s.re) :\n LSeriesSummable χ.zetaMul s :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_56519afacc2d","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"612f146d6ffea9cae934d2141347dc2d52fe46b9656dd8a44aa5744626ee7d6b","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"NumberTheory/LSeries","family_id":"lseriessummable_zetamul","file_id":"mathlib/Mathlib/NumberTheory/LSeries/Nonvanishing.lean","sample_id":"56519afacc2d5e31a7ff13d1e323f4ff97057c4f9bf2c94c8477e3390f8a82cd"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d9fbb91c6cf19a5d7c3101a22a9bfd098220cfedac9ba2a5006ac14a37ec6f4a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"08fb894ecd555da7ee112faa67d54af39cc2459f7449128d176d79001c35a1e4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"12c743603b5e36875150136ef6aa3332ac038143c7463314c540e91c3f868901","source_sha256":"e92821624364f083ce763deaa881e12bdd2e9c0d50cfc1279362e04dab3593cf","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨m, hm⟩ := hp\n suffices ∃ a b : A, p ^ m * a + n * b = 1 by\n obtain ⟨a, b, h⟩ := this\n refine .of_mul_eq_one b ?_\n simpa [hm] using h\n refine ⟨(p ^ m).gcdA n, (p ^ m).gcdB n, ?_⟩\n norm_cast\n rw [← Nat.cast_one, ← Int.cast_natCast 1, ← (h.pow_left m).gcd_eq_one, Nat.gcd_eq_gcd_ab]","hard_negative":true,"metrics":{"chosen_tokens":101,"rejected_tokens":3,"token_jaccard":0.020408,"token_length_ratio":0.029703},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"587167666c24297d326a8e5526988529a05ab566e06db3add1db65dfc59f9bea","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.CharP.Invertible\npublic import Mathlib.Data.Finset.NatAntidiagonal\npublic import Mathlib.Data.Nat.Choose.Basic\n\nNamespace:\nIsUnit\n\nLocal context:\n/-\nCopyright (c) 2025 Antoine Chambert-Loir, María Inés de Frutos-Fernández. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Antoine Chambert-Loir, María Inés de Frutos-Fernández\n-/\n/-!\n# Invertibility of factorials\n\nThis file contains lemmas providing sufficient conditions for the cast of `n!` to a (semi)ring `A`\nto be a unit.\n\n-/\n\npublic section\n\nnamespace IsUnit\n\nopen Nat\nsection Semiring\n\nvariable {A : Type*} [Semiring A]\n\ntheorem natCast_factorial_of_le {n : ℕ} (hn_fac : IsUnit (n ! : A))\n {m : ℕ} (hmn : m ≤ n) : IsUnit (m ! : A) := by\n obtain ⟨k, rfl⟩ := exists_add_of_le hmn\n clear hmn\n induction k generalizing m with\n | zero => simpa using hn_fac\n | succ k ih =>\n rw [← add_assoc, add_right_comm] at hn_fac\n have := ih hn_fac\n rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_commute _ _ |>.isUnit_mul_iff] at this\n exact this.2\n\ntheorem natCast_factorial_of_lt {n : ℕ} (hn_fac : IsUnit ((n - 1)! : A))\n {m : ℕ} (hmn : m < n) : IsUnit (m ! : A) :=\n hn_fac.natCast_factorial_of_le <| le_sub_one_of_lt hmn\n\n/-- If `A` is an algebra over a characteristic-zero (semi)field, then `n!` is a unit. -/\ntheorem natCast_factorial_of_algebra (K : Type*) [Semifield K] [CharZero K] [Algebra K A] (n : ℕ) :\n IsUnit (n ! : A) := by\n suffices IsUnit (n ! : K) by\n simpa using this.map (algebraMap K A)\n simp [isUnit_iff_ne_zero, n.factorial_ne_zero]\n\nend Semiring\n\nsection CharP\n\nvariable {A : Type*} [Ring A] (p : ℕ) [Fact (Nat.Prime p)] [CharP A p]\n\ntheorem natCast_factorial_iff_of_charP {n : ℕ} : IsUnit (n ! : A) ↔ n < p := by\n have hp : p.Prime := Fact.out\n induction n with\n | zero => simp [hp.pos]\n | succ n ih =>\n -- TODO: why is `.symm.symm` needed here!?\n rw [factorial_succ, cast_mul, Nat.cast_commute _ _ |>.isUnit_mul_iff, ih.symm.symm,\n ← Nat.add_one_le_iff, CharP.isUnit_natCast_iff hp]\n exact ⟨fun ⟨h1, h2⟩ ↦ lt_of_le_of_ne h2 (mt (· ▸ dvd_rfl) h1),\n fun h ↦ ⟨not_dvd_of_pos_of_lt (Nat.succ_pos _) h, h.le⟩⟩\n\nend CharP\n\nsection Nilpotent\n\nvariable {A : Type*} [CommRing A] {n p : ℕ} (hp : IsNilpotent (p : A))\ninclude hp\n\nTarget:\nlemma natCast_of_isNilpotent_of_coprime (h : p.Coprime n) :\n IsUnit (n : A) :=\n\nProof body:\n","rejected":"by\n exact natCast_of_isNilpotent_of_coprime","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"7f8b22ce700ec3c5da419adaf9ae7c758cc6a4bae98427a8389ec387d14186c4","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Nat","family_id":"natcast_of_isnilpotent_of_coprime","file_id":"mathlib/Mathlib/Data/Nat/Factorial/NatCast.lean","sample_id":"12c743603b5e36875150136ef6aa3332ac038143c7463314c540e91c3f868901"},"split":"validation"} {"binding":{"chosen_proof_sha256":"40625d9f4d5e19cf093a34023a2ebfb722b1326dc7e8a44bd7188d00bdef2d83","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"baef9f3c451e495d26f3d1cd7f38137bc951f99459b9821f931d562f764dcbce","source_sha256":"a5b9fd4ae26ed5eac524a8ce0f4aac28fccd2337d8a28d5e1bf35f99625bb1bd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rcases Module.equiv_directSum_of_isTorsion hM with ⟨ι, _, p, h, e, ⟨l⟩⟩\n haveI : ∀ i : ι, NeZero (p i ^ e i).natAbs := fun i =>\n ⟨Int.natAbs_ne_zero.mpr <| pow_ne_zero (e i) (h i).ne_zero⟩\n haveI : ∀ i : ι, _root_.Finite <| ℤ ⧸ Submodule.span ℤ {p i ^ e i} := fun i =>\n Finite.of_equiv _ (p i ^ e i).quotientSpanEquivZMod.symm.toEquiv\n haveI : _root_.Finite (⨁ i, ℤ ⧸ (Submodule.span ℤ {p i ^ e i} : Submodule ℤ ℤ)) :=\n Finite.of_equiv _ DFinsupp.equivFunOnFintype.symm\n exact Finite.of_equiv _ l.symm.toEquiv","hard_negative":false,"metrics":{"chosen_tokens":158,"rejected_tokens":2,"token_jaccard":0.019231,"token_length_ratio":0.012658},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"5ba2c0407e913c3221e176768bf8077b070a78a8548e707e3f2cdf3979a04b9e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.PID\npublic import Mathlib.Algebra.Group.TypeTags.Finite\npublic import Mathlib.Data.ZMod.QuotientRing\n\nNamespace:\nModule\n\nLocal context:\n/-\nCopyright (c) 2022 Pierre-Alexandre Bazin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Pierre-Alexandre Bazin\n-/\n/-!\n# Structure of finite(ly generated) abelian groups\n\n* `AddCommGroup.equiv_free_prod_directSum_zmod` : Any finitely generated abelian group is the\n product of a power of `ℤ` and a direct sum of some `ZMod (p i ^ e i)` for some prime powers\n `p i ^ e i`.\n* `CommGroup.equiv_free_prod_prod_multiplicative_zmod` is a version for multiplicative groups.\n* `AddCommGroup.equiv_directSum_zmod_of_finite` : Any finite abelian group is a direct sum of\n some `ZMod (p i ^ e i)` for some prime powers `p i ^ e i`.\n* `CommGroup.equiv_prod_multiplicative_zmod_of_finite` is a version for multiplicative groups.\n-/\n\n@[expose] public section\n\nopen scoped DirectSum\n\n/-\nTODO: Here's a more general approach to dropping trivial factors from a direct sum:\n\ndef DirectSum.congr {ι κ : Type*} {α : ι → Type*} {β : κ → Type*} [DecidableEq ι] [DecidableEq κ]\n [∀ i, DecidableEq (α i)] [∀ j, DecidableEq (β j)] [∀ i, AddCommMonoid (α i)]\n [∀ j, AddCommMonoid (β j)] (f : ∀ i, Nontrivial (α i) → κ) (g : ∀ j, Nontrivial (β j) → ι)\n (F : ∀ i hi, α i →+ β (f i hi)) (G : ∀ j hj, β j →+ α (g j hj))\n (hfg : ∀ i hi hj, g (f i hi) hj = i) (hgf : ∀ j hj hi, f (g j hj) hi = j)\n (hFG : ∀ i hi hj a, hfg i hi hj ▸ G _ hj (F i hi a) = a)\n (hGF : ∀ j hj hi b, hgf j hj hi ▸ F _ hi (G j hj b) = b) :\n (⨁ i, α i) ≃+ ⨁ j, β j where\n toFun x := x.sum fun i a ↦ if ha : a = 0 then 0 else DFinsupp.single (f i ⟨a, 0, ha⟩) (F _ _ a)\n invFun y := y.sum fun j b ↦ if hb : b = 0 then 0 else DFinsupp.single (g j ⟨b, 0, hb⟩) (G _ _ b)\n -- The two sorries here are probably doable with the existing machinery, but quite painful\n left_inv x := DFinsupp.ext fun i ↦ sorry\n right_inv y := DFinsupp.ext fun j ↦ sorry\n map_add' x₁ x₂ := by\n dsimp\n refine DFinsupp.sum_add_index (by simp) fun i a₁ a₂ ↦ ?_\n split_ifs\n any_goals simp_all\n rw [← DFinsupp.single_add, ← map_add, ‹a₁ + a₂ = 0›, map_zero, DFinsupp.single_zero]\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.congr\n (fun i _ ↦ i)\n (fun j hj ↦ ⟨j, fun h ↦ by simp [h, pow_zero, zmod_nontrivial] at hj⟩)\n (fun i _ ↦ AddMonoidHom.id _)\n (fun j _ ↦ AddMonoidHom.id _)\n (fun i hi hj ↦ rfl)\n (fun j hj hi ↦ rfl)\n (fun i hi hj a ↦ rfl)\n (fun j hj hi a ↦ rfl)\n-/\n\nprivate def directSumNeZeroMulHom {ι : Type} [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) →+ ⨁ i, ZMod (p i ^ n i) :=\n DirectSum.toAddMonoid fun i ↦ DirectSum.of (fun i ↦ ZMod (p i ^ n i)) i\n\nprivate def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :\n (⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) where\n toFun := directSumNeZeroMulHom p n\n invFun := DirectSum.toAddMonoid fun i ↦\n if h : n i = 0 then 0 else DirectSum.of (fun j : {i // n i ≠ 0} ↦ ZMod (p j ^ n j)) ⟨i, h⟩\n left_inv x := by\n induction x using DirectSum.induction_on with\n | zero => simp\n | of i x =>\n rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of, DirectSum.toAddMonoid_of,\n dif_neg i.prop]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n right_inv x := by\n induction x using DirectSum.induction_on with\n | zero => rw [map_zero, map_zero]\n | of i x =>\n rw [DirectSum.toAddMonoid_of]\n split_ifs with h\n · simp [(ZMod.subsingleton_iff.2 <| by rw [h, pow_zero]).elim x 0]\n · simp_rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of]\n | add x y hx hy => rw [map_add, map_add, hx, hy]\n map_add' := map_add (directSumNeZeroMulHom p n)\n\nuniverse u\n\nnamespace Module\n\nvariable (M : Type u)\n\nTarget:\ntheorem finite_of_fg_torsion [AddCommGroup M] [Module ℤ M] [Module.Finite ℤ M]\n (hM : Module.IsTorsion ℤ M) : _root_.Finite M :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/FiniteAbelian","family_id":"finite_of_fg_torsion","file_id":"mathlib/Mathlib/GroupTheory/FiniteAbelian/Basic.lean","sample_id":"baef9f3c451e495d26f3d1cd7f38137bc951f99459b9821f931d562f764dcbce"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3ec32b9923c396411fc7331af67fe6487d8a0df4c759f04b5d8ad92f87c6243d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"760fe1c7d47cdad6b2200c5e2a14bfb8fb79a00ce22d06653d4add4ff8342421","source_sha256":"881ac4e04220671a354c0ff67112160cf9fcb67e5dd46f3a36a0eeb47ad8a23f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨fun _ ↦ ⟨F.ringFilterBasis, rfl⟩, fun ⟨B, hB⟩ ↦ ⟨fun {I} hI a ↦ ?_⟩⟩\n obtain ⟨V, hbasis, hsub⟩ := B.mul_right a (U := I) (hB.ge (by simpa))\n obtain ⟨J, hJ, rfl⟩ := hB.le hbasis\n exact Order.PFilter.mem_of_le (fun x hx ↦ by simpa using (hsub hx)) hJ","hard_negative":true,"metrics":{"chosen_tokens":93,"rejected_tokens":8,"token_jaccard":0.043478,"token_length_ratio":0.086022},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"60c96ce2e78eb5001d22008a82917b42b10de3b72206232e81a581cbda037d61","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.IdealFilter.Basic\npublic import Mathlib.Topology.Algebra.LinearTopology\npublic import Mathlib.Topology.Algebra.FilterBasis\n\nNamespace:\nIdealFilter\n\nLocal context:\n/-\nCopyright (c) 2025 Blake Farman. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Blake Farman\n-/\n/-!\n# Topologies associated to ideal filters\n\nThis file constructs topological structures on a ring from an `IdealFilter` and characterizes\nuniform ideal filters in terms of ring filter bases.\n\n## Main definitions\n* `WithIdealFilter`: Type synonym for a ring that depends on a choice of ideal filter. This can be\n used to assign and infer instances on a ring that depend on an ideal filter.\n* `IdealFilter.addGroupFilterBasis`: the `AddGroupFilterBasis` with sets the ideals of `F`.\n* `IdealFilter.ringFilterBasis`: under `[F.IsUniform]`, the `RingFilterBasis` with sets the ideals\n of `F`.\n\n## Main statements\n\n* `IdealFilter.isUniform_iff_exists_ringFilterBasis`: An `IdealFilter` on a ring `A` is uniform if\n and only if its ideals form a `RingFilterBasis` for `A`.\n\n## References\n\n* [nLab: Uniform filter](https://ncatlab.org/nlab/show/uniform+filter)\n\n## Tags\n\nring theory, ideal, filter, linear topology\n-/\n\n@[expose] public section\n\nopen scoped Pointwise Topology\n\nnamespace IdealFilter\n\n/-- The additive-group filter basis whose sets are the ideals belonging to the ideal filter `F`. -/\n@[implicit_reducible]\ndef addGroupFilterBasis {A : Type*} [Ring A] (F : IdealFilter A) : AddGroupFilterBasis A where\n sets := {(I : Set A) | I ∈ F}\n nonempty := ⟨_, ⟨_, F.nonempty.choose_spec, rfl⟩⟩\n inter_sets := by\n rintro s t ⟨I, hI, rfl⟩ ⟨J, hJ, rfl⟩\n exact ⟨I ⊓ J, ⟨I ⊓ J, Order.PFilter.inf_mem hI hJ, rfl⟩, fun _ h ↦ h⟩\n zero' := by aesop\n add' := by aesop\n neg' := by aesop\n conj' := by aesop\n\n/-- Under `[F.IsUniform]`, the ring filter basis obtained from `addGroupFilterBasis`. -/\n@[simps! -isSimp sets, implicit_reducible]\ndef ringFilterBasis {A : Type*} [Ring A] {F : IdealFilter A} [F.IsUniform] :\n RingFilterBasis A where\n __ := F.addGroupFilterBasis\n mul' := by\n rintro U ⟨I, hI, rfl⟩\n exact ⟨I, ⟨I, hI, rfl⟩, Set.mul_subset_iff.mpr fun _ h₁ _ h₂ ↦ mul_mem h₁ h₂⟩\n mul_left' := by\n rintro x₀ U ⟨I, hI, rfl⟩\n exact ⟨I, ⟨I, hI, rfl⟩, fun a ha ↦ Ideal.mul_mem_left I x₀ ha⟩\n mul_right' := by\n rintro x₀ U ⟨I, hI, rfl⟩\n refine ⟨I.colon {x₀}, ⟨I.colon {x₀}, IsUniform.colon_mem hI x₀, rfl⟩,\n fun a ha ↦ Set.mem_preimage.mpr (Submodule.mem_colon_singleton.mp ha)⟩\n\n/-- An `IdealFilter` on a ring `A` is uniform if and only if its ideals form a `RingFilterBasis`\nfor `A`. -/\n\nTarget:\ntheorem isUniform_iff_exists_ringFilterBasis {A : Type*} [Ring A] {F : IdealFilter A} :\n F.IsUniform ↔ ∃ B : RingFilterBasis A, B.sets = {(I : Set A) | I ∈ F} :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"9475e3095c2bbf41966926bffcb5e547a9172133ec9db76bbe455cdc18a9d482","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/IdealFilter","family_id":"isuniform_iff_exists_ringfilterbasis","file_id":"mathlib/Mathlib/RingTheory/IdealFilter/Topology.lean","sample_id":"760fe1c7d47cdad6b2200c5e2a14bfb8fb79a00ce22d06653d4add4ff8342421"},"split":"validation"} {"binding":{"chosen_proof_sha256":"cf5b01726404f68401d774f6cc71a346cea9861f63ade813243cdf554437b1c2","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d39e27c5da6b9455030f6e2ddf71c0baeda0371c50ea57ee2c4fc4bafb382136","source_sha256":"40b3fe35a4f6ee6eaf5570fa9a5773e90967e90bbd65a7f661f7a527d47b82ae","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [BiTotal, leftTotal_empty, rightTotal_iff_isEmpty_right, true_and]","hard_negative":false,"metrics":{"chosen_tokens":12,"rejected_tokens":2,"token_jaccard":0.090909,"token_length_ratio":0.166667},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"61764b702c16b8d762f234307571b7d59b49f7f165e38b0a96e81a15a34ae017","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Logic.Function.Basic\npublic import Mathlib.Logic.IsEmpty.Defs\npublic import Mathlib.Logic.Relator\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Floris van Doorn. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Floris van Doorn\n-/\n/-!\nIn this file we prove some basic properties about the typeclass `IsEmpty`.\n-/\n\npublic section\n\nvariable {α β γ : Sort*}\n\n@[simp, push]\ntheorem not_nonempty_iff : ¬Nonempty α ↔ IsEmpty α :=\n ⟨fun h ↦ ⟨fun x ↦ h ⟨x⟩⟩, fun h1 h2 ↦ h2.elim h1.elim⟩\n\n@[simp, push]\ntheorem not_isEmpty_iff : ¬IsEmpty α ↔ Nonempty α :=\n not_iff_comm.mp not_nonempty_iff\n\n@[simp]\ntheorem isEmpty_Prop {p : Prop} : IsEmpty p ↔ ¬p := by\n simp only [← not_nonempty_iff, nonempty_prop]\n\n@[simp]\ntheorem isEmpty_pi {π : α → Sort*} : IsEmpty (∀ a, π a) ↔ ∃ a, IsEmpty (π a) := by\n simp only [← not_nonempty_iff, Classical.nonempty_pi, not_forall]\n\ntheorem isEmpty_fun : IsEmpty (α → β) ↔ Nonempty α ∧ IsEmpty β := by\n rw [isEmpty_pi, ← exists_true_iff_nonempty, ← exists_and_right, true_and]\n\n@[simp]\ntheorem nonempty_fun : Nonempty (α → β) ↔ IsEmpty α ∨ Nonempty β :=\n not_iff_not.mp <| by rw [not_or, not_nonempty_iff, not_nonempty_iff, isEmpty_fun, not_isEmpty_iff]\n\n@[simp]\ntheorem isEmpty_sigma {α} {E : α → Type*} : IsEmpty (Sigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_sigma, not_exists]\n\n@[simp]\ntheorem isEmpty_psigma {α} {E : α → Sort*} : IsEmpty (PSigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_psigma, not_exists]\n\ntheorem isEmpty_subtype (p : α → Prop) : IsEmpty (Subtype p) ↔ ∀ x, ¬p x := by\n simp only [← not_nonempty_iff, nonempty_subtype, not_exists]\n\n@[simp]\ntheorem isEmpty_prod {α β : Type*} : IsEmpty (α × β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_prod, not_and_or]\n\n@[simp]\ntheorem isEmpty_pprod : IsEmpty (PProd α β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_pprod, not_and_or]\n\n@[simp]\ntheorem isEmpty_sum {α β} : IsEmpty (α ⊕ β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_sum, not_or]\n\n@[simp]\ntheorem isEmpty_psum {α β} : IsEmpty (α ⊕' β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_psum, not_or]\n\n@[simp]\ntheorem isEmpty_ulift {α} : IsEmpty (ULift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_ulift]\n\n@[simp]\ntheorem isEmpty_plift {α} : IsEmpty (PLift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_plift]\n\ntheorem wellFounded_of_isEmpty {α} [IsEmpty α] (r : α → α → Prop) : WellFounded r :=\n ⟨isEmptyElim⟩\n\nvariable (α)\n\ntheorem isEmpty_or_nonempty : IsEmpty α ∨ Nonempty α :=\n (em <| IsEmpty α).elim Or.inl <| Or.inr ∘ not_isEmpty_iff.mp\n\n@[simp]\ntheorem not_isEmpty_of_nonempty [h : Nonempty α] : ¬IsEmpty α :=\n not_isEmpty_iff.mpr h\n\nvariable {α}\n\ntheorem Function.extend_of_isEmpty [IsEmpty α] (f : α → β) (g : α → γ) (h : β → γ) :\n Function.extend f g h = h :=\n funext fun _ ↦ (Function.extend_apply' _ _ _) fun ⟨a, _⟩ ↦ isEmptyElim a\n\nopen Relator\n\nvariable {α β : Type*} (R : α → β → Prop)\n\n@[simp]\ntheorem leftTotal_empty [IsEmpty α] : LeftTotal R := by\n simp only [LeftTotal, IsEmpty.forall_iff]\n\ntheorem leftTotal_iff_isEmpty_left [IsEmpty β] : LeftTotal R ↔ IsEmpty α := by\n simp only [LeftTotal, IsEmpty.exists_iff, isEmpty_iff]\n\n@[simp]\ntheorem rightTotal_empty [IsEmpty β] : RightTotal R := by\n simp only [RightTotal, IsEmpty.forall_iff]\n\ntheorem rightTotal_iff_isEmpty_right [IsEmpty α] : RightTotal R ↔ IsEmpty β := by\n simp only [RightTotal, IsEmpty.exists_iff, isEmpty_iff]\n\n@[simp]\ntheorem biTotal_empty [IsEmpty α] [IsEmpty β] : BiTotal R :=\n ⟨leftTotal_empty R, rightTotal_empty R⟩\n\nTarget:\ntheorem biTotal_iff_isEmpty_right [IsEmpty α] : BiTotal R ↔ IsEmpty β :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Logic/IsEmpty","family_id":"bitotal_iff_isempty_right","file_id":"mathlib/Mathlib/Logic/IsEmpty/Basic.lean","sample_id":"d39e27c5da6b9455030f6e2ddf71c0baeda0371c50ea57ee2c4fc4bafb382136"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d17056e186bd79690508d18b6329d6c92ea961f832d0039698b9d039eb61df32","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"037105a9185d2ca0fdabf9757094f361dead96d5e688d56f64a1c2e0e30938cf","source_sha256":"b5ead3699b586fdde3d03deabff500efd9a58e49d2069d0a294c0b57a2c4dc0d","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← pow_smul_eq_iff_period_dvd, Monoid.pow_exponent_eq_one, one_smul]","hard_negative":false,"metrics":{"chosen_tokens":12,"rejected_tokens":2,"token_jaccard":0.083333,"token_length_ratio":0.166667},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"62f34e25e58f01aaff1af822190f565fa49087524fffdbf617a4bee0b5565a8e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Dynamics.PeriodicPts.Lemmas\npublic import Mathlib.GroupTheory.Exponent\npublic import Mathlib.GroupTheory.GroupAction.Basic\n\nNamespace:\nMulAction\n\nLocal context:\n/-\nCopyright (c) 2024 Emilie Burgun. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Emilie Burgun\n-/\n/-!\n# Period of a group action\n\nThis module defines some helpful lemmas around [`MulAction.period`] and [`AddAction.period`].\nThe period of a point `a` by a group element `g` is the smallest `m` such that `g ^ m • a = a`\n(resp. `(m • g) +ᵥ a = a`) for a given `g : G` and `a : α`.\n\nIf such an `m` does not exist,\nthen by convention `MulAction.period` and `AddAction.period` return 0.\n-/\n\npublic section\n\nnamespace MulAction\n\nuniverse u v\nvariable {α : Type v}\nvariable {G : Type u} [Group G] [MulAction G α]\nvariable {M : Type u} [Monoid M] [MulAction M α]\n\n/-- If the action is periodic, then a lower bound for its period can be computed. -/\n@[to_additive /-- If the action is periodic, then a lower bound for its period can be computed. -/]\ntheorem le_period {m : M} {a : α} {n : ℕ} (period_pos : 0 < period m a)\n (moved : ∀ k, 0 < k → k < n → m ^ k • a ≠ a) : n ≤ period m a :=\n le_of_not_gt fun period_lt_n =>\n moved _ period_pos period_lt_n <| pow_period_smul m a\n\n/-- If for some `n`, `m ^ n • a = a`, then `period m a ≤ n`. -/\n@[to_additive /-- If for some `n`, `(n • m) +ᵥ a = a`, then `period m a ≤ n`. -/]\ntheorem period_le_of_fixed {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (fixed : m ^ n • a = a) :\n period m a ≤ n :=\n (isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_le n_pos\n\n/-- If for some `n`, `m ^ n • a = a`, then `0 < period m a`. -/\n@[to_additive /-- If for some `n`, `(n • m) +ᵥ a = a`, then `0 < period m a`. -/]\ntheorem period_pos_of_fixed {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (fixed : m ^ n • a = a) :\n 0 < period m a :=\n (isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_pos n_pos\n\n@[to_additive]\ntheorem period_eq_one_iff {m : M} {a : α} : period m a = 1 ↔ m • a = a :=\n ⟨fun eq_one => pow_one m ▸ eq_one ▸ pow_period_smul m a,\n fun fixed => le_antisymm\n (period_le_of_fixed one_pos (by simpa))\n (period_pos_of_fixed one_pos (by simpa))⟩\n\n/-- For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `m ^ n`. -/\n@[to_additive\n/-- For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `n • m`. -/]\ntheorem pow_smul_ne_of_lt_period {m : M} {a : α} {n : ℕ} (n_pos : 0 < n)\n (n_lt_period : n < period m a) : m ^ n • a ≠ a := fun a_fixed =>\n not_le_of_gt n_lt_period <| period_le_of_fixed n_pos a_fixed\n\nsection Identities\n\n/-! ### `MulAction.period` for common group elements\n-/\n\nvariable (M) in\n@[to_additive (attr := simp)]\ntheorem period_one (a : α) : period (1 : M) a = 1 := period_eq_one_iff.mpr (one_smul M a)\n\n@[to_additive (attr := simp)]\ntheorem period_inv (g : G) (a : α) : period g⁻¹ a = period g a := by\n simp only [period_eq_minimalPeriod, Function.minimalPeriod_eq_minimalPeriod_iff,\n isPeriodicPt_smul_iff]\n intro n\n rw [smul_eq_iff_eq_inv_smul, eq_comm, ← zpow_natCast, inv_zpow, inv_inv, zpow_natCast]\n\nend Identities\n\nsection MonoidExponent\n\n/-! ### `MulAction.period` and group exponents\n\nThe period of a given element `m : M` can be bounded by the `Monoid.exponent M` or `orderOf m`.\n-/\n\n@[to_additive]\ntheorem period_dvd_orderOf (m : M) (a : α) : period m a ∣ orderOf m := by\n rw [← pow_smul_eq_iff_period_dvd, pow_orderOf_eq_one, one_smul]\n\n@[to_additive]\ntheorem period_pos_of_orderOf_pos {m : M} (order_pos : 0 < orderOf m) (a : α) :\n 0 < period m a :=\n Nat.pos_of_dvd_of_pos (period_dvd_orderOf m a) order_pos\n\n@[to_additive]\ntheorem period_le_orderOf {m : M} (order_pos : 0 < orderOf m) (a : α) :\n period m a ≤ orderOf m :=\n Nat.le_of_dvd order_pos (period_dvd_orderOf m a)\n\n@[to_additive]\n\nTarget:\ntheorem period_dvd_exponent (m : M) (a : α) : period m a ∣ Monoid.exponent M :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/GroupAction","family_id":"period_dvd_exponent","file_id":"mathlib/Mathlib/GroupTheory/GroupAction/Period.lean","sample_id":"037105a9185d2ca0fdabf9757094f361dead96d5e688d56f64a1c2e0e30938cf"},"split":"validation"} {"binding":{"chosen_proof_sha256":"35fb3e5225b5ae3bcc5f024a70671c5bc50fd8637e443747459aa51529cbdfba","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"94251131d492c314cdbc294716303f425a61469b40de26ba17d17e79868bf204","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"73672596677ce937c3dfceeee8632043e3afb7312baf0799c4172ab87d016c2b","source_sha256":"15f4267aebdd955e889db0e8eeeb1b1b795e84a4db28bdd55809c3f802e3c9e1","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa only [hom_ext_iff, comp_f] using P.idem","hard_negative":false,"metrics":{"chosen_tokens":12,"rejected_tokens":19,"token_jaccard":0.857143,"token_length_ratio":1.583333},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"64bba812c0a9b919cf9d25850e0f4f72211a46c02e7636af405276c250f65fa1","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Idempotents.Karoubi\n\nNamespace:\nCategoryTheory.Idempotents.KaroubiKaroubi\n\nLocal context:\n/-\nCopyright (c) 2022 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n/-!\n# Idempotence of the Karoubi envelope\n\nIn this file, we construct the equivalence of categories\n`KaroubiKaroubi.equivalence C : Karoubi C ≌ Karoubi (Karoubi C)` for any category `C`.\n\n-/\n\n@[expose] public section\n\n\nopen CategoryTheory.Category\n\nopen CategoryTheory.Idempotents.Karoubi\n\nnamespace CategoryTheory\n\nnamespace Idempotents\n\nnamespace KaroubiKaroubi\n\nvariable (C : Type*) [Category* C]\n\n@[reassoc (attr := simp)]\n\nTarget:\nlemma idem_f (P : Karoubi (Karoubi C)) : P.p.f ≫ P.p.f = P.p.f :=\n\nProof body:\n","rejected":"```lean\nby\n simpa only [hom_ext_iff, comp_f] using P.idem\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Idempotents","family_id":"idem_f","file_id":"mathlib/Mathlib/CategoryTheory/Idempotents/KaroubiKaroubi.lean","sample_id":"73672596677ce937c3dfceeee8632043e3afb7312baf0799c4172ab87d016c2b"},"split":"validation"} {"binding":{"chosen_proof_sha256":"43eac99e6ff24deb0ba10140dd3aec655d975a7a41be8091f0170271beadb564","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8bb499a671c32e380f5df66c53b463bdf8374724765f939c60ac58a4b60f1cfd","source_sha256":"ba496f1ae5e19ce25b587823e7f362d29c16e3b0a774157842c947dfc9e38545","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_rw [(neg_sub _ x).symm, isNilpotent_neg_iff]\n refine existsUnique_of_exists_of_unique ?_ fun r₁ r₂ ⟨hr₁, hr₁'⟩ ⟨hr₂, hr₂'⟩ ↦ ?_\n · -- Existence\n obtain ⟨n, hn⟩ := id h\n refine ⟨P.newtonMap^[n] x, isNilpotent_iterate_newtonMap_sub_of_isNilpotent h n, ?_⟩\n rw [← zero_dvd_iff, ← pow_eq_zero_of_le (n.lt_two_pow_self).le hn]\n exact aeval_pow_two_pow_dvd_aeval_iterate_newtonMap h h' n\n · -- Uniqueness\n have ⟨u, hu⟩ := binomExpansion (P.map (algebraMap R S)) r₁ (r₂ - r₁)\n suffices IsUnit (aeval r₁ (derivative P) + u * (r₂ - r₁)) by\n rwa [derivative_map, eval_map_algebraMap, eval_map_algebraMap, eval_map_algebraMap,\n add_sub_cancel, hr₂', hr₁', zero_add, pow_two, ← mul_assoc, ← add_mul, eq_comm,\n this.mul_right_eq_zero, sub_eq_zero, eq_comm] at hu\n have : IsUnit (aeval r₁ (derivative P)) :=\n isUnit_aeval_of_isUnit_aeval_of_isNilpotent_sub h' hr₁\n rw [← sub_sub_sub_cancel_right r₂ r₁ x]\n refine IsNilpotent.isUnit_add_left_of_commute ?_ this (Commute.all _ _)\n exact (Commute.all _ _).isNilpotent_mul_left <| (Commute.all _ _).isNilpotent_sub hr₂ hr₁","hard_negative":false,"metrics":{"chosen_tokens":254,"rejected_tokens":2,"token_jaccard":0.011494,"token_length_ratio":0.007874},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"663678be4dcf65650cf2b68846f4ca948b62a7ed2eefe0db531a15d19e9573cd","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Polynomial.Nilpotent\n\nNamespace:\nPolynomial\n\nLocal context:\n/-\nCopyright (c) 2024 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Antoine Chambert-Loir, Oliver Nash\n-/\n/-!\n# Newton-Raphson method\n\nGiven a single-variable polynomial `P` with derivative `P'`, Newton's method concerns iteration of\nthe rational map: `x ↦ x - P(x) / P'(x)`.\n\nOver a field, it can serve as a root-finding algorithm. It is also useful in proving results such\nas Hensel's lemma and the Jordan-Chevalley decomposition.\n\n## Main definitions / results:\n\n* `Polynomial.newtonMap`: the map `x ↦ x - P(x) / P'(x)`, where `P'` is the derivative of the\n polynomial `P`.\n* `Polynomial.isFixedPt_newtonMap_of_isUnit_iff`: `x` is a fixed point for Newton iteration iff\n it is a root of `P` (provided `P'(x)` is a unit).\n* `Polynomial.existsUnique_nilpotent_sub_and_aeval_eq_zero`: if `x` is almost a root of `P` in the\n sense that `P(x)` is nilpotent (and `P'(x)` is a unit) then we may write `x` as a sum\n `x = n + r` where `n` is nilpotent and `r` is a root of `P`. This can be used to prove the\n Jordan-Chevalley decomposition of linear endomorphisms.\n\n-/\n\n@[expose] public section\n\nopen Set Function\n\nnoncomputable section\n\nnamespace Polynomial\n\nvariable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] (P : R[X]) {x : S}\n\n/-- Given a single-variable polynomial `P` with derivative `P'`, this is the map:\n`x ↦ x - P(x) / P'(x)`. When `P'(x)` is not a unit we use a junk-value pattern and send `x ↦ x`. -/\ndef newtonMap (x : S) : S :=\n x - (Ring.inverse <| aeval x (derivative P)) * aeval x P\n\ntheorem newtonMap_apply :\n P.newtonMap x = x - (Ring.inverse <| aeval x (derivative P)) * (aeval x P) :=\n rfl\n\nvariable {P}\n\ntheorem newtonMap_apply_of_isUnit (h : IsUnit <| aeval x (derivative P)) :\n P.newtonMap x = x - h.unit⁻¹ * aeval x P := by\n simp [newtonMap_apply, Ring.inverse, h]\n\ntheorem newtonMap_apply_of_not_isUnit (h : ¬ (IsUnit <| aeval x (derivative P))) :\n P.newtonMap x = x := by\n simp [newtonMap_apply, Ring.inverse, h]\n\ntheorem isNilpotent_iterate_newtonMap_sub_of_isNilpotent (h : IsNilpotent <| aeval x P) (n : ℕ) :\n IsNilpotent <| P.newtonMap^[n] x - x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [iterate_succ', comp_apply, newtonMap_apply, sub_right_comm]\n refine (Commute.all _ _).isNilpotent_sub ih <| (Commute.all _ _).isNilpotent_mul_left ?_\n simpa using Commute.isNilpotent_add (Commute.all _ _)\n (isNilpotent_aeval_sub_of_isNilpotent_sub P ih) h\n\ntheorem isFixedPt_newtonMap_of_aeval_eq_zero (h : aeval x P = 0) :\n IsFixedPt P.newtonMap x := by\n rw [IsFixedPt, newtonMap_apply, h, mul_zero, sub_zero]\n\ntheorem isFixedPt_newtonMap_of_isUnit_iff (h : IsUnit <| aeval x (derivative P)) :\n IsFixedPt P.newtonMap x ↔ aeval x P = 0 := by\n rw [IsFixedPt, newtonMap_apply, sub_eq_self, Ring.inverse_mul_eq_iff_eq_mul _ _ _ h, mul_zero]\n\n/-- This is really an auxiliary result, en route to\n`Polynomial.existsUnique_nilpotent_sub_and_aeval_eq_zero`. -/\ntheorem aeval_pow_two_pow_dvd_aeval_iterate_newtonMap\n (h : IsNilpotent (aeval x P)) (h' : IsUnit (aeval x <| derivative P)) (n : ℕ) :\n (aeval x P) ^ (2 ^ n) ∣ aeval (P.newtonMap^[n] x) P := by\n induction n with\n | zero => simp\n | succ n ih =>\n have ⟨d, hd⟩ := binomExpansion (P.map (algebraMap R S)) (P.newtonMap^[n] x)\n (-Ring.inverse (aeval (P.newtonMap^[n] x) <| derivative P) * aeval (P.newtonMap^[n] x) P)\n rw [eval_map_algebraMap, eval_map_algebraMap] at hd\n rw [iterate_succ', comp_apply, newtonMap_apply, sub_eq_add_neg, neg_mul_eq_neg_mul, hd]\n refine dvd_add ?_ (dvd_mul_of_dvd_right ?_ _)\n · convert! dvd_zero _\n have : IsUnit (aeval (P.newtonMap^[n] x) <| derivative P) :=\n isUnit_aeval_of_isUnit_aeval_of_isNilpotent_sub h' <|\n isNilpotent_iterate_newtonMap_sub_of_isNilpotent h n\n rw [derivative_map, eval_map_algebraMap, ← mul_assoc, mul_neg, Ring.mul_inverse_cancel _ this,\n neg_mul, one_mul, add_neg_cancel]\n · rw [neg_mul, even_two.neg_pow, mul_pow, pow_succ, pow_mul]\n exact dvd_mul_of_dvd_right (pow_dvd_pow_of_dvd ih 2) _\n\n/-- If `x` is almost a root of `P` in the sense that `P(x)` is nilpotent (and `P'(x)` is a\nunit) then we may write `x` as a sum `x = n + r` where `n` is nilpotent and `r` is a root of `P`.\nMoreover, `n` and `r` are unique.\n\nThis can be used to prove the Jordan-Chevalley decomposition of linear endomorphisms. -/\n\nTarget:\ntheorem existsUnique_nilpotent_sub_and_aeval_eq_zero\n (h : IsNilpotent (aeval x P)) (h' : IsUnit (aeval x <| derivative P)) :\n ∃! r, IsNilpotent (x - r) ∧ aeval r P = 0 :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Dynamics","family_id":"existsunique_nilpotent_sub_and_aeval_eq_zero","file_id":"mathlib/Mathlib/Dynamics/Newton.lean","sample_id":"8bb499a671c32e380f5df66c53b463bdf8374724765f939c60ac58a4b60f1cfd"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8f91837b0f741684782f03ea72ade4773b8cba68773efaed8c9a404060c04662","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"04e30d75a20649a4e8af1e3fb2c4664deed6136b7d405220d3f62537dac223d3","source_sha256":"fee0a2b95796c84709e51646b2725c39adb38b453000ce9df0ea97a95ddddeaf","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_rw [scalar_apply, ← smul_eq_diagonal_mul, ← op_smul_eq_mul_diagonal]","hard_negative":false,"metrics":{"chosen_tokens":11,"rejected_tokens":2,"token_jaccard":0.1,"token_length_ratio":0.181818},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"67c8e4e15485be97f6b9ee2937520a2c7bca39d238f10a51d70ca5bc0667f09d","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Opposite\npublic import Mathlib.Algebra.Algebra.Pi\npublic import Mathlib.Algebra.BigOperators.RingEquiv\npublic import Mathlib.Data.Finite.Prod\npublic import Mathlib.Data.Matrix.Mul\npublic import Mathlib.LinearAlgebra.Pi\npublic import Mathlib.GroupTheory.DedekindFinite\n\nNamespace:\nMatrix\n\nLocal context:\n/-\nCopyright (c) 2018 Ellen Arlt. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Ellen Arlt, Blair Shi, Sean Leather, Mario Carneiro, Johan Commelin, Lu-Ming Zhang\n-/\n/-!\n# Matrices\n\nThis file contains basic results on matrices including bundled versions of matrix operators.\n\n## Implementation notes\n\nFor convenience, `Matrix m n α` is defined as `m → n → α`, as this allows elements of the matrix\nto be accessed with `A i j`. However, it is not advisable to _construct_ matrices using terms of the\nform `fun i j ↦ _` or even `(fun i j ↦ _ : Matrix m n α)`, as these are not recognized by Lean\nas having the right type. Instead, `Matrix.of` should be used.\n\n## TODO\n\nUnder various conditions, multiplication of infinite matrices makes sense.\nThese have not yet been implemented.\n-/\n\n@[expose] public section\n\nassert_not_exists TrivialStar\n\nuniverse u u' v w\n\nvariable {l m n o : Type*} {m' : o → Type*} {n' : o → Type*}\nvariable {R S T A α β γ : Type*}\n\nnamespace Matrix\n\ninstance decidableEq [DecidableEq α] [Fintype m] [Fintype n] : DecidableEq (Matrix m n α) :=\n Fintype.decidablePiFintype\n\ninstance {n m} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] (α) [Fintype α] :\n Fintype (Matrix m n α) := inferInstanceAs (Fintype (m → n → α))\n\ninstance {n m} [Finite m] [Finite n] (α) [Finite α] :\n Finite (Matrix m n α) := inferInstanceAs (Finite (m → n → α))\n\ninstance (priority := low) [Semiring α] [Finite α] : IsStablyFiniteRing α := ⟨inferInstance⟩\n\nsection\nvariable (R)\n\n/-- This is `Matrix.of` bundled as a linear equivalence. -/\ndef ofLinearEquiv [Semiring R] [AddCommMonoid α] [Module R α] : (m → n → α) ≃ₗ[R] Matrix m n α where\n __ := ofAddEquiv\n map_smul' _ _ := rfl\n\n@[simp] lemma coe_ofLinearEquiv [Semiring R] [AddCommMonoid α] [Module R α] :\n ⇑(ofLinearEquiv _ : (m → n → α) ≃ₗ[R] Matrix m n α) = of := rfl\n@[simp] lemma coe_ofLinearEquiv_symm [Semiring R] [AddCommMonoid α] [Module R α] :\n ⇑((ofLinearEquiv _).symm : Matrix m n α ≃ₗ[R] (m → n → α)) = of.symm := rfl\n\nend\n\ntheorem sum_apply [AddCommMonoid α] (i : m) (j : n) (s : Finset β) (g : β → Matrix m n α) :\n (∑ c ∈ s, g c) i j = ∑ c ∈ s, g c i j :=\n (congr_fun (s.sum_apply i g) j).trans (s.sum_apply j _)\n\nend Matrix\n\nopen Matrix\n\nnamespace Matrix\n\nsection Diagonal\n\nvariable [DecidableEq n]\n\nvariable (n α)\n\n/-- `Matrix.diagonal` as an `AddMonoidHom`. -/\n@[simps]\ndef diagonalAddMonoidHom [AddZeroClass α] : (n → α) →+ Matrix n n α where\n toFun := diagonal\n map_zero' := diagonal_zero\n map_add' x y := (diagonal_add x y).symm\n\nvariable (R)\n\n/-- `Matrix.diagonal` as a `LinearMap`. -/\n@[simps]\ndef diagonalLinearMap [Semiring R] [AddCommMonoid α] [Module R α] : (n → α) →ₗ[R] Matrix n n α :=\n { diagonalAddMonoidHom n α with map_smul' := diagonal_smul }\n\nvariable {n α R}\n\nsection One\n\nvariable [Zero α] [One α]\n\nlemma zero_le_one_elem [Preorder α] [ZeroLEOneClass α] (i j : n) :\n 0 ≤ (1 : Matrix n n α) i j := by\n by_cases hi : i = j\n · subst hi\n simp\n · simp [hi]\n\nlemma zero_le_one_row [Preorder α] [ZeroLEOneClass α] (i : n) :\n 0 ≤ (1 : Matrix n n α) i :=\n zero_le_one_elem i\n\nend One\n\nend Diagonal\n\nsection Diag\n\nvariable (n α)\n\n/-- `Matrix.diag` as an `AddMonoidHom`. -/\n@[simps]\ndef diagAddMonoidHom [AddZeroClass α] : Matrix n n α →+ n → α where\n toFun := diag\n map_zero' := diag_zero\n map_add' := diag_add\n\nvariable (R)\n\n/-- `Matrix.diag` as a `LinearMap`. -/\n@[simps]\ndef diagLinearMap [Semiring R] [AddCommMonoid α] [Module R α] : Matrix n n α →ₗ[R] n → α :=\n { diagAddMonoidHom n α with map_smul' := diag_smul }\n\nvariable {n α R}\n\n@[simp]\ntheorem diag_list_sum [AddMonoid α] (l : List (Matrix n n α)) : diag l.sum = (l.map diag).sum :=\n map_list_sum (diagAddMonoidHom n α) l\n\n@[simp]\ntheorem diag_multiset_sum [AddCommMonoid α] (s : Multiset (Matrix n n α)) :\n diag s.sum = (s.map diag).sum :=\n map_multiset_sum (diagAddMonoidHom n α) s\n\n@[simp]\ntheorem diag_sum {ι} [AddCommMonoid α] (s : Finset ι) (f : ι → Matrix n n α) :\n diag (∑ i ∈ s, f i) = ∑ i ∈ s, diag (f i) :=\n map_sum (diagAddMonoidHom n α) f s\n\nend Diag\n\nopen Matrix\n\nsection NonAssocSemiring\n\nvariable [NonAssocSemiring α]\n\nvariable (α n)\n\n/-- `Matrix.diagonal` as a `RingHom`. -/\n@[simps]\ndef diagonalRingHom [Fintype n] [DecidableEq n] : (n → α) →+* Matrix n n α :=\n { diagonalAddMonoidHom n α with\n toFun := diagonal\n map_one' := diagonal_one\n map_mul' := fun _ _ => (diagonal_mul_diagonal' _ _).symm }\n\nend NonAssocSemiring\n\nsection Semiring\n\nvariable [Semiring α]\n\ntheorem diagonal_pow [Fintype n] [DecidableEq n] (v : n → α) (k : ℕ) :\n diagonal v ^ k = diagonal (v ^ k) :=\n (map_pow (diagonalRingHom n α) v k).symm\n\n/-- The ring homomorphism `α →+* Matrix n n α`\nsending `a` to the diagonal matrix with `a` on the diagonal.\n-/\ndef scalar (n : Type u) [DecidableEq n] [Fintype n] : α →+* Matrix n n α :=\n (diagonalRingHom n α).comp <| Pi.constRingHom n α\n\nsection Scalar\n\nvariable [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m]\n\n@[simp]\ntheorem scalar_apply (a : α) : scalar n a = diagonal fun _ => a :=\n rfl\n\ntheorem scalar_inj [Nonempty n] {r s : α} : scalar n r = scalar n s ↔ r = s :=\n (diagonal_injective.comp Function.const_injective).eq_iff\n\n/-- A version of `Matrix.scalar_commute_iff` for rectangular matrices. -/\n\nTarget:\ntheorem scalar_comm_iff {r : α} {M : Matrix m n α} :\n scalar m r * M = M * scalar n r ↔ r • M = MulOpposite.op r • M :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Matrix","family_id":"scalar_comm_iff","file_id":"mathlib/Mathlib/Data/Matrix/Basic.lean","sample_id":"04e30d75a20649a4e8af1e3fb2c4664deed6136b7d405220d3f62537dac223d3"},"split":"validation"} {"binding":{"chosen_proof_sha256":"85f6ad78c524eda0c934e721b19e9291082fa2a1821c5d6d537c1276227894a6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"af7a044ec67c6f2d2ab89500edd15004633c97bb48831f2a88a5dfcc067c7a4b","source_sha256":"cc2967dc8d7641f0817b378e7e53dcbd89d3d9b349ad605c7f1a8d10ea3bf1f7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Module.Finite k (Module.End A V) := .of_injective (LinearMap.restrictScalarsₗ k A V V k) <|\n LinearMap.restrictScalars_injective _\n classical exact IsAlgClosed.algebraMap_bijective_of_isIntegral (k := k)\n\nvariable (A V)","hard_negative":false,"metrics":{"chosen_tokens":49,"rejected_tokens":3,"token_jaccard":0.074074,"token_length_ratio":0.061224},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"67fddab9e3bc2621836b2f3d677c2da057cd9673eb504bea7a84aff2b2a2666e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Lie.OfAssociative\npublic import Mathlib.FieldTheory.IsAlgClosed.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Stepan Nesterov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Stepan Nesterov\n-/\n/-!\n# Basic facts about algebra representations\n\nThis file collects basic general facts about algebra representations. The purpose of this file is\nto have general results so that when we prove a corresponding fact about group representations\n(or Lie algebra representations etc), we can deduce them as special cases of facts from this file.\n\n-/\n\npublic section\n\nvariable {A V : Type*} (k : Type*) [Field k] [Ring A] [Algebra k A] [AddCommGroup V] [Module k V]\n [Module A V] [IsScalarTower k A V]\n [IsSimpleModule A V] [FiniteDimensional k V] [IsAlgClosed k]\n\n/-- Schur's Lemma: If `V` is a representation of an algebra `A` over an algebraically closed field\n`k`, then any endomorphism of `V` is scalar. -/\n\nTarget:\ntheorem IsSimpleModule.algebraMap_end_bijective_of_isAlgClosed :\n Function.Bijective (algebraMap k (Module.End A V)) :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RepresentationTheory/AlgebraRepresentation","family_id":"issimplemodule","file_id":"mathlib/Mathlib/RepresentationTheory/AlgebraRepresentation/Basic.lean","sample_id":"af7a044ec67c6f2d2ab89500edd15004633c97bb48831f2a88a5dfcc067c7a4b"},"split":"validation"} {"binding":{"chosen_proof_sha256":"40918c6c4e621adbec13d515addfa93b0b2bfcf79f1d67ac9e52d74a6819d7b6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"a691b7a2e4e63bc8f6d2deccd181f1126f91d33ce55ac0d74ae9395d3f538acf","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"69c1472eb4fcac7f75367d274023840a7d509a9012ba86d8696aa01e223abc4f","source_sha256":"3faa405bdd543132812264268c6e4b51083d5c127ac14d512f81647196fa8418","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n classical\n induction S using Finset.induction generalizing n with\n | empty =>\n simp\n | insert a S' ha hind =>\n have : (∀ (n : ℕ), Subsingleton {r | r ∈ S' ∧ (x r).coeff n ≠ 0}) := by\n refine fun n ↦ ⟨fun b c ↦ ?_⟩\n ext\n exact congrArg (fun x ↦ x.1) <|\n (h n).allEq ⟨b.1, S'.subset_insert a b.2.1, b.2.2⟩ ⟨c.1, S'.subset_insert a c.2.1, c.2.2⟩\n replace hind := hind this\n simp only [ha, not_false_eq_true, Finset.sum_insert]\n have : ∀ (n : ℕ), (x a).coeff n = 0 ∨ (∑ s ∈ S', x s).coeff n = 0 := by\n simp only [hind]\n by_contra! ⟨m, hma, hmS'⟩\n have := Finset.sum_eq_zero.mt hmS'\n push Not at this\n choose b hb hb' using this\n have : a = b :=\n congrArg (fun x ↦ x.1) <|\n (h m).allEq ⟨a, S'.mem_insert_self a, hma⟩ ⟨b, S'.mem_insert_of_mem hb, hb'⟩\n exact ha (this ▸ hb)\n rw [coeff_add_of_disjoint n _ _ this, hind n]\n\nvariable [CharP R p]","hard_negative":true,"metrics":{"chosen_tokens":276,"rejected_tokens":5,"token_jaccard":0.033333,"token_length_ratio":0.018116},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"6aaa1cf70cec394466f3cad6db83bfae4cdd9e62129da6948e9b56c88caba8bb","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.WittVector.Complete\npublic import Mathlib.RingTheory.WittVector.Teichmuller\n\nNamespace:\nWittVector\n\nLocal context:\n/-\nCopyright (c) 2025 Jiedong Jiang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jiedong Jiang\n-/\n/-!\n# Teichmuller Series\n\nLet `R` be a characteristic `p` perfect ring. In this file, we show that\nevery element `x` of the Witt vectors `𝕎 R` can be written as the\n(`p`-adic) summation of Teichmuller series, namely\n`∑ i, (teichmuller p\n (((frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i)`\n\n## Main theorems\n\n* `WittVector.dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff` : `p ^ (n + 1)` divides\n `x` minus the summation of the first `n + 1` terms of the Teichmuller series.\n* `WittVector.eq_of_apply_teichmuller_eq` : Given a ring `S` such that `p` is nilpotent in `S`\n and two ring maps `f g : 𝕎 R →+* S`, if they coincide on the teichmuller representatives,\n then they are equal.\n\n## TODO\nShow that the Teichmuller series is unique.\n-/\n\npublic section\n\nopen Ideal Quotient\nnamespace WittVector\n\nvariable {p : ℕ} [hp : Fact (Nat.Prime p)]\n\nlocal notation \"𝕎\" => WittVector p\n\nvariable {R : Type*} [CommRing R]\n\nTarget:\ntheorem sum_coeff_eq_coeff_sum {α : Type*} {S : Finset α} (x : α → 𝕎 R)\n (h : ∀ (n : ℕ), Subsingleton {r | r ∈ S ∧ (x r).coeff n ≠ 0}) (n : ℕ) :\n (∑ s ∈ S, x s).coeff n = ∑ (s ∈ S), (x s).coeff n :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_69c1472eb4fc","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"49276761b3f0d07eb5f83a40061ba9b552aaa2f3ffd69fbe73e01cc65749cdc6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/WittVector","family_id":"sum_coeff_eq_coeff_sum","file_id":"mathlib/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean","sample_id":"69c1472eb4fcac7f75367d274023840a7d509a9012ba86d8696aa01e223abc4f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"391a2815a81fe5c563afbbf104ea9a9570c78f626b32d9dea8e5cd422d7026cb","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6572bc706fa7e9b1be53d4e6b76c1ccc5a80c5e857d33e0e105a97a314368bcc","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"38bdcd928bd2dde54ab742026689587c40e9f5013b387ac532573d8d11ae2ece","source_sha256":"65a1b087d9d05e07d4861107b2b6ea2121850181b3d7efafcdfdfd0be355face","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Module.Finite P.Ring P.Cotangent :=\n have : Module.Finite P.Ring P.ker := .of_fg h'\n .of_surjective _ Extension.Cotangent.mk_surjective\n have : Module.Finite S P.Cotangent := Module.Finite.of_restrictScalars_finite P.Ring _ _\n rw [← IsLocalRing.split_injective_iff_lTensor_residueField_injective,\n P.formallySmooth_iff_split_injection]","hard_negative":true,"metrics":{"chosen_tokens":67,"rejected_tokens":2,"token_jaccard":0.035714,"token_length_ratio":0.029851},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"6cd2122f46fecd17316e172fa222e600793867282bd3abfcc5e03eee4743ac93","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Flat.FaithfullyFlat.Basic\npublic import Mathlib.RingTheory.LocalRing.Module\npublic import Mathlib.RingTheory.Smooth.Basic\npublic import Mathlib.RingTheory.TensorProduct.Free\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2024 Andrew Yang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Andrew Yang\n-/\n/-!\n# Formally smooth local algebras\n-/\n\npublic section\n\nopen TensorProduct IsLocalRing KaehlerDifferential\n\nvariable {R S : Type*} [CommRing R] [CommRing S] [IsLocalRing S] [Algebra R S]\n\nnamespace Algebra\n\n/--\nThe **Jacobian criterion** for smoothness of local algebras.\nSuppose `S` is a local `R`-algebra, and `0 → I → P → S → 0` is a presentation such that\n`P` is formally-smooth over `R`, `Ω[P⁄R]` is finite free over `P`,\n(typically satisfied when `P` is the localization of a polynomial ring of finite type)\nand `I` is finitely generated.\nThen `S` is formally smooth iff `k ⊗ₛ I/I² → k ⊗ₚ Ω[P/R]` is injective,\nwhere `k` is the residue field of `S`.\n-/\n\nTarget:\ntheorem FormallySmooth.iff_injective_lTensor_residueField.{u}\n (P : Algebra.Extension.{u} R S)\n [FormallySmooth R P.Ring]\n [Module.Free P.Ring Ω[P.Ring⁄R]] [Module.Finite P.Ring Ω[P.Ring⁄R]]\n (h' : P.ker.FG) :\n Algebra.FormallySmooth R S ↔\n Function.Injective (P.cotangentComplex.lTensor (ResidueField S)) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_38bdcd928bd2","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"398a37b2f8759e9981db0d85c6148a50f9eab02625b8a6c6523c8e3b3384d39d","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Smooth","family_id":"formallysmooth","file_id":"mathlib/Mathlib/RingTheory/Smooth/Local.lean","sample_id":"38bdcd928bd2dde54ab742026689587c40e9f5013b387ac532573d8d11ae2ece"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8340b6a2be8bea62ce51d3f93f0b2c0018f1ef116a48ffeacc6fbc881ea6020b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"3278737e23e1a514baf88c972adf0ba6ea67c348892b3828e35a3e686dbb455a","source_sha256":"1c117292ea35b4c69b7b89450ffaaab2429e40cafa2d7e856efd5b7f3baef936","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n cases H\n rfl","hard_negative":false,"metrics":{"chosen_tokens":4,"rejected_tokens":3,"token_jaccard":0.166667,"token_length_ratio":0.75},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"6d383eb67d277d76d3d370e41a6a86fa24ed2a6cbdcf29b54d7bd78aaad70d64","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Iso\npublic import Mathlib.CategoryTheory.Functor.Category\npublic import Mathlib.CategoryTheory.EqToHom\npublic import Mathlib.CategoryTheory.Products.Unitor\n\nNamespace:\nCategoryTheory.Comma\n\nLocal context:\n/-\nCopyright (c) 2018 Kim Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kim Morrison, Johan Commelin, Bhavik Mehta\n-/\n/-!\n# Comma categories\n\nA comma category is a construction in category theory, which builds a category out of two functors\nwith a common codomain. Specifically, for functors `L : A ⥤ T` and `R : B ⥤ T`, an object in\n`Comma L R` is a morphism `hom : L.obj left ⟶ R.obj right` for some objects `left : A` and\n`right : B`, and a morphism in `Comma L R` between `hom : L.obj left ⟶ R.obj right` and\n`hom' : L.obj left' ⟶ R.obj right'` is a commutative square\n\n```\nL.obj left ⟶ L.obj left'\n | |\n hom | | hom'\n ↓ ↓\nR.obj right ⟶ R.obj right',\n```\n\nwhere the top and bottom morphism come from morphisms `left ⟶ left'` and `right ⟶ right'`,\nrespectively.\n\n## Main definitions\n\n* `Comma L R`: the comma category of the functors `L` and `R`.\n* `Over X`: the over category of the object `X` (developed in `Over.lean`).\n* `Under X`: the under category of the object `X` (also developed in `Over.lean`).\n* `Arrow T`: the arrow category of the category `T` (developed in `Arrow.lean`).\n\n## References\n\n* \n\n## Tags\n\ncomma, slice, coslice, over, under, arrow\n-/\n\n@[expose] public section\n\nnamespace CategoryTheory\n\nopen Category\n\n-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation\nuniverse v₁ v₂ v₃ v₄ v₅ v₆ u₁ u₂ u₃ u₄ u₅ u₆\n\nvariable {A : Type u₁} [Category.{v₁} A]\nvariable {B : Type u₂} [Category.{v₂} B]\nvariable {T : Type u₃} [Category.{v₃} T]\nvariable {A' : Type u₄} [Category.{v₄} A']\nvariable {B' : Type u₅} [Category.{v₅} B']\nvariable {T' : Type u₆} [Category.{v₆} T']\n\n/-- The objects of the comma category are triples of an object `left : A`, an object\n`right : B` and a morphism `hom : L.obj left ⟶ R.obj right`. -/\n@[to_dual self (reorder := A B, 2 4, L R), wikidata Q1780005]\nstructure Comma (L : A ⥤ T) (R : B ⥤ T) : Type max u₁ u₂ v₃ where\n /-- The left subobject -/\n left : A\n /-- The right subobject -/\n right : B\n /-- A morphism from `L.obj left` to `R.obj right` -/\n hom : L.obj left ⟶ R.obj right\n\nset_option linter.translateOverwrite false\n\nattribute [to_dual existing right] Comma.left\nattribute [to_dual self] Comma.mk\n\n-- Satisfying the inhabited linter\ninstance Comma.inhabited [Inhabited T] : Inhabited (Comma (𝟭 T) (𝟭 T)) where\n default :=\n { left := default\n right := default\n hom := 𝟙 default }\n\nvariable {L : A ⥤ T} {R : B ⥤ T}\n\n/-- A morphism between two objects in the comma category is a commutative square connecting the\nmorphisms coming from the two objects using morphisms in the image of the functors `L` and `R`.\n-/\n@[ext, to_dual self (reorder := A B, 2 4, L R, X Y)]\nstructure CommaMorphism (X Y : Comma L R) where\n /-- Morphism on left objects -/\n left : X.left ⟶ Y.left\n /-- Morphism on right objects -/\n right : X.right ⟶ Y.right\n w : L.map left ≫ Y.hom = X.hom ≫ R.map right := by cat_disch\n\nattribute [to_dual existing right] CommaMorphism.left\n\nto_dual_name_hint Left Right, Fst Snd, L R, L₁ R₁, L₂ R₂, A B, F₁ F₂\n\n@[to_dual existing w]\ntheorem CommaMorphism.w' {X Y : Comma R L} (self : CommaMorphism Y X) :\n Y.hom ≫ L.map self.right = R.map self.left ≫ X.hom :=\n self.w.symm\n\n/-- `CommaMorphism.mk'` is the dual of `CommaMorphism.mk`, which we need for `to_dual`.\nPlease avoid using this directly. -/\n@[to_dual existing mk]\nabbrev CommaMorphism.mk' {X Y : Comma R L}\n (right : Y.right ⟶ X.right) (left : Y.left ⟶ X.left)\n (w : Y.hom ≫ L.map right = R.map left ≫ X.hom) :\n CommaMorphism Y X where\n left; right; w := w.symm\n\n-- Satisfying the inhabited linter\ninstance CommaMorphism.inhabited [Inhabited (Comma L R)] :\n Inhabited (CommaMorphism (default : Comma L R) default) :=\n ⟨{ left := 𝟙 _, right := 𝟙 _}⟩\n\nattribute [reassoc (attr := simp)] CommaMorphism.w\n\n@[to_dual self]\ninstance commaCategory : Category (Comma L R) where\n Hom X Y := CommaMorphism X Y\n id X :=\n { left := 𝟙 X.left\n right := 𝟙 X.right }\n comp f g :=\n { left := f.left ≫ g.left\n right := f.right ≫ g.right }\n\nnamespace Comma\n\nsection\n\nvariable {X Y Z : Comma L R} {f : X ⟶ Y} {g : Y ⟶ Z}\n\n@[ext, to_dual self (reorder := A B, 2 4, L R, X Y, h₁ h₂)]\nlemma hom_ext (f g : X ⟶ Y) (h₁ : f.left = g.left) (h₂ : f.right = g.right) : f = g :=\n CommaMorphism.ext h₁ h₂\n\n@[to_dual (attr := simp)]\ntheorem id_left : (𝟙 X : CommaMorphism X X).left = 𝟙 X.left :=\n rfl\n\n@[to_dual (attr := simp)]\ntheorem comp_left : (f ≫ g).left = f.left ≫ g.left :=\n rfl\n\nend\n\nvariable (L) (R)\n\n/-- The functor sending an object `X` in the comma category to `X.left`. -/\n@[to_dual (reorder := L R) (attr := simps)\n/-- The functor sending an object `X` in the comma category to `X.right`. -/]\ndef fst : Comma L R ⥤ A where\n obj X := X.left\n map f := f.left\n\nset_option linter.existingAttributeWarning false in\nattribute [to_dual existing] fst_map\n\nset_option backward.defeqAttrib.useBackward true in\n/-- We can interpret the commutative square constituting a morphism in the comma category as a\nnatural transformation between the functors `fst ⋙ L` and `snd ⋙ R` from the comma category\nto `T`, where the components are given by the morphism that constitutes an object of the comma\ncategory. -/\n@[simps, to_dual self]\ndef natTrans : fst L R ⋙ L ⟶ snd L R ⋙ R where app X := X.hom\n\n@[simp]\ntheorem eqToHom_left (X Y : Comma L R) (H : X = Y) :\n CommaMorphism.left (eqToHom H) = eqToHom (by cases H; rfl) := by\n cases H\n rfl\n\n@[simp]\n\nTarget:\ntheorem eqToHom_right (X Y : Comma L R) (H : X = Y) :\n CommaMorphism.right (eqToHom H) = eqToHom (by cases H; rfl) :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Comma","family_id":"eqtohom_right","file_id":"mathlib/Mathlib/CategoryTheory/Comma/Basic.lean","sample_id":"3278737e23e1a514baf88c972adf0ba6ea67c348892b3828e35a3e686dbb455a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"e15b99f0eb73b50a3658217852a3ecec3d538f7ab20646620ad2a6942cdf6a8f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"8fdb645973c6e7e6c43cf4446cea8e550d9545d6298ad55f982c4ea7593bfcb4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"fc3c5dcea0d121e7d50618fa13f14653cb05b535558cfd36971f20d217d9f23d","source_sha256":"740bfb06835908c9077b160ff85d111cf738322bf1006fc19f108aa1f2da53d5","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n revert h\n induction x using q.P.wCases\n case ih a₀ f'₀ f₀ =>\n induction y using q.P.wCases\n apply WEquiv.abs","hard_negative":true,"metrics":{"chosen_tokens":32,"rejected_tokens":5,"token_jaccard":0.083333,"token_length_ratio":0.15625},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"6e2325e5c2939209293960819a60083ed9689fbc123d841216f9ced475c36089","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.PFunctor.Multivariate.W\npublic import Mathlib.Data.QPF.Multivariate.Basic\n\nNamespace:\nMvQPF\n\nLocal context:\n/-\nCopyright (c) 2018 Jeremy Avigad. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jeremy Avigad, Simon Hudon\n-/\n/-!\n# The initial algebra of a multivariate qpf is again a qpf.\n\nFor an `(n+1)`-ary QPF `F (α₀,..,αₙ)`, we take the least fixed point of `F` with\nregards to its last argument `αₙ`. The result is an `n`-ary functor: `Fix F (α₀,..,αₙ₋₁)`.\nMaking `Fix F` into a functor allows us to take the fixed point, compose with other functors\nand take a fixed point again.\n\n## Main definitions\n\n* `Fix.mk` - constructor\n* `Fix.dest` - destructor\n* `Fix.rec` - recursor: basis for defining functions by structural recursion on `Fix F α`\n* `Fix.drec` - dependent recursor: generalization of `Fix.rec` where\n the result type of the function is allowed to depend on the `Fix F α` value\n* `Fix.rec_eq` - defining equation for `recursor`\n* `Fix.ind` - induction principle for `Fix F α`\n\n## Implementation notes\n\nFor `F` a `QPF`, we define `Fix F α` in terms of the W-type of the polynomial functor `P` of `F`.\nWe define the relation `WEquiv` and take its quotient as the definition of `Fix F α`.\n\nSee [avigad-carneiro-hudon2019] for more details.\n\n## Reference\n\n* Jeremy Avigad, Mario M. Carneiro and Simon Hudon.\n [*Data Types as Quotients of Polynomial Functors*][avigad-carneiro-hudon2019]\n-/\n\n@[expose] public section\n\n\nuniverse u v\n\nnamespace MvQPF\n\nopen TypeVec\n\nopen MvFunctor (LiftP LiftR)\n\nopen MvFunctor\n\nvariable {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u} [q : MvQPF F]\n\n\n/-- `recF` is used as a basis for defining the recursor on `Fix F α`. `recF`\ntraverses recursively the W-type generated by `q.P` using a function on `F`\nas a recursive step -/\ndef recF {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) : q.P.W α → β :=\n q.P.wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)\n\ntheorem recF_eq {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (a : q.P.A)\n (f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :\n recF g (q.P.wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩) := by\n rw [recF, MvPFunctor.wRec_eq]; rfl\n\nset_option backward.isDefEq.respectTransparency false in\ntheorem recF_eq' {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (x : q.P.W α) :\n recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) := by\n induction x using q.P.wCases\n case ih a f' f =>\n rw [recF_eq, q.P.wDest'_wMk, MvPFunctor.map_eq, appendFun_comp_splitFun, TypeVec.id_comp]\n\n/-- Equivalence relation on W-types that represent the same `Fix F`\nvalue -/\ninductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop\n | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :\n (∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)\n | abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)\n (f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :\n abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →\n WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)\n | trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w\n\ntheorem recF_eq_of_wEquiv (α : TypeVec n) {β : Type u} (u : F (α.append1 β) → β) (x y : q.P.W α) :\n WEquiv x y → recF u x = recF u y := by\n induction x using q.P.wCases\n case ih a₀ f'₀ f₀ =>\n induction y using q.P.wCases\n case ih a₁ f'₁ f₁ =>\n intro h\n -- Porting note: induction on h doesn't work.\n refine @WEquiv.recOn _ _ _ _ (fun a a' _ ↦ recF u a = recF u a') _ _ h ?_ ?_ ?_\n · intro a f' f₀ f₁ _h ih; simp only [recF_eq]\n congr 4; funext; apply ih\n · intro a₀ f'₀ f₀ a₁ f'₁ f₁ h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h]\n · intro x y z _e₁ _e₂ ih₁ ih₂; exact Eq.trans ih₁ ih₂\n\nTarget:\ntheorem wEquiv.abs' {α : TypeVec n} (x y : q.P.W α)\n (h : MvQPF.abs (q.P.wDest' x) = MvQPF.abs (q.P.wDest' y)) :\n WEquiv x y :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_fc3c5dcea0d1","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"fa6b9d0c09701100096029cb709279764cc71dc3165dadd8c427d38e660cfead","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/QPF","family_id":"wequiv","file_id":"mathlib/Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean","sample_id":"fc3c5dcea0d121e7d50618fa13f14653cb05b535558cfd36971f20d217d9f23d"},"split":"validation"} {"binding":{"chosen_proof_sha256":"0905756c2396ecd50373c7495fa57410ab608eb21629d69318b9d171d1cbbd95","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"a578da784cf87ad85e3b4938ca2f25816acb6ce5baf99402dfac2ff24f88a2a1","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"24a50e7c923889ee600c6124112db36d9e99116f749fac0c7fb2453afa7f8437","source_sha256":"43006e022782a083a6e27e774534747103f94575f40281c1e1972ea93b801577","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rcases hs.exists_countable_dense_subset with ⟨t, hts, htc, hst⟩\n lift t to Set s using hts\n refine ⟨⟨t, countable_of_injective_of_countable_image Subtype.coe_injective.injOn htc, ?_⟩⟩\n rwa [IsInducing.subtypeVal.dense_iff, Subtype.forall]","hard_negative":true,"metrics":{"chosen_tokens":51,"rejected_tokens":2,"token_jaccard":0.030303,"token_length_ratio":0.039216},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"6e7c8256ae58e24d24009c0581475300a899fbe0965527c713b18e9ba8a08a5c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.UniformSpace.Pi\n\nNamespace:\nTopologicalSpace\n\nLocal context:\n/-\nCopyright (c) 2021 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Metrizable Spaces\n\nIn this file we define metrizable topological spaces, i.e., topological spaces for which there\nexists a metric space structure that generates the same topology.\nWe define it without any reference to metric spaces in order to avoid importing the real numbers.\nFor the proof that metrizable spaces admit a compatible metric,\nsee `Mathlib/Topology/Metrizable/Uniformity.lean`.\n-/\n\n-- don't import the real numbers\nassert_not_exists AddMonoidWithOne\n\npublic section\n\nopen Filter Set Topology Uniformity UniformSpace SetRel\n\nnamespace TopologicalSpace\n\nvariable {ι X Y : Type*} {A : ι → Type*} [TopologicalSpace X] [TopologicalSpace Y] [Finite ι]\n [∀ i, TopologicalSpace (A i)]\n\n/-- A topological space is *pseudometrizable* if there exists a pseudometric space structure\ncompatible with the topology. To minimize imports, we implement this class in terms of the\nexistence of a countably generated uniformity inducing the topology, which is mathematically\nequivalent.\nTo endow such a space with a compatible uniformity, use\n`letI : UniformSpace X := TopologicalSpace.pseudoMetrizableSpaceUniformity X`.\nTo endow such a space with a compatible distance, use\n`letI : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X`. -/\nclass PseudoMetrizableSpace (X : Type*) [t : TopologicalSpace X] : Prop where\n exists_countably_generated :\n ∃ u : UniformSpace X, u.toTopologicalSpace = t ∧ (uniformity X).IsCountablyGenerated\n\n/-- A uniform space with countably generated `𝓤 X` is pseudometrizable. -/\ninstance (priority := 100) _root_.UniformSpace.pseudoMetrizableSpace {X : Type*}\n [u : UniformSpace X] [hu : IsCountablyGenerated (uniformity X)] : PseudoMetrizableSpace X :=\n ⟨⟨u, rfl, hu⟩⟩\n\n/-- Construct on a pseudometrizable space a countably generated uniformity\ncompatible with the topology. Use `pseudoMetrizableSpaceUniformity_countably_generated` for a proof\nthat this uniformity is countably generated. -/\n-- see note [reducible non-instances]\nnoncomputable abbrev pseudoMetrizableSpaceUniformity (X : Type*) [TopologicalSpace X]\n [h : PseudoMetrizableSpace X] : UniformSpace X :=\n h.exists_countably_generated.choose.replaceTopology\n h.exists_countably_generated.choose_spec.1.symm\n\nexample {X : Type*} [t : TopologicalSpace X] [PseudoMetrizableSpace X] :\n (pseudoMetrizableSpaceUniformity X).toTopologicalSpace = t := by\n with_reducible_and_instances rfl\n\n/-- The uniformity coming from `pseudoMetrizableSpaceUniformity` is countably generated.. -/\ntheorem pseudoMetrizableSpaceUniformity_countably_generated\n (X : Type*) [TopologicalSpace X] [h : PseudoMetrizableSpace X] :\n 𝓤[pseudoMetrizableSpaceUniformity X].IsCountablyGenerated :=\n h.exists_countably_generated.choose_spec.2\n\ninstance pseudoMetrizableSpace_prod [PseudoMetrizableSpace X] [PseudoMetrizableSpace Y] :\n PseudoMetrizableSpace (X × Y) :=\n let : UniformSpace X := pseudoMetrizableSpaceUniformity X\n have : (uniformity X).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated X\n let : UniformSpace Y := pseudoMetrizableSpaceUniformity Y\n have : (uniformity Y).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated Y\n inferInstance\n\n/-- Given an inducing map of a topological space into a pseudometrizable space, the source space\nis also pseudometrizable. -/\ntheorem _root_.Topology.IsInducing.pseudoMetrizableSpace [PseudoMetrizableSpace Y] {f : X → Y}\n (hf : IsInducing f) : PseudoMetrizableSpace X :=\n let u : UniformSpace Y := pseudoMetrizableSpaceUniformity Y\n have : (uniformity Y).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated Y\n ⟨⟨u.comap f, u.toTopologicalSpace_comap.trans hf.eq_induced.symm,\n Filter.comap.isCountablyGenerated (uniformity Y) (Prod.map f f)⟩⟩\n\n/-- Every pseudo-metrizable space is first countable. -/\ninstance (priority := 100) PseudoMetrizableSpace.firstCountableTopology\n [h : PseudoMetrizableSpace X] : FirstCountableTopology X :=\n let : UniformSpace X := pseudoMetrizableSpaceUniformity X\n have : (uniformity X).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated X\n inferInstance\n\ninstance PseudoMetrizableSpace.subtype [PseudoMetrizableSpace X] (s : Set X) :\n PseudoMetrizableSpace s :=\n IsInducing.subtypeVal.pseudoMetrizableSpace\n\ninstance pseudoMetrizableSpace_pi [∀ i, PseudoMetrizableSpace (A i)] :\n PseudoMetrizableSpace (∀ i, A i) :=\n let := fun i => pseudoMetrizableSpaceUniformity (A i)\n have := fun i => pseudoMetrizableSpaceUniformity_countably_generated (A i)\n inferInstance\n\ninstance PseudoMetrizableSpace.regularSpace [PseudoMetrizableSpace X] : RegularSpace X :=\n let := pseudoMetrizableSpaceUniformity X\n inferInstance\n\ninstance (priority := 100) IndiscreteTopology.pseudoMetrizableSpace [IndiscreteTopology X] :\n PseudoMetrizableSpace X where\n exists_countably_generated :=\n ⟨⊤, (IndiscreteTopology.eq_top X).symm, isCountablyGenerated_top⟩\n\n/-- A topological space is metrizable if there exists a metric space structure compatible with the\ntopology. To minimize imports, we implement this class in terms of the existence of a\ncountably generated uniformity inducing the topology, which is mathematically\nequivalent.\nTo endow such a space with a compatible uniformity, use\n`letI : UniformSpace X := TopologicalSpace.pseudoMetrizableSpaceUniformity X`.\nTo endow such a space with a compatible distance, use\n`letI : MetricSpace X := TopologicalSpace.metrizableSpaceMetric X`. -/\nclass MetrizableSpace (X : Type*) [t : TopologicalSpace X] : Prop extends\n PseudoMetrizableSpace X, T0Space X\n\n-- See note [lower instance priority]\nattribute [instance 100] MetrizableSpace.toT0Space\nattribute [instance 100] MetrizableSpace.toPseudoMetrizableSpace\n\ninstance (priority := 100) PseudoMetrizableSpace.toMetrizableSpace\n [T0Space X] [h : PseudoMetrizableSpace X] : MetrizableSpace X where\n\ninstance (priority := 100) t2Space_of_metrizableSpace [MetrizableSpace X] : T2Space X :=\n letI : UniformSpace X := pseudoMetrizableSpaceUniformity X\n inferInstance\n\ninstance metrizableSpace_prod [MetrizableSpace X] [MetrizableSpace Y] :\n MetrizableSpace (X × Y) where\n\n/-- Given an embedding of a topological space into a metrizable space, the source space is also\nmetrizable. -/\ntheorem _root_.Topology.IsEmbedding.metrizableSpace [MetrizableSpace Y] {f : X → Y}\n (hf : IsEmbedding f) : MetrizableSpace X where\n toPseudoMetrizableSpace := hf.toIsInducing.pseudoMetrizableSpace\n toT0Space := hf.t0Space\n\ninstance MetrizableSpace.subtype [MetrizableSpace X] (s : Set X) : MetrizableSpace s :=\n IsEmbedding.subtypeVal.metrizableSpace\n\ninstance metrizableSpace_pi [∀ i, MetrizableSpace (A i)] : MetrizableSpace (∀ i, A i) where\n\ntheorem IsSeparable.secondCountableTopology [PseudoMetrizableSpace X] {s : Set X}\n (hs : IsSeparable s) : SecondCountableTopology s :=\n let ⟨u, hu, hs⟩ := hs\n have := hu.to_subtype\n have : SeparableSpace (closure u) :=\n ⟨Set.range (u.inclusion subset_closure), Set.countable_range (u.inclusion subset_closure),\n Subtype.dense_iff.2 <| by rw [← Set.range_comp, Set.val_comp_inclusion, Subtype.range_coe]⟩\n let := pseudoMetrizableSpaceUniformity (closure u)\n have := pseudoMetrizableSpaceUniformity_countably_generated (closure u)\n have := secondCountable_of_separable (closure u)\n (Topology.IsEmbedding.inclusion hs).secondCountableTopology\n\ninstance (X : Type*) [TopologicalSpace X] [LindelofSpace X] [PseudoMetrizableSpace X] :\n SecondCountableTopology X := by\n let := pseudoMetrizableSpaceUniformity X\n have := pseudoMetrizableSpaceUniformity_countably_generated X\n suffices _ : SeparableSpace X from secondCountable_of_separable X\n obtain ⟨V, hVb, hVs⟩ := has_seq_basis X\n choose U hUc hUu using fun n =>\n LindelofSpace.elim_nhds_subcover (fun x => ball x (V n))\n (fun x => ball_mem_nhds x (hVb.mem n))\n refine ⟨Set.iUnion U, Set.countable_iUnion hUc, fun x => ?_⟩\n rw [mem_closure_iff_frequently, nhds_eq_comap_uniformity, frequently_comap, hVb.frequently_iff]\n intro n _\n obtain ⟨i, hi, hx⟩ := Set.mem_iUnion₂.1 (Set.eq_univ_iff_forall.1 (hUu n) x)\n rw [ball_eq_of_symmetry] at hx\n exact ⟨(x, i), hx, i, rfl, Set.mem_iUnion_of_mem n hi⟩\n\n/-- If a set `s` is separable in a pseudo metrizable space, then it admits a countable dense\nsubset. This is not obvious, as the countable set whose closure covers `s` given by the definition\nof separability does not need in general to be contained in `s`. -/\ntheorem IsSeparable.exists_countable_dense_subset [PseudoMetrizableSpace X]\n {s : Set X} (hs : IsSeparable s) : ∃ t, t ⊆ s ∧ t.Countable ∧ s ⊆ closure t := by\n let := pseudoMetrizableSpaceUniformity X\n have := pseudoMetrizableSpaceUniformity_countably_generated X\n apply subset_countable_closure_of_almost_dense_set\n intro U hU\n obtain ⟨t, htc, hst⟩ := hs\n refine ⟨t, htc, fun x hx => ?_⟩\n obtain ⟨y, hyx, hyt⟩ := mem_closure_iff_ball.1 (hst hx) (symmetrize_mem_uniformity hU)\n exact mem_biUnion hyt (ball_mono SetRel.symmetrize_subset_inv x hyx)\n\n/-- If a set `s` is separable, then the corresponding subtype is separable in a\npseudo metrizable space.\nThis is not obvious, as the countable set whose closure covers `s` does not need in\ngeneral to be contained in `s`. -/\n\nTarget:\ntheorem IsSeparable.separableSpace [PseudoMetrizableSpace X] {s : Set X} (hs : IsSeparable s) :\n SeparableSpace s :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_24a50e7c9238","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"60c6351076d9ba06073c1b2898c15f51132a308294acccfec3137351c8f34462","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Metrizable","family_id":"isseparable","file_id":"mathlib/Mathlib/Topology/Metrizable/Basic.lean","sample_id":"24a50e7c923889ee600c6124112db36d9e99116f749fac0c7fb2453afa7f8437"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1d0ec81d029f062c72e75fa8be2f1729cc3c1eb96a4a2c9cdc3e3806c3732cb0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"acc6d61ed1f194e7efe6bbd8865604508eabacf6f242e8c7aadc431ec7a734c0","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"408060ae3a28659f83cb4e62e2bf39c8fd83d7e7e19911f46e717649bdbc5d13","source_sha256":"484b555447ac93535ee86f92f767ea9e12d384105ac74c26fe8c77249c716290","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n letI := hf.mulActionFiber x\n have := hf.mulActionFiber_isPretransitive x\n obtain ⟨g, rfl⟩ := MulAction.IsPretransitive.exists_smul_eq e e' (M := G)\n use g\n ext\n simp","hard_negative":true,"metrics":{"chosen_tokens":36,"rejected_tokens":3,"token_jaccard":0.034483,"token_length_ratio":0.083333},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"7397454332fb687108d5fe6e868dc963f3aafb70e2235e1102aaf07d22181166","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.Coset.Defs\npublic import Mathlib.Topology.Algebra.ConstMulAction\npublic import Mathlib.Topology.Algebra.Group.Quotient\npublic import Mathlib.Topology.Covering.Basic\n\nNamespace:\nIsQuotientCoveringMap\n\nLocal context:\n/-\nCopyright (c) 2025 Junyan Xu. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Junyan Xu\n-/\n/-!\n# Covering maps to quotients by free and properly discontinuous group actions\n-/\n\n@[expose] public section\n\nvariable {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] (f : E → X)\nvariable (G : Type*) [Group G] [MulAction G E]\n\nopen Topology\n\n/-- A function from a topological space `E` with an action by a discrete group to another\ntopological space `X` is a quotient covering map if it is a quotient map, the action is\ncontinuous and transitive on fibers, and every point of `E` has a neighborhood whose translates\nby the group elements are pairwise disjoint. -/\nstructure IsAddQuotientCoveringMap (G) [AddGroup G] [AddAction G E] : Prop\n extends IsQuotientMap f, ContinuousConstVAdd G E where\n apply_eq_iff_mem_orbit {e₁ e₂} : f e₁ = f e₂ ↔ e₁ ∈ AddAction.orbit G e₂\n disjoint (e : E) : ∃ U ∈ 𝓝 e, ∀ g : G, ((g +ᵥ ·) '' U ∩ U).Nonempty → g = 0\n\n/-- A function from a topological space `E` with an action by a discrete group to another\ntopological space `X` is a quotient covering map if it is a quotient map, the action is\ncontinuous and transitive on fibers, and every point of `E` has a neighborhood whose translates\nby the group elements are pairwise disjoint. -/\n@[mk_iff, to_additive]\nstructure IsQuotientCoveringMap : Prop extends IsQuotientMap f, ContinuousConstSMul G E where\n apply_eq_iff_mem_orbit {e₁ e₂} : f e₁ = f e₂ ↔ e₁ ∈ MulAction.orbit G e₂\n disjoint (e : E) : ∃ U ∈ 𝓝 e, ∀ g : G, ((g • ·) '' U ∩ U).Nonempty → g = 1\n\nattribute [to_additive] isQuotientCoveringMap_iff\n\nnamespace IsQuotientCoveringMap\n\n@[to_additive] theorem subgroup_congr (S S' : Subgroup G) (eq : S = S') :\n IsQuotientCoveringMap f S ↔ IsQuotientCoveringMap f S' := by rw [eq]\n\nvariable {f G} (hf : IsQuotientCoveringMap f G)\ninclude hf\n\n@[to_additive] protected theorem map_smul (g : G) {e : E} : f (g • e) = f e :=\n hf.apply_eq_iff_mem_orbit.mpr ⟨g, rfl⟩\n\n/-- The group action on the domain of a quotient covering map is free. -/\n@[to_additive] theorem isCancelSMul : IsCancelSMul G E where\n right_cancel' g g' e eq := by\n have ⟨U, heU, hU⟩ := hf.disjoint e\n simpa [inv_mul_eq_one, eq_comm] using hU (g'⁻¹ * g)\n ⟨e, ⟨e, mem_of_mem_nhds heU, by simpa [mul_smul, inv_smul_eq_iff]⟩, mem_of_mem_nhds heU⟩\n\n@[to_additive] theorem homeomorph_comp {Y} [TopologicalSpace Y]\n (φ : X ≃ₜ Y) : IsQuotientCoveringMap (φ ∘ f) G where\n __ := φ.isQuotientMap.comp hf.toIsQuotientMap\n continuous_const_smul := hf.continuous_const_smul\n apply_eq_iff_mem_orbit := by simpa using @hf.apply_eq_iff_mem_orbit\n disjoint := hf.disjoint\n\nomit hf in\n@[to_additive (attr := simp)] theorem homeomorph_comp_iff {Y} [TopologicalSpace Y]\n (φ : X ≃ₜ Y) : IsQuotientCoveringMap (φ ∘ f) G ↔ IsQuotientCoveringMap f G where\n mp h := by convert! h.homeomorph_comp φ.symm; ext; simp\n mpr h := h.homeomorph_comp φ\n\n/-- Fibers of a quotient covering map by a group G is a G-torsor. -/\n@[to_additive /-- Fibers of a quotient covering map by an additive group G is a G-torsor. -/]\nnoncomputable def fiberEquivGroup {x : X} (e : f ⁻¹' {x}) : f ⁻¹' {x} ≃ G :=\n have := hf.isCancelSMul\n .symm <| .ofBijective (fun g ↦ ⟨g • e, (hf.map_smul g).trans e.2⟩)\n ⟨fun _ _ eq ↦ IsCancelSMul.right_cancel _ _ e.1 congr($eq), fun e' ↦\n have ⟨g, eq⟩ := hf.apply_eq_iff_mem_orbit.mp (e'.2.trans e.2.symm); ⟨g, Subtype.ext eq⟩⟩\n\n@[simp] theorem fiberEquivGroup_self {x : X} (e : f ⁻¹' {x}) : hf.fiberEquivGroup e e = 1 :=\n (Equiv.apply_eq_iff_eq_symm_apply _).mpr <| Subtype.ext (one_smul ..).symm\n\n@[simp] theorem fiberEquivGroup_eq_iff {x : X} (e e' : f ⁻¹' {x}) (g : G) :\n hf.fiberEquivGroup e e' = g ↔ e' = g • (e : E) := by\n rw [fiberEquivGroup, Equiv.symm_apply_eq, Equiv.ofBijective_apply, Subtype.mk.injEq]\n\n@[simp] theorem fiberEquivGroup_smul_self {x : X} (e : f ⁻¹' {x}) {e' : f ⁻¹' {x}} :\n hf.fiberEquivGroup e e' • (e : E) = (e' : E) :=\n congr($((hf.fiberEquivGroup e).symm_apply_apply e'))\n\n/-- The action of `G` restricted to the fiber. -/\n@[implicit_reducible] def mulActionFiber (x : X) : MulAction G (f ⁻¹' {x}) :=\n SubMulAction.mulAction ⟨f ⁻¹' {x}, fun g _ h ↦ (hf.map_smul g).trans h⟩\n\n@[simp] lemma coe_mulActionFiber_smul (x : X) (g : G) (e : f ⁻¹' {x}) :\n letI := hf.mulActionFiber x\n (↑(g • e) : E) = g • (e : E) :=\n rfl\n\nlemma mulActionFiber_isPretransitive (x : X) :\n letI := hf.mulActionFiber x\n MulAction.IsPretransitive G (f ⁻¹' {x}) := by\n letI := hf.mulActionFiber x\n constructor\n intro e e'\n obtain ⟨g, hg⟩ := hf.apply_eq_iff_mem_orbit.mp (e'.2.trans e.2.symm)\n exact ⟨g, Subtype.ext hg⟩\n\n/-- A quotient covering map `f` induces a permutation action on each fiber. -/\n@[simps!] def toPermFiber (x : X) : G →* Equiv.Perm (f ⁻¹' {x}) :=\n (hf.mulActionFiber x).toPermHom\n\ntheorem toPermFiber_ext (x : X) (e : f ⁻¹' {x}) {g g' : G}\n (eq : hf.toPermFiber x g e = hf.toPermFiber x g' e) : g = g' :=\n have := hf.isCancelSMul\n IsCancelSMul.right_cancel _ _ e.1 congr($eq)\n\ntheorem toPermFiber_injective (x : X) : Function.Injective (hf.toPermFiber x) :=\n have ⟨e, he⟩ := hf.surjective x\n fun _ _ eq ↦ hf.toPermFiber_ext x ⟨e, he⟩ congr($eq _)\n\nTarget:\ntheorem exists_toPermFiber_eq {x : X} (e e' : f ⁻¹' {x}) : ∃ g, hf.toPermFiber x g e = e' :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_408060ae3a28","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"423a3c78ada33abf0f8a97ba939f9168d82f1bd66457825ea1b88ca41e2031d3","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Covering","family_id":"exists_topermfiber_eq","file_id":"mathlib/Mathlib/Topology/Covering/Quotient.lean","sample_id":"408060ae3a28659f83cb4e62e2bf39c8fd83d7e7e19911f46e717649bdbc5d13"},"split":"validation"} {"binding":{"chosen_proof_sha256":"76e366f5fa46bedf55f80e4fe13ea42e4abec33a4984b6cfbbd385f0e3966549","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d4b316aa381dd6ab25b1ff72c98d7023b49eea42b4e79d16d87ac28af7dd94f3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"6c8fe76d7d5b9445f80fa88773e7e040dba76c83483359c8ece78cffd4125daa","source_sha256":"3cf25ec0a66d4cd0e72d015f27da2a40d04295e8624f25b2320308ac159eb3f0","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by rw [elim_comp fun f : α → β => f y]","hard_negative":false,"metrics":{"chosen_tokens":14,"rejected_tokens":19,"token_jaccard":0.764706,"token_length_ratio":1.357143},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"74f6b9b59b8798c000f0aadd27dbdc0293577c743a92db68e501c48eb63ddcf3","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Control.Combinators\npublic import Mathlib.Data.Option.Defs\npublic import Mathlib.Logic.IsEmpty.Basic\npublic import Mathlib.Logic.Relator\npublic import Mathlib.Util.CompileInductive\npublic import Aesop\npublic import Batteries.Tactic.Lint.Simp\n\nNamespace:\nOption\n\nLocal context:\n/-\nCopyright (c) 2017 Mario Carneiro. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Mario Carneiro\n-/\n/-!\n# Option of a type\n\nThis file develops the basic theory of option types.\n\nIf `α` is a type, then `Option α` can be understood as the type with one more element than `α`.\n`Option α` has terms `some a`, where `a : α`, and `none`, which is the added element.\nThis is useful in multiple ways:\n* It is the prototype of addition of terms to a type. See for example `WithBot α` which uses\n `none` as an element smaller than all others.\n* It can be used to define failsafe partial functions, which return `some the_result_we_expect`\n if we can find `the_result_we_expect`, and `none` if there is no meaningful result. This forces\n any subsequent use of the partial function to explicitly deal with the exceptions that make it\n return `none`.\n* `Option` is a monad. We love monads.\n\n`Part` is an alternative to `Option` that can be seen as the type of `True`/`False` values\nalong with a term `a : α` if the value is `True`.\n\n-/\n\n@[expose] public section\n\nuniverse u\n\nnamespace Option\n\nvariable {α β γ δ : Type*}\n\ntheorem coe_def : (fun a ↦ ↑a : α → Option α) = some :=\n rfl\n\ntheorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp\n\n@[simp 1100]\ntheorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} :\n f a ∈ o.map f ↔ a ∈ o := by\n aesop\n\ntheorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} :\n (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp\n\ntheorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} :\n (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp\n\ntheorem coe_get {o : Option α} (h : o.isSome) : ((Option.get _ h : α) : Option α) = o :=\n Option.some_get h\n\ntheorem eq_of_mem_of_mem {a : α} {o1 o2 : Option α} (h1 : a ∈ o1) (h2 : a ∈ o2) : o1 = o2 :=\n h1.trans h2.symm\n\ntheorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α → Prop) :=\n fun _ _ _ => mem_unique\n\ntheorem some_injective (α : Type*) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp\n\n@[simp]\ntheorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f :=\n rfl\n\n@[congr]\ntheorem bind_congr' {f g : α → Option β} {x y : Option α} (hx : x = y)\n (hf : ∀ a ∈ y, f a = g a) : x.bind f = y.bind g :=\n hx.symm ▸ bind_congr hf\n\ntheorem joinM_eq_join : joinM = @join α :=\n funext fun _ ↦ rfl\n\ntheorem bind_eq_bind' {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=\n rfl\n\ntheorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=\n rfl\n\n@[simp]\ntheorem map_coe' {a : α} {f : α → β} : Option.map f (a : Option α) = ↑(f a) :=\n rfl\n\n/-- `Option.map` as a function between functions is injective. -/\ntheorem map_injective' : Function.Injective (@Option.map α β) := fun f g h ↦\n funext fun x ↦ some_injective _ <| by simp only [← map_some, h]\n\n@[simp]\ntheorem map_inj {f g : α → β} : Option.map f = Option.map g ↔ f = g :=\n map_injective'.eq_iff\n\n@[simp]\ntheorem map_eq_id {f : α → α} : Option.map f = id ↔ f = id :=\n map_injective'.eq_iff' map_id\n\ntheorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)\n (a : α) :\n (Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by rw [map_map, h, ← map_map]\n\nsection pmap\n\nvariable {p : α → Prop} (f : ∀ a : α, p a → β) (x : Option α)\n\ntheorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by\n rw [mem_def] at ha ⊢\n subst ha\n rfl\n\ntheorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)\n (H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :\n pmap f (x >>= g) H = x >>= fun a ↦ pmap f (g a) fun _ h ↦ H _ (H' a _ h) := by\n grind [cases Option]\n\ntheorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :\n pmap f x H >>= g = x.pbind fun a h ↦ g (f a (H _ h)) := by\n grind [cases Option, pmap]\n\nvariable {f x}\n\ntheorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}\n (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by\n grind [cases Option]\n\ntheorem join_pmap_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :\n (pmap (pmap f) x H).join = pmap f x.join fun a h ↦ H (some a) (mem_of_mem_join h) _ rfl := by\n grind [cases Option]\n\ntheorem pmap_bind_id_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :\n ((pmap (pmap f) x H).bind fun a ↦ a) =\n pmap f x.join fun a h ↦ H (some a) (mem_of_mem_join h) _ rfl := by\n grind [cases Option]\n\nend pmap\n\n@[simp]\ntheorem seq_some {α β} {a : α} {f : α → β} : some f <*> some a = some (f a) :=\n rfl\n\n@[deprecated \"Use `Option.get` with proof of `isSome`.\" (since := \"2026-01-05\")]\ntheorem iget_mem [Inhabited α] : ∀ {o : Option α}, isSome o → o.iget ∈ o\n | some _, _ => rfl\n\n@[deprecated \"Use `Option.getD`.\" (since := \"2026-01-05\")]\ntheorem iget_of_mem [Inhabited α] {a : α} : ∀ {o : Option α}, a ∈ o → o.iget = a\n | _, rfl => rfl\n\n@[deprecated \"Use `Option.getD` directly.\" (since := \"2026-01-05\")]\ntheorem getD_default_eq_iget [Inhabited α] (o : Option α) :\n o.getD default = o.iget := by cases o <;> rfl\n\n@[simp, grind =]\ntheorem failure_eq_none {α} : failure = (none : Option α) := rfl\n\n@[simp]\ntheorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by\n grind [cases Option, _root_.guard]\n\n/-- Given an element of `a : Option α`, a default element `b : β` and a function `α → β`, apply this\nfunction to `a` if it comes from `α`, and return `b` otherwise. -/\ndef casesOn' : Option α → β → (α → β) → β\n | none, n, _ => n\n | some a, _, s => s a\n\n@[simp]\ntheorem casesOn'_none (x : β) (f : α → β) : casesOn' none x f = x :=\n rfl\n\n@[simp]\ntheorem casesOn'_some (x : β) (f : α → β) (a : α) : casesOn' (some a) x f = f a :=\n rfl\n\n@[simp]\ntheorem casesOn'_coe (x : β) (f : α → β) (a : α) : casesOn' (a : Option α) x f = f a :=\n rfl\n\n@[simp]\ntheorem casesOn'_none_coe (f : Option α → β) (o : Option α) :\n casesOn' o (f none) (f ∘ (fun a ↦ ↑a)) = f o := by cases o <;> rfl\n\nlemma casesOn'_eq_elim (b : β) (f : α → β) (a : Option α) :\n Option.casesOn' a b f = Option.elim a b f := by cases a <;> rfl\n\ntheorem orElse_eq_some (o o' : Option α) (x : α) :\n (o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x := by\n simp\n\ntheorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none := by\n simp\n\nsection\n\ntheorem choice_eq_none (α : Type*) [IsEmpty α] : choice α = none :=\n choice_eq_none_iff_not_nonempty.mpr (not_nonempty_iff_imp_false.mpr isEmptyElim)\n\nend\n\n@[simp]\ntheorem elim_none_some (f : Option α → β) (i : Option α) : i.elim (f none) (f ∘ some) = f i := by\n cases i <;> rfl\n\ntheorem elim_comp (h : α → β) {f : γ → α} {x : α} {i : Option γ} :\n (i.elim (h x) fun j => h (f j)) = h (i.elim x f) := by cases i <;> rfl\n\ntheorem elim_comp₂ (h : α → β → γ) {f : γ → α} {x : α} {g : γ → β} {y : β}\n {i : Option γ} : (i.elim (h x y) fun j => h (f j) (g j)) = h (i.elim x f) (i.elim y g) := by\n cases i <;> rfl\n\nTarget:\ntheorem elim_apply {f : γ → α → β} {x : α → β} {i : Option γ} {y : α} :\n i.elim x f y = i.elim (x y) fun j => f j y :=\n\nProof body:\n","rejected":"Here is the proof:\nby rw [elim_comp fun f : α → β => f y]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Option","family_id":"elim_apply","file_id":"mathlib/Mathlib/Data/Option/Basic.lean","sample_id":"6c8fe76d7d5b9445f80fa88773e7e040dba76c83483359c8ece78cffd4125daa"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b83f8e53633557ef15104c4885ffde5051bcab86a979306f38a36ee85b75be6e","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"fdef19f5c540f223b81039bd2949a124d0c9f0906e3d3f8b5ac91dae3ad99a00","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"487f77b1863493c81889f1a380c67217647a0d5f1442c3add03b6ced0d3d199f","source_sha256":"4cbfaea4512194920684a45e4f0826b8ccc52fd008969fd599e2ede23bc90d0f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [continuous_iSup_dom]\n exact forall_congr' (fun i ↦ forall_congr'\n (fun f ↦ (by rw [continuous_coinduced_dom]; simp [equiv, Equiv.refl])))","hard_negative":true,"metrics":{"chosen_tokens":35,"rejected_tokens":3,"token_jaccard":0.086957,"token_length_ratio":0.085714},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"7546ca1343d132d9bb94b6c555c37b42e2828341c7de583f9be00e14d87c0552","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.ContinuousMap.Basic\n\nNamespace:\nTopology.WithGeneratedByTopology\n\nLocal context:\n/-\nCopyright (c) 2025 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou, Dagur Asgeirsson, Ben Eltschig\n-/\n/-!\n# The topology that is generated by a family of topological spaces\n\nLet `X : ι → Type u` be a family of topological spaces.\nLet `Y` be a topological space. We introduce a type synonym\n`WithGeneratedByTopology X Y` for `Y`. This type is endowed\nwith the `X`-generated topology, which is coinduced by\nall continuous maps `X i → Y`. When the bijection\n`WithGeneratedByTopology X Y ≃ Y` is a homeomorphism,\nwe say that `Y` is `X`-generated (typeclass `IsGeneratedBy X Y`).\n\n## TODO (@joelriou)\n* Redefine compactly generated spaces and delta generated spaces using\n these definitions\n* Define the category of `X`-generated spaces and show that it is coreflective in `TopCat`\n* Show that under suitable assumptions, the category of `X`-generated\n spaces is a closed cartesian monoidal category.\n\n## References\n* [Rainer M. Vogt, *Convenient categories of topological spaces\n for homotopy theory*][vogt-1971]\n* [Martín Escardó, Jimmie Lawson and Alex Simpson, *Comparing Cartesian closed\n categories of (core) compactly generated spaces*][escardo-lawson-simpson-2004]\n\n-/\n\n@[expose] public section\n\nuniverse v v' t u\n\nopen Topology\n\nvariable {ι : Type t} (X : ι → Type u) [∀ i, TopologicalSpace (X i)]\n {Y : Type v} [tY : TopologicalSpace Y] {Z : Type v'} [TopologicalSpace Z]\n\nnamespace TopologicalSpace\n\n/-- Given a family of topological spaces `X i`, the `X`-generated topology on\na topological space `Y` is the topology that is coinduced\nby all continuous maps `X i → Y`. -/\n@[implicit_reducible]\ndef generatedBy : TopologicalSpace Y :=\n ⨆ (i : ι) (f : C(X i, Y)), coinduced f inferInstance\n\n/-- The `X`-generated topology is also coinduced by a single map out of a sigma type. -/\nlemma generatedBy_eq_coinduced :\n generatedBy X (Y := Y) =\n coinduced (fun (x : (f : (i : ι) × C(X i, Y)) × X f.1) ↦ x.1.2 x.2) inferInstance := by\n rw [generatedBy, instTopologicalSpaceSigma, coinduced_iSup, iSup_sigma]\n rfl\n\nend TopologicalSpace\n\nvariable {X}\n\nnamespace Topology\n\n/-- Given a family of topological spaces `X i`, and a topological space `Y`,\nthis is a type synonym for `Y` which we endow with the `X`-generated topology. -/\n@[nolint unusedArguments]\ndef WithGeneratedByTopology (X : ι → Type u) [∀ i, TopologicalSpace (X i)]\n (Y : Type v) [TopologicalSpace Y] := Y\n\nnamespace WithGeneratedByTopology\n\n/-- The obvious bijection `WithGeneratedByTopology X Y ≃ Y`, where\nthe source is endowed with the `X`-generated topology. See `continuous_equiv`\nfor the continuity of `equiv`. The inverse map `equiv.symm` is continuous\niff `Y` is `X`-generated, see `isGeneratedBy_iff`. -/\ndef equiv : WithGeneratedByTopology X Y ≃ Y := Equiv.refl _\n\ninstance {Y : Type v} [TopologicalSpace Y] :\n TopologicalSpace (WithGeneratedByTopology X Y) :=\n -- fast_instance% .generatedBy X (Y := Y) fails\n letI : TopologicalSpace Y := .generatedBy X (Y := Y)\n inferInstanceAs <| TopologicalSpace Y\n\nset_option backward.isDefEq.respectTransparency false in\nlemma isOpen_iff {U : Set (WithGeneratedByTopology X Y)} :\n IsOpen U ↔ ∀ ⦃i : ι⦄ (f : C(X i, Y)), IsOpen (f ⁻¹' equiv.symm ⁻¹' U) := by\n simp [isOpen_iSup_iff, isOpen_coinduced, equiv, Equiv.refl]\n\nset_option backward.isDefEq.respectTransparency false in\nlemma isClosed_iff {U : Set (WithGeneratedByTopology X Y)} :\n IsClosed U ↔ ∀ ⦃i : ι⦄ (f : C(X i, Y)), IsClosed (f ⁻¹' equiv.symm ⁻¹' U) := by\n simp [isClosed_iSup_iff, isClosed_coinduced, equiv, Equiv.refl]\n\nset_option backward.isDefEq.respectTransparency false in\n\nTarget:\nlemma continuous_from_iff (g : WithGeneratedByTopology X Y → Z) :\n Continuous g ↔ ∀ ⦃i : ι⦄ (f : C(X i, Y)), Continuous (g ∘ equiv.symm ∘ f : X i → Z) :=\n\nProof body:\n","rejected":"by\n exact continuous_from_iff","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"7ddd806410f511e869c67ea6a22d3d7762d96cecbc12914d32587d5cb34da3fa","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Convenient","family_id":"continuous_from_iff","file_id":"mathlib/Mathlib/Topology/Convenient/GeneratedBy.lean","sample_id":"487f77b1863493c81889f1a380c67217647a0d5f1442c3add03b6ced0d3d199f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"80c6f3f1c03e3443ea332e065c3d8b8bfc34fc02cc2d451654028c2a3957e335","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"3c63506c658b72a6abfca37fa89938b25acc8c846fb7365e9de6b4369953e609","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"6fdad4d2ffe81718354610143a337f5eeb0e36697133ee4c8eca1fe5887abaeb","source_sha256":"50acf64242e7f5ba0eaecf90f2bb1d8dc0b0dc2be95b5ced05cba0f43f7fdac3","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← decompose_symm_of _, Equiv.apply_symm_apply]","hard_negative":false,"metrics":{"chosen_tokens":11,"rejected_tokens":15,"token_jaccard":0.785714,"token_length_ratio":1.363636},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"7765a98f9a556521b85d634f9056978237e90858dcfb767561d31c5632d2245b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.DirectSum.Module\npublic import Mathlib.Algebra.Module.Submodule.Basic\n\nNamespace:\nDirectSum\n\nLocal context:\n/-\nCopyright (c) 2022 Eric Wieser. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Eric Wieser, Jujian Zhang\n-/\n/-!\n# Decompositions of additive monoids, groups, and modules into direct sums\n\n## Main definitions\n\n* `DirectSum.Decomposition ℳ`: A typeclass to provide a constructive decomposition from\n an additive monoid `M` into a family of additive submonoids `ℳ`\n* `DirectSum.decompose ℳ`: The canonical equivalence provided by the above typeclass\n\n\n## Main statements\n\n* `DirectSum.Decomposition.isInternal`: The link to `DirectSum.IsInternal`.\n\n## Implementation details\n\nAs we want to talk about different types of decomposition (additive monoids, modules, rings, ...),\nwe choose to avoid heavily bundling `DirectSum.decompose`, instead making copies for the\n`AddEquiv`, `LinearEquiv`, etc. This means we have to repeat statements that follow from these\nbundled homs, but means we don't have to repeat statements for different types of decomposition.\n-/\n\n@[expose] public section\n\n\nvariable {ι R M σ : Type*}\n\nopen DirectSum\n\nnamespace DirectSum\n\nsection AddCommMonoid\n\nvariable [DecidableEq ι] [AddCommMonoid M]\nvariable [SetLike σ M] [AddSubmonoidClass σ M] (ℳ : ι → σ)\n\n/-- A decomposition is an equivalence between an additive monoid `M` and a direct sum of additive\nsubmonoids `ℳ i` of that `M`, such that the \"recomposition\" is canonical. This definition also\nworks for additive groups and modules.\n\nThis is a version of `DirectSum.IsInternal` which comes with a constructive inverse to the\ncanonical \"recomposition\" rather than just a proof that the \"recomposition\" is bijective.\n\nOften it is easier to construct a term of this type via `Decomposition.ofAddHom` or\n`Decomposition.ofLinearMap`. -/\nclass Decomposition where\n decompose' : M → ⨁ i, ℳ i\n left_inv : Function.LeftInverse (DirectSum.coeAddMonoidHom ℳ) decompose'\n right_inv : Function.RightInverse (DirectSum.coeAddMonoidHom ℳ) decompose'\n\n/-- `DirectSum.Decomposition` instances, while carrying data, are always equal. -/\ninstance : Subsingleton (Decomposition ℳ) :=\n ⟨fun x y ↦ by\n obtain ⟨_, _, xr⟩ := x\n obtain ⟨_, yl, _⟩ := y\n congr\n exact Function.LeftInverse.eq_rightInverse xr yl⟩\n\n/-- A convenience method to construct a decomposition from an `AddMonoidHom`, such that the proofs\nof left and right inverse can be constructed via `ext`. -/\nabbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i)\n (h_left_inv : (DirectSum.coeAddMonoidHom ℳ).comp decompose = .id _)\n (h_right_inv : decompose.comp (DirectSum.coeAddMonoidHom ℳ) = .id _) : Decomposition ℳ where\n decompose' := decompose\n left_inv := DFunLike.congr_fun h_left_inv\n right_inv := DFunLike.congr_fun h_right_inv\n\n/-- Noncomputably conjure a decomposition instance from a `DirectSum.IsInternal` proof. -/\n@[implicit_reducible]\nnoncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) :\n DirectSum.Decomposition ℳ where\n decompose' := (Equiv.ofBijective _ h).symm\n left_inv := (Equiv.ofBijective _ h).right_inv\n right_inv := (Equiv.ofBijective _ h).left_inv\n\nvariable [Decomposition ℳ]\n\nprotected theorem Decomposition.isInternal : DirectSum.IsInternal ℳ :=\n ⟨Decomposition.right_inv.injective, Decomposition.left_inv.surjective⟩\n\n/-- If `M` is graded by `ι` with degree `i` component `ℳ i`, then it is isomorphic as\nto a direct sum of components. This is the canonical spelling of the `decompose'` field. -/\ndef decompose : M ≃ ⨁ i, ℳ i where\n toFun := Decomposition.decompose'\n invFun := DirectSum.coeAddMonoidHom ℳ\n left_inv := Decomposition.left_inv\n right_inv := Decomposition.right_inv\n\nomit [AddSubmonoidClass σ M] in\n/-- A substructure `p ⊆ M` is homogeneous if for every `m ∈ p`, all homogeneous components\n of `m` are in `p`. -/\ndef SetLike.IsHomogeneous {P : Type*} [SetLike P M] (p : P) : Prop :=\n ∀ (i : ι) ⦃m : M⦄, m ∈ p → (DirectSum.decompose ℳ m i : M) ∈ p\n\n@[elab_as_elim]\nprotected theorem Decomposition.inductionOn {motive : M → Prop} (zero : motive 0)\n (homogeneous : ∀ {i} (m : ℳ i), motive (m : M))\n (add : ∀ m m' : M, motive m → motive m' → motive (m + m')) : ∀ m, motive m := by\n let ℳ' : ι → AddSubmonoid M := fun i ↦\n (⟨⟨ℳ i, fun x y ↦ AddMemClass.add_mem x y⟩, (ZeroMemClass.zero_mem _)⟩ : AddSubmonoid M)\n haveI t : DirectSum.Decomposition ℳ' :=\n { decompose' := DirectSum.decompose ℳ\n left_inv := fun _ ↦ (decompose ℳ).left_inv _\n right_inv := fun _ ↦ (decompose ℳ).right_inv _ }\n have mem : ∀ m, m ∈ iSup ℳ' := fun _m ↦\n (DirectSum.IsInternal.addSubmonoid_iSup_eq_top ℳ' (Decomposition.isInternal ℳ')).symm ▸ trivial\n -- Porting note: needs to use @ even though no implicit argument is provided\n exact fun m ↦ @AddSubmonoid.iSup_induction _ _ _ ℳ' _ _ (mem m)\n (fun i m h ↦ homogeneous ⟨m, h⟩) zero add\n-- exact fun m ↦\n-- AddSubmonoid.iSup_induction ℳ' (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add\n\n@[simp]\ntheorem Decomposition.decompose'_eq : Decomposition.decompose' = decompose ℳ := rfl\n\n@[simp]\ntheorem decompose_symm_of {i : ι} (x : ℳ i) : (decompose ℳ).symm (DirectSum.of _ i x) = x :=\n DirectSum.coeAddMonoidHom_of ℳ _ _\n\n@[simp]\n\nTarget:\ntheorem decompose_coe {i : ι} (x : ℳ i) : decompose ℳ (x : M) = DirectSum.of _ i x :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n rw [← decompose_symm_of _, Equiv.apply_symm_apply]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/DirectSum","family_id":"decompose_coe","file_id":"mathlib/Mathlib/Algebra/DirectSum/Decomposition.lean","sample_id":"6fdad4d2ffe81718354610143a337f5eeb0e36697133ee4c8eca1fe5887abaeb"},"split":"validation"} {"binding":{"chosen_proof_sha256":"3383ebb0329b7960caad6f2c85d824f9357853fa6469e3040a3b6e0669cd33e8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"452ea3f5e3b412854111f6a07005944668a10b2a6b6b1d25585672f9dbcfeb3a","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4a382e437502a9bb0307e27b749e96cfdbb0864b5f7a450aafd30eb1aef16a23","source_sha256":"35229697683d4b1be4d41972c9213be8e6e9f0f207028d46330db6ff5671f9c3","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n ext k\n by_cases h : k = c.index j\n · rw [h]\n let r : Fin (c.blocksFun (c.index j)) → Fin n := c.embedding (c.index j)\n simp only [Function.update_self]\n change p (c.blocksFun (c.index j)) (Function.update v j z ∘ r) = _\n let j' := c.invEmbedding j\n suffices B : Function.update v j z ∘ r = Function.update (v ∘ r) j' z by rw [B]\n suffices C : Function.update v (r j') z ∘ r = Function.update (v ∘ r) j' z by\n convert! C; exact (c.embedding_comp_inv j).symm\n exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _\n · simp only [h, Function.update_of_ne, Ne, not_false_iff]\n let r : Fin (c.blocksFun k) → Fin n := c.embedding k\n change p (c.blocksFun k) (Function.update v j z ∘ r) = p (c.blocksFun k) (v ∘ r)\n suffices B : Function.update v j z ∘ r = v ∘ r by rw [B]\n apply Function.update_comp_eq_of_notMem_range\n rwa [c.mem_range_embedding_iff']","hard_negative":false,"metrics":{"chosen_tokens":258,"rejected_tokens":263,"token_jaccard":0.934426,"token_length_ratio":1.01938},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"776cc7bd213a059d98e45b6590ce9660b0cb6338668951d756319582e9dfdd88","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Analytic.Basic\npublic import Mathlib.Analysis.Analytic.CPolynomialDef\npublic import Mathlib.Combinatorics.Enumerative.Composition\n\nNamespace:\nFormalMultilinearSeries\n\nLocal context:\n/-\nCopyright (c) 2020 Sébastien Gouëzel. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Sébastien Gouëzel, Johan Commelin\n-/\n/-!\n# Composition of analytic functions\n\nIn this file we prove that the composition of analytic functions is analytic.\n\nThe argument is the following. Assume `g z = ∑' qₙ (z, ..., z)` and `f y = ∑' pₖ (y, ..., y)`. Then\n\n`g (f y) = ∑' qₙ (∑' pₖ (y, ..., y), ..., ∑' pₖ (y, ..., y))\n= ∑' qₙ (p_{i₁} (y, ..., y), ..., p_{iₙ} (y, ..., y))`.\n\nFor each `n` and `i₁, ..., iₙ`, define a `i₁ + ... + iₙ` multilinear function mapping\n`(y₀, ..., y_{i₁ + ... + iₙ - 1})` to\n`qₙ (p_{i₁} (y₀, ..., y_{i₁-1}), p_{i₂} (y_{i₁}, ..., y_{i₁ + i₂ - 1}), ..., p_{iₙ} (....)))`.\nThen `g ∘ f` is obtained by summing all these multilinear functions.\n\nTo formalize this, we use compositions of an integer `N`, i.e., its decompositions into\na sum `i₁ + ... + iₙ` of positive integers. Given such a composition `c` and two formal\nmultilinear series `q` and `p`, let `q.compAlongComposition p c` be the above multilinear\nfunction. Then the `N`-th coefficient in the power series expansion of `g ∘ f` is the sum of these\nterms over all `c : Composition N`.\n\nTo complete the proof, we need to show that this power series has a positive radius of convergence.\nThis follows from the fact that `Composition N` has cardinality `2^(N-1)` and estimates on\nthe norm of `qₙ` and `pₖ`, which give summability. We also need to show that it indeed converges to\n`g ∘ f`. For this, we note that the composition of partial sums converges to `g ∘ f`, and that it\ncorresponds to a part of the whole sum, on a subset that increases to the whole space. By\nsummability of the norms, this implies the overall convergence.\n\n## Main results\n\n* `q.comp p` is the formal composition of the formal multilinear series `q` and `p`.\n* `HasFPowerSeriesAt.comp` states that if two functions `g` and `f` admit power series expansions\n `q` and `p`, then `g ∘ f` admits a power series expansion given by `q.comp p`.\n* `AnalyticAt.comp` states that the composition of analytic functions is analytic.\n* `FormalMultilinearSeries.comp_assoc` states that composition is associative on formal\n multilinear series.\n\n## Implementation details\n\nThe main technical difficulty is to write down things. In particular, we need to define precisely\n`q.compAlongComposition p c` and to show that it is indeed a continuous multilinear\nfunction. This requires a whole interface built on the class `Composition`. Once this is set,\nthe main difficulty is to reorder the sums, writing the composition of the partial sums as a sum\nover some subset of `Σ n, Composition n`. We need to check that the reordering is a bijection,\nrunning over difficulties due to the dependent nature of the types under consideration, that are\ncontrolled thanks to the interface for `Composition`.\n\nThe associativity of composition on formal multilinear series is a nontrivial result: it does not\nfollow from the associativity of composition of analytic functions, as there is no uniqueness for\nthe formal multilinear series representing a function (and also, it holds even when the radius of\nconvergence of the series is `0`). Instead, we give a direct proof, which amounts to reordering\ndouble sums in a careful way. The change of variables is a canonical (combinatorial) bijection\n`Composition.sigmaEquivSigmaPi` between `(Σ (a : Composition n), Composition a.length)` and\n`(Σ (c : Composition n), Π (i : Fin c.length), Composition (c.blocksFun i))`, and is described\nin more details below in the paragraph on associativity.\n-/\n\n@[expose] public section\n\n\nnoncomputable section\n\nvariable {𝕜 : Type*} {E F G H : Type*}\n\nopen Filter List\n\nopen scoped Topology NNReal ENNReal\n\nsection Topological\n\nvariable [CommRing 𝕜] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]\nvariable [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 G]\nvariable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]\n\n/-! ### Composing formal multilinear series -/\n\n\nnamespace FormalMultilinearSeries\n\nvariable [IsTopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]\nvariable [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]\nvariable [IsTopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]\n\n/-!\nIn this paragraph, we define the composition of formal multilinear series, by summing over all\npossible compositions of `n`.\n-/\n\n\n/-- Given a formal multilinear series `p`, a composition `c` of `n` and the index `i` of a\nblock of `c`, we may define a function on `Fin n → E` by picking the variables in the `i`-th block\nof `n`, and applying the corresponding coefficient of `p` to these variables. This function is\ncalled `p.applyComposition c v i` for `v : Fin n → E` and `i : Fin c.length`. -/\ndef applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n) :\n (Fin n → E) → Fin c.length → F := fun v i => p (c.blocksFun i) (v ∘ c.embedding i)\n\ntheorem applyComposition_ones (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :\n p.applyComposition (Composition.ones n) = fun v i =>\n p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by\n funext v i\n apply p.congr (Composition.ones_blocksFun _ _)\n intro j hjn hj1\n obtain rfl : j = 0 := by lia\n refine congr_arg v ?_\n rw [Fin.ext_iff, Fin.val_castLE, Composition.ones_embedding, Fin.val_mk]\n\ntheorem applyComposition_single (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : 0 < n)\n (v : Fin n → E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by\n ext j\n refine p.congr (by simp) fun i hi1 hi2 => ?_\n dsimp\n congr 1\n convert! Composition.single_embedding hn ⟨i, hi2⟩ using 1\n obtain ⟨j_val, j_property⟩ := j\n have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)\n rw! [this]\n rfl\n\n@[simp]\ntheorem removeZero_applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}\n (c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by\n ext v i\n simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]\n\n/-- Technical lemma stating how `p.applyComposition` commutes with updating variables. This\nwill be the key point to show that functions constructed from `applyComposition` retain\nmultilinearity. -/\n\nTarget:\ntheorem applyComposition_update (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n)\n (j : Fin n) (v : Fin n → E) (z : E) :\n p.applyComposition c (Function.update v j z) =\n Function.update (p.applyComposition c v) (c.index j)\n (p (c.blocksFun (c.index j))\n (Function.update (v ∘ c.embedding (c.index j)) (c.invEmbedding j) z)) :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n ext k\n by_cases h : k = c.index j\n · rw [h]\n let r : Fin (c.blocksFun (c.index j)) → Fin n := c.embedding (c.index j)\n simp only [Function.update_self]\n change p (c.blocksFun (c.index j)) (Function.update v j z ∘ r) = _\n let j' := c.invEmbedding j\n suffices B : Function.update v j z ∘ r = Function.update (v ∘ r) j' z by rw [B]\n suffices C : Function.update v (r j') z ∘ r = Function.update (v ∘ r) j' z by\n convert! C; exact (c.embedding_comp_inv j).symm\n exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _\n · simp only [h, Function.update_of_ne, Ne, not_false_iff]\n let r : Fin (c.blocksFun k) → Fin n := c.embedding k\n change p (c.blocksFun k) (Function.update v j z ∘ r) = p (c.blocksFun k) (v ∘ r)\n suffices B : Function.update v j z ∘ r = v ∘ r by rw [B]\n apply Function.update_comp_eq_of_notMem_range\n rwa [c.mem_range_embedding_iff']","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Analytic","family_id":"applycomposition_update","file_id":"mathlib/Mathlib/Analysis/Analytic/Composition.lean","sample_id":"4a382e437502a9bb0307e27b749e96cfdbb0864b5f7a450aafd30eb1aef16a23"},"split":"validation"} {"binding":{"chosen_proof_sha256":"de7dcb88ac5477054e22f4d402bca4115ad00d477cba6c6b783c7b48c6413e81","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4f1cb43e0c809a92fb375322321196497fb45ce5842c8b3824f891867413aabe","source_sha256":"d4f13835575c5d19e0669c1711e5cdd9ebe1612a72ec57a0896bb8957095a385","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp [closure_eq_cluster_pts, ClusterPt, ← exists_ultrafilter_iff, and_comm]","hard_negative":false,"metrics":{"chosen_tokens":12,"rejected_tokens":5,"token_jaccard":0.071429,"token_length_ratio":0.416667},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"7ea9d6f76e0395267e513a9e5f9e650aba911384bae10950c6e123e60ff14303","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Order.Filter.Ultrafilter.Basic\npublic import Mathlib.Topology.Continuous\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2017 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Mario Carneiro, Jeremy Avigad\n-/\n/-! # Characterization of basic topological properties in terms of ultrafilters -/\n\npublic section\n\nopen Set Filter Topology\n\nuniverse u v w x\n\nvariable {X : Type u} {Y : Type v} {ι : Sort w} {α β : Type*} {x : X} {s s₁ s₂ t : Set X}\n {p p₁ p₂ : X → Prop} [TopologicalSpace X] [TopologicalSpace Y] {F : Filter α} {u : α → X}\n\ntheorem Ultrafilter.clusterPt_iff {f : Ultrafilter X} : ClusterPt x f ↔ ↑f ≤ 𝓝 x :=\n ⟨f.le_of_inf_neBot', fun h => ClusterPt.of_le_nhds h⟩\n\ntheorem clusterPt_iff_ultrafilter {f : Filter X} : ClusterPt x f ↔\n ∃ u : Ultrafilter X, u ≤ f ∧ u ≤ 𝓝 x := by\n simp_rw [ClusterPt, ← le_inf_iff, exists_ultrafilter_iff, inf_comm]\n\ntheorem mapClusterPt_iff_ultrafilter :\n MapClusterPt x F u ↔ ∃ U : Ultrafilter α, U ≤ F ∧ Tendsto u U (𝓝 x) := by\n simp_rw [MapClusterPt, ClusterPt, ← Filter.push_pull', map_neBot_iff, tendsto_iff_comap,\n ← le_inf_iff, exists_ultrafilter_iff, inf_comm]\n\ntheorem isOpen_iff_ultrafilter :\n IsOpen s ↔ ∀ x ∈ s, ∀ (l : Ultrafilter X), ↑l ≤ 𝓝 x → s ∈ l := by\n simp_rw [isOpen_iff_mem_nhds, ← mem_iff_ultrafilter]\n\n/-- `x` belongs to the closure of `s` if and only if some ultrafilter\n supported on `s` converges to `x`. -/\n\nTarget:\ntheorem mem_closure_iff_ultrafilter :\n x ∈ closure s ↔ ∃ u : Ultrafilter X, s ∈ u ∧ ↑u ≤ 𝓝 x :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology","family_id":"mem_closure_iff_ultrafilter","file_id":"mathlib/Mathlib/Topology/Ultrafilter.lean","sample_id":"4f1cb43e0c809a92fb375322321196497fb45ce5842c8b3824f891867413aabe"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1fae15e34064bf8ae673e8fec62409b09ae3c381e55cd7a1a8df15ff0a7a2c98","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9e18c70ea34b4ec81845e3c0ef54e74401da5ac65b1bc2968babe79bad1f9db2","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8b4458963958caea7284c3b37c020627fee1b32d3d574c8e6e6d2422ef2fc8b5","source_sha256":"5843500cd428a65c65e242734937e92c0f0b5d9024ddf9d8f2d0ee127d9aacac","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [Topology.IsInducing.continuous_iff (autEmbedding_isClosedEmbedding _).isInducing,\n continuous_pi_iff]\n intro X\n change Continuous fun a ↦ G.mapAut (F.obj X) (autEmbedding F a X)\n fun_prop\n\n/-- If `G` is a fully faithful functor of categories finite types, this is the automorphism of\ntopological groups `Aut F ≃ Aut (F ⋙ G)`. -/\nnoncomputable def autEquivAutWhiskerRight {G : FintypeCat.{w} ⥤ FintypeCat.{v}}\n (h : G.FullyFaithful) :\n Aut F ≃ₜ* Aut (F ⋙ G) where\n __ := (h.whiskeringRight C).autMulEquivOfFullyFaithful F\n continuous_toFun := continuous_mapAut_whiskeringRight F G\n continuous_invFun := Continuous.continuous_symm_of_equiv_compact_to_t2\n (f := ((h.whiskeringRight C).autMulEquivOfFullyFaithful F).toEquiv)\n (continuous_mapAut_whiskeringRight F G)\n\nvariable [GaloisCategory C] [FiberFunctor F]","hard_negative":true,"metrics":{"chosen_tokens":168,"rejected_tokens":2,"token_jaccard":0.012821,"token_length_ratio":0.011905},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"808c5002c2c0caffe53f7d3e03ee64055adcc3fc8d69c667cbe1ec86ca264c85","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Galois.Prorepresentability\npublic import Mathlib.Topology.Algebra.ContinuousMonoidHom\npublic import Mathlib.Topology.Algebra.Group.Basic\n\nNamespace:\nCategoryTheory.PreGaloisCategory\n\nLocal context:\n/-\nCopyright (c) 2024 Christian Merten. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Christian Merten\n-/\n/-!\n\n# Topology of fundamental group\n\nIn this file we define a natural topology on the automorphism group of a functor\n`F : C ⥤ FintypeCat`: It is defined as the subspace topology induced by the natural\nembedding of `Aut F` into `∀ X, Aut (F.obj X)` where\n`Aut (F.obj X)` carries the discrete topology.\n\n## References\n\n- [Stacks 0BMQ](https://stacks.math.columbia.edu/tag/0BMQ)\n\n-/\n\n@[expose] public section\n\nopen Topology\n\nuniverse u₁ u₂ v₁ v₂ v w\n\nnamespace CategoryTheory\n\nnamespace PreGaloisCategory\n\nopen Functor\n\nvariable {C : Type u₁} [Category.{u₂} C] (F : C ⥤ FintypeCat.{w})\n\n/-- For a functor `F : C ⥤ FintypeCat`, the canonical embedding of `Aut F` into\nthe product over `Aut (F.obj X)` for all objects `X`. -/\ndef autEmbedding : Aut F →* ∀ X, Aut (F.obj X) :=\n MonoidHom.mk' (fun σ X ↦ σ.app X) (fun _ _ ↦ rfl)\n\n@[simp]\nlemma autEmbedding_apply (σ : Aut F) (X : C) : autEmbedding F σ X = σ.app X :=\n rfl\n\nlemma autEmbedding_injective : Function.Injective (autEmbedding F) := by\n intro σ τ h\n ext X x\n have : σ.app X = τ.app X := congr_fun h X\n rw [← Iso.app_hom, ← Iso.app_hom, this]\n\n/-- We put the discrete topology on `F.obj X`. -/\nscoped instance (X : C) : TopologicalSpace (F.obj X) := ⊥\n\n@[scoped instance]\nlemma obj_discreteTopology (X : C) : DiscreteTopology (F.obj X) := ⟨rfl⟩\n\n/-- We put the discrete topology on `Aut (F.obj X)`. -/\nscoped instance (X : C) : TopologicalSpace (Aut (F.obj X)) := ⊥\n\n/-- We give `F.obj X ⟶ F.obj Y` the product topology. -/\n@[local simp]\nscoped instance {X Y : C} : TopologicalSpace (F.obj X ⟶ F.obj Y) :=\n .coinduced (fun f ↦ ObjectProperty.homMk (↾f)) inferInstance\n\nscoped instance {X Y : C} : DiscreteTopology (F.obj X ⟶ F.obj Y) :=\n ⟨by simp [DiscreteTopology.eq_bot]⟩\n\n@[scoped instance]\nlemma aut_discreteTopology (X : C) : DiscreteTopology (Aut (F.obj X)) := ⟨rfl⟩\n\n/-- `Aut F` is equipped with the by the embedding into `∀ X, Aut (F.obj X)` induced embedding. -/\ninstance : TopologicalSpace (Aut F) :=\n TopologicalSpace.induced (autEmbedding F) inferInstance\n\n/-lemma autEmbedding_range :\n Set.range (autEmbedding F) =\n ⋂ (f : Arrow C), { a | F.map f.hom ≫ (a f.right).hom = (a f.left).hom ≫ F.map f.hom } := by\n ext a\n simp only [Set.mem_range, id_obj, Set.mem_iInter, Set.mem_setOf_eq]\n refine ⟨fun ⟨σ, h⟩ i ↦ h.symm ▸ σ.hom.naturality i.hom, fun h ↦ ?_⟩\n · use NatIso.ofComponents a (fun {X Y} f ↦ h ⟨X, Y, f⟩)\n rfl-/\n\n/-- The image of `Aut F` in `∀ X, Aut (F.obj X)` are precisely the compatible families of\nautomorphisms. -/\nlemma autEmbedding_range :\n Set.range (autEmbedding F) = ⋂ (f : Arrow C), { a | F.map f.hom ≫ (a f.right).hom =\n (a f.left).hom ≫ F.map f.hom } := by\n ext a\n simp +instances only [Set.mem_range, Set.mem_iInter, Set.mem_setOf_eq]\n refine ⟨fun ⟨σ, h⟩ i ↦ by cat_disch, fun h ↦ ?_⟩\n exact ⟨NatIso.ofComponents a (fun {X Y} f ↦ by\n ext; simpa using ConcreteCategory.congr_hom (h ⟨X, Y, f⟩) _), rfl⟩\n\n/-- The image of `Aut F` in `∀ X, Aut (F.obj X)` is closed. -/\nlemma autEmbedding_range_isClosed : IsClosed (Set.range (autEmbedding F)) := by\n rw [autEmbedding_range]\n exact isClosed_iInter (fun f ↦ isClosed_eq (by fun_prop) (by fun_prop))\n\nlemma autEmbedding_isClosedEmbedding : IsClosedEmbedding (autEmbedding F) where\n eq_induced := rfl\n injective := autEmbedding_injective F\n isClosed_range := autEmbedding_range_isClosed F\n\ninstance : CompactSpace (Aut F) := (autEmbedding_isClosedEmbedding F).compactSpace\n\ninstance : T2Space (Aut F) :=\n T2Space.of_injective_continuous (autEmbedding_injective F) continuous_induced_dom\n\ninstance : TotallyDisconnectedSpace (Aut F) :=\n (autEmbedding_isClosedEmbedding F).isEmbedding.isTotallyDisconnected_range.mp\n (isTotallyDisconnected_of_totallyDisconnectedSpace _)\n\ninstance : ContinuousMul (Aut F) :=\n (autEmbedding_isClosedEmbedding F).isInducing.continuousMul (autEmbedding F)\n\ninstance : ContinuousInv (Aut F) :=\n (autEmbedding_isClosedEmbedding F).isInducing.continuousInv fun _ ↦ rfl\n\ninstance : IsTopologicalGroup (Aut F) := ⟨⟩\n\ninstance (X : C) : SMul (Aut (F.obj X)) (F.obj X) := ⟨fun σ a => σ.hom a⟩\n\ninstance (X : C) : ContinuousSMul (Aut (F.obj X)) (F.obj X) := by\n constructor\n fun_prop\n\ninstance continuousSMul_aut_fiber (X : C) : ContinuousSMul (Aut F) (F.obj X) where\n continuous_smul := by\n let g : Aut (F.obj X) × F.obj X → F.obj X := fun ⟨σ, x⟩ ↦ σ.hom x\n let h (q : Aut F × F.obj X) : Aut (F.obj X) × F.obj X :=\n ⟨((fun p ↦ p X) ∘ autEmbedding F) q.1, q.2⟩\n change Continuous (g ∘ h)\n fun_prop\n\n/-- If `G` is a functor of categories of finite types, the induced map `Aut F → Aut (F ⋙ G)` is\ncontinuous. -/\n\nTarget:\nlemma continuous_mapAut_whiskeringRight (G : FintypeCat.{w} ⥤ FintypeCat.{v}) :\n Continuous (((whiskeringRight _ _ _).obj G).mapAut F) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_8b4458963958","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"7c7ef57fbb9a72bead9a90a4c0a1bb0c10e3c387b4fdd7c944409a5ed69d3921","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Galois","family_id":"continuous_mapaut_whiskeringright","file_id":"mathlib/Mathlib/CategoryTheory/Galois/Topology.lean","sample_id":"8b4458963958caea7284c3b37c020627fee1b32d3d574c8e6e6d2422ef2fc8b5"},"split":"validation"} {"binding":{"chosen_proof_sha256":"e67fa3c9f84e8cadae9ede73693532e673b71771aa7cbd3886799839cb8caa1b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8f2fe4411145b1604f3a1ee7e9c9f3ff839de680c49d18ca6cbe243372e5e7e3","source_sha256":"019a3efb9bf01184ab20cec983f14c924240760bdbf7e2ba56314e6375b9dddb","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n split_ifs with h\n · simp only [supNorm, gaussNorm, h, ↓reduceDIte, one_pow, mul_one, Function.comp_apply]\n congr\n · simp [supNorm, gaussNorm, h]","hard_negative":true,"metrics":{"chosen_tokens":35,"rejected_tokens":8,"token_jaccard":0.038462,"token_length_ratio":0.228571},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"812e1d264efbcfb186b6d23bd7d5093ac055a6d1fb6ccc1e86400464094b515f","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Polynomial.GaussNorm\npublic import Mathlib.Analysis.Normed.Unbundled.RingSeminorm\npublic import Mathlib.Algebra.Order.Hom.Basic\n\nNamespace:\nPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Kevin H. Wilson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kevin H. Wilson\n-/\n/-!\n# Sup Norm of Polynomials\n\nIn this file we define the sup norm on `Polynomial`s based on their coefficients as well as several\nbasic results about this norm. We note that this is often called the _(naive) height_ of the\npolynomial in the literature.\n\nThe sup norm is related to the Mahler measure of the polynomial. See\n`Mathlib/Analysis/Polynomial/MahlerMeasure.lean`.\n\n## Main definitions\n\n- `Polynomial.supNorm p`: the sup norm of the coefficients of the polynomial, equal to the\n maximum of the norm of its coefficients (or zero for the zero polynomial)\n\n## A Note on Naming\n\nIn the literature, the sup norm is often called the _(naive) height_ of a polynomial and the\n`l^1` norm is often called the _length_ of the polynomial. Unfortunately, these terms are\nextremely overloaded and Mathlib defines _height_ differently.\n\n### TODOs\n\nAll other `l^p` norms can be defined on Polynomials as well. In the literature, the `l^1` norm is\nsometimes called the polynomial's _length_. The `l^2` norm sometimes arises due to Parseval's\ntheorem implying that the squared `l^2` norm of a complex polynomial is the integral of the norm of\nthe polynomial's value on the unit circle.\n-/\n\n\n@[expose] public section supnorm_seminorm\n\nvariable {A : Type*} [SeminormedRing A] (p : Polynomial A)\n\nnamespace Polynomial\n\n/-- The sup norm of a polynomial on a semi-normed ring, defined as the maximum of its coefficients.\nOften called the _(naive) height_ of the polynomial.\n\nThis is defined in terms of `Polynomial.gaussNorm`. -/\nnoncomputable def supNorm : ℝ := p.gaussNorm (SeminormedRing.toRingSeminorm A) 1\n\n/-- The direct definition of the supNorm -/\n\nTarget:\nlemma supNorm_def' : p.supNorm =\n if hp : p.support.Nonempty then p.support.sup' hp (norm ∘ p.coeff) else 0 :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"25a01ea3da8e9738a0d064394af48e7e57df628ad07793eb0e8403e6d572a0ef","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Polynomial","family_id":"supnorm_def","file_id":"mathlib/Mathlib/Analysis/Polynomial/Norm.lean","sample_id":"8f2fe4411145b1604f3a1ee7e9c9f3ff839de680c49d18ca6cbe243372e5e7e3"},"split":"validation"} {"binding":{"chosen_proof_sha256":"414dfd8713f03aa030cad377ecd27c0cf1b7c477f283b0f6317a8abed1f4232f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"feb5fd7b4e023e54121cee437cf5d269c26e742bc4f204daf39fec6a945fa315","source_sha256":"81f683fc149322018a098af754168365ec7fb0f23809135ec5dd229fe217bed2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨n, hn : ∀ m, n ≤ m → LinearMap.range (f ^ n) = LinearMap.range (f ^ m)⟩ :=\n IsArtinian.monotone_stabilizes f.iterateRange\n refine eventually_atTop.mpr ⟨n, fun l hl ↦ le_antisymm (iInf_le _ _) (le_iInf fun m ↦ ?_)⟩\n rcases le_or_gt l m with h | h\n · rw [← hn _ (hl.trans h), hn _ hl]\n · exact f.iterateRange.monotone h.le","hard_negative":false,"metrics":{"chosen_tokens":100,"rejected_tokens":3,"token_jaccard":0.039216,"token_length_ratio":0.03},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"81d36260a848380bae2e85f1f8c785096f58c8d33e750c341872c301ffd3cfbf","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Units.Opposite\npublic import Mathlib.Algebra.Regular.Opposite\npublic import Mathlib.Data.SetLike.Fintype\npublic import Mathlib.LinearAlgebra.FreeModule.Finite.Basic\npublic import Mathlib.Order.Filter.EventuallyConst\npublic import Mathlib.RingTheory.Artinian.Defs\npublic import Mathlib.RingTheory.Ideal.Prod\npublic import Mathlib.RingTheory.Ideal.Quotient.Operations\npublic import Mathlib.RingTheory.Jacobson.Semiprimary\npublic import Mathlib.RingTheory.Nilpotent.Lemmas\npublic import Mathlib.RingTheory.Noetherian.Defs\npublic import Mathlib.RingTheory.Spectrum.Maximal.Basic\npublic import Mathlib.RingTheory.Spectrum.Prime.Basic\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\nCopyright (c) 2021 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Artinian rings and modules\n\nA module satisfying these equivalent conditions is said to be an *Artinian* R-module\nif every decreasing chain of submodules is eventually constant, or equivalently,\nif the relation `<` on submodules is well founded.\n\nA ring is said to be left (or right) Artinian if it is Artinian as a left (or right) module over\nitself, or simply Artinian if it is both left and right Artinian.\n\n## Main results\n\n* `IsArtinianRing.primeSpectrum_finite`, `IsArtinianRing.isMaximal_of_isPrime`: there are only\n finitely prime ideals in a commutative Artinian ring, and each of them is maximal.\n\n* `IsArtinianRing.equivPi`: a reduced commutative Artinian ring `R` is isomorphic to a finite\n product of fields (and therefore is a semisimple ring and a decomposition monoid; moreover\n `R[X]` is also a decomposition monoid).\n\n* `IsArtinian.isSemisimpleModule_iff_jacobson`: an Artinian module is semisimple\n iff its Jacobson radical is zero.\n\n* `instIsSemiprimaryRingOfIsArtinianRing`: an Artinian ring `R` is semiprimary, in particular\n the Jacobson radical of `R` is a nilpotent ideal (`IsArtinianRing.isNilpotent_jacobson_bot`).\n\n## References\n\n* [M. F. Atiyah and I. G. Macdonald, *Introduction to commutative algebra*][atiyah-macdonald]\n* [P. Samuel, *Algebraic Theory of Numbers*][samuel1967]\n\n## Tags\n\nArtinian, artinian, Artinian ring, Artinian module, artinian ring, artinian module\n\n-/\n\n@[expose] public section\n\nopen Set Filter Pointwise\n\nsection Semiring\n\nvariable {R M P N : Type*}\nvariable [Semiring R] [AddCommMonoid M] [AddCommMonoid P] [AddCommMonoid N]\nvariable [Module R M] [Module R P] [Module R N]\n\ntheorem LinearMap.isArtinian_iff_of_bijective {S P} [Semiring S] [AddCommMonoid P] [Module S P]\n {σ : R →+* S} [RingHomSurjective σ] (l : M →ₛₗ[σ] P) (hl : Function.Bijective l) :\n IsArtinian R M ↔ IsArtinian S P :=\n let e := Submodule.orderIsoMapComapOfBijective l hl\n ⟨fun _ ↦ e.symm.strictMono.wellFoundedLT, fun _ ↦ e.strictMono.wellFoundedLT⟩\n\ntheorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] :\n IsArtinian R M :=\n ⟨Subrelation.wf\n (fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB)\n (InvImage.wf (Submodule.map f) IsWellFounded.wf)⟩\n\ninstance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N :=\n isArtinian_of_injective N.subtype Subtype.val_injective\n\ntheorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s :=\n isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h)\n\nvariable (M) in\ntheorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] :\n IsArtinian R P :=\n ⟨Subrelation.wf\n (fun {A B} hAB =>\n show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB)\n (InvImage.wf (Submodule.comap f) IsWellFounded.wf)⟩\n\n/--\nIf `M` is an Artinian `R` module, and `S` is an `R`-algebra with a surjective\nalgebra map, then `M` is an Artinian `S` module.\n-/\ntheorem isArtinian_of_surjective_algebraMap {S : Type*} [CommSemiring S] [Algebra S R]\n [Module S M] [IsArtinian R M] [IsScalarTower S R M]\n (H : Function.Surjective (algebraMap S R)) : IsArtinian S M := by\n apply (OrderEmbedding.wellFoundedLT (β := Submodule R M))\n refine ⟨⟨?_, ?_⟩, ?_⟩\n · intro N\n refine { toAddSubmonoid := N.toAddSubmonoid, smul_mem' := ?_ }\n intro c x hx\n obtain ⟨r, rfl⟩ := H c\n suffices r • x ∈ N by simpa [Algebra.algebraMap_eq_smul_one, smul_assoc]\n apply N.smul_mem _ hx\n · intro N1 N2 h\n rwa [Submodule.ext_iff] at h ⊢\n · intro N1 N2\n rfl\n\ninstance isArtinian_range (f : M →ₗ[R] P) [IsArtinian R M] : IsArtinian R (LinearMap.range f) :=\n isArtinian_of_surjective _ _ f.surjective_rangeRestrict\n\ntheorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P :=\n isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective\n\ntheorem LinearEquiv.isArtinian_iff (f : M ≃ₗ[R] P) : IsArtinian R M ↔ IsArtinian R P :=\n ⟨fun _ ↦ isArtinian_of_linearEquiv f, fun _ ↦ isArtinian_of_linearEquiv f.symm⟩\n\n-- This was previously a global instance,\n-- but it doesn't appear to be used and has been implicated in slow typeclass resolutions.\nlemma isArtinian_of_finite [Finite M] : IsArtinian R M :=\n ⟨Finite.wellFounded_of_trans_of_irrefl _⟩\n\nopen Submodule\n\ntheorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [h : IsArtinian R M] {s : Set M}\n (hs : LinearIndependent R ((↑) : s → M)) : s.Finite :=\n WellFoundedLT.finite_of_iSupIndep hs.iSupIndep_span_singleton fun i _ ↦ hs.ne_zero i (by simp_all)\n\n/-- A module is Artinian iff every nonempty set of submodules has a minimal submodule among them. -/\ntheorem set_has_minimal_iff_artinian :\n (∀ a : Set <| Submodule R M, a.Nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬I < M') ↔ IsArtinian R M := by\n rw [isArtinian_iff, WellFounded.wellFounded_iff_has_min]\n\ntheorem IsArtinian.set_has_minimal [IsArtinian R M] (a : Set <| Submodule R M) (ha : a.Nonempty) :\n ∃ M' ∈ a, ∀ I ∈ a, ¬I < M' :=\n set_has_minimal_iff_artinian.mpr ‹_› a ha\n\n/-- A module is Artinian iff every decreasing chain of submodules stabilizes. -/\ntheorem monotone_stabilizes_iff_artinian :\n (∀ f : ℕ →o (Submodule R M)ᵒᵈ, ∃ n, ∀ m, n ≤ m → f n = f m) ↔ IsArtinian R M :=\n wellFoundedGT_iff_monotone_chain_condition.symm\n\nnamespace IsArtinian\n\nvariable [IsArtinian R M]\n\ntheorem monotone_stabilizes (f : ℕ →o (Submodule R M)ᵒᵈ) : ∃ n, ∀ m, n ≤ m → f n = f m :=\n monotone_stabilizes_iff_artinian.mpr ‹_› f\n\ntheorem eventuallyConst_of_isArtinian (f : ℕ →o (Submodule R M)ᵒᵈ) :\n atTop.EventuallyConst f := by\n simp_rw [eventuallyConst_atTop, eq_comm]\n exact monotone_stabilizes f\n\nopen Function\n\n/-- Any injective endomorphism of an Artinian module is surjective. -/\ntheorem surjective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Surjective f := by\n have h := ‹IsArtinian R M›; contrapose h\n rw [IsArtinian, WellFoundedLT, isWellFounded_iff]\n refine (RelEmbedding.natGT (LinearMap.range <| f ^ ·) ?_).not_wellFounded\n intro n\n simp_rw [pow_succ, Module.End.mul_eq_comp, LinearMap.range_comp, ← Submodule.map_top (f ^ n)]\n refine Submodule.map_strictMono_of_injective (Module.End.iterate_injective s n) (Ne.lt_top ?_)\n rwa [Ne, LinearMap.range_eq_top]\n\n/-- Any injective endomorphism of an Artinian module is bijective. -/\ntheorem bijective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Bijective f :=\n ⟨s, surjective_of_injective_endomorphism f s⟩\n\n/-- A sequence `f` of submodules of an Artinian module,\nwith the supremum `f (n+1)` and the infimum of `f 0`, ..., `f n` being ⊤,\nis eventually ⊤. -/\ntheorem disjoint_partial_infs_eventually_top (f : ℕ → Submodule R M)\n (h : ∀ n, Disjoint (partialSups (OrderDual.toDual ∘ f) n) (OrderDual.toDual (f (n + 1)))) :\n ∃ n : ℕ, ∀ m, n ≤ m → f m = ⊤ := by\n -- A little off-by-one cleanup first:\n rsuffices ⟨n, w⟩ : ∃ n : ℕ, ∀ m, n ≤ m → OrderDual.toDual f (m + 1) = ⊤\n · use n + 1\n rintro (_ | m) p\n · cases p\n · apply w\n exact Nat.succ_le_succ_iff.mp p\n obtain ⟨n, w⟩ := monotone_stabilizes (partialSups (OrderDual.toDual ∘ f))\n refine ⟨n, fun m p ↦ (h m).eq_bot_of_ge <| sup_eq_left.mp ?_⟩\n simpa only [partialSups_add_one] using! (w (m + 1) <| le_add_right p).symm.trans <| w m p\n\nend IsArtinian\n\nlemma IsArtinian.subsingleton_of_injective [IsArtinian R N] {f : P × N →ₗ[R] N}\n (inj : Function.Injective f) : Subsingleton P :=\n subsingleton_of_forall_eq 0 fun p ↦\n have ⟨_, eq⟩ := IsArtinian.surjective_of_injective_endomorphism (f ∘ₗ .inr ..)\n (inj.comp (Prod.mk_right_injective _)) (f (p, 0))\n congr($(inj eq).1).symm\n\nnamespace LinearMap\n\nvariable [IsArtinian R M]\n\nTarget:\nlemma eventually_iInf_range_pow_eq (f : Module.End R M) :\n ∀ᶠ n in atTop, ⨅ m, LinearMap.range (f ^ m) = LinearMap.range (f ^ n) :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Artinian","family_id":"eventually_iinf_range_pow_eq","file_id":"mathlib/Mathlib/RingTheory/Artinian/Module.lean","sample_id":"feb5fd7b4e023e54121cee437cf5d269c26e742bc4f204daf39fec6a945fa315"},"split":"validation"} {"binding":{"chosen_proof_sha256":"7b2cd5f189e96fc3c6ef12149fbbfa2d1c134c7953b7aff3fba3bef5f976115c","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"ab48b8d46006831193e99745f398cb36288b2062d63500da6e284159f76b72df","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"56519afacc2d5e31a7ff13d1e323f4ff97057c4f9bf2c94c8477e3390f8a82cd","source_sha256":"8b292ad45fd299df1a3eb89f8cf5e64c099eea0affd6d1888191f3d1a85a5932","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ArithmeticFunction.LSeriesSummable_mul (LSeriesSummable_zeta_iff.mpr hs) <|\n LSeriesSummable_of_bounded_of_one_lt_re (m := 1) (fun n hn ↦ ?_) hs\n simpa only [toArithmeticFunction, coe_mk, hn, ↓reduceIte]\n using norm_le_one χ _","hard_negative":false,"metrics":{"chosen_tokens":44,"rejected_tokens":51,"token_jaccard":0.944444,"token_length_ratio":1.159091},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"83c4d83b3d8a19032267662f1d1705fba8f675440150538f87a8469dec1b218c","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds\npublic import Mathlib.NumberTheory.Harmonic.ZetaAsymp\npublic import Mathlib.NumberTheory.LSeries.Dirichlet\npublic import Mathlib.NumberTheory.LSeries.DirichletContinuation\npublic import Mathlib.NumberTheory.LSeries.Positivity\n\nNamespace:\nDirichletCharacter\n\nLocal context:\n/-\nCopyright (c) 2024 Michael Stoll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Michael Stoll, David Loeffler\n-/\n/-!\n# The L-function of a Dirichlet character does not vanish on Re(s) ≥ 1\n\nThe main result in this file is `DirichletCharacter.LFunction_ne_zero_of_one_le_re`:\nif `χ` is a Dirichlet character, `s ∈ ℂ` with `1 ≤ s.re`, and either `χ` is nontrivial or `s ≠ 1`,\nthen the L-function of `χ` does not vanish at `s`.\n\nAs a consequence, we have the corresponding statement for the Riemann ζ function:\n`riemannZeta_ne_zero_of_one_le_re` (which does not require `s ≠ 1`, since the junk value at `s = 1`\nhappens to be non-zero).\n\nThese results are prerequisites for the **Prime Number Theorem** and\n**Dirichlet's Theorem** on primes in arithmetic progressions.\n\n## Outline of proofs\n\nWe split into two cases: first, the special case of (non-trivial) quadratic characters at `s = 1`;\nthen the remaining case when either `s ≠ 1` or `χ ^ 2 ≠ 1`.\n\nThe first case is handled using a positivity argument applied to the series `L χ s * ζ s`: we show\nthat this function has non-negative Dirichlet coefficients, is strictly positive for `s ≫ 0`, but\nvanishes at `s = -2`, so it must have a pole somewhere in between.\n\nThe second case is dealt with using the product\n`L(χ^0, 1 + x)^3 L(χ, 1 + x + I * y)^4 L(χ^2, 1 + x + 2 * I * y)`, which\nwe show has absolute value `≥ 1` for all positive `x` and real `y`; if `L(χ, 1 + I * y) = 0` then\nthis product would have to tend to 0 as `x → 0`, which is a contradiction.\n-/\n\n@[expose] public section\n\n/- NB: Many lemmas (and some defs) in this file are private, since they concern properties of\nhypothetical objects which we eventually deduce cannot exist. We have only made public the lemmas\nwhose hypotheses do not turn out to be contradictory.\n-/\n\nopen Complex Asymptotics Topology Filter\nopen ArithmeticFunction hiding log\n\n-- We use the ordering on `ℂ` given by comparing real parts for fixed imaginary part\nopen scoped ComplexOrder\n\nvariable {N : ℕ}\n\nnamespace DirichletCharacter\n\nsection quadratic\n\n/-!\n### Convolution of a Dirichlet character with ζ\n\nWe define `DirichletCharacter.zetaMul χ` to be the arithmetic function obtained by\ntaking the product (as arithmetic functions = Dirichlet convolution) of the\narithmetic function `ζ` with `χ`.\n\nWe then show that for a quadratic character `χ`, this arithmetic function is multiplicative\nand takes nonnegative real values.\n-/\n\n/-- The complex-valued arithmetic function that is the convolution of the constant\nfunction `1` with `χ`. -/\nnoncomputable def zetaMul (χ : DirichletCharacter ℂ N) : ArithmeticFunction ℂ :=\n .zeta * toArithmeticFunction (χ ·)\n\n/-- The arithmetic function `zetaMul χ` is multiplicative. -/\nlemma isMultiplicative_zetaMul (χ : DirichletCharacter ℂ N) : χ.zetaMul.IsMultiplicative :=\n isMultiplicative_zeta.natCast.mul <| isMultiplicative_toArithmeticFunction χ\n\nTarget:\nlemma LSeriesSummable_zetaMul (χ : DirichletCharacter ℂ N) {s : ℂ} (hs : 1 < s.re) :\n LSeriesSummable χ.zetaMul s :=\n\nProof body:\n","rejected":"```lean\nby\n refine ArithmeticFunction.LSeriesSummable_mul (LSeriesSummable_zeta_iff.mpr hs) <|\n LSeriesSummable_of_bounded_of_one_lt_re (m := 1) (fun n hn ↦ ?_) hs\n simpa only [toArithmeticFunction, coe_mk, hn, ↓reduceIte]\n using norm_le_one χ _\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"NumberTheory/LSeries","family_id":"lseriessummable_zetamul","file_id":"mathlib/Mathlib/NumberTheory/LSeries/Nonvanishing.lean","sample_id":"56519afacc2d5e31a7ff13d1e323f4ff97057c4f9bf2c94c8477e3390f8a82cd"},"split":"validation"} {"binding":{"chosen_proof_sha256":"12b867465765bd4788b2d1528e1b00d3edd8d271a080e6c4c48fad1872abe444","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"bffa1a566b7deeaf04c2c7eafaa8ef70ec490a2c4559295f3c504fefd5b2941e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"f737c4eafcf7cde903df04875325836e1223b80333863a297d0f7a725eb57cdf","source_sha256":"b241b4d50c8705f60930b08595330ff34c9b5c145562a6cf542e2e8a9982512f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n -- We use a standard ε / 2 argument to deduce the result from the approximation for\n -- continuous compactly supported functions.\n have hε₂ : 0 < ε / 2 := by positivity\n have hε₂' : 0 < ENNReal.ofReal (ε / 2) := by positivity\n obtain ⟨g, hg₁, hg₂, hg₃, hg₄⟩ := hf.exists_hasCompactSupport_eLpNorm_sub_le hp hε₂'.ne'\n obtain ⟨g', hg'₁, hg'₂, hg'₃⟩ := hg₁.exist_eLpNorm_sub_le_of_continuous μ hε₂ hg₃\n refine ⟨g', hg'₁, hg'₂, ?_⟩\n have : f - g' = (f - g) - (g' - g) := by simp\n grw [this, eLpNorm_sub_le (hf.aestronglyMeasurable.sub hg₄.aestronglyMeasurable)\n (hg'₂.continuous.aestronglyMeasurable.sub hg₄.aestronglyMeasurable) hp₂, hg₂,\n eLpNorm_sub_comm, hg'₃, ← ENNReal.ofReal_add hε₂.le hε₂.le, add_halves]","hard_negative":false,"metrics":{"chosen_tokens":200,"rejected_tokens":205,"token_jaccard":0.958904,"token_length_ratio":1.025},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"84c82e07a05b5fd61e1bc84b9275f58f78eaf2a64ff4549655f7c9b25b9eef92","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Calculus.ContDiff.Defs\npublic import Mathlib.LinearAlgebra.FiniteDimensional.Defs\npublic import Mathlib.MeasureTheory.Function.LpSpace.Basic\nimport Mathlib.Geometry.Manifold.SmoothApprox\nimport Mathlib.MeasureTheory.Function.ContinuousMapDense\n\nNamespace:\nMeasureTheory.MemLp\n\nLocal context:\n/-\nCopyright (c) 2025 Moritz Doll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Moritz Doll\n-/\n/-!\n\n# Density of smooth compactly supported functions in `Lp`\n\nIn this file, we prove that `Lp` functions can be approximated by smooth compactly supported\nfunctions for `p < ∞`.\n\nThis result is recorded in `MeasureTheory.MemLp.exist_sub_eLpNorm_le`.\n-/\n\npublic section\n\nvariable {α β E F : Type*} [MeasurableSpace E] [NormedAddCommGroup F]\n\nopen scoped Nat NNReal ContDiff\nopen MeasureTheory Pointwise ENNReal\n\nnamespace HasCompactSupport\n\nvariable [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [BorelSpace E]\n [NormedSpace ℝ F]\n\n/-- For every continuous compactly supported function `f` there exists a smooth compactly supported\nfunction `g` such that `f - g` is arbitrary small in the `Lp`-norm for `p < ∞`. -/\ntheorem exist_eLpNorm_sub_le_of_continuous (μ : Measure E := by volume_tac)\n [IsFiniteMeasureOnCompacts μ] {p : ℝ≥0∞} {ε : ℝ} (hε : 0 < ε) {f : E → F}\n (h₁ : HasCompactSupport f) (h₂ : Continuous f) :\n ∃ (g : E → F), HasCompactSupport g ∧ ContDiff ℝ ∞ g ∧\n eLpNorm (f - g) p μ ≤ ENNReal.ofReal ε := by\n rcases eq_or_ne p ∞ with rfl | hp\n · obtain ⟨g, hg₁, hg₂, hg₃⟩ := h₂.exists_contDiff_approx ⊤ (ε := fun _ ↦ ε) (by fun_prop)\n (by intro; positivity)\n refine ⟨g, h₁.mono hg₃, hg₁, eLpNormEssSup_le_of_ae_bound (.of_forall fun x ↦ ?_)⟩\n simpa [← dist_eq_norm_sub'] using (hg₂ x).le\n by_cases hf : f =ᵐ[μ] 0\n -- We will need that the support is non-empty, so we treat the trivial case `f = 0` first.\n · use 0\n simpa [HasCompactSupport.zero, eLpNorm_congr_ae hf] using! contDiff_const\n have hs₁ : μ (tsupport f) ≠ ⊤ := h₁.measure_lt_top.ne\n have hs₂ : 0 < (μ <| tsupport f).toReal := by\n -- Since `f` is not the zero function `tsupport f` has positive measure\n rw [← Measure.measure_support_eq_zero_iff _] at hf\n exact toReal_pos (pos_mono (subset_tsupport f) (pos_of_ne_zero hf)).ne' hs₁\n set ε' := ε * (μ <| tsupport f).toReal ^ (-(1 / p.toReal)) with ε'_def\n have hε' : 0 < ε' := by positivity\n have hε₂ : ENNReal.ofReal ε' * μ (tsupport f) ^ (1 / p.toReal) ≤ ENNReal.ofReal ε := by\n rw [← ofReal_toReal hs₁, ofReal_rpow_of_pos hs₂, ← ofReal_mul hε'.le,\n ofReal_le_ofReal_iff hε.le, ε'_def, mul_assoc, ← Real.rpow_add hs₂, neg_add_cancel,\n Real.rpow_zero, mul_one]\n obtain ⟨g, hg₁, hg₂, hg₃⟩ := h₂.exists_contDiff_approx ⊤ (ε := fun _ ↦ ε') (by fun_prop)\n (by intro; positivity)\n refine ⟨g, h₁.mono hg₃, hg₁, (eLpNorm_sub_le_of_dist_bdd μ hp h₁.measurableSet hε'.le ?_\n (subset_tsupport f) (hg₃.trans (subset_tsupport f))).trans hε₂⟩\n intro x\n rw [dist_comm]\n exact (hg₂ x).le\n\nend HasCompactSupport\n\nnamespace MeasureTheory.MemLp\n\nvariable [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [BorelSpace E]\n [NormedSpace ℝ F]\n {μ : Measure E} [IsFiniteMeasureOnCompacts μ]\n\n/-- Every `Lp` function can be approximated by a smooth compactly supported function provided that\n`p < ∞`. -/\n\nTarget:\ntheorem exist_eLpNorm_sub_le {p : ℝ≥0∞} (hp : p ≠ ⊤) (hp₂ : 1 ≤ p) {f : E → F} (hf : MemLp f p μ)\n {ε : ℝ} (hε : 0 < ε) :\n ∃ g, HasCompactSupport g ∧ ContDiff ℝ ∞ g ∧ eLpNorm (f - g) p μ ≤ ENNReal.ofReal ε :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n -- We use a standard ε / 2 argument to deduce the result from the approximation for\n -- continuous compactly supported functions.\n have hε₂ : 0 < ε / 2 := by positivity\n have hε₂' : 0 < ENNReal.ofReal (ε / 2) := by positivity\n obtain ⟨g, hg₁, hg₂, hg₃, hg₄⟩ := hf.exists_hasCompactSupport_eLpNorm_sub_le hp hε₂'.ne'\n obtain ⟨g', hg'₁, hg'₂, hg'₃⟩ := hg₁.exist_eLpNorm_sub_le_of_continuous μ hε₂ hg₃\n refine ⟨g', hg'₁, hg'₂, ?_⟩\n have : f - g' = (f - g) - (g' - g) := by simp\n grw [this, eLpNorm_sub_le (hf.aestronglyMeasurable.sub hg₄.aestronglyMeasurable)\n (hg'₂.continuous.aestronglyMeasurable.sub hg₄.aestronglyMeasurable) hp₂, hg₂,\n eLpNorm_sub_comm, hg'₃, ← ENNReal.ofReal_add hε₂.le hε₂.le, add_halves]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Normed","family_id":"exist_elpnorm_sub_le","file_id":"mathlib/Mathlib/Analysis/Normed/Lp/SmoothApprox.lean","sample_id":"f737c4eafcf7cde903df04875325836e1223b80333863a297d0f7a725eb57cdf"},"split":"validation"} {"binding":{"chosen_proof_sha256":"391a2815a81fe5c563afbbf104ea9a9570c78f626b32d9dea8e5cd422d7026cb","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"71e2ca16c51170a10e38ffd34cca61fa812771e592a5393a96d868e9c76f34d4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"38bdcd928bd2dde54ab742026689587c40e9f5013b387ac532573d8d11ae2ece","source_sha256":"65a1b087d9d05e07d4861107b2b6ea2121850181b3d7efafcdfdfd0be355face","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Module.Finite P.Ring P.Cotangent :=\n have : Module.Finite P.Ring P.ker := .of_fg h'\n .of_surjective _ Extension.Cotangent.mk_surjective\n have : Module.Finite S P.Cotangent := Module.Finite.of_restrictScalars_finite P.Ring _ _\n rw [← IsLocalRing.split_injective_iff_lTensor_residueField_injective,\n P.formallySmooth_iff_split_injection]","hard_negative":false,"metrics":{"chosen_tokens":67,"rejected_tokens":74,"token_jaccard":0.931034,"token_length_ratio":1.104478},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"8cb5ced1134d8663ebb04443e3da018016c72c48d4f906d2f59cc385f09924d4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Flat.FaithfullyFlat.Basic\npublic import Mathlib.RingTheory.LocalRing.Module\npublic import Mathlib.RingTheory.Smooth.Basic\npublic import Mathlib.RingTheory.TensorProduct.Free\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2024 Andrew Yang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Andrew Yang\n-/\n/-!\n# Formally smooth local algebras\n-/\n\npublic section\n\nopen TensorProduct IsLocalRing KaehlerDifferential\n\nvariable {R S : Type*} [CommRing R] [CommRing S] [IsLocalRing S] [Algebra R S]\n\nnamespace Algebra\n\n/--\nThe **Jacobian criterion** for smoothness of local algebras.\nSuppose `S` is a local `R`-algebra, and `0 → I → P → S → 0` is a presentation such that\n`P` is formally-smooth over `R`, `Ω[P⁄R]` is finite free over `P`,\n(typically satisfied when `P` is the localization of a polynomial ring of finite type)\nand `I` is finitely generated.\nThen `S` is formally smooth iff `k ⊗ₛ I/I² → k ⊗ₚ Ω[P/R]` is injective,\nwhere `k` is the residue field of `S`.\n-/\n\nTarget:\ntheorem FormallySmooth.iff_injective_lTensor_residueField.{u}\n (P : Algebra.Extension.{u} R S)\n [FormallySmooth R P.Ring]\n [Module.Free P.Ring Ω[P.Ring⁄R]] [Module.Finite P.Ring Ω[P.Ring⁄R]]\n (h' : P.ker.FG) :\n Algebra.FormallySmooth R S ↔\n Function.Injective (P.cotangentComplex.lTensor (ResidueField S)) :=\n\nProof body:\n","rejected":"```lean\nby\n have : Module.Finite P.Ring P.Cotangent :=\n have : Module.Finite P.Ring P.ker := .of_fg h'\n .of_surjective _ Extension.Cotangent.mk_surjective\n have : Module.Finite S P.Cotangent := Module.Finite.of_restrictScalars_finite P.Ring _ _\n rw [← IsLocalRing.split_injective_iff_lTensor_residueField_injective,\n P.formallySmooth_iff_split_injection]\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Smooth","family_id":"formallysmooth","file_id":"mathlib/Mathlib/RingTheory/Smooth/Local.lean","sample_id":"38bdcd928bd2dde54ab742026689587c40e9f5013b387ac532573d8d11ae2ece"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d86e7607bc11051f9de4320108b1774234758b1e7f7a6ff252c4d838ae4b2685","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8c8f7d01ef83bc6f75414f45a3ca3178b97ad187d4219644c511a31e7f52ee08","source_sha256":"c60b869c723c3c91f9b10ffc01a437f63b4e5c04e61a58398bcd9e9d0ac2e64f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n apply SkewMonoidAlgebra.induction <;> aesop","hard_negative":false,"metrics":{"chosen_tokens":9,"rejected_tokens":2,"token_jaccard":0.1,"token_length_ratio":0.222222},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"8e238b5bf7c76d135a3cc614343f10cefd9f8b26cc4e30c927a47f8ebf94dbb5","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Single\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Support\n\nNamespace:\nSkewPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Xavier Généreux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Xavier Généreux, María Inés de Frutos-Fernández\n-/\n/-!\n# Univariate skew polynomials\n\nGiven a ring `R` and an endomorphism `φ` on `R` the skew polynomials over `R`\nare polynomials\n$$\\sum_{i= 0}^n a_iX^n, n\\geq 0, a_i\\in R$$\nwhere the addition is the usual addition of polynomials\n$$\\sum_{i= 0}^n a_iX^n + \\sum_{i= 0}^n b_iX^n= \\sum_{i= 0}^n (a_i + b_i)X^n.$$\nThe multiplication, however, is determined by\n$$Xa = \\varphi (a)X$$\nby extending it to all polynomials in the obvious way.\n\nSkew polynomials are represented as `SkewMonoidAlgebra R (Multiplicative ℕ)`,\nwhere `R` is usually at least a Semiring. In this file, we define `SkewPolynomial`\nand provide basic instances.\n\n**Note**: To register the endomorphism `φ` see notation below.\n\n## Notation\n\nThe endomorphism `φ` is implemented using some action of `Multiplicative ℕ` on `R`.\nFrom this action, `φ` is an `abbrev` denoting $(\\text{ofAdd } 1) \\cdot a := \\varphi(a)$.\n\nUsers that want to work with a specific map `φ` should introduce an action of\n`Multiplicative ℕ` on `R`. Specifying that this action is a `MulSemiringAction` amounts\nto saying that `φ` is an endomorphism.\n\nFurthermore, with this notation `φ^[n](a) = (ofAdd n) • a`, see `φ_iterate_apply`.\n\n## Main definitions\n\n* `SkewPolynomial.monomial n a` is the skew polynomial `a X ^ n`. Note that\n `SkewPolynomial.monomial n` is defined as an `R`-linear map.\n* `SkewPolynomial.C a` is the constant skew polynomial `a`. Note that `C` is defined as an additive\n homomorphism.\n* `SkewPolynomial.CRingHom a` is the constant skew polynomial `a`, as a ring homomorphism. This\n requires to assume `[MulSemiringAction (Multiplicative ℕ) R]`.\n* `SkewPolynomial.X` is the skew polynomial `X`, i.e., `SkewPolynomial.monomial 1 1`.\n* `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`.\n* `SkewPolynomial.coeff p n` is the coefficient of `X ^ n` in `p`.\n* `SkewPolynomial.erase p n` is the skew polynomial `p` in which one removes the monomial in\n degree `n`.\n* `SkewPolynomial.update p n a` is the skew polynomial obtained by replacing the coefficient of\n degree `n` by a given value `a : R`. If `a = 0`, this is equal to `p.erase n` If\n `p.natDegree < n` and `a ≠ 0`, this increases the degree of `p` to `n`.\n\n## Implementation notes\n\nThe implementation uses `Multiplicative ℕ` instead of `ℕ`, since Mathlib does not contain an\nadditive version of `SkewMonoidAlgebra`.\n\nThis decision was made because we use the type class `MulSemiringAction` to specify the properties\nthe action needs to respect for associativity. There is no version of this in Mathlib that\nuses an acting `AddMonoid M` and so we need to use `Multiplicative ℕ` for the action.\n\nFor associativity to hold, there should be an instance of\n`MulSemiringAction (Multiplicative ℕ) R` present in the context.\nFor example, in the context of $\\mathbb{F}_q$-linear polynomials, this can be the\n$q$-th Frobenius endomorphism - so $\\varphi(a) = a^q$.\n\n## Reference\n\nThe definition is inspired by Chapter 3 of [Papikian2023].\n\n## Tags\n\nSkew Polynomials, Twisted Polynomials.\n\nNote that [ore33] proposes a more general definition of skew polynomial ring, where the\nmultiplication is determined by $Xa = \\varphi (a)X + δ (a)$, where `φ` is as above and\n`δ` is a derivation.\n\n-/\n\n@[expose] public section\n\nnoncomputable section\n\nopen Function Multiplicative SkewMonoidAlgebra\n\n/-- The skew polynomials over `R` is the type of univariate polynomials over `R`\nendowed with a skewed convolution product. -/\nabbrev SkewPolynomial (R : Type*) [AddCommMonoid R] := SkewMonoidAlgebra R (Multiplicative ℕ)\n\nnamespace SkewPolynomial\n\nvariable {R : Type*} {m n : ℕ}\n\nsection Semiring\n\nvariable [Semiring R] {p q : SkewPolynomial R}\n\n\nlemma zero_def : (0 : SkewPolynomial R) = (0 : SkewMonoidAlgebra R (Multiplicative ℕ)) := rfl\n\nvariable {S S₁ S₂ : Type*}\n\n/--\nThe set of all `n` such that `X^n` has a non-zero coefficient.\n-/\ndef support (p : SkewPolynomial R) : Finset ℕ :=\n Finset.map ⟨toAdd, toAdd.injective⟩ (SkewMonoidAlgebra.support p)\n\n/-- Though `SkewPolynomial.support` is not definiyionally equal to `SkewMonoidAlgebra.support` we\n can relate them using the following lemma. -/\nlemma support_eq_skewMonoidAlgebra_support (p : SkewPolynomial R) :\n p.support = Finset.map (Multiplicative.toAdd (α := ℕ)) (SkewMonoidAlgebra.support p) := by\n simp only [support]\n\n@[simp] lemma support_zero : (0 : SkewPolynomial R).support = ∅ := rfl\n\n@[simp] lemma support_eq_empty : p.support = ∅ ↔ p = 0 := by simp [support]\n\nlemma card_support_eq_zero : p.support.card = 0 ↔ p = 0 := by simp\n\nlemma support_add : (p + q).support ⊆ p.support ∪ q.support := by\n simpa [support, ← Finset.map_union, Finset.map_subset_map] using SkewMonoidAlgebra.support_add\n\n/-- `coeff p n` is the coefficient of `X ^ n` in `p`. -/\ndef coeff (p : SkewPolynomial R) : ℕ → R := fun n ↦ (SkewMonoidAlgebra.coeff p (ofAdd n))\n\n@[simp]\nlemma mem_support_iff : n ∈ p.support ↔ p.coeff n ≠ 0 := by\n simp [support, coeff]\n\nlemma notMem_support_iff : n ∉ p.support ↔ p.coeff n = 0 := by simp\n\n/-- `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`. -/\ndef sum {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) : S :=\n SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r)\n\n/-- For a skew polynomial `p`, `p.sum f` can be written in terms of `SkewMonoidAlgebra.sum p`. -/\nlemma sum_def' {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r) := rfl\n\nlemma sum_def {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = ∑ n ∈ p.support, f n (p.coeff n) := by\n simp only [sum_def', SkewMonoidAlgebra.sum_def, Finsupp.sum, toFinsupp_apply]\n apply Finset.sum_of_injOn (toAdd) (Injective.injOn fun ⦃a₁ a₂⦄ a ↦ a) (fun _ ↦ ?_) <;>\n simp +contextual [coeff]\n\nlemma sum_sum_index {R' P : Type*} [AddCommMonoid P] [Semiring R']\n {f : SkewPolynomial R} {g : ℕ → R → SkewPolynomial R'} {h : ℕ → R' → P}\n (h_zero : ∀ (a : ℕ), h a 0 = 0)\n (h_add : ∀ (a : ℕ) (b₁ b₂ : R'), h a (b₁ + b₂) = h a b₁ + h a b₂) :\n sum (sum f g) h = sum f fun (a : ℕ) (b : R) ↦ sum (g a b) h := by\n simp only [sum_def', SkewMonoidAlgebra.sum_sum_index (fun a ↦ h_zero (toAdd a))\n (fun a ↦ h_add (toAdd a))]\n\n@[simp]\nlemma sum_zero {N : Type*} [AddCommMonoid N] {f : SkewPolynomial R} :\n (f.sum fun (_ : ℕ) _ ↦ (0 : N)) = 0 :=\n SkewMonoidAlgebra.sum_zero\n\nsection Monomial\n\nvariable (n)\n\n/-- `monomial s a` is the monomial `a * X ^ s`. -/\ndef monomial : R →ₗ[R] SkewPolynomial R := lsingle R (ofAdd n)\n\nlemma monomial_zero_right : monomial n (0 : R) = 0 := single_zero _\n\nlemma monomial_zero_one [MulSemiringAction (Multiplicative ℕ) R] : monomial 0 (1 : R) = 1 :=\n rfl\n\nlemma monomial_def (a : R) : monomial n a = single (ofAdd n) a := rfl\n\nlemma monomial_add (r s : R) : monomial n (r + s) = monomial n r + monomial n s :=\n single_add ..\n\nlemma smul_monomial {S} [Semiring S] [Module S R] (a : S) (b : R) :\n a • monomial n b = monomial n (a • b) :=\n smul_single ..\n\n@[simp]\nlemma sum_monomial (f : SkewPolynomial R) : f.sum (fun (a : ℕ) ↦ monomial a) = f :=\n SkewMonoidAlgebra.sum_single _\n\n@[simp]\nlemma sum_monomial_index {N} [AddCommMonoid N] {n : ℕ} {b : R} {h : ℕ → R → N}\n (h_zero : h n 0 = 0) : (monomial n b).sum h = h n b :=\n SkewMonoidAlgebra.sum_single_index h_zero\n\nlemma monomial_injective : Function.Injective (monomial n : R → SkewPolynomial R) :=\n single_injective (ofAdd n)\n\n@[simp]\nlemma monomial_eq_zero_iff (t : R) : monomial n t = 0 ↔ t = 0 :=\n LinearMap.map_eq_zero_iff _ (SkewPolynomial.monomial_injective n)\n\nlemma monomial_eq_monomial_iff {m n : ℕ} {a b : R} :\n monomial m a = monomial n b ↔ m = n ∧ a = b ∨ a = 0 ∧ b = 0 := by\n rw [← Finsupp.single_eq_single_iff m n a b]\n simp only [monomial_def, ← toFinsupp_single, toFinsupp_inj]\n simp only [← ofFinsupp_single, SkewMonoidAlgebra.ofFinsupp_inj, Finsupp.single_eq_single_iff,\n EmbeddingLike.apply_eq_iff_eq]\n\nTarget:\nlemma induction {motive : SkewPolynomial R → Prop} (p : SkewPolynomial R) (h0 : motive 0)\n (ha : ∀ (n : ℕ) (r : R) (q : SkewPolynomial R), n ∉ q.support → r ≠ 0 → motive q →\n motive (SkewPolynomial.monomial n r + q)) : motive p :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/SkewPolynomial","family_id":"induction","file_id":"mathlib/Mathlib/Algebra/SkewPolynomial/Basic.lean","sample_id":"8c8f7d01ef83bc6f75414f45a3ca3178b97ad187d4219644c511a31e7f52ee08"},"split":"validation"} {"binding":{"chosen_proof_sha256":"6bc12762f785864b83212cf83edd04640292f6138d0cd8b8ec222ff4cc1d9e74","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"631a5c27d359997eaffc49fbfaae20900df2d4b6394167040420c6ef9727e90c","source_sha256":"68837b163b389d23b448b42fd6a15b696bef3e8ca80152666170476a190f313d","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa [directSumLeft] using! lequivCongrLeft_lof S (by simp) _ _ rfl","hard_negative":false,"metrics":{"chosen_tokens":16,"rejected_tokens":3,"token_jaccard":0.0625,"token_length_ratio":0.1875},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"8e82966c8f783f87cb342abc3854d07d754b457cbdc4f9308f873160a10bbb44","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.Algebra.DirectSum.Module\n\nNamespace:\nTensorProduct\n\nLocal context:\n/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Mario Carneiro, Eric Wieser\n-/\n/-!\n# Tensor products of direct sums\n\nThis file shows that taking `TensorProduct`s commutes with taking `DirectSum`s in both arguments.\n\n## Main results\n\n* `TensorProduct.directSum`\n* `TensorProduct.directSumLeft`\n* `TensorProduct.directSumRight`\n-/\n\n@[expose] public section\n\nuniverse u v₁ v₂ w₁ w₁' w₂ w₂'\n\nsection Ring\n\nnamespace TensorProduct\n\nopen TensorProduct\n\nopen DirectSum\n\nopen LinearMap\n\nattribute [local ext] TensorProduct.ext\n\nvariable (R : Type u) [CommSemiring R] (S) [Semiring S] [Algebra R S]\nvariable {ι₁ : Type v₁} {ι₂ : Type v₂}\nvariable [DecidableEq ι₁] [DecidableEq ι₂]\nvariable (M₁ : ι₁ → Type w₁) (M₁' : Type w₁') (M₂ : ι₂ → Type w₂) (M₂' : Type w₂')\nvariable [∀ i₁, AddCommMonoid (M₁ i₁)] [AddCommMonoid M₁']\nvariable [∀ i₂, AddCommMonoid (M₂ i₂)] [AddCommMonoid M₂']\nvariable [∀ i₁, Module R (M₁ i₁)] [Module R M₁'] [∀ i₂, Module R (M₂ i₂)] [Module R M₂']\nvariable [∀ i₁, Module S (M₁ i₁)] [∀ i₁, IsScalarTower R S (M₁ i₁)]\nvariable [Module S M₁'] [IsScalarTower R S M₁']\n\n/-- The linear equivalence `(⨁ i₁, M₁ i₁) ⊗ (⨁ i₂, M₂ i₂) ≃ (⨁ i₁, ⨁ i₂, M₁ i₁ ⊗ M₂ i₂)`, i.e.\n\"tensor product distributes over direct sum\". -/\nprotected def directSum :\n ((⨁ i₁, M₁ i₁) ⊗[R] ⨁ i₂, M₂ i₂) ≃ₗ[S] ⨁ i : ι₁ × ι₂, M₁ i.1 ⊗[R] M₂ i.2 := by\n refine LinearEquiv.ofLinear ?toFun ?invFun ?left ?right\n · exact AlgebraTensorModule.lift <|\n toModule S _ _ fun i₁ => flip <| toModule R _ _ fun i₂ => flip <| AlgebraTensorModule.curry <|\n DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂)\n · exact toModule S _ _ fun i => AlgebraTensorModule.map (lof S _ M₁ i.1) (lof R _ M₂ i.2)\n · ext ⟨i₁, i₂⟩ x₁ x₂ : 4\n simp only [coe_comp, Function.comp_apply, toModule_lof, AlgebraTensorModule.map_tmul,\n AlgebraTensorModule.lift_apply, lift.tmul, coe_restrictScalars, flip_apply,\n AlgebraTensorModule.curry_apply, curry_apply, id_comp]\n · ext i₁ i₂ x₁ x₂ : 5\n simp only [coe_comp, Function.comp_apply, AlgebraTensorModule.curry_apply, curry_apply,\n coe_restrictScalars, AlgebraTensorModule.lift_apply, lift.tmul, toModule_lof, flip_apply,\n AlgebraTensorModule.map_tmul, id_coe, id_eq]\n\n/-- Tensor products distribute over a direct sum on the left . -/\ndef directSumLeft : (⨁ i₁, M₁ i₁) ⊗[R] M₂' ≃ₗ[S] ⨁ i, M₁ i ⊗[R] M₂' :=\n TensorProduct.AlgebraTensorModule.congr 1 (DirectSum.lid _ _).symm ≪≫ₗ\n TensorProduct.directSum R S M₁ (fun _ : Unit ↦ M₂') ≪≫ₗ\n DirectSum.lequivCongrLeft S (Equiv.prodUnique _ _)\n\n/-- Tensor products distribute over a direct sum on the right. -/\ndef directSumRight : (M₁' ⊗[R] ⨁ i, M₂ i) ≃ₗ[S] ⨁ i, M₁' ⊗[R] M₂ i :=\n TensorProduct.AlgebraTensorModule.congr (DirectSum.lid _ _).symm 1 ≪≫ₗ\n TensorProduct.directSum R S (fun _ : Unit ↦ M₁') M₂ ≪≫ₗ\n DirectSum.lequivCongrLeft S (Equiv.uniqueProd _ _)\n\n@[deprecated (since := \"2026-03-04\")] alias directSumRight' := directSumRight\n\nvariable {M₁ M₁' M₂ M₂'}\n\n@[simp]\ntheorem directSum_lof_tmul_lof (i₁ : ι₁) (m₁ : M₁ i₁) (i₂ : ι₂) (m₂ : M₂ i₂) :\n TensorProduct.directSum R S M₁ M₂ (DirectSum.lof S ι₁ M₁ i₁ m₁ ⊗ₜ DirectSum.lof R ι₂ M₂ i₂ m₂) =\n DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂) (m₁ ⊗ₜ m₂) := by\n simp [TensorProduct.directSum]\n\n@[simp]\ntheorem directSum_symm_lof_tmul (i₁ : ι₁) (m₁ : M₁ i₁) (i₂ : ι₂) (m₂ : M₂ i₂) :\n (TensorProduct.directSum R S M₁ M₂).symm\n (DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂) (m₁ ⊗ₜ m₂)) =\n (DirectSum.lof S ι₁ M₁ i₁ m₁ ⊗ₜ DirectSum.lof R ι₂ M₂ i₂ m₂) := by\n rw [LinearEquiv.symm_apply_eq, directSum_lof_tmul_lof]\n\n@[simp]\n\nTarget:\ntheorem directSumLeft_tmul_lof (i : ι₁) (x : M₁ i) (y : M₂') :\n directSumLeft R S M₁ M₂' (DirectSum.lof S _ _ i x ⊗ₜ[R] y) =\n DirectSum.lof S _ _ i (x ⊗ₜ[R] y) :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/DirectSum","family_id":"directsumleft_tmul_lof","file_id":"mathlib/Mathlib/LinearAlgebra/DirectSum/TensorProduct.lean","sample_id":"631a5c27d359997eaffc49fbfaae20900df2d4b6394167040420c6ef9727e90c"},"split":"validation"} {"binding":{"chosen_proof_sha256":"cb9f44b11b2405abffc6cf02d9d6ca0828a51fac742a41f2c3aa8b22c89acf20","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"5392c952d864de7d73f7a4f425440c3c7d14586f78c2e6b44435f523faea7ef2","source_sha256":"e123ed5591679e8fbff485a4307c62b93299618db2753a3e9ba7f6502bdbcbe7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← π.biUnionIndex_of_mem (πi := fun J => (πi J).toPrepartition) hJ hJ']\n rfl","hard_negative":false,"metrics":{"chosen_tokens":26,"rejected_tokens":5,"token_jaccard":0.043478,"token_length_ratio":0.192308},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"8f769a0047fd610a9f3cabb9842ebc1c8144b0e4ec5ac3ddd7ad94a1f636694e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.BoxIntegral.Partition.Basic\n\nNamespace:\nBoxIntegral.Prepartition\n\nLocal context:\n/-\nCopyright (c) 2021 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Tagged partitions\n\nA tagged (pre)partition is a (pre)partition `π` enriched with a tagged point for each box of\n`π`. For simplicity we require that the function `BoxIntegral.TaggedPrepartition.tag` is defined\non all boxes `J : Box ι` but use its values only on boxes of the partition. Given\n`π : BoxIntegral.TaggedPrepartition I`, we require that each `BoxIntegral.TaggedPrepartition π J`\nbelongs to `BoxIntegral.Box.Icc I`. If for every `J ∈ π`, `π.tag J` belongs to `J.Icc`, then `π` is\ncalled a *Henstock* partition. We do not include this assumption into the definition of a tagged\n(pre)partition because McShane integral is defined as a limit along tagged partitions without this\nrequirement.\n\n## Tags\n\nrectangular box, box partition\n-/\n\n@[expose] public section\n\n\nnoncomputable section\n\nopen Finset Function ENNReal NNReal Set\n\nnamespace BoxIntegral\n\nvariable {ι : Type*}\n\n/-- A tagged prepartition is a prepartition enriched with a tagged point for each box of the\nprepartition. For simplicity we require that `tag` is defined for all boxes in `ι → ℝ` but\nwe will use only the values of `tag` on the boxes of the partition. -/\nstructure TaggedPrepartition (I : Box ι) extends Prepartition I where\n /-- Choice of tagged point of each box in this prepartition:\n we extend this to a total function, on all boxes in `ι → ℝ`. -/\n tag : Box ι → ι → ℝ\n /-- Each tagged point belongs to `I` -/\n tag_mem_Icc : ∀ J, tag J ∈ Box.Icc I\n\nnamespace TaggedPrepartition\n\nvariable {I J J₁ J₂ : Box ι} (π : TaggedPrepartition I) {x : ι → ℝ}\n\ninstance : Membership (Box ι) (TaggedPrepartition I) :=\n ⟨fun π J => J ∈ π.boxes⟩\n\n@[simp]\ntheorem mem_toPrepartition {π : TaggedPrepartition I} : J ∈ π.toPrepartition ↔ J ∈ π := Iff.rfl\n\n@[simp]\ntheorem mem_mk (π : Prepartition I) (f h) : J ∈ mk π f h ↔ J ∈ π := Iff.rfl\n\n/-- Union of all boxes of a tagged prepartition. -/\ndef iUnion : Set (ι → ℝ) :=\n π.toPrepartition.iUnion\n\ntheorem iUnion_def : π.iUnion = ⋃ J ∈ π, ↑J := rfl\n\n@[simp]\ntheorem iUnion_mk (π : Prepartition I) (f h) : (mk π f h).iUnion = π.iUnion := rfl\n\n@[simp]\ntheorem iUnion_toPrepartition : π.toPrepartition.iUnion = π.iUnion := rfl\n\n@[simp]\ntheorem mem_iUnion : x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J := by\n convert! Set.mem_iUnion₂\n rw [Box.mem_coe, mem_toPrepartition, exists_prop]\n\ntheorem subset_iUnion (h : J ∈ π) : ↑J ⊆ π.iUnion :=\n subset_biUnion_of_mem h\n\ntheorem iUnion_subset : π.iUnion ⊆ I :=\n iUnion₂_subset π.le_of_mem'\n\n/-- A tagged prepartition is a partition if it covers the whole box. -/\ndef IsPartition :=\n π.toPrepartition.IsPartition\n\ntheorem isPartition_iff_iUnion_eq : IsPartition π ↔ π.iUnion = I :=\n Prepartition.isPartition_iff_iUnion_eq\n\n/-- The tagged partition made of boxes of `π` that satisfy predicate `p`. -/\n@[simps! -fullyApplied]\ndef filter (p : Box ι → Prop) : TaggedPrepartition I :=\n ⟨π.1.filter p, π.2, π.3⟩\n\n@[simp]\ntheorem mem_filter {p : Box ι → Prop} : J ∈ π.filter p ↔ J ∈ π ∧ p J := by\n classical exact Finset.mem_filter\n\n@[simp]\ntheorem iUnion_filter_not (π : TaggedPrepartition I) (p : Box ι → Prop) :\n (π.filter fun J => ¬p J).iUnion = π.iUnion \\ (π.filter p).iUnion :=\n π.toPrepartition.iUnion_filter_not p\n\nend TaggedPrepartition\n\nnamespace Prepartition\n\nvariable {I J : Box ι}\n\n/-- Given a partition `π` of `I : BoxIntegral.Box ι` and a collection of tagged partitions\n`πi J` of all boxes `J ∈ π`, returns the tagged partition of `I` into all the boxes of `πi J`\nwith tags coming from `(πi J).tag`. -/\ndef biUnionTagged (π : Prepartition I) (πi : ∀ J : Box ι, TaggedPrepartition J) :\n TaggedPrepartition I where\n toPrepartition := π.biUnion fun J => (πi J).toPrepartition\n tag J := (πi (π.biUnionIndex (fun J => (πi J).toPrepartition) J)).tag J\n tag_mem_Icc _ := Box.le_iff_Icc.1 (π.biUnionIndex_le _ _) ((πi _).tag_mem_Icc _)\n\n@[simp]\ntheorem mem_biUnionTagged (π : Prepartition I) {πi : ∀ J, TaggedPrepartition J} :\n J ∈ π.biUnionTagged πi ↔ ∃ J' ∈ π, J ∈ πi J' :=\n π.mem_biUnion\n\nTarget:\ntheorem tag_biUnionTagged (π : Prepartition I) {πi : ∀ J, TaggedPrepartition J} (hJ : J ∈ π) {J'}\n (hJ' : J' ∈ πi J) : (π.biUnionTagged πi).tag J' = (πi J).tag J' :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/BoxIntegral","family_id":"tag_biuniontagged","file_id":"mathlib/Mathlib/Analysis/BoxIntegral/Partition/Tagged.lean","sample_id":"5392c952d864de7d73f7a4f425440c3c7d14586f78c2e6b44435f523faea7ef2"},"split":"validation"} {"binding":{"chosen_proof_sha256":"2628a130253968a8a686af97d98eddb2b162e209ea731c0dcd4d454971dcc9b6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"8409acc5986acfded179d9782c4750b7d6026c7133b137a2818351c57dbc1f7b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8d343aa127f197e818f22279e907f55b3532ba43d07e558d0fa74795d9b604ed","source_sha256":"09dd13e02db05fd527f00c9f33b3add6a1ffc3bbffe4376f55a8c13248c9fdd4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by intro; rfl) :\n ContinuousEvalConst F' α X where\n continuous_eval_const x := by simpa only [← hf] using! (continuous_eval_const x).comp hc","hard_negative":true,"metrics":{"chosen_tokens":30,"rejected_tokens":5,"token_jaccard":0.068966,"token_length_ratio":0.166667},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"903d71c95b50341b97e674db18705d8e175f648609eb15bb3c58c3a3774ac0f1","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Constructions\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Bundled morphisms with continuous evaluation at a point\n\nIn this file we define a typeclass\nsaying that `F` is a type of bundled morphisms (in the sense of `DFunLike`)\nwith a topology on `F` such that evaluation at a point is continuous in `f : F`.\n\n## Implementation Notes\n\nFor now, we define the typeclass for non-dependent bundled functions only.\nWhenever we add a type of bundled dependent functions with a topology having this property,\nwe may decide to generalize from `FunLike` to `DFunLike`.\n-/\n\npublic section\n\nopen scoped Topology\nopen Filter\n\n/-- A typeclass saying that `F` is a type of bundled morphisms (in the sense of `DFunLike`)\nwith a topology on `F` such that evaluation at a point is continuous in `f : F`. -/\nclass ContinuousEvalConst (F : Type*) (α X : outParam Type*) [FunLike F α X]\n [TopologicalSpace F] [TopologicalSpace X] : Prop where\n continuous_eval_const (x : α) : Continuous fun f : F ↦ f x\n\nexport ContinuousEvalConst (continuous_eval_const)\n\nsection ContinuousEvalConst\n\nvariable {F α X Z : Type*} [FunLike F α X] [TopologicalSpace F] [TopologicalSpace X]\n [ContinuousEvalConst F α X] [TopologicalSpace Z] {f : Z → F} {s : Set Z} {z : Z}\n\n/-- If a type `F'` of bundled morphisms admits a continuous projection\nto a type satisfying `ContinuousEvalConst`,\nthen `F'` satisfies this predicate too.\n\nThe word \"forget\" in the name is motivated by the term \"forgetful functor\". -/\n\nTarget:\ntheorem ContinuousEvalConst.of_continuous_forget {F' : Type*} [FunLike F' α X] [TopologicalSpace F']\n {f : F' → F} (hc : Continuous f) (hf : ∀ g, ⇑(f g) = g :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_8d343aa127f1","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"43e6fa03b5ee80f727c32cd80fc1bc1d27f8de8cfd486cb6d34472e8e2b425af","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Hom","family_id":"continuousevalconst","file_id":"mathlib/Mathlib/Topology/Hom/ContinuousEvalConst.lean","sample_id":"8d343aa127f197e818f22279e907f55b3532ba43d07e558d0fa74795d9b604ed"},"split":"validation"} {"binding":{"chosen_proof_sha256":"85f6ad78c524eda0c934e721b19e9291082fa2a1821c5d6d537c1276227894a6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c46d93cc1f5e50b7a7f2240f5da76791bdf5242fff72eb544bb08e77c8831dbf","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"af7a044ec67c6f2d2ab89500edd15004633c97bb48831f2a88a5dfcc067c7a4b","source_sha256":"cc2967dc8d7641f0817b378e7e53dcbd89d3d9b349ad605c7f1a8d10ea3bf1f7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Module.Finite k (Module.End A V) := .of_injective (LinearMap.restrictScalarsₗ k A V V k) <|\n LinearMap.restrictScalars_injective _\n classical exact IsAlgClosed.algebraMap_bijective_of_isIntegral (k := k)\n\nvariable (A V)","hard_negative":true,"metrics":{"chosen_tokens":49,"rejected_tokens":3,"token_jaccard":0.074074,"token_length_ratio":0.061224},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"959e0da1d0b4040cb1ae33cfdc2fbeede7c72d6ecef57a404f9549345c806581","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Lie.OfAssociative\npublic import Mathlib.FieldTheory.IsAlgClosed.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Stepan Nesterov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Stepan Nesterov\n-/\n/-!\n# Basic facts about algebra representations\n\nThis file collects basic general facts about algebra representations. The purpose of this file is\nto have general results so that when we prove a corresponding fact about group representations\n(or Lie algebra representations etc), we can deduce them as special cases of facts from this file.\n\n-/\n\npublic section\n\nvariable {A V : Type*} (k : Type*) [Field k] [Ring A] [Algebra k A] [AddCommGroup V] [Module k V]\n [Module A V] [IsScalarTower k A V]\n [IsSimpleModule A V] [FiniteDimensional k V] [IsAlgClosed k]\n\n/-- Schur's Lemma: If `V` is a representation of an algebra `A` over an algebraically closed field\n`k`, then any endomorphism of `V` is scalar. -/\n\nTarget:\ntheorem IsSimpleModule.algebraMap_end_bijective_of_isAlgClosed :\n Function.Bijective (algebraMap k (Module.End A V)) :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_af7a044ec67c","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"83fb29e69b21cf309e68deccae127986d9771b6d222fcc064f96983712058aa5","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RepresentationTheory/AlgebraRepresentation","family_id":"issimplemodule","file_id":"mathlib/Mathlib/RepresentationTheory/AlgebraRepresentation/Basic.lean","sample_id":"af7a044ec67c6f2d2ab89500edd15004633c97bb48831f2a88a5dfcc067c7a4b"},"split":"validation"} {"binding":{"chosen_proof_sha256":"ba1c0657c4e5e36007d59095474142624479cfd95c5fb8093a43086d67daaefd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"03fe8452e8dda77fc756d2e905200f9aad50ed00b4f4dff36617d12d1800c918","source_sha256":"72a74d5e8415d17ef93928b2484d6fb73612e69b72912e573cba6662ce324b48","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n intro x hx\n obtain ⟨J, hJ⟩ := F.nonempty\n exact ⟨J, hJ, le_of_le_of_eq le_top (by simpa [eq_comm])⟩","hard_negative":false,"metrics":{"chosen_tokens":30,"rejected_tokens":2,"token_jaccard":0.041667,"token_length_ratio":0.066667},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"973fb474ec7d54dc0e081018bf661e429b7ec3695ccff7676d7b74495c91707d","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Order.PFilter\npublic import Mathlib.RingTheory.Ideal.Colon\n\nNamespace:\nIdealFilter\n\nLocal context:\n/-\nCopyright (c) 2025 Blake Farman. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Blake Farman\n-/\n/-!\n# Ideal Filters\n\nAn **ideal filter** is a filter in the lattice of ideals of a ring `A`.\n\n## Main definitions\n\n* `IdealFilter A`: the type of an ideal filter on a ring `A`.\n* `IsUniform F` : a filter `F` is uniform if whenever `I` is an ideal in the filter, then for all\n `a : A`, the colon ideal `I.colon {a}` is in `F`.\n* `IsTorsionElem` : Given a filter `F`, an element, `m`, of an `A`-module, `M`, is `F`-torsion if\n there exists an ideal `L` in `F` that annihilates `m`.\n* `IsTorsion` : Given a filter `F`, an `A`-module, `M`, is `F`-torsion if every element is torsion.\n* `gabrielComposition` : Given two filters `F` and `G`, the Gabriel composition of `F` and `G` is\n the set of ideals `L` of `A` such that there exists an ideal `K` in `G` with `K/L` `F`-torsion.\n This is again a filter.\n* `IsGabriel F` : a filter `F` is a Gabriel filter if it is uniform and satisfies axiom T4:\n for all `I : Ideal A`, if there exists `J ∈ F` such that for all `a ∈ J` the colon ideal\n `I.colon {a}` is in `F`, then `I ∈ F`.\n\n## Main statements\n\n* `isGabriel_iff`: a filter is Gabriel iff it is uniform and `F • F = F`.\n\n## Notation\n\n* `F • G`: the Gabriel composition of ideal filters `F` and `G`, defined by\n `gabrielComposition F G`.\n\n## Implementation notes\n\nIn the classical literature (e.g. Stenström), *right linear topologies* on a ring are often\ndescribed via filters of open **right** ideals, and the terminology is frequently abused by\nidentifying the topology with its filter of ideals.\n\nIn this development we work systematically with **left ideals**. Accordingly, Stenström’s\nright-ideal construction `(L : a) = {x ∈ A | a * x ∈ L}` is replaced by the left ideal\n`L.colon {a} = {a | x * a ∈ L}`.\n\nWith this convention, uniform filters correspond to linear (additive) topologies, while the\nadditional Gabriel condition (axiom T4) imposes an algebraic saturation property that does not\nchange the induced topology.\n\n## References\n\n* [Bo Stenström, *Rings and Modules of Quotients*][stenstrom1971]\n* [Bo Stenström, *Rings of Quotients*][stenstrom1975]\n* [nLab: Uniform filter](https://ncatlab.org/nlab/show/uniform+filter)\n* [nLab: Gabriel filter](https://ncatlab.org/nlab/show/Gabriel+filter)\n* [nLab: Gabriel composition](https://ncatlab.org/nlab/show/Gabriel+composition+of+filters)\n\n## Tags\n\nring theory, ideal, filter, uniform filter, Gabriel filter, torsion theory\n-/\n\n@[expose] public section\n\nopen scoped Pointwise\n\n/-- `IdealFilter A` is the type of `Order.PFilter`s on the lattice of ideals of `A`. -/\nabbrev IdealFilter (A : Type*) [Ring A] := Order.PFilter (Ideal A)\n\nnamespace IdealFilter\n\nvariable {A : Type*} [Ring A]\n\n/-- A filter of ideals is *uniform* if it is closed under colon by singletons. -/\nclass IsUniform (F : IdealFilter A) : Prop where\n /-- **Axiom T3.** See [stenstrom1975]. -/\n colon_mem {I : Ideal A} (hI : I ∈ F) (a : A) : I.colon {a} ∈ F\n\n/-- We say that an element `m : M` is `F`-torsion if it is annihilated by some ideal belonging to\nthe filter `F`. -/\ndef IsTorsionElem (F : IdealFilter A)\n {M : Type*} [AddCommMonoid M] [Module A M] (m : M) : Prop :=\n ∃ L ∈ F, ∀ a ∈ L, a • m = 0\n\n/-- Module-level `F`-torsion: every element is `F`-torsion. -/\ndef IsTorsion (F : IdealFilter A)\n (M : Type*) [AddCommMonoid M] [Module A M] : Prop :=\n ∀ m : M, IsTorsionElem F m\n\n/-- We say that the quotient `K/L` is `F`-torsion if every element `k ∈ K` is annihilated\n(modulo `L`) by some ideal in `F`. Equivalently, for each `k ∈ K` there exists `I ∈ F`\nsuch that `I ≤ L.colon {k}`. This formulation avoids forming the quotient module explicitly. -/\ndef IsTorsionQuot (F : IdealFilter A) (L K : Ideal A) : Prop :=\n ∀ k ∈ K, ∃ I ∈ F, I ≤ L.colon {k}\n\n/-- Intersecting the left ideal with `K` does not change `IsTorsionQuot` on the right.\nIn particular, `IsTorsionQuot F L K` need not require `L ≤ K` for it is equivalent to asserting\nthe quotient `K / (L ⊓ K)` is `F`-torsion. -/\nlemma isTorsionQuot_inter_left_iff {F : IdealFilter A} {L K : Ideal A} :\n IsTorsionQuot F (L ⊓ K) K ↔ IsTorsionQuot F L K := by\n constructor <;>\n · intro h k hk\n rcases h k hk with ⟨I, hI, hI_le⟩\n have hcol : (L ⊓ K).colon {k} = Submodule.colon L {k} :=\n Submodule.colon_inf_eq_left_of_subset (Set.singleton_subset_iff.mpr hk)\n exact ⟨I, hI, (by simpa [hcol] using hI_le)⟩\n\n\n@[simp] lemma isTorsion_def (F : IdealFilter A) (M : Type*) [AddCommMonoid M] [Module A M] :\n IsTorsion F M ↔ ∀ m : M, IsTorsionElem F m :=\n Iff.rfl\n\n@[simp] lemma isTorsionQuot_def {F : IdealFilter A} {L K : Ideal A} :\n IsTorsionQuot F L K ↔ ∀ k ∈ (K : Set A), ∃ I ∈ F, I ≤ L.colon {k} :=\n Iff.rfl\n\nTarget:\nlemma isTorsionQuot_self (F : IdealFilter A) (I : Ideal A) :\n IsTorsionQuot F I I :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/IdealFilter","family_id":"istorsionquot_self","file_id":"mathlib/Mathlib/RingTheory/IdealFilter/Basic.lean","sample_id":"03fe8452e8dda77fc756d2e905200f9aad50ed00b4f4dff36617d12d1800c918"},"split":"validation"} {"binding":{"chosen_proof_sha256":"0884aed4a51095b96f57ccb528daef1ead8aeb0a004104a4bb7af2a1aca6bcb7","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"32df83b5cfff84a0d40ea22defef52e05ad87170a8992b92463514a1299afc54","source_sha256":"e0a01946c7540aa60c56fcb889febeffcb9e2b62b643b054d427e71008a64c26","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let F' : J ⥤ Sheaf C X :=\n { obj := fun j => ⟨F.obj j, H j⟩\n map := fun f => ⟨F.map f⟩ }\n let e : F' ⋙ Sheaf.forget C X ≅ F := NatIso.ofComponents fun _ => Iso.refl _\n exact Presheaf.isSheaf_of_iso\n ((isLimitOfPreserves (Sheaf.forget C X) (limit.isLimit F')).conePointsIsoOfNatIso hc e)\n (limit F').2","hard_negative":true,"metrics":{"chosen_tokens":92,"rejected_tokens":8,"token_jaccard":0.0625,"token_length_ratio":0.086957},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"98cdb3059b6db72eed0e98353c4328a10f0e23fcfd8647fec35a343118768b6c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Sheaves.Sheaf\npublic import Mathlib.CategoryTheory.Sites.Limits\npublic import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic\n\nNamespace:\nTopCat\n\nLocal context:\n/-\nCopyright (c) 2020 Kim Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kim Morrison\n-/\n/-!\n# Presheaves in `C` have limits and colimits when `C` does.\n-/\n\npublic section\n\n\nnoncomputable section\n\nuniverse v u w t\n\nopen CategoryTheory\n\nopen CategoryTheory.Limits\n\nvariable {C : Type u} [Category.{v} C] {J : Type w} [Category* J]\n\nnamespace TopCat\n\ninstance [HasLimitsOfShape J C] (X : TopCat.{t}) : HasLimitsOfShape J (Presheaf C X) :=\n functorCategoryHasLimitsOfShape\n\ninstance [HasLimits C] (X : TopCat.{v}) : HasLimits.{v} (Presheaf C X) where\n\ninstance [HasColimitsOfShape J C] (X : TopCat) : HasColimitsOfShape J (Presheaf C X) :=\n functorCategoryHasColimitsOfShape\n\ninstance [HasColimits.{v, u} C] (X : TopCat.{t}) : HasColimitsOfSize.{v, v} (Presheaf C X) where\n\ninstance [HasLimitsOfShape J C] (X : TopCat.{t}) : CreatesLimitsOfShape J (Sheaf.forget C X) :=\n inferInstanceAs <| CreatesLimitsOfShape J (sheafToPresheaf _ _)\n\ninstance [HasLimitsOfShape J C] (X : TopCat.{t}) : HasLimitsOfShape J (Sheaf C X) :=\n hasLimitsOfShape_of_hasLimitsOfShape_createsLimitsOfShape (Sheaf.forget C X)\n\ninstance [HasLimits C] (X : TopCat) : CreatesLimits.{v, v} (Sheaf.forget C X) where\n\ninstance [HasLimits C] (X : TopCat.{v}) : HasLimitsOfSize.{v, v} (Sheaf.{v} C X) where\n\nset_option backward.isDefEq.respectTransparency false in\n\nTarget:\ntheorem isSheaf_of_isLimit [HasLimitsOfShape J C] {X : TopCat.{v}} (F : J ⥤ Presheaf.{v} C X)\n (H : ∀ j, (F.obj j).IsSheaf) {c : Cone F} (hc : IsLimit c) : c.pt.IsSheaf :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"27de53d7f3dff800409460258813ccf9e779ec9999b4f2de64668e2da7019ad2","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Sheaves","family_id":"issheaf_of_islimit","file_id":"mathlib/Mathlib/Topology/Sheaves/Limits.lean","sample_id":"32df83b5cfff84a0d40ea22defef52e05ad87170a8992b92463514a1299afc54"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b205002fc568c12815572bd8e5a82144be163527107151f5023428d9aa79e5e8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"0f5d5b2142dd098a971cfed894d13ceb07152dafeb65b14609ac21cf2f161ec7","source_sha256":"37f17dacd5bcc157b99a90651c7281496dc8bcf5b9fd1ba77727f58502e618cc","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let := Localization.AtPrime.algebraOfLiesOver (q.under R) q\n rw [inertiaDeg'_def]\n apply Module.finrank_pos","hard_negative":false,"metrics":{"chosen_tokens":23,"rejected_tokens":3,"token_jaccard":0.047619,"token_length_ratio":0.130435},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"99f10ef59437e2b5def92e12d3b5309186c985b9329df4287d73465a5be75b6d","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.NumberTheory.RamificationInertia.Inertia\npublic import Mathlib.RingTheory.QuasiFinite.Basic\n\nNamespace:\nIdeal\n\nLocal context:\n/-\nCopyright (c) 2026 Thomas Browning. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Thomas Browning\n-/\n/-!\n# Inertia degree\n\nGiven a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\n## Main definitions\n\n* `Ideal.inertiaDeg' q R`: The inertia degree of `q` over `R`.\n\n## Main statements\n\n* `inertiaDeg_eq_inertiaDeg'`: The inertia degree agrees with the usual definition in the case of\n maximal ideals.\n* `inertiaDeg'_tower`: Inertia degree is multiplicative in towers.\n-/\n\n@[expose] public section\n\nnamespace Ideal\n\nsection\n\nvariable {S : Type*} [CommRing S] (q : Ideal S) (R : Type*) [CommRing R] [Algebra R S]\n\nopen Classical in\n/-- Given a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\nWhen `q` is not prime, we use a junk value of `0`.\n\nThis will eventually replace the existing definition of `Ideal.inertiaDeg`. -/\nnoncomputable def inertiaDeg' : ℕ :=\n if _ : q.IsPrime then\n letI := Localization.AtPrime.algebraOfLiesOver (q.under R) q\n Module.finrank (q.under R).ResidueField q.ResidueField else 0\n\ntheorem inertiaDeg'_def [hq : q.IsPrime]\n [Algebra (Localization.AtPrime (q.under R)) (Localization.AtPrime q)]\n [Localization.AtPrime.IsLiesOverAlgebra (q.under R) q] :\n q.inertiaDeg' R = Module.finrank (q.under R).ResidueField q.ResidueField := by\n convert! dif_pos hq\n simp [Algebra.algebra_ext_iff, Localization.AtPrime.IsLiesOverAlgebra.algebraMap_eq]\n\ntheorem inertiaDeg'_of_not_isPrime (hq : ¬ q.IsPrime) : q.inertiaDeg' R = 0 :=\n dif_neg hq\n\nTarget:\ntheorem inertiaDeg'_pos [hq : q.IsPrime] [Module.Finite R S] : 0 < q.inertiaDeg' R :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/RamificationInertia","family_id":"inertiadeg'_pos","file_id":"mathlib/Mathlib/RingTheory/RamificationInertia/Inertia.lean","sample_id":"0f5d5b2142dd098a971cfed894d13ceb07152dafeb65b14609ac21cf2f161ec7"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d50b756eaade280806a139d7660ce807405f96ef06b18f58e23f13c29c199cb6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"49f7d7a3e6fe985d533fc3d2d40856e1a9fa3e08ac32f94325a15558314ac1dc","source_sha256":"2d1ca9408fcd1765e9d2dc833c7f4cbefad14ad1a3c169f30ede2989831b39df","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [ZMod.minOrder hp.ne_zero hp.ne_one, hp.minFac_eq]","hard_negative":false,"metrics":{"chosen_tokens":17,"rejected_tokens":5,"token_jaccard":0.0625,"token_length_ratio":0.294118},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"9a36057a474695fc15ddedb57e963ae823b70eed08ff3ecb689d8fe8ea0c2a06","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Torsion\npublic import Mathlib.Data.ENat.Lattice\npublic import Mathlib.Data.ZMod.QuotientGroup\n\nNamespace:\nZMod\n\nLocal context:\n/-\nCopyright (c) 2023 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Minimum order of an element\n\nThis file defines the minimum order of an element of a monoid.\n\n## Main declarations\n\n* `Monoid.minOrder`: The minimum order of an element of a given monoid.\n* `Monoid.minOrder_eq_top`: The minimum order is infinite iff the monoid is torsion-free.\n* `ZMod.minOrder`: The minimum order of $ℤ/nℤ$ is the smallest factor of `n`, unless `n = 0, 1`.\n-/\n\n@[expose] public section\n\nopen Subgroup\n\nvariable {G α : Type*}\n\nnamespace Monoid\nsection Monoid\nvariable (α) [Monoid α]\n\n/-- The minimum order of a non-identity element. Also the minimum size of a nontrivial subgroup, see\n`Monoid.le_minOrder_iff_forall_subgroup`. Returns `∞` if the monoid is torsion-free. -/\n@[to_additive /-- The minimum order of a non-identity element. Also the minimum size of a nontrivial\nsubgroup, see `AddMonoid.le_minOrder_iff_forall_addSubgroup`. Returns `∞` if the monoid is\ntorsion-free. -/]\nnoncomputable def minOrder : ℕ∞ := ⨅ (a : α) (_ha : a ≠ 1) (_ha' : IsOfFinOrder a), orderOf a\n\nvariable {α} {a : α}\n\n@[to_additive (attr := simp)]\nlemma le_minOrder {n : ℕ∞} :\n n ≤ minOrder α ↔ ∀ ⦃a : α⦄, a ≠ 1 → IsOfFinOrder a → n ≤ orderOf a := by simp [minOrder]\n\n@[to_additive]\nlemma minOrder_le_orderOf (ha : a ≠ 1) (ha' : IsOfFinOrder a) : minOrder α ≤ orderOf a :=\n le_minOrder.1 le_rfl ha ha'\n\nend Monoid\n\nsection Group\nvariable [Group G] {s : Subgroup G}\n\n@[to_additive]\nlemma le_minOrder_iff_forall_subgroup {n : ℕ∞} :\n n ≤ minOrder G ↔ ∀ ⦃s : Subgroup G⦄, s ≠ ⊥ → (s : Set G).Finite → n ≤ Nat.card s := by\n rw [le_minOrder]\n refine ⟨fun h s hs hs' ↦ ?_, fun h a ha ha' ↦ ?_⟩\n · obtain ⟨a, has, ha⟩ := s.bot_or_exists_ne_one.resolve_left hs\n exact\n (h ha <| finite_zpowers.1 <| hs'.subset <| zpowers_le.2 has).trans\n (WithTop.coe_le_coe.2 <| s.orderOf_le_card hs' has)\n · simpa using h (zpowers_ne_bot.2 ha) ha'.finite_zpowers\n\n@[to_additive]\nlemma minOrder_le_natCard (hs : s ≠ ⊥) (hs' : (s : Set G).Finite) : minOrder G ≤ Nat.card s :=\n le_minOrder_iff_forall_subgroup.1 le_rfl hs hs'\n\n@[to_additive (attr := simp)]\nlemma minOrder_eq_top [IsMulTorsionFree G] : minOrder G = ⊤ := by\n simpa [minOrder] using fun _ ↦ not_isOfFinOrder_of_isMulTorsionFree\n\nend Group\n\nsection CommGroup\nvariable [CommGroup G] {s : Subgroup G}\n\n@[to_additive (attr := simp)]\nlemma minOrder_eq_top_iff : minOrder G = ⊤ ↔ IsMulTorsionFree G := by\n simp [minOrder, isMulTorsionFree_iff_not_isOfFinOrder]\n\nend CommGroup\nend Monoid\n\nopen AddMonoid AddSubgroup Nat Set\n\nnamespace ZMod\n\n@[simp]\nprotected lemma minOrder {n : ℕ} (hn : n ≠ 0) (hn₁ : n ≠ 1) : minOrder (ZMod n) = n.minFac := by\n have : Fact (1 < n) := ⟨one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn, hn₁⟩⟩\n classical\n have : (↑(n / n.minFac) : ZMod n) ≠ 0 := by\n rw [Ne, ringChar.spec, ringChar.eq (ZMod n) n]\n exact\n not_dvd_of_pos_of_lt (Nat.div_pos (minFac_le hn.bot_lt) n.minFac_pos)\n (div_lt_self hn.bot_lt (minFac_prime hn₁).one_lt)\n refine ((minOrder_le_natCard (zmultiples_eq_bot.not.2 this) <| toFinite _).trans ?_).antisymm <|\n le_minOrder_iff_forall_addSubgroup.2 fun s hs _ ↦ ?_\n · rw [Nat.card_zmultiples, ZMod.addOrderOf_coe _ hn,\n gcd_eq_right (div_dvd_of_dvd n.minFac_dvd), Nat.div_div_self n.minFac_dvd hn]\n · haveI : Nontrivial s := s.bot_or_nontrivial.resolve_left hs\n exact WithTop.coe_le_coe.2 <| minFac_le_of_dvd Finite.one_lt_card <|\n (card_addSubgroup_dvd_card _).trans n.card_zmod.dvd\n\n@[simp]\n\nTarget:\nlemma minOrder_of_prime {p : ℕ} (hp : p.Prime) : minOrder (ZMod p) = p :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Order","family_id":"minorder_of_prime","file_id":"mathlib/Mathlib/GroupTheory/Order/Min.lean","sample_id":"49f7d7a3e6fe985d533fc3d2d40856e1a9fa3e08ac32f94325a15558314ac1dc"},"split":"validation"} {"binding":{"chosen_proof_sha256":"96a4647d38d2be134bd0cbc054a26eb639ec9b413425186d651a50ebfb54c53a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ced8639e1ca4d495f44ecd51985ed45400cfaa22445376bb03249bbf6ab81a02","source_sha256":"917f3cb2e1213b32d3e18dd0a2b54c8129085a11b702148659e7554792c22323","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine .of_continuous_injective_isClosedMap\n natUnionInftyEmbedding.continuous ?_ ?_\n · rintro (_ | n) (_ | m) h\n · rfl\n · simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, zero_eq_inv] at h\n assumption_mod_cast\n · simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, inv_eq_zero] at h\n assumption_mod_cast\n · simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, inv_inj, add_left_inj,\n Nat.cast_inj] at h\n rw [h]\n · exact fun _ hC => (hC.isCompact.image natUnionInftyEmbedding.continuous).isClosed","hard_negative":false,"metrics":{"chosen_tokens":104,"rejected_tokens":2,"token_jaccard":0.04878,"token_length_ratio":0.019231},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"9d8138207c12c436ab57c27043731c6f1bfdb0643d93d6cab884e878ec947c2b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Compactification.OnePoint.Basic\npublic import Mathlib.Topology.Category.LightProfinite.Basic\n\nNamespace:\nLightProfinite\n\nLocal context:\n/-\nCopyright (c) 2024 Dagur Asgeirsson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Dagur Asgeirsson\n-/\n/-!\n\n# The light profinite set classifying convergent sequences\n\nThis file defines the light profinite set `ℕ∪{∞}`, defined as the one point compactification of\n`ℕ`.\n-/\n\n@[expose] public section\n\nopen CategoryTheory OnePoint TopologicalSpace Topology\n\nnamespace LightProfinite\n\n/-- The continuous map from `ℕ∪{∞}` to `ℝ` sending `n` to `1/(n+1)` and `∞` to `0`. -/\nnoncomputable def natUnionInftyEmbedding : C(OnePoint ℕ, ℝ) where\n toFun\n | ∞ => 0\n | OnePoint.some n => 1 / (n + 1 : ℝ)\n continuous_toFun := OnePoint.continuous_iff_from_nat _ |>.mpr\n tendsto_one_div_add_atTop_nhds_zero_nat\n\n/--\nThe continuous map from `ℕ∪{∞}` to `ℝ` sending `n` to `1/(n+1)` and `∞` to `0` is a closed\nembedding.\n-/\n\nTarget:\nlemma isClosedEmbedding_natUnionInftyEmbedding : IsClosedEmbedding natUnionInftyEmbedding :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Category","family_id":"isclosedembedding_natunioninftyembedding","file_id":"mathlib/Mathlib/Topology/Category/LightProfinite/Sequence.lean","sample_id":"ced8639e1ca4d495f44ecd51985ed45400cfaa22445376bb03249bbf6ab81a02"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5ff4fe1ce8ea0c1513443d99362da477a119bb068ccbcdbd0e1bf12aed838f28","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"da5c0f2b9ba29a27ad391cdca1e174df2ca74d15861a88d5b8ad067be04e6ef8","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"2ffb7bc3cdc6661fedeaa8ff798c20a2df36f8d23e5658ee8f8eca3374b417bf","source_sha256":"c5f2821e1022912479225343e085671f902aa490700adbce0fd87ebd02ef26e6","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have h_finrank_inf : finrank K ↑(s ⊓ t) = 0 := by\n rw [disjoint_iff_inf_le, le_bot_iff] at hdisjoint\n rw [hdisjoint, finrank_bot]\n apply eq_top_of_finrank_eq\n replace hdim : finrank K V = finrank K s + finrank K t :=\n le_antisymm hdim (finrank_add_finrank_le_of_disjoint hdisjoint)\n rw [hdim]\n convert! s.finrank_sup_add_finrank_inf_eq t\n rw [h_finrank_inf, add_zero]","hard_negative":true,"metrics":{"chosen_tokens":69,"rejected_tokens":2,"token_jaccard":0.026316,"token_length_ratio":0.028986},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"9f2cc469636838ac739ee9afba82ddbcbc989ea75cc4bcb4acebdc2226629a8a","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Dimension.DivisionRing\npublic import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition\npublic import Mathlib.LinearAlgebra.FiniteDimensional.Basic\npublic import Mathlib.Tactic.IntervalCases\n\nNamespace:\nSubmodule\n\nLocal context:\n/-\nCopyright (c) 2019 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Finite-dimensional vector spaces\n\nThis file contains some further development of finite-dimensional vector spaces, their dimensions,\nand linear maps on such spaces.\n\nDefinitions are in `Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean`\nand results that require fewer imports are in `Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean`.\n-/\n\n@[expose] public section\n\nassert_not_exists Monoid.exponent Module.IsTorsion\n\n\nuniverse u v v'\n\nopen Cardinal Submodule Module Function\n\nvariable {K : Type u} {V : Type v}\n\nnamespace Submodule\n\nopen IsNoetherian Module\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V]\n\n/-- The dimension of a strict submodule is strictly bounded by the dimension of the ambient\nspace.\n\nSee also `Submodule.length_lt`. -/\ntheorem finrank_lt [FiniteDimensional K V] {s : Submodule K V} (h : s ≠ ⊤) :\n finrank K s < finrank K V := by\n rw [← s.finrank_quotient_add_finrank, add_comm]\n rw [← Quotient.nontrivial_iff] at h\n exact Nat.lt_add_of_pos_right finrank_pos\n\n/-- The sum of the dimensions of s + t and s ∩ t is the sum of the dimensions of s and t -/\ntheorem finrank_sup_add_finrank_inf_eq (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] :\n finrank K ↑(s ⊔ t) + finrank K ↑(s ⊓ t) = finrank K ↑s + finrank K ↑t := by\n have key : Module.rank K ↑(s ⊔ t) + Module.rank K ↑(s ⊓ t) = Module.rank K s + Module.rank K t :=\n rank_sup_add_rank_inf_eq s t\n repeat rw [← finrank_eq_rank] at key\n norm_cast at key\n\ntheorem finrank_add_le_finrank_add_finrank (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] : finrank K (s ⊔ t : Submodule K V) ≤ finrank K s + finrank K t := by\n rw [← finrank_sup_add_finrank_inf_eq]\n exact self_le_add_right _ _\n\ntheorem finrank_add_finrank_le_of_disjoint [FiniteDimensional K V]\n {s t : Submodule K V} (hdisjoint : Disjoint s t) :\n finrank K s + finrank K t ≤ finrank K V := by\n rw [← Submodule.finrank_sup_add_finrank_inf_eq s t, hdisjoint.eq_bot, finrank_bot, add_zero]\n exact Submodule.finrank_le _\n\nTarget:\ntheorem eq_top_of_disjoint [FiniteDimensional K V] (s t : Submodule K V)\n (hdim : finrank K V ≤ finrank K s + finrank K t) (hdisjoint : Disjoint s t) : s ⊔ t = ⊤ :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_2ffb7bc3cdc6","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"ad5cbf567cf97ac13dc56f4a323bf3e49f4e55798955ce91b07342865cdf42bd","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/FiniteDimensional","family_id":"eq_top_of_disjoint","file_id":"mathlib/Mathlib/LinearAlgebra/FiniteDimensional/Lemmas.lean","sample_id":"2ffb7bc3cdc6661fedeaa8ff798c20a2df36f8d23e5658ee8f8eca3374b417bf"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8fb58c6f14a266699e3630ddc08f2506df27ecb4cd3ed55d66121a2125f0f457","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d35f578aeb3865679d33c329115886c0cf2d3fd65ba43bc6758cfe8ff02b20f7","source_sha256":"a39928ff7890cdcd21c8866bd1117c6c0758a4d9558d42687caaffe7e7599081","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_rw [Equiv.Perm.coe_pow]; exact MapsTo.iterate","hard_negative":false,"metrics":{"chosen_tokens":14,"rejected_tokens":2,"token_jaccard":0.076923,"token_length_ratio":0.142857},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"a40d6cbafc062f22629f7a584a46b0995478b9527da56158b45278c8cfb87f33","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Defs\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Logic.Equiv.Set\npublic import Mathlib.Tactic.Common\n\nNamespace:\nSet\n\nLocal context:\n/-\nCopyright (c) 2015 Microsoft Corporation. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Leonardo de Moura, Mario Carneiro\n-/\n/-!\n# Extra lemmas about permutations\n\nThis file proves miscellaneous lemmas about `Equiv.Perm`.\n\n## TODO\n\nMost of the content of this file was moved to `Mathlib/Algebra/Group/End.lean` in\nhttps://github.com/leanprover-community/mathlib4/pull/22141.\nIt would be good to merge the remaining lemmas with other files, e.g.\n`GroupTheory.Perm.ViaEmbedding` looks like it could benefit from such a treatment (splitting into\nthe algebra and non-algebra parts).\n-/\n\npublic section\n\n\nuniverse u v\n\nnamespace Equiv\n\nvariable {α : Type u} {β : Type v}\n\nsection Swap\n\nvariable [DecidableEq α]\n\n@[simp]\ntheorem swap_smul_self_smul [MulAction (Perm α) β] (i j : α) (x : β) :\n swap i j • swap i j • x = x := by simp [smul_smul]\n\ntheorem swap_smul_involutive [MulAction (Perm α) β] (i j : α) :\n Function.Involutive (swap i j • · : β → β) := swap_smul_self_smul i j\n\nend Swap\nend Equiv\n\nopen Equiv Function\n\nnamespace Set\nvariable {α : Type*} {f : Perm α} {s : Set α}\n\nlemma BijOn.perm_inv (hf : BijOn f s s) : BijOn ↑(f⁻¹) s s := hf.symm f.invOn\n\nTarget:\nlemma MapsTo.perm_pow : MapsTo f s s → ∀ n : ℕ, MapsTo (f ^ n) s s :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Perm","family_id":"mapsto","file_id":"mathlib/Mathlib/GroupTheory/Perm/Basic.lean","sample_id":"d35f578aeb3865679d33c329115886c0cf2d3fd65ba43bc6758cfe8ff02b20f7"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4dacf2aed3011dd313380ff94e829dbf4569a37fb51cb289a73f3a0d9653d731","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"005d896ce1eba8ca638f3fb23cb6fc96f3e143afc72233402e25f53f4c989434","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"1e76a6937ef7eed199c024ad2570137983c4d386f4cd87e171a864689afcb800","source_sha256":"34350a16580be8156d160cc3af1b21b173a7989c542045e07884d27af6d9ea99","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n ext U\n change IsOpen (p ⁻¹' U) ↔ ∃ V, _\n simp_rw [hf.isOpen_iff,\n (Set.image_surjective.mpr hq.surjective).exists,\n ← hq.isQuotientMap.isOpen_preimage]\n constructor\n · rintro ⟨V, hV, e⟩\n refine ⟨V, hq.continuous.1 _ (hq.isOpenMap _ hV), ?_⟩\n ext x\n obtain ⟨x, rfl⟩ := hp x\n constructor\n · rintro ⟨y, hy, e'⟩\n obtain ⟨y, rfl⟩ := H ⟨_, ⟨x, rfl⟩, (e'.trans (congr_fun h x)).symm⟩\n rw [← hg ((congr_fun h y).trans e')]\n exact e.le hy\n · intro H\n exact ⟨f x, e.ge H, congr_fun h.symm x⟩\n · rintro ⟨V, hV, rfl⟩\n refine ⟨_, hV, ?_⟩\n simp_rw [← Set.preimage_comp, h]","hard_negative":true,"metrics":{"chosen_tokens":191,"rejected_tokens":5,"token_jaccard":0.045455,"token_length_ratio":0.026178},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"a5760129ddcc2141b7e9d712a0a4d10425484992eb151c3ad796d718eccfc206","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Maps.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Open quotient maps\n\nAn open quotient map is an open map `f : X → Y` which is both an open map and a quotient map.\nEquivalently, it is a surjective continuous open map.\nWe use the latter characterization as a definition.\n\nMany important quotient maps are open quotient maps, including\n\n- the quotient map from a topological space to its quotient by the action of a group;\n- the quotient map from a topological group to its quotient by a normal subgroup;\n- the quotient map from a topological space to its separation quotient.\n\nContrary to general quotient maps,\nthe category of open quotient maps is closed under `Prod.map`.\n-/\n\npublic section\n\nopen Filter Function Set Topology\n\nvariable {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] {f : X → Y}\n\nnamespace IsOpenQuotientMap\n\nprotected theorem id : IsOpenQuotientMap (id : X → X) := ⟨surjective_id, continuous_id, .id⟩\n\n/-- An open quotient map is a quotient map. -/\ntheorem isQuotientMap (h : IsOpenQuotientMap f) : IsQuotientMap f :=\n h.isOpenMap.isQuotientMap h.continuous h.surjective\n\ntheorem iff_isOpenMap_isQuotientMap : IsOpenQuotientMap f ↔ IsOpenMap f ∧ IsQuotientMap f :=\n ⟨fun h ↦ ⟨h.isOpenMap, h.isQuotientMap⟩, fun ⟨ho, hq⟩ ↦ ⟨hq.surjective, hq.continuous, ho⟩⟩\n\ntheorem of_isOpenMap_isQuotientMap (ho : IsOpenMap f) (hq : IsQuotientMap f) :\n IsOpenQuotientMap f :=\n iff_isOpenMap_isQuotientMap.2 ⟨ho, hq⟩\n\ntheorem comp {g : Y → Z} (hg : IsOpenQuotientMap g) (hf : IsOpenQuotientMap f) :\n IsOpenQuotientMap (g ∘ f) :=\n ⟨.comp hg.1 hf.1, .comp hg.2 hf.2, .comp hg.3 hf.3⟩\n\ntheorem map_nhds_eq (h : IsOpenQuotientMap f) (x : X) : map f (𝓝 x) = 𝓝 (f x) :=\n le_antisymm h.continuous.continuousAt <| h.isOpenMap.nhds_le _\n\ntheorem continuous_comp_iff (h : IsOpenQuotientMap f) {g : Y → Z} :\n Continuous (g ∘ f) ↔ Continuous g :=\n h.isQuotientMap.continuous_iff.symm\n\ntheorem continuousAt_comp_iff (h : IsOpenQuotientMap f) {g : Y → Z} {x : X} :\n ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) := by\n simp only [ContinuousAt, ← h.map_nhds_eq, tendsto_map'_iff, comp_def]\n\ntheorem dense_preimage_iff (h : IsOpenQuotientMap f) {s : Set Y} : Dense (f ⁻¹' s) ↔ Dense s :=\n ⟨fun hs ↦ h.surjective.denseRange.dense_of_mapsTo h.continuous hs (mapsTo_preimage _ _),\n fun hs ↦ hs.preimage h.isOpenMap⟩\n\nend IsOpenQuotientMap\n\ntheorem Topology.IsInducing.isOpenQuotientMap_of_surjective (ind : IsInducing f)\n (surj : Function.Surjective f) : IsOpenQuotientMap f where\n surjective := surj\n continuous := ind.continuous\n isOpenMap U U_open := by\n obtain ⟨V, hV, rfl⟩ := ind.isOpen_iff.mp U_open\n rwa [V.image_preimage_eq surj]\n\ntheorem Topology.IsInducing.isQuotientMap_of_surjective (ind : IsInducing f)\n (surj : Function.Surjective f) : IsQuotientMap f :=\n (ind.isOpenQuotientMap_of_surjective surj).isQuotientMap\n\nsection Subquotient\n\nvariable {A B C D : Type*}\nvariable [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] [TopologicalSpace D]\nvariable (f : A → B) (g : C → D) (p : A → C) (q : B → D)\n\nomit [TopologicalSpace C] in\n/--\nGiven the following diagram with `f` inducing, `p` surjective,\n`q` an open quotient map, and `g` injective. Suppose the image of `A` in `B` is stable\nunder the equivalence mod `q`, then the coinduced topology on `C` (from `A`)\ncoincides with the induced topology (from `D`).\n```\nA -f→ B\n∣ ∣\np q\n↓ ↓\nC -g→ D\n```\n\nA typical application is when `K ≤ H` are subgroups of `G`, then the quotient topology on `H/K`\nis also the subspace topology from `G/K`.\n-/\n\nTarget:\nlemma coinduced_eq_induced_of_isOpenQuotientMap_of_isInducing\n (h : g ∘ p = q ∘ f)\n (hf : IsInducing f) (hp : Function.Surjective p)\n (hq : IsOpenQuotientMap q) (hg : Function.Injective g)\n (H : q ⁻¹' q '' Set.range f ⊆ Set.range f) :\n ‹TopologicalSpace A›.coinduced p = ‹TopologicalSpace D›.induced g :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_1e76a6937ef7","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"e8cfe9594669b8856b31fd730ac56d9e14f2d7de116f808b7ba9512c9074fd32","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Maps","family_id":"coinduced_eq_induced_of_isopenquotientmap_of_isinducing","file_id":"mathlib/Mathlib/Topology/Maps/OpenQuotient.lean","sample_id":"1e76a6937ef7eed199c024ad2570137983c4d386f4cd87e171a864689afcb800"},"split":"validation"} {"binding":{"chosen_proof_sha256":"76e366f5fa46bedf55f80e4fe13ea42e4abec33a4984b6cfbbd385f0e3966549","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"6c8fe76d7d5b9445f80fa88773e7e040dba76c83483359c8ece78cffd4125daa","source_sha256":"3cf25ec0a66d4cd0e72d015f27da2a40d04295e8624f25b2320308ac159eb3f0","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by rw [elim_comp fun f : α → β => f y]","hard_negative":true,"metrics":{"chosen_tokens":14,"rejected_tokens":8,"token_jaccard":0.111111,"token_length_ratio":0.571429},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"a77f68609b5f36357e4b0dc1ffb47ae5463cc5f4e1b0e9bb361922d7bf2bd28a","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Control.Combinators\npublic import Mathlib.Data.Option.Defs\npublic import Mathlib.Logic.IsEmpty.Basic\npublic import Mathlib.Logic.Relator\npublic import Mathlib.Util.CompileInductive\npublic import Aesop\npublic import Batteries.Tactic.Lint.Simp\n\nNamespace:\nOption\n\nLocal context:\n/-\nCopyright (c) 2017 Mario Carneiro. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Mario Carneiro\n-/\n/-!\n# Option of a type\n\nThis file develops the basic theory of option types.\n\nIf `α` is a type, then `Option α` can be understood as the type with one more element than `α`.\n`Option α` has terms `some a`, where `a : α`, and `none`, which is the added element.\nThis is useful in multiple ways:\n* It is the prototype of addition of terms to a type. See for example `WithBot α` which uses\n `none` as an element smaller than all others.\n* It can be used to define failsafe partial functions, which return `some the_result_we_expect`\n if we can find `the_result_we_expect`, and `none` if there is no meaningful result. This forces\n any subsequent use of the partial function to explicitly deal with the exceptions that make it\n return `none`.\n* `Option` is a monad. We love monads.\n\n`Part` is an alternative to `Option` that can be seen as the type of `True`/`False` values\nalong with a term `a : α` if the value is `True`.\n\n-/\n\n@[expose] public section\n\nuniverse u\n\nnamespace Option\n\nvariable {α β γ δ : Type*}\n\ntheorem coe_def : (fun a ↦ ↑a : α → Option α) = some :=\n rfl\n\ntheorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp\n\n@[simp 1100]\ntheorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} :\n f a ∈ o.map f ↔ a ∈ o := by\n aesop\n\ntheorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} :\n (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp\n\ntheorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} :\n (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp\n\ntheorem coe_get {o : Option α} (h : o.isSome) : ((Option.get _ h : α) : Option α) = o :=\n Option.some_get h\n\ntheorem eq_of_mem_of_mem {a : α} {o1 o2 : Option α} (h1 : a ∈ o1) (h2 : a ∈ o2) : o1 = o2 :=\n h1.trans h2.symm\n\ntheorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α → Prop) :=\n fun _ _ _ => mem_unique\n\ntheorem some_injective (α : Type*) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp\n\n@[simp]\ntheorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f :=\n rfl\n\n@[congr]\ntheorem bind_congr' {f g : α → Option β} {x y : Option α} (hx : x = y)\n (hf : ∀ a ∈ y, f a = g a) : x.bind f = y.bind g :=\n hx.symm ▸ bind_congr hf\n\ntheorem joinM_eq_join : joinM = @join α :=\n funext fun _ ↦ rfl\n\ntheorem bind_eq_bind' {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=\n rfl\n\ntheorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=\n rfl\n\n@[simp]\ntheorem map_coe' {a : α} {f : α → β} : Option.map f (a : Option α) = ↑(f a) :=\n rfl\n\n/-- `Option.map` as a function between functions is injective. -/\ntheorem map_injective' : Function.Injective (@Option.map α β) := fun f g h ↦\n funext fun x ↦ some_injective _ <| by simp only [← map_some, h]\n\n@[simp]\ntheorem map_inj {f g : α → β} : Option.map f = Option.map g ↔ f = g :=\n map_injective'.eq_iff\n\n@[simp]\ntheorem map_eq_id {f : α → α} : Option.map f = id ↔ f = id :=\n map_injective'.eq_iff' map_id\n\ntheorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)\n (a : α) :\n (Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by rw [map_map, h, ← map_map]\n\nsection pmap\n\nvariable {p : α → Prop} (f : ∀ a : α, p a → β) (x : Option α)\n\ntheorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by\n rw [mem_def] at ha ⊢\n subst ha\n rfl\n\ntheorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)\n (H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :\n pmap f (x >>= g) H = x >>= fun a ↦ pmap f (g a) fun _ h ↦ H _ (H' a _ h) := by\n grind [cases Option]\n\ntheorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :\n pmap f x H >>= g = x.pbind fun a h ↦ g (f a (H _ h)) := by\n grind [cases Option, pmap]\n\nvariable {f x}\n\ntheorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}\n (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by\n grind [cases Option]\n\ntheorem join_pmap_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :\n (pmap (pmap f) x H).join = pmap f x.join fun a h ↦ H (some a) (mem_of_mem_join h) _ rfl := by\n grind [cases Option]\n\ntheorem pmap_bind_id_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :\n ((pmap (pmap f) x H).bind fun a ↦ a) =\n pmap f x.join fun a h ↦ H (some a) (mem_of_mem_join h) _ rfl := by\n grind [cases Option]\n\nend pmap\n\n@[simp]\ntheorem seq_some {α β} {a : α} {f : α → β} : some f <*> some a = some (f a) :=\n rfl\n\n@[deprecated \"Use `Option.get` with proof of `isSome`.\" (since := \"2026-01-05\")]\ntheorem iget_mem [Inhabited α] : ∀ {o : Option α}, isSome o → o.iget ∈ o\n | some _, _ => rfl\n\n@[deprecated \"Use `Option.getD`.\" (since := \"2026-01-05\")]\ntheorem iget_of_mem [Inhabited α] {a : α} : ∀ {o : Option α}, a ∈ o → o.iget = a\n | _, rfl => rfl\n\n@[deprecated \"Use `Option.getD` directly.\" (since := \"2026-01-05\")]\ntheorem getD_default_eq_iget [Inhabited α] (o : Option α) :\n o.getD default = o.iget := by cases o <;> rfl\n\n@[simp, grind =]\ntheorem failure_eq_none {α} : failure = (none : Option α) := rfl\n\n@[simp]\ntheorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by\n grind [cases Option, _root_.guard]\n\n/-- Given an element of `a : Option α`, a default element `b : β` and a function `α → β`, apply this\nfunction to `a` if it comes from `α`, and return `b` otherwise. -/\ndef casesOn' : Option α → β → (α → β) → β\n | none, n, _ => n\n | some a, _, s => s a\n\n@[simp]\ntheorem casesOn'_none (x : β) (f : α → β) : casesOn' none x f = x :=\n rfl\n\n@[simp]\ntheorem casesOn'_some (x : β) (f : α → β) (a : α) : casesOn' (some a) x f = f a :=\n rfl\n\n@[simp]\ntheorem casesOn'_coe (x : β) (f : α → β) (a : α) : casesOn' (a : Option α) x f = f a :=\n rfl\n\n@[simp]\ntheorem casesOn'_none_coe (f : Option α → β) (o : Option α) :\n casesOn' o (f none) (f ∘ (fun a ↦ ↑a)) = f o := by cases o <;> rfl\n\nlemma casesOn'_eq_elim (b : β) (f : α → β) (a : Option α) :\n Option.casesOn' a b f = Option.elim a b f := by cases a <;> rfl\n\ntheorem orElse_eq_some (o o' : Option α) (x : α) :\n (o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x := by\n simp\n\ntheorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none := by\n simp\n\nsection\n\ntheorem choice_eq_none (α : Type*) [IsEmpty α] : choice α = none :=\n choice_eq_none_iff_not_nonempty.mpr (not_nonempty_iff_imp_false.mpr isEmptyElim)\n\nend\n\n@[simp]\ntheorem elim_none_some (f : Option α → β) (i : Option α) : i.elim (f none) (f ∘ some) = f i := by\n cases i <;> rfl\n\ntheorem elim_comp (h : α → β) {f : γ → α} {x : α} {i : Option γ} :\n (i.elim (h x) fun j => h (f j)) = h (i.elim x f) := by cases i <;> rfl\n\ntheorem elim_comp₂ (h : α → β → γ) {f : γ → α} {x : α} {g : γ → β} {y : β}\n {i : Option γ} : (i.elim (h x y) fun j => h (f j) (g j)) = h (i.elim x f) (i.elim y g) := by\n cases i <;> rfl\n\nTarget:\ntheorem elim_apply {f : γ → α → β} {x : α → β} {i : Option γ} {y : α} :\n i.elim x f y = i.elim (x y) fun j => f j y :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"4200eacac8740ba0ed882d6658f27de025a19aad628b7985c7f90ee53142d45a","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Option","family_id":"elim_apply","file_id":"mathlib/Mathlib/Data/Option/Basic.lean","sample_id":"6c8fe76d7d5b9445f80fa88773e7e040dba76c83483359c8ece78cffd4125daa"},"split":"validation"} {"binding":{"chosen_proof_sha256":"62c9042c5bada54f7629265637e200109ebcc62aa86c0afc8c2ad4da09366c07","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c17b4685c3b2580e211299c4be46b731e14a9bf7d030fd120481c7f90fa8129","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d86e4bf52041d047197ceb9d1f42dcbff6065adc46b4b00663a325a378883e3f","source_sha256":"b677be1637d0f0510422dcf696d28dc69e3d9a311a292b4280b55b63ec13d4f6","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rintro e he\n ext x\n exact hHG.isLoopAt_congr he","hard_negative":true,"metrics":{"chosen_tokens":11,"rejected_tokens":5,"token_jaccard":0.25,"token_length_ratio":0.454545},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"a863e29fba8a63acea00838bcb30fb7b73dc8162a0c7309f524123e7dad63930","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Combinatorics.Graph.Basic\npublic import Mathlib.Tactic.TFAE\n\nNamespace:\nGraph\n\nLocal context:\n/-\nCopyright (c) 2025 Peter Nelson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Peter Nelson, Jun Kwon\n-/\n/-!\n# Subgraphs of multigraphs\n\nThis file develops the basic theory of subgraphs for multigraphs `Graph α β`:\nthe subgraph relation, standard classes of subgraphs (spanning, induced, closed),\nand the bottom element `⊥`.\n\n## Main definitions\n\n- `H ≤ G`: the subgraph relation as a partial order on graphs. This is the preferred spelling over\n `H.IsSubgraph G` which it is definitionally equal to.\n- `H ≤s G` (`Graph.IsSpanningSubgraph`): `H` has the same vertex set as `G`.\n- `H ≤i G` (`Graph.IsInducedSubgraph`): `H` contains every ambient link between its vertices.\n- `H ≤c G` (`Graph.IsClosedSubgraph`): `H` is a union of components of `G`.\n- `⊥`: empty graph with no vertices or edges as its bottom element.\n\n## Implementation notes\n\nFollowing the overall design of `Graph`, subgraphs are terms of the same type `Graph α β`\nrather than a separate `Subgraph` structure. This allows us to reuse notation and lemmas\nuniformly and to express the subgraph order directly as a partial order on `Graph α β`.\n\n`G ≤ H` is the canonical spelling for \"G is a subgraph of H\". This is definitionally equal to\n`G.IsSubgraph H` which exists only for implementation reasons.\nThe explicit `IsSubgraph` structure is defined so that stronger subgraph notions\n(such as `IsSpanningSubgraph`, `IsInducedSubgraph`, and `IsClosedSubgraph`) can extend it.\nThis allows them to inherit fundamental fields and lemmas like `vertexSet_mono` and `edgeSet_mono`\nwithout lemma duplication. However, in statements and proofs, users use `G ≤ H` instead.\nThe relation `≤` is the `simp` normal form, and the API is developed entirely in terms of it.\n\n## Tags\n\ngraphs, subgraph, induced subgraph, spanning subgraph, closed subgraph\n-/\n\npublic section\n\nvariable {α β : Type*} {x y z u v w : α} {e f : β} {G G₁ G₂ H H₁ H₂ K : Graph α β} {F F₁ F₂ : Set β}\n {X Y : Set α}\n\nopen Set\n\nopen scoped Sym2\n\nnamespace Graph\n\nsection Subgraph\n\n/-- `IsSubgraph H G` is NOT the preferred spelling for the subgraph relation. Please use\n`H ≤ G` instead. -/\n@[mk_iff]\nstructure IsSubgraph (H G : Graph α β) : Prop where\n vertexSet_mono : V(H) ⊆ V(G) := by aesop\n isLink_mono : ∀ ⦃e x y⦄, H.IsLink e x y → G.IsLink e x y := by aesop\n\nattribute [gcongr, grind →] IsSubgraph.vertexSet_mono\n\nlemma IsSubgraph.trans (h₁ : H.IsSubgraph G) (h₂ : G.IsSubgraph G₁) : H.IsSubgraph G₁ :=\n ⟨h₁.1.trans h₂.1, fun _ _ _ h ↦ h₂.2 (h₁.2 h)⟩\n\nlemma IsSubgraph.antisymm (h₁ : H.IsSubgraph G) (h₂ : G.IsSubgraph H) : H = G :=\n Graph.ext (h₁.1.antisymm h₂.1) fun _ _ _ ↦ ⟨(h₁.2 ·), (h₂.2 ·)⟩\n\n/-- `H ≤ G` means `H` is a subgraph of `G`. It is defined as `V(H) ⊆ V(G)` and every link of `H`\nbeing a link of `G`. -/\ninstance : PartialOrder (Graph α β) where\n le := IsSubgraph\n le_refl _ := ⟨le_rfl, fun _ _ _ h ↦ h⟩\n le_trans _ _ _ h₁ h₂ := h₁.trans h₂\n le_antisymm G H h₁ h₂ := h₁.antisymm h₂\n\n@[simp]\nlemma isSubgraph_iff_le : H.IsSubgraph G ↔ H ≤ G := .rfl\n\n@[gcongr]\nlemma IsLink.mono (hHG : H ≤ G) (h : H.IsLink e x y) : G.IsLink e x y := hHG.2 h\n\n@[gcongr, grind →]\nlemma IsSubgraph.edgeSet_mono (h : H ≤ G) : E(H) ⊆ E(G) := by\n intro e he\n obtain ⟨x, y, h'⟩ := exists_isLink_of_mem_edgeSet he\n exact (h'.mono h).edge_mem\n\nprivate lemma IsLink.anti_of_mem (h : G.IsLink e x y) (hHG : H ≤ G) (he : e ∈ E(H)) :\n H.IsLink e x y := by\n obtain ⟨u, v, huv⟩ := exists_isLink_of_mem_edgeSet he\n obtain ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ := (huv.mono hHG).eq_and_eq_or_eq_and_eq h\n · assumption\n exact huv.symm\n\nlemma IsSubgraph.isLink_iff (hHG : H ≤ G) (he : e ∈ E(H)) : H.IsLink e x y ↔ G.IsLink e x y :=\n ⟨fun h ↦ h.mono hHG, fun h ↦ h.anti_of_mem hHG he⟩\n\nlemma IsSubgraph.isLink_eqOn (hHG : H ≤ G) : EqOn H.IsLink G.IsLink E(H) := by\n rintro e he\n ext x y\n exact isLink_iff hHG he\n\n/-- Two subgraphs of the same graph are compatible. -/\nlemma Compatible.of_le_le (hH₁G : H₁ ≤ G) (hH₂G : H₂ ≤ G) : H₁.Compatible H₂ :=\n fun _ he₁ he₂ _ _ ↦ hH₁G.isLink_iff he₁ |>.trans <| (hH₂G.isLink_iff he₂).symm\n\nlemma Compatible.of_le (hHG : H ≤ G) : H.Compatible G := .of_le_le hHG le_rfl\nlemma Compatible.of_ge (hHG : G ≤ H) : H.Compatible G := .of_le_le le_rfl hHG\n\nalias IsSubgraph.compatible := Compatible.of_le\nalias IsSubgraph.compatible' := Compatible.of_ge\n\nlemma Compatible.anti_left (hG₁G : G₁ ≤ G) (h : Compatible G H) : Compatible G₁ H :=\n fun _ he₁ he₂ _ _ ↦ hG₁G.isLink_iff he₁ |>.trans <| h (hG₁G.edgeSet_mono he₁) he₂ ..\n\nlemma Compatible.anti_right (hH₁H : H₁ ≤ H) (h : Compatible G H) : Compatible G H₁ :=\n (h.symm.anti_left hH₁H).symm\n\nlemma Compatible.anti (hG₁G : G₁ ≤ G) (hH₁H : H₁ ≤ H) (h : G.Compatible H) : G₁.Compatible H₁ :=\n (h.anti_left hG₁G).anti_right hH₁H\n\n@[gcongr]\nlemma Inc.mono (hHG : H ≤ G) (h : H.Inc e x) : G.Inc e x :=\n (h.choose_spec.mono hHG).inc_left\n\nlemma IsSubgraph.inc_congr (hHG : H ≤ G) (he : e ∈ E(H)) : H.Inc e x ↔ G.Inc e x := by\n simp_rw [Graph.Inc, hHG.isLink_iff he]\n\nlemma IsSubgraph.inc_eqOn (hHG : H ≤ G) : EqOn H.Inc G.Inc E(H) := by\n rintro e he\n ext x\n exact hHG.inc_congr he\n\nlemma IsLoopAt.mono (hHG : H ≤ G) (h : H.IsLoopAt e x) : G.IsLoopAt e x :=\n IsLink.mono hHG h\n\nlemma IsSubgraph.isLoopAt_congr (hHG : H ≤ G) (he : e ∈ E(H)) :\n H.IsLoopAt e x ↔ G.IsLoopAt e x := by\n unfold Graph.IsLoopAt\n rw [hHG.isLink_iff he]\n\nTarget:\nlemma IsSubgraph.isLoopAt_eqOn (hHG : H ≤ G) : EqOn H.IsLoopAt G.IsLoopAt E(H) :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_d86e4bf52041","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"20c80f148cb0f1ef14aa916af11449527e53a5ffbdd5de1bf4d32c19158d30c6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Combinatorics/Graph","family_id":"issubgraph","file_id":"mathlib/Mathlib/Combinatorics/Graph/Subgraph.lean","sample_id":"d86e4bf52041d047197ceb9d1f42dcbff6065adc46b4b00663a325a378883e3f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"0884aed4a51095b96f57ccb528daef1ead8aeb0a004104a4bb7af2a1aca6bcb7","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"a5f299c66edf200b56c9d19ec5dac3e658fe174705e03693c065e2003f9d891c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"32df83b5cfff84a0d40ea22defef52e05ad87170a8992b92463514a1299afc54","source_sha256":"e0a01946c7540aa60c56fcb889febeffcb9e2b62b643b054d427e71008a64c26","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let F' : J ⥤ Sheaf C X :=\n { obj := fun j => ⟨F.obj j, H j⟩\n map := fun f => ⟨F.map f⟩ }\n let e : F' ⋙ Sheaf.forget C X ≅ F := NatIso.ofComponents fun _ => Iso.refl _\n exact Presheaf.isSheaf_of_iso\n ((isLimitOfPreserves (Sheaf.forget C X) (limit.isLimit F')).conePointsIsoOfNatIso hc e)\n (limit F').2","hard_negative":false,"metrics":{"chosen_tokens":92,"rejected_tokens":97,"token_jaccard":0.916667,"token_length_ratio":1.054348},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"a901feef198d385abca360d8e6865bf564dc0420ab120009871d0675be073dbb","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Sheaves.Sheaf\npublic import Mathlib.CategoryTheory.Sites.Limits\npublic import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic\n\nNamespace:\nTopCat\n\nLocal context:\n/-\nCopyright (c) 2020 Kim Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kim Morrison\n-/\n/-!\n# Presheaves in `C` have limits and colimits when `C` does.\n-/\n\npublic section\n\n\nnoncomputable section\n\nuniverse v u w t\n\nopen CategoryTheory\n\nopen CategoryTheory.Limits\n\nvariable {C : Type u} [Category.{v} C] {J : Type w} [Category* J]\n\nnamespace TopCat\n\ninstance [HasLimitsOfShape J C] (X : TopCat.{t}) : HasLimitsOfShape J (Presheaf C X) :=\n functorCategoryHasLimitsOfShape\n\ninstance [HasLimits C] (X : TopCat.{v}) : HasLimits.{v} (Presheaf C X) where\n\ninstance [HasColimitsOfShape J C] (X : TopCat) : HasColimitsOfShape J (Presheaf C X) :=\n functorCategoryHasColimitsOfShape\n\ninstance [HasColimits.{v, u} C] (X : TopCat.{t}) : HasColimitsOfSize.{v, v} (Presheaf C X) where\n\ninstance [HasLimitsOfShape J C] (X : TopCat.{t}) : CreatesLimitsOfShape J (Sheaf.forget C X) :=\n inferInstanceAs <| CreatesLimitsOfShape J (sheafToPresheaf _ _)\n\ninstance [HasLimitsOfShape J C] (X : TopCat.{t}) : HasLimitsOfShape J (Sheaf C X) :=\n hasLimitsOfShape_of_hasLimitsOfShape_createsLimitsOfShape (Sheaf.forget C X)\n\ninstance [HasLimits C] (X : TopCat) : CreatesLimits.{v, v} (Sheaf.forget C X) where\n\ninstance [HasLimits C] (X : TopCat.{v}) : HasLimitsOfSize.{v, v} (Sheaf.{v} C X) where\n\nset_option backward.isDefEq.respectTransparency false in\n\nTarget:\ntheorem isSheaf_of_isLimit [HasLimitsOfShape J C] {X : TopCat.{v}} (F : J ⥤ Presheaf.{v} C X)\n (H : ∀ j, (F.obj j).IsSheaf) {c : Cone F} (hc : IsLimit c) : c.pt.IsSheaf :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n let F' : J ⥤ Sheaf C X :=\n { obj := fun j => ⟨F.obj j, H j⟩\n map := fun f => ⟨F.map f⟩ }\n let e : F' ⋙ Sheaf.forget C X ≅ F := NatIso.ofComponents fun _ => Iso.refl _\n exact Presheaf.isSheaf_of_iso\n ((isLimitOfPreserves (Sheaf.forget C X) (limit.isLimit F')).conePointsIsoOfNatIso hc e)\n (limit F').2","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Sheaves","family_id":"issheaf_of_islimit","file_id":"mathlib/Mathlib/Topology/Sheaves/Limits.lean","sample_id":"32df83b5cfff84a0d40ea22defef52e05ad87170a8992b92463514a1299afc54"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8fb58c6f14a266699e3630ddc08f2506df27ecb4cd3ed55d66121a2125f0f457","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0e0cdc8984633b80b408ddd0742a84cf3b5ef39441651f89168fc7e46554282d","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d35f578aeb3865679d33c329115886c0cf2d3fd65ba43bc6758cfe8ff02b20f7","source_sha256":"a39928ff7890cdcd21c8866bd1117c6c0758a4d9558d42687caaffe7e7599081","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp_rw [Equiv.Perm.coe_pow]; exact MapsTo.iterate","hard_negative":true,"metrics":{"chosen_tokens":14,"rejected_tokens":3,"token_jaccard":0.153846,"token_length_ratio":0.214286},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"aa0b9a8ccf1470e89da1434ce46f58da7c46b6823bf190d3e0f06e267995899e","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Defs\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Logic.Equiv.Set\npublic import Mathlib.Tactic.Common\n\nNamespace:\nSet\n\nLocal context:\n/-\nCopyright (c) 2015 Microsoft Corporation. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Leonardo de Moura, Mario Carneiro\n-/\n/-!\n# Extra lemmas about permutations\n\nThis file proves miscellaneous lemmas about `Equiv.Perm`.\n\n## TODO\n\nMost of the content of this file was moved to `Mathlib/Algebra/Group/End.lean` in\nhttps://github.com/leanprover-community/mathlib4/pull/22141.\nIt would be good to merge the remaining lemmas with other files, e.g.\n`GroupTheory.Perm.ViaEmbedding` looks like it could benefit from such a treatment (splitting into\nthe algebra and non-algebra parts).\n-/\n\npublic section\n\n\nuniverse u v\n\nnamespace Equiv\n\nvariable {α : Type u} {β : Type v}\n\nsection Swap\n\nvariable [DecidableEq α]\n\n@[simp]\ntheorem swap_smul_self_smul [MulAction (Perm α) β] (i j : α) (x : β) :\n swap i j • swap i j • x = x := by simp [smul_smul]\n\ntheorem swap_smul_involutive [MulAction (Perm α) β] (i j : α) :\n Function.Involutive (swap i j • · : β → β) := swap_smul_self_smul i j\n\nend Swap\nend Equiv\n\nopen Equiv Function\n\nnamespace Set\nvariable {α : Type*} {f : Perm α} {s : Set α}\n\nlemma BijOn.perm_inv (hf : BijOn f s s) : BijOn ↑(f⁻¹) s s := hf.symm f.invOn\n\nTarget:\nlemma MapsTo.perm_pow : MapsTo f s s → ∀ n : ℕ, MapsTo (f ^ n) s s :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_d35f578aeb38","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"794d538becd28dbbf2b899bf8c3e157c082f39b153bf1b6a220c739d0e5b56be","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Perm","family_id":"mapsto","file_id":"mathlib/Mathlib/GroupTheory/Perm/Basic.lean","sample_id":"d35f578aeb3865679d33c329115886c0cf2d3fd65ba43bc6758cfe8ff02b20f7"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4a65cc27fbfccb0962f2b40b6449adb7efeb1278751be2fe5962887d4998e66f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"b90bc5f814724b08b718bd0f40c742584bf1a0f50c5201337eccdd3ca34b9331","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"970944dc1afd0e0eb6c4cb55334bce3e1ad8e6505f9f7729235cd49cf2489634","source_sha256":"766299eabb61515bf61321e63a62728ce040d606e2774c9023e11c0ba06c287b","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis hB hB']","hard_negative":false,"metrics":{"chosen_tokens":21,"rejected_tokens":25,"token_jaccard":0.842105,"token_length_ratio":1.190476},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"ab0d4957a8d8edc049f4967c6c55bacae7bfd702e4465307c306fb74d8f2cf3f","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.BilinearForm.Properties\n\nNamespace:\nLinearMap.BilinForm\n\nLocal context:\n/-\nCopyright (c) 2018 Andrew Yang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Andrew Yang\n-/\n/-!\n\n# Dual submodule with respect to a bilinear form.\n\n## Main definitions and results\n- `BilinForm.dualSubmodule`: The dual submodule with respect to a bilinear form.\n- `BilinForm.dualSubmodule_span_of_basis`: The dual of a lattice is spanned by the dual basis.\n\n## TODO\nProperly develop the material in the context of lattices.\n-/\n\n@[expose] public section\n\nopen LinearMap (BilinForm)\nopen Module\n\nvariable {R S M} [CommRing R] [Field S] [AddCommGroup M]\nvariable [Algebra R S] [Module R M] [Module S M] [IsScalarTower R S M]\n\nnamespace LinearMap\n\nnamespace BilinForm\n\nvariable (B : BilinForm S M)\n\n/-- The dual submodule of a submodule with respect to a bilinear form. -/\ndef dualSubmodule (N : Submodule R M) : Submodule R M where\n carrier := { x | ∀ y ∈ N, B x y ∈ (1 : Submodule R S) }\n add_mem' {a b} ha hb y hy := by simpa using add_mem (ha y hy) (hb y hy)\n zero_mem' y _ := by rw [B.zero_left]; exact zero_mem _\n smul_mem' r a ha y hy := by\n convert! (1 : Submodule R S).smul_mem r (ha y hy)\n rw [← IsScalarTower.algebraMap_smul S r a]\n simp only [algebraMap_smul, map_smul_of_tower, LinearMap.smul_apply]\n\nlemma mem_dualSubmodule {N : Submodule R M} {x} :\n x ∈ B.dualSubmodule N ↔ ∀ y ∈ N, B x y ∈ (1 : Submodule R S) := Iff.rfl\n\nlemma le_flip_dualSubmodule {N₁ N₂ : Submodule R M} :\n N₁ ≤ B.flip.dualSubmodule N₂ ↔ N₂ ≤ B.dualSubmodule N₁ := by\n change (∀ (x : M), x ∈ N₁ → _) ↔ ∀ (x : M), x ∈ N₂ → _\n simp only [mem_dualSubmodule, Submodule.mem_one, flip_apply]\n exact forall₂_comm\n\n/-- The natural paring of `B.dualSubmodule N` and `N`.\nThis is bundled as a bilinear map in `BilinForm.dualSubmoduleToDual`. -/\nnoncomputable\ndef dualSubmoduleParing {N : Submodule R M} (x : B.dualSubmodule N) (y : N) : R :=\n (Submodule.mem_one.mp <| x.prop y y.prop).choose\n\n@[simp]\nlemma dualSubmoduleParing_spec {N : Submodule R M} (x : B.dualSubmodule N) (y : N) :\n algebraMap R S (B.dualSubmoduleParing x y) = B x y :=\n (Submodule.mem_one.mp <| x.prop y y.prop).choose_spec\n\n/-- The natural paring of `B.dualSubmodule N` and `N`. -/\n-- TODO: Show that this is perfect when `N` is a lattice and `B` is nondegenerate.\n@[simps]\nnoncomputable\ndef dualSubmoduleToDual [IsDomain R] [IsTorsionFree R S] (N : Submodule R M) :\n B.dualSubmodule N →ₗ[R] Module.Dual R N :=\n { toFun := fun x ↦\n { toFun := B.dualSubmoduleParing x\n map_add' := fun x y ↦ FaithfulSMul.algebraMap_injective R S (by simp)\n map_smul' := fun r m ↦ FaithfulSMul.algebraMap_injective R S\n (by simp [← Algebra.smul_def]) }\n map_add' := fun x y ↦ LinearMap.ext fun z ↦ FaithfulSMul.algebraMap_injective R S\n (by simp)\n map_smul' := fun r x ↦ LinearMap.ext fun y ↦ FaithfulSMul.algebraMap_injective R S\n (by simp [← Algebra.smul_def]) }\n\nlemma dualSubmoduleToDual_injective [IsDomain R] (hB : B.Nondegenerate) [IsTorsionFree R S]\n (N : Submodule R M) (hN : Submodule.span S (N : Set M) = ⊤) :\n Function.Injective (B.dualSubmoduleToDual N) := by\n intro x y e\n ext\n apply LinearMap.ker_eq_bot.mp hB.ker_eq_bot\n apply LinearMap.ext_on hN\n intro z hz\n simpa using congr_arg (algebraMap R S) (LinearMap.congr_fun e ⟨z, hz⟩)\n\nlemma dualSubmodule_span_of_basis {ι} [Finite ι] [DecidableEq ι]\n (hB : B.Nondegenerate) (b : Basis ι S M) :\n B.dualSubmodule (Submodule.span R (Set.range b)) =\n Submodule.span R (Set.range <| B.dualBasis hB b) := by\n cases nonempty_fintype ι\n apply le_antisymm\n · intro x hx\n rw [← (B.dualBasis hB b).sum_repr x]\n apply sum_mem\n rintro i -\n obtain ⟨r, hr⟩ := Submodule.mem_one.mp <| hx (b i) (Submodule.subset_span ⟨_, rfl⟩)\n simp only [dualBasis_repr_apply, ← hr, algebraMap_smul]\n apply Submodule.smul_mem\n exact Submodule.subset_span ⟨_, rfl⟩\n · rw [Submodule.span_le]\n rintro _ ⟨i, rfl⟩ y hy\n obtain ⟨f, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun _).mp hy\n simp only [map_sum]\n apply sum_mem\n rintro j -\n rw [← IsScalarTower.algebraMap_smul S (f j), map_smul]\n simp_rw [apply_dualBasis_left]\n rw [smul_eq_mul, mul_ite, mul_one, mul_zero, ← (algebraMap R S).map_zero, ← apply_ite]\n exact Submodule.mem_one.mpr ⟨_, rfl⟩\n\nlemma dualSubmodule_dualSubmodule_flip_of_basis {ι : Type*} [Finite ι]\n (hB : B.Nondegenerate) (b : Basis ι S M) :\n B.dualSubmodule (B.flip.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis _ hB.flip, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis_flip hB]\n\nlemma dualSubmodule_flip_dualSubmodule_of_basis {ι : Type*} [Finite ι]\n (hB : B.Nondegenerate) (b : Basis ι S M) :\n B.flip.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis _ hB.flip,\n dualBasis_flip_dualBasis hB]\n\nTarget:\nlemma dualSubmodule_dualSubmodule_of_basis\n {ι} [Finite ι] (hB : B.Nondegenerate) (hB' : B.IsSymm) (b : Basis ι S M) :\n B.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n classical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis hB hB']","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/BilinearForm","family_id":"dualsubmodule_dualsubmodule_of_basis","file_id":"mathlib/Mathlib/LinearAlgebra/BilinearForm/DualLattice.lean","sample_id":"970944dc1afd0e0eb6c4cb55334bce3e1ad8e6505f9f7729235cd49cf2489634"},"split":"validation"} {"binding":{"chosen_proof_sha256":"26d182abc6389dc84737bf95d2c21225b0cb78d6127fc29126a79ec54ffdff6d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"fae2d4ff6c1ba174ac37720a87ba104c22e2d8e7c1233c12d381b44e981e1aa5","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"1699f9d464a20fd86e8564bc21d776b528e7683831049e1312c46a1ab479c935","source_sha256":"086cc329dd922787bf3d118bbc69bcad4d5fdd250cd32d7601cc5afc35a9bebe","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n algebraize [f.toRingHom]\n refine lt_of_le_of_ne (Ideal.map_le_iff_le_comap.mpr ?_) fun e ↦ ?_\n · rw [Ideal.comap_comap, ← algebraMap_eq, f.comp_algebraMap]\n let := Localization.AtPrime.algebraOfLiesOver (P.under R) (P.under R[X])\n let := Localization.AtPrime.algebraOfLiesOver (P.under R[X]) P\n let := Localization.AtPrime.algebraOfLiesOver (P.under R) P\n have : Module.Finite (Ideal.under R P).ResidueField P.ResidueField :=\n Algebra.WeaklyQuasiFiniteAt.finite_residueField ..\n have : Module.Finite (P.under R).ResidueField (P.under R[X]).ResidueField :=\n .of_injective (IsScalarTower.toAlgHom _ _ P.ResidueField).toLinearMap\n (algebraMap (P.under R[X]).ResidueField P.ResidueField).injective\n have : Module.Finite (P.under R).ResidueField (RatFunc (P.under R).ResidueField) :=\n .of_surjective (residueFieldMapCAlgEquiv _ (P.under _) e.symm).toLinearMap\n (residueFieldMapCAlgEquiv _ (P.under _) e.symm).surjective\n exact RatFunc.transcendental_X (K := (P.under R).ResidueField)\n (Algebra.IsIntegral.isIntegral _).isAlgebraic","hard_negative":true,"metrics":{"chosen_tokens":256,"rejected_tokens":2,"token_jaccard":0.016393,"token_length_ratio":0.007812},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"ac716823c87de7364f0f58a84bb5b37438885ca1b4114ac4d3cd444db5687f7e","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.LocalRing.ResidueField.Polynomial\npublic import Mathlib.RingTheory.QuasiFinite.Weakly\n\nNamespace:\nPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Andrew Yang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Andrew Yang\n-/\n/-! # Quasi-finite primes in polynomial algebras -/\n\n@[expose] public section\n\nvariable {R S T : Type*} [CommRing R] [CommRing S] [CommRing T]\n [Algebra R S] [Algebra R T] [Algebra S T] [IsScalarTower R S T]\n\nnamespace Polynomial\n\nattribute [local instance] Algebra.WeaklyQuasiFiniteAt.finite_locoalization in\nlemma not_weaklyQuasiFiniteAt (P : Ideal R[X]) [P.IsPrime] : ¬ Algebra.WeaklyQuasiFiniteAt R P := by\n intro H\n wlog hR : IsField R\n · let p := P.under R\n obtain ⟨Q, hQ⟩ := (PrimeSpectrum.preimageEquivFiber R R[X]\n ⟨p, inferInstance⟩).symm.surjective ⟨⟨P, ‹_›⟩, rfl⟩\n have inst : Algebra.WeaklyQuasiFiniteAt p.ResidueField Q.asIdeal :=\n .baseChange P Q.asIdeal congr($(hQ.symm).1.1)\n exact this (Q.asIdeal.comap (polyEquivTensor' R p.ResidueField).toRingHom)\n inferInstance (Field.toIsField _)\n let := hR.toField\n have := Module.Finite.of_injective\n (IsScalarTower.toAlgHom R R[X] (Localization.AtPrime P)).toLinearMap\n (IsLocalization.injective _ P.primeCompl_le_nonZeroDivisors)\n exact transcendental_X R (Algebra.IsIntegral.isIntegral X).isAlgebraic\n\n/-- `R[X]` is not quasi-finite over `R` at any prime. -/\nlemma not_quasiFiniteAt (P : Ideal R[X]) [P.IsPrime] : ¬ Algebra.QuasiFiniteAt R P :=\n fun _ ↦ not_weaklyQuasiFiniteAt P inferInstance\n\nTarget:\nlemma map_under_lt_comap_of_weaklyQuasiFiniteAt\n (f : R[X] →ₐ[R] S) (P : Ideal S) [P.IsPrime] [Algebra.WeaklyQuasiFiniteAt R P] :\n (P.under R).map C < P.comap (f : R[X] →+* S) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_1699f9d464a2","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"48361ac4450e4553b17fb4acc27d9d88e0534c4e27b8616c917f14f2754b2a3d","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/QuasiFinite","family_id":"map_under_lt_comap_of_weaklyquasifiniteat","file_id":"mathlib/Mathlib/RingTheory/QuasiFinite/Polynomial.lean","sample_id":"1699f9d464a20fd86e8564bc21d776b528e7683831049e1312c46a1ab479c935"},"split":"validation"} {"binding":{"chosen_proof_sha256":"7fc150cba70fd1f39cbdb3da54128727f8df39f87f3628e56cd6f6a5fc598a65","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"032cd4a88eadc0af270823b877fb79265f82359d0ee8ee691a580874518b3696","source_sha256":"7eafb57dc8a3d4503f110a5a562aa3213743b7948602bcad3d7f974c6a103b75","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [dense_iff_inter_open, inter_iUnion, nonempty_iUnion, ← image_inter_nonempty_iff]\n exact ⟨fun h _ h₁ h₂ _ h₃ h₄ ↦ h.1 h₃ h₄ h₁ h₂, fun h ↦ ⟨fun h₁ h₂ h₃ h₄ ↦ h h₃ h₄ _ h₁ h₂⟩⟩","hard_negative":false,"metrics":{"chosen_tokens":66,"rejected_tokens":2,"token_jaccard":0.04,"token_length_ratio":0.030303},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"ac7f53dde76d6e62614b84585622c3d559b49cebd86631f5473360f166e7b2dd","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Dynamics.Minimal\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Daniel Figueroa. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Daniel Figueroa\n-/\n/-!\n# Topologically transitive monoid actions\n\nIn this file we define an action of a monoid `M` on a topological space `α` to be\n*topologically transitive* if for any pair of nonempty open sets `U` and `V` in `α` there exists an\n`m : M` such that `(m • U) ∩ V` is nonempty. We also provide an additive version of this definition\nand prove basic facts about topologically transitive actions.\n\n## Tags\n\ngroup action, topologically transitive\n-/\n\npublic section\n\n\nopen scoped Pointwise\n\n/-- An action of an additive monoid `M` on a topological space `α` is called\n*topologically transitive* if for any pair of nonempty open sets `U` and `V` in `α` there exists an\n`m : M` such that `(m +ᵥ U) ∩ V` is nonempty. -/\nclass AddAction.IsTopologicallyTransitive (M α : Type*) [AddMonoid M] [TopologicalSpace α]\n [AddAction M α] : Prop where\n exists_vadd_inter : ∀ {U V : Set α}, IsOpen U → U.Nonempty → IsOpen V → V.Nonempty →\n ∃ m : M, ((m +ᵥ U) ∩ V).Nonempty\n\n/-- An action of a monoid `M` on a topological space `α` is called *topologically transitive* if for\nany pair of nonempty open sets `U` and `V` in `α` there exists an `m : M` such that `(m • U) ∩ V` is\nnonempty. -/\n@[to_additive]\nclass MulAction.IsTopologicallyTransitive (M α : Type*) [Monoid M] [TopologicalSpace α]\n [MulAction M α] : Prop where\n exists_smul_inter : ∀ {U V : Set α}, IsOpen U → U.Nonempty → IsOpen V → V.Nonempty →\n ∃ m : M, ((m • U) ∩ V).Nonempty\n\nopen MulAction Set\n\nvariable (M : Type*) {α : Type*} [TopologicalSpace α] [Monoid M] [MulAction M α]\n\nsection IsTopologicallyTransitive\n\n@[to_additive]\ntheorem MulAction.isTopologicallyTransitive_iff :\n IsTopologicallyTransitive M α ↔ ∀ {U V : Set α}, IsOpen U → U.Nonempty → IsOpen V →\n V.Nonempty → ∃ m : M, ((m • U) ∩ V).Nonempty := ⟨fun h ↦ h.1, fun h ↦ ⟨h⟩⟩\n\n/-- An action of a monoid `M` on `α` is topologically transitive if and only if for any nonempty\nopen subset `U` of `α` the union over the elements of `M` of images of `U` is dense in `α`. -/\n@[to_additive /-- An action of an additive monoid `M` on `α` is topologically transitive if and only\nif for any nonempty open subset `U` of `α` the union over the elements of `M` of images of `U` is\ndense in `α`. -/]\ntheorem MulAction.isTopologicallyTransitive_iff_dense_iUnion :\n IsTopologicallyTransitive M α ↔\n ∀ {U : Set α}, IsOpen U → U.Nonempty → Dense (⋃ m : M, m • U) := by\n simp only [isTopologicallyTransitive_iff, inter_comm, dense_iff_inter_open, inter_iUnion,\n nonempty_iUnion]\n exact ⟨fun h _ h₁ h₂ _ h₃ h₄ ↦ h h₁ h₂ h₃ h₄, fun h _ _ h₁ h₂ h₃ h₄ ↦ h h₁ h₂ _ h₃ h₄⟩\n\n/-- An action of a monoid `M` on `α` is topologically transitive if and only if for any nonempty\nopen subset `U` of `α` the union of the preimages of `U` over the elements of `M` is dense in `α`.\n-/\n@[to_additive /-- An action of an additive monoid `M` on `α` is topologically transitive if and only\nif for any nonempty open subset `U` of `α` the union of the preimages of `U` over the elements of\n`M` is dense in `α`. -/]\n\nTarget:\ntheorem MulAction.isTopologicallyTransitive_iff_dense_iUnion_preimage :\n IsTopologicallyTransitive M α ↔\n ∀ {U : Set α}, IsOpen U → U.Nonempty → Dense (⋃ m : M, (m • ·) ⁻¹' U) :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Dynamics","family_id":"mulaction","file_id":"mathlib/Mathlib/Dynamics/Transitive.lean","sample_id":"032cd4a88eadc0af270823b877fb79265f82359d0ee8ee691a580874518b3696"},"split":"validation"} {"binding":{"chosen_proof_sha256":"a968b4cf2ddc49c486b229261dc33491da82d4366122d12e1d0118475a666163","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e9773e8e4b8e0feffa949567a6cf810241aa484e78f15668137e4272b9e64929","source_sha256":"d9da9d2d65eac42d61ebce4b4577b5669368330273cdd4a7310214763fb8a4ce","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n dsimp only [toFun, invFun]\n rw [Function.rightInverse_iff_comp, ← coe_comp, ← @id_coe R]\n congr\n refine pi_ext fun i x ↦ ?_\n induction x using Submodule.Quotient.induction_on with | _ x'\n refine funext fun j ↦ ?_\n rw [comp_apply, piQuotientLift_single, mapQ_apply,\n quotientPiLift_mk, id_apply]\n by_cases hij : i = j <;> simp only [mkQ_apply, coe_single]\n · subst hij\n rw [Pi.single_eq_same, Pi.single_eq_same]\n · rw [Pi.single_eq_of_ne (Ne.symm hij), Pi.single_eq_of_ne (Ne.symm hij), Quotient.mk_zero]","hard_negative":false,"metrics":{"chosen_tokens":118,"rejected_tokens":5,"token_jaccard":0.03125,"token_length_ratio":0.042373},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"ad0375290323d0d843771194690893fbf2cc2a392c8337456c645a55bd2d107a","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Pi\npublic import Mathlib.LinearAlgebra.Quotient.Basic\n\nNamespace:\nSubmodule.quotientPi_aux\n\nLocal context:\n/-\nCopyright (c) 2022 Anne Baanen. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Anne Baanen, Alex J. Best\n-/\n/-!\n# Submodule quotients and direct sums\n\nThis file contains some results on the quotient of a module by a direct sum of submodules,\nand the direct sum of quotients of modules by submodules.\n\n## Main definitions\n\n* `Submodule.piQuotientLift`: create a map out of the direct sum of quotients\n* `Submodule.quotientPiLift`: create a map out of the quotient of a direct sum\n* `Submodule.quotientPi`: the quotient of a direct sum is the direct sum of quotients.\n\n-/\n\n@[expose] public section\n\n\nnamespace Submodule\n\nopen LinearMap\n\nvariable {ι R : Type*} [CommRing R]\nvariable {Ms : ι → Type*} [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]\nvariable {N : Type*} [AddCommGroup N] [Module R N]\nvariable {Ns : ι → Type*} [∀ i, AddCommGroup (Ns i)] [∀ i, Module R (Ns i)]\n\n/-- Lift a family of maps to the direct sum of quotients. -/\ndef piQuotientLift [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) (q : Submodule R N)\n (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) : (∀ i, Ms i ⧸ p i) →ₗ[R] N ⧸ q :=\n lsum R (fun i => Ms i ⧸ p i) R fun i => (p i).mapQ q (f i) (hf i)\n\n@[simp]\ntheorem piQuotientLift_mk [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))\n (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (x : ∀ i, Ms i) :\n (piQuotientLift p q f hf fun i => Quotient.mk (x i)) = Quotient.mk (lsum _ _ R f x) := by\n rw [piQuotientLift, lsum_apply, sum_apply, ← mkQ_apply, lsum_apply, sum_apply, _root_.map_sum]\n simp only [coe_proj, mapQ_apply, mkQ_apply, comp_apply]\n\n@[simp]\ntheorem piQuotientLift_single [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))\n (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (i)\n (x : Ms i ⧸ p i) : piQuotientLift p q f hf (Pi.single i x) = mapQ _ _ (f i) (hf i) x := by\n simp_rw [piQuotientLift, lsum_apply, sum_apply, comp_apply, proj_apply]\n rw [Finset.sum_eq_single i]\n · rw [Pi.single_eq_same]\n · rintro j - hj\n rw [Pi.single_eq_of_ne hj, map_zero]\n · intros\n have := Finset.mem_univ i\n contradiction\n\n/-- Lift a family of maps to a quotient of direct sums. -/\ndef quotientPiLift (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i)\n (hf : ∀ i, p i ≤ ker (f i)) : (∀ i, Ms i) ⧸ pi Set.univ p →ₗ[R] ∀ i, Ns i :=\n (pi Set.univ p).liftQ (LinearMap.pi fun i => (f i).comp (proj i)) fun x hx =>\n mem_ker.mpr <| by\n ext i\n simpa using hf i (mem_pi.mp hx i (Set.mem_univ i))\n\n@[simp]\ntheorem quotientPiLift_mk (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i)\n (hf : ∀ i, p i ≤ ker (f i)) (x : ∀ i, Ms i) :\n quotientPiLift p f hf (Quotient.mk x) = fun i => f i (x i) :=\n rfl\n\nnamespace quotientPi_aux\n\nvariable (p : ∀ i, Submodule R (Ms i))\n\n@[simp]\ndef toFun : ((∀ i, Ms i) ⧸ pi Set.univ p) → ∀ i, Ms i ⧸ p i :=\n quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge\n\ntheorem map_add (x y : ((i : ι) → Ms i) ⧸ pi Set.univ p) :\n toFun p (x + y) = toFun p x + toFun p y :=\n LinearMap.map_add (quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge) x y\n\ntheorem map_smul (r : R) (x : ((i : ι) → Ms i) ⧸ pi Set.univ p) :\n toFun p (r • x) = (RingHom.id R r) • toFun p x :=\n LinearMap.map_smul (quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge) r x\n\nvariable [Fintype ι] [DecidableEq ι]\n\n@[simp]\ndef invFun : (∀ i, Ms i ⧸ p i) → (∀ i, Ms i) ⧸ pi Set.univ p :=\n piQuotientLift p (pi Set.univ p) _ fun _ => le_comap_single_pi p\n\ntheorem left_inv : Function.LeftInverse (invFun p) (toFun p) := fun x =>\n Submodule.Quotient.induction_on _ x fun x' => by\n dsimp only [toFun, invFun]\n rw [quotientPiLift_mk p, funext fun i => (mkQ_apply (p i) (x' i)), piQuotientLift_mk p,\n lsum_single, id_apply]\n\nTarget:\ntheorem right_inv : Function.RightInverse (invFun p) (toFun p) :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Quotient","family_id":"right_inv","file_id":"mathlib/Mathlib/LinearAlgebra/Quotient/Pi.lean","sample_id":"e9773e8e4b8e0feffa949567a6cf810241aa484e78f15668137e4272b9e64929"},"split":"validation"} {"binding":{"chosen_proof_sha256":"a968b4cf2ddc49c486b229261dc33491da82d4366122d12e1d0118475a666163","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e9773e8e4b8e0feffa949567a6cf810241aa484e78f15668137e4272b9e64929","source_sha256":"d9da9d2d65eac42d61ebce4b4577b5669368330273cdd4a7310214763fb8a4ce","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n dsimp only [toFun, invFun]\n rw [Function.rightInverse_iff_comp, ← coe_comp, ← @id_coe R]\n congr\n refine pi_ext fun i x ↦ ?_\n induction x using Submodule.Quotient.induction_on with | _ x'\n refine funext fun j ↦ ?_\n rw [comp_apply, piQuotientLift_single, mapQ_apply,\n quotientPiLift_mk, id_apply]\n by_cases hij : i = j <;> simp only [mkQ_apply, coe_single]\n · subst hij\n rw [Pi.single_eq_same, Pi.single_eq_same]\n · rw [Pi.single_eq_of_ne (Ne.symm hij), Pi.single_eq_of_ne (Ne.symm hij), Quotient.mk_zero]","hard_negative":true,"metrics":{"chosen_tokens":118,"rejected_tokens":8,"token_jaccard":0.030303,"token_length_ratio":0.067797},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"ad6390ca00f7c98f604522e1d041617275c978667c1b8791d33090cd86720f0d","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Pi\npublic import Mathlib.LinearAlgebra.Quotient.Basic\n\nNamespace:\nSubmodule.quotientPi_aux\n\nLocal context:\n/-\nCopyright (c) 2022 Anne Baanen. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Anne Baanen, Alex J. Best\n-/\n/-!\n# Submodule quotients and direct sums\n\nThis file contains some results on the quotient of a module by a direct sum of submodules,\nand the direct sum of quotients of modules by submodules.\n\n## Main definitions\n\n* `Submodule.piQuotientLift`: create a map out of the direct sum of quotients\n* `Submodule.quotientPiLift`: create a map out of the quotient of a direct sum\n* `Submodule.quotientPi`: the quotient of a direct sum is the direct sum of quotients.\n\n-/\n\n@[expose] public section\n\n\nnamespace Submodule\n\nopen LinearMap\n\nvariable {ι R : Type*} [CommRing R]\nvariable {Ms : ι → Type*} [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]\nvariable {N : Type*} [AddCommGroup N] [Module R N]\nvariable {Ns : ι → Type*} [∀ i, AddCommGroup (Ns i)] [∀ i, Module R (Ns i)]\n\n/-- Lift a family of maps to the direct sum of quotients. -/\ndef piQuotientLift [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) (q : Submodule R N)\n (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) : (∀ i, Ms i ⧸ p i) →ₗ[R] N ⧸ q :=\n lsum R (fun i => Ms i ⧸ p i) R fun i => (p i).mapQ q (f i) (hf i)\n\n@[simp]\ntheorem piQuotientLift_mk [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))\n (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (x : ∀ i, Ms i) :\n (piQuotientLift p q f hf fun i => Quotient.mk (x i)) = Quotient.mk (lsum _ _ R f x) := by\n rw [piQuotientLift, lsum_apply, sum_apply, ← mkQ_apply, lsum_apply, sum_apply, _root_.map_sum]\n simp only [coe_proj, mapQ_apply, mkQ_apply, comp_apply]\n\n@[simp]\ntheorem piQuotientLift_single [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))\n (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (i)\n (x : Ms i ⧸ p i) : piQuotientLift p q f hf (Pi.single i x) = mapQ _ _ (f i) (hf i) x := by\n simp_rw [piQuotientLift, lsum_apply, sum_apply, comp_apply, proj_apply]\n rw [Finset.sum_eq_single i]\n · rw [Pi.single_eq_same]\n · rintro j - hj\n rw [Pi.single_eq_of_ne hj, map_zero]\n · intros\n have := Finset.mem_univ i\n contradiction\n\n/-- Lift a family of maps to a quotient of direct sums. -/\ndef quotientPiLift (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i)\n (hf : ∀ i, p i ≤ ker (f i)) : (∀ i, Ms i) ⧸ pi Set.univ p →ₗ[R] ∀ i, Ns i :=\n (pi Set.univ p).liftQ (LinearMap.pi fun i => (f i).comp (proj i)) fun x hx =>\n mem_ker.mpr <| by\n ext i\n simpa using hf i (mem_pi.mp hx i (Set.mem_univ i))\n\n@[simp]\ntheorem quotientPiLift_mk (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i)\n (hf : ∀ i, p i ≤ ker (f i)) (x : ∀ i, Ms i) :\n quotientPiLift p f hf (Quotient.mk x) = fun i => f i (x i) :=\n rfl\n\nnamespace quotientPi_aux\n\nvariable (p : ∀ i, Submodule R (Ms i))\n\n@[simp]\ndef toFun : ((∀ i, Ms i) ⧸ pi Set.univ p) → ∀ i, Ms i ⧸ p i :=\n quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge\n\ntheorem map_add (x y : ((i : ι) → Ms i) ⧸ pi Set.univ p) :\n toFun p (x + y) = toFun p x + toFun p y :=\n LinearMap.map_add (quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge) x y\n\ntheorem map_smul (r : R) (x : ((i : ι) → Ms i) ⧸ pi Set.univ p) :\n toFun p (r • x) = (RingHom.id R r) • toFun p x :=\n LinearMap.map_smul (quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge) r x\n\nvariable [Fintype ι] [DecidableEq ι]\n\n@[simp]\ndef invFun : (∀ i, Ms i ⧸ p i) → (∀ i, Ms i) ⧸ pi Set.univ p :=\n piQuotientLift p (pi Set.univ p) _ fun _ => le_comap_single_pi p\n\ntheorem left_inv : Function.LeftInverse (invFun p) (toFun p) := fun x =>\n Submodule.Quotient.induction_on _ x fun x' => by\n dsimp only [toFun, invFun]\n rw [quotientPiLift_mk p, funext fun i => (mkQ_apply (p i) (x' i)), piQuotientLift_mk p,\n lsum_single, id_apply]\n\nTarget:\ntheorem right_inv : Function.RightInverse (invFun p) (toFun p) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"d4d8ec00f918628f477fff309883998d5831a7a79383887d6402b7d9ab4d0a29","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Quotient","family_id":"right_inv","file_id":"mathlib/Mathlib/LinearAlgebra/Quotient/Pi.lean","sample_id":"e9773e8e4b8e0feffa949567a6cf810241aa484e78f15668137e4272b9e64929"},"split":"validation"} {"binding":{"chosen_proof_sha256":"135e538224b478b7321478a8ed534f854e5bf945d2b74633ee4f900703a86e8f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"ed45c75970ddd6512f0600b8b591304a8c86bb49674f9db4b2e34963291d81ac","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"553441baaa635096c335f03a69853e486818cf4c8b20fee538c5f43d28aa2a32","source_sha256":"8776202ae66e6a5502d495e8a86b902f1a12ad7e893cebc8ed41f328fff5f0dd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp [binomialRandom_apply', setBernoulli_apply, ← Set.image_comp]","hard_negative":true,"metrics":{"chosen_tokens":12,"rejected_tokens":3,"token_jaccard":0.076923,"token_length_ratio":0.25},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"adf1e7b8fb900d3718439fdf3ee836d334808d29c328000d6e0370b605ccd6b9","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Sym.Card\npublic import Mathlib.MeasureTheory.Constructions.SimpleGraph\npublic import Mathlib.Probability.Distributions.SetBernoulli\n\nNamespace:\nSimpleGraph\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Binomial random graphs\n\nThis file constructs the binomial distribution with parameter `p` on simple graphs with\nvertices `V`. This is the law `G(V, p)` of binomial random graphs with probability `p`.\n\n## TODO\n\nAdd the characteristic predicate for a random graph to follow the binomial random distribution.\n\n## Historical note\n\nThis is usually called the Erdős–Rényi model, but this name is historically inaccurate as Erdős and\nRényi introduced a closely related but different model. We therefore choose the name\n\"binomial random graph\" to avoid confusion with this other model and because it is a more\ndescriptive name.\n\n## Tags\n\nErdős-Rényi graph, Erdős-Renyi graph, Erdös-Rényi graph, Erdös-Renyi graph, Erdos-Rényi graph,\nErdos-Renyi graph\n-/\n\npublic section\n\nopen MeasureTheory Measure ProbabilityTheory unitInterval\nopen scoped Finset\n\nnamespace SimpleGraph\nvariable {V : Type*} {p : I}\n\nvariable (V p) in\n/-- The binomial distribution with parameter `p` on simple graphs with vertices `V`. -/\n@[expose]\nnoncomputable def binomialRandom : Measure (SimpleGraph V) :=\n setBer(Sym2.diagSetᶜ, p).comap edgeSet\n\n@[inherit_doc] scoped notation \"G(\" V \", \" p \")\" => binomialRandom V p\n\nsection Countable\nvariable [Countable V]\n\nvariable (V p) in\nlemma binomialRandom_eq_map : G(V, p) = map fromEdgeSet setBer(Sym2.diagSetᶜ, p) := by\n refine (map_eq_comap measurable_fromEdgeSet measurableEmbedding_edgeSet ?_\n fromEdgeSet_edgeSet).symm\n filter_upwards [setBernoulli_ae_subset] with S hS\n exact ⟨fromEdgeSet S, by simpa [← Set.compl_setOf, Set.subset_compl_iff_disjoint_right] using hS⟩\n\nvariable (p) in\nlemma binomialRandom_apply' (S : Set (SimpleGraph V)) :\n G(V, p) S = setBer(Sym2.diagSetᶜ, p) (edgeSet '' S) := by\n rw [binomialRandom, measurableEmbedding_edgeSet.comap_apply]\n\nvariable (p) in\n\nTarget:\nlemma binomialRandom_apply (S : Set (SimpleGraph V)) :\n G(V, p) S = infinitePi\n (fun e : Sym2 V ↦ toNNReal p • .dirac (¬ e.IsDiag) + toNNReal (σ p) • .dirac False)\n ((fun G e ↦ e ∈ G.edgeSet) '' S) :=\n\nProof body:\n","rejected":"by\n exact binomialRandom_apply","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"6bd7b765ee5504985008e3f70f703b3401ff84006dd5da230612bffdf0f571c3","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Probability/Combinatorics","family_id":"binomialrandom_apply","file_id":"mathlib/Mathlib/Probability/Combinatorics/BinomialRandomGraph/Defs.lean","sample_id":"553441baaa635096c335f03a69853e486818cf4c8b20fee538c5f43d28aa2a32"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5660265bd323109b39095dd42345d8988e67e51883994445e37df5a94fa9fb63","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"ac3fa2b98fba7ed67c202b94cfc542a475c91465f938fea818173938d71de268","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d033ac08ff0773d8cd710d59db4143a19c0a7bdc12fd0e5323510cd8f78442b6","source_sha256":"8a3ed8c4958576dfb64a5b6e4797c98f6e40ab96e7622412ed9830183a729b69","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n revert x y\n rw [isSymm_iff_eq_flip]\n aesop\n\nvariable (A) in\n/-- The base change of a bilinear map (also known as \"extension of scalars\"). -/\nprotected def baseChange (B : BilinMap R M₂ N₂) : BilinMap A (A ⊗[R] M₂) (A ⊗[R] N₂) :=\n BilinMap.tmul (R := R) (A := A) (M₁ := A) (M₂ := M₂) (LinearMap.mul A A) B","hard_negative":false,"metrics":{"chosen_tokens":106,"rejected_tokens":111,"token_jaccard":0.92,"token_length_ratio":1.04717},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"b22eadbffeb080be2997225ca02b28c98bc842e55cc77dcd5f58eea929b588b4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.BilinearForm.Hom\npublic import Mathlib.LinearAlgebra.Dual.Lemmas\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.RingTheory.TensorProduct.Finite\n\nNamespace:\nLinearMap.BilinMap\n\nLocal context:\n/-\nCopyright (c) 2023 Eric Wieser. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Eric Wieser\n-/\n/-!\n# The bilinear form on a tensor product\n\n## Main definitions\n\n* `LinearMap.BilinMap.tensorDistrib (B₁ ⊗ₜ B₂)`: the bilinear form on `M₁ ⊗ M₂` constructed by\n applying `B₁` on `M₁` and `B₂` on `M₂`.\n* `LinearMap.BilinMap.tensorDistribEquiv`: `BilinForm.tensorDistrib` as an equivalence on finite\n free modules.\n\n-/\n\n@[expose] public section\n\nuniverse u v w uR uA uM₁ uM₂ uN₁ uN₂\n\nvariable {R : Type uR} {A : Type uA} {M₁ : Type uM₁} {M₂ : Type uM₂} {N₁ : Type uN₁} {N₂ : Type uN₂}\n\nopen TensorProduct\n\nnamespace LinearMap\n\nopen LinearMap (BilinMap BilinForm)\n\nsection CommSemiring\n\nvariable [CommSemiring R] [CommSemiring A]\nvariable [AddCommMonoid M₁] [AddCommMonoid M₂] [AddCommMonoid N₁] [AddCommMonoid N₂]\nvariable [Algebra R A] [Module R M₁] [Module A M₁] [Module R N₁] [Module A N₁]\nvariable [SMulCommClass R A M₁] [IsScalarTower R A M₁]\nvariable [SMulCommClass R A N₁] [IsScalarTower R A N₁]\nvariable [Module R M₂] [Module R N₂]\n\nnamespace BilinMap\n\nvariable (R A) in\n/-- The tensor product of two bilinear maps injects into bilinear maps on tensor products.\n\nNote this is heterobasic; the bilinear map on the left can take values in a module over a\n(commutative) algebra over the ring of the module in which the right bilinear map is valued. -/\ndef tensorDistrib :\n (BilinMap A M₁ N₁ ⊗[R] BilinMap R M₂ N₂) →ₗ[A] BilinMap A (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂) :=\n (TensorProduct.lift.equiv (.id A) (M₁ ⊗[R] M₂) (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂)).symm.toLinearMap ∘ₗ\n ((LinearMap.llcomp A _ _ _).flip\n (TensorProduct.AlgebraTensorModule.tensorTensorTensorComm R R A A M₁ M₂ M₁ M₂).toLinearMap)\n ∘ₗ TensorProduct.AlgebraTensorModule.homTensorHomMap R _ _ _ _ _ _\n ∘ₗ (TensorProduct.AlgebraTensorModule.congr\n (TensorProduct.lift.equiv (.id A) M₁ M₁ N₁)\n (TensorProduct.lift.equiv (.id R) _ _ _)).toLinearMap\n\n@[simp]\ntheorem tensorDistrib_tmul (B₁ : BilinMap A M₁ N₁) (B₂ : BilinMap R M₂ N₂) (m₁ : M₁) (m₂ : M₂)\n (m₁' : M₁) (m₂' : M₂) :\n tensorDistrib R A (B₁ ⊗ₜ B₂) (m₁ ⊗ₜ m₂) (m₁' ⊗ₜ m₂')\n = B₁ m₁ m₁' ⊗ₜ B₂ m₂ m₂' :=\n rfl\n\n/-- The tensor product of two bilinear forms, a shorthand for dot notation. -/\nprotected abbrev tmul (B₁ : BilinMap A M₁ N₁) (B₂ : BilinMap R M₂ N₂) :\n BilinMap A (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂) :=\n tensorDistrib R A (B₁ ⊗ₜ[R] B₂)\n\nattribute [local ext] TensorProduct.ext in\n/-- A tensor product of symmetric bilinear maps is symmetric. -/\n\nTarget:\nlemma tmul_isSymm {B₁ : BilinMap A M₁ N₁} {B₂ : BilinMap R M₂ N₂}\n (hB₁ : ∀ x y, B₁ x y = B₁ y x) (hB₂ : ∀ x y, B₂ x y = B₂ y x)\n (x y : M₁ ⊗[R] M₂) :\n B₁.tmul B₂ x y = B₁.tmul B₂ y x :=\n\nProof body:\n","rejected":"by\n revert x y\n rw [isSymm_iff_eq_flip]\n aesop\n\nvariable (A) in\n/-- The base change of a bilinear map (also known as \"extension of scalars\"). -/\nprotected def baseChange (B : BilinMap R M₂ N₂) : BilinMap A (A ⊗[R] M₂) (A ⊗[R] N₂) :=\n BilinMap.tmul (R := R) (A := A) (M₁ := A) (M₂ := M₂) (LinearMap.mul A A) B\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/BilinearForm","family_id":"tmul_issymm","file_id":"mathlib/Mathlib/LinearAlgebra/BilinearForm/TensorProduct.lean","sample_id":"d033ac08ff0773d8cd710d59db4143a19c0a7bdc12fd0e5323510cd8f78442b6"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4335f9074abdc05faabccd34c6fb09ef844f44da8c968c1c4714c1b03c12405d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"5d5286368893047c13385df033d1c8120553752c08ed1e107bfabbc5a55f21e4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4436fa25191e3fc74c960f7d5ea5f788d15cfb8f8ae10f184cf8a52976c4d0c3","source_sha256":"8b955bbaffd2bc1eba2df1d6c668ffd5393bb009abfb2003a13272afec5c9b7d","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n cases isEmpty_or_nonempty ι with\n | inr _ =>\n refine ⟨fun _ hx ↦ hx.1, ?_⟩\n intro n hn x hx\n simp only [Ideal.mem_inf, mem_iInf] at hx ⊢\n exact ⟨hI.dpow_mem hn hx.1, fun i ↦ IsSubDPIdeal.dpow_mem (hJ i) n hn (hx.2 i)⟩\n | inl _ =>\n simp only [iInf_of_empty, le_top, inf_of_le_left]\n exact IsSubDPIdeal.self hI","hard_negative":true,"metrics":{"chosen_tokens":86,"rejected_tokens":5,"token_jaccard":0.0625,"token_length_ratio":0.05814},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"b3b0eb4b9f298bbb0b5959ee2c59bb00589b590125f1905d38d3f6e8caf9d02f","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.DividedPowers.DPMorphism\npublic import Mathlib.RingTheory.Ideal.Quotient.Operations\n\nNamespace:\nDividedPowers\n\nLocal context:\n/-\nCopyright (c) 2025 Antoine Chambert-Loir, María Inés de Frutos-Fernández. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Antoine Chambert-Loir, María Inés de Frutos-Fernández\n-/\n/-! # Sub-divided power-ideals\n\nLet `A` be a commutative (semi)ring and let `I` be an ideal of `A` with a divided power\nstructure `hI`. A subideal `J` of `I` is a *sub-dp-ideal* of `(I, hI)` if, for all `n ∈ ℕ > 0` and\nall `x ∈ J`, `hI.dpow n x ∈ J`.\n\n## Main definitions\n\n* `DividedPowers.IsSubDPIdeal` : A sub-ideal `J` of a divided power ideal `(I, hI)` is a\n *sub-dp-ideal* if for all `n > 0` and all `x ∈ J`, `hI.dpow n j ∈ J`.\n* `DividedPowers.SubDPIdeal` : A bundled version of `IsSubDPIdeal`.\n* `DividedPowers.IsSubDPIdeal.dividedPowers`: the divided power structure on a sub-dp-ideal.\n* `DividedPowers.IsSubDPIdeal.prod` : if `J` is an `A`-ideal, then `I ⬝ J` is a sub-dp-ideal of `I`.\n* `DividedPowers.IsSubDPIdeal.span` : the sub-dp-ideal of `I` generated by a set of elements of `A`.\n* `DividedPowers.subDPIdeal_inf_of_quot` : if there is a dp-structure on `I⬝(A/J)` such that the\n quotient map is a dp-morphism, then `J ⊓ I` is a sub-dp-ideal of `I`.\n* `DividedPowers.Quotient.OfSurjective.dividedPowers`: when `f : A → B` is a surjective map and\n `f.ker ⊓ I` is a sub-dp-ideal of `I`, this is the induced divided power structure on the ideal\n `I.map f` of the target.\n* `DividedPowers.Quotient.dividedPowers` : when `I ⊓ J` is a sub-dp-ideal of `I`, this is the\n divided power structure on the ideal `I(A⧸J)` of the quotient.\n\n## Main results\n\n* `DividedPowers.isSubDPIdeal_inf_iff` : the ideal `J ⊓ I` is a sub-dp-ideal of `I` if and only if\n (on `I`) the divided powers are compatible mod `J`.\n* `DividedPowers.span_isSubDPIdeal_iff` : the span of a set `S : Set A` is a sub-dp-ideal of `I`\n if and only if for all `n ∈ ℕ > 0` and all `s ∈ S`, hI.dpow n s ∈ span S.\n* `DividedPowers.isSubDPIdeal_ker` : the kernel of a divided power morphism from `I` to `J` is\n a sub-dp-ideal of `I`.\n* `DividedPowers.isSubDPIdeal_map` : the image of a divided power morphism from `I` to `J` is\n a sub-dp-ideal of `J`.\n* `DividedPowers.SubDPIdeal.instCompleteLattice` : sub-dp-ideals of `I` form a complete lattice\n under inclusion.\n* `DividedPowers.SubDPIdeal.span_carrier_eq_dpow_span` : the underlying ideal of\n `SubDPIdeal.span hI S` is generated by the elements of the form `hI.dpow n x` with `n > 0`\n and `x ∈ S`.\n* `DividedPowers.Quotient.OfSurjective.dividedPowers_unique` : the only divided power structure on\n `I.map f` such that the surjective map `f : A → B` is a divided power morphism is given by\n `DividedPowers.Quotient.OfSurjective.dividedPowers`.\n* `DividedPowers.Quotient.dividedPowers_unique` : the only divided power structure on `I(A⧸J)` such\n that the quotient map `A → A/J` is a divided power morphism is given by\n `DividedPowers.Quotient.dividedPowers`.\n\n## Implementation remarks\n\nWe provide both a bundled and an unbundled definition of sub-dp-ideals. The unbundled version is\noften more convenient when a larger proof requires to show that a certain ideal is a sub-dp-ideal.\nOn the other hand, a bundled version is required to prove that sub-dp-ideals form a complete\nlattice.\n\n## References\n\n* [P. Berthelot, *Cohomologie cristalline des schémas de caractéristique $p$ > 0*][Berthelot-1974]\n\n* [P. Berthelot and A. Ogus, *Notes on crystalline cohomology*][BerthelotOgus-1978]\n\n* [N. Roby, *Lois polynomes et lois formelles en théorie des modules*][Roby-1963]\n\n* [N. Roby, *Les algèbres à puissances dividées*][Roby-1965]\n-/\n\n@[expose] public section\n\nopen Subtype\n\nnamespace DividedPowers\n\n/-- A sub-ideal `J` of a divided power ideal `(I, hI)` is a sub-dp-ideal if for all `n > 0` and\n all `x ∈ J`, `hI.dpow n j ∈ J`. -/\nstructure IsSubDPIdeal {A : Type*} [CommSemiring A] {I : Ideal A} (hI : DividedPowers I)\n (J : Ideal A) : Prop where\n isSubideal : J ≤ I\n dpow_mem : ∀ (n : ℕ) (_ : n ≠ 0) {j : A} (_ : j ∈ J), hI.dpow n j ∈ J\n\nsection IsSubDPIdeal\n\nnamespace IsSubDPIdeal\n\nvariable {A : Type*} [CommSemiring A] {I : Ideal A} (hI : DividedPowers I)\n\nopen Ideal\n\ntheorem self : IsSubDPIdeal hI I where\n isSubideal := le_rfl\n dpow_mem _ hn _ ha := hI.dpow_mem hn ha\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The divided power structure on a sub-dp-ideal. -/\ndef dividedPowers {J : Ideal A} (hJ : IsSubDPIdeal hI J) [∀ x, Decidable (x ∈ J)] :\n DividedPowers J where\n dpow n x := if x ∈ J then hI.dpow n x else 0\n dpow_null hx := by simp [if_neg hx]\n dpow_zero hx := by simp [if_pos hx, hI.dpow_zero (hJ.isSubideal hx)]\n dpow_one hx := by simp [if_pos hx, hI.dpow_one (hJ.isSubideal hx)]\n dpow_mem hn hx := by simp [if_pos hx, hJ.dpow_mem _ hn hx]\n dpow_add hx hy := by simp_rw [if_pos hx, if_pos hy, if_pos (Ideal.add_mem J hx hy),\n hI.dpow_add (hJ.isSubideal hx) (hJ.isSubideal hy)]\n dpow_mul hx := by\n simp [if_pos hx, if_pos (mul_mem_left J _ hx), hI.dpow_mul (hJ.isSubideal hx)]\n mul_dpow hx := by simp [if_pos hx, hI.mul_dpow (hJ.isSubideal hx)]\n dpow_comp hn hx := by\n simp [if_pos hx, if_pos (hJ.dpow_mem _ hn hx), hI.dpow_comp hn (hJ.isSubideal hx)]\n\nvariable {J : Ideal A} (hJ : IsSubDPIdeal hI J) [∀ x, Decidable (x ∈ J)]\n\nlemma dpow_eq (n : ℕ) (a : A) :\n (IsSubDPIdeal.dividedPowers hI hJ).dpow n a = if a ∈ J then hI.dpow n a else 0 := rfl\n\nlemma dpow_eq_of_mem {n : ℕ} {a : A} (ha : a ∈ J) :\n (IsSubDPIdeal.dividedPowers hI hJ).dpow n a = hI.dpow n a := by rw [dpow_eq, if_pos ha]\n\ntheorem isDPMorphism (hJ : IsSubDPIdeal hI J) :\n (IsSubDPIdeal.dividedPowers hI hJ).IsDPMorphism hI (RingHom.id A) := by\n simpa only [isDPMorphism_iff, Ideal.map_id, RingHom.id_apply]\n using ⟨hJ.1, fun _ _ _ ha ↦ by rw [dpow_eq_of_mem _ _ ha]⟩\n\nend IsSubDPIdeal\n\nopen Finset Ideal\n\n/-- The ideal `J ⊓ I` is a sub-dp-ideal of `I` if and only if the divided powers have\n some compatibility mod `J`. (The necessity was proved as a sanity check.) -/\ntheorem isSubDPIdeal_inf_iff {A : Type*} [CommRing A] {I : Ideal A} (hI : DividedPowers I)\n {J : Ideal A} : IsSubDPIdeal hI (J ⊓ I) ↔\n ∀ {n : ℕ} {a b : A} (_ : a ∈ I) (_ : b ∈ I) (_ : a - b ∈ J), hI.dpow n a - hI.dpow n b ∈ J := by\n refine ⟨fun hIJ n a b ha hb hab ↦ ?_, fun hIJ ↦ ?_⟩\n · have hab' : a - b ∈ I := I.sub_mem ha hb\n rw [← add_sub_cancel b a, hI.dpow_add' hb hab', range_add_one, sum_insert notMem_range_self,\n tsub_self, hI.dpow_zero hab', mul_one, add_sub_cancel_left]\n exact J.sum_mem (fun i hi ↦ SemilatticeInf.inf_le_left J I ((J ⊓ I).smul_mem _\n (hIJ.dpow_mem _ (ne_of_gt (Nat.sub_pos_of_lt (mem_range.mp hi))) ⟨hab, hab'⟩)))\n · refine ⟨SemilatticeInf.inf_le_right J I, fun {n} hn {a} ha ↦ ⟨?_, hI.dpow_mem hn ha.right⟩⟩\n rw [← sub_zero (hI.dpow n a), ← hI.dpow_eval_zero hn]\n exact hIJ ha.right I.zero_mem (J.sub_mem ha.left J.zero_mem)\n\nvariable {A B : Type*} [CommSemiring A] {I : Ideal A} {hI : DividedPowers I} [CommSemiring B]\n {J : Ideal B} {hJ : DividedPowers J}\n\n/-- [P. Berthelot and A. Ogus, *Notes on crystalline cohomology* (Lemma 3.6)][BerthelotOgus-1978] -/\ntheorem span_isSubDPIdeal_iff {S : Set A} (hS : S ⊆ I) :\n IsSubDPIdeal hI (span S) ↔ ∀ {n : ℕ} (_ : n ≠ 0), ∀ s ∈ S, hI.dpow n s ∈ span S := by\n refine ⟨fun hhI n hn s hs ↦ hhI.dpow_mem n hn (subset_span hs), fun hhI ↦ ?_⟩\n · -- interesting direction\n have hSI := span_le.mpr hS\n apply IsSubDPIdeal.mk hSI\n intro m hm z hz\n induction hz using Submodule.span_induction generalizing m hm with\n | mem x h => exact hhI hm x h\n | zero =>\n rw [hI.dpow_eval_zero hm]\n exact (span S).zero_mem\n | add x y hxI hyI hx hy =>\n rw [hI.dpow_add' (hSI hxI) (hSI hyI)]\n apply Submodule.sum_mem (span S)\n intro m _\n by_cases hm0 : m = 0\n · exact hm0 ▸ mul_mem_left (span S) _ (hy _ hm)\n · exact mul_mem_right _ (span S) (hx _ hm0)\n | smul a x hxI hx =>\n rw [smul_eq_mul, hI.dpow_mul (hSI hxI)]\n exact mul_mem_left (span S) (a ^ m) (hx m hm)\n\ntheorem isSubDPIdeal_sup {J K : Ideal A} (hJ : IsSubDPIdeal hI J) (hK : IsSubDPIdeal hI K) :\n IsSubDPIdeal hI (J ⊔ K) := by\n rw [← J.span_eq, ← K.span_eq, ← span_union,\n span_isSubDPIdeal_iff (Set.union_subset_iff.mpr ⟨hJ.1, hK.1⟩)]\n intro n hn a ha\n rcases ha with ha | ha\n · exact span_mono Set.subset_union_left (subset_span (hJ.2 n hn ha))\n · exact span_mono Set.subset_union_right (subset_span (hK.2 n hn ha))\n\ntheorem isSubDPIdeal_iSup {ι : Type*} {J : ι → Ideal A} (hJ : ∀ i, IsSubDPIdeal hI (J i)) :\n IsSubDPIdeal hI (iSup J) := by\n rw [iSup_eq_span, span_isSubDPIdeal_iff (Set.iUnion_subset_iff.mpr <| fun i ↦ (hJ i).1)]\n simp_rw [Set.mem_iUnion]\n rintro n hn a ⟨i, ha⟩\n exact span_mono (Set.subset_iUnion _ i) (subset_span ((hJ i).2 n hn ha))\n\nTarget:\ntheorem isSubDPIdeal_iInf {ι : Type*} {J : ι → Ideal A} (hJ : ∀ i, IsSubDPIdeal hI (J i)) :\n IsSubDPIdeal hI (I ⊓ iInf (fun i ↦ J i)) :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_4436fa25191e","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"b653f6214f89a5f85d1f610e4304c91d285c51effabaddd072d528b6e636cc1f","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/DividedPowers","family_id":"issubdpideal_iinf","file_id":"mathlib/Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean","sample_id":"4436fa25191e3fc74c960f7d5ea5f788d15cfb8f8ae10f184cf8a52976c4d0c3"},"split":"validation"} {"binding":{"chosen_proof_sha256":"2e2a0ea703b7a3bfdb7e14e12a69aba635aaedc52b307b58fc0bc2f916eae48a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6c8b932524c15bfe9709d917f08aa4e0851c9aa8026485e452e315f1af8558fb","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"93ce585b4eb43d761cd3a6e8a7821422241492ef2e0cddda81b97895591573f8","source_sha256":"4188929eaab00be25e03f370f903a35926218751914f9459e15da14f5b80289a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by grind\n\n/-!\n### Algebraic replacement rules\n\nA collection of lemmas to transfer associativity, commutativity, distributivity, ... of operations\nto the associativity, commutativity, distributivity, ... of `Option.map₂` of those operations.\nThe proof pattern is `map₂_lemma operation_lemma`. For example, `map₂_comm mul_comm` proves that\n`map₂ (*) a b = map₂ (*) g f` in a `CommSemigroup`.\n-/\n\nvariable {α' β' δ' ε ε' : Type*}","hard_negative":true,"metrics":{"chosen_tokens":112,"rejected_tokens":2,"token_jaccard":0.016667,"token_length_ratio":0.017857},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"b57e6d102fa67cd4d9008b2066a9a5dcf14ecc6b8c0d328bbdfc3dd0278a9cee","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Init\n\nNamespace:\nOption\n\nLocal context:\n/-\nCopyright (c) 2022 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Binary map of options\n\nThis file defines the binary map of `Option`. This is mostly useful to define pointwise operations\non intervals.\n\n## Main declarations\n\n* `Option.map₂`: Binary map of options.\n\n## Notes\n\nThis file is very similar to the n-ary section of `Mathlib/Data/Set/Basic.lean`, to\n`Mathlib/Data/Finset/NAry.lean` and to `Mathlib/Order/Filter/NAry.lean`. Please keep them in sync.\n\nWe do not define `Option.map₃` as its only purpose so far would be to prove properties of\n`Option.map₂` and casing already fulfills this task.\n-/\n\n@[expose] public section\n\nuniverse u\n\nopen Function\n\nnamespace Option\n\n-- Allow `grind` to case split on `Option` in this file.\nattribute [local grind cases] Option\n\nvariable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ}\n\n/-- The image of a binary function `f : α → β → γ` as a function `Option α → Option β → Option γ`.\nMathematically this should be thought of as the image of the corresponding function `α × β → γ`. -/\ndef map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ :=\n a.bind fun a => b.map <| f a\n\n/-- `Option.map₂` in terms of monadic operations. Note that this can't be taken as the definition\nbecause of the lack of universe polymorphism. -/\ntheorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) :\n map₂ f a b = f <$> a <*> b := by\n cases a <;> rfl\n\n@[simp, grind =]\ntheorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl\n\ntheorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl\n\n@[simp, grind =]\ntheorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl\n\n@[simp, grind =]\ntheorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl\n\n@[simp]\ntheorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b :=\n rfl\n\n@[simp]\ntheorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) :\n map₂ f a b = a.map fun a => f a b := by grind\n\ntheorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by\n grind\n\n/-- `simp`-normal form of `mem_map₂_iff`. -/\n@[simp]\ntheorem map₂_eq_some_iff {c : γ} :\n map₂ f a b = some c ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by\n grind\n\n@[simp]\ntheorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by\n grind\n\ntheorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) :\n map₂ f a b = map₂ (fun a b => f b a) b a := by grind\n\ntheorem map_map₂ (f : α → β → γ) (g : γ → δ) :\n (map₂ f a b).map g = map₂ (fun a b => g (f a b)) a b := by grind\n\ntheorem map₂_map_left (f : γ → β → δ) (g : α → γ) :\n map₂ f (a.map g) b = map₂ (fun a b => f (g a) b) a b := by grind\n\ntheorem map₂_map_right (f : α → γ → δ) (g : β → γ) :\n map₂ f a (b.map g) = map₂ (fun a b => f a (g b)) a b := by grind\n\n@[simp]\ntheorem map₂_curry (f : α × β → γ) (a : Option α) (b : Option β) :\n map₂ (curry f) a b = Option.map f (map₂ Prod.mk a b) := by grind\n\n@[simp]\n\nTarget:\ntheorem map_uncurry (f : α → β → γ) (x : Option (α × β)) :\n x.map (uncurry f) = map₂ f (x.map Prod.fst) (x.map Prod.snd) :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_93ce585b4eb4","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"49e33d80841933b7b408527ef96a267d16c805fb6366d4699cee7961e4ce0949","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Option","family_id":"map_uncurry","file_id":"mathlib/Mathlib/Data/Option/NAry.lean","sample_id":"93ce585b4eb43d761cd3a6e8a7821422241492ef2e0cddda81b97895591573f8"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8c8fe3d67908f29401248fc1d369ee6c2299abf2cd6123278a19accbce24703a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"ab17ba4637d956eb15d4f29a4c17c159ecd5fcf8ce55bbc241f1833fb1541f10","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"536b9c6a6a5b364cbf955e37e33716d32e57e801c918bfe11a1d15bd1faeaaf9","source_sha256":"d71fa3ee7da14cca634518b535c01bc451d796c261b03831d3a069160e1a02e2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨fun h a x ↦ ?_, fun h a b x y ↦ ?_⟩\n · obtain ⟨a, ma, rfl⟩ := x\n exact ⟨a.2, fun b x y ↦ by simpa [h (show ⟨b, y⟩ ≤ a by exact x) ma]⟩\n · have ma : a.1 ∈ Subtype.val '' s := by simp [a.2, y]\n simpa only [mem_image, Subtype.coe_inj, exists_eq_right] using (h ma).2 x b.2","hard_negative":false,"metrics":{"chosen_tokens":109,"rejected_tokens":113,"token_jaccard":0.934783,"token_length_ratio":1.036697},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"b611123cb403ff41db819c6579b56d9e6dcf0427e5175bf895d0f6d03af8b6dc","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Set.Image\npublic import Mathlib.Data.SetLike.Basic\npublic import Mathlib.Order.Interval.Set.Defs\npublic import Mathlib.Order.SetNotation\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Jeremy Tan. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jeremy Tan\n-/\n/-!\n# Properties of relative upper/lower sets\n\nThis file proves results on `IsRelUpperSet` and `IsRelLowerSet`.\n-/\n\npublic section\n\nopen Set\n\nvariable {α : Type*} {ι : Sort*} {κ : ι → Sort*} {s t : Set α} {a b : α} {P : α → Prop}\n\nsection LE\n\nvariable [LE α]\n\n@[simp] lemma isRelUpperSet_true_iff_isUpperSet :\n IsRelUpperSet s (fun _ ↦ True) ↔ IsUpperSet s := by\n grind [IsUpperSet, IsRelUpperSet]\n\n@[simp] lemma isRelLowerSet_true_iff_isLowerSet :\n IsRelLowerSet s (fun _ ↦ True) ↔ IsLowerSet s := by\n grind [IsLowerSet, IsRelLowerSet]\n\nvariable (P) in\nlemma IsUpperSet.isRelUpperSet_sep (hs : IsUpperSet s) : IsRelUpperSet {x ∈ s | P x} P :=\n fun _ h => ⟨h.2, fun _ ht hp => ⟨hs ht h.1, hp⟩⟩\nvariable (P) in\nlemma IsLowerSet.isRelLowerSet_sep (hs : IsLowerSet s) : IsRelLowerSet {x ∈ s | P x} P :=\n fun _ h => ⟨h.2, fun _ ht hp => ⟨hs ht h.1, hp⟩⟩\n\n/-- A subset that is a lower set is additionally a _relative_ lower set. -/\nlemma IsRelLowerSet.mono_isLowerSet (ht : IsRelLowerSet t P) (hs : IsLowerSet s) (hst : s ⊆ t) :\n IsRelLowerSet s P :=\n fun _ h => ⟨(ht (hst h)).1, fun _ ht _ => hs ht h⟩\n\n/-- A subset that is an upper set is additionally a _relative_ upper set. -/\nlemma IsRelUpperSet.mono_isUpperSet (ht : IsRelUpperSet t P) (hs : IsUpperSet s) (hst : s ⊆ t) :\n IsRelUpperSet s P :=\n fun _ h => ⟨(ht (hst h)).1, fun _ ht _ => hs ht h⟩\n\nlemma IsRelUpperSet.prop_of_mem (hs : IsRelUpperSet s P) (h : a ∈ s) : P a := (hs h).1\nlemma IsRelLowerSet.prop_of_mem (hs : IsRelLowerSet s P) (h : a ∈ s) : P a := (hs h).1\n\nlemma IsRelUpperSet.mem_of_le (hs : IsRelUpperSet s P) (h : a ∈ s) (h₁ : a ≤ b) (h₂ : P b) :\n b ∈ s := (hs h).2 h₁ h₂\nlemma IsRelLowerSet.mem_of_le (hs : IsRelLowerSet s P) (h : a ∈ s) (h₁ : b ≤ a) (h₂ : P b) :\n b ∈ s := (hs h).2 h₁ h₂\n\n@[simp] lemma isRelUpperSet_empty : IsRelUpperSet (∅ : Set α) P := fun _ ↦ False.elim\n@[simp] lemma isRelLowerSet_empty : IsRelLowerSet (∅ : Set α) P := fun _ ↦ False.elim\n\n@[simp] lemma isRelUpperSet_self : IsRelUpperSet s (· ∈ s) := fun _ b ↦ ⟨b, fun _ _ ↦ id⟩\n@[simp] lemma isRelLowerSet_self : IsRelLowerSet s (· ∈ s) := fun _ b ↦ ⟨b, fun _ _ ↦ id⟩\n\nlemma IsRelUpperSet.union (hs : IsRelUpperSet s P) (ht : IsRelUpperSet t P) :\n IsRelUpperSet (s ∪ t) P := fun b mb ↦ by\n cases mb with\n | inl h => exact ⟨(hs h).1, fun _ x y ↦ .inl ((hs h).2 x y)⟩\n | inr h => exact ⟨(ht h).1, fun _ x y ↦ .inr ((ht h).2 x y)⟩\n\nlemma IsRelLowerSet.union (hs : IsRelLowerSet s P) (ht : IsRelLowerSet t P) :\n IsRelLowerSet (s ∪ t) P := fun b mb ↦ by\n cases mb with\n | inl h => exact ⟨(hs h).1, fun _ x y ↦ .inl ((hs h).2 x y)⟩\n | inr h => exact ⟨(ht h).1, fun _ x y ↦ .inr ((ht h).2 x y)⟩\n\nlemma IsRelUpperSet.inter (hs : IsRelUpperSet s P) (ht : IsRelUpperSet t P) :\n IsRelUpperSet (s ∩ t) P := fun b ⟨bs, bt⟩ ↦ by\n simp_all only [IsRelUpperSet, true_and]\n exact fun _ x y ↦ ⟨(hs bs).2 x y, (ht bt).2 x y⟩\n\nlemma IsRelLowerSet.inter (hs : IsRelLowerSet s P) (ht : IsRelLowerSet t P) :\n IsRelLowerSet (s ∩ t) P := fun b ⟨bs, bt⟩ ↦ by\n simp_all only [IsRelLowerSet, true_and]\n exact fun _ x y ↦ ⟨(hs bs).2 x y, (ht bt).2 x y⟩\n\nprotected lemma IsRelUpperSet.sUnion {S : Set (Set α)} (hS : ∀ s ∈ S, IsRelUpperSet s P) :\n IsRelUpperSet (⋃₀ S) P := fun _ ⟨s, ms, mb⟩ ↦\n ⟨(hS s ms mb).1, fun _ x y ↦ ⟨s, ms, (hS s ms mb).2 x y⟩⟩\n\nprotected lemma IsRelLowerSet.sUnion {S : Set (Set α)} (hS : ∀ s ∈ S, IsRelLowerSet s P) :\n IsRelLowerSet (⋃₀ S) P := fun _ ⟨s, ms, mb⟩ ↦\n ⟨(hS s ms mb).1, fun _ x y ↦ ⟨s, ms, (hS s ms mb).2 x y⟩⟩\n\nprotected lemma IsRelUpperSet.iUnion {f : ι → Set α} (hf : ∀ i, IsRelUpperSet (f i) P) :\n IsRelUpperSet (⋃ i, f i) P :=\n .sUnion (forall_mem_range.2 hf)\n\nprotected lemma IsRelLowerSet.iUnion {f : ι → Set α} (hf : ∀ i, IsRelLowerSet (f i) P) :\n IsRelLowerSet (⋃ i, f i) P :=\n .sUnion (forall_mem_range.2 hf)\n\nprotected lemma IsRelUpperSet.iUnion₂ {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelUpperSet (f i j) P) :\n IsRelUpperSet (⋃ (i) (j), f i j) P :=\n .iUnion fun i ↦ .iUnion (hf i)\n\nprotected lemma IsRelLowerSet.iUnion₂ {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelLowerSet (f i j) P) :\n IsRelLowerSet (⋃ (i) (j), f i j) P :=\n .iUnion fun i ↦ .iUnion (hf i)\n\nprotected lemma IsRelUpperSet.sInter\n {S : Set (Set α)} (hS : S.Nonempty) (hf : ∀ s ∈ S, IsRelUpperSet s P) :\n IsRelUpperSet (⋂₀ S) P := fun b mb ↦ by\n obtain ⟨s₀, ms₀⟩ := hS\n refine ⟨(hf s₀ ms₀ (mb s₀ ms₀)).1, fun _ x y s ms ↦ (hf s ms (mb s ms)).2 x y⟩\n\nprotected lemma IsRelLowerSet.sInter\n {S : Set (Set α)} (hS : S.Nonempty) (hf : ∀ s ∈ S, IsRelLowerSet s P) :\n IsRelLowerSet (⋂₀ S) P := fun b mb ↦ by\n obtain ⟨s₀, ms₀⟩ := hS\n refine ⟨(hf s₀ ms₀ (mb s₀ ms₀)).1, fun _ x y s ms ↦ (hf s ms (mb s ms)).2 x y⟩\n\nprotected lemma IsRelUpperSet.iInter\n [Nonempty ι] {f : ι → Set α} (hf : ∀ i, IsRelUpperSet (f i) P) : IsRelUpperSet (⋂ i, f i) P :=\n .sInter (range_nonempty f) (forall_mem_range.2 hf)\n\nprotected lemma IsRelLowerSet.iInter\n [Nonempty ι] {f : ι → Set α} (hf : ∀ i, IsRelLowerSet (f i) P) : IsRelLowerSet (⋂ i, f i) P :=\n .sInter (range_nonempty f) (forall_mem_range.2 hf)\n\nprotected lemma IsRelUpperSet.iInter₂ [Nonempty ι] [∀ i, Nonempty (κ i)]\n {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelUpperSet (f i j) P) :\n IsRelUpperSet (⋂ (i) (j), f i j) P :=\n .iInter fun i ↦ .iInter (hf i)\n\nprotected lemma IsRelLowerSet.iInter₂ [Nonempty ι] [∀ i, Nonempty (κ i)]\n {f : ∀ i, κ i → Set α} (hf : ∀ i j, IsRelLowerSet (f i j) P) :\n IsRelLowerSet (⋂ (i) (j), f i j) P :=\n .iInter fun i ↦ .iInter (hf i)\n\nlemma isUpperSet_subtype_iff_isRelUpperSet {s : Set { x // P x }} :\n IsUpperSet s ↔ IsRelUpperSet (Subtype.val '' s) P := by\n refine ⟨fun h a x ↦ ?_, fun h a b x y ↦ ?_⟩\n · obtain ⟨a, ma, rfl⟩ := x\n exact ⟨a.2, fun b x y ↦ by simpa [h (show a ≤ ⟨b, y⟩ by exact x) ma]⟩\n · have ma : a.1 ∈ Subtype.val '' s := by simp [a.2, y]\n simpa only [mem_image, Subtype.coe_inj, exists_eq_right] using (h ma).2 x b.2\n\nTarget:\nlemma isLowerSet_subtype_iff_isRelLowerSet {s : Set { x // P x }} :\n IsLowerSet s ↔ IsRelLowerSet (Subtype.val '' s) P :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n refine ⟨fun h a x ↦ ?_, fun h a b x y ↦ ?_⟩\n · obtain ⟨a, ma, rfl⟩ := x\n exact ⟨a.2, fun b x y ↦ by simpa [h (show ⟨b, y⟩ ≤ a by exact x) ma]⟩\n · have ma : a.1 ∈ Subtype.val '' s := by simp [a.2, y]\n simpa only [mem_image, Subtype.coe_inj, exists_eq_right] using (h ma).2 x b.2","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Order/UpperLower","family_id":"islowerset_subtype_iff_isrellowerset","file_id":"mathlib/Mathlib/Order/UpperLower/Relative.lean","sample_id":"536b9c6a6a5b364cbf955e37e33716d32e57e801c918bfe11a1d15bd1faeaaf9"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5f4ec1fadc34891847a7da527835fa28eb9845877c9dd8ef226bb8cf0f4991f0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"eb4ec1bb5d346bec9caf2c06136e6b6978a03154b095a90138d81160cbc41d2c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"250df88c40a9c38c53c756c9f0a6070ff564fcc606b5665c05481b0f1e5a0c17","source_sha256":"ecc7ed823eab4701ef04e2817ef37a969189071935536b0da6ae40027d388081","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [UniformSpace.mem_nhds_iff]\n constructor\n · rintro ⟨V, V_in, V_sub⟩\n rw [IsUltraUniformity.hasBasis.mem_iff'] at V_in\n obtain ⟨U, ⟨U_in, U_sym, U_trans⟩, U_sub⟩ := V_in\n refine ⟨U, U_in, U_sym, U_trans, (UniformSpace.ball_mono U_sub _).trans V_sub⟩\n · rintro ⟨V, V_in, _, _, V_sub⟩\n exact ⟨V, V_in, V_sub⟩","hard_negative":false,"metrics":{"chosen_tokens":85,"rejected_tokens":90,"token_jaccard":0.871795,"token_length_ratio":1.058824},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"bba6582f0d6de2ab807031b7e22a4469f0690a469300d715d913a53439aac737","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.UniformSpace.Defs\npublic import Mathlib.Topology.Bases\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Yakov Pechersky. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yakov Pechersky\n-/\n/-!\n# Ultrametric (nonarchimedean) uniform spaces\n\nUltrametric (nonarchimedean) uniform spaces are ones that generalize ultrametric spaces by\nhaving a uniformity based on equivalence relations.\n\n## Main definitions\n\nIn this file we define `IsUltraUniformity`, a Prop mixin typeclass.\n\n## Main results\n\n* `TopologicalSpace.isTopologicalBasis_clopens`: a uniform space with a nonarchimedean uniformity\n has a topological basis of clopen sets in the topology, meaning that it is topologically\n zero-dimensional.\n\n## Implementation notes\n\nAs in the `Mathlib/Topology/UniformSpace/Defs.lean` file, we do not reuse `Mathlib/Data/Rel.lean`\nbut rather extend the relation properties as needed.\n\n## TODOs\n\n* Prove that `IsUltraUniformity` iff metrizable by `IsUltrametricDist` on a `PseudoMetricSpace`\n under a countable system/basis condition\n* Generalize `IsUltrametricDist` to `IsUltrametricUniformity`\n* Provide `IsUltraUniformity` for the uniformity in a `Valued` ring\n* Generalize results about open/closed balls and spheres in `IsUltraUniformity` to\n combine applications for `MetricSpace.ball` and valued \"balls\"\n* Use `IsUltraUniformity` to work with profinite/totally separated spaces\n\n## References\n\n* [D. Windisch, *Equivalent characterizations of non-Archimedean uniform spaces*][windisch2021]\n* [A. C. M. van Rooij, *Non-Archimedean uniformities*][vanrooij1970]\n\n-/\n\n@[expose] public section\n\nopen Set Filter Topology\nopen scoped SetRel Uniformity\n\nvariable {X : Type*}\n\nlemma IsTransitiveRel.prod_subset_trans {s : SetRel X X} {t u v : Set X} [s.IsTrans]\n (htu : t ×ˢ u ⊆ s) (huv : u ×ˢ v ⊆ s) (hu : u.Nonempty) :\n t ×ˢ v ⊆ s := by\n rintro ⟨a, b⟩ hab\n simp only [mem_prod] at hab\n obtain ⟨x, hx⟩ := hu\n exact s.trans (@htu ⟨a, x⟩ ⟨hab.left, hx⟩) (@huv ⟨x, b⟩ ⟨hx, hab.right⟩)\n\nlemma IsTransitiveRel.mem_filter_prod_trans {s : SetRel X X} {f g h : Filter X} [g.NeBot]\n [s.IsTrans] (hfg : s ∈ f ×ˢ g) (hgh : s ∈ g ×ˢ h) :\n s ∈ f ×ˢ h :=\n Eventually.trans_prod (p := (fun x y ↦ (x, y) ∈ s)) (q := (fun x y ↦ (x, y) ∈ s))\n (r := (fun x y ↦ (x, y) ∈ s)) hfg hgh fun _ _ _ ↦ s.trans\n\nopen UniformSpace\n\nlemma ball_subset_of_mem {V : SetRel X X} [V.IsTrans] {x y : X} (hy : y ∈ ball x V) :\n ball y V ⊆ ball x V :=\n ball_subset_of_comp_subset hy SetRel.comp_subset_self\n\nlemma ball_eq_of_mem {V : SetRel X X} [V.IsSymm] [V.IsTrans] {x y : X} (hy : y ∈ ball x V) :\n ball x V = ball y V := by\n refine le_antisymm (ball_subset_of_mem ?_) (ball_subset_of_mem hy)\n rwa [← mem_ball_symmetry]\n\nvariable [UniformSpace X]\n\nvariable (X) in\n/-- A uniform space is ultrametric if the uniformity `𝓤 X` has a basis of equivalence relations. -/\nclass IsUltraUniformity : Prop where\n hasBasis : (𝓤 X).HasBasis\n (fun s : SetRel X X => s ∈ 𝓤 X ∧ SetRel.IsSymm s ∧ SetRel.IsTrans s) id\n\nlemma IsUltraUniformity.mk_of_hasBasis {ι : Type*} {p : ι → Prop} {s : ι → SetRel X X}\n (h_basis : (𝓤 X).HasBasis p s) (h_symm : ∀ i, p i → SetRel.IsSymm (s i))\n (h_trans : ∀ i, p i → SetRel.IsTrans (s i)) :\n IsUltraUniformity X where\n hasBasis := h_basis.to_hasBasis'\n (fun i hi ↦ ⟨s i, ⟨h_basis.mem_of_mem hi, h_symm i hi, h_trans i hi⟩, subset_rfl⟩)\n (fun _ hs ↦ hs.1)\n\nTarget:\nlemma IsUltraUniformity.mem_nhds_iff_symm_trans [IsUltraUniformity X] {x : X} {s : Set X} :\n s ∈ 𝓝 x ↔ ∃ V ∈ 𝓤 X, SetRel.IsSymm V ∧ SetRel.IsTrans V ∧ UniformSpace.ball x V ⊆ s :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n rw [UniformSpace.mem_nhds_iff]\n constructor\n · rintro ⟨V, V_in, V_sub⟩\n rw [IsUltraUniformity.hasBasis.mem_iff'] at V_in\n obtain ⟨U, ⟨U_in, U_sym, U_trans⟩, U_sub⟩ := V_in\n refine ⟨U, U_in, U_sym, U_trans, (UniformSpace.ball_mono U_sub _).trans V_sub⟩\n · rintro ⟨V, V_in, _, _, V_sub⟩\n exact ⟨V, V_in, V_sub⟩","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/UniformSpace","family_id":"isultrauniformity","file_id":"mathlib/Mathlib/Topology/UniformSpace/Ultra/Basic.lean","sample_id":"250df88c40a9c38c53c756c9f0a6070ff564fcc606b5665c05481b0f1e5a0c17"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d50b756eaade280806a139d7660ce807405f96ef06b18f58e23f13c29c199cb6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"49f7d7a3e6fe985d533fc3d2d40856e1a9fa3e08ac32f94325a15558314ac1dc","source_sha256":"2d1ca9408fcd1765e9d2dc833c7f4cbefad14ad1a3c169f30ede2989831b39df","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [ZMod.minOrder hp.ne_zero hp.ne_one, hp.minFac_eq]","hard_negative":true,"metrics":{"chosen_tokens":17,"rejected_tokens":8,"token_jaccard":0.055556,"token_length_ratio":0.470588},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"bd44cf2e74a8cdd4b09f8adc23e880c76470633869d4f1af721f5c577c66a8b8","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Torsion\npublic import Mathlib.Data.ENat.Lattice\npublic import Mathlib.Data.ZMod.QuotientGroup\n\nNamespace:\nZMod\n\nLocal context:\n/-\nCopyright (c) 2023 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Minimum order of an element\n\nThis file defines the minimum order of an element of a monoid.\n\n## Main declarations\n\n* `Monoid.minOrder`: The minimum order of an element of a given monoid.\n* `Monoid.minOrder_eq_top`: The minimum order is infinite iff the monoid is torsion-free.\n* `ZMod.minOrder`: The minimum order of $ℤ/nℤ$ is the smallest factor of `n`, unless `n = 0, 1`.\n-/\n\n@[expose] public section\n\nopen Subgroup\n\nvariable {G α : Type*}\n\nnamespace Monoid\nsection Monoid\nvariable (α) [Monoid α]\n\n/-- The minimum order of a non-identity element. Also the minimum size of a nontrivial subgroup, see\n`Monoid.le_minOrder_iff_forall_subgroup`. Returns `∞` if the monoid is torsion-free. -/\n@[to_additive /-- The minimum order of a non-identity element. Also the minimum size of a nontrivial\nsubgroup, see `AddMonoid.le_minOrder_iff_forall_addSubgroup`. Returns `∞` if the monoid is\ntorsion-free. -/]\nnoncomputable def minOrder : ℕ∞ := ⨅ (a : α) (_ha : a ≠ 1) (_ha' : IsOfFinOrder a), orderOf a\n\nvariable {α} {a : α}\n\n@[to_additive (attr := simp)]\nlemma le_minOrder {n : ℕ∞} :\n n ≤ minOrder α ↔ ∀ ⦃a : α⦄, a ≠ 1 → IsOfFinOrder a → n ≤ orderOf a := by simp [minOrder]\n\n@[to_additive]\nlemma minOrder_le_orderOf (ha : a ≠ 1) (ha' : IsOfFinOrder a) : minOrder α ≤ orderOf a :=\n le_minOrder.1 le_rfl ha ha'\n\nend Monoid\n\nsection Group\nvariable [Group G] {s : Subgroup G}\n\n@[to_additive]\nlemma le_minOrder_iff_forall_subgroup {n : ℕ∞} :\n n ≤ minOrder G ↔ ∀ ⦃s : Subgroup G⦄, s ≠ ⊥ → (s : Set G).Finite → n ≤ Nat.card s := by\n rw [le_minOrder]\n refine ⟨fun h s hs hs' ↦ ?_, fun h a ha ha' ↦ ?_⟩\n · obtain ⟨a, has, ha⟩ := s.bot_or_exists_ne_one.resolve_left hs\n exact\n (h ha <| finite_zpowers.1 <| hs'.subset <| zpowers_le.2 has).trans\n (WithTop.coe_le_coe.2 <| s.orderOf_le_card hs' has)\n · simpa using h (zpowers_ne_bot.2 ha) ha'.finite_zpowers\n\n@[to_additive]\nlemma minOrder_le_natCard (hs : s ≠ ⊥) (hs' : (s : Set G).Finite) : minOrder G ≤ Nat.card s :=\n le_minOrder_iff_forall_subgroup.1 le_rfl hs hs'\n\n@[to_additive (attr := simp)]\nlemma minOrder_eq_top [IsMulTorsionFree G] : minOrder G = ⊤ := by\n simpa [minOrder] using fun _ ↦ not_isOfFinOrder_of_isMulTorsionFree\n\nend Group\n\nsection CommGroup\nvariable [CommGroup G] {s : Subgroup G}\n\n@[to_additive (attr := simp)]\nlemma minOrder_eq_top_iff : minOrder G = ⊤ ↔ IsMulTorsionFree G := by\n simp [minOrder, isMulTorsionFree_iff_not_isOfFinOrder]\n\nend CommGroup\nend Monoid\n\nopen AddMonoid AddSubgroup Nat Set\n\nnamespace ZMod\n\n@[simp]\nprotected lemma minOrder {n : ℕ} (hn : n ≠ 0) (hn₁ : n ≠ 1) : minOrder (ZMod n) = n.minFac := by\n have : Fact (1 < n) := ⟨one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn, hn₁⟩⟩\n classical\n have : (↑(n / n.minFac) : ZMod n) ≠ 0 := by\n rw [Ne, ringChar.spec, ringChar.eq (ZMod n) n]\n exact\n not_dvd_of_pos_of_lt (Nat.div_pos (minFac_le hn.bot_lt) n.minFac_pos)\n (div_lt_self hn.bot_lt (minFac_prime hn₁).one_lt)\n refine ((minOrder_le_natCard (zmultiples_eq_bot.not.2 this) <| toFinite _).trans ?_).antisymm <|\n le_minOrder_iff_forall_addSubgroup.2 fun s hs _ ↦ ?_\n · rw [Nat.card_zmultiples, ZMod.addOrderOf_coe _ hn,\n gcd_eq_right (div_dvd_of_dvd n.minFac_dvd), Nat.div_div_self n.minFac_dvd hn]\n · haveI : Nontrivial s := s.bot_or_nontrivial.resolve_left hs\n exact WithTop.coe_le_coe.2 <| minFac_le_of_dvd Finite.one_lt_card <|\n (card_addSubgroup_dvd_card _).trans n.card_zmod.dvd\n\n@[simp]\n\nTarget:\nlemma minOrder_of_prime {p : ℕ} (hp : p.Prime) : minOrder (ZMod p) = p :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"cf2e50195b6cdcea29e573364318fbbc2c0b689c8943837badf26d38e52032c8","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Order","family_id":"minorder_of_prime","file_id":"mathlib/Mathlib/GroupTheory/Order/Min.lean","sample_id":"49f7d7a3e6fe985d533fc3d2d40856e1a9fa3e08ac32f94325a15558314ac1dc"},"split":"validation"} {"binding":{"chosen_proof_sha256":"713a31421b99240127688204675215a79ba4e0ebae49ad6735b8673f5ba804bd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d634389033b93c54cf7d510e6d5a4f28a3abbef04c4914e406071be57d7e16b5","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ae25540ba46c9b45a9b274bcdbfbfd149e28f32049fb375902bb38a173e8c22c","source_sha256":"1438a6885b233a4c239ccc359128314e2075f618ba6baf50cbb53c7a41248de4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [continuousGeneratedBy_iff]\n exact (hg.continuousMap.comp hf.continuousMap).continuous","hard_negative":true,"metrics":{"chosen_tokens":18,"rejected_tokens":3,"token_jaccard":0.133333,"token_length_ratio":0.166667},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"bd71e7eb852990420a35c0214947bf794f9a6341fcbe429ab29233dff30f2076","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Convenient.GeneratedBy\n\nNamespace:\nTopology\n\nLocal context:\n/-\nCopyright (c) 2026 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n/-!\n# `X`-continuous maps\n\nGiven a family `X i` of topological spaces, we introduce a predicate\n`ContinuousGeneratedBy X` on maps `g : Y ⟶ Z` saying that\n`g` is `X`-continuous, i.e. for any continuous map `f : X i → Y`,\nthe composition `g ∘ f` is continuous.\n\n## References\n* [Martín Escardó, Jimmie Lawson and Alex Simpson, *Comparing Cartesian closed\n categories of (core) compactly generated spaces*][escardo-lawson-simpson-2004]\n\n-/\n\nuniverse v v' t u\n\n@[expose] public section\n\nopen Topology\n\nvariable {ι : Type t} {X : ι → Type u} [∀ i, TopologicalSpace (X i)]\n {Y : Type v} [TopologicalSpace Y] {Z : Type v'} [TopologicalSpace Z]\n\nnamespace Topology\n\nvariable (X) in\n/-- Given a family `X i` of topological space, this is a predicate\non maps `g : Y → Z` between topological spaces saying that for any\ncontinuous map `f : X i → Y`, the composition `g ∘ f` is continuous.\nWe say that `g` is `X`-continuous. -/\ndef ContinuousGeneratedBy (g : Y → Z) : Prop :=\n ∀ ⦃i : ι⦄ (f : C(X i, Y)), Continuous (g ∘ f)\n\nlemma continuousGeneratedBy_def (g : Y → Z) :\n ContinuousGeneratedBy X g ↔\n ∀ ⦃i : ι⦄ (f : C(X i, Y)), Continuous (g ∘ f) := Iff.rfl\n\nlemma continuousGeneratedBy_iff (g : Y → Z) :\n ContinuousGeneratedBy X g ↔\n Continuous ((WithGeneratedByTopology.equiv (X := X)).symm ∘ g ∘\n WithGeneratedByTopology.equiv (X := X)) := by\n rw [IsGeneratedBy.equiv_symm_comp_continuous_iff,\n WithGeneratedByTopology.continuous_from_iff]\n rfl\n\n/-- A `X`-continuous map `g : Y → Z` induces a continuous map\nbetween the types `Y` and `Z` equipped with the `X`-generated topology. -/\ndef ContinuousGeneratedBy.continuousMap {g : Y → Z}\n (hg : ContinuousGeneratedBy X g) :\n C(WithGeneratedByTopology X Y, WithGeneratedByTopology X Z) :=\n ⟨WithGeneratedByTopology.equiv.symm ∘ g ∘ WithGeneratedByTopology.equiv, by\n rwa [← continuousGeneratedBy_iff]⟩\n\n@[simp]\nlemma ContinuousGeneratedBy.continuousMap_coe {g : Y → Z}\n (hg : ContinuousGeneratedBy X g) :\n ⇑hg.continuousMap = WithGeneratedByTopology.equiv.symm ∘ g ∘ WithGeneratedByTopology.equiv :=\n rfl\n\n@[simp]\nlemma ContinuousGeneratedBy.id :\n ContinuousGeneratedBy X (id : Y → Y) := by\n simpa [continuousGeneratedBy_iff] using continuous_id\n\nTarget:\nlemma ContinuousGeneratedBy.comp {g : Y → Z} (hg : ContinuousGeneratedBy X g)\n {T : Type*} [TopologicalSpace T] {f : T → Y} (hf : ContinuousGeneratedBy X f) :\n ContinuousGeneratedBy X (g ∘ f) :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_ae25540ba46c","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"0b0072bddfe8e3ab4563474f863d1eade64a05f183149301627aebdfee1756a4","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Convenient","family_id":"continuousgeneratedby","file_id":"mathlib/Mathlib/Topology/Convenient/ContinuousMapGeneratedBy.lean","sample_id":"ae25540ba46c9b45a9b274bcdbfbfd149e28f32049fb375902bb38a173e8c22c"},"split":"validation"} {"binding":{"chosen_proof_sha256":"038df626524d5df4a51b5f907a00c1c15cad051f72f5beeb3d7f6c9ae35b3917","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"418414422e4980dc8c02e755ea61a7eaa6e11b8cd193a415f0fb4074eeef6568","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"f681ebeae95f04e21de4583a72badb0029b1f5b886262dbd3fe5ec3c4cf55ac5","source_sha256":"81f683fc149322018a098af754168365ec7fb0f23809135ec5dd229fe217bed2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨fun h ↦ ⟨inferInstance, inferInstance⟩, fun ⟨_, _⟩ ↦ ?_⟩\n apply isArtinian_of_range_eq_ker S.subtype S.mkQ\n rw [Submodule.ker_mkQ, Submodule.range_subtype]","hard_negative":true,"metrics":{"chosen_tokens":40,"rejected_tokens":3,"token_jaccard":0.04,"token_length_ratio":0.075},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"bf1688753c002c904cf5cdac968e6ed4f4ed51d58179a7009d6ddeac5062a53d","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Units.Opposite\npublic import Mathlib.Algebra.Regular.Opposite\npublic import Mathlib.Data.SetLike.Fintype\npublic import Mathlib.LinearAlgebra.FreeModule.Finite.Basic\npublic import Mathlib.Order.Filter.EventuallyConst\npublic import Mathlib.RingTheory.Artinian.Defs\npublic import Mathlib.RingTheory.Ideal.Prod\npublic import Mathlib.RingTheory.Ideal.Quotient.Operations\npublic import Mathlib.RingTheory.Jacobson.Semiprimary\npublic import Mathlib.RingTheory.Nilpotent.Lemmas\npublic import Mathlib.RingTheory.Noetherian.Defs\npublic import Mathlib.RingTheory.Spectrum.Maximal.Basic\npublic import Mathlib.RingTheory.Spectrum.Prime.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Artinian rings and modules\n\nA module satisfying these equivalent conditions is said to be an *Artinian* R-module\nif every decreasing chain of submodules is eventually constant, or equivalently,\nif the relation `<` on submodules is well founded.\n\nA ring is said to be left (or right) Artinian if it is Artinian as a left (or right) module over\nitself, or simply Artinian if it is both left and right Artinian.\n\n## Main results\n\n* `IsArtinianRing.primeSpectrum_finite`, `IsArtinianRing.isMaximal_of_isPrime`: there are only\n finitely prime ideals in a commutative Artinian ring, and each of them is maximal.\n\n* `IsArtinianRing.equivPi`: a reduced commutative Artinian ring `R` is isomorphic to a finite\n product of fields (and therefore is a semisimple ring and a decomposition monoid; moreover\n `R[X]` is also a decomposition monoid).\n\n* `IsArtinian.isSemisimpleModule_iff_jacobson`: an Artinian module is semisimple\n iff its Jacobson radical is zero.\n\n* `instIsSemiprimaryRingOfIsArtinianRing`: an Artinian ring `R` is semiprimary, in particular\n the Jacobson radical of `R` is a nilpotent ideal (`IsArtinianRing.isNilpotent_jacobson_bot`).\n\n## References\n\n* [M. F. Atiyah and I. G. Macdonald, *Introduction to commutative algebra*][atiyah-macdonald]\n* [P. Samuel, *Algebraic Theory of Numbers*][samuel1967]\n\n## Tags\n\nArtinian, artinian, Artinian ring, Artinian module, artinian ring, artinian module\n\n-/\n\n@[expose] public section\n\nopen Set Filter Pointwise\n\nsection Semiring\n\nvariable {R M P N : Type*}\nvariable [Semiring R] [AddCommMonoid M] [AddCommMonoid P] [AddCommMonoid N]\nvariable [Module R M] [Module R P] [Module R N]\n\ntheorem LinearMap.isArtinian_iff_of_bijective {S P} [Semiring S] [AddCommMonoid P] [Module S P]\n {σ : R →+* S} [RingHomSurjective σ] (l : M →ₛₗ[σ] P) (hl : Function.Bijective l) :\n IsArtinian R M ↔ IsArtinian S P :=\n let e := Submodule.orderIsoMapComapOfBijective l hl\n ⟨fun _ ↦ e.symm.strictMono.wellFoundedLT, fun _ ↦ e.strictMono.wellFoundedLT⟩\n\ntheorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] :\n IsArtinian R M :=\n ⟨Subrelation.wf\n (fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB)\n (InvImage.wf (Submodule.map f) IsWellFounded.wf)⟩\n\ninstance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N :=\n isArtinian_of_injective N.subtype Subtype.val_injective\n\ntheorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s :=\n isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h)\n\nvariable (M) in\ntheorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] :\n IsArtinian R P :=\n ⟨Subrelation.wf\n (fun {A B} hAB =>\n show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB)\n (InvImage.wf (Submodule.comap f) IsWellFounded.wf)⟩\n\n/--\nIf `M` is an Artinian `R` module, and `S` is an `R`-algebra with a surjective\nalgebra map, then `M` is an Artinian `S` module.\n-/\ntheorem isArtinian_of_surjective_algebraMap {S : Type*} [CommSemiring S] [Algebra S R]\n [Module S M] [IsArtinian R M] [IsScalarTower S R M]\n (H : Function.Surjective (algebraMap S R)) : IsArtinian S M := by\n apply (OrderEmbedding.wellFoundedLT (β := Submodule R M))\n refine ⟨⟨?_, ?_⟩, ?_⟩\n · intro N\n refine { toAddSubmonoid := N.toAddSubmonoid, smul_mem' := ?_ }\n intro c x hx\n obtain ⟨r, rfl⟩ := H c\n suffices r • x ∈ N by simpa [Algebra.algebraMap_eq_smul_one, smul_assoc]\n apply N.smul_mem _ hx\n · intro N1 N2 h\n rwa [Submodule.ext_iff] at h ⊢\n · intro N1 N2\n rfl\n\ninstance isArtinian_range (f : M →ₗ[R] P) [IsArtinian R M] : IsArtinian R (LinearMap.range f) :=\n isArtinian_of_surjective _ _ f.surjective_rangeRestrict\n\ntheorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P :=\n isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective\n\ntheorem LinearEquiv.isArtinian_iff (f : M ≃ₗ[R] P) : IsArtinian R M ↔ IsArtinian R P :=\n ⟨fun _ ↦ isArtinian_of_linearEquiv f, fun _ ↦ isArtinian_of_linearEquiv f.symm⟩\n\n-- This was previously a global instance,\n-- but it doesn't appear to be used and has been implicated in slow typeclass resolutions.\nlemma isArtinian_of_finite [Finite M] : IsArtinian R M :=\n ⟨Finite.wellFounded_of_trans_of_irrefl _⟩\n\nopen Submodule\n\ntheorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [h : IsArtinian R M] {s : Set M}\n (hs : LinearIndependent R ((↑) : s → M)) : s.Finite :=\n WellFoundedLT.finite_of_iSupIndep hs.iSupIndep_span_singleton fun i _ ↦ hs.ne_zero i (by simp_all)\n\n/-- A module is Artinian iff every nonempty set of submodules has a minimal submodule among them. -/\ntheorem set_has_minimal_iff_artinian :\n (∀ a : Set <| Submodule R M, a.Nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬I < M') ↔ IsArtinian R M := by\n rw [isArtinian_iff, WellFounded.wellFounded_iff_has_min]\n\ntheorem IsArtinian.set_has_minimal [IsArtinian R M] (a : Set <| Submodule R M) (ha : a.Nonempty) :\n ∃ M' ∈ a, ∀ I ∈ a, ¬I < M' :=\n set_has_minimal_iff_artinian.mpr ‹_› a ha\n\n/-- A module is Artinian iff every decreasing chain of submodules stabilizes. -/\ntheorem monotone_stabilizes_iff_artinian :\n (∀ f : ℕ →o (Submodule R M)ᵒᵈ, ∃ n, ∀ m, n ≤ m → f n = f m) ↔ IsArtinian R M :=\n wellFoundedGT_iff_monotone_chain_condition.symm\n\nnamespace IsArtinian\n\nvariable [IsArtinian R M]\n\ntheorem monotone_stabilizes (f : ℕ →o (Submodule R M)ᵒᵈ) : ∃ n, ∀ m, n ≤ m → f n = f m :=\n monotone_stabilizes_iff_artinian.mpr ‹_› f\n\ntheorem eventuallyConst_of_isArtinian (f : ℕ →o (Submodule R M)ᵒᵈ) :\n atTop.EventuallyConst f := by\n simp_rw [eventuallyConst_atTop, eq_comm]\n exact monotone_stabilizes f\n\nopen Function\n\n/-- Any injective endomorphism of an Artinian module is surjective. -/\ntheorem surjective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Surjective f := by\n have h := ‹IsArtinian R M›; contrapose h\n rw [IsArtinian, WellFoundedLT, isWellFounded_iff]\n refine (RelEmbedding.natGT (LinearMap.range <| f ^ ·) ?_).not_wellFounded\n intro n\n simp_rw [pow_succ, Module.End.mul_eq_comp, LinearMap.range_comp, ← Submodule.map_top (f ^ n)]\n refine Submodule.map_strictMono_of_injective (Module.End.iterate_injective s n) (Ne.lt_top ?_)\n rwa [Ne, LinearMap.range_eq_top]\n\n/-- Any injective endomorphism of an Artinian module is bijective. -/\ntheorem bijective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Bijective f :=\n ⟨s, surjective_of_injective_endomorphism f s⟩\n\n/-- A sequence `f` of submodules of an Artinian module,\nwith the supremum `f (n+1)` and the infimum of `f 0`, ..., `f n` being ⊤,\nis eventually ⊤. -/\ntheorem disjoint_partial_infs_eventually_top (f : ℕ → Submodule R M)\n (h : ∀ n, Disjoint (partialSups (OrderDual.toDual ∘ f) n) (OrderDual.toDual (f (n + 1)))) :\n ∃ n : ℕ, ∀ m, n ≤ m → f m = ⊤ := by\n -- A little off-by-one cleanup first:\n rsuffices ⟨n, w⟩ : ∃ n : ℕ, ∀ m, n ≤ m → OrderDual.toDual f (m + 1) = ⊤\n · use n + 1\n rintro (_ | m) p\n · cases p\n · apply w\n exact Nat.succ_le_succ_iff.mp p\n obtain ⟨n, w⟩ := monotone_stabilizes (partialSups (OrderDual.toDual ∘ f))\n refine ⟨n, fun m p ↦ (h m).eq_bot_of_ge <| sup_eq_left.mp ?_⟩\n simpa only [partialSups_add_one] using! (w (m + 1) <| le_add_right p).symm.trans <| w m p\n\nend IsArtinian\n\nlemma IsArtinian.subsingleton_of_injective [IsArtinian R N] {f : P × N →ₗ[R] N}\n (inj : Function.Injective f) : Subsingleton P :=\n subsingleton_of_forall_eq 0 fun p ↦\n have ⟨_, eq⟩ := IsArtinian.surjective_of_injective_endomorphism (f ∘ₗ .inr ..)\n (inj.comp (Prod.mk_right_injective _)) (f (p, 0))\n congr($(inj eq).1).symm\n\nnamespace LinearMap\n\nvariable [IsArtinian R M]\n\nlemma eventually_iInf_range_pow_eq (f : Module.End R M) :\n ∀ᶠ n in atTop, ⨅ m, LinearMap.range (f ^ m) = LinearMap.range (f ^ n) := by\n obtain ⟨n, hn : ∀ m, n ≤ m → LinearMap.range (f ^ n) = LinearMap.range (f ^ m)⟩ :=\n IsArtinian.monotone_stabilizes f.iterateRange\n refine eventually_atTop.mpr ⟨n, fun l hl ↦ le_antisymm (iInf_le _ _) (le_iInf fun m ↦ ?_)⟩\n rcases le_or_gt l m with h | h\n · rw [← hn _ (hl.trans h), hn _ hl]\n · exact f.iterateRange.monotone h.le\n\nend LinearMap\n\nend Semiring\n\nsection Ring\n\nvariable {R M P N : Type*}\nvariable [Ring R] [AddCommGroup M] [AddCommGroup P] [AddCommGroup N]\nvariable [Module R M] [Module R P] [Module R N]\n\ninstance isArtinian_of_quotient_of_artinian\n (N : Submodule R M) [IsArtinian R M] : IsArtinian R (M ⧸ N) :=\n isArtinian_of_surjective M (Submodule.mkQ N) (Submodule.Quotient.mk_surjective N)\n\ntheorem isArtinian_of_range_eq_ker [IsArtinian R M] [IsArtinian R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P)\n (h : LinearMap.range f = LinearMap.ker g) : IsArtinian R N :=\n wellFounded_lt_exact_sequence (LinearMap.range f)\n (Submodule.map ((LinearMap.ker f).liftQ f le_rfl))\n (Submodule.comap ((LinearMap.ker f).liftQ f le_rfl))\n (Submodule.comap g.rangeRestrict) (Submodule.map g.rangeRestrict)\n (Submodule.gciMapComap <| LinearMap.ker_eq_bot.mp <| Submodule.ker_liftQ_eq_bot _ _ _ le_rfl)\n (Submodule.giMapComap g.surjective_rangeRestrict)\n (by simp [Submodule.map_comap_eq, inf_comm, Submodule.range_liftQ])\n (by simp [Submodule.comap_map_eq, h])\n\nTarget:\ntheorem isArtinian_iff_submodule_quotient (S : Submodule R P) :\n IsArtinian R P ↔ IsArtinian R S ∧ IsArtinian R (P ⧸ S) :=\n\nProof body:\n","rejected":"by\n exact isArtinian_iff_submodule_quotient","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"700ed072ad993e12544af2258154b4e41a3ce74af3ea85285ec2bfb532fb228f","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Artinian","family_id":"isartinian_iff_submodule_quotient","file_id":"mathlib/Mathlib/RingTheory/Artinian/Module.lean","sample_id":"f681ebeae95f04e21de4583a72badb0029b1f5b886262dbd3fe5ec3c4cf55ac5"},"split":"validation"} {"binding":{"chosen_proof_sha256":"bbb9a226483231d82067eec87f43e12d83aad6e5c91ff3e5b6a9caf4c654cffd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d26ad724f9e11749a5bb07e2e5a34d311b4f1a68df600a152a56dc18ee95067c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"071da6c001a660cdfd73e6b0d949c8634a046ae85daad91a8bddf2722505eed9","source_sha256":"37f17dacd5bcc157b99a90651c7281496dc8bcf5b9fd1ba77727f58502e618cc","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n convert! dif_pos hq\n simp [Algebra.algebra_ext_iff, Localization.AtPrime.IsLiesOverAlgebra.algebraMap_eq]","hard_negative":true,"metrics":{"chosen_tokens":19,"rejected_tokens":3,"token_jaccard":0.055556,"token_length_ratio":0.157895},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"bf961eecf799542548c8d37e75ed7532595e0a6a7b2871012da2b2431f2bde77","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.NumberTheory.RamificationInertia.Inertia\npublic import Mathlib.RingTheory.QuasiFinite.Basic\n\nNamespace:\nIdeal\n\nLocal context:\n/-\nCopyright (c) 2026 Thomas Browning. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Thomas Browning\n-/\n/-!\n# Inertia degree\n\nGiven a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\n## Main definitions\n\n* `Ideal.inertiaDeg' q R`: The inertia degree of `q` over `R`.\n\n## Main statements\n\n* `inertiaDeg_eq_inertiaDeg'`: The inertia degree agrees with the usual definition in the case of\n maximal ideals.\n* `inertiaDeg'_tower`: Inertia degree is multiplicative in towers.\n-/\n\n@[expose] public section\n\nnamespace Ideal\n\nsection\n\nvariable {S : Type*} [CommRing S] (q : Ideal S) (R : Type*) [CommRing R] [Algebra R S]\n\nopen Classical in\n/-- Given a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\nWhen `q` is not prime, we use a junk value of `0`.\n\nThis will eventually replace the existing definition of `Ideal.inertiaDeg`. -/\nnoncomputable def inertiaDeg' : ℕ :=\n if _ : q.IsPrime then\n letI := Localization.AtPrime.algebraOfLiesOver (q.under R) q\n Module.finrank (q.under R).ResidueField q.ResidueField else 0\n\nTarget:\ntheorem inertiaDeg'_def [hq : q.IsPrime]\n [Algebra (Localization.AtPrime (q.under R)) (Localization.AtPrime q)]\n [Localization.AtPrime.IsLiesOverAlgebra (q.under R) q] :\n q.inertiaDeg' R = Module.finrank (q.under R).ResidueField q.ResidueField :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_071da6c001a6","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"b6ad7eb49f544f7972e937c09dd4376644651e322ce3e6fda7bc3519606a9083","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/RamificationInertia","family_id":"inertiadeg'_def","file_id":"mathlib/Mathlib/RingTheory/RamificationInertia/Inertia.lean","sample_id":"071da6c001a660cdfd73e6b0d949c8634a046ae85daad91a8bddf2722505eed9"},"split":"validation"} {"binding":{"chosen_proof_sha256":"6ee7f737e8c2d4671ff94ca3332e31fcc1949203f2cecbaf3edb19973b3febab","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"b270ebede4fd06b991aefc41c5c732786abb20999f8d207c6cb7dd5cb33e7adb","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"c52c64e1c712585df638ea3219bbaa16560e618aef9929691fab84e789b3af69","source_sha256":"790acd992586304a23c30f7c64c4cbe1862b5710e414e5488a2b139adb1423f5","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨p, hp⟩ := Algebra.adjoin_eq_exists_aeval _ x a\n grind","hard_negative":true,"metrics":{"chosen_tokens":15,"rejected_tokens":5,"token_jaccard":0.111111,"token_length_ratio":0.333333},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"c3a7a5c0d0559d861425d08b2c0bbf6782aaac804b54da4fcbe2c233f3949b99","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Polynomial.AlgebraMap\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2018 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes, Johannes Hölzl, Kim Morrison, Jens Wagemaker\n-/\n/-!\n# Polynomials and adjoining roots\n\n## Main results\n\n* `Algebra.instCommSemiringAdjoinSingleton, Algebra.instCommRingAdjoinSingleton`:\n adjoining an element to a commutative (semi)ring gives a commutative (semi)ring\n* `Algebra.adjoin_singleton_induction`:\n proving a fact about `a : adjoin R {x}` is the same as proving it for `aeval x p` where `p`\n is an arbitrary polynomial\n-/\n\npublic section\n\nnoncomputable section\n\nopen Finset\n\nopen Polynomial\n\nnamespace Algebra\n\nuniverse u v w z\n\nvariable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {A' B : Type*} {a b : R} {n : ℕ}\n\nsection aeval\n\nopen Algebra\n\nvariable [CommSemiring R] [Semiring A] [CommSemiring A'] [Semiring B]\nvariable [Algebra R A] [Algebra R B]\nvariable {p q : R[X]} (x : A)\n\n@[simp]\ntheorem _root_.Polynomial.adjoin_X : adjoin R ({X} : Set R[X]) = ⊤ := by\n refine top_unique fun p _hp => ?_\n set S := adjoin R ({X} : Set R[X])\n rw [← sum_monomial_eq p]; simp only [← smul_X_eq_monomial]\n exact S.sum_mem fun n _hn => S.smul_mem (S.pow_mem (subset_adjoin rfl) _) _\n\nvariable (R)\ntheorem adjoin_singleton_eq_range_aeval (x : A) :\n adjoin R {x} = (aeval x).range := by\n rw [← Algebra.map_top, ← adjoin_X, AlgHom.map_adjoin, Set.image_singleton, aeval_X]\n\n@[simp]\ntheorem _root_.Polynomial.aeval_mem_adjoin_singleton : aeval x p ∈ adjoin R {x} := by\n simp [adjoin_singleton_eq_range_aeval]\n\ninstance {A B : Type*} [CommSemiring A] [Semiring B] [Algebra A B] (x : B) (p : Polynomial A) :\n CoeDep B (p.aeval x) (Algebra.adjoin A {x}) where\n coe := ⟨p.aeval x, aeval_mem_adjoin_singleton A x⟩\n\ntheorem adjoin_mem_exists_aeval {a : A} (h : a ∈ R[x]) :\n ∃ p : R[X], aeval x p = a := by\n rw [Algebra.adjoin_singleton_eq_range_aeval] at h\n simp_all\n\ntheorem adjoin_eq_exists_aeval (a : R[x]) :\n ∃ p : R[X], aeval x p = a := by\n have : (a : A) ∈ R[x] := by simp\n set y := (a : A) with h\n rw [Algebra.adjoin_singleton_eq_range_aeval] at this\n simp_all\n\n/--\nProving a fact about `a : adjoin R {x}` is the same as proving it for\n`aeval x p` where `p`is an arbitrary polynomial. -/\n@[elab_as_elim]\n\nTarget:\ntheorem adjoin_singleton_induction {M : (adjoin R {x}) → Prop}\n (a : adjoin R {x}) (f : ∀ (p : Polynomial R), M (aeval x p : adjoin R {x})) : M a :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_c52c64e1c712","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"5909705c9fbb5af47acdac243281e448a6c6ba4e47eaf1ccb253f07bf0242392","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Adjoin","family_id":"adjoin_singleton_induction","file_id":"mathlib/Mathlib/RingTheory/Adjoin/Polynomial/Basic.lean","sample_id":"c52c64e1c712585df638ea3219bbaa16560e618aef9929691fab84e789b3af69"},"split":"validation"} {"binding":{"chosen_proof_sha256":"9bea1cf4eff001878af62be358ec2f27ebbedc4cae0a0d9ef061143d0875c48a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"8b776eed7f1f66fd451682adffb6a409295439108d4a3638f05c6e6ab95e8223","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"e5f8124606bef5403b341ced7b032022bbb79f88908d3b7d373b847dc8564c6b","source_sha256":"2565cfa070809a58a73096b7d4b24bc9767260f50405d346f360e28141b33728","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]\n tauto","hard_negative":false,"metrics":{"chosen_tokens":15,"rejected_tokens":20,"token_jaccard":0.764706,"token_length_ratio":1.333333},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"c4286c4292b79c6208793cb42d475a32c4493ea0757ca7c482b9df06860acbbc","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Fintype.Powerset\npublic import Mathlib.Topology.Constructions\npublic import Mathlib.Topology.GDelta.Basic\npublic import Mathlib.Topology.Maps.OpenQuotient\npublic import Mathlib.Tactic.CrossRefAttribute\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2019 Sébastien Gouëzel. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Sébastien Gouëzel\n-/\n/-!\n# Baire spaces\n\nA topological space is called a *Baire space*\nif a countable intersection of dense open subsets is dense.\nBaire theorems say that all completely metrizable spaces\nand all locally compact regular spaces are Baire spaces.\nWe prove the theorems in `Mathlib/Topology/Baire/CompleteMetrizable`\nand `Mathlib/Topology/Baire/LocallyCompactRegular`.\n\nIn this file we prove some lemmas about Baire spaces.\n\nThe good concept underlying the theorems is that of a Gδ set, i.e., a countable intersection\nof open sets. Then Baire theorem can also be formulated as the fact that a countable\nintersection of dense Gδ sets is a dense Gδ set. We deduce this version from Baire property.\nWe also prove the important consequence that, if the space is\ncovered by a countable union of closed sets, then the union of their interiors is dense.\n\nWe also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set.\n-/\n\npublic section\n\n\nnoncomputable section\n\nopen scoped Topology\nopen Filter Set TopologicalSpace\n\nvariable {X α : Type*} {ι : Sort*}\n\nsection BaireTheorem\n\nvariable [TopologicalSpace X]\n\n/-- The intersection of finitely many open dense sets is dense. -/\ntheorem Set.Finite.dense_sInter {s : Set (Set X)} (hs : s.Finite)\n (ho : ∀ t ∈ s, IsOpen t) (hd : ∀ t ∈ s, Dense t) : Dense (⋂₀ s) := by\n induction s, hs using Set.Finite.induction_on with\n | empty => simp [sInter_empty]\n | insert ha hsf ih =>\n simp only [sInter_insert, forall_mem_insert] at hd ⊢\n refine hd.1.inter_of_isOpen_right ?_ (hsf.isOpen_sInter (fun y hy => ho y (Or.inr hy)))\n exact ih ((fun y hy => ho y (Or.inr hy))) (fun y hy => hd.2 y hy)\n\n/-- A finite set is Baire. -/\ntheorem baire_of_finite [Finite X] : BaireSpace X where\n baire_property f _ _ := sInter_range f ▸ (toFinite (range f)).dense_sInter (by grind) (by grind)\n\nvariable [BaireSpace X]\n\n/-- Definition of a Baire space. -/\ntheorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n))\n (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) :=\n BaireSpace.baire_property f ho hd\n\n/-- A dense Gδ subset of a Baire space is Baire. -/\ntheorem IsGδ.baireSpace_of_dense {s : Set X} (hG : IsGδ s) (hd : Dense s) : BaireSpace s := by\n constructor\n intro f hof hdf\n obtain ⟨V, hV⟩ : ∃ V : ℕ → Set X, (∀ n, IsOpen (V n)) ∧ s = ⋂ n, V n := eq_iInter_nat hG\n choose g hg1 hg2 hg3 using fun n => exists_open_dense_of_open_dense_subtype hd (hof n) (hdf n)\n have h_inter_dense : Dense (⋂ n, g n ∩ V n) := BaireSpace.baire_property (fun n ↦ g n ∩ V n)\n (fun n => (hg1 n).inter (hV.1 n))\n (fun n => (hg2 n).inter_of_isOpen_left (hd.mono (by simp [hV.2, iInter_subset])) (hg1 n))\n have h_inter_eq : ⋂ n, g n ∩ V n = ⋂ n, f n := by ext; simp_all; grind\n exact Subtype.dense_iff.mpr fun a _ ↦ h_inter_eq ▸ h_inter_dense a\n\n/-- If `p : Y → X` is an open embedding and `X` is a Baire space, then `Y` is a Baire space. -/\ntheorem Topology.IsOpenEmbedding.baireSpace {Y : Type*} [TopologicalSpace Y] {p : Y → X}\n (hp : Topology.IsOpenEmbedding p) : BaireSpace Y := by\n constructor\n intro f hof hdf\n let s := range p\n let c := fun n : ℕ => p '' f n ∪ (closure s)ᶜ\n have c_open (n : ℕ) : IsOpen (c n) := IsOpen.union (hp.isOpenMap (f n) (hof n))\n isClosed_closure.isOpen_compl\n have c_dense (n : ℕ) : Dense (c n) := by\n rw [dense_iff_closure_eq, subset_antisymm_iff]\n have : univ ⊆ closure (c n) := calc\n _ ⊆ (interior (closure s)) ∪ (interior (closure s))ᶜ := by grind\n _ ⊆ closure s ∪ (interior (closure s))ᶜ := by gcongr; exact interior_subset\n _ ⊆ closure (p '' f n) ∪ (interior (closure s))ᶜ := union_subset_union\n (closure_minimal (hp.continuous.range_subset_closure_image_dense (hdf n))\n isClosed_closure) (subset_refl (interior (closure s))ᶜ)\n _ ⊆ closure (p '' f n) ∪ closure ((closure s)ᶜ) := union_subset_union (by simp) (by simp)\n _ = closure (c n) := closure_union.symm\n grind\n have c_inter_dense : Dense (⋂ n, c n) := dense_iInter_of_isOpen_nat c_open c_dense\n have c_inter_eq : ⋂ n, f n = p ⁻¹' (⋂ n, c n) := by\n ext x\n simp only [mem_iInter, mem_preimage, mem_union, mem_compl_iff, c]\n refine ⟨fun h i => by grind, fun h i => ?_⟩\n exact hp.injective.mem_set_image.mp (imp_iff_or_not.mpr (h i)\n (subset_closure (mem_range_self x)))\n exact c_inter_eq ▸ Dense.preimage c_inter_dense hp.isOpenMap\n\n/-- An open subset of a Baire space is Baire. -/\ntheorem IsOpen.baireSpace {s : Set X} (hO : IsOpen s) : BaireSpace s :=\n hO.isOpenEmbedding_subtypeVal.baireSpace\n\n/-- If `f` is an open quotient map and `X` is Baire, then `Y` is Baire. -/\ntheorem IsOpenQuotientMap.baireSpace {Y : Type*} [TopologicalSpace Y] {f : X → Y}\n (hf : IsOpenQuotientMap f) : BaireSpace Y := by\n constructor\n intro u hou hdu\n have := dense_iInter_of_isOpen_nat (fun n => hf.continuous.isOpen_preimage (u n) (hou n))\n (fun n => (IsOpenQuotientMap.dense_preimage_iff hf).mpr (hdu n))\n simp_all [← preimage_iInter, IsOpenQuotientMap.dense_preimage_iff]\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/\ntheorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)\n (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by\n rcases S.eq_empty_or_nonempty with h | h\n · simp [h]\n · rcases hS.exists_eq_range h with ⟨f, rfl⟩\n exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd)\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable set in any type. -/\ntheorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s))\n (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by\n rw [← sInter_image]\n refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable type. -/\n@[wikidata Q1052678]\ntheorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i))\n (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) :=\n dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd)\n\n/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/\ntheorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by\n constructor\n · rw [mem_residual_iff]\n rintro ⟨S, hSo, hSd, Sct, Ss⟩\n refine ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, ?_⟩\n exact dense_sInter_of_isOpen hSo Sct hSd\n rintro ⟨t, ts, ho, hd⟩\n exact mem_of_superset (residual_of_dense_Gδ ho hd) ts\n\n/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/\n\nTarget:\ntheorem eventually_residual {p : X → Prop} :\n (∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=\n\nProof body:\n","rejected":"by\n simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]\n tauto\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Baire","family_id":"eventually_residual","file_id":"mathlib/Mathlib/Topology/Baire/Lemmas.lean","sample_id":"e5f8124606bef5403b341ced7b032022bbb79f88908d3b7d373b847dc8564c6b"},"split":"validation"} {"binding":{"chosen_proof_sha256":"96d926c0b11cee78eb87e06307d4e766a9d61eb46c5c0169a1f563540c85f0bf","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"839750e565861765a713683645adcc2bb7d6f7a1925780dff05cb6b274efb480","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ce15a4338d0332eed734e41e9bcacaff09b24a76f31b01c98ebde55874522ad0","source_sha256":"61c6b8c956c45819c5a62aa885cad329c13f10279b91e08994009dca1da68c85","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by simpa using (Quotient.eq' p : mk x = 0 ↔ _)","hard_negative":true,"metrics":{"chosen_tokens":16,"rejected_tokens":5,"token_jaccard":0.105263,"token_length_ratio":0.3125},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"c436b70ecd44c46275221dec4f0bdf3506af13bc766ecda90aa8b41a28c6a8ba","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.Equiv.Defs\npublic import Mathlib.Algebra.Module.Submodule.Defs\npublic import Mathlib.GroupTheory.QuotientGroup.Defs\npublic import Mathlib.Logic.Small.Basic\n\nNamespace:\nSubmodule.Quotient\n\nLocal context:\n/-\nCopyright (c) 2017 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Mario Carneiro, Kevin Buzzard, Yury Kudryashov\n-/\n/-!\n# Quotients by submodules\n\n* If `p` is a submodule of `M`, `M ⧸ p` is the quotient of `M` with respect to `p`:\n that is, elements of `M` are identified if their difference is in `p`. This is itself a module.\n\n## Main definitions\n\n* `Submodule.Quotient.mk`: a function sending an element of `M` to `M ⧸ p`\n* `Submodule.Quotient.module`: `M ⧸ p` is a module\n* `Submodule.Quotient.mkQ`: a linear map sending an element of `M` to `M ⧸ p`\n* `Submodule.quotEquivOfEq`: if `p` and `p'` are equal, their quotients are equivalent\n\n-/\n\n@[expose] public section\n\n-- For most of this file we work over a noncommutative ring\nsection Ring\n\nnamespace Submodule\n\nvariable {R M : Type*} {r : R} {x y : M} [Ring R] [AddCommGroup M] [Module R M]\nvariable (p p' : Submodule R M)\n\nopen QuotientAddGroup\n\n/-- The equivalence relation associated to a submodule `p`, defined by `x ≈ y` iff `-x + y ∈ p`.\n\nNote this is equivalent to `y - x ∈ p`, but defined this way to be defeq to the `AddSubgroup`\nversion, where commutativity can't be assumed. -/\ndef quotientRel : Setoid M :=\n QuotientAddGroup.leftRel p.toAddSubgroup\n\ntheorem quotientRel_def {x y : M} : p.quotientRel x y ↔ x - y ∈ p :=\n Iff.trans\n (by\n rw [quotientRel, leftRel_apply, sub_eq_add_neg, neg_add, neg_neg]\n rfl)\n neg_mem_iff\n\n/-- The quotient of a module `M` by a submodule `p ⊆ M`. -/\ninstance hasQuotient : HasQuotient M (Submodule R M) :=\n ⟨fun p => Quotient (quotientRel p)⟩\n\nnamespace Quotient\n/-- Map associating to an element of `M` the corresponding element of `M/p`,\nwhen `p` is a submodule of `M`. -/\ndef mk {p : Submodule R M} : M → M ⧸ p :=\n Quotient.mk''\n\ntheorem mk'_eq_mk' {p : Submodule R M} (x : M) :\n @Quotient.mk' _ (quotientRel p) x = mk x :=\n rfl\n\ntheorem mk''_eq_mk {p : Submodule R M} (x : M) : (Quotient.mk'' x : M ⧸ p) = mk x :=\n rfl\n\ntheorem quot_mk_eq_mk {p : Submodule R M} (x : M) : (Quot.mk _ x : M ⧸ p) = mk x :=\n rfl\n\ntheorem quotientAddGroupMk_eq_mk {p : Submodule R M} (x : M) :\n (QuotientAddGroup.mk x : M ⧸ p) = mk x :=\n rfl\n\nprotected theorem eq' {x y : M} : (mk x : M ⧸ p) = mk y ↔ -x + y ∈ p :=\n QuotientAddGroup.eq\n\nprotected theorem eq {x y : M} : (mk x : M ⧸ p) = mk y ↔ x - y ∈ p :=\n (Submodule.Quotient.eq' p).trans (leftRel_apply.symm.trans p.quotientRel_def)\n\ninstance : Zero (M ⧸ p) where\n -- Use Quotient.mk'' instead of mk here because mk is not reducible.\n -- This would lead to non-defeq diamonds.\n -- See also the same comment at the One instance for Con.\n zero := Quotient.mk'' 0\n\ninstance : Inhabited (M ⧸ p) :=\n ⟨0⟩\n\n@[simp]\ntheorem mk_zero : mk 0 = (0 : M ⧸ p) :=\n rfl\n\n@[simp]\n\nTarget:\ntheorem mk_eq_zero : (mk x : M ⧸ p) = 0 ↔ x ∈ p :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_ce15a4338d03","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"de4154c08ac8c74bff7edc12335d6a03e1b0cce19776b988a04c7f823b032e26","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Quotient","family_id":"mk_eq_zero","file_id":"mathlib/Mathlib/LinearAlgebra/Quotient/Defs.lean","sample_id":"ce15a4338d0332eed734e41e9bcacaff09b24a76f31b01c98ebde55874522ad0"},"split":"validation"} {"binding":{"chosen_proof_sha256":"6f2e2bdde9df65f7fae68f371268a13bea710dc9d3decb2f9cefb19f98606b56","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ca54e7316b6c0004a5665e1a2e5c8b8a7d3c31345e51a12dddf12e28aa2b50d2","source_sha256":"83e2601cf6c07c32f34aa34172516324d335356d2cf96b31eaf33c25cc9353c7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n constructor <;> intro H\n · exact ⟨H.continuous, fun Z ↦ H.universally_closed _⟩\n · rw [isProperMap_iff_isClosedMap_ultrafilter]\n exact ⟨H.1, H.2 _⟩","hard_negative":true,"metrics":{"chosen_tokens":38,"rejected_tokens":8,"token_jaccard":0.032258,"token_length_ratio":0.210526},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"c44065ba5dbc259f0bde628f121ae1be363205c9ad80f90cfc6f348ba61f45af","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Compactification.StoneCech\npublic import Mathlib.Topology.Filter\npublic import Mathlib.Topology.Maps.Proper.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2023 Anatole Dedecker. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Anatole Dedecker, Etienne Marion\n-/\n/-!\n# A map is proper iff it is continuous and universally closed\n-/\n\npublic section\n\nopen Filter\n\nuniverse u v\n\n/-- A map `f : X → Y` is proper if and only if it is continuous and the map\n`(Prod.map f id : X × Filter X → Y × Filter X)` is closed. This is stronger than\n`isProperMap_iff_universally_closed` since it shows that there's only one space to check to get\nproperness, but in most cases it doesn't matter. -/\ntheorem isProperMap_iff_isClosedMap_filter {X : Type u} {Y : Type v} [TopologicalSpace X]\n [TopologicalSpace Y] {f : X → Y} :\n IsProperMap f ↔ Continuous f ∧ IsClosedMap\n (Prod.map f id : X × Filter X → Y × Filter X) := by\n constructor <;> intro H\n -- The direct implication is clear.\n · exact ⟨H.continuous, H.universally_closed _⟩\n · rw [isProperMap_iff_ultrafilter]\n -- Let `𝒰 : Ultrafilter X`, and assume that `f` tends to some `y` along `𝒰`.\n refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩\n -- In `X × Filter X`, consider the closed set `F := closure {(x, ℱ) | ℱ = pure x}`\n let F : Set (X × Filter X) := closure {xℱ | xℱ.2 = pure xℱ.1}\n -- Since `f × id` is closed, the set `(f × id) '' F` is also closed.\n have := H.2 F isClosed_closure\n -- Let us show that `(y, 𝒰) ∈ (f × id) '' F`.\n have : (y, ↑𝒰) ∈ Prod.map f id '' F :=\n -- Note that, by the properties of the topology on `Filter X`, the function `pure : X → Filter X`\n -- tends to the point `𝒰` of `Filter X` along the filter `𝒰` on `X`. Since `f` tends to `y` along\n -- `𝒰`, we get that the function `(f, pure) : X → (Y, Filter X)` tends to `(y, 𝒰)` along\n -- `𝒰`. Furthermore, each `(f, pure)(x) = (f × id)(x, pure x)` is clearly an element of\n -- the closed set `(f × id) '' F`, thus the limit `(y, 𝒰)` also belongs to that set.\n this.mem_of_tendsto (hy.prodMk_nhds (Filter.tendsto_pure_self (𝒰 : Filter X)))\n (Eventually.of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩)\n -- The above shows that `(y, 𝒰) = (f x, 𝒰)`, for some `x : X` such that `(x, 𝒰) ∈ F`.\n rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩\n -- We already know that `f x = y`, so to finish the proof we just have to check that `𝒰` tends\n -- to `x`. So, for `U ∈ 𝓝 x` arbitrary, let's show that `U ∈ 𝒰`. Since `𝒰` is an ultrafilter,\n -- it is enough to show that `Uᶜ` is not in `𝒰`.\n refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_notMem_iff.mp fun hUc ↦ ?_⟩\n rw [mem_closure_iff_nhds] at hx\n -- Indeed, if that was the case, the set `V := {𝒢 : Filter X | Uᶜ ∈ 𝒢}` would be a neighborhood\n -- of `𝒰` in `Filter X`, hence `U ×ˢ V` would be a neighborhood of `(x, 𝒰) : X × Filter X`.\n -- But recall that `(x, 𝒰) ∈ F = closure {(x, ℱ) | ℱ = pure x}`, so the neighborhood `U ×ˢ V`\n -- must contain some element of the form `(z, pure z)`. In other words, we have `z ∈ U` and\n -- `Uᶜ ∈ pure z`, which means `z ∈ Uᶜ` by the definition of pure.\n -- This is a contradiction, which completes the proof.\n rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU (isOpen_setOf_mem.mem_nhds hUc)) with\n ⟨⟨z, 𝒢⟩, ⟨⟨hz : z ∈ U, hz' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure z⟩⟩\n exact hz' hz\n\n/-- A map `f : X → Y` is proper if and only if it is continuous and the map\n`(Prod.map f id : X × Ultrafilter X → Y × Ultrafilter X)` is closed. This is stronger than\n`isProperMap_iff_universally_closed` since it shows that there's only one space to check to get\nproperness, but in most cases it doesn't matter. -/\ntheorem isProperMap_iff_isClosedMap_ultrafilter {X : Type u} {Y : Type v} [TopologicalSpace X]\n [TopologicalSpace Y] {f : X → Y} :\n IsProperMap f ↔ Continuous f ∧ IsClosedMap\n (Prod.map f id : X × Ultrafilter X → Y × Ultrafilter X) := by\n -- The proof is basically the same as above.\n constructor <;> intro H\n · exact ⟨H.continuous, H.universally_closed _⟩\n · rw [isProperMap_iff_ultrafilter]\n refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩\n let F : Set (X × Ultrafilter X) := closure {xℱ | xℱ.2 = pure xℱ.1}\n have := H.2 F isClosed_closure\n have : (y, 𝒰) ∈ Prod.map f id '' F :=\n this.mem_of_tendsto (hy.prodMk_nhds (Ultrafilter.tendsto_pure_self 𝒰))\n (Eventually.of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩)\n rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩\n refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_notMem_iff.mp fun hUc ↦ ?_⟩\n rw [mem_closure_iff_nhds] at hx\n rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU ((ultrafilter_isOpen_basic _).mem_nhds hUc))\n with ⟨⟨y, 𝒢⟩, ⟨⟨hy : y ∈ U, hy' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure y⟩⟩\n exact hy' hy\n\n/-- A map `f : X → Y` is proper if and only if it is continuous and **universally closed**, in the\nsense that for any topological space `Z`, the map `Prod.map f id : X × Z → Y × Z` is closed. Note\nthat `Z` lives in the same universe as `X` here, but `IsProperMap.universally_closed` does not\nhave this restriction.\n\nThis is taken as the definition of properness in\n[N. Bourbaki, *General Topology*][bourbaki1966]. -/\n\nTarget:\ntheorem isProperMap_iff_universally_closed {X : Type u} {Y : Type v} [TopologicalSpace X]\n [TopologicalSpace Y] {f : X → Y} :\n IsProperMap f ↔ Continuous f ∧ ∀ (Z : Type u) [TopologicalSpace Z],\n IsClosedMap (Prod.map f id : X × Z → Y × Z) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"587d93f5c7836cc9fee5a5ec771d03d20924f27e4a39a552ed1905b871bff832","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Maps","family_id":"ispropermap_iff_universally_closed","file_id":"mathlib/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean","sample_id":"ca54e7316b6c0004a5665e1a2e5c8b8a7d3c31345e51a12dddf12e28aa2b50d2"},"split":"validation"} {"binding":{"chosen_proof_sha256":"845472be762363f8188a78d60f0ef615671098268d2ad9069b2712b4f3303d4a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"1daec5c82b9b2ac077e22585fa5708098ec30535974790183ed5d48a9bcf5e66","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"9b6478b4919383ee6445b9686b547108af18f08223f8c2558e2e146246f56c84","source_sha256":"3ae5f7aeff9efeae8bf5ccb60171899d1b7a3a6014b3b22c1122b0a75f50ca6c","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simpa only [← preimage_smul_inv] using! h_qmp.ae_eq h_ae_eq","hard_negative":false,"metrics":{"chosen_tokens":13,"rejected_tokens":17,"token_jaccard":0.8125,"token_length_ratio":1.307692},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"c764aee7c47341fdf4d6ada27d77e1a2deae9b0d29539318b2a89a99ae8d1b0f","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.MeasureTheory.Measure.AbsolutelyContinuous\npublic import Mathlib.MeasureTheory.OuterMeasure.BorelCantelli\n\nNamespace:\nMeasureTheory.Measure.QuasiMeasurePreserving\n\nLocal context:\n/-\nCopyright (c) 2017 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Mario Carneiro\n-/\n/-!\n# Quasi-Measure-Preserving Functions\n\nA map `f : α → β` is said to be *quasi-measure-preserving* (a.k.a. non-singular) w.r.t. measures\n`μa` and `μb` if it is measurable and `μb s = 0` implies `μa (f ⁻¹' s) = 0`.\nThat last condition can also be written `μa.map f ≪ μb` (the map of `μa` by `f` is\nabsolutely continuous with respect to `μb`).\n\n## Main definitions\n\n* `MeasureTheory.Measure.QuasiMeasurePreserving f μa μb`: `f` is quasi-measure-preserving with\n respect to `μa` and `μb`.\n\n-/\n\npublic section\n\nvariable {α β γ δ : Type*}\n\nnamespace MeasureTheory\n\nopen Set Function ENNReal\nopen Filter hiding map\n\nvariable {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}\n {μ ν : Measure α} {s : Set α}\n\nnamespace Measure\n\n/-- A map `f : α → β` is said to be *quasi-measure-preserving* (a.k.a. non-singular) w.r.t. measures\n`μa` and `μb` if it is measurable and `μb s = 0` implies `μa (f ⁻¹' s) = 0`. -/\n@[fun_prop]\nstructure QuasiMeasurePreserving {m0 : MeasurableSpace α} (f : α → β)\n (μa : Measure α := by volume_tac)\n (μb : Measure β := by volume_tac) : Prop where\n protected measurable : Measurable f\n protected absolutelyContinuous : μa.map f ≪ μb\n\nattribute [fun_prop] QuasiMeasurePreserving.measurable\n\nnamespace QuasiMeasurePreserving\n\n@[fun_prop]\nprotected theorem id {_m0 : MeasurableSpace α} (μ : Measure α) : QuasiMeasurePreserving id μ μ :=\n ⟨measurable_id, map_id.absolutelyContinuous⟩\n\nvariable {μa μa' : Measure α} {μb μb' : Measure β} {μc : Measure γ} {f : α → β}\n\nprotected theorem _root_.Measurable.quasiMeasurePreserving\n {_m0 : MeasurableSpace α} (hf : Measurable f) (μ : Measure α) :\n QuasiMeasurePreserving f μ (μ.map f) :=\n ⟨hf, AbsolutelyContinuous.rfl⟩\n\ntheorem mono_left (h : QuasiMeasurePreserving f μa μb) (ha : μa' ≪ μa) :\n QuasiMeasurePreserving f μa' μb :=\n ⟨h.1, (ha.map h.1).trans h.2⟩\n\ntheorem mono_right (h : QuasiMeasurePreserving f μa μb) (ha : μb ≪ μb') :\n QuasiMeasurePreserving f μa μb' :=\n ⟨h.1, h.2.trans ha⟩\n\n@[gcongr, mono]\ntheorem mono (ha : μa' ≪ μa) (hb : μb ≪ μb') (h : QuasiMeasurePreserving f μa μb) :\n QuasiMeasurePreserving f μa' μb' :=\n (h.mono_left ha).mono_right hb\n\n@[fun_prop]\nprotected theorem comp {g : β → γ} {f : α → β} (hg : QuasiMeasurePreserving g μb μc)\n (hf : QuasiMeasurePreserving f μa μb) : QuasiMeasurePreserving (g ∘ f) μa μc :=\n ⟨hg.measurable.comp hf.measurable, by\n rw [← map_map hg.1 hf.1]\n exact (hf.2.map hg.1).trans hg.2⟩\n\nprotected theorem iterate {f : α → α} (hf : QuasiMeasurePreserving f μa μa) :\n ∀ n, QuasiMeasurePreserving f^[n] μa μa\n | 0 => QuasiMeasurePreserving.id μa\n | n + 1 => (hf.iterate n).comp hf\n\nprotected theorem aemeasurable (hf : QuasiMeasurePreserving f μa μb) : AEMeasurable f μa :=\n hf.1.aemeasurable\n\nprotected theorem congr (hf : QuasiMeasurePreserving f μa μb) {f' : α → β} (hf' : Measurable f')\n (h : f =ᵐ[μa] f') : QuasiMeasurePreserving f' μa μb := by\n refine ⟨hf', ?_⟩\n rw [Measure.map_congr h.symm]\n exact hf.absolutelyContinuous\n\ntheorem smul_measure {R : Type*} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]\n (hf : QuasiMeasurePreserving f μa μb) (c : R) : QuasiMeasurePreserving f (c • μa) (c • μb) :=\n ⟨hf.1, by rw [Measure.map_smul]; exact hf.2.smul c⟩\n\ntheorem ae_map_le (h : QuasiMeasurePreserving f μa μb) : ae (μa.map f) ≤ ae μb :=\n h.2.ae_le\n\ntheorem tendsto_ae (h : QuasiMeasurePreserving f μa μb) : Tendsto f (ae μa) (ae μb) :=\n (tendsto_ae_map h.aemeasurable).mono_right h.ae_map_le\n\ntheorem ae (h : QuasiMeasurePreserving f μa μb) {p : β → Prop} (hg : ∀ᵐ x ∂μb, p x) :\n ∀ᵐ x ∂μa, p (f x) :=\n h.tendsto_ae hg\n\n@[gcongr]\ntheorem ae_eq (h : QuasiMeasurePreserving f μa μb) {g₁ g₂ : β → δ} (hg : g₁ =ᵐ[μb] g₂) :\n g₁ ∘ f =ᵐ[μa] g₂ ∘ f :=\n h.ae hg\n\ntheorem preimage_null (h : QuasiMeasurePreserving f μa μb) {s : Set β} (hs : μb s = 0) :\n μa (f ⁻¹' s) = 0 :=\n preimage_null_of_map_null h.aemeasurable (h.2 hs)\n\ntheorem preimage_mono_ae {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s ≤ᵐ[μb] t) :\n f ⁻¹' s ≤ᵐ[μa] f ⁻¹' t :=\n eventually_map.mp <|\n Eventually.filter_mono (tendsto_ae_map hf.aemeasurable) (Eventually.filter_mono hf.ae_map_le h)\n\ntheorem preimage_ae_eq {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s =ᵐ[μb] t) :\n f ⁻¹' s =ᵐ[μa] f ⁻¹' t :=\n EventuallyLE.antisymm (hf.preimage_mono_ae h.le) (hf.preimage_mono_ae h.symm.le)\n\n/-- The preimage of a null measurable set under a (quasi-)measure-preserving map is a null\nmeasurable set. -/\ntheorem _root_.MeasureTheory.NullMeasurableSet.preimage {s : Set β} (hs : NullMeasurableSet s μb)\n (hf : QuasiMeasurePreserving f μa μb) : NullMeasurableSet (f ⁻¹' s) μa :=\n let ⟨t, htm, hst⟩ := hs\n ⟨f ⁻¹' t, hf.measurable htm, hf.preimage_ae_eq hst⟩\n\ntheorem preimage_iterate_ae_eq {s : Set α} {f : α → α} (hf : QuasiMeasurePreserving f μ μ) (k : ℕ)\n (hs : f ⁻¹' s =ᵐ[μ] s) : f^[k] ⁻¹' s =ᵐ[μ] s := by\n induction k with\n | zero => rfl\n | succ k ih =>\n rw [iterate_succ, preimage_comp]\n exact EventuallyEq.trans (hf.preimage_ae_eq ih) hs\n\ntheorem image_zpow_ae_eq {s : Set α} {e : α ≃ α} (he : QuasiMeasurePreserving e μ μ)\n (he' : QuasiMeasurePreserving e.symm μ μ) (k : ℤ) (hs : e '' s =ᵐ[μ] s) :\n (⇑(e ^ k)) '' s =ᵐ[μ] s := by\n rw [Equiv.image_eq_preimage_symm]\n obtain ⟨k, rfl | rfl⟩ := k.eq_nat_or_neg\n · replace hs : (⇑e⁻¹) ⁻¹' s =ᵐ[μ] s := by rwa [Equiv.image_eq_preimage_symm] at hs\n replace he' : (⇑e⁻¹)^[k] ⁻¹' s =ᵐ[μ] s := he'.preimage_iterate_ae_eq k hs\n rwa [Equiv.Perm.iterate_eq_pow e⁻¹ k, inv_pow e k] at he'\n · rw [zpow_neg, zpow_natCast]\n replace hs : e ⁻¹' s =ᵐ[μ] s := by\n convert! he.preimage_ae_eq hs.symm\n rw [Equiv.preimage_image]\n replace he : (⇑e)^[k] ⁻¹' s =ᵐ[μ] s := he.preimage_iterate_ae_eq k hs\n rwa [Equiv.Perm.iterate_eq_pow e k] at he\n\n-- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941\ntheorem limsup_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ)\n (hs : f ⁻¹' s =ᵐ[μ] s) : limsup (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s :=\n limsup_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by\n simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs\n\n-- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941\ntheorem liminf_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ)\n (hs : f ⁻¹' s =ᵐ[μ] s) : liminf (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s :=\n liminf_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by\n simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs\n\n/-- For a quasi-measure-preserving self-map `f`, if a null measurable set `s` is a.e. invariant,\nthen it is a.e. equal to a measurable invariant set.\n-/\ntheorem exists_preimage_eq_of_preimage_ae {f : α → α} (h : QuasiMeasurePreserving f μ μ)\n (hs : NullMeasurableSet s μ) (hs' : f ⁻¹' s =ᵐ[μ] s) :\n ∃ t : Set α, MeasurableSet t ∧ t =ᵐ[μ] s ∧ f ⁻¹' t = t := by\n obtain ⟨t, htm, ht⟩ := hs\n refine ⟨limsup (f^[·] ⁻¹' t) atTop, ?_, ?_, ?_⟩\n · exact .measurableSet_limsup fun n ↦ h.measurable.iterate n htm\n · have : f ⁻¹' t =ᵐ[μ] t := (h.preimage_ae_eq ht.symm).trans (hs'.trans ht)\n exact limsup_ae_eq_of_forall_ae_eq _ fun n ↦ .trans (h.preimage_iterate_ae_eq _ this) ht.symm\n · simp only [Set.preimage_iterate_eq]\n exact CompleteLatticeHom.apply_limsup_iterate (CompleteLatticeHom.setPreimage f) t\n\nopen scoped Pointwise\n\n@[to_additive]\n\nTarget:\ntheorem smul_ae_eq_of_ae_eq {G α : Type*} [Group G] [MulAction G α] {_ : MeasurableSpace α}\n {s t : Set α} {μ : Measure α} (g : G)\n (h_qmp : QuasiMeasurePreserving (g⁻¹ • · : α → α) μ μ)\n (h_ae_eq : s =ᵐ[μ] t) : (g • s : Set α) =ᵐ[μ] (g • t : Set α) :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n simpa only [← preimage_smul_inv] using! h_qmp.ae_eq h_ae_eq","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"MeasureTheory/Measure","family_id":"smul_ae_eq_of_ae_eq","file_id":"mathlib/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean","sample_id":"9b6478b4919383ee6445b9686b547108af18f08223f8c2558e2e146246f56c84"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1a230b9602a6125d0fa7430a4612f1c8aad565aed5808bbe2d3a11ec566dd25a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"00a02bddf3a5d934532b0f2822ba59542bf0ae28af1479b5acc90c557fd9c040","source_sha256":"426555287cadea427db46f434f2427413a3069f543392fbabfda474ad97429a1","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by ext; simp [h.symm]","hard_negative":true,"metrics":{"chosen_tokens":9,"rejected_tokens":8,"token_jaccard":0.066667,"token_length_ratio":0.888889},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"c7a427f65bbf0142621d4716d748aec0f53e455a55f21018322cfd3df745f023","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Module.Equiv.Defs\npublic import Mathlib.Algebra.Module.LinearMap.End\npublic import Mathlib.Algebra.Module.Pi\npublic import Mathlib.Data.Finsupp.SMul\n\nNamespace:\nFinsupp\n\nLocal context:\n/-\nCopyright (c) 2019 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl\n-/\n/-!\n# Properties of the module `α →₀ M`\n\nGiven an `R`-module `M`, the `R`-module structure on `α →₀ M` is defined in\n`Mathlib/Data/Finsupp/SMul.lean`.\n\nIn this file we define `LinearMap` versions of various maps:\n\n* `Finsupp.lsingle a : M →ₗ[R] ι →₀ M`: `Finsupp.single a` as a linear map;\n* `Finsupp.lapply a : (ι →₀ M) →ₗ[R] M`: the map `fun f ↦ f a` as a linear map;\n* `Finsupp.lsubtypeDomain (s : Set α) : (α →₀ M) →ₗ[R] (s →₀ M)`: restriction to a subtype as a\n linear map;\n* `Finsupp.restrictDom`: `Finsupp.filter` as a linear map to `Finsupp.supported s`;\n* `Finsupp.lmapDomain`: a linear map version of `Finsupp.mapDomain`;\n\n## Tags\n\nfunction with finite support, module, linear algebra\n-/\n\n@[expose] public section\n\nassert_not_exists Submodule\n\nnoncomputable section\n\nopen Set LinearMap\n\nnamespace Finsupp\n\nvariable {α : Type*} {M : Type*} {N : Type*} {P : Type*} {R R₂ R₃ : Type*} {S : Type*}\nvariable [Semiring R] [Semiring R₂] [Semiring R₃] [Semiring S]\nvariable [AddCommMonoid M] [Module R M]\nvariable [AddCommMonoid N] [Module R₂ N]\nvariable [AddCommMonoid P] [Module R₃ P]\nvariable {σ₁₂ : R →+* R₂} {σ₂₁ : R₂ →+* R}\nvariable {σ₂₃ : R₂ →+* R₃} {σ₃₂ : R₃ →+* R₂}\nvariable {σ₁₃ : R →+* R₃} {σ₃₁ : R₃ →+* R}\nvariable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] [RingHomCompTriple σ₃₂ σ₂₁ σ₃₁]\n\nsection LinearEquivFunOnFinite\n\nvariable (R : Type*) {S : Type*} (M : Type*) (α : Type*)\nvariable [Finite α] [AddCommMonoid M] [Semiring R] [Module R M]\n\n/-- Given `Finite α`, `linearEquivFunOnFinite R` is the natural `R`-linear equivalence between\n`α →₀ β` and `α → β`. -/\n@[simps apply]\nnoncomputable def linearEquivFunOnFinite : (α →₀ M) ≃ₗ[R] α → M :=\n { equivFunOnFinite with\n toFun := (⇑)\n map_add' := fun _ _ => rfl\n map_smul' := fun _ _ => rfl }\n\n@[simp]\ntheorem linearEquivFunOnFinite_single [DecidableEq α] (x : α) (m : M) :\n (linearEquivFunOnFinite R M α) (single x m) = Pi.single x m :=\n equivFunOnFinite_single x m\n\n@[simp]\ntheorem linearEquivFunOnFinite_symm_single [DecidableEq α] (x : α) (m : M) :\n (linearEquivFunOnFinite R M α).symm (Pi.single x m) = single x m :=\n equivFunOnFinite_symm_single x m\n\n@[simp]\ntheorem linearEquivFunOnFinite_symm_coe (f : α →₀ M) : (linearEquivFunOnFinite R M α).symm f = f :=\n (linearEquivFunOnFinite R M α).symm_apply_apply f\n\n@[simp]\ntheorem linearEquivFunOnFinite_symm_apply (f : α → M) : (linearEquivFunOnFinite R M α).symm f = f :=\n rfl\n\nend LinearEquivFunOnFinite\n\n/-- Interpret `Finsupp.single a` as a linear map. -/\ndef lsingle (a : α) : M →ₗ[R] α →₀ M :=\n { Finsupp.singleAddHom a with map_smul' := fun _ _ => (smul_single _ _ _).symm }\n\n/-- Two `R`-linear maps from `Finsupp X M` which agree on each `single x y` agree everywhere. -/\ntheorem lhom_ext ⦃φ ψ : (α →₀ M) →ₛₗ[σ₁₂] N⦄ (h : ∀ a b, φ (single a b) = ψ (single a b)) : φ = ψ :=\n LinearMap.toAddMonoidHom_injective <| addHom_ext h\n\n/-- Two `R`-linear maps from `Finsupp X M` which agree on each `single x y` agree everywhere.\n\nWe formulate this fact using equality of linear maps `φ.comp (lsingle a)` and `ψ.comp (lsingle a)`\nso that the `ext` tactic can apply a type-specific extensionality lemma to prove equality of these\nmaps. E.g., if `M = R`, then it suffices to verify `φ (single a 1) = ψ (single a 1)`. -/\n-- The priority should be higher than `LinearMap.ext`.\n@[ext high]\ntheorem lhom_ext' ⦃φ ψ : (α →₀ M) →ₛₗ[σ₁₂] N⦄ (h : ∀ a, φ.comp (lsingle a) = ψ.comp (lsingle a)) :\n φ = ψ :=\n lhom_ext fun a => LinearMap.congr_fun (h a)\n\n/-- Interpret `fun f : α →₀ M ↦ f a` as a linear map. -/\ndef lapply (a : α) : (α →₀ M) →ₗ[R] M :=\n { Finsupp.applyAddHom a with map_smul' := fun _ _ => rfl }\n\ninstance [Nonempty α] [FaithfulSMul R M] : FaithfulSMul R (α →₀ M) :=\n .of_injective (Finsupp.lsingle <| Classical.arbitrary _) (Finsupp.single_injective _)\n\nsection LSubtypeDomain\n\nvariable (s : Set α)\n\n/-- Interpret `Finsupp.subtypeDomain s` as a linear map. -/\ndef lsubtypeDomain : (α →₀ M) →ₗ[R] s →₀ M where\n toFun := subtypeDomain fun x => x ∈ s\n map_add' _ _ := subtypeDomain_add\n map_smul' _ _ := ext fun _ => rfl\n\ntheorem lsubtypeDomain_apply (f : α →₀ M) :\n (lsubtypeDomain s : (α →₀ M) →ₗ[R] s →₀ M) f = subtypeDomain (fun x => x ∈ s) f :=\n rfl\n\nend LSubtypeDomain\n\n@[simp]\ntheorem lsingle_apply (a : α) (b : M) : (lsingle a : M →ₗ[R] α →₀ M) b = single a b :=\n rfl\n\n@[simp]\ntheorem lapply_apply (a : α) (f : α →₀ M) : (lapply a : (α →₀ M) →ₗ[R] M) f = f a :=\n rfl\n\n@[simp]\ntheorem lapply_comp_lsingle_same (a : α) : lapply a ∘ₗ lsingle a = (.id : M →ₗ[R] M) := by ext; simp\n\n@[simp]\n\nTarget:\ntheorem lapply_comp_lsingle_of_ne (a a' : α) (h : a ≠ a') :\n lapply a ∘ₗ lsingle a' = (0 : M →ₗ[R] M) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"6072f09ef15146d2a26449ec95835b6f8cf657c5db1c002141bf04dac1babcb0","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Finsupp","family_id":"lapply_comp_lsingle_of_ne","file_id":"mathlib/Mathlib/LinearAlgebra/Finsupp/Defs.lean","sample_id":"00a02bddf3a5d934532b0f2822ba59542bf0ae28af1479b5acc90c557fd9c040"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f77ed22ce482683d941ce3730ae2e8f510d2678626103bd1f0ff988c81a4f296","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"17cab4bca43941b77562f1577c52a5d4cc1ec084fb09d9aa6678357b4a566f43","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"77efb6bce26e950b2369ecb305e9643f1ff5fc63afe9ac4a312413b2c8375881","source_sha256":"dfcdfb7def47f0bcbcab37ea254b17db55b5da584b38ce7ceb07bc11e4db6c04","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n rfl","hard_negative":true,"metrics":{"chosen_tokens":16,"rejected_tokens":3,"token_jaccard":0.0625,"token_length_ratio":0.1875},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"c7baca0092655eebae3caf0c1054f63d961572c26f47992abf03cc5fb25acfe0","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Control.Bitraversable.Basic\n\nNamespace:\nBitraversable\n\nLocal context:\n/-\nCopyright (c) 2019 Simon Hudon. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Simon Hudon\n-/\n/-!\n# Bitraversable Lemmas\n\n## Main definitions\n * tfst - traverse on first functor argument\n * tsnd - traverse on second functor argument\n\n## Lemmas\n\nCombination of\n * bitraverse\n * tfst\n * tsnd\n\nwith the applicatives `id` and `comp`\n\n## References\n\n* Hackage: \n\n## Tags\n\ntraversable bitraversable functor bifunctor applicative\n\n\n-/\n\npublic section\n\n\nuniverse u\n\nvariable {t : Type u → Type u → Type u} [Bitraversable t]\nvariable {β : Type u}\n\nnamespace Bitraversable\n\nopen Functor LawfulApplicative\n\nvariable {F G : Type u → Type u} [Applicative F] [Applicative G]\n\n/-- traverse on the first functor argument -/\nabbrev tfst {α α'} (f : α → F α') : t α β → F (t α' β) :=\n bitraverse f pure\n\n/-- traverse on the second functor argument -/\nabbrev tsnd {α α'} (f : α → F α') : t β α → F (t β α') :=\n bitraverse pure f\n\nvariable [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G]\n\n@[higher_order tfst_id]\ntheorem id_tfst : ∀ {α β} (x : t α β), tfst (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tsnd_id]\ntheorem id_tsnd : ∀ {α β} (x : t α β), tsnd (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tfst_comp_tfst]\ntheorem comp_tfst {α₀ α₁ α₂ β} (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β) :\n Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, tfst, map_pure, Pure.pure]\n\n@[higher_order tfst_comp_tsnd]\ntheorem tfst_tsnd {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tfst f <$> tsnd f' x)\n = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n\n@[higher_order tsnd_comp_tfst]\ntheorem tsnd_tfst {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tsnd f' <$> tfst f x)\n = bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n\n@[higher_order tsnd_comp_tsnd]\n\nTarget:\ntheorem comp_tsnd {α β₀ β₁ β₂} (g : β₀ → F β₁) (g' : β₁ → G β₂) (x : t α β₀) :\n Comp.mk (tsnd g' <$> tsnd g x) = tsnd (Comp.mk ∘ map g' ∘ g) x :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_77efb6bce26e","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"d6725ca3d4de74c19c2ebf67472b34c9d4bb1dd26d4863a54d1feb09e92ba8c6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Control/Bitraversable","family_id":"comp_tsnd","file_id":"mathlib/Mathlib/Control/Bitraversable/Lemmas.lean","sample_id":"77efb6bce26e950b2369ecb305e9643f1ff5fc63afe9ac4a312413b2c8375881"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d86e7607bc11051f9de4320108b1774234758b1e7f7a6ff252c4d838ae4b2685","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"609e6e0c746de524fc0e85041a8ed06ce471719713d2e825d5b4da8a6b3c4a63","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8c8f7d01ef83bc6f75414f45a3ca3178b97ad187d4219644c511a31e7f52ee08","source_sha256":"c60b869c723c3c91f9b10ffc01a437f63b4e5c04e61a58398bcd9e9d0ac2e64f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n apply SkewMonoidAlgebra.induction <;> aesop","hard_negative":true,"metrics":{"chosen_tokens":9,"rejected_tokens":5,"token_jaccard":0.166667,"token_length_ratio":0.555556},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"c8a46b600d8e167aa705a4d473f2889af53d9918bf5e0fb938573164a71a892b","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Single\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Support\n\nNamespace:\nSkewPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Xavier Généreux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Xavier Généreux, María Inés de Frutos-Fernández\n-/\n/-!\n# Univariate skew polynomials\n\nGiven a ring `R` and an endomorphism `φ` on `R` the skew polynomials over `R`\nare polynomials\n$$\\sum_{i= 0}^n a_iX^n, n\\geq 0, a_i\\in R$$\nwhere the addition is the usual addition of polynomials\n$$\\sum_{i= 0}^n a_iX^n + \\sum_{i= 0}^n b_iX^n= \\sum_{i= 0}^n (a_i + b_i)X^n.$$\nThe multiplication, however, is determined by\n$$Xa = \\varphi (a)X$$\nby extending it to all polynomials in the obvious way.\n\nSkew polynomials are represented as `SkewMonoidAlgebra R (Multiplicative ℕ)`,\nwhere `R` is usually at least a Semiring. In this file, we define `SkewPolynomial`\nand provide basic instances.\n\n**Note**: To register the endomorphism `φ` see notation below.\n\n## Notation\n\nThe endomorphism `φ` is implemented using some action of `Multiplicative ℕ` on `R`.\nFrom this action, `φ` is an `abbrev` denoting $(\\text{ofAdd } 1) \\cdot a := \\varphi(a)$.\n\nUsers that want to work with a specific map `φ` should introduce an action of\n`Multiplicative ℕ` on `R`. Specifying that this action is a `MulSemiringAction` amounts\nto saying that `φ` is an endomorphism.\n\nFurthermore, with this notation `φ^[n](a) = (ofAdd n) • a`, see `φ_iterate_apply`.\n\n## Main definitions\n\n* `SkewPolynomial.monomial n a` is the skew polynomial `a X ^ n`. Note that\n `SkewPolynomial.monomial n` is defined as an `R`-linear map.\n* `SkewPolynomial.C a` is the constant skew polynomial `a`. Note that `C` is defined as an additive\n homomorphism.\n* `SkewPolynomial.CRingHom a` is the constant skew polynomial `a`, as a ring homomorphism. This\n requires to assume `[MulSemiringAction (Multiplicative ℕ) R]`.\n* `SkewPolynomial.X` is the skew polynomial `X`, i.e., `SkewPolynomial.monomial 1 1`.\n* `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`.\n* `SkewPolynomial.coeff p n` is the coefficient of `X ^ n` in `p`.\n* `SkewPolynomial.erase p n` is the skew polynomial `p` in which one removes the monomial in\n degree `n`.\n* `SkewPolynomial.update p n a` is the skew polynomial obtained by replacing the coefficient of\n degree `n` by a given value `a : R`. If `a = 0`, this is equal to `p.erase n` If\n `p.natDegree < n` and `a ≠ 0`, this increases the degree of `p` to `n`.\n\n## Implementation notes\n\nThe implementation uses `Multiplicative ℕ` instead of `ℕ`, since Mathlib does not contain an\nadditive version of `SkewMonoidAlgebra`.\n\nThis decision was made because we use the type class `MulSemiringAction` to specify the properties\nthe action needs to respect for associativity. There is no version of this in Mathlib that\nuses an acting `AddMonoid M` and so we need to use `Multiplicative ℕ` for the action.\n\nFor associativity to hold, there should be an instance of\n`MulSemiringAction (Multiplicative ℕ) R` present in the context.\nFor example, in the context of $\\mathbb{F}_q$-linear polynomials, this can be the\n$q$-th Frobenius endomorphism - so $\\varphi(a) = a^q$.\n\n## Reference\n\nThe definition is inspired by Chapter 3 of [Papikian2023].\n\n## Tags\n\nSkew Polynomials, Twisted Polynomials.\n\nNote that [ore33] proposes a more general definition of skew polynomial ring, where the\nmultiplication is determined by $Xa = \\varphi (a)X + δ (a)$, where `φ` is as above and\n`δ` is a derivation.\n\n-/\n\n@[expose] public section\n\nnoncomputable section\n\nopen Function Multiplicative SkewMonoidAlgebra\n\n/-- The skew polynomials over `R` is the type of univariate polynomials over `R`\nendowed with a skewed convolution product. -/\nabbrev SkewPolynomial (R : Type*) [AddCommMonoid R] := SkewMonoidAlgebra R (Multiplicative ℕ)\n\nnamespace SkewPolynomial\n\nvariable {R : Type*} {m n : ℕ}\n\nsection Semiring\n\nvariable [Semiring R] {p q : SkewPolynomial R}\n\n\nlemma zero_def : (0 : SkewPolynomial R) = (0 : SkewMonoidAlgebra R (Multiplicative ℕ)) := rfl\n\nvariable {S S₁ S₂ : Type*}\n\n/--\nThe set of all `n` such that `X^n` has a non-zero coefficient.\n-/\ndef support (p : SkewPolynomial R) : Finset ℕ :=\n Finset.map ⟨toAdd, toAdd.injective⟩ (SkewMonoidAlgebra.support p)\n\n/-- Though `SkewPolynomial.support` is not definiyionally equal to `SkewMonoidAlgebra.support` we\n can relate them using the following lemma. -/\nlemma support_eq_skewMonoidAlgebra_support (p : SkewPolynomial R) :\n p.support = Finset.map (Multiplicative.toAdd (α := ℕ)) (SkewMonoidAlgebra.support p) := by\n simp only [support]\n\n@[simp] lemma support_zero : (0 : SkewPolynomial R).support = ∅ := rfl\n\n@[simp] lemma support_eq_empty : p.support = ∅ ↔ p = 0 := by simp [support]\n\nlemma card_support_eq_zero : p.support.card = 0 ↔ p = 0 := by simp\n\nlemma support_add : (p + q).support ⊆ p.support ∪ q.support := by\n simpa [support, ← Finset.map_union, Finset.map_subset_map] using SkewMonoidAlgebra.support_add\n\n/-- `coeff p n` is the coefficient of `X ^ n` in `p`. -/\ndef coeff (p : SkewPolynomial R) : ℕ → R := fun n ↦ (SkewMonoidAlgebra.coeff p (ofAdd n))\n\n@[simp]\nlemma mem_support_iff : n ∈ p.support ↔ p.coeff n ≠ 0 := by\n simp [support, coeff]\n\nlemma notMem_support_iff : n ∉ p.support ↔ p.coeff n = 0 := by simp\n\n/-- `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`. -/\ndef sum {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) : S :=\n SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r)\n\n/-- For a skew polynomial `p`, `p.sum f` can be written in terms of `SkewMonoidAlgebra.sum p`. -/\nlemma sum_def' {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r) := rfl\n\nlemma sum_def {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = ∑ n ∈ p.support, f n (p.coeff n) := by\n simp only [sum_def', SkewMonoidAlgebra.sum_def, Finsupp.sum, toFinsupp_apply]\n apply Finset.sum_of_injOn (toAdd) (Injective.injOn fun ⦃a₁ a₂⦄ a ↦ a) (fun _ ↦ ?_) <;>\n simp +contextual [coeff]\n\nlemma sum_sum_index {R' P : Type*} [AddCommMonoid P] [Semiring R']\n {f : SkewPolynomial R} {g : ℕ → R → SkewPolynomial R'} {h : ℕ → R' → P}\n (h_zero : ∀ (a : ℕ), h a 0 = 0)\n (h_add : ∀ (a : ℕ) (b₁ b₂ : R'), h a (b₁ + b₂) = h a b₁ + h a b₂) :\n sum (sum f g) h = sum f fun (a : ℕ) (b : R) ↦ sum (g a b) h := by\n simp only [sum_def', SkewMonoidAlgebra.sum_sum_index (fun a ↦ h_zero (toAdd a))\n (fun a ↦ h_add (toAdd a))]\n\n@[simp]\nlemma sum_zero {N : Type*} [AddCommMonoid N] {f : SkewPolynomial R} :\n (f.sum fun (_ : ℕ) _ ↦ (0 : N)) = 0 :=\n SkewMonoidAlgebra.sum_zero\n\nsection Monomial\n\nvariable (n)\n\n/-- `monomial s a` is the monomial `a * X ^ s`. -/\ndef monomial : R →ₗ[R] SkewPolynomial R := lsingle R (ofAdd n)\n\nlemma monomial_zero_right : monomial n (0 : R) = 0 := single_zero _\n\nlemma monomial_zero_one [MulSemiringAction (Multiplicative ℕ) R] : monomial 0 (1 : R) = 1 :=\n rfl\n\nlemma monomial_def (a : R) : monomial n a = single (ofAdd n) a := rfl\n\nlemma monomial_add (r s : R) : monomial n (r + s) = monomial n r + monomial n s :=\n single_add ..\n\nlemma smul_monomial {S} [Semiring S] [Module S R] (a : S) (b : R) :\n a • monomial n b = monomial n (a • b) :=\n smul_single ..\n\n@[simp]\nlemma sum_monomial (f : SkewPolynomial R) : f.sum (fun (a : ℕ) ↦ monomial a) = f :=\n SkewMonoidAlgebra.sum_single _\n\n@[simp]\nlemma sum_monomial_index {N} [AddCommMonoid N] {n : ℕ} {b : R} {h : ℕ → R → N}\n (h_zero : h n 0 = 0) : (monomial n b).sum h = h n b :=\n SkewMonoidAlgebra.sum_single_index h_zero\n\nlemma monomial_injective : Function.Injective (monomial n : R → SkewPolynomial R) :=\n single_injective (ofAdd n)\n\n@[simp]\nlemma monomial_eq_zero_iff (t : R) : monomial n t = 0 ↔ t = 0 :=\n LinearMap.map_eq_zero_iff _ (SkewPolynomial.monomial_injective n)\n\nlemma monomial_eq_monomial_iff {m n : ℕ} {a b : R} :\n monomial m a = monomial n b ↔ m = n ∧ a = b ∨ a = 0 ∧ b = 0 := by\n rw [← Finsupp.single_eq_single_iff m n a b]\n simp only [monomial_def, ← toFinsupp_single, toFinsupp_inj]\n simp only [← ofFinsupp_single, SkewMonoidAlgebra.ofFinsupp_inj, Finsupp.single_eq_single_iff,\n EmbeddingLike.apply_eq_iff_eq]\n\nTarget:\nlemma induction {motive : SkewPolynomial R → Prop} (p : SkewPolynomial R) (h0 : motive 0)\n (ha : ∀ (n : ℕ) (r : R) (q : SkewPolynomial R), n ∉ q.support → r ≠ 0 → motive q →\n motive (SkewPolynomial.monomial n r + q)) : motive p :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_8c8f7d01ef83","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"60db2a4272aa83161c3d8e3f8048df0c7180e26ae30cb540cf7db01bfb4e4bfe","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/SkewPolynomial","family_id":"induction","file_id":"mathlib/Mathlib/Algebra/SkewPolynomial/Basic.lean","sample_id":"8c8f7d01ef83bc6f75414f45a3ca3178b97ad187d4219644c511a31e7f52ee08"},"split":"validation"} {"binding":{"chosen_proof_sha256":"897c172047eda794e8869be4ee35cff8b29b581623e6fe2b10f4a65fbcafe6c9","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"1480ca314344bbeedcc3024354388153952b9296e9277aaf7cb9b985c4279056","source_sha256":"f933354ffdad343f1f87876dd6cf99ec8b0c6f9434915fe785999e4c86761fe8","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rcases H with ⟨u, hu⟩; rwa [← u.mul_left_inj, Hg.comm u]","hard_negative":true,"metrics":{"chosen_tokens":22,"rejected_tokens":8,"token_jaccard":0.041667,"token_length_ratio":0.363636},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"c93cce9d35b25bdfc72c6cf9465a2ad4edcfb849bcdb13cec8d2589e07fee3aa","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Subgroup.Basic\npublic import Mathlib.GroupTheory.Submonoid.Center\n\nNamespace:\nIsConj\n\nLocal context:\n/-\nCopyright (c) 2020 Kexing Ying. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kexing Ying\n-/\n/-!\n# Centers of subgroups\n\n-/\n\n@[expose] public section\n\nassert_not_exists MonoidWithZero Multiset\n\nvariable {G : Type*} [Group G]\n\nnamespace Subgroup\n\nvariable (G)\n\n/-- The center of a group `G` is the set of elements that commute with everything in `G` -/\n@[to_additive\n /-- The center of an additive group `G` is the set of elements that commute with\n everything in `G` -/]\ndef center : Subgroup G where\n __ := Submonoid.center G\n inv_mem' := Set.inv_mem_center\n\n@[to_additive]\ntheorem coe_center : ↑(center G) = Set.center G :=\n rfl\n\n@[to_additive (attr := simp)]\ntheorem center_toSubmonoid : (center G).toSubmonoid = Submonoid.center G :=\n rfl\n\ninstance center.isMulCommutative : IsMulCommutative (center G) :=\n ⟨⟨fun a b => Subtype.ext (b.2.comm a).symm⟩⟩\n\nvariable {G} in\n/-- The center of isomorphic groups are isomorphic. -/\n@[to_additive (attr := simps!) /-- The center of isomorphic additive groups are isomorphic. -/]\ndef centerCongr {H} [Group H] (e : G ≃* H) : center G ≃* center H := Submonoid.centerCongr e\n\n/-- The center of a group is isomorphic to the center of its opposite. -/\n@[to_additive (attr := simps!)\n/-- The center of an additive group is isomorphic to the center of its opposite. -/]\ndef centerToMulOpposite : center G ≃* center Gᵐᵒᵖ := Submonoid.centerToMulOpposite\n\nvariable {G}\n\n@[to_additive]\ntheorem mem_center_iff {z : G} : z ∈ center G ↔ ∀ g, g * z = z * g := by\n rw [← Semigroup.mem_center_iff]\n exact Iff.rfl\n\ninstance decidableMemCenter (z : G) [Decidable (∀ g, g * z = z * g)] : Decidable (z ∈ center G) :=\n decidable_of_iff' _ mem_center_iff\n\n@[to_additive]\ninstance centerCharacteristic : (center G).Characteristic := by\n refine characteristic_iff_comap_le.mpr fun ϕ g hg => ?_\n rw [mem_center_iff]\n intro h\n rw [← ϕ.injective.eq_iff, map_mul, map_mul]\n exact (hg.comm (ϕ h)).symm\n\n@[to_additive]\ntheorem _root_.CommGroup.center_eq_top {G : Type*} [CommGroup G] : center G = ⊤ := by\n rw [eq_top_iff']\n intro x\n rw [Subgroup.mem_center_iff]\n intro y\n exact mul_comm y x\n\n@[to_additive]\ntheorem center_eq_top_iff : center G = ⊤ ↔ IsMulCommutative G := by\n simp [eq_top_iff', isMulCommutative_iff, mem_center_iff, eq_comm]\n\n@[to_additive]\ntheorem center_eq_top [hG : IsMulCommutative G] : center G = ⊤ :=\n center_eq_top_iff.mpr hG\n\n/-- A group is commutative if the center is the whole group. -/\n@[to_additive /-- An additive group is commutative if the center is the whole group. -/,\n implicit_reducible]\ndef _root_.Group.commGroupOfCenterEqTop (h : center G = ⊤) : CommGroup G :=\n { ‹Group G› with\n mul_comm := by\n rw [eq_top_iff'] at h\n intro x y\n apply Subgroup.mem_center_iff.mp _ x\n exact h y\n }\n\n@[to_additive]\nprotected theorem center_prod {H : Type*} [Group H] : center (G × H) = prod (center G) (center H) :=\n SetLike.coe_injective Set.center_prod\n\n@[to_additive]\nprotected theorem center_pi {η : Type*} {G : η → Type*} [Π i, Group (G i)] :\n center (Π i, G i) = pi .univ fun i ↦ center (G i) :=\n SetLike.coe_injective Set.center_pi\n\nvariable {H : Subgroup G}\n\nsection Normalizer\n\n@[to_additive]\ninstance instNormalCenter : (center G).Normal :=\n ⟨fun a ha b ↦ by simpa [mem_center_iff.mp ha b]⟩\n\n@[to_additive]\ntheorem center_le_normalizer (s : Set G) : center G ≤ normalizer s := by\n intro x hx y\n simp [← mem_center_iff.mp hx y]\n\nend Normalizer\n\nend Subgroup\n\nnamespace IsConj\n\nvariable {M : Type*} [Monoid M]\n\nTarget:\ntheorem eq_of_left_mem_center {g h : M} (H : IsConj g h) (Hg : g ∈ Set.center M) : g = h :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"0470e7a63ec5de101961df654d45abeeb07186f786002f2dfe38282e9fef85aa","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Subgroup","family_id":"eq_of_left_mem_center","file_id":"mathlib/Mathlib/GroupTheory/Subgroup/Center.lean","sample_id":"1480ca314344bbeedcc3024354388153952b9296e9277aaf7cb9b985c4279056"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4d490ee977d0711ff39cddfe60d9377a386905836bcdbc6ae1adf757c990a11f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"b9bcc9b05e97a301d57ec6e78a354a9ce63b36fcde5e8307f55c930a1a5524a5","source_sha256":"57f2efe792830f667cc2c077aed3a9c4921545c3176de30e03066c364104267f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rintro x hx\n by_contra! h\n simpa [U.rfl] using h _ <| hN.2 (y := insert x N) ⟨by simp [insert_subset_iff, hx, hN.1.1],\n hN.1.2.insert fun y hy hxy ↦ (h y hy hxy).elim⟩ (subset_insert _ _) (mem_insert _ _)","hard_negative":false,"metrics":{"chosen_tokens":74,"rejected_tokens":3,"token_jaccard":0.025,"token_length_ratio":0.040541},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"c96e974f63b465e1fe76297698c6f30e74ae17d05a3845a21eb18a3df34626b4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Rel.Separated\n\nNamespace:\nSetRel\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Covers in a uniform space\n\nThis file defines covers, aka nets, which are a quantitative notion of compactness given an\nentourage.\n\nA `U`-cover of a set `s` is a set `N` such that every element of `s` is `U`-close to some element of\n`N`.\n\nThe concept of uniform covers is used to define two further notions of covering:\n* Metric covers: `Metric.IsCover`, defined using the distance entourage.\n* Dynamical covers: `Dynamics.IsDynCoverOf`, defined using the dynamical entourage.\n\n## References\n\n[R. Vershynin, *High Dimensional Probability*][vershynin2018high], Section 4.2.\n-/\n\n@[expose] public section\n\nopen Set\n\nnamespace SetRel\nvariable {X : Type*} {U V : SetRel X X} {s t N N₁ N₂ : Set X} {x : X}\n\n/-- For an entourage `U`, a set `N` is a *`U`-cover* of a set `s` if every point of `s` is `U`-close\nto some point of `N`.\n\nThis is also called a *`U`-net* in the literature.\n\n[R. Vershynin, *High Dimensional Probability*][vershynin2018high], 4.2.1. -/\ndef IsCover (U : SetRel X X) (s N : Set X) : Prop := ∀ ⦃x⦄, x ∈ s → ∃ y ∈ N, x ~[U] y\n\n@[simp] lemma IsCover.empty : IsCover U ∅ N := by simp [IsCover]\n\n@[simp] lemma isCover_empty_right : IsCover U s ∅ ↔ s = ∅ := by\n simp [IsCover, eq_empty_iff_forall_notMem]\n\nprotected nonrec lemma IsCover.nonempty (hsN : IsCover U s N) (hs : s.Nonempty) : N.Nonempty :=\n let ⟨_x, hx⟩ := hs; let ⟨y, hy, _⟩ := hsN hx; ⟨y, hy⟩\n\n@[simp] lemma IsCover.refl (U : SetRel X X) [U.IsRefl] (s : Set X) : IsCover U s s :=\n fun a ha ↦ ⟨a, ha, U.rfl⟩\n\nlemma IsCover.rfl {U : SetRel X X} [U.IsRefl] {s : Set X} : IsCover U s s := refl U s\n\n@[simp] protected lemma isCover_univ : IsCover univ s N ↔ (s.Nonempty → N.Nonempty) := by\n simp [IsCover, Set.Nonempty]\n\nlemma IsCover.mono (hN : N₁ ⊆ N₂) (h₁ : IsCover U s N₁) : IsCover U s N₂ :=\n fun _x hx ↦ let ⟨y, hy, hxy⟩ := h₁ hx; ⟨y, hN hy, hxy⟩\n\nlemma IsCover.anti (hst : s ⊆ t) (ht : IsCover U t N) : IsCover U s N := fun _x hx ↦ ht <| hst hx\n\nlemma IsCover.mono_entourage (hUV : U ⊆ V) (hU : IsCover U s N) : IsCover V s N :=\n fun _x hx ↦ let ⟨y, hy, hxy⟩ := hU hx; ⟨y, hy, hUV hxy⟩\n\nlemma IsCover.union (hs : IsCover U s N₁) (ht : IsCover U t N₂) : IsCover U (s ∪ t) (N₁ ∪ N₂) := fun\n | _x, .inl hx => let ⟨y, hy, hxy⟩ := hs hx; ⟨y, .inl hy, hxy⟩\n | _x, .inr hx => let ⟨y, hy, hxy⟩ := ht hx; ⟨y, .inr hy, hxy⟩\n\n/-- A maximal `U`-separated subset of a set `s` is a `U`-cover of `s`.\n\n[R. Vershynin, *High Dimensional Probability*][vershynin2018high], 4.2.6. -/\n\nTarget:\nlemma IsCover.of_maximal_isSeparated [U.IsRefl] [U.IsSymm]\n (hN : Maximal (fun N ↦ N ⊆ s ∧ IsSeparated U N) N) : IsCover U s N :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Rel","family_id":"iscover","file_id":"mathlib/Mathlib/Data/Rel/Cover.lean","sample_id":"b9bcc9b05e97a301d57ec6e78a354a9ce63b36fcde5e8307f55c930a1a5524a5"},"split":"validation"} {"binding":{"chosen_proof_sha256":"34370117cf1af66983b4a01919919b3775cd8065b450b0e261d20b1099f20daf","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"54f00642a3e653fcdff3f5ec5eba15dd8d06bc171554ee5cf4531d7c68a7a874","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"53e0ba607316ade5e9bd1d0ce5d67c6f506005e9671a13d827f6883bfdc1d4a0","source_sha256":"768b3331f9549aba216af332031e1c95a6da433745e06e2b8d9e582387e161ea","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [IsSymmetricAlgebra, lift_ι]\n exact Function.Involutive.bijective (congrFun rfl)","hard_negative":false,"metrics":{"chosen_tokens":18,"rejected_tokens":25,"token_jaccard":0.894737,"token_length_ratio":1.388889},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"ca1e66b65bc1592ca956d9f4bfed6e3f503be2d3abf44c27ea8097731904d1cc","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.TensorAlgebra.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Raphael Douglas Giles. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Raphael Douglas Giles, Zhixuan Dai, Zhenyan Fu, Yiming Fu, Jingting Wang, Eric Wieser\n-/\n/-!\n# Symmetric Algebras\n\nGiven a commutative semiring `R`, and an `R`-module `M`, we construct the symmetric algebra of `M`.\nThis is the free commutative `R`-algebra generated (`R`-linearly) by the module `M`.\n\n## Notation\n\n* `SymmetricAlgebra R M`: a concrete construction of the symmetric algebra defined as a\n quotient of the tensor algebra. It is endowed with an R-algebra structure and a commutative\n ring structure.\n* `SymmetricAlgebra.ι R`: the canonical R-linear map `M →ₗ[R] SymmetricAlgebra R M`.\n* Given a morphism `ι : M →ₗ[R] A`, `IsSymmetricAlgebra ι` is a proposition saying that the algebra\n homomorphism from `SymmetricAlgebra R M` to `A` lifted from `ι` is bijective.\n* Given a linear map `f : M →ₗ[R] A'` to a commutative R-algebra `A'`, and a morphism\n `ι : M →ₗ[R] A` with `p : IsSymmetricAlgebra ι`, `IsSymmetricAlgebra.lift p f`\n is the lift of `f` to an `R`-algebra morphism `A →ₐ[R] A'`.\n\n## Note\n\nSee `SymAlg R` instead if you are looking for the symmetrized algebra, which gives a commutative\nmultiplication on `R` by $a \\circ b = \\frac{1}{2}(ab + ba)$.\n-/\n\n@[expose] public section\n\nvariable (R M : Type*) [CommSemiring R] [AddCommMonoid M] [Module R M]\n\n/-- Relation on the tensor algebra which will yield the symmetric algebra when\nquotiented out by. -/\ninductive TensorAlgebra.SymRel : TensorAlgebra R M → TensorAlgebra R M → Prop where\n | mul_comm (x y : M) : SymRel (ι R x * ι R y) (ι R y * ι R x)\n\nopen TensorAlgebra\n\n/-- Concrete construction of the symmetric algebra of `M` by quotienting out\nthe tensor algebra by the commutativity relation. -/\nabbrev SymmetricAlgebra := RingQuot (SymRel R M)\n\nnamespace SymmetricAlgebra\n\n/-- Algebra homomorphism from the tensor algebra over `M` to the symmetric algebra over `M`. -/\nabbrev algHom : TensorAlgebra R M →ₐ[R] SymmetricAlgebra R M := RingQuot.mkAlgHom R (SymRel R M)\n\nlemma algHom_surjective : Function.Surjective (algHom R M) :=\n RingQuot.mkAlgHom_surjective _ _\n\n/-- Canonical inclusion of `M` into the symmetric algebra `SymmetricAlgebra R M`. -/\ndef ι : M →ₗ[R] SymmetricAlgebra R M := algHom R M ∘ₗ TensorAlgebra.ι R\n\n@[elab_as_elim]\ntheorem induction {motive : SymmetricAlgebra R M → Prop}\n (algebraMap : ∀ r, motive (algebraMap R (SymmetricAlgebra R M) r)) (ι : ∀ x, motive (ι R M x))\n (mul : ∀ a b, motive a → motive b → motive (a * b))\n (add : ∀ a b, motive a → motive b → motive (a + b))\n (a : SymmetricAlgebra R M) : motive a := by\n rcases algHom_surjective _ _ a with ⟨a, rfl⟩\n induction a using TensorAlgebra.induction with\n | algebraMap r => rw [AlgHom.commutes]; exact algebraMap r\n | ι x => exact ι x\n | mul x y hx hy => rw [map_mul]; exact mul _ _ hx hy\n | add x y hx hy => rw [map_add]; exact add _ _ hx hy\n\nopen TensorAlgebra in\ninstance : CommSemiring (SymmetricAlgebra R M) where\n mul_comm a b := by\n change Commute a b\n induction b using SymmetricAlgebra.induction with\n | algebraMap r => exact Algebra.commute_algebraMap_right _ _\n | ι x => induction a using SymmetricAlgebra.induction with\n | algebraMap r => exact Algebra.commute_algebraMap_left _ _\n | ι y => simp [commute_iff_eq, ι, ← map_mul, RingQuot.mkAlgHom_rel _ (SymRel.mul_comm x y)]\n | mul a b ha hb => exact ha.mul_left hb\n | add a b ha hb => exact ha.add_left hb\n | mul b c hb hc => exact hb.mul_right hc\n | add b c hb hc => exact hb.add_right hc\n\ninstance (R M) [CommRing R] [AddCommMonoid M] [Module R M] : CommRing (SymmetricAlgebra R M) where\n __ := (inferInstance : CommSemiring (SymmetricAlgebra R M))\n __ := (inferInstance : Ring (RingQuot (SymRel R M)))\n\nvariable {R M} {A : Type*} [CommSemiring A] [Algebra R A]\n\n/-- For any linear map `f : M →ₗ[R] A`, `SymmetricAlgebra.lift f` lifts the linear map to an\nR-algebra homomorphism from `SymmetricAlgebra R M` to `A`. -/\ndef lift : (M →ₗ[R] A) ≃ (SymmetricAlgebra R M →ₐ[R] A) := by\n let equiv : (TensorAlgebra R M →ₐ[R] A) ≃\n {f : TensorAlgebra R M →ₐ[R] A // ∀ {x y}, (TensorAlgebra.SymRel R M) x y → f x = f y} := by\n refine (Equiv.subtypeUnivEquiv fun h _ _ h' ↦ ?_).symm\n induction h' with | mul_comm x y => rw [map_mul, map_mul, mul_comm]\n exact (TensorAlgebra.lift R).trans <| equiv.trans <| RingQuot.liftAlgHom R\n\nvariable (f : M →ₗ[R] A)\n\n@[simp]\nlemma lift_ι_apply (a : M) : lift f (ι R M a) = f a := by\n simp [lift, ι, algHom]\n\n@[simp]\nlemma lift_comp_ι : lift f ∘ₗ ι R M = f := LinearMap.ext <| lift_ι_apply f\n\n@[ext 1100]\ntheorem algHom_ext {F G : SymmetricAlgebra R M →ₐ[R] A}\n (h : F ∘ₗ ι R M = (G ∘ₗ ι R M : M →ₗ[R] A)) : F = G := by\n ext x\n exact congr($h x)\n\n@[simp]\nlemma lift_ι : lift (ι R M) = .id R (SymmetricAlgebra R M) := by\n apply algHom_ext\n rw [lift_comp_ι]\n ext\n simp\n\n/-- The left-inverse of `algebraMap`. -/\ndef algebraMapInv : SymmetricAlgebra R M →ₐ[R] R :=\n lift (0 : M →ₗ[R] R)\n\ntheorem algebraMapInv_ι (x : M) : algebraMapInv (ι R M x) = 0 := lift_ι_apply 0 x\n\nvariable (M)\n\ntheorem algebraMap_leftInverse :\n Function.LeftInverse algebraMapInv (algebraMap R <| SymmetricAlgebra R M) := fun x => by\n simp [algebraMapInv]\n\n@[simp]\ntheorem algebraMap_inj (x y : R) :\n algebraMap R (SymmetricAlgebra R M) x = algebraMap R (SymmetricAlgebra R M) y ↔ x = y :=\n (algebraMap_leftInverse M).injective.eq_iff\n\n@[simp]\ntheorem algebraMap_eq_zero_iff (x : R) : algebraMap R (SymmetricAlgebra R M) x = 0 ↔ x = 0 :=\n map_eq_zero_iff (algebraMap _ _) (algebraMap_leftInverse _).injective\n\n@[simp]\ntheorem algebraMap_eq_one_iff (x : R) : algebraMap R (SymmetricAlgebra R M) x = 1 ↔ x = 1 :=\n map_eq_one_iff (algebraMap _ _) (algebraMap_leftInverse _).injective\n\n/-- A `SymmetricAlgebra` over a nontrivial semiring is nontrivial. -/\ninstance [Nontrivial R] : Nontrivial (SymmetricAlgebra R M) :=\n (algebraMap_leftInverse M).injective.nontrivial\n\nend SymmetricAlgebra\n\nvariable {A : Type*} [CommSemiring A] [Algebra R A] (f : M →ₗ[R] A)\nvariable {R} {M}\n\n/-- Given a morphism `f : M →ₗ[R] A`, `IsSymmetricAlgebra f` is a proposition saying that the\nalgebra homomorphism from `SymmetricAlgebra R M` to `A` is bijective. -/\ndef IsSymmetricAlgebra (f : M →ₗ[R] A) : Prop :=\n Function.Bijective (SymmetricAlgebra.lift f)\n\nTarget:\ntheorem SymmetricAlgebra.isSymmetricAlgebra_ι : IsSymmetricAlgebra (ι R M) :=\n\nProof body:\n","rejected":"```lean\nby\n rw [IsSymmetricAlgebra, lift_ι]\n exact Function.Involutive.bijective (congrFun rfl)\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/SymmetricAlgebra","family_id":"symmetricalgebra","file_id":"mathlib/Mathlib/LinearAlgebra/SymmetricAlgebra/Basic.lean","sample_id":"53e0ba607316ade5e9bd1d0ce5d67c6f506005e9671a13d827f6883bfdc1d4a0"},"split":"validation"} {"binding":{"chosen_proof_sha256":"41505fad08a882f8dccf141cddf38335570092c30def0476a4e569bd96c364f0","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"bd69b7d5cb06628b801d8387efe0b84d829dc938f07ddc5fb82dc0244e454ed1","source_sha256":"416697ad3bd8bcfb088a8e7c76c87ecb4d2a97671573839a13fb91b3527112b2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let e := MulEquivClass.toMulEquiv e\n exact ⟨comap_prime e e.symm fun a => by simp,\n fun h => (comap_prime e.symm e fun a => by simp) <| (e.symm_apply_apply p).substr h⟩","hard_negative":false,"metrics":{"chosen_tokens":48,"rejected_tokens":5,"token_jaccard":0.071429,"token_length_ratio":0.104167},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"caa551fd0c481bfb43077ac2740bf8b711c6a281df16840175c82dd6540c49b4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Divisibility.Hom\npublic import Mathlib.Algebra.Group.Irreducible.Lemmas\npublic import Mathlib.Algebra.GroupWithZero.Equiv\npublic import Mathlib.Algebra.Prime.Defs\npublic import Mathlib.Order.Monotone.Defs\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2018 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Jens Wagemaker\n-/\n/-!\n# Associated, prime, and irreducible elements.\n\nIn this file we define the predicate `Prime p`\nsaying that an element of a commutative monoid with zero is prime.\nNamely, `Prime p` means that `p` isn't zero, it isn't a unit,\nand `p ∣ a * b → p ∣ a ∨ p ∣ b` for all `a`, `b`;\n\nIn decomposition monoids (e.g., `ℕ`, `ℤ`), this predicate is equivalent to `Irreducible`,\nhowever this is not true in general.\n\nWe also define an equivalence relation `Associated`\nsaying that two elements of a monoid differ by a multiplication by a unit.\nThen we show that the quotient type `Associates` is a monoid\nand prove basic properties of this quotient.\n-/\n\npublic section\n\nassert_not_exists IsOrderedMonoid Multiset\n\nvariable {M N : Type*}\n\nsection Prime\n\nvariable [CommMonoidWithZero M]\n\nsection Map\n\nvariable [CommMonoidWithZero N] {F : Type*} {G : Type*} [FunLike F M N]\nvariable [MonoidWithZeroHomClass F M N] [FunLike G N M] [MulHomClass G N M]\nvariable (f : F) (g : G) {p : M}\n\ntheorem comap_prime (hinv : ∀ a, g (f a : N) = a) (hp : Prime (f p)) : Prime p :=\n ⟨fun h => hp.1 <| by simp [h], fun h => hp.2.1 <| h.map f, fun a b h => by\n refine\n (hp.2.2 (f a) (f b) <| by\n convert! map_dvd f h\n simp).imp\n ?_ ?_ <;>\n · intro h\n convert! ← map_dvd g h <;> apply hinv⟩\n\nTarget:\ntheorem MulEquiv.prime_iff {E : Type*} [EquivLike E M N] [MulEquivClass E M N] (e : E) :\n Prime (e p) ↔ Prime p :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Prime","family_id":"mulequiv","file_id":"mathlib/Mathlib/Algebra/Prime/Lemmas.lean","sample_id":"bd69b7d5cb06628b801d8387efe0b84d829dc938f07ddc5fb82dc0244e454ed1"},"split":"validation"} {"binding":{"chosen_proof_sha256":"48ae0c5f114f77be432829afce557e82af1be4254dc52848688fd0c2e7a00f16","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"97cc2dcead0110530410d02293d7f941e112d91ff180a713d803fd6582412f20","source_sha256":"c4da1021a79c09c7df686cb23d008cec3d659e62929e487ef02d24baa2e90a0f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [coe_coeMonoidHom]\n exact DFunLike.coe_injective","hard_negative":true,"metrics":{"chosen_tokens":9,"rejected_tokens":8,"token_jaccard":0.066667,"token_length_ratio":0.888889},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"cabd8ad101212800923faa8c98c6d729822772918a2d590946adb83dc9653aea","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.FunLike.IsApply\npublic import Mathlib.Algebra.Group.InjSurj\npublic import Mathlib.Algebra.Group.Hom.Defs\npublic import Mathlib.Algebra.Group.Pi.Basic\n\nNamespace:\nFunLike\n\nLocal context:\n/-\nCopyright (c) 2026 Moritz Doll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Moritz Doll\n-/\n/-! # Group instances for `FunLike` types\nIn this file we define various instances related to groups for `FunLike` types.\n\nFor example given a `FunLike F α β` with `IsMulApply F α β` and `Semigroup β`, then `F` is naturally\na semigroup. Note that currently, these are not registered as instances, but only `abbrev`s to\navoid long typeclass searches.\n\nMoreover, we define the homomorphism `FunLike.coeMulHom : F →* α → β` that acts by coercion. This\ndefinition is mainly needed to define a module instance on `F`.\n\n-/\n\n@[expose] public section\n\nnamespace FunLike\n\nvariable {F α β : Type*} [FunLike F α β]\n\nsection CoercionHom\n\nsection MulHom\n\nvariable [Mul F] [Mul β] [IsMulApply F α β]\n\nvariable (F α β) in\n/-- Coercion as a multiplicative homomorphism. -/\n@[to_additive\n/-- Coercion as an additive homomorphism. -/]\ndef coeMulHom : F →ₙ* α → β where\n toFun f := f\n map_mul' := coe_mul\n\n@[to_additive (attr := simp)]\ntheorem coeMulHom_apply (f : F) : coeMulHom F α β f = f := rfl\n\n@[to_additive (attr := norm_cast)]\ntheorem coe_coeMulHom : (coeMulHom F α β : F → α → β) = DFunLike.coe := rfl\n\n@[to_additive]\ntheorem coeMulHom_injective : Function.Injective (coeMulHom F α β) := by\n rw [coe_coeMulHom]\n exact DFunLike.coe_injective\n\nend MulHom\n\nsection MonoidHom\n\nvariable [MulOne F] [MulOneClass β] [IsOneApply F α β] [IsMulApply F α β]\n\nvariable (F α β) in\n/-- Coercion as a monoid homomorphism. -/\n@[to_additive\n/-- Coercion as an additive monoid homomorphism. -/]\ndef coeMonoidHom : F →* α → β where\n toFun f := f\n map_one' := coe_one\n map_mul' := coe_mul\n\n@[to_additive (attr := simp)]\ntheorem coeMonoidHom_apply (f : F) : coeMonoidHom F α β f = f := rfl\n\n@[to_additive (attr := norm_cast)]\ntheorem coe_coeMonoidHom : (coeMonoidHom F α β : F → α → β) = DFunLike.coe := rfl\n\n@[to_additive (attr := norm_cast)]\ntheorem coe_coeMonoidHom' : (coeMonoidHom F α β : F →ₙ* α → β) = coeMulHom F α β := rfl\n\n@[to_additive]\n\nTarget:\ntheorem coeMonoidHom_injective : Function.Injective (coeMonoidHom F α β) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"1f32eaf786831dfe98d078cdaf3fbaf931d1c21893680497b3200723a8da8555","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/FunLike","family_id":"coemonoidhom_injective","file_id":"mathlib/Mathlib/Data/FunLike/Group.lean","sample_id":"97cc2dcead0110530410d02293d7f941e112d91ff180a713d803fd6582412f20"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f9238a33c34df8d596e122a93a4a0a65af65fcc20ce9465e0bb19ab23680a8d8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"2c264d6adec184e75e8a764edc47b951a871ff4312cbef2af23ae57c61d62767","source_sha256":"ad68699b4540dc5df6f32705a5ebbd4937fbb699df2546854b29d6ff60827576","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n apply Finset.eq_univ_of_card\n rw [card_four']\n repeat rw [card_insert_of_notMem]\n on_goal 4 => simpa using mul_notMem_of_exponent_two (by simp) hx hy hxy\n all_goals simp_all","hard_negative":false,"metrics":{"chosen_tokens":29,"rejected_tokens":3,"token_jaccard":0.037037,"token_length_ratio":0.103448},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"cbcca30a95062f51e6cd1ec9d2570eddabc2561ed94da5592e4edaaa884f4e50","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.SpecificGroups.Cyclic\n\nNamespace:\nIsKleinFour\n\nLocal context:\n/-\nCopyright (c) 2023 Newell Jensen. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Newell Jensen\n-/\n/-!\n# Klein Four Group\n\nThe Klein (Vierergruppe) four-group is a non-cyclic abelian group with four elements, in which\neach element is self-inverse and in which composing any two of the three non-identity elements\nproduces the third one.\n\n## Main definitions\n\n* `IsKleinFour` : A mixin class which states that the group has order four and exponent two.\n* `mulEquiv'` : An equivalence between a Klein four-group and a group of exponent two which\n preserves the identity is in fact an isomorphism.\n* `mulEquiv`: Any two Klein four-groups are isomorphic via any identity-preserving equivalence.\n\n## References\n\n* https://en.wikipedia.org/wiki/Klein_four-group\n* https://en.wikipedia.org/wiki/Alternating_group\n\n## TODO\n\n* Prove an `IsKleinFour` group is isomorphic to the normal subgroup of `alternatingGroup (Fin 4)`\n with the permutation cycles `V = {(), (1 2)(3 4), (1 3)(2 4), (1 4)(2 3)}`. This is the kernel\n of the surjection of `alternatingGroup (Fin 4)` onto `alternatingGroup (Fin 3) ≃ (ZMod 3)`.\n In other words, we have the exact sequence `V → A₄ → A₃`.\n\n* The outer automorphism group of `A₆` is the Klein four-group `V = (ZMod 2) × (ZMod 2)`,\n and is related to the outer automorphism of `S₆`. The extra outer automorphism in `A₆`\n swaps the 3-cycles (like `(1 2 3)`) with elements of shape `3²` (like `(1 2 3)(4 5 6)`).\n\n## Tags\nnon-cyclic abelian group\n-/\n\n@[expose] public section\n\n/-! ### Klein four-groups as a mixin class -/\n\n/-- An (additive) Klein four-group is an (additive) group of cardinality four and exponent two. -/\nclass IsAddKleinFour (G : Type*) [AddGroup G] : Prop where\n card_four : Nat.card G = 4\n exponent_two : AddMonoid.exponent G = 2\n\n/-- A Klein four-group is a group of cardinality four and exponent two. -/\n@[to_additive existing IsAddKleinFour]\nclass IsKleinFour (G : Type*) [Group G] : Prop where\n card_four : Nat.card G = 4\n exponent_two : Monoid.exponent G = 2\n\nattribute [simp] IsKleinFour.card_four IsKleinFour.exponent_two\n IsAddKleinFour.card_four IsAddKleinFour.exponent_two\n\ninstance : IsAddKleinFour (ZMod 2 × ZMod 2) where\n card_four := by simp\n exponent_two := by simp [AddMonoid.exponent_prod]\n\ninstance {G : Type*} [Group G] [IsKleinFour G] : IsAddKleinFour (Additive G) where\n card_four := by rw [← IsKleinFour.card_four (G := G)]; congr!\n exponent_two := by simp\n\ninstance {G : Type*} [AddGroup G] [IsAddKleinFour G] : IsKleinFour (Multiplicative G) where\n card_four := by rw [← IsAddKleinFour.card_four (G := G)]; congr!\n exponent_two := by simp\n\nnamespace IsKleinFour\n\n@[to_additive]\ntheorem isMulCommutative {G : Type*} [Group G] [IsKleinFour G] :\n IsMulCommutative G where\n is_comm.comm := mul_comm_of_exponent_two exponent_two\n\n/-- This instance is scoped, because it always applies (which makes linting and typeclass inference\npotentially *a lot* slower). -/\n@[to_additive]\nscoped instance instFinite {G : Type*} [Group G] [IsKleinFour G] : Finite G :=\n Nat.finite_of_card_ne_zero <| by simp [IsKleinFour.card_four]\n\n@[to_additive (attr := simp)]\nlemma card_four' {G : Type*} [Group G] [Fintype G] [IsKleinFour G] :\n Fintype.card G = 4 :=\n Nat.card_eq_fintype_card (α := G).symm ▸ IsKleinFour.card_four\n\nopen Finset\n\nvariable {G : Type*} [Group G] [IsKleinFour G]\n\n@[to_additive]\nlemma not_isCyclic : ¬IsCyclic G :=\n fun h ↦ by simpa using h.exponent_eq_card\n\n@[to_additive]\nlemma inv_eq_self (x : G) : x⁻¹ = x := inv_eq_self_of_exponent_two (by simp) x\n\n/- this is not an appropriate global `simp` lemma for a `Prop`-mixin class. Indeed, if it were\nthen every time Lean sees `·⁻¹` it would try to apply `inv_eq_self` which would trigger\ntype class inference to try and synthesize an `IsKleinFour` instance. -/\nscoped[IsKleinFour] attribute [simp] inv_eq_self\nscoped[IsAddKleinFour] attribute [simp] neg_eq_self\n\n@[to_additive]\nlemma mul_self (x : G) : x * x = 1 := by\n rw [mul_eq_one_iff_eq_inv, inv_eq_self]\n\n@[to_additive]\n\nTarget:\nlemma eq_finset_univ [Fintype G] [DecidableEq G]\n {x y : G} (hx : x ≠ 1) (hy : y ≠ 1) (hxy : x ≠ y) : {x * y, x, y, (1 : G)} = Finset.univ :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/SpecificGroups","family_id":"eq_finset_univ","file_id":"mathlib/Mathlib/GroupTheory/SpecificGroups/KleinFour.lean","sample_id":"2c264d6adec184e75e8a764edc47b951a871ff4312cbef2af23ae57c61d62767"},"split":"validation"} {"binding":{"chosen_proof_sha256":"05d3ba4bdf879c10e8524f55b940e5b3ca48adfcb0a89235de0ee63b150243f4","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"47e718ddab9971af90c132b8bd624e6c6ba3e5c6fba0120662590ec43fca0801","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8f7ef0d7e323ddacd62136d0f1456b9736fef6e1c80e1e52e41af3ec24357a35","source_sha256":"6d31abda8202e7c1354edbb9de4059c0a40330c2a375465bbf58a648a338b5af","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← ListBlank.cons_head_tail l]\n induction l.tail using Quotient.inductionOn'\n rfl","hard_negative":true,"metrics":{"chosen_tokens":18,"rejected_tokens":2,"token_jaccard":0.0625,"token_length_ratio":0.111111},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"cc57b35c4e00fdad2135557766296ffebcdccd1983e3103210da03c52d8fac3d","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Logic.Function.Iterate\npublic import Mathlib.Tactic.ApplyFun\npublic import Mathlib.Data.List.GetD\npublic import Mathlib.Algebra.Group.Int.Defs\npublic import Mathlib.Algebra.Group.Nat.Defs\npublic import Mathlib.Data.List.Basic\n\nNamespace:\nTuring\n\nLocal context:\n/-\nCopyright (c) 2018 Mario Carneiro. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Mario Carneiro\n-/\n/-!\n# Turing machine tapes\n\nThis file defines the notion of a Turing machine tape, and the operations on it. A tape is a\nbidirectional infinite sequence of cells, each of which stores an element of a given alphabet `Γ`.\nAll but finitely many of the cells are required to hold the blank symbol `default : Γ`.\n\n## Main definitions\n\n* `ListBlank Γ` is the type of one-directional tapes with alphabet `Γ`. Implemented as a quotient\n of `List Γ` by extension by blanks at the end.\n* `Tape Γ` is the type of Turing machine tapes with alphabet `Γ`. Implemented as two\n `ListBlank Γ` instances, one for each direction, as well as a head symbol.\n\n-/\n\n@[expose] public section\n\nassert_not_exists MonoidWithZero\n\nopen Function (iterate_succ iterate_succ_apply iterate_zero_apply)\n\nnamespace Turing\n\nsection ListBlank\n\n/-- The `BlankExtends` partial order holds of `l₁` and `l₂` if `l₂` is obtained by adding\nblanks (`default : Γ`) to the end of `l₁`. -/\ndef BlankExtends {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop :=\n ∃ n, l₂ = l₁ ++ List.replicate n default\n\n@[refl]\ntheorem BlankExtends.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankExtends l l :=\n ⟨0, by simp⟩\n\n@[trans]\ntheorem BlankExtends.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} :\n BlankExtends l₁ l₂ → BlankExtends l₂ l₃ → BlankExtends l₁ l₃ := by\n rintro ⟨i, rfl⟩ ⟨j, rfl⟩\n exact ⟨i + j, by simp⟩\n\ntheorem BlankExtends.below_of_le {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} :\n BlankExtends l l₁ → BlankExtends l l₂ → l₁.length ≤ l₂.length → BlankExtends l₁ l₂ := by\n rintro ⟨i, rfl⟩ ⟨j, rfl⟩ h; use j - i\n simp only [List.length_append, Nat.add_le_add_iff_left, List.length_replicate] at h\n simp only [← List.replicate_add, Nat.add_sub_cancel' h, List.append_assoc]\n\n/-- Any two extensions by blank `l₁,l₂` of `l` have a common join (which can be taken to be the\nlonger of `l₁` and `l₂`). -/\ndef BlankExtends.above {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} (h₁ : BlankExtends l l₁)\n (h₂ : BlankExtends l l₂) : { l' // BlankExtends l₁ l' ∧ BlankExtends l₂ l' } :=\n if h : l₁.length ≤ l₂.length then ⟨l₂, h₁.below_of_le h₂ h, BlankExtends.refl _⟩\n else ⟨l₁, BlankExtends.refl _, h₂.below_of_le h₁ (le_of_not_ge h)⟩\n\ntheorem BlankExtends.above_of_le {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} :\n BlankExtends l₁ l → BlankExtends l₂ l → l₁.length ≤ l₂.length → BlankExtends l₁ l₂ := by\n rintro ⟨i, rfl⟩ ⟨j, e⟩ h; use i - j\n refine List.append_cancel_right (e.symm.trans ?_)\n rw [List.append_assoc, ← List.replicate_add, Nat.sub_add_cancel]\n apply_fun List.length at e\n simp only [List.length_append, List.length_replicate] at e\n rwa [← Nat.add_le_add_iff_left, e, Nat.add_le_add_iff_right]\n\n/-- `BlankRel` is the symmetric closure of `BlankExtends`, turning it into an equivalence\nrelation. Two lists are related by `BlankRel` if one extends the other by blanks. -/\ndef BlankRel {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop :=\n BlankExtends l₁ l₂ ∨ BlankExtends l₂ l₁\n\n@[refl]\ntheorem BlankRel.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankRel l l :=\n Or.inl (BlankExtends.refl _)\n\n@[symm]\ntheorem BlankRel.symm {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} : BlankRel l₁ l₂ → BlankRel l₂ l₁ :=\n Or.symm\n\n@[trans]\ntheorem BlankRel.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} :\n BlankRel l₁ l₂ → BlankRel l₂ l₃ → BlankRel l₁ l₃ := by\n grind [eq_def, BlankExtends.below_of_le, BlankExtends.above_of_le, BlankExtends.trans]\n\n/-- Given two `BlankRel` lists, there exists (constructively) a common join. -/\ndef BlankRel.above {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} (h : BlankRel l₁ l₂) :\n { l // BlankExtends l₁ l ∧ BlankExtends l₂ l } := by\n refine\n if hl : l₁.length ≤ l₂.length then ⟨l₂, Or.elim h id fun h' ↦ ?_, BlankExtends.refl _⟩\n else ⟨l₁, BlankExtends.refl _, Or.elim h (fun h' ↦ ?_) id⟩\n · exact (BlankExtends.refl _).above_of_le h' hl\n · exact (BlankExtends.refl _).above_of_le h' (le_of_not_ge hl)\n\n/-- Given two `BlankRel` lists, there exists (constructively) a common meet. -/\ndef BlankRel.below {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} (h : BlankRel l₁ l₂) :\n { l // BlankExtends l l₁ ∧ BlankExtends l l₂ } := by\n refine\n if hl : l₁.length ≤ l₂.length then ⟨l₁, BlankExtends.refl _, Or.elim h id fun h' ↦ ?_⟩\n else ⟨l₂, Or.elim h (fun h' ↦ ?_) id, BlankExtends.refl _⟩\n · exact (BlankExtends.refl _).above_of_le h' hl\n · exact (BlankExtends.refl _).above_of_le h' (le_of_not_ge hl)\n\ntheorem BlankRel.equivalence (Γ) [Inhabited Γ] : Equivalence (@BlankRel Γ _) :=\n ⟨BlankRel.refl, @BlankRel.symm _ _, @BlankRel.trans _ _⟩\n\n/-- Construct a setoid instance for `BlankRel`. -/\n@[implicit_reducible]\ndef BlankRel.setoid (Γ) [Inhabited Γ] : Setoid (List Γ) :=\n ⟨_, BlankRel.equivalence _⟩\n\n/-- A `ListBlank Γ` is a quotient of `List Γ` by extension by blanks at the end. This is used to\nrepresent half-tapes of a Turing machine, so that we can pretend that the list continues\ninfinitely with blanks. -/\ndef ListBlank (Γ) [Inhabited Γ] :=\n Quotient (BlankRel.setoid Γ)\n\ninstance ListBlank.inhabited {Γ} [Inhabited Γ] : Inhabited (ListBlank Γ) :=\n ⟨Quotient.mk'' []⟩\n\ninstance ListBlank.hasEmptyc {Γ} [Inhabited Γ] : EmptyCollection (ListBlank Γ) :=\n ⟨Quotient.mk'' []⟩\n\n/-- A modified version of `Quotient.liftOn'` specialized for `ListBlank`, with the stronger\nprecondition `BlankExtends` instead of `BlankRel`. -/\nprotected abbrev ListBlank.liftOn {Γ} [Inhabited Γ] {α} (l : ListBlank Γ) (f : List Γ → α)\n (H : ∀ a b, BlankExtends a b → f a = f b) : α :=\n l.liftOn' f <| by rintro a b (h | h) <;> [exact H _ _ h; exact (H _ _ h).symm]\n\n/-- The quotient map turning a `List` into a `ListBlank`. -/\ndef ListBlank.mk {Γ} [Inhabited Γ] : List Γ → ListBlank Γ :=\n Quotient.mk''\n\n@[elab_as_elim]\nprotected theorem ListBlank.induction_on {Γ} [Inhabited Γ] {p : ListBlank Γ → Prop}\n (q : ListBlank Γ) (h : ∀ a, p (ListBlank.mk a)) : p q :=\n Quotient.inductionOn' q h\n\n/-- The head of a `ListBlank` is well defined. -/\ndef ListBlank.head {Γ} [Inhabited Γ] (l : ListBlank Γ) : Γ := by\n apply l.liftOn List.headI\n rintro a _ ⟨i, rfl⟩\n cases a\n · cases i <;> rfl\n rfl\n\n@[simp]\ntheorem ListBlank.head_mk {Γ} [Inhabited Γ] (l : List Γ) :\n ListBlank.head (ListBlank.mk l) = l.headI :=\n rfl\n\n/-- The tail of a `ListBlank` is well defined (up to the tail of blanks). -/\ndef ListBlank.tail {Γ} [Inhabited Γ] (l : ListBlank Γ) : ListBlank Γ := by\n apply l.liftOn (fun l ↦ ListBlank.mk l.tail)\n rintro a _ ⟨i, rfl⟩\n refine Quotient.sound' (Or.inl ?_)\n cases a\n · rcases i with - | i <;> [exact ⟨0, rfl⟩; exact ⟨i, rfl⟩]\n exact ⟨i, rfl⟩\n\n@[simp]\ntheorem ListBlank.tail_mk {Γ} [Inhabited Γ] (l : List Γ) :\n ListBlank.tail (ListBlank.mk l) = ListBlank.mk l.tail :=\n rfl\n\n/-- We can cons an element onto a `ListBlank`. -/\ndef ListBlank.cons {Γ} [Inhabited Γ] (a : Γ) (l : ListBlank Γ) : ListBlank Γ := by\n apply l.liftOn (fun l ↦ ListBlank.mk (List.cons a l))\n rintro _ _ ⟨i, rfl⟩\n exact Quotient.sound' (Or.inl ⟨i, rfl⟩)\n\n@[simp]\ntheorem ListBlank.cons_mk {Γ} [Inhabited Γ] (a : Γ) (l : List Γ) :\n ListBlank.cons a (ListBlank.mk l) = ListBlank.mk (a :: l) :=\n rfl\n\n@[simp]\ntheorem ListBlank.head_cons {Γ} [Inhabited Γ] (a : Γ) : ∀ l : ListBlank Γ, (l.cons a).head = a :=\n Quotient.ind' fun _ ↦ rfl\n\n@[simp]\ntheorem ListBlank.tail_cons {Γ} [Inhabited Γ] (a : Γ) : ∀ l : ListBlank Γ, (l.cons a).tail = l :=\n Quotient.ind' fun _ ↦ rfl\n\n/-- The `cons` and `head`/`tail` functions are mutually inverse, unlike in the case of `List` where\nthis only holds for nonempty lists. -/\n@[simp]\ntheorem ListBlank.cons_head_tail {Γ} [Inhabited Γ] : ∀ l : ListBlank Γ, l.tail.cons l.head = l := by\n apply Quotient.ind'\n refine fun l ↦ Quotient.sound' (Or.inr ?_)\n cases l\n · exact ⟨1, rfl⟩\n · rfl\n\n/-- The `cons` and `head`/`tail` functions are mutually inverse, unlike in the case of `List` where\nthis only holds for nonempty lists. -/\ntheorem ListBlank.exists_cons {Γ} [Inhabited Γ] (l : ListBlank Γ) :\n ∃ a l', l = ListBlank.cons a l' :=\n ⟨_, _, (ListBlank.cons_head_tail _).symm⟩\n\n/-- The n-th element of a `ListBlank` is well defined for all `n : ℕ`, unlike in a `List`. -/\ndef ListBlank.nth {Γ} [Inhabited Γ] (l : ListBlank Γ) (n : ℕ) : Γ := by\n apply l.liftOn (fun l ↦ List.getI l n)\n rintro l _ ⟨i, rfl⟩\n rcases lt_or_ge n _ with h | h\n · rw [List.getI_append _ _ _ h]\n rw [List.getI_eq_default _ h]\n rcases le_or_gt _ n with h₂ | h₂\n · rw [List.getI_eq_default _ h₂]\n rw [List.getI_eq_getElem _ h₂, List.getElem_append_right h, List.getElem_replicate]\n\n@[simp]\ntheorem ListBlank.nth_mk {Γ} [Inhabited Γ] (l : List Γ) (n : ℕ) :\n (ListBlank.mk l).nth n = l.getI n :=\n rfl\n\n@[simp]\ntheorem ListBlank.nth_zero {Γ} [Inhabited Γ] (l : ListBlank Γ) : l.nth 0 = l.head := by\n rw [← ListBlank.cons_head_tail l]\n induction l.tail using Quotient.inductionOn'\n rfl\n\n@[simp]\n\nTarget:\ntheorem ListBlank.nth_succ {Γ} [Inhabited Γ] (l : ListBlank Γ) (n : ℕ) :\n l.nth (n + 1) = l.tail.nth n :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_8f7ef0d7e323","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"b7d0070d4f532a356a1aa252266575fb1c59f9d1f07b93699a9eff42af680948","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Computability/TuringMachine","family_id":"listblank","file_id":"mathlib/Mathlib/Computability/TuringMachine/Tape.lean","sample_id":"8f7ef0d7e323ddacd62136d0f1456b9736fef6e1c80e1e52e41af3ec24357a35"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c47e0ebd9f6d5941669301d043ad9d7f2bf52308746a9fc9bca91a3ebea452d6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0a083c52d8eabd0babc7fe1e3308ece32068cf4f999f3c6ca8e9b898ec6c1bbd","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"25ff82aa69b0c6934ee96e07b5dc1405bc1556a826dc0b6f3fe17c771346776f","source_sha256":"4a09e6ef672a691d9ce797abf5331ef80bdb460134e85a17438c693b4627f9d9","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let F (n : ℕ) : ℂ := if n = 0 then 0 else f n\n have hF₀ : F 0 = 0 := rfl\n have hF {n : ℕ} (hn : n ≠ 0) : F n = f n := if_neg hn\n have ha' : abscissaOfAbsConv F < ⊤ := (abscissaOfAbsConv_congr hF).symm ▸ ha\n simp_rw [← LSeries_congr hF]\n convert! LSeries.tendsto_cpow_mul_atTop (n := 0) (fun _ hm ↦ Nat.le_zero.mp hm ▸ hF₀) ha' using 1\n simp","hard_negative":false,"metrics":{"chosen_tokens":104,"rejected_tokens":109,"token_jaccard":0.929825,"token_length_ratio":1.048077},"negative_category":"markdown_preamble_trailing","negative_mode":"preamble","pair_id":"cc93985b5489cfe7c5828b091424c109dcee748ab3d63ff9b07b3d8392847c37","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Normed.Group.Tannery\npublic import Mathlib.NumberTheory.LSeries.Convergence\npublic import Mathlib.NumberTheory.LSeries.Linearity\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Michael Stoll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Michael Stoll\n-/\n/-!\n# A converging L-series determines its coefficients\n\nWe show that two functions `f` and `g : ℕ → ℂ` whose L-series agree and both converge somewhere\nmust agree on all nonzero arguments. See `LSeries_eq_iff_of_abscissaOfAbsConv_lt_top`\nand `LSeries_injOn`.\n-/\n\npublic section\n\nopen LSeries Complex\n\n-- The following two lemmas need both `LSeries.Linearity` and `LSeries.Convergence`,\n-- so cannot live in either of these files.\n\n/-- The abscissa of absolute convergence of `f + g` is at most the maximum of those\nof `f` and `g`. -/\nlemma LSeries.abscissaOfAbsConv_add_le (f g : ℕ → ℂ) :\n abscissaOfAbsConv (f + g) ≤ max (abscissaOfAbsConv f) (abscissaOfAbsConv g) :=\n abscissaOfAbsConv_binop_le LSeriesSummable.add f g\n\n/-- The abscissa of absolute convergence of `f - g` is at most the maximum of those\nof `f` and `g`. -/\nlemma LSeries.abscissaOfAbsConv_sub_le (f g : ℕ → ℂ) :\n abscissaOfAbsConv (f - g) ≤ max (abscissaOfAbsConv f) (abscissaOfAbsConv g) :=\n abscissaOfAbsConv_binop_le LSeriesSummable.sub f g\n\nprivate\nlemma cpow_mul_div_cpow_eq_div_div_cpow (m n : ℕ) (z : ℂ) (x : ℝ) :\n (n + 1) ^ (x : ℂ) * (z / m ^ (x : ℂ)) = z / (m / (n + 1)) ^ (x : ℂ) := by\n have Hn : (0 : ℝ) ≤ (n + 1 : ℝ)⁻¹ := by positivity\n rw [← mul_div_assoc, mul_comm, div_eq_mul_inv z, mul_div_assoc]\n congr\n simp_rw [div_eq_mul_inv]\n rw [show (n + 1 : ℂ)⁻¹ = (n + 1 : ℝ)⁻¹ by simp,\n show (n + 1 : ℂ) = (n + 1 : ℝ) by norm_cast, show (m : ℂ) = (m : ℝ) by norm_cast,\n mul_cpow_ofReal_nonneg m.cast_nonneg Hn, mul_inv, mul_comm]\n congr\n rw [← cpow_neg, show (-x : ℂ) = (-1 : ℝ) * x by simp, cpow_mul_ofReal_nonneg Hn,\n Real.rpow_neg_one, inv_inv]\n\nopen Filter Real in\n/-- If the coefficients `f m` of an L-series are zero for `m ≤ n` and the L-series converges\nat some point, then `f (n+1)` is the limit of `(n+1)^x * LSeries f x` as `x → ∞`. -/\nlemma LSeries.tendsto_cpow_mul_atTop {f : ℕ → ℂ} {n : ℕ} (h : ∀ m ≤ n, f m = 0)\n (ha : abscissaOfAbsConv f < ⊤) :\n Tendsto (fun x : ℝ ↦ (n + 1) ^ (x : ℂ) * LSeries f x) atTop (nhds (f (n + 1))) := by\n obtain ⟨y, hay, hyt⟩ := exists_between ha\n lift y to ℝ using ⟨hyt.ne, ((OrderBot.bot_le _).trans_lt hay).ne'⟩\n -- `F x m` is the `m`th term of `(n+1)^x * LSeries f x`, except that `F x (n+1) = 0`\n let F := fun (x : ℝ) ↦ {m | n + 1 < m}.indicator (fun m ↦ f m / (m / (n + 1) : ℂ) ^ (x : ℂ))\n have hF₀ (x : ℝ) {m : ℕ} (hm : m ≤ n + 1) : F x m = 0 := by simp [F, not_lt_of_ge hm]\n have hF (x : ℝ) {m : ℕ} (hm : m ≠ n + 1) : F x m = ((n + 1) ^ (x : ℂ)) * term f x m := by\n rcases lt_trichotomy m (n + 1) with H | rfl | H\n · simp [Nat.not_lt_of_gt H, term, h m <| Nat.lt_succ_iff.mp H, F]\n · exact (hm rfl).elim\n · simp [H, term, (n.zero_lt_succ.trans H).ne', F, cpow_mul_div_cpow_eq_div_div_cpow]\n have hs {x : ℝ} (hx : x ≥ y) : Summable fun m ↦ (n + 1) ^ (x : ℂ) * term f x m := by\n refine (summable_mul_left_iff <| natCast_add_one_cpow_ne_zero n _).mpr <|\n LSeriesSummable_of_abscissaOfAbsConv_lt_re ?_\n simpa only [ofReal_re] using hay.trans_le <| EReal.coe_le_coe_iff.mpr hx\n -- we can write `(n+1)^x * LSeries f x` as `f (n+1)` plus the series over `F x`\n have key : ∀ x ≥ y, (n + 1) ^ (x : ℂ) * LSeries f x = f (n + 1) + ∑' m : ℕ, F x m := by\n intro x hx\n rw [LSeries, ← tsum_mul_left, (hs hx).tsum_eq_add_tsum_ite (n + 1), pow_mul_term_eq f x n]\n congr\n ext1 m\n rcases eq_or_ne m (n + 1) with rfl | hm\n · simp [hF₀ x le_rfl]\n · simp [hm, hF]\n -- reduce to showing that `∑' m, F x m → 0` as `x → ∞`\n conv => enter [3, 1]; rw [← add_zero (f _)]\n refine Tendsto.congr'\n (eventuallyEq_of_mem (s := {x | y ≤ x}) (mem_atTop y) key).symm <| tendsto_const_nhds.add ?_\n -- get the prerequisites for applying dominated convergence\n have hys : Summable (F y) := by\n refine ((hs le_rfl).indicator {m | n + 1 < m}).congr fun m ↦ ?_\n by_cases! hm : n + 1 < m\n · simp [hF, hm, hm.ne']\n · simp [hm, hF₀ _ hm]\n have hc (k : ℕ) : Tendsto (F · k) atTop (nhds 0) := by\n rcases lt_or_ge (n + 1) k with H | H\n · have H₀ : (0 : ℝ) ≤ k / (n + 1) := by positivity\n have H₀' : (0 : ℝ) ≤ (n + 1) / k := by positivity\n have H₁ : (k / (n + 1) : ℂ) = (k / (n + 1) : ℝ) := by push_cast; rfl\n have H₂ : (n + 1) / k < (1 : ℝ) :=\n (div_lt_one <| mod_cast n.succ_pos.trans H).mpr <| mod_cast H\n simp only [Set.mem_setOf_eq, H, Set.indicator_of_mem, F]\n conv =>\n enter [1, x]\n rw [div_eq_mul_inv, H₁, ← ofReal_cpow H₀, ← ofReal_inv, ← Real.inv_rpow H₀, inv_div]\n conv => enter [3, 1]; rw [← mul_zero (f k)]\n exact\n (tendsto_rpow_atTop_of_base_lt_one _ (neg_one_lt_zero.trans_le H₀') H₂).ofReal.const_mul _\n · simp [hF₀ _ H]\n rw [show (0 : ℂ) = tsum (fun _ : ℕ ↦ 0) from tsum_zero.symm]\n refine tendsto_tsum_of_dominated_convergence hys.norm hc <| eventually_iff.mpr ?_\n filter_upwards [mem_atTop y] with y' hy' k\n -- it remains to show that `‖F y' k‖ ≤ ‖F y k‖` (for `y' ≥ y`)\n rcases lt_or_ge (n + 1) k with H | H\n · simp only [Set.mem_setOf_eq, H, Set.indicator_of_mem, norm_div, norm_cpow_real,\n Complex.norm_natCast, F]\n rw [← Nat.cast_one, ← Nat.cast_add, Complex.norm_natCast]\n have hkn : 1 ≤ (k / (n + 1 :) : ℝ) :=\n (one_le_div (by positivity)).mpr <| mod_cast Nat.le_of_succ_le H\n gcongr\n · simp [hF₀ _ H]\n\nopen Filter in\n/-- If the L-series of `f` converges at some point, then `f 1` is the limit of `LSeries f x`\nas `x → ∞`. -/\n\nTarget:\nlemma LSeries.tendsto_atTop {f : ℕ → ℂ} (ha : abscissaOfAbsConv f < ⊤) :\n Tendsto (fun x : ℝ ↦ LSeries f x) atTop (nhds (f 1)) :=\n\nProof body:\n","rejected":"Here is the proof:\nby\n let F (n : ℕ) : ℂ := if n = 0 then 0 else f n\n have hF₀ : F 0 = 0 := rfl\n have hF {n : ℕ} (hn : n ≠ 0) : F n = f n := if_neg hn\n have ha' : abscissaOfAbsConv F < ⊤ := (abscissaOfAbsConv_congr hF).symm ▸ ha\n simp_rw [← LSeries_congr hF]\n convert! LSeries.tendsto_cpow_mul_atTop (n := 0) (fun _ hm ↦ Nat.le_zero.mp hm ▸ hF₀) ha' using 1\n simp","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"NumberTheory/LSeries","family_id":"lseries","file_id":"mathlib/Mathlib/NumberTheory/LSeries/Injectivity.lean","sample_id":"25ff82aa69b0c6934ee96e07b5dc1405bc1556a826dc0b6f3fe17c771346776f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"7705d6eb19a9665f0206eeba301b6ce8e18e50335613523dc57f068240dd516d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"c34f306310edfad9ab85f28dd6a805e4bf0fcb55e44267f085d1a69e3cc49b66","source_sha256":"baf559ab5fd26edca1eca75118e019b5d41dddd237c03529db8e155c6d33c743","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let R := MvPolynomial σ F\n let K := FractionRing R\n refine ((rank_le_card _ _).trans ?_).antisymm ?_\n · rw [FractionRing.cardinalMk, MvPolynomial.cardinalMk_eq_max_lift]\n have hinj := IsFractionRing.injective R K\n have h1 := (IsScalarTower.toAlgHom F R K).toLinearMap.rank_le_of_injective hinj\n rw [MvPolynomial.rank_eq_lift, mk_finsupp_nat, lift_max, lift_aleph0, max_le_iff] at h1\n obtain ⟨i⟩ := ‹Nonempty σ›\n have hx : Transcendental F (algebraMap R K (MvPolynomial.X i)) :=\n (transcendental_algebraMap_iff hinj).2 (MvPolynomial.transcendental_X F i)\n have h2 := hx.linearIndependent_sub_inv.cardinal_lift_le_rank\n rw [lift_id'.{v, u}, lift_umax.{v, u}] at h2\n exact max_le (max_le h2 h1.1) h1.2","hard_negative":false,"metrics":{"chosen_tokens":158,"rejected_tokens":3,"token_jaccard":0.044776,"token_length_ratio":0.018987},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"cdb41173f0aae4c21f339c65da916d6a3537f345e86ee4128bf31edc525efa5c","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.MvPolynomial.Cardinal\npublic import Mathlib.RingTheory.Algebraic.LinearIndependent\npublic import Mathlib.RingTheory.Algebraic.MvPolynomial\npublic import Mathlib.RingTheory.Localization.Cardinality\npublic import Mathlib.RingTheory.MvPolynomial\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jz Pan. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jz Pan\n-/\n/-!\n# Rank of multivariate rational function field\n-/\n\npublic section\n\nnoncomputable section\n\nuniverse u v\n\nopen Cardinal in\n\nTarget:\ntheorem MvRatFunc.rank_eq_max_lift\n {σ : Type u} {F : Type v} [Field F] [Nonempty σ] :\n Module.rank F (FractionRing (MvPolynomial σ F)) = lift.{u} #F ⊔ lift.{v} #σ ⊔ ℵ₀ :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"FieldTheory/MvRatFunc","family_id":"mvratfunc","file_id":"mathlib/Mathlib/FieldTheory/MvRatFunc/Rank.lean","sample_id":"c34f306310edfad9ab85f28dd6a805e4bf0fcb55e44267f085d1a69e3cc49b66"},"split":"validation"} {"binding":{"chosen_proof_sha256":"d9fbb91c6cf19a5d7c3101a22a9bfd098220cfedac9ba2a5006ac14a37ec6f4a","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"bee59869686a54d0c4db441818900ea692d3c4753f7bcc6e222d76ddd513dbc0","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"12c743603b5e36875150136ef6aa3332ac038143c7463314c540e91c3f868901","source_sha256":"e92821624364f083ce763deaa881e12bdd2e9c0d50cfc1279362e04dab3593cf","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨m, hm⟩ := hp\n suffices ∃ a b : A, p ^ m * a + n * b = 1 by\n obtain ⟨a, b, h⟩ := this\n refine .of_mul_eq_one b ?_\n simpa [hm] using h\n refine ⟨(p ^ m).gcdA n, (p ^ m).gcdB n, ?_⟩\n norm_cast\n rw [← Nat.cast_one, ← Int.cast_natCast 1, ← (h.pow_left m).gcd_eq_one, Nat.gcd_eq_gcd_ab]","hard_negative":false,"metrics":{"chosen_tokens":101,"rejected_tokens":105,"token_jaccard":0.94,"token_length_ratio":1.039604},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"cef42a7ecb21ff085a9bc27f2daf68a726fa35c5913d84bf98c640ada04681a4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.CharP.Invertible\npublic import Mathlib.Data.Finset.NatAntidiagonal\npublic import Mathlib.Data.Nat.Choose.Basic\n\nNamespace:\nIsUnit\n\nLocal context:\n/-\nCopyright (c) 2025 Antoine Chambert-Loir, María Inés de Frutos-Fernández. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Antoine Chambert-Loir, María Inés de Frutos-Fernández\n-/\n/-!\n# Invertibility of factorials\n\nThis file contains lemmas providing sufficient conditions for the cast of `n!` to a (semi)ring `A`\nto be a unit.\n\n-/\n\npublic section\n\nnamespace IsUnit\n\nopen Nat\nsection Semiring\n\nvariable {A : Type*} [Semiring A]\n\ntheorem natCast_factorial_of_le {n : ℕ} (hn_fac : IsUnit (n ! : A))\n {m : ℕ} (hmn : m ≤ n) : IsUnit (m ! : A) := by\n obtain ⟨k, rfl⟩ := exists_add_of_le hmn\n clear hmn\n induction k generalizing m with\n | zero => simpa using hn_fac\n | succ k ih =>\n rw [← add_assoc, add_right_comm] at hn_fac\n have := ih hn_fac\n rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_commute _ _ |>.isUnit_mul_iff] at this\n exact this.2\n\ntheorem natCast_factorial_of_lt {n : ℕ} (hn_fac : IsUnit ((n - 1)! : A))\n {m : ℕ} (hmn : m < n) : IsUnit (m ! : A) :=\n hn_fac.natCast_factorial_of_le <| le_sub_one_of_lt hmn\n\n/-- If `A` is an algebra over a characteristic-zero (semi)field, then `n!` is a unit. -/\ntheorem natCast_factorial_of_algebra (K : Type*) [Semifield K] [CharZero K] [Algebra K A] (n : ℕ) :\n IsUnit (n ! : A) := by\n suffices IsUnit (n ! : K) by\n simpa using this.map (algebraMap K A)\n simp [isUnit_iff_ne_zero, n.factorial_ne_zero]\n\nend Semiring\n\nsection CharP\n\nvariable {A : Type*} [Ring A] (p : ℕ) [Fact (Nat.Prime p)] [CharP A p]\n\ntheorem natCast_factorial_iff_of_charP {n : ℕ} : IsUnit (n ! : A) ↔ n < p := by\n have hp : p.Prime := Fact.out\n induction n with\n | zero => simp [hp.pos]\n | succ n ih =>\n -- TODO: why is `.symm.symm` needed here!?\n rw [factorial_succ, cast_mul, Nat.cast_commute _ _ |>.isUnit_mul_iff, ih.symm.symm,\n ← Nat.add_one_le_iff, CharP.isUnit_natCast_iff hp]\n exact ⟨fun ⟨h1, h2⟩ ↦ lt_of_le_of_ne h2 (mt (· ▸ dvd_rfl) h1),\n fun h ↦ ⟨not_dvd_of_pos_of_lt (Nat.succ_pos _) h, h.le⟩⟩\n\nend CharP\n\nsection Nilpotent\n\nvariable {A : Type*} [CommRing A] {n p : ℕ} (hp : IsNilpotent (p : A))\ninclude hp\n\nTarget:\nlemma natCast_of_isNilpotent_of_coprime (h : p.Coprime n) :\n IsUnit (n : A) :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n obtain ⟨m, hm⟩ := hp\n suffices ∃ a b : A, p ^ m * a + n * b = 1 by\n obtain ⟨a, b, h⟩ := this\n refine .of_mul_eq_one b ?_\n simpa [hm] using h\n refine ⟨(p ^ m).gcdA n, (p ^ m).gcdB n, ?_⟩\n norm_cast\n rw [← Nat.cast_one, ← Int.cast_natCast 1, ← (h.pow_left m).gcd_eq_one, Nat.gcd_eq_gcd_ab]","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Nat","family_id":"natcast_of_isnilpotent_of_coprime","file_id":"mathlib/Mathlib/Data/Nat/Factorial/NatCast.lean","sample_id":"12c743603b5e36875150136ef6aa3332ac038143c7463314c540e91c3f868901"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b8941c02b0897c37b31620cc121225fb927353bbafa09db8fe3efcfc10020c86","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"084dfac048a127a79332bc112fe2f72333d8d2887a13c44a99cdfe63db896832","source_sha256":"13145f44ead8d985879a371c864031f8e21ad289ea2a17320dc811b9f8e0a0fb","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [isClosed_iff]\n intro F hF\n exact cl_cl _ ⟨F, hF, rfl⟩","hard_negative":true,"metrics":{"chosen_tokens":18,"rejected_tokens":8,"token_jaccard":0.047619,"token_length_ratio":0.444444},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"d0500f68b1a1b4e46129a9477b80f101c02a9292d1678b59062036a9187067e8","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Monad.Types\npublic import Mathlib.CategoryTheory.Monad.Limits\npublic import Mathlib.CategoryTheory.Equivalence\npublic import Mathlib.Topology.Category.CompHaus.Basic\npublic import Mathlib.Topology.Category.Profinite.Basic\npublic import Mathlib.Data.Set.Constructions\n\nNamespace:\nCompactum\n\nLocal context:\n/-\nCopyright (c) 2020 Adam Topaz. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Adam Topaz\n-/\n/-!\n\n# Compacta and Compact Hausdorff Spaces\n\nRecall that, given a monad `M` on `Type*`, an *algebra* for `M` consists of the following data:\n- A type `X : Type*`\n- A \"structure\" map `M X → X`.\n\nThis data must also satisfy a distributivity and unit axiom, and algebras for `M` form a category\nin an evident way.\n\nSee the file `Mathlib/CategoryTheory/Monad/Algebra.lean` for a general version, as well as the\nfollowing link.\nhttps://ncatlab.org/nlab/show/monad\n\nThis file proves the equivalence between the category of *compact Hausdorff topological spaces*\nand the category of algebras for the *ultrafilter monad*.\n\n## Notation:\n\nHere are the main objects introduced in this file.\n- `Compactum` is the type of compacta, which we define as algebras for the ultrafilter monad.\n- `compactumToCompHaus` is the functor `Compactum ⥤ CompHaus`. Here `CompHaus` is the usual\n category of compact Hausdorff spaces.\n- `compactumToCompHaus.isEquivalence` is a term of type `IsEquivalence compactumToCompHaus`.\n\nThe proof of this equivalence is a bit technical. But the idea is quite simply that the structure\nmap `Ultrafilter X → X` for an algebra `X` of the ultrafilter monad should be considered as the map\nsending an ultrafilter to its limit in `X`. The topology on `X` is then defined by mimicking the\ncharacterization of open sets in terms of ultrafilters.\n\nAny `X : Compactum` is endowed with a coercion to `Type*`, as well as the following instances:\n- `TopologicalSpace X`.\n- `CompactSpace X`.\n- `T2Space X`.\n\nAny morphism `f : X ⟶ Y` of is endowed with a coercion to a function `X → Y`, which is shown to\nbe continuous in `continuous_of_hom`.\n\nThe function `Compactum.ofTopologicalSpace` can be used to construct a `Compactum` from a\ntopological space which satisfies `CompactSpace` and `T2Space`.\n\nWe also add wrappers around structures which already exist. Here are the main ones, all in the\n`Compactum` namespace:\n\n- `forget : Compactum ⥤ Type*` is the forgetful functor, which induces a `ConcreteCategory`\n instance for `Compactum`.\n- `free : Type* ⥤ Compactum` is the left adjoint to `forget`, and the adjunction is in `adj`.\n- `str : Ultrafilter X → X` is the structure map for `X : Compactum`.\n The notation `X.str` is preferred.\n- `join : Ultrafilter (Ultrafilter X) → Ultrafilter X` is the monadic join for `X : Compactum`.\n Again, the notation `X.join` is preferred.\n- `incl : X → Ultrafilter X` is the unit for `X : Compactum`. The notation `X.incl` is preferred.\n\n## References\n\n- E. Manes, Algebraic Theories, Graduate Texts in Mathematics 26, Springer-Verlag, 1976.\n- https://ncatlab.org/nlab/show/ultrafilter\n\n-/\n\n@[expose] public section\n\nuniverse u\n\nopen CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter\nopen scoped Topology\n\nlocal notation \"β\" => ofTypeMonad Ultrafilter\n\n/-- The type `Compactum` of Compacta, defined as algebras for the ultrafilter monad. -/\ndef Compactum :=\n Monad.Algebra β deriving Category, Inhabited\n\nnamespace Compactum\n\n/-- The forgetful functor to TypeCat -/\ndef forget : Compactum ⥤ Type _ :=\n Monad.forget _\n\ninstance : forget.Faithful :=\n show (Monad.forget _).Faithful from inferInstance\n\nnoncomputable instance : CreatesLimits forget :=\n show CreatesLimits <| Monad.forget _ from inferInstance\n\n/-- The \"free\" Compactum functor. -/\ndef free : Type _ ⥤ Compactum :=\n Monad.free _\n\n/-- The adjunction between `free` and `forget`. -/\ndef adj : free ⊣ forget :=\n Monad.adj _\n\ninstance : CoeSort Compactum Type* :=\n ⟨fun X => X.A⟩\n\ninstance {X Y : Compactum} : FunLike (X ⟶ Y) X Y where\n coe f := f.f\n coe_injective _ _ h := (Monad.forget_faithful β).map_injective (by aesop)\n\n-- Basic instances\ninstance : ConcreteCategory Compactum (· ⟶ ·) where\n hom f := f\n ofHom f := f\n\ninstance : HasLimits Compactum :=\n hasLimits_of_hasLimits_createsLimits forget\n\n/-- The structure map for a compactum, essentially sending an ultrafilter to its limit. -/\ndef str (X : Compactum) : Ultrafilter X → X :=\n X.a\n\n/-- The monadic join. -/\ndef join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X :=\n (β).μ.app _\n\n/-- The inclusion of `X` into `Ultrafilter X`. -/\ndef incl (X : Compactum) : X → Ultrafilter X :=\n (β).η.app _\n\n@[simp]\ntheorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by\n change ((β).η.app _ ≫ X.a) _ = _\n rw [Monad.Algebra.unit]\n rfl\n\n@[simp]\ntheorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) :\n f (X.str xs) = Y.str (map f xs) := by\n change (X.a ≫ f.f) _ = _\n rw [← f.h]\n rfl\n\n@[simp]\ntheorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) :\n X.str (X.join uux) = X.str (map X.str uux) := by\n change ((β).μ.app _ ≫ X.a) _ = _\n rw [Monad.Algebra.assoc]\n rfl\n\ninstance {X : Compactum} : TopologicalSpace X where\n IsOpen U := ∀ F : Ultrafilter X, X.str F ∈ U → U ∈ F\n isOpen_univ _ _ := Filter.univ_sets _\n isOpen_inter _ _ h3 h4 _ h6 := Filter.inter_sets _ (h3 _ h6.1) (h4 _ h6.2)\n isOpen_sUnion := fun _ h1 _ ⟨T, hT, h2⟩ =>\n mem_of_superset (h1 T hT _ h2) (Set.subset_sUnion_of_mem hT)\n\ntheorem isClosed_iff {X : Compactum} (S : Set X) :\n IsClosed S ↔ ∀ F : Ultrafilter X, S ∈ F → X.str F ∈ S := by\n rw [← isOpen_compl_iff]\n constructor\n · intro cond F h\n by_contra c\n specialize cond F c\n rw [compl_mem_iff_notMem] at cond\n contradiction\n · intro h1 F h2\n specialize h1 F\n rcases F.mem_or_compl_mem S with h | h\n exacts [absurd (h1 h) h2, h]\n\ninstance {X : Compactum} : CompactSpace X := by\n constructor\n rw [isCompact_iff_ultrafilter_le_nhds]\n intro F _\n refine ⟨X.str F, by tauto, ?_⟩\n rw [le_nhds_iff]\n intro S h1 h2\n exact h2 F h1\n\n/-- A local definition used only in the proofs. -/\nprivate def basic {X : Compactum} (A : Set X) : Set (Ultrafilter X) :=\n { F | A ∈ F }\n\nset_option backward.privateInPublic true in\n/-- A local definition used only in the proofs. -/\nprivate def cl {X : Compactum} (A : Set X) : Set X :=\n X.str '' basic A\n\nprivate theorem basic_inter {X : Compactum} (A B : Set X) : basic (A ∩ B) = basic A ∩ basic B := by\n ext G\n constructor\n · intro hG\n constructor <;> filter_upwards [hG] with _\n exacts [And.left, And.right]\n · rintro ⟨h1, h2⟩\n exact inter_mem h1 h2\n\nprivate theorem subset_cl {X : Compactum} (A : Set X) : A ⊆ cl A := fun a ha =>\n ⟨X.incl a, ha, by simp⟩\n\nprivate theorem cl_cl {X : Compactum} (A : Set X) : cl (cl A) ⊆ cl A := by\n rintro _ ⟨F, hF, rfl⟩\n -- Notation to be used in this proof.\n let fsu := Finset (Set (Ultrafilter X))\n let ssu := Set (Set (Ultrafilter X))\n let ι : fsu → ssu := fun x ↦ ↑x\n let C0 : ssu := { Z | ∃ B ∈ F, X.str ⁻¹' B = Z }\n let AA := { G : Ultrafilter X | A ∈ G }\n let C1 := insert AA C0\n let C2 := finiteInterClosure C1\n -- C0 is closed under intersections.\n have claim1 : ∀ (B) (_ : B ∈ C0) (C) (_ : C ∈ C0), B ∩ C ∈ C0 := by\n rintro B ⟨Q, hQ, rfl⟩ C ⟨R, hR, rfl⟩\n use Q ∩ R\n simp only [and_true, Set.preimage_inter]\n exact inter_sets _ hQ hR\n -- All sets in C0 are nonempty.\n have claim2 : ∀ B ∈ C0, Set.Nonempty B := by\n rintro B ⟨Q, hQ, rfl⟩\n obtain ⟨q⟩ := Filter.nonempty_of_mem hQ\n use X.incl q\n simpa\n -- The intersection of AA with every set in C0 is nonempty.\n have claim3 : ∀ B ∈ C0, (AA ∩ B).Nonempty := by\n rintro B ⟨Q, hQ, rfl⟩\n have : (Q ∩ cl A).Nonempty := Filter.nonempty_of_mem (inter_mem hQ hF)\n rcases this with ⟨q, hq1, P, hq2, hq3⟩\n refine ⟨P, hq2, ?_⟩\n rw [← hq3] at hq1\n simpa\n -- Suffices to show that the intersection of any finite subcollection of C1 is nonempty.\n suffices ∀ T : fsu, ι T ⊆ C1 → (⋂₀ ι T).Nonempty by\n obtain ⟨G, h1⟩ := exists_ultrafilter_of_finite_inter_nonempty _ this\n use X.join G\n have : G.map X.str = F := Ultrafilter.coe_le_coe.1 fun S hS => h1 (Or.inr ⟨S, hS, rfl⟩)\n rw [join_distrib, this]\n exact ⟨h1 (Or.inl rfl), rfl⟩\n -- C2 is closed under finite intersections (by construction!).\n have claim4 := finiteInterClosure_finiteInter C1\n -- C0 is closed under finite intersections by claim1.\n have claim5 : FiniteInter C0 := ⟨⟨_, univ_mem, Set.preimage_univ⟩, claim1⟩\n -- Every element of C2 is nonempty.\n have claim6 : ∀ P ∈ C2, (P : Set (Ultrafilter X)).Nonempty := by\n suffices ∀ P ∈ C2, P ∈ C0 ∨ ∃ Q ∈ C0, P = AA ∩ Q by\n intro P hP\n rcases this P hP with h | h\n · exact claim2 _ h\n · rcases h with ⟨Q, hQ, rfl⟩\n exact claim3 _ hQ\n intro P hP\n exact claim5.finiteInterClosure_insert _ hP\n intro T hT\n -- Suffices to show that the intersection of the T's is contained in C2.\n suffices ⋂₀ ι T ∈ C2 by exact claim6 _ this\n -- Finish\n apply claim4.finiteInter_mem T\n intro t ht\n exact finiteInterClosure.basic (@hT t ht)\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n\nTarget:\ntheorem isClosed_cl {X : Compactum} (A : Set X) : IsClosed (cl A) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"2997e12fd10b434d2a8e73b2e516eabedcba0b4b0ab74715df34ee91d69319ca","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Category","family_id":"isclosed_cl","file_id":"mathlib/Mathlib/Topology/Category/Compactum.lean","sample_id":"084dfac048a127a79332bc112fe2f72333d8d2887a13c44a99cdfe63db896832"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f6c05bed3bd1dc1d35c7dcaf41a5b689d1f98e6093c3d8b8ddedbb3618871526","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"deab4978ab61ffa92fe0ea887bf9f48eb34e04fc641fbbe7de68cc3d78525e4a","source_sha256":"75ccbd34ea3edfdafe52ae0a8bd4f555b75dadeb010c82c074c4516aa0fe19cd","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have : Std.Symm fun x y ↦ ¬(x, y) ∈ R := { symm _ _ := mt R.symm }\n simpa [not_imp_not, IsSeparated] using pairwise_insert_of_symm (r := fun x y ↦ ¬(x, y) ∈ R)","hard_negative":false,"metrics":{"chosen_tokens":53,"rejected_tokens":3,"token_jaccard":0.03125,"token_length_ratio":0.056604},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"d25165cd849785ea113712a0e3aaef3ced6b8ca63317b1ce4b1ad4db9fb16fc1","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Set.Pairwise.Basic\npublic import Mathlib.Data.Rel\n\nNamespace:\nSetRel\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Uniform separation\n\nThis file defines a notion of separation of a set relative to a relation.\n\nFor a relation `R`, an `R`-separated set `s` is a set such that every pair of elements of `s` is\n`R`-unrelated.\n\nThe concept of uniformly separated sets is used to define two further notions of separation:\n* Metric separation: `Metric.IsSeparated`, defined using the small distance relation.\n* Dynamical nets: `Dynamics.IsDynNetIn`, defined using the dynamical relation.\n\n## TODO\n\n* Actually use `SetRel.IsSeparated` to define the above two notions.\n* Link to the notion of separation given by pairwise disjoint balls.\n-/\n\n@[expose] public section\n\nopen Set\n\nnamespace SetRel\nvariable {X : Type*} {R S : SetRel X X} {s t : Set X} {x : X}\n\n/-- Given a relation `R`, a set `s` is `R`-separated if its elements are pairwise `R`-unrelated from\neach other. -/\ndef IsSeparated (R : SetRel X X) (s : Set X) : Prop := s.Pairwise fun x y ↦ ¬ x ~[R] y\n\nprotected lemma IsSeparated.empty : IsSeparated R (∅ : Set X) := pairwise_empty _\nprotected lemma IsSeparated.singleton : IsSeparated R {x} := pairwise_singleton ..\n\n@[simp] lemma IsSeparated.of_subsingleton (hs : s.Subsingleton) : IsSeparated R s := hs.pairwise _\n\nalias _root_.Set.Subsingleton.relIsSeparated := IsSeparated.of_subsingleton\n\nnonrec lemma IsSeparated.mono_left (hUV : R ⊆ S) (hs : IsSeparated S s) : IsSeparated R s :=\n hs.mono' fun _x _y hxy h ↦ hxy <| hUV h\n\nlemma IsSeparated.mono_right (hst : s ⊆ t) (ht : IsSeparated R t) : IsSeparated R s := ht.mono hst\n\nlemma isSeparated_insert' :\n IsSeparated R (insert x s) ↔ IsSeparated R s ∧ (∀ y ∈ s, x ~[R] y → x = y) ∧\n ∀ y ∈ s, y ~[R] x → x = y := by\n simp [IsSeparated, pairwise_insert, not_imp_comm (a := _ = _), -not_and, forall_and]\n\nTarget:\nlemma isSeparated_insert [R.IsSymm] :\n IsSeparated R (insert x s) ↔ IsSeparated R s ∧ ∀ y ∈ s, x ~[R] y → x = y :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Rel","family_id":"isseparated_insert","file_id":"mathlib/Mathlib/Data/Rel/Separated.lean","sample_id":"deab4978ab61ffa92fe0ea887bf9f48eb34e04fc641fbbe7de68cc3d78525e4a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8340b6a2be8bea62ce51d3f93f0b2c0018f1ef116a48ffeacc6fbc881ea6020b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"47dae70e9e595cca187d319f3b678081f7e896f36039137fa9c94d64272257f2","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"3278737e23e1a514baf88c972adf0ba6ea67c348892b3828e35a3e686dbb455a","source_sha256":"1c117292ea35b4c69b7b89450ffaaab2429e40cafa2d7e856efd5b7f3baef936","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n cases H\n rfl","hard_negative":true,"metrics":{"chosen_tokens":4,"rejected_tokens":3,"token_jaccard":0.166667,"token_length_ratio":0.75},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"d2cf56730755a84715130f7d3e8936fac09feeaa0091d8df88331f8776ceadae","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Iso\npublic import Mathlib.CategoryTheory.Functor.Category\npublic import Mathlib.CategoryTheory.EqToHom\npublic import Mathlib.CategoryTheory.Products.Unitor\n\nNamespace:\nCategoryTheory.Comma\n\nLocal context:\n/-\nCopyright (c) 2018 Kim Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kim Morrison, Johan Commelin, Bhavik Mehta\n-/\n/-!\n# Comma categories\n\nA comma category is a construction in category theory, which builds a category out of two functors\nwith a common codomain. Specifically, for functors `L : A ⥤ T` and `R : B ⥤ T`, an object in\n`Comma L R` is a morphism `hom : L.obj left ⟶ R.obj right` for some objects `left : A` and\n`right : B`, and a morphism in `Comma L R` between `hom : L.obj left ⟶ R.obj right` and\n`hom' : L.obj left' ⟶ R.obj right'` is a commutative square\n\n```\nL.obj left ⟶ L.obj left'\n | |\n hom | | hom'\n ↓ ↓\nR.obj right ⟶ R.obj right',\n```\n\nwhere the top and bottom morphism come from morphisms `left ⟶ left'` and `right ⟶ right'`,\nrespectively.\n\n## Main definitions\n\n* `Comma L R`: the comma category of the functors `L` and `R`.\n* `Over X`: the over category of the object `X` (developed in `Over.lean`).\n* `Under X`: the under category of the object `X` (also developed in `Over.lean`).\n* `Arrow T`: the arrow category of the category `T` (developed in `Arrow.lean`).\n\n## References\n\n* \n\n## Tags\n\ncomma, slice, coslice, over, under, arrow\n-/\n\n@[expose] public section\n\nnamespace CategoryTheory\n\nopen Category\n\n-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation\nuniverse v₁ v₂ v₃ v₄ v₅ v₆ u₁ u₂ u₃ u₄ u₅ u₆\n\nvariable {A : Type u₁} [Category.{v₁} A]\nvariable {B : Type u₂} [Category.{v₂} B]\nvariable {T : Type u₃} [Category.{v₃} T]\nvariable {A' : Type u₄} [Category.{v₄} A']\nvariable {B' : Type u₅} [Category.{v₅} B']\nvariable {T' : Type u₆} [Category.{v₆} T']\n\n/-- The objects of the comma category are triples of an object `left : A`, an object\n`right : B` and a morphism `hom : L.obj left ⟶ R.obj right`. -/\n@[to_dual self (reorder := A B, 2 4, L R), wikidata Q1780005]\nstructure Comma (L : A ⥤ T) (R : B ⥤ T) : Type max u₁ u₂ v₃ where\n /-- The left subobject -/\n left : A\n /-- The right subobject -/\n right : B\n /-- A morphism from `L.obj left` to `R.obj right` -/\n hom : L.obj left ⟶ R.obj right\n\nset_option linter.translateOverwrite false\n\nattribute [to_dual existing right] Comma.left\nattribute [to_dual self] Comma.mk\n\n-- Satisfying the inhabited linter\ninstance Comma.inhabited [Inhabited T] : Inhabited (Comma (𝟭 T) (𝟭 T)) where\n default :=\n { left := default\n right := default\n hom := 𝟙 default }\n\nvariable {L : A ⥤ T} {R : B ⥤ T}\n\n/-- A morphism between two objects in the comma category is a commutative square connecting the\nmorphisms coming from the two objects using morphisms in the image of the functors `L` and `R`.\n-/\n@[ext, to_dual self (reorder := A B, 2 4, L R, X Y)]\nstructure CommaMorphism (X Y : Comma L R) where\n /-- Morphism on left objects -/\n left : X.left ⟶ Y.left\n /-- Morphism on right objects -/\n right : X.right ⟶ Y.right\n w : L.map left ≫ Y.hom = X.hom ≫ R.map right := by cat_disch\n\nattribute [to_dual existing right] CommaMorphism.left\n\nto_dual_name_hint Left Right, Fst Snd, L R, L₁ R₁, L₂ R₂, A B, F₁ F₂\n\n@[to_dual existing w]\ntheorem CommaMorphism.w' {X Y : Comma R L} (self : CommaMorphism Y X) :\n Y.hom ≫ L.map self.right = R.map self.left ≫ X.hom :=\n self.w.symm\n\n/-- `CommaMorphism.mk'` is the dual of `CommaMorphism.mk`, which we need for `to_dual`.\nPlease avoid using this directly. -/\n@[to_dual existing mk]\nabbrev CommaMorphism.mk' {X Y : Comma R L}\n (right : Y.right ⟶ X.right) (left : Y.left ⟶ X.left)\n (w : Y.hom ≫ L.map right = R.map left ≫ X.hom) :\n CommaMorphism Y X where\n left; right; w := w.symm\n\n-- Satisfying the inhabited linter\ninstance CommaMorphism.inhabited [Inhabited (Comma L R)] :\n Inhabited (CommaMorphism (default : Comma L R) default) :=\n ⟨{ left := 𝟙 _, right := 𝟙 _}⟩\n\nattribute [reassoc (attr := simp)] CommaMorphism.w\n\n@[to_dual self]\ninstance commaCategory : Category (Comma L R) where\n Hom X Y := CommaMorphism X Y\n id X :=\n { left := 𝟙 X.left\n right := 𝟙 X.right }\n comp f g :=\n { left := f.left ≫ g.left\n right := f.right ≫ g.right }\n\nnamespace Comma\n\nsection\n\nvariable {X Y Z : Comma L R} {f : X ⟶ Y} {g : Y ⟶ Z}\n\n@[ext, to_dual self (reorder := A B, 2 4, L R, X Y, h₁ h₂)]\nlemma hom_ext (f g : X ⟶ Y) (h₁ : f.left = g.left) (h₂ : f.right = g.right) : f = g :=\n CommaMorphism.ext h₁ h₂\n\n@[to_dual (attr := simp)]\ntheorem id_left : (𝟙 X : CommaMorphism X X).left = 𝟙 X.left :=\n rfl\n\n@[to_dual (attr := simp)]\ntheorem comp_left : (f ≫ g).left = f.left ≫ g.left :=\n rfl\n\nend\n\nvariable (L) (R)\n\n/-- The functor sending an object `X` in the comma category to `X.left`. -/\n@[to_dual (reorder := L R) (attr := simps)\n/-- The functor sending an object `X` in the comma category to `X.right`. -/]\ndef fst : Comma L R ⥤ A where\n obj X := X.left\n map f := f.left\n\nset_option linter.existingAttributeWarning false in\nattribute [to_dual existing] fst_map\n\nset_option backward.defeqAttrib.useBackward true in\n/-- We can interpret the commutative square constituting a morphism in the comma category as a\nnatural transformation between the functors `fst ⋙ L` and `snd ⋙ R` from the comma category\nto `T`, where the components are given by the morphism that constitutes an object of the comma\ncategory. -/\n@[simps, to_dual self]\ndef natTrans : fst L R ⋙ L ⟶ snd L R ⋙ R where app X := X.hom\n\n@[simp]\ntheorem eqToHom_left (X Y : Comma L R) (H : X = Y) :\n CommaMorphism.left (eqToHom H) = eqToHom (by cases H; rfl) := by\n cases H\n rfl\n\n@[simp]\n\nTarget:\ntheorem eqToHom_right (X Y : Comma L R) (H : X = Y) :\n CommaMorphism.right (eqToHom H) = eqToHom (by cases H; rfl) :=\n\nProof body:\n","rejected":"by\n exact eqToHom_right","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"b1f4c28508dd1fb675826ec2f00a7791a9296e36eae16d9c58d4c26ff162adc2","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Comma","family_id":"eqtohom_right","file_id":"mathlib/Mathlib/CategoryTheory/Comma/Basic.lean","sample_id":"3278737e23e1a514baf88c972adf0ba6ea67c348892b3828e35a3e686dbb455a"},"split":"validation"} {"binding":{"chosen_proof_sha256":"01f92c9eacb7d4aa63fca4672272c0a7bdd186716991c370961c3c5aaf86cdb5","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"5b09c1e40f111032eed4ff9ffa368424558ff9fbc576300b421d738170d70a49","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8fd6f7293f02dbb89a6618efc7ba6c6c13b13154fea5740b612d0f1380e951ea","source_sha256":"3faa405bdd543132812264268c6e4b51083d5c127ac14d512f81647196fa8418","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨n, hn⟩ := hp\n ext x\n obtain ⟨c, hc⟩ := (dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff x n)\n calc\n f x = f (x - ∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) + f (∑ (i ≤ n), teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i) := by simp\n _ = ∑ (i ≤ n), f (teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i))) * p ^ i := by rw [hc]; simp [pow_succ, hn]\n _ = ∑ (i ≤ n), g (teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i))) * p ^ i := by simp [h]\n _ = g (x - ∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) + g (∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) := by rw [hc]; simp [pow_succ, hn]\n _ = g x := by simp","hard_negative":false,"metrics":{"chosen_tokens":303,"rejected_tokens":307,"token_jaccard":0.934783,"token_length_ratio":1.013201},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"d53d045fa37e68f1c6e6b27f5f03f65da8feaa6682c29808863e7cedc07b2322","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.WittVector.Complete\npublic import Mathlib.RingTheory.WittVector.Teichmuller\n\nNamespace:\nWittVector\n\nLocal context:\n/-\nCopyright (c) 2025 Jiedong Jiang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jiedong Jiang\n-/\n/-!\n# Teichmuller Series\n\nLet `R` be a characteristic `p` perfect ring. In this file, we show that\nevery element `x` of the Witt vectors `𝕎 R` can be written as the\n(`p`-adic) summation of Teichmuller series, namely\n`∑ i, (teichmuller p\n (((frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i)`\n\n## Main theorems\n\n* `WittVector.dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff` : `p ^ (n + 1)` divides\n `x` minus the summation of the first `n + 1` terms of the Teichmuller series.\n* `WittVector.eq_of_apply_teichmuller_eq` : Given a ring `S` such that `p` is nilpotent in `S`\n and two ring maps `f g : 𝕎 R →+* S`, if they coincide on the teichmuller representatives,\n then they are equal.\n\n## TODO\nShow that the Teichmuller series is unique.\n-/\n\npublic section\n\nopen Ideal Quotient\nnamespace WittVector\n\nvariable {p : ℕ} [hp : Fact (Nat.Prime p)]\n\nlocal notation \"𝕎\" => WittVector p\n\nvariable {R : Type*} [CommRing R]\n\ntheorem sum_coeff_eq_coeff_sum {α : Type*} {S : Finset α} (x : α → 𝕎 R)\n (h : ∀ (n : ℕ), Subsingleton {r | r ∈ S ∧ (x r).coeff n ≠ 0}) (n : ℕ) :\n (∑ s ∈ S, x s).coeff n = ∑ (s ∈ S), (x s).coeff n := by\n classical\n induction S using Finset.induction generalizing n with\n | empty =>\n simp\n | insert a S' ha hind =>\n have : (∀ (n : ℕ), Subsingleton {r | r ∈ S' ∧ (x r).coeff n ≠ 0}) := by\n refine fun n ↦ ⟨fun b c ↦ ?_⟩\n ext\n exact congrArg (fun x ↦ x.1) <|\n (h n).allEq ⟨b.1, S'.subset_insert a b.2.1, b.2.2⟩ ⟨c.1, S'.subset_insert a c.2.1, c.2.2⟩\n replace hind := hind this\n simp only [ha, not_false_eq_true, Finset.sum_insert]\n have : ∀ (n : ℕ), (x a).coeff n = 0 ∨ (∑ s ∈ S', x s).coeff n = 0 := by\n simp only [hind]\n by_contra! ⟨m, hma, hmS'⟩\n have := Finset.sum_eq_zero.mt hmS'\n push Not at this\n choose b hb hb' using this\n have : a = b :=\n congrArg (fun x ↦ x.1) <|\n (h m).allEq ⟨a, S'.mem_insert_self a, hma⟩ ⟨b, S'.mem_insert_of_mem hb, hb'⟩\n exact ha (this ▸ hb)\n rw [coeff_add_of_disjoint n _ _ this, hind n]\n\nvariable [CharP R p]\n\n@[simp]\ntheorem teichmuller_mul_pow_coeff (n : ℕ) (x : R) :\n (teichmuller p x * p ^ n).coeff n = x ^ p ^ n := by\n simpa using WittVector.mul_pow_charP_coeff_succ (teichmuller p x) (m := 0)\n\ntheorem teichmuller_mul_pow_coeff_of_ne (x : R)\n {m n : ℕ} (h : m ≠ n) : (teichmuller p x * p ^ n).coeff m = 0 := by\n cases Nat.lt_or_lt_of_ne h with\n | inl h =>\n exact WittVector.mul_pow_charP_coeff_zero (teichmuller p x) h\n | inr h =>\n rw [← Nat.sub_add_cancel h.le, WittVector.mul_pow_charP_coeff_succ (teichmuller p x),\n WittVector.teichmuller_coeff_pos p x (m - n) (Nat.zero_lt_sub_of_lt h), zero_pow]\n simp [Nat.Prime.ne_zero Fact.out]\n\nvariable [PerfectRing R p]\n\n/--\n`p ^ (n + 1)` divides\n`x` minus the summation of the first `n + 1` terms of the Teichmuller series.\n-/\ntheorem dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff (x : 𝕎 R) (n : ℕ) :\n (p : 𝕎 R) ^ (n + 1) ∣ x - ∑ (i ≤ n), (teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i) := by\n rw [← Ideal.mem_span_singleton, mem_span_p_pow_iff_le_coeff_eq_zero,\n ← le_coeff_eq_iff_le_sub_coeff_eq_zero]\n intro i hi\n rw [WittVector.sum_coeff_eq_coeff_sum]\n · rw [Finset.sum_eq_add_sum_sdiff_singleton_of_mem (Finset.mem_Iic.mpr (Nat.lt_succ_iff.mp hi))]\n let g := fun x : ℕ ↦ (0 : R)\n rw [Finset.sum_congr rfl (g := g)]\n · simp [g]\n · intro b hb\n simp only [Finset.mem_sdiff, Finset.mem_Iic, Finset.mem_singleton] at hb\n exact teichmuller_mul_pow_coeff_of_ne _ (Ne.intro hb.2).symm\n · refine fun n ↦ ⟨fun ⟨a, _, ha⟩ ⟨b, _, hb⟩ ↦ ?_⟩\n ext\n dsimp only [ne_eq, Set.mem_setOf_eq]\n rw [← Not.imp_symm (teichmuller_mul_pow_coeff_of_ne _) ha]\n exact Not.imp_symm (teichmuller_mul_pow_coeff_of_ne _) hb\n\n/--\nGiven a ring `S` such that `p` is nilpotent in `S`\nand two ring maps `f g : 𝕎 R →+* S`, if they coincide on the teichmuller representatives,\nthen they are equal.\n-/\n\nTarget:\ntheorem eq_of_apply_teichmuller_eq\n {S : Type*} [CommRing S] (f g : 𝕎 R →+* S) (hp : IsNilpotent (p : S))\n (h : ∀ (x : R), f (teichmuller p x) = g (teichmuller p x)) : f = g :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n obtain ⟨n, hn⟩ := hp\n ext x\n obtain ⟨c, hc⟩ := (dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff x n)\n calc\n f x = f (x - ∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) + f (∑ (i ≤ n), teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i) := by simp\n _ = ∑ (i ≤ n), f (teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i))) * p ^ i := by rw [hc]; simp [pow_succ, hn]\n _ = ∑ (i ≤ n), g (teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i))) * p ^ i := by simp [h]\n _ = g (x - ∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) + g (∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) := by rw [hc]; simp [pow_succ, hn]\n _ = g x := by simp","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/WittVector","family_id":"eq_of_apply_teichmuller_eq","file_id":"mathlib/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean","sample_id":"8fd6f7293f02dbb89a6618efc7ba6c6c13b13154fea5740b612d0f1380e951ea"},"split":"validation"} {"binding":{"chosen_proof_sha256":"003c7137d8f39c95cfb963dbfb8ac5ad5441c59f308f866f4ef0c9c064fd613c","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"fb5d05e1c691263e6393a77e6911275e45ee8c79ddf11e44423f0af313684105","source_sha256":"524b5816b6e1293bba6fd67e900de566ae101a2425218c9665aa3b48d126279e","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine le_antisymm (fun m hm ↦ mem_eigenspace_iff.mpr ?_) (f.genEigenspace μ |>.mono ?_)\n · apply apply_eq_of_mem_of_comm_of_isFinitelySemisimple_of_isNil hm rfl hf\n simp\n · exact Order.one_le_iff_pos.mpr hk","hard_negative":false,"metrics":{"chosen_tokens":41,"rejected_tokens":2,"token_jaccard":0.032258,"token_length_ratio":0.04878},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"d54d7093e625b119f19178e3b63eac02f68b10b68ff4255156bb727afdd16ce4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Eigenspace.Basic\npublic import Mathlib.LinearAlgebra.Eigenspace.Triangularizable\npublic import Mathlib.LinearAlgebra.Semisimple\n\nNamespace:\nModule.End\n\nLocal context:\n/-\nCopyright (c) 2024 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Eigenspaces of semisimple linear endomorphisms\n\nThis file contains basic results relevant to the study of eigenspaces of semisimple linear\nendomorphisms.\n\n## Main definitions / results\n\n* `Module.End.IsFinitelySemisimple.genEigenspace_eq_eigenspace`: for a semisimple endomorphism,\n a generalized eigenspace is an eigenspace.\n* `Module.End.IsSemisimple.iSup_eigenspace_eq_top`: over an algebraically closed field,\n the eigenspaces of a semisimple endomorphism span the whole space.\n* `Module.End.IsSemisimple.eq_zero_iff_forall_eigenvalue`: a semisimple endomorphism over\n an algebraically closed field is zero iff all eigenvalues are zero.\n\n-/\n\npublic section\n\nopen Function Set\n\nnamespace Module.End\n\nvariable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] {f g : End R M}\n\nlemma apply_eq_of_mem_of_comm_of_isFinitelySemisimple_of_isNil\n {μ : R} {k : ℕ∞} {m : M} (hm : m ∈ f.genEigenspace μ k)\n (hfg : Commute f g) (hss : g.IsFinitelySemisimple) (hnil : IsNilpotent (f - g)) :\n g m = μ • m := by\n rw [f.mem_genEigenspace] at hm\n obtain ⟨l, -, hm⟩ := hm\n rw [← f.mem_genEigenspace_nat] at hm\n set p := f.genEigenspace μ l\n have h₁ : MapsTo g p p := mapsTo_genEigenspace_of_comm hfg μ l\n have h₂ : MapsTo (g - algebraMap R (End R M) μ) p p :=\n mapsTo_genEigenspace_of_comm (hfg.sub_right <| Algebra.commute_algebraMap_right μ f) μ l\n have h₃ : MapsTo (f - g) p p :=\n mapsTo_genEigenspace_of_comm (Commute.sub_right rfl hfg) μ l\n have h₄ : MapsTo (f - algebraMap R (End R M) μ) p p :=\n mapsTo_genEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ l\n replace hfg : Commute (f - algebraMap R (End R M) μ) (f - g) :=\n (Commute.sub_right rfl hfg).sub_left <| Algebra.commute_algebraMap_left μ (f - g)\n suffices IsNilpotent ((g - algebraMap R (End R M) μ).restrict h₂) by\n replace this : g.restrict h₁ - algebraMap R (End R p) μ = 0 :=\n eq_zero_of_isNilpotent_of_isFinitelySemisimple this (by simpa using hss.restrict _)\n simpa [LinearMap.restrict_apply, sub_eq_zero] using LinearMap.congr_fun this ⟨m, hm⟩\n simpa [LinearMap.restrict_sub h₄ h₃] using (LinearMap.restrict_commute hfg h₄ h₃).isNilpotent_sub\n (f.isNilpotent_restrict_sub_algebraMap μ l) (Module.End.isNilpotent.restrict h₃ hnil)\n\nTarget:\nlemma IsFinitelySemisimple.genEigenspace_eq_eigenspace\n (hf : f.IsFinitelySemisimple) (μ : R) {k : ℕ∞} (hk : 0 < k) :\n f.genEigenspace μ k = f.eigenspace μ :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Eigenspace","family_id":"isfinitelysemisimple","file_id":"mathlib/Mathlib/LinearAlgebra/Eigenspace/Semisimple.lean","sample_id":"fb5d05e1c691263e6393a77e6911275e45ee8c79ddf11e44423f0af313684105"},"split":"validation"} {"binding":{"chosen_proof_sha256":"038df626524d5df4a51b5f907a00c1c15cad051f72f5beeb3d7f6c9ae35b3917","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"f681ebeae95f04e21de4583a72badb0029b1f5b886262dbd3fe5ec3c4cf55ac5","source_sha256":"81f683fc149322018a098af754168365ec7fb0f23809135ec5dd229fe217bed2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine ⟨fun h ↦ ⟨inferInstance, inferInstance⟩, fun ⟨_, _⟩ ↦ ?_⟩\n apply isArtinian_of_range_eq_ker S.subtype S.mkQ\n rw [Submodule.ker_mkQ, Submodule.range_subtype]","hard_negative":false,"metrics":{"chosen_tokens":40,"rejected_tokens":3,"token_jaccard":0.083333,"token_length_ratio":0.075},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"d5ecc074c355e2401076ed49ac859a42cd7b3bb2f82e35bb4713687a9e4e1de4","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Units.Opposite\npublic import Mathlib.Algebra.Regular.Opposite\npublic import Mathlib.Data.SetLike.Fintype\npublic import Mathlib.LinearAlgebra.FreeModule.Finite.Basic\npublic import Mathlib.Order.Filter.EventuallyConst\npublic import Mathlib.RingTheory.Artinian.Defs\npublic import Mathlib.RingTheory.Ideal.Prod\npublic import Mathlib.RingTheory.Ideal.Quotient.Operations\npublic import Mathlib.RingTheory.Jacobson.Semiprimary\npublic import Mathlib.RingTheory.Nilpotent.Lemmas\npublic import Mathlib.RingTheory.Noetherian.Defs\npublic import Mathlib.RingTheory.Spectrum.Maximal.Basic\npublic import Mathlib.RingTheory.Spectrum.Prime.Basic\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Artinian rings and modules\n\nA module satisfying these equivalent conditions is said to be an *Artinian* R-module\nif every decreasing chain of submodules is eventually constant, or equivalently,\nif the relation `<` on submodules is well founded.\n\nA ring is said to be left (or right) Artinian if it is Artinian as a left (or right) module over\nitself, or simply Artinian if it is both left and right Artinian.\n\n## Main results\n\n* `IsArtinianRing.primeSpectrum_finite`, `IsArtinianRing.isMaximal_of_isPrime`: there are only\n finitely prime ideals in a commutative Artinian ring, and each of them is maximal.\n\n* `IsArtinianRing.equivPi`: a reduced commutative Artinian ring `R` is isomorphic to a finite\n product of fields (and therefore is a semisimple ring and a decomposition monoid; moreover\n `R[X]` is also a decomposition monoid).\n\n* `IsArtinian.isSemisimpleModule_iff_jacobson`: an Artinian module is semisimple\n iff its Jacobson radical is zero.\n\n* `instIsSemiprimaryRingOfIsArtinianRing`: an Artinian ring `R` is semiprimary, in particular\n the Jacobson radical of `R` is a nilpotent ideal (`IsArtinianRing.isNilpotent_jacobson_bot`).\n\n## References\n\n* [M. F. Atiyah and I. G. Macdonald, *Introduction to commutative algebra*][atiyah-macdonald]\n* [P. Samuel, *Algebraic Theory of Numbers*][samuel1967]\n\n## Tags\n\nArtinian, artinian, Artinian ring, Artinian module, artinian ring, artinian module\n\n-/\n\n@[expose] public section\n\nopen Set Filter Pointwise\n\nsection Semiring\n\nvariable {R M P N : Type*}\nvariable [Semiring R] [AddCommMonoid M] [AddCommMonoid P] [AddCommMonoid N]\nvariable [Module R M] [Module R P] [Module R N]\n\ntheorem LinearMap.isArtinian_iff_of_bijective {S P} [Semiring S] [AddCommMonoid P] [Module S P]\n {σ : R →+* S} [RingHomSurjective σ] (l : M →ₛₗ[σ] P) (hl : Function.Bijective l) :\n IsArtinian R M ↔ IsArtinian S P :=\n let e := Submodule.orderIsoMapComapOfBijective l hl\n ⟨fun _ ↦ e.symm.strictMono.wellFoundedLT, fun _ ↦ e.strictMono.wellFoundedLT⟩\n\ntheorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] :\n IsArtinian R M :=\n ⟨Subrelation.wf\n (fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB)\n (InvImage.wf (Submodule.map f) IsWellFounded.wf)⟩\n\ninstance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N :=\n isArtinian_of_injective N.subtype Subtype.val_injective\n\ntheorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s :=\n isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h)\n\nvariable (M) in\ntheorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] :\n IsArtinian R P :=\n ⟨Subrelation.wf\n (fun {A B} hAB =>\n show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB)\n (InvImage.wf (Submodule.comap f) IsWellFounded.wf)⟩\n\n/--\nIf `M` is an Artinian `R` module, and `S` is an `R`-algebra with a surjective\nalgebra map, then `M` is an Artinian `S` module.\n-/\ntheorem isArtinian_of_surjective_algebraMap {S : Type*} [CommSemiring S] [Algebra S R]\n [Module S M] [IsArtinian R M] [IsScalarTower S R M]\n (H : Function.Surjective (algebraMap S R)) : IsArtinian S M := by\n apply (OrderEmbedding.wellFoundedLT (β := Submodule R M))\n refine ⟨⟨?_, ?_⟩, ?_⟩\n · intro N\n refine { toAddSubmonoid := N.toAddSubmonoid, smul_mem' := ?_ }\n intro c x hx\n obtain ⟨r, rfl⟩ := H c\n suffices r • x ∈ N by simpa [Algebra.algebraMap_eq_smul_one, smul_assoc]\n apply N.smul_mem _ hx\n · intro N1 N2 h\n rwa [Submodule.ext_iff] at h ⊢\n · intro N1 N2\n rfl\n\ninstance isArtinian_range (f : M →ₗ[R] P) [IsArtinian R M] : IsArtinian R (LinearMap.range f) :=\n isArtinian_of_surjective _ _ f.surjective_rangeRestrict\n\ntheorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P :=\n isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective\n\ntheorem LinearEquiv.isArtinian_iff (f : M ≃ₗ[R] P) : IsArtinian R M ↔ IsArtinian R P :=\n ⟨fun _ ↦ isArtinian_of_linearEquiv f, fun _ ↦ isArtinian_of_linearEquiv f.symm⟩\n\n-- This was previously a global instance,\n-- but it doesn't appear to be used and has been implicated in slow typeclass resolutions.\nlemma isArtinian_of_finite [Finite M] : IsArtinian R M :=\n ⟨Finite.wellFounded_of_trans_of_irrefl _⟩\n\nopen Submodule\n\ntheorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [h : IsArtinian R M] {s : Set M}\n (hs : LinearIndependent R ((↑) : s → M)) : s.Finite :=\n WellFoundedLT.finite_of_iSupIndep hs.iSupIndep_span_singleton fun i _ ↦ hs.ne_zero i (by simp_all)\n\n/-- A module is Artinian iff every nonempty set of submodules has a minimal submodule among them. -/\ntheorem set_has_minimal_iff_artinian :\n (∀ a : Set <| Submodule R M, a.Nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬I < M') ↔ IsArtinian R M := by\n rw [isArtinian_iff, WellFounded.wellFounded_iff_has_min]\n\ntheorem IsArtinian.set_has_minimal [IsArtinian R M] (a : Set <| Submodule R M) (ha : a.Nonempty) :\n ∃ M' ∈ a, ∀ I ∈ a, ¬I < M' :=\n set_has_minimal_iff_artinian.mpr ‹_› a ha\n\n/-- A module is Artinian iff every decreasing chain of submodules stabilizes. -/\ntheorem monotone_stabilizes_iff_artinian :\n (∀ f : ℕ →o (Submodule R M)ᵒᵈ, ∃ n, ∀ m, n ≤ m → f n = f m) ↔ IsArtinian R M :=\n wellFoundedGT_iff_monotone_chain_condition.symm\n\nnamespace IsArtinian\n\nvariable [IsArtinian R M]\n\ntheorem monotone_stabilizes (f : ℕ →o (Submodule R M)ᵒᵈ) : ∃ n, ∀ m, n ≤ m → f n = f m :=\n monotone_stabilizes_iff_artinian.mpr ‹_› f\n\ntheorem eventuallyConst_of_isArtinian (f : ℕ →o (Submodule R M)ᵒᵈ) :\n atTop.EventuallyConst f := by\n simp_rw [eventuallyConst_atTop, eq_comm]\n exact monotone_stabilizes f\n\nopen Function\n\n/-- Any injective endomorphism of an Artinian module is surjective. -/\ntheorem surjective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Surjective f := by\n have h := ‹IsArtinian R M›; contrapose h\n rw [IsArtinian, WellFoundedLT, isWellFounded_iff]\n refine (RelEmbedding.natGT (LinearMap.range <| f ^ ·) ?_).not_wellFounded\n intro n\n simp_rw [pow_succ, Module.End.mul_eq_comp, LinearMap.range_comp, ← Submodule.map_top (f ^ n)]\n refine Submodule.map_strictMono_of_injective (Module.End.iterate_injective s n) (Ne.lt_top ?_)\n rwa [Ne, LinearMap.range_eq_top]\n\n/-- Any injective endomorphism of an Artinian module is bijective. -/\ntheorem bijective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Bijective f :=\n ⟨s, surjective_of_injective_endomorphism f s⟩\n\n/-- A sequence `f` of submodules of an Artinian module,\nwith the supremum `f (n+1)` and the infimum of `f 0`, ..., `f n` being ⊤,\nis eventually ⊤. -/\ntheorem disjoint_partial_infs_eventually_top (f : ℕ → Submodule R M)\n (h : ∀ n, Disjoint (partialSups (OrderDual.toDual ∘ f) n) (OrderDual.toDual (f (n + 1)))) :\n ∃ n : ℕ, ∀ m, n ≤ m → f m = ⊤ := by\n -- A little off-by-one cleanup first:\n rsuffices ⟨n, w⟩ : ∃ n : ℕ, ∀ m, n ≤ m → OrderDual.toDual f (m + 1) = ⊤\n · use n + 1\n rintro (_ | m) p\n · cases p\n · apply w\n exact Nat.succ_le_succ_iff.mp p\n obtain ⟨n, w⟩ := monotone_stabilizes (partialSups (OrderDual.toDual ∘ f))\n refine ⟨n, fun m p ↦ (h m).eq_bot_of_ge <| sup_eq_left.mp ?_⟩\n simpa only [partialSups_add_one] using! (w (m + 1) <| le_add_right p).symm.trans <| w m p\n\nend IsArtinian\n\nlemma IsArtinian.subsingleton_of_injective [IsArtinian R N] {f : P × N →ₗ[R] N}\n (inj : Function.Injective f) : Subsingleton P :=\n subsingleton_of_forall_eq 0 fun p ↦\n have ⟨_, eq⟩ := IsArtinian.surjective_of_injective_endomorphism (f ∘ₗ .inr ..)\n (inj.comp (Prod.mk_right_injective _)) (f (p, 0))\n congr($(inj eq).1).symm\n\nnamespace LinearMap\n\nvariable [IsArtinian R M]\n\nlemma eventually_iInf_range_pow_eq (f : Module.End R M) :\n ∀ᶠ n in atTop, ⨅ m, LinearMap.range (f ^ m) = LinearMap.range (f ^ n) := by\n obtain ⟨n, hn : ∀ m, n ≤ m → LinearMap.range (f ^ n) = LinearMap.range (f ^ m)⟩ :=\n IsArtinian.monotone_stabilizes f.iterateRange\n refine eventually_atTop.mpr ⟨n, fun l hl ↦ le_antisymm (iInf_le _ _) (le_iInf fun m ↦ ?_)⟩\n rcases le_or_gt l m with h | h\n · rw [← hn _ (hl.trans h), hn _ hl]\n · exact f.iterateRange.monotone h.le\n\nend LinearMap\n\nend Semiring\n\nsection Ring\n\nvariable {R M P N : Type*}\nvariable [Ring R] [AddCommGroup M] [AddCommGroup P] [AddCommGroup N]\nvariable [Module R M] [Module R P] [Module R N]\n\ninstance isArtinian_of_quotient_of_artinian\n (N : Submodule R M) [IsArtinian R M] : IsArtinian R (M ⧸ N) :=\n isArtinian_of_surjective M (Submodule.mkQ N) (Submodule.Quotient.mk_surjective N)\n\ntheorem isArtinian_of_range_eq_ker [IsArtinian R M] [IsArtinian R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P)\n (h : LinearMap.range f = LinearMap.ker g) : IsArtinian R N :=\n wellFounded_lt_exact_sequence (LinearMap.range f)\n (Submodule.map ((LinearMap.ker f).liftQ f le_rfl))\n (Submodule.comap ((LinearMap.ker f).liftQ f le_rfl))\n (Submodule.comap g.rangeRestrict) (Submodule.map g.rangeRestrict)\n (Submodule.gciMapComap <| LinearMap.ker_eq_bot.mp <| Submodule.ker_liftQ_eq_bot _ _ _ le_rfl)\n (Submodule.giMapComap g.surjective_rangeRestrict)\n (by simp [Submodule.map_comap_eq, inf_comm, Submodule.range_liftQ])\n (by simp [Submodule.comap_map_eq, h])\n\nTarget:\ntheorem isArtinian_iff_submodule_quotient (S : Submodule R P) :\n IsArtinian R P ↔ IsArtinian R S ∧ IsArtinian R (P ⧸ S) :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Artinian","family_id":"isartinian_iff_submodule_quotient","file_id":"mathlib/Mathlib/RingTheory/Artinian/Module.lean","sample_id":"f681ebeae95f04e21de4583a72badb0029b1f5b886262dbd3fe5ec3c4cf55ac5"},"split":"validation"} {"binding":{"chosen_proof_sha256":"01f92c9eacb7d4aa63fca4672272c0a7bdd186716991c370961c3c5aaf86cdb5","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d34bb21dfaf59856ace712fe97d070945c6fdd19d03edd85d829fe04df4f01eb","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8fd6f7293f02dbb89a6618efc7ba6c6c13b13154fea5740b612d0f1380e951ea","source_sha256":"3faa405bdd543132812264268c6e4b51083d5c127ac14d512f81647196fa8418","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨n, hn⟩ := hp\n ext x\n obtain ⟨c, hc⟩ := (dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff x n)\n calc\n f x = f (x - ∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) + f (∑ (i ≤ n), teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i) := by simp\n _ = ∑ (i ≤ n), f (teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i))) * p ^ i := by rw [hc]; simp [pow_succ, hn]\n _ = ∑ (i ≤ n), g (teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i))) * p ^ i := by simp [h]\n _ = g (x - ∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) + g (∑ (i ≤ n), teichmuller p (((_root_.frobeniusEquiv R p).symm ^ i)\n (x.coeff i)) * p ^ i) := by rw [hc]; simp [pow_succ, hn]\n _ = g x := by simp","hard_negative":true,"metrics":{"chosen_tokens":303,"rejected_tokens":3,"token_jaccard":0.022222,"token_length_ratio":0.009901},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"d602553faa649fcf326853fd51edb5a50908b7b1a3bf5dcc94a04fd8211defe9","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.WittVector.Complete\npublic import Mathlib.RingTheory.WittVector.Teichmuller\n\nNamespace:\nWittVector\n\nLocal context:\n/-\nCopyright (c) 2025 Jiedong Jiang. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jiedong Jiang\n-/\n/-!\n# Teichmuller Series\n\nLet `R` be a characteristic `p` perfect ring. In this file, we show that\nevery element `x` of the Witt vectors `𝕎 R` can be written as the\n(`p`-adic) summation of Teichmuller series, namely\n`∑ i, (teichmuller p\n (((frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i)`\n\n## Main theorems\n\n* `WittVector.dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff` : `p ^ (n + 1)` divides\n `x` minus the summation of the first `n + 1` terms of the Teichmuller series.\n* `WittVector.eq_of_apply_teichmuller_eq` : Given a ring `S` such that `p` is nilpotent in `S`\n and two ring maps `f g : 𝕎 R →+* S`, if they coincide on the teichmuller representatives,\n then they are equal.\n\n## TODO\nShow that the Teichmuller series is unique.\n-/\n\npublic section\n\nopen Ideal Quotient\nnamespace WittVector\n\nvariable {p : ℕ} [hp : Fact (Nat.Prime p)]\n\nlocal notation \"𝕎\" => WittVector p\n\nvariable {R : Type*} [CommRing R]\n\ntheorem sum_coeff_eq_coeff_sum {α : Type*} {S : Finset α} (x : α → 𝕎 R)\n (h : ∀ (n : ℕ), Subsingleton {r | r ∈ S ∧ (x r).coeff n ≠ 0}) (n : ℕ) :\n (∑ s ∈ S, x s).coeff n = ∑ (s ∈ S), (x s).coeff n := by\n classical\n induction S using Finset.induction generalizing n with\n | empty =>\n simp\n | insert a S' ha hind =>\n have : (∀ (n : ℕ), Subsingleton {r | r ∈ S' ∧ (x r).coeff n ≠ 0}) := by\n refine fun n ↦ ⟨fun b c ↦ ?_⟩\n ext\n exact congrArg (fun x ↦ x.1) <|\n (h n).allEq ⟨b.1, S'.subset_insert a b.2.1, b.2.2⟩ ⟨c.1, S'.subset_insert a c.2.1, c.2.2⟩\n replace hind := hind this\n simp only [ha, not_false_eq_true, Finset.sum_insert]\n have : ∀ (n : ℕ), (x a).coeff n = 0 ∨ (∑ s ∈ S', x s).coeff n = 0 := by\n simp only [hind]\n by_contra! ⟨m, hma, hmS'⟩\n have := Finset.sum_eq_zero.mt hmS'\n push Not at this\n choose b hb hb' using this\n have : a = b :=\n congrArg (fun x ↦ x.1) <|\n (h m).allEq ⟨a, S'.mem_insert_self a, hma⟩ ⟨b, S'.mem_insert_of_mem hb, hb'⟩\n exact ha (this ▸ hb)\n rw [coeff_add_of_disjoint n _ _ this, hind n]\n\nvariable [CharP R p]\n\n@[simp]\ntheorem teichmuller_mul_pow_coeff (n : ℕ) (x : R) :\n (teichmuller p x * p ^ n).coeff n = x ^ p ^ n := by\n simpa using WittVector.mul_pow_charP_coeff_succ (teichmuller p x) (m := 0)\n\ntheorem teichmuller_mul_pow_coeff_of_ne (x : R)\n {m n : ℕ} (h : m ≠ n) : (teichmuller p x * p ^ n).coeff m = 0 := by\n cases Nat.lt_or_lt_of_ne h with\n | inl h =>\n exact WittVector.mul_pow_charP_coeff_zero (teichmuller p x) h\n | inr h =>\n rw [← Nat.sub_add_cancel h.le, WittVector.mul_pow_charP_coeff_succ (teichmuller p x),\n WittVector.teichmuller_coeff_pos p x (m - n) (Nat.zero_lt_sub_of_lt h), zero_pow]\n simp [Nat.Prime.ne_zero Fact.out]\n\nvariable [PerfectRing R p]\n\n/--\n`p ^ (n + 1)` divides\n`x` minus the summation of the first `n + 1` terms of the Teichmuller series.\n-/\ntheorem dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff (x : 𝕎 R) (n : ℕ) :\n (p : 𝕎 R) ^ (n + 1) ∣ x - ∑ (i ≤ n), (teichmuller p\n (((_root_.frobeniusEquiv R p).symm ^ i) (x.coeff i)) * p ^ i) := by\n rw [← Ideal.mem_span_singleton, mem_span_p_pow_iff_le_coeff_eq_zero,\n ← le_coeff_eq_iff_le_sub_coeff_eq_zero]\n intro i hi\n rw [WittVector.sum_coeff_eq_coeff_sum]\n · rw [Finset.sum_eq_add_sum_sdiff_singleton_of_mem (Finset.mem_Iic.mpr (Nat.lt_succ_iff.mp hi))]\n let g := fun x : ℕ ↦ (0 : R)\n rw [Finset.sum_congr rfl (g := g)]\n · simp [g]\n · intro b hb\n simp only [Finset.mem_sdiff, Finset.mem_Iic, Finset.mem_singleton] at hb\n exact teichmuller_mul_pow_coeff_of_ne _ (Ne.intro hb.2).symm\n · refine fun n ↦ ⟨fun ⟨a, _, ha⟩ ⟨b, _, hb⟩ ↦ ?_⟩\n ext\n dsimp only [ne_eq, Set.mem_setOf_eq]\n rw [← Not.imp_symm (teichmuller_mul_pow_coeff_of_ne _) ha]\n exact Not.imp_symm (teichmuller_mul_pow_coeff_of_ne _) hb\n\n/--\nGiven a ring `S` such that `p` is nilpotent in `S`\nand two ring maps `f g : 𝕎 R →+* S`, if they coincide on the teichmuller representatives,\nthen they are equal.\n-/\n\nTarget:\ntheorem eq_of_apply_teichmuller_eq\n {S : Type*} [CommRing S] (f g : 𝕎 R →+* S) (hp : IsNilpotent (p : S))\n (h : ∀ (x : R), f (teichmuller p x) = g (teichmuller p x)) : f = g :=\n\nProof body:\n","rejected":"by\n exact eq_of_apply_teichmuller_eq","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"6f447a46d3081d3c40ed432c2f9624767b65165937af70ca9b943b2844e3c7a7","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/WittVector","family_id":"eq_of_apply_teichmuller_eq","file_id":"mathlib/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean","sample_id":"8fd6f7293f02dbb89a6618efc7ba6c6c13b13154fea5740b612d0f1380e951ea"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b83f8e53633557ef15104c4885ffde5051bcab86a979306f38a36ee85b75be6e","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"704efeeee592c3ee6480336bbb69c4f75dd795846a471cd26e230716ffdaed02","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"487f77b1863493c81889f1a380c67217647a0d5f1442c3add03b6ced0d3d199f","source_sha256":"4cbfaea4512194920684a45e4f0826b8ccc52fd008969fd599e2ede23bc90d0f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [continuous_iSup_dom]\n exact forall_congr' (fun i ↦ forall_congr'\n (fun f ↦ (by rw [continuous_coinduced_dom]; simp [equiv, Equiv.refl])))","hard_negative":false,"metrics":{"chosen_tokens":35,"rejected_tokens":3,"token_jaccard":0.086957,"token_length_ratio":0.085714},"negative_category":"by_exact_placeholder","negative_mode":"exact?","pair_id":"d6755690be1a419a4ef4c06697edc018c0d74815016307b9e44526ab9fabc040","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.ContinuousMap.Basic\n\nNamespace:\nTopology.WithGeneratedByTopology\n\nLocal context:\n/-\nCopyright (c) 2025 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou, Dagur Asgeirsson, Ben Eltschig\n-/\n/-!\n# The topology that is generated by a family of topological spaces\n\nLet `X : ι → Type u` be a family of topological spaces.\nLet `Y` be a topological space. We introduce a type synonym\n`WithGeneratedByTopology X Y` for `Y`. This type is endowed\nwith the `X`-generated topology, which is coinduced by\nall continuous maps `X i → Y`. When the bijection\n`WithGeneratedByTopology X Y ≃ Y` is a homeomorphism,\nwe say that `Y` is `X`-generated (typeclass `IsGeneratedBy X Y`).\n\n## TODO (@joelriou)\n* Redefine compactly generated spaces and delta generated spaces using\n these definitions\n* Define the category of `X`-generated spaces and show that it is coreflective in `TopCat`\n* Show that under suitable assumptions, the category of `X`-generated\n spaces is a closed cartesian monoidal category.\n\n## References\n* [Rainer M. Vogt, *Convenient categories of topological spaces\n for homotopy theory*][vogt-1971]\n* [Martín Escardó, Jimmie Lawson and Alex Simpson, *Comparing Cartesian closed\n categories of (core) compactly generated spaces*][escardo-lawson-simpson-2004]\n\n-/\n\n@[expose] public section\n\nuniverse v v' t u\n\nopen Topology\n\nvariable {ι : Type t} (X : ι → Type u) [∀ i, TopologicalSpace (X i)]\n {Y : Type v} [tY : TopologicalSpace Y] {Z : Type v'} [TopologicalSpace Z]\n\nnamespace TopologicalSpace\n\n/-- Given a family of topological spaces `X i`, the `X`-generated topology on\na topological space `Y` is the topology that is coinduced\nby all continuous maps `X i → Y`. -/\n@[implicit_reducible]\ndef generatedBy : TopologicalSpace Y :=\n ⨆ (i : ι) (f : C(X i, Y)), coinduced f inferInstance\n\n/-- The `X`-generated topology is also coinduced by a single map out of a sigma type. -/\nlemma generatedBy_eq_coinduced :\n generatedBy X (Y := Y) =\n coinduced (fun (x : (f : (i : ι) × C(X i, Y)) × X f.1) ↦ x.1.2 x.2) inferInstance := by\n rw [generatedBy, instTopologicalSpaceSigma, coinduced_iSup, iSup_sigma]\n rfl\n\nend TopologicalSpace\n\nvariable {X}\n\nnamespace Topology\n\n/-- Given a family of topological spaces `X i`, and a topological space `Y`,\nthis is a type synonym for `Y` which we endow with the `X`-generated topology. -/\n@[nolint unusedArguments]\ndef WithGeneratedByTopology (X : ι → Type u) [∀ i, TopologicalSpace (X i)]\n (Y : Type v) [TopologicalSpace Y] := Y\n\nnamespace WithGeneratedByTopology\n\n/-- The obvious bijection `WithGeneratedByTopology X Y ≃ Y`, where\nthe source is endowed with the `X`-generated topology. See `continuous_equiv`\nfor the continuity of `equiv`. The inverse map `equiv.symm` is continuous\niff `Y` is `X`-generated, see `isGeneratedBy_iff`. -/\ndef equiv : WithGeneratedByTopology X Y ≃ Y := Equiv.refl _\n\ninstance {Y : Type v} [TopologicalSpace Y] :\n TopologicalSpace (WithGeneratedByTopology X Y) :=\n -- fast_instance% .generatedBy X (Y := Y) fails\n letI : TopologicalSpace Y := .generatedBy X (Y := Y)\n inferInstanceAs <| TopologicalSpace Y\n\nset_option backward.isDefEq.respectTransparency false in\nlemma isOpen_iff {U : Set (WithGeneratedByTopology X Y)} :\n IsOpen U ↔ ∀ ⦃i : ι⦄ (f : C(X i, Y)), IsOpen (f ⁻¹' equiv.symm ⁻¹' U) := by\n simp [isOpen_iSup_iff, isOpen_coinduced, equiv, Equiv.refl]\n\nset_option backward.isDefEq.respectTransparency false in\nlemma isClosed_iff {U : Set (WithGeneratedByTopology X Y)} :\n IsClosed U ↔ ∀ ⦃i : ι⦄ (f : C(X i, Y)), IsClosed (f ⁻¹' equiv.symm ⁻¹' U) := by\n simp [isClosed_iSup_iff, isClosed_coinduced, equiv, Equiv.refl]\n\nset_option backward.isDefEq.respectTransparency false in\n\nTarget:\nlemma continuous_from_iff (g : WithGeneratedByTopology X Y → Z) :\n Continuous g ↔ ∀ ⦃i : ι⦄ (f : C(X i, Y)), Continuous (g ∘ equiv.symm ∘ f : X i → Z) :=\n\nProof body:\n","rejected":"by\n exact?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Convenient","family_id":"continuous_from_iff","file_id":"mathlib/Mathlib/Topology/Convenient/GeneratedBy.lean","sample_id":"487f77b1863493c81889f1a380c67217647a0d5f1442c3add03b6ced0d3d199f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"7fc150cba70fd1f39cbdb3da54128727f8df39f87f3628e56cd6f6a5fc598a65","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"2afa49ce6b78240bba90f3c180b3290c519f51f91dc59e6cbcb6280a13243d46","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"032cd4a88eadc0af270823b877fb79265f82359d0ee8ee691a580874518b3696","source_sha256":"7eafb57dc8a3d4503f110a5a562aa3213743b7948602bcad3d7f974c6a103b75","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [dense_iff_inter_open, inter_iUnion, nonempty_iUnion, ← image_inter_nonempty_iff]\n exact ⟨fun h _ h₁ h₂ _ h₃ h₄ ↦ h.1 h₃ h₄ h₁ h₂, fun h ↦ ⟨fun h₁ h₂ h₃ h₄ ↦ h h₃ h₄ _ h₁ h₂⟩⟩","hard_negative":true,"metrics":{"chosen_tokens":66,"rejected_tokens":3,"token_jaccard":0.08,"token_length_ratio":0.045455},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"d6e1dbacd939dc679d0509425acb07aa1255aedcb57a58e83761b5d3b163dacf","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Dynamics.Minimal\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2025 Daniel Figueroa. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Daniel Figueroa\n-/\n/-!\n# Topologically transitive monoid actions\n\nIn this file we define an action of a monoid `M` on a topological space `α` to be\n*topologically transitive* if for any pair of nonempty open sets `U` and `V` in `α` there exists an\n`m : M` such that `(m • U) ∩ V` is nonempty. We also provide an additive version of this definition\nand prove basic facts about topologically transitive actions.\n\n## Tags\n\ngroup action, topologically transitive\n-/\n\npublic section\n\n\nopen scoped Pointwise\n\n/-- An action of an additive monoid `M` on a topological space `α` is called\n*topologically transitive* if for any pair of nonempty open sets `U` and `V` in `α` there exists an\n`m : M` such that `(m +ᵥ U) ∩ V` is nonempty. -/\nclass AddAction.IsTopologicallyTransitive (M α : Type*) [AddMonoid M] [TopologicalSpace α]\n [AddAction M α] : Prop where\n exists_vadd_inter : ∀ {U V : Set α}, IsOpen U → U.Nonempty → IsOpen V → V.Nonempty →\n ∃ m : M, ((m +ᵥ U) ∩ V).Nonempty\n\n/-- An action of a monoid `M` on a topological space `α` is called *topologically transitive* if for\nany pair of nonempty open sets `U` and `V` in `α` there exists an `m : M` such that `(m • U) ∩ V` is\nnonempty. -/\n@[to_additive]\nclass MulAction.IsTopologicallyTransitive (M α : Type*) [Monoid M] [TopologicalSpace α]\n [MulAction M α] : Prop where\n exists_smul_inter : ∀ {U V : Set α}, IsOpen U → U.Nonempty → IsOpen V → V.Nonempty →\n ∃ m : M, ((m • U) ∩ V).Nonempty\n\nopen MulAction Set\n\nvariable (M : Type*) {α : Type*} [TopologicalSpace α] [Monoid M] [MulAction M α]\n\nsection IsTopologicallyTransitive\n\n@[to_additive]\ntheorem MulAction.isTopologicallyTransitive_iff :\n IsTopologicallyTransitive M α ↔ ∀ {U V : Set α}, IsOpen U → U.Nonempty → IsOpen V →\n V.Nonempty → ∃ m : M, ((m • U) ∩ V).Nonempty := ⟨fun h ↦ h.1, fun h ↦ ⟨h⟩⟩\n\n/-- An action of a monoid `M` on `α` is topologically transitive if and only if for any nonempty\nopen subset `U` of `α` the union over the elements of `M` of images of `U` is dense in `α`. -/\n@[to_additive /-- An action of an additive monoid `M` on `α` is topologically transitive if and only\nif for any nonempty open subset `U` of `α` the union over the elements of `M` of images of `U` is\ndense in `α`. -/]\ntheorem MulAction.isTopologicallyTransitive_iff_dense_iUnion :\n IsTopologicallyTransitive M α ↔\n ∀ {U : Set α}, IsOpen U → U.Nonempty → Dense (⋃ m : M, m • U) := by\n simp only [isTopologicallyTransitive_iff, inter_comm, dense_iff_inter_open, inter_iUnion,\n nonempty_iUnion]\n exact ⟨fun h _ h₁ h₂ _ h₃ h₄ ↦ h h₁ h₂ h₃ h₄, fun h _ _ h₁ h₂ h₃ h₄ ↦ h h₁ h₂ _ h₃ h₄⟩\n\n/-- An action of a monoid `M` on `α` is topologically transitive if and only if for any nonempty\nopen subset `U` of `α` the union of the preimages of `U` over the elements of `M` is dense in `α`.\n-/\n@[to_additive /-- An action of an additive monoid `M` on `α` is topologically transitive if and only\nif for any nonempty open subset `U` of `α` the union of the preimages of `U` over the elements of\n`M` is dense in `α`. -/]\n\nTarget:\ntheorem MulAction.isTopologicallyTransitive_iff_dense_iUnion_preimage :\n IsTopologicallyTransitive M α ↔\n ∀ {U : Set α}, IsOpen U → U.Nonempty → Dense (⋃ m : M, (m • ·) ⁻¹' U) :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_032cd4a88ead","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"5f2816554f711ee6f1d8cae5615cefafdc7c446f6c7366304632bcf0e0f5c939","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":true},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Dynamics","family_id":"mulaction","file_id":"mathlib/Mathlib/Dynamics/Transitive.lean","sample_id":"032cd4a88eadc0af270823b877fb79265f82359d0ee8ee691a580874518b3696"},"split":"validation"} {"binding":{"chosen_proof_sha256":"414dfd8713f03aa030cad377ecd27c0cf1b7c477f283b0f6317a8abed1f4232f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"f61ed008b6283d4c9614b116403e6954273771eb8cbd700f43f089c75227039f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"feb5fd7b4e023e54121cee437cf5d269c26e742bc4f204daf39fec6a945fa315","source_sha256":"81f683fc149322018a098af754168365ec7fb0f23809135ec5dd229fe217bed2","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n obtain ⟨n, hn : ∀ m, n ≤ m → LinearMap.range (f ^ n) = LinearMap.range (f ^ m)⟩ :=\n IsArtinian.monotone_stabilizes f.iterateRange\n refine eventually_atTop.mpr ⟨n, fun l hl ↦ le_antisymm (iInf_le _ _) (le_iInf fun m ↦ ?_)⟩\n rcases le_or_gt l m with h | h\n · rw [← hn _ (hl.trans h), hn _ hl]\n · exact f.iterateRange.monotone h.le","hard_negative":true,"metrics":{"chosen_tokens":100,"rejected_tokens":3,"token_jaccard":0.039216,"token_length_ratio":0.03},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"d776039cadcfc3bcdc83027a645ac0807ecaec4da9ba5b762fd4ec65d06f3111","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Units.Opposite\npublic import Mathlib.Algebra.Regular.Opposite\npublic import Mathlib.Data.SetLike.Fintype\npublic import Mathlib.LinearAlgebra.FreeModule.Finite.Basic\npublic import Mathlib.Order.Filter.EventuallyConst\npublic import Mathlib.RingTheory.Artinian.Defs\npublic import Mathlib.RingTheory.Ideal.Prod\npublic import Mathlib.RingTheory.Ideal.Quotient.Operations\npublic import Mathlib.RingTheory.Jacobson.Semiprimary\npublic import Mathlib.RingTheory.Nilpotent.Lemmas\npublic import Mathlib.RingTheory.Noetherian.Defs\npublic import Mathlib.RingTheory.Spectrum.Maximal.Basic\npublic import Mathlib.RingTheory.Spectrum.Prime.Basic\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\nCopyright (c) 2021 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Artinian rings and modules\n\nA module satisfying these equivalent conditions is said to be an *Artinian* R-module\nif every decreasing chain of submodules is eventually constant, or equivalently,\nif the relation `<` on submodules is well founded.\n\nA ring is said to be left (or right) Artinian if it is Artinian as a left (or right) module over\nitself, or simply Artinian if it is both left and right Artinian.\n\n## Main results\n\n* `IsArtinianRing.primeSpectrum_finite`, `IsArtinianRing.isMaximal_of_isPrime`: there are only\n finitely prime ideals in a commutative Artinian ring, and each of them is maximal.\n\n* `IsArtinianRing.equivPi`: a reduced commutative Artinian ring `R` is isomorphic to a finite\n product of fields (and therefore is a semisimple ring and a decomposition monoid; moreover\n `R[X]` is also a decomposition monoid).\n\n* `IsArtinian.isSemisimpleModule_iff_jacobson`: an Artinian module is semisimple\n iff its Jacobson radical is zero.\n\n* `instIsSemiprimaryRingOfIsArtinianRing`: an Artinian ring `R` is semiprimary, in particular\n the Jacobson radical of `R` is a nilpotent ideal (`IsArtinianRing.isNilpotent_jacobson_bot`).\n\n## References\n\n* [M. F. Atiyah and I. G. Macdonald, *Introduction to commutative algebra*][atiyah-macdonald]\n* [P. Samuel, *Algebraic Theory of Numbers*][samuel1967]\n\n## Tags\n\nArtinian, artinian, Artinian ring, Artinian module, artinian ring, artinian module\n\n-/\n\n@[expose] public section\n\nopen Set Filter Pointwise\n\nsection Semiring\n\nvariable {R M P N : Type*}\nvariable [Semiring R] [AddCommMonoid M] [AddCommMonoid P] [AddCommMonoid N]\nvariable [Module R M] [Module R P] [Module R N]\n\ntheorem LinearMap.isArtinian_iff_of_bijective {S P} [Semiring S] [AddCommMonoid P] [Module S P]\n {σ : R →+* S} [RingHomSurjective σ] (l : M →ₛₗ[σ] P) (hl : Function.Bijective l) :\n IsArtinian R M ↔ IsArtinian S P :=\n let e := Submodule.orderIsoMapComapOfBijective l hl\n ⟨fun _ ↦ e.symm.strictMono.wellFoundedLT, fun _ ↦ e.strictMono.wellFoundedLT⟩\n\ntheorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] :\n IsArtinian R M :=\n ⟨Subrelation.wf\n (fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB)\n (InvImage.wf (Submodule.map f) IsWellFounded.wf)⟩\n\ninstance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N :=\n isArtinian_of_injective N.subtype Subtype.val_injective\n\ntheorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s :=\n isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h)\n\nvariable (M) in\ntheorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] :\n IsArtinian R P :=\n ⟨Subrelation.wf\n (fun {A B} hAB =>\n show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB)\n (InvImage.wf (Submodule.comap f) IsWellFounded.wf)⟩\n\n/--\nIf `M` is an Artinian `R` module, and `S` is an `R`-algebra with a surjective\nalgebra map, then `M` is an Artinian `S` module.\n-/\ntheorem isArtinian_of_surjective_algebraMap {S : Type*} [CommSemiring S] [Algebra S R]\n [Module S M] [IsArtinian R M] [IsScalarTower S R M]\n (H : Function.Surjective (algebraMap S R)) : IsArtinian S M := by\n apply (OrderEmbedding.wellFoundedLT (β := Submodule R M))\n refine ⟨⟨?_, ?_⟩, ?_⟩\n · intro N\n refine { toAddSubmonoid := N.toAddSubmonoid, smul_mem' := ?_ }\n intro c x hx\n obtain ⟨r, rfl⟩ := H c\n suffices r • x ∈ N by simpa [Algebra.algebraMap_eq_smul_one, smul_assoc]\n apply N.smul_mem _ hx\n · intro N1 N2 h\n rwa [Submodule.ext_iff] at h ⊢\n · intro N1 N2\n rfl\n\ninstance isArtinian_range (f : M →ₗ[R] P) [IsArtinian R M] : IsArtinian R (LinearMap.range f) :=\n isArtinian_of_surjective _ _ f.surjective_rangeRestrict\n\ntheorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P :=\n isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective\n\ntheorem LinearEquiv.isArtinian_iff (f : M ≃ₗ[R] P) : IsArtinian R M ↔ IsArtinian R P :=\n ⟨fun _ ↦ isArtinian_of_linearEquiv f, fun _ ↦ isArtinian_of_linearEquiv f.symm⟩\n\n-- This was previously a global instance,\n-- but it doesn't appear to be used and has been implicated in slow typeclass resolutions.\nlemma isArtinian_of_finite [Finite M] : IsArtinian R M :=\n ⟨Finite.wellFounded_of_trans_of_irrefl _⟩\n\nopen Submodule\n\ntheorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [h : IsArtinian R M] {s : Set M}\n (hs : LinearIndependent R ((↑) : s → M)) : s.Finite :=\n WellFoundedLT.finite_of_iSupIndep hs.iSupIndep_span_singleton fun i _ ↦ hs.ne_zero i (by simp_all)\n\n/-- A module is Artinian iff every nonempty set of submodules has a minimal submodule among them. -/\ntheorem set_has_minimal_iff_artinian :\n (∀ a : Set <| Submodule R M, a.Nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬I < M') ↔ IsArtinian R M := by\n rw [isArtinian_iff, WellFounded.wellFounded_iff_has_min]\n\ntheorem IsArtinian.set_has_minimal [IsArtinian R M] (a : Set <| Submodule R M) (ha : a.Nonempty) :\n ∃ M' ∈ a, ∀ I ∈ a, ¬I < M' :=\n set_has_minimal_iff_artinian.mpr ‹_› a ha\n\n/-- A module is Artinian iff every decreasing chain of submodules stabilizes. -/\ntheorem monotone_stabilizes_iff_artinian :\n (∀ f : ℕ →o (Submodule R M)ᵒᵈ, ∃ n, ∀ m, n ≤ m → f n = f m) ↔ IsArtinian R M :=\n wellFoundedGT_iff_monotone_chain_condition.symm\n\nnamespace IsArtinian\n\nvariable [IsArtinian R M]\n\ntheorem monotone_stabilizes (f : ℕ →o (Submodule R M)ᵒᵈ) : ∃ n, ∀ m, n ≤ m → f n = f m :=\n monotone_stabilizes_iff_artinian.mpr ‹_› f\n\ntheorem eventuallyConst_of_isArtinian (f : ℕ →o (Submodule R M)ᵒᵈ) :\n atTop.EventuallyConst f := by\n simp_rw [eventuallyConst_atTop, eq_comm]\n exact monotone_stabilizes f\n\nopen Function\n\n/-- Any injective endomorphism of an Artinian module is surjective. -/\ntheorem surjective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Surjective f := by\n have h := ‹IsArtinian R M›; contrapose h\n rw [IsArtinian, WellFoundedLT, isWellFounded_iff]\n refine (RelEmbedding.natGT (LinearMap.range <| f ^ ·) ?_).not_wellFounded\n intro n\n simp_rw [pow_succ, Module.End.mul_eq_comp, LinearMap.range_comp, ← Submodule.map_top (f ^ n)]\n refine Submodule.map_strictMono_of_injective (Module.End.iterate_injective s n) (Ne.lt_top ?_)\n rwa [Ne, LinearMap.range_eq_top]\n\n/-- Any injective endomorphism of an Artinian module is bijective. -/\ntheorem bijective_of_injective_endomorphism (f : M →ₗ[R] M) (s : Injective f) : Bijective f :=\n ⟨s, surjective_of_injective_endomorphism f s⟩\n\n/-- A sequence `f` of submodules of an Artinian module,\nwith the supremum `f (n+1)` and the infimum of `f 0`, ..., `f n` being ⊤,\nis eventually ⊤. -/\ntheorem disjoint_partial_infs_eventually_top (f : ℕ → Submodule R M)\n (h : ∀ n, Disjoint (partialSups (OrderDual.toDual ∘ f) n) (OrderDual.toDual (f (n + 1)))) :\n ∃ n : ℕ, ∀ m, n ≤ m → f m = ⊤ := by\n -- A little off-by-one cleanup first:\n rsuffices ⟨n, w⟩ : ∃ n : ℕ, ∀ m, n ≤ m → OrderDual.toDual f (m + 1) = ⊤\n · use n + 1\n rintro (_ | m) p\n · cases p\n · apply w\n exact Nat.succ_le_succ_iff.mp p\n obtain ⟨n, w⟩ := monotone_stabilizes (partialSups (OrderDual.toDual ∘ f))\n refine ⟨n, fun m p ↦ (h m).eq_bot_of_ge <| sup_eq_left.mp ?_⟩\n simpa only [partialSups_add_one] using! (w (m + 1) <| le_add_right p).symm.trans <| w m p\n\nend IsArtinian\n\nlemma IsArtinian.subsingleton_of_injective [IsArtinian R N] {f : P × N →ₗ[R] N}\n (inj : Function.Injective f) : Subsingleton P :=\n subsingleton_of_forall_eq 0 fun p ↦\n have ⟨_, eq⟩ := IsArtinian.surjective_of_injective_endomorphism (f ∘ₗ .inr ..)\n (inj.comp (Prod.mk_right_injective _)) (f (p, 0))\n congr($(inj eq).1).symm\n\nnamespace LinearMap\n\nvariable [IsArtinian R M]\n\nTarget:\nlemma eventually_iInf_range_pow_eq (f : Module.End R M) :\n ∀ᶠ n in atTop, ⨅ m, LinearMap.range (f ^ m) = LinearMap.range (f ^ n) :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_feb5fd7b4e02","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"f1f6563e57e455e615619a443867b59522f7e835950a00ccca33627a9e318216","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Artinian","family_id":"eventually_iinf_range_pow_eq","file_id":"mathlib/Mathlib/RingTheory/Artinian/Module.lean","sample_id":"feb5fd7b4e023e54121cee437cf5d269c26e742bc4f204daf39fec6a945fa315"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f30b6b70ea73c803c2832616e5d9eb45020f66252ef17a3f00d8dbf888e5e9f2","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"4f38efc652675510d252427c33f89a7d0d852a04e6d88ea4945c1482e15f30d4","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"57596c7226016462a23949e6ea93a54316af2221967ae24cad1a25b185f92483","source_sha256":"167cae25a064b15f836022f0441997349a236bd699ca87bcd93cf532b794529a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let b := chooseBasis R M₁\n rw [← LinearMap.charpoly_toMatrix φ b, ← LinearMap.charpoly_toMatrix (e.conj φ) (b.map e)]\n congr 1\n ext i j : 1\n simp [LinearMap.toMatrix]","hard_negative":true,"metrics":{"chosen_tokens":47,"rejected_tokens":3,"token_jaccard":0.03125,"token_length_ratio":0.06383},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"d782d43e793001949ad51837c810add1a91a9fd87fe4dd9c1a9f9629f6266db3","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Charpoly.Basic\npublic import Mathlib.LinearAlgebra.Matrix.Basis\npublic import Mathlib.RingTheory.Finiteness.Prod\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Riccardo Brasca. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Riccardo Brasca\n-/\n/-!\n\n# Characteristic polynomial\n\n## Main result\n\n* `LinearMap.charpoly_toMatrix f` : `charpoly f` is the characteristic polynomial of the matrix\n of `f` in any basis.\n\n-/\n\npublic section\n\nnoncomputable section\n\nopen Module Free Polynomial Matrix\n\nuniverse u v w\n\nvariable {R M M₁ M₂ : Type*} [CommRing R]\nvariable [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M]\nvariable [AddCommGroup M₁] [Module R M₁] [Module.Finite R M₁] [Module.Free R M₁]\nvariable [AddCommGroup M₂] [Module R M₂] [Module.Finite R M₂] [Module.Free R M₂]\nvariable (f : M →ₗ[R] M)\n\nnamespace LinearMap\n\nsection Basic\n\n/-- `charpoly f` is the characteristic polynomial of the matrix of `f` in any basis. -/\n@[simp]\ntheorem charpoly_toMatrix {ι : Type w} [DecidableEq ι] [Fintype ι] (b : Basis ι R M) :\n (toMatrix b b f).charpoly = f.charpoly := by\n nontriviality R\n unfold LinearMap.charpoly\n set b' := chooseBasis R M\n rw [← basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix b b' b b']\n set P := b.toMatrix b'\n set A := toMatrix b' b' f\n set Q := b'.toMatrix b\n let e := Basis.indexEquiv b b'\n let ι' := ChooseBasisIndex R M\n let φ := reindexLinearEquiv R R e e\n let φ₁ := reindexLinearEquiv R R e (Equiv.refl ι')\n let φ₂ := reindexLinearEquiv R R (Equiv.refl ι') (Equiv.refl ι')\n let φ₃ := reindexLinearEquiv R R (Equiv.refl ι') e\n calc\n (P * A * Q).charpoly = (φ (P * A * Q)).charpoly := (charpoly_reindex ..).symm\n _ = (φ₁ P * φ₂ A * φ₃ Q).charpoly := by rw [reindexLinearEquiv_mul, reindexLinearEquiv_mul]\n _ = A.charpoly := by rw [charpoly_mul_comm, ← mul_assoc]; simp [P, Q, φ₁, φ₂, φ₃]\n\nlemma charpoly_prodMap (f₁ : M₁ →ₗ[R] M₁) (f₂ : M₂ →ₗ[R] M₂) :\n (f₁.prodMap f₂).charpoly = f₁.charpoly * f₂.charpoly := by\n let b₁ := chooseBasis R M₁\n let b₂ := chooseBasis R M₂\n let b := b₁.prod b₂\n rw [← charpoly_toMatrix f₁ b₁, ← charpoly_toMatrix f₂ b₂, ← charpoly_toMatrix (f₁.prodMap f₂) b,\n toMatrix_prodMap b₁ b₂ f₁ f₂, Matrix.charpoly_fromBlocks_zero₁₂]\n\nend Basic\n\nend LinearMap\n\n@[simp]\n\nTarget:\nlemma LinearEquiv.charpoly_conj (e : M₁ ≃ₗ[R] M₂) (φ : Module.End R M₁) :\n (e.conj φ).charpoly = φ.charpoly :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_57596c722601","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"365759ed4d38a2ee3c40df88c1c692a559599c1ef1b14e1289c3620469850ea7","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Charpoly","family_id":"linearequiv","file_id":"mathlib/Mathlib/LinearAlgebra/Charpoly/ToMatrix.lean","sample_id":"57596c7226016462a23949e6ea93a54316af2221967ae24cad1a25b185f92483"},"split":"validation"} {"binding":{"chosen_proof_sha256":"ac4cef73e43e9d1cfba0acc787526dd60d60008c4d9916b90723478cab31821b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6c9cd48db3e33f0f06205b16c0012fed43f1add114169b08312bd202aa6e82e3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"b7e943a04bd53cb46b6eae75a9fee412935e361167923416781176c986ca628e","source_sha256":"b72e89b384020496bbd8393293edd2656c420f581416551d6887740dc5903234","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n refine (isDedekindFiniteMonoid_iff _).trans ⟨fun h x y z hxz hyz ↦ ?_, fun h x y eq ↦ ?_⟩\n · simpa [mul_assoc, h hyz] using congr_arg (· * y) hxz\n have := h _ (1 - y * x + x) _ eq <| by\n rw [add_mul, sub_mul, mul_assoc, eq, one_mul, mul_one, sub_self, zero_add]\n rwa [right_eq_add, sub_eq_zero, eq_comm] at this","hard_negative":true,"metrics":{"chosen_tokens":91,"rejected_tokens":2,"token_jaccard":0.02,"token_length_ratio":0.021978},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"d79f4758a80ba7e956be6da88a38e452237845cca5f78fedfac4e2cbcdbe0118","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Basic\npublic import Mathlib.Algebra.GroupWithZero.Regular\npublic import Mathlib.Algebra.Ring.Defs\n\nNamespace:\nIsDedekindFiniteMonoid\n\nLocal context:\n/-\nCopyright (c) 2014 Jeremy Avigad. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Yury Kudryashov, Neil Strickland\n-/\n/-!\n# Lemmas about regular elements in rings.\n-/\n\npublic section\n\n\nvariable {α : Type*}\n\n/-- Left `Mul` by a `k : α` over `[Ring α]` is injective, if `k` is not a zero divisor.\nThe typeclass that restricts all terms of `α` to have this property is `NoZeroDivisors`. -/\ntheorem isLeftRegular_of_non_zero_divisor [NonUnitalNonAssocRing α] (k : α)\n (h : ∀ x : α, k * x = 0 → x = 0) : IsLeftRegular k := by\n refine fun x y (h' : k * x = k * y) => sub_eq_zero.mp (h _ ?_)\n rw [mul_sub, sub_eq_zero, h']\n\n/-- Right `Mul` by a `k : α` over `[Ring α]` is injective, if `k` is not a zero divisor.\nThe typeclass that restricts all terms of `α` to have this property is `NoZeroDivisors`. -/\ntheorem isRightRegular_of_non_zero_divisor [NonUnitalNonAssocRing α] (k : α)\n (h : ∀ x : α, x * k = 0 → x = 0) : IsRightRegular k := by\n refine fun x y (h' : x * k = y * k) => sub_eq_zero.mp (h _ ?_)\n rw [sub_mul, sub_eq_zero, h']\n\ntheorem IsRegular.of_ne_zero' [NonUnitalNonAssocRing α] [NoZeroDivisors α] {k : α} (hk : k ≠ 0) :\n IsRegular k :=\n ⟨isLeftRegular_of_non_zero_divisor k fun _ h =>\n (NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h).resolve_left hk,\n isRightRegular_of_non_zero_divisor k fun _ h =>\n (NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h).resolve_right hk⟩\n\n@[deprecated (since := \"2026-01-21\")] alias isRegular_of_ne_zero' := IsRegular.of_ne_zero'\n\ntheorem isRegular_iff_ne_zero' [Nontrivial α] [NonUnitalNonAssocRing α] [NoZeroDivisors α]\n {k : α} : IsRegular k ↔ k ≠ 0 :=\n ⟨fun h => by\n rintro rfl\n exact not_not.mpr h.left not_isLeftRegular_zero, .of_ne_zero'⟩\n\n/-- A ring with no zero divisors is a cancellative `MonoidWithZero`.\n\nNote this is not an instance as it forms a typeclass loop. -/\nlemma NoZeroDivisors.toIsCancelMulZero [NonUnitalNonAssocRing α] [NoZeroDivisors α] :\n IsCancelMulZero α where\n mul_left_cancel_of_ne_zero ha := (IsRegular.of_ne_zero' ha).1\n mul_right_cancel_of_ne_zero hb := (IsRegular.of_ne_zero' hb).2\n\nnamespace IsDedekindFiniteMonoid\n\nvariable [Ring α]\n\n/-- A ring is Dedekind-finite if and only if every element has at most one right inverse. -/\ntheorem iff_eq_of_mul_left_eq_one :\n IsDedekindFiniteMonoid α ↔ ∀ x y z : α, x * y = 1 → x * z = 1 → y = z := by\n refine (isDedekindFiniteMonoid_iff _).trans ⟨fun h x y z hxy hxz ↦ ?_, fun h x y eq ↦ ?_⟩\n · simpa [← mul_assoc, h hxz] using congr_arg (z * ·) hxy\n have := h _ _ (1 - y * x + y) eq <| by\n rw [mul_add, mul_sub, ← mul_assoc, eq, mul_one, one_mul, sub_self, zero_add]\n rwa [right_eq_add, sub_eq_zero, eq_comm] at this\n\n/-- A ring is Dedekind-finite if and only if every element has at most one left inverse. -/\n\nTarget:\ntheorem iff_eq_of_mul_right_eq_one :\n IsDedekindFiniteMonoid α ↔ ∀ x y z : α, x * z = 1 → y * z = 1 → x = y :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_b7e943a04bd5","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"20a01c52d7dfa5d324adce2dc6b6a4500325df77123bb391414e662408b6d7f6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/Ring","family_id":"iff_eq_of_mul_right_eq_one","file_id":"mathlib/Mathlib/Algebra/Ring/Regular.lean","sample_id":"b7e943a04bd53cb46b6eae75a9fee412935e361167923416781176c986ca628e"},"split":"validation"} {"binding":{"chosen_proof_sha256":"a480604e686ac85bbb8ba2d21f5c762b31805a73ad58401b0a0dd1b6b9facdfc","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"6a0f03b458ed50734a3025d61af53351276c215c38aa315f74b586dfa99d0d93","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"29af87114d75888b1dfc659c3ad79f3eb2dadaa919600b6183181e8fe8177aae","source_sha256":"2d1ca9408fcd1765e9d2dc833c7f4cbefad14ad1a3c169f30ede2989831b39df","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [le_minOrder]\n refine ⟨fun h s hs hs' ↦ ?_, fun h a ha ha' ↦ ?_⟩\n · obtain ⟨a, has, ha⟩ := s.bot_or_exists_ne_one.resolve_left hs\n exact\n (h ha <| finite_zpowers.1 <| hs'.subset <| zpowers_le.2 has).trans\n (WithTop.coe_le_coe.2 <| s.orderOf_le_card hs' has)\n · simpa using h (zpowers_ne_bot.2 ha) ha'.finite_zpowers","hard_negative":false,"metrics":{"chosen_tokens":91,"rejected_tokens":2,"token_jaccard":0.045455,"token_length_ratio":0.021978},"negative_category":"by_exact_placeholder","negative_mode":"by?","pair_id":"d7c1a27fbb4e3aeb2ba4bd00e78e02e4264769b23f71fd7bde8a4f40939b5e12","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Torsion\npublic import Mathlib.Data.ENat.Lattice\npublic import Mathlib.Data.ZMod.QuotientGroup\n\nNamespace:\nMonoid\n\nLocal context:\n/-\nCopyright (c) 2023 Yaël Dillies. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies\n-/\n/-!\n# Minimum order of an element\n\nThis file defines the minimum order of an element of a monoid.\n\n## Main declarations\n\n* `Monoid.minOrder`: The minimum order of an element of a given monoid.\n* `Monoid.minOrder_eq_top`: The minimum order is infinite iff the monoid is torsion-free.\n* `ZMod.minOrder`: The minimum order of $ℤ/nℤ$ is the smallest factor of `n`, unless `n = 0, 1`.\n-/\n\n@[expose] public section\n\nopen Subgroup\n\nvariable {G α : Type*}\n\nnamespace Monoid\nsection Monoid\nvariable (α) [Monoid α]\n\n/-- The minimum order of a non-identity element. Also the minimum size of a nontrivial subgroup, see\n`Monoid.le_minOrder_iff_forall_subgroup`. Returns `∞` if the monoid is torsion-free. -/\n@[to_additive /-- The minimum order of a non-identity element. Also the minimum size of a nontrivial\nsubgroup, see `AddMonoid.le_minOrder_iff_forall_addSubgroup`. Returns `∞` if the monoid is\ntorsion-free. -/]\nnoncomputable def minOrder : ℕ∞ := ⨅ (a : α) (_ha : a ≠ 1) (_ha' : IsOfFinOrder a), orderOf a\n\nvariable {α} {a : α}\n\n@[to_additive (attr := simp)]\nlemma le_minOrder {n : ℕ∞} :\n n ≤ minOrder α ↔ ∀ ⦃a : α⦄, a ≠ 1 → IsOfFinOrder a → n ≤ orderOf a := by simp [minOrder]\n\n@[to_additive]\nlemma minOrder_le_orderOf (ha : a ≠ 1) (ha' : IsOfFinOrder a) : minOrder α ≤ orderOf a :=\n le_minOrder.1 le_rfl ha ha'\n\nend Monoid\n\nsection Group\nvariable [Group G] {s : Subgroup G}\n\n@[to_additive]\n\nTarget:\nlemma le_minOrder_iff_forall_subgroup {n : ℕ∞} :\n n ≤ minOrder G ↔ ∀ ⦃s : Subgroup G⦄, s ≠ ⊥ → (s : Set G).Finite → n ≤ Nat.card s :=\n\nProof body:\n","rejected":"by?","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/Order","family_id":"le_minorder_iff_forall_subgroup","file_id":"mathlib/Mathlib/GroupTheory/Order/Min.lean","sample_id":"29af87114d75888b1dfc659c3ad79f3eb2dadaa919600b6183181e8fe8177aae"},"split":"validation"} {"binding":{"chosen_proof_sha256":"fe1bc9d7a63b3bd7a030d94b9bf18b412ceb748c63fe6302088785bc851f6792","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"537e20c20d9605a529ec54230fcc6ed2302bcdefd442710ea94c64f2448a90a2","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"91ce7db28ad7a157d7479c6f4f282517d1541de9eb032652af516b5e19816905","source_sha256":"167cae25a064b15f836022f0441997349a236bd699ca87bcd93cf532b794529a","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let b₁ := chooseBasis R M₁\n let b₂ := chooseBasis R M₂\n let b := b₁.prod b₂\n rw [← charpoly_toMatrix f₁ b₁, ← charpoly_toMatrix f₂ b₂, ← charpoly_toMatrix (f₁.prodMap f₂) b,\n toMatrix_prodMap b₁ b₂ f₁ f₂, Matrix.charpoly_fromBlocks_zero₁₂]","hard_negative":true,"metrics":{"chosen_tokens":70,"rejected_tokens":3,"token_jaccard":0.038462,"token_length_ratio":0.042857},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"d8e76d192f6cceab4c69a8d33ad49bd3bce026994f45a2ee4e4353efd3982882","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Charpoly.Basic\npublic import Mathlib.LinearAlgebra.Matrix.Basis\npublic import Mathlib.RingTheory.Finiteness.Prod\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\nCopyright (c) 2021 Riccardo Brasca. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Riccardo Brasca\n-/\n/-!\n\n# Characteristic polynomial\n\n## Main result\n\n* `LinearMap.charpoly_toMatrix f` : `charpoly f` is the characteristic polynomial of the matrix\n of `f` in any basis.\n\n-/\n\npublic section\n\nnoncomputable section\n\nopen Module Free Polynomial Matrix\n\nuniverse u v w\n\nvariable {R M M₁ M₂ : Type*} [CommRing R]\nvariable [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M]\nvariable [AddCommGroup M₁] [Module R M₁] [Module.Finite R M₁] [Module.Free R M₁]\nvariable [AddCommGroup M₂] [Module R M₂] [Module.Finite R M₂] [Module.Free R M₂]\nvariable (f : M →ₗ[R] M)\n\nnamespace LinearMap\n\nsection Basic\n\n/-- `charpoly f` is the characteristic polynomial of the matrix of `f` in any basis. -/\n@[simp]\ntheorem charpoly_toMatrix {ι : Type w} [DecidableEq ι] [Fintype ι] (b : Basis ι R M) :\n (toMatrix b b f).charpoly = f.charpoly := by\n nontriviality R\n unfold LinearMap.charpoly\n set b' := chooseBasis R M\n rw [← basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix b b' b b']\n set P := b.toMatrix b'\n set A := toMatrix b' b' f\n set Q := b'.toMatrix b\n let e := Basis.indexEquiv b b'\n let ι' := ChooseBasisIndex R M\n let φ := reindexLinearEquiv R R e e\n let φ₁ := reindexLinearEquiv R R e (Equiv.refl ι')\n let φ₂ := reindexLinearEquiv R R (Equiv.refl ι') (Equiv.refl ι')\n let φ₃ := reindexLinearEquiv R R (Equiv.refl ι') e\n calc\n (P * A * Q).charpoly = (φ (P * A * Q)).charpoly := (charpoly_reindex ..).symm\n _ = (φ₁ P * φ₂ A * φ₃ Q).charpoly := by rw [reindexLinearEquiv_mul, reindexLinearEquiv_mul]\n _ = A.charpoly := by rw [charpoly_mul_comm, ← mul_assoc]; simp [P, Q, φ₁, φ₂, φ₃]\n\nTarget:\nlemma charpoly_prodMap (f₁ : M₁ →ₗ[R] M₁) (f₂ : M₂ →ₗ[R] M₂) :\n (f₁.prodMap f₂).charpoly = f₁.charpoly * f₂.charpoly :=\n\nProof body:\n","rejected":"by\n exact charpoly_prodMap","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"6615ece854fd4691fe572e497260c3cc92a1294ba93213cc19c859c1575264a6","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/Charpoly","family_id":"charpoly_prodmap","file_id":"mathlib/Mathlib/LinearAlgebra/Charpoly/ToMatrix.lean","sample_id":"91ce7db28ad7a157d7479c6f4f282517d1541de9eb032652af516b5e19816905"},"split":"validation"} {"binding":{"chosen_proof_sha256":"de7dcb88ac5477054e22f4d402bca4115ad00d477cba6c6b783c7b48c6413e81","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4f1cb43e0c809a92fb375322321196497fb45ce5842c8b3824f891867413aabe","source_sha256":"d4f13835575c5d19e0669c1711e5cdd9ebe1612a72ec57a0896bb8957095a385","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp [closure_eq_cluster_pts, ClusterPt, ← exists_ultrafilter_iff, and_comm]","hard_negative":true,"metrics":{"chosen_tokens":12,"rejected_tokens":8,"token_jaccard":0.0625,"token_length_ratio":0.666667},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"da1b5cfbda9691223629edeef2221755e2a0e2282e37e614a53e48869ec4cdca","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Order.Filter.Ultrafilter.Basic\npublic import Mathlib.Topology.Continuous\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2017 Johannes Hölzl. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johannes Hölzl, Mario Carneiro, Jeremy Avigad\n-/\n/-! # Characterization of basic topological properties in terms of ultrafilters -/\n\npublic section\n\nopen Set Filter Topology\n\nuniverse u v w x\n\nvariable {X : Type u} {Y : Type v} {ι : Sort w} {α β : Type*} {x : X} {s s₁ s₂ t : Set X}\n {p p₁ p₂ : X → Prop} [TopologicalSpace X] [TopologicalSpace Y] {F : Filter α} {u : α → X}\n\ntheorem Ultrafilter.clusterPt_iff {f : Ultrafilter X} : ClusterPt x f ↔ ↑f ≤ 𝓝 x :=\n ⟨f.le_of_inf_neBot', fun h => ClusterPt.of_le_nhds h⟩\n\ntheorem clusterPt_iff_ultrafilter {f : Filter X} : ClusterPt x f ↔\n ∃ u : Ultrafilter X, u ≤ f ∧ u ≤ 𝓝 x := by\n simp_rw [ClusterPt, ← le_inf_iff, exists_ultrafilter_iff, inf_comm]\n\ntheorem mapClusterPt_iff_ultrafilter :\n MapClusterPt x F u ↔ ∃ U : Ultrafilter α, U ≤ F ∧ Tendsto u U (𝓝 x) := by\n simp_rw [MapClusterPt, ClusterPt, ← Filter.push_pull', map_neBot_iff, tendsto_iff_comap,\n ← le_inf_iff, exists_ultrafilter_iff, inf_comm]\n\ntheorem isOpen_iff_ultrafilter :\n IsOpen s ↔ ∀ x ∈ s, ∀ (l : Ultrafilter X), ↑l ≤ 𝓝 x → s ∈ l := by\n simp_rw [isOpen_iff_mem_nhds, ← mem_iff_ultrafilter]\n\n/-- `x` belongs to the closure of `s` if and only if some ultrafilter\n supported on `s` converges to `x`. -/\n\nTarget:\ntheorem mem_closure_iff_ultrafilter :\n x ∈ closure s ↔ ∃ u : Ultrafilter X, s ∈ u ∧ ↑u ≤ 𝓝 x :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"2e84f8d95d51340e16db5c22ccc715a83d01130a6c9b138aaeb3c54febe4ea26","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology","family_id":"mem_closure_iff_ultrafilter","file_id":"mathlib/Mathlib/Topology/Ultrafilter.lean","sample_id":"4f1cb43e0c809a92fb375322321196497fb45ce5842c8b3824f891867413aabe"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f57503c52a9b1e060292c072a271bc94ef8f6572828934221808d804a1a188fe","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"9eec81e091d440b4cd965592fdfb7b79b65254c69b28e5587ef953fdbdf0da3f","source_sha256":"8ffbc81a3567c29009e2b20cc3c4b3a75af8d50dc4bc70ce72316fca439dda83","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n nth_rw 1 [← Category.id_comp (𝟙 X)]\n simp only [P.map_comp]","hard_negative":false,"metrics":{"chosen_tokens":20,"rejected_tokens":2,"token_jaccard":0.055556,"token_length_ratio":0.1},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"da33593b0d7177ecdf723a6545a195574eec3c14530096296de50e159d24b72b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Yoneda\n\nNamespace:\nCategoryTheory.ProfunctorCore\n\nLocal context:\n/-\nCopyright (c) 2026 Dagur Asgeirsson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Dagur Asgeirsson, Adam Topaz, Adrian Marti\n-/\n/-!\n\n# Profunctors\n\nA profunctor from a category `C` to a category `D` is a functor from `C` to a category of\npresheaves of sets on `D`. We define this as `Profunctor.{w} C D := C ⥤ Dᵒᵖ ⥤ Type w`.\n\nThis file provides convenient constructors `ProfunctorCore` and `ProfunctorCore.Hom` for profunctors\nand natural transformations between them. We also define the identity profunctor `Profunctor.id`\nas the Yoneda bifunctor, the opposite of a profunctor, the `ulift` of a profunctor, whiskering\nof a profunctor with functors, and the profunctors in both directions corresponding to a functor\n`C ⥤ D` (see `Functor.toProfunctor` and `Functor.toProfunctorFlip`).\n\n## Future work\n\n- Define composition of profunctors.\n- Define the bicategory of categories where the 1-morphisms are profunctors.\n-/\n\n@[expose] public section\n\nnamespace CategoryTheory\n\nopen Opposite\n\nuniverse w' w v₁ v₂ u₁ u₂\n\nvariable (C : Type u₁) (D : Type u₂) [Category.{v₁} C] [Category.{v₂} D]\n\n/-- Custom structure to construct profunctors, i.e. bifunctors `C ⥤ Dᵒᵖ ⥤ Type w`. -/\n@[pp_with_univ]\nstructure ProfunctorCore where\n /-- The object part -/\n obj : C → D → Type w\n /-- The morphism part -/\n map {X X' : C} {Y Y' : D} (f : X ⟶ X') (g : Y ⟶ Y') : obj X Y' ⟶ obj X' Y\n map_id (X : C) (Y : D) : map (𝟙 X) (𝟙 Y) = 𝟙 _ := by cat_disch\n map_comp {X₁ X₂ X₃ : C} {Y₁ Y₂ Y₃ : D} (f : X₁ ⟶ X₂) (f' : X₂ ⟶ X₃) (g : Y₁ ⟶ Y₂) (g' : Y₂ ⟶ Y₃) :\n map (f ≫ f') (g ≫ g') = map f g' ≫ map f' g := by cat_disch\n\nattribute [simp] ProfunctorCore.map_id ProfunctorCore.map_comp\n\n/-- A profunctor from C to D (`Profunctor.{w} C D`) is a bifunctor `C ⥤ Dᵒᵖ ⥤ Type w`. -/\n@[pp_with_univ]\nabbrev Profunctor := C ⥤ Dᵒᵖ ⥤ Type w\n\nvariable {C D}\n\n/-- Typecheck a bifunctor `C ⥤ Dᵒᵖ ⥤ Type w` as a profunctor. -/\nabbrev Functor.profunctor (F : C ⥤ Dᵒᵖ ⥤ Type w) : Profunctor.{w} C D := F\n\nnamespace ProfunctorCore\n\n/-- Custom structure to construct natural transformations between profunctors, see\n`CategoryTheory.Profunctor.ofHom`. -/\nstructure Hom (P Q : ProfunctorCore.{w} C D) where\n /-- The components of the natural transformation -/\n app (X : C) (Y : D) : P.obj X Y ⟶ Q.obj X Y\n naturality ⦃X X' : C⦄ ⦃Y Y' : D⦄ (f : X ⟶ X') (g : Y ⟶ Y') :\n P.map f g ≫ app X' Y = app X Y' ≫ Q.map f g := by cat_disch\n\nattribute [reassoc (attr := simp)] ProfunctorCore.Hom.naturality\n\n@[simp]\n\nTarget:\nlemma map_id_comp (P : ProfunctorCore.{w} C D) (X : C) {Y Y' Y'' : D}\n (g : Y ⟶ Y') (g' : Y' ⟶ Y'') :\n P.map (𝟙 X) (g ≫ g') = P.map (𝟙 X) g' ≫ P.map (𝟙 X) g :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Profunctor","family_id":"map_id_comp","file_id":"mathlib/Mathlib/CategoryTheory/Profunctor/Basic.lean","sample_id":"9eec81e091d440b4cd965592fdfb7b79b65254c69b28e5587ef953fdbdf0da3f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"42ef2c7b63e4668d7678c6f88e876f724173a0548ef02c484242defea7ec90d9","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"488beec443760282e68c5c24445c8b00d3a99c2f28d3d4b3394f1f4d360a54a9","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"cd5eefd2051037aa1d3cfc0ae07fc27231575ffdbfbd934224e5cb490f198640","source_sha256":"40b3fe35a4f6ee6eaf5570fa9a5773e90967e90bbd65a7f661f7a527d47b82ae","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [RightTotal, IsEmpty.forall_iff]","hard_negative":true,"metrics":{"chosen_tokens":10,"rejected_tokens":3,"token_jaccard":0.083333,"token_length_ratio":0.3},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"dabb41b310401bb17c2c8de713d444b41903831a381b5786ba5ef9d5f5e22e0c","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Logic.Function.Basic\npublic import Mathlib.Logic.IsEmpty.Defs\npublic import Mathlib.Logic.Relator\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2021 Floris van Doorn. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Floris van Doorn\n-/\n/-!\nIn this file we prove some basic properties about the typeclass `IsEmpty`.\n-/\n\npublic section\n\nvariable {α β γ : Sort*}\n\n@[simp, push]\ntheorem not_nonempty_iff : ¬Nonempty α ↔ IsEmpty α :=\n ⟨fun h ↦ ⟨fun x ↦ h ⟨x⟩⟩, fun h1 h2 ↦ h2.elim h1.elim⟩\n\n@[simp, push]\ntheorem not_isEmpty_iff : ¬IsEmpty α ↔ Nonempty α :=\n not_iff_comm.mp not_nonempty_iff\n\n@[simp]\ntheorem isEmpty_Prop {p : Prop} : IsEmpty p ↔ ¬p := by\n simp only [← not_nonempty_iff, nonempty_prop]\n\n@[simp]\ntheorem isEmpty_pi {π : α → Sort*} : IsEmpty (∀ a, π a) ↔ ∃ a, IsEmpty (π a) := by\n simp only [← not_nonempty_iff, Classical.nonempty_pi, not_forall]\n\ntheorem isEmpty_fun : IsEmpty (α → β) ↔ Nonempty α ∧ IsEmpty β := by\n rw [isEmpty_pi, ← exists_true_iff_nonempty, ← exists_and_right, true_and]\n\n@[simp]\ntheorem nonempty_fun : Nonempty (α → β) ↔ IsEmpty α ∨ Nonempty β :=\n not_iff_not.mp <| by rw [not_or, not_nonempty_iff, not_nonempty_iff, isEmpty_fun, not_isEmpty_iff]\n\n@[simp]\ntheorem isEmpty_sigma {α} {E : α → Type*} : IsEmpty (Sigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_sigma, not_exists]\n\n@[simp]\ntheorem isEmpty_psigma {α} {E : α → Sort*} : IsEmpty (PSigma E) ↔ ∀ a, IsEmpty (E a) := by\n simp only [← not_nonempty_iff, nonempty_psigma, not_exists]\n\ntheorem isEmpty_subtype (p : α → Prop) : IsEmpty (Subtype p) ↔ ∀ x, ¬p x := by\n simp only [← not_nonempty_iff, nonempty_subtype, not_exists]\n\n@[simp]\ntheorem isEmpty_prod {α β : Type*} : IsEmpty (α × β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_prod, not_and_or]\n\n@[simp]\ntheorem isEmpty_pprod : IsEmpty (PProd α β) ↔ IsEmpty α ∨ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_pprod, not_and_or]\n\n@[simp]\ntheorem isEmpty_sum {α β} : IsEmpty (α ⊕ β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_sum, not_or]\n\n@[simp]\ntheorem isEmpty_psum {α β} : IsEmpty (α ⊕' β) ↔ IsEmpty α ∧ IsEmpty β := by\n simp only [← not_nonempty_iff, nonempty_psum, not_or]\n\n@[simp]\ntheorem isEmpty_ulift {α} : IsEmpty (ULift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_ulift]\n\n@[simp]\ntheorem isEmpty_plift {α} : IsEmpty (PLift α) ↔ IsEmpty α := by\n simp only [← not_nonempty_iff, nonempty_plift]\n\ntheorem wellFounded_of_isEmpty {α} [IsEmpty α] (r : α → α → Prop) : WellFounded r :=\n ⟨isEmptyElim⟩\n\nvariable (α)\n\ntheorem isEmpty_or_nonempty : IsEmpty α ∨ Nonempty α :=\n (em <| IsEmpty α).elim Or.inl <| Or.inr ∘ not_isEmpty_iff.mp\n\n@[simp]\ntheorem not_isEmpty_of_nonempty [h : Nonempty α] : ¬IsEmpty α :=\n not_isEmpty_iff.mpr h\n\nvariable {α}\n\ntheorem Function.extend_of_isEmpty [IsEmpty α] (f : α → β) (g : α → γ) (h : β → γ) :\n Function.extend f g h = h :=\n funext fun _ ↦ (Function.extend_apply' _ _ _) fun ⟨a, _⟩ ↦ isEmptyElim a\n\nopen Relator\n\nvariable {α β : Type*} (R : α → β → Prop)\n\n@[simp]\ntheorem leftTotal_empty [IsEmpty α] : LeftTotal R := by\n simp only [LeftTotal, IsEmpty.forall_iff]\n\ntheorem leftTotal_iff_isEmpty_left [IsEmpty β] : LeftTotal R ↔ IsEmpty α := by\n simp only [LeftTotal, IsEmpty.exists_iff, isEmpty_iff]\n\n@[simp]\n\nTarget:\ntheorem rightTotal_empty [IsEmpty β] : RightTotal R :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_cd5eefd20510","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"1e38bf243aab1a5864ba46273a78350490e1de62a9a76397988744fae3ebfa5f","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Logic/IsEmpty","family_id":"righttotal_empty","file_id":"mathlib/Mathlib/Logic/IsEmpty/Basic.lean","sample_id":"cd5eefd2051037aa1d3cfc0ae07fc27231575ffdbfbd934224e5cb490f198640"},"split":"validation"} {"binding":{"chosen_proof_sha256":"713a31421b99240127688204675215a79ba4e0ebae49ad6735b8673f5ba804bd","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"148d4bb481d5fb6dd96abb5cffc2629c9e26450cf546a2d15ee9ec7face5cf4f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ae25540ba46c9b45a9b274bcdbfbfd149e28f32049fb375902bb38a173e8c22c","source_sha256":"1438a6885b233a4c239ccc359128314e2075f618ba6baf50cbb53c7a41248de4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [continuousGeneratedBy_iff]\n exact (hg.continuousMap.comp hf.continuousMap).continuous","hard_negative":false,"metrics":{"chosen_tokens":18,"rejected_tokens":3,"token_jaccard":0.133333,"token_length_ratio":0.166667},"negative_category":"by_exact_placeholder","negative_mode":"placeholder","pair_id":"dac6d8cca9d0845eaafacb537109d025b04330a01cc3d6d68c740b98b8af426d","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.Convenient.GeneratedBy\n\nNamespace:\nTopology\n\nLocal context:\n/-\nCopyright (c) 2026 Joël Riou. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Joël Riou\n-/\n/-!\n# `X`-continuous maps\n\nGiven a family `X i` of topological spaces, we introduce a predicate\n`ContinuousGeneratedBy X` on maps `g : Y ⟶ Z` saying that\n`g` is `X`-continuous, i.e. for any continuous map `f : X i → Y`,\nthe composition `g ∘ f` is continuous.\n\n## References\n* [Martín Escardó, Jimmie Lawson and Alex Simpson, *Comparing Cartesian closed\n categories of (core) compactly generated spaces*][escardo-lawson-simpson-2004]\n\n-/\n\nuniverse v v' t u\n\n@[expose] public section\n\nopen Topology\n\nvariable {ι : Type t} {X : ι → Type u} [∀ i, TopologicalSpace (X i)]\n {Y : Type v} [TopologicalSpace Y] {Z : Type v'} [TopologicalSpace Z]\n\nnamespace Topology\n\nvariable (X) in\n/-- Given a family `X i` of topological space, this is a predicate\non maps `g : Y → Z` between topological spaces saying that for any\ncontinuous map `f : X i → Y`, the composition `g ∘ f` is continuous.\nWe say that `g` is `X`-continuous. -/\ndef ContinuousGeneratedBy (g : Y → Z) : Prop :=\n ∀ ⦃i : ι⦄ (f : C(X i, Y)), Continuous (g ∘ f)\n\nlemma continuousGeneratedBy_def (g : Y → Z) :\n ContinuousGeneratedBy X g ↔\n ∀ ⦃i : ι⦄ (f : C(X i, Y)), Continuous (g ∘ f) := Iff.rfl\n\nlemma continuousGeneratedBy_iff (g : Y → Z) :\n ContinuousGeneratedBy X g ↔\n Continuous ((WithGeneratedByTopology.equiv (X := X)).symm ∘ g ∘\n WithGeneratedByTopology.equiv (X := X)) := by\n rw [IsGeneratedBy.equiv_symm_comp_continuous_iff,\n WithGeneratedByTopology.continuous_from_iff]\n rfl\n\n/-- A `X`-continuous map `g : Y → Z` induces a continuous map\nbetween the types `Y` and `Z` equipped with the `X`-generated topology. -/\ndef ContinuousGeneratedBy.continuousMap {g : Y → Z}\n (hg : ContinuousGeneratedBy X g) :\n C(WithGeneratedByTopology X Y, WithGeneratedByTopology X Z) :=\n ⟨WithGeneratedByTopology.equiv.symm ∘ g ∘ WithGeneratedByTopology.equiv, by\n rwa [← continuousGeneratedBy_iff]⟩\n\n@[simp]\nlemma ContinuousGeneratedBy.continuousMap_coe {g : Y → Z}\n (hg : ContinuousGeneratedBy X g) :\n ⇑hg.continuousMap = WithGeneratedByTopology.equiv.symm ∘ g ∘ WithGeneratedByTopology.equiv :=\n rfl\n\n@[simp]\nlemma ContinuousGeneratedBy.id :\n ContinuousGeneratedBy X (id : Y → Y) := by\n simpa [continuousGeneratedBy_iff] using continuous_id\n\nTarget:\nlemma ContinuousGeneratedBy.comp {g : Y → Z} (hg : ContinuousGeneratedBy X g)\n {T : Type*} [TopologicalSpace T] {f : T → Y} (hf : ContinuousGeneratedBy X f) :\n ContinuousGeneratedBy X (g ∘ f) :=\n\nProof body:\n","rejected":"by\n exact placeholder","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Convenient","family_id":"continuousgeneratedby","file_id":"mathlib/Mathlib/Topology/Convenient/ContinuousMapGeneratedBy.lean","sample_id":"ae25540ba46c9b45a9b274bcdbfbfd149e28f32049fb375902bb38a173e8c22c"},"split":"validation"} {"binding":{"chosen_proof_sha256":"e67fa3c9f84e8cadae9ede73693532e673b71771aa7cbd3886799839cb8caa1b","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8f2fe4411145b1604f3a1ee7e9c9f3ff839de680c49d18ca6cbe243372e5e7e3","source_sha256":"019a3efb9bf01184ab20cec983f14c924240760bdbf7e2ba56314e6375b9dddb","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n split_ifs with h\n · simp only [supNorm, gaussNorm, h, ↓reduceDIte, one_pow, mul_one, Function.comp_apply]\n congr\n · simp [supNorm, gaussNorm, h]","hard_negative":false,"metrics":{"chosen_tokens":35,"rejected_tokens":5,"token_jaccard":0.041667,"token_length_ratio":0.142857},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"dcaa2e6d856282c83604ff7c3cdcd9a6b614da514b679be683de73f2cafd0c3b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Polynomial.GaussNorm\npublic import Mathlib.Analysis.Normed.Unbundled.RingSeminorm\npublic import Mathlib.Algebra.Order.Hom.Basic\n\nNamespace:\nPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Kevin H. Wilson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kevin H. Wilson\n-/\n/-!\n# Sup Norm of Polynomials\n\nIn this file we define the sup norm on `Polynomial`s based on their coefficients as well as several\nbasic results about this norm. We note that this is often called the _(naive) height_ of the\npolynomial in the literature.\n\nThe sup norm is related to the Mahler measure of the polynomial. See\n`Mathlib/Analysis/Polynomial/MahlerMeasure.lean`.\n\n## Main definitions\n\n- `Polynomial.supNorm p`: the sup norm of the coefficients of the polynomial, equal to the\n maximum of the norm of its coefficients (or zero for the zero polynomial)\n\n## A Note on Naming\n\nIn the literature, the sup norm is often called the _(naive) height_ of a polynomial and the\n`l^1` norm is often called the _length_ of the polynomial. Unfortunately, these terms are\nextremely overloaded and Mathlib defines _height_ differently.\n\n### TODOs\n\nAll other `l^p` norms can be defined on Polynomials as well. In the literature, the `l^1` norm is\nsometimes called the polynomial's _length_. The `l^2` norm sometimes arises due to Parseval's\ntheorem implying that the squared `l^2` norm of a complex polynomial is the integral of the norm of\nthe polynomial's value on the unit circle.\n-/\n\n\n@[expose] public section supnorm_seminorm\n\nvariable {A : Type*} [SeminormedRing A] (p : Polynomial A)\n\nnamespace Polynomial\n\n/-- The sup norm of a polynomial on a semi-normed ring, defined as the maximum of its coefficients.\nOften called the _(naive) height_ of the polynomial.\n\nThis is defined in terms of `Polynomial.gaussNorm`. -/\nnoncomputable def supNorm : ℝ := p.gaussNorm (SeminormedRing.toRingSeminorm A) 1\n\n/-- The direct definition of the supNorm -/\n\nTarget:\nlemma supNorm_def' : p.supNorm =\n if hp : p.support.Nonempty then p.support.sup' hp (norm ∘ p.coeff) else 0 :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/Polynomial","family_id":"supnorm_def","file_id":"mathlib/Mathlib/Analysis/Polynomial/Norm.lean","sample_id":"8f2fe4411145b1604f3a1ee7e9c9f3ff839de680c49d18ca6cbe243372e5e7e3"},"split":"validation"} {"binding":{"chosen_proof_sha256":"caa002cb212c353282864e9f564bff6c16a1207fabe9e0633a1a9b9782cc3cf8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e6432d29ef4ba24cfd7ea5c2ca105f906cb2d6c17cea1ff2533b15568a777269","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"b1be8c25175294dc1c04ff1ce7bf75503ac22bd9b28d0049949d83e76a154742","source_sha256":"c60b869c723c3c91f9b10ffc01a437f63b4e5c04e61a58398bcd9e9d0ac2e64f","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n simp only [sum_def', SkewMonoidAlgebra.sum_sum_index (fun a ↦ h_zero (toAdd a))\n (fun a ↦ h_add (toAdd a))]","hard_negative":false,"metrics":{"chosen_tokens":30,"rejected_tokens":5,"token_jaccard":0.045455,"token_length_ratio":0.166667},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorryAx","pair_id":"dd2e9120ba28c1cf8973660d9dddbc0ac8e127b3101a24dac43fa36b96d0cfcd","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Single\npublic import Mathlib.Algebra.SkewMonoidAlgebra.Support\n\nNamespace:\nSkewPolynomial\n\nLocal context:\n/-\nCopyright (c) 2025 Xavier Généreux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Xavier Généreux, María Inés de Frutos-Fernández\n-/\n/-!\n# Univariate skew polynomials\n\nGiven a ring `R` and an endomorphism `φ` on `R` the skew polynomials over `R`\nare polynomials\n$$\\sum_{i= 0}^n a_iX^n, n\\geq 0, a_i\\in R$$\nwhere the addition is the usual addition of polynomials\n$$\\sum_{i= 0}^n a_iX^n + \\sum_{i= 0}^n b_iX^n= \\sum_{i= 0}^n (a_i + b_i)X^n.$$\nThe multiplication, however, is determined by\n$$Xa = \\varphi (a)X$$\nby extending it to all polynomials in the obvious way.\n\nSkew polynomials are represented as `SkewMonoidAlgebra R (Multiplicative ℕ)`,\nwhere `R` is usually at least a Semiring. In this file, we define `SkewPolynomial`\nand provide basic instances.\n\n**Note**: To register the endomorphism `φ` see notation below.\n\n## Notation\n\nThe endomorphism `φ` is implemented using some action of `Multiplicative ℕ` on `R`.\nFrom this action, `φ` is an `abbrev` denoting $(\\text{ofAdd } 1) \\cdot a := \\varphi(a)$.\n\nUsers that want to work with a specific map `φ` should introduce an action of\n`Multiplicative ℕ` on `R`. Specifying that this action is a `MulSemiringAction` amounts\nto saying that `φ` is an endomorphism.\n\nFurthermore, with this notation `φ^[n](a) = (ofAdd n) • a`, see `φ_iterate_apply`.\n\n## Main definitions\n\n* `SkewPolynomial.monomial n a` is the skew polynomial `a X ^ n`. Note that\n `SkewPolynomial.monomial n` is defined as an `R`-linear map.\n* `SkewPolynomial.C a` is the constant skew polynomial `a`. Note that `C` is defined as an additive\n homomorphism.\n* `SkewPolynomial.CRingHom a` is the constant skew polynomial `a`, as a ring homomorphism. This\n requires to assume `[MulSemiringAction (Multiplicative ℕ) R]`.\n* `SkewPolynomial.X` is the skew polynomial `X`, i.e., `SkewPolynomial.monomial 1 1`.\n* `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`.\n* `SkewPolynomial.coeff p n` is the coefficient of `X ^ n` in `p`.\n* `SkewPolynomial.erase p n` is the skew polynomial `p` in which one removes the monomial in\n degree `n`.\n* `SkewPolynomial.update p n a` is the skew polynomial obtained by replacing the coefficient of\n degree `n` by a given value `a : R`. If `a = 0`, this is equal to `p.erase n` If\n `p.natDegree < n` and `a ≠ 0`, this increases the degree of `p` to `n`.\n\n## Implementation notes\n\nThe implementation uses `Multiplicative ℕ` instead of `ℕ`, since Mathlib does not contain an\nadditive version of `SkewMonoidAlgebra`.\n\nThis decision was made because we use the type class `MulSemiringAction` to specify the properties\nthe action needs to respect for associativity. There is no version of this in Mathlib that\nuses an acting `AddMonoid M` and so we need to use `Multiplicative ℕ` for the action.\n\nFor associativity to hold, there should be an instance of\n`MulSemiringAction (Multiplicative ℕ) R` present in the context.\nFor example, in the context of $\\mathbb{F}_q$-linear polynomials, this can be the\n$q$-th Frobenius endomorphism - so $\\varphi(a) = a^q$.\n\n## Reference\n\nThe definition is inspired by Chapter 3 of [Papikian2023].\n\n## Tags\n\nSkew Polynomials, Twisted Polynomials.\n\nNote that [ore33] proposes a more general definition of skew polynomial ring, where the\nmultiplication is determined by $Xa = \\varphi (a)X + δ (a)$, where `φ` is as above and\n`δ` is a derivation.\n\n-/\n\n@[expose] public section\n\nnoncomputable section\n\nopen Function Multiplicative SkewMonoidAlgebra\n\n/-- The skew polynomials over `R` is the type of univariate polynomials over `R`\nendowed with a skewed convolution product. -/\nabbrev SkewPolynomial (R : Type*) [AddCommMonoid R] := SkewMonoidAlgebra R (Multiplicative ℕ)\n\nnamespace SkewPolynomial\n\nvariable {R : Type*} {m n : ℕ}\n\nsection Semiring\n\nvariable [Semiring R] {p q : SkewPolynomial R}\n\n\nlemma zero_def : (0 : SkewPolynomial R) = (0 : SkewMonoidAlgebra R (Multiplicative ℕ)) := rfl\n\nvariable {S S₁ S₂ : Type*}\n\n/--\nThe set of all `n` such that `X^n` has a non-zero coefficient.\n-/\ndef support (p : SkewPolynomial R) : Finset ℕ :=\n Finset.map ⟨toAdd, toAdd.injective⟩ (SkewMonoidAlgebra.support p)\n\n/-- Though `SkewPolynomial.support` is not definiyionally equal to `SkewMonoidAlgebra.support` we\n can relate them using the following lemma. -/\nlemma support_eq_skewMonoidAlgebra_support (p : SkewPolynomial R) :\n p.support = Finset.map (Multiplicative.toAdd (α := ℕ)) (SkewMonoidAlgebra.support p) := by\n simp only [support]\n\n@[simp] lemma support_zero : (0 : SkewPolynomial R).support = ∅ := rfl\n\n@[simp] lemma support_eq_empty : p.support = ∅ ↔ p = 0 := by simp [support]\n\nlemma card_support_eq_zero : p.support.card = 0 ↔ p = 0 := by simp\n\nlemma support_add : (p + q).support ⊆ p.support ∪ q.support := by\n simpa [support, ← Finset.map_union, Finset.map_subset_map] using SkewMonoidAlgebra.support_add\n\n/-- `coeff p n` is the coefficient of `X ^ n` in `p`. -/\ndef coeff (p : SkewPolynomial R) : ℕ → R := fun n ↦ (SkewMonoidAlgebra.coeff p (ofAdd n))\n\n@[simp]\nlemma mem_support_iff : n ∈ p.support ↔ p.coeff n ≠ 0 := by\n simp [support, coeff]\n\nlemma notMem_support_iff : n ∉ p.support ↔ p.coeff n = 0 := by simp\n\n/-- `p.sum f` is `∑ n ∈ p.support, f n (p.coeff n)`, i.e., one sums the values of functions applied\n to coefficients of the polynomial `p`. -/\ndef sum {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) : S :=\n SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r)\n\n/-- For a skew polynomial `p`, `p.sum f` can be written in terms of `SkewMonoidAlgebra.sum p`. -/\nlemma sum_def' {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = SkewMonoidAlgebra.sum p (fun n r ↦ f (toAdd n : ℕ) r) := rfl\n\nlemma sum_def {S : Type*} [AddCommMonoid S] (p : SkewPolynomial R) (f : ℕ → R → S) :\n p.sum f = ∑ n ∈ p.support, f n (p.coeff n) := by\n simp only [sum_def', SkewMonoidAlgebra.sum_def, Finsupp.sum, toFinsupp_apply]\n apply Finset.sum_of_injOn (toAdd) (Injective.injOn fun ⦃a₁ a₂⦄ a ↦ a) (fun _ ↦ ?_) <;>\n simp +contextual [coeff]\n\nTarget:\nlemma sum_sum_index {R' P : Type*} [AddCommMonoid P] [Semiring R']\n {f : SkewPolynomial R} {g : ℕ → R → SkewPolynomial R'} {h : ℕ → R' → P}\n (h_zero : ∀ (a : ℕ), h a 0 = 0)\n (h_add : ∀ (a : ℕ) (b₁ b₂ : R'), h a (b₁ + b₂) = h a b₁ + h a b₂) :\n sum (sum f g) h = sum f fun (a : ℕ) (b : R) ↦ sum (g a b) h :=\n\nProof body:\n","rejected":"by\n exact sorryAx _ true","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/SkewPolynomial","family_id":"sum_sum_index","file_id":"mathlib/Mathlib/Algebra/SkewPolynomial/Basic.lean","sample_id":"b1be8c25175294dc1c04ff1ce7bf75503ac22bd9b28d0049949d83e76a154742"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4a4930020165d85951ea7218cf3532f4a238f279f18a1e79774e7569b91912bb","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"e5f448e0ed3c85754caa66df9c6b8269c1ccb2a0a9e4a700f6a41443b1246b8c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"ca02ea81322f1fc81778a460bde26244fe65ec5faeb54e8c6ade9ea5e475356d","source_sha256":"7af9ae814fef6855524f2289979442060289c7085e449c49d2dbe6db43c90104","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← MonoidHom.mem_ker, ← S.range_inl_eq_ker_rightHom, MonoidHom.mem_range]\n exact exists_apply_eq_apply S.inl n","hard_negative":true,"metrics":{"chosen_tokens":23,"rejected_tokens":2,"token_jaccard":0.058824,"token_length_ratio":0.086957},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"e014f2094e543e5afe70bb420201bcb775774fefbc42969ec674430f3565c0a0","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.GroupAction.ConjAct\npublic import Mathlib.GroupTheory.SemidirectProduct\n\nNamespace:\nGroupExtension\n\nLocal context:\n/-\nCopyright (c) 2024 Yudai Yamazaki. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yudai Yamazaki\n-/\n/-!\n# Group Extensions\n\nThis file defines extensions of multiplicative and additive groups and their associated structures\nsuch as splittings and equivalences.\n\n## Main definitions\n\n- `(Add?)GroupExtension N E G`: structure for extensions of `G` by `N` as short exact sequences\n `1 → N → E → G → 1` (`0 → N → E → G → 0` for additive groups)\n- `(Add?)GroupExtension.Equiv S S'`: structure for equivalences of two group extensions `S` and `S'`\n as specific homomorphisms `E → E'` such that each diagram below is commutative\n\n```text\nFor multiplicative groups:\n ↗ E ↘\n1 → N ↓ G → 1\n ↘ E' ↗\n\nFor additive groups:\n ↗ E ↘\n0 → N ↓ G → 0\n ↘ E' ↗\n```\n\n- `(Add?)GroupExtension.Section S`: structure for right inverses to `rightHom` of a group extension\n `S` of `G` by `N`\n- `(Add?)GroupExtension.Splitting S`: structure for section homomorphisms of a group extension `S`\n of `G` by `N`\n- `SemidirectProduct.toGroupExtension φ`: the multiplicative group extension associated to the\n semidirect product coming from `φ : G →* MulAut N`, `1 → N → N ⋊[φ] G → G → 1`\n\n## TODO\n\nIf `N` is abelian,\n\n- there is a bijection between `N`-conjugacy classes of\n `(SemidirectProduct.toGroupExtension φ).Splitting` and `groupCohomology.H1`\n (which will be available in the planned file `Mathlib/GroupTheory/GroupExtension/Abelian.lean` to\n be added in a later PR).\n- there is a bijection between equivalence classes of group extensions and `groupCohomology.H2`\n (which is also stated as a TODO in `Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean`).\n-/\n\n@[expose] public section\n\nvariable (N E G : Type*)\n\n/-- `AddGroupExtension N E G` is a short exact sequence of additive groups `0 → N → E → G → 0`. -/\nstructure AddGroupExtension [AddGroup N] [AddGroup E] [AddGroup G] where\n /-- The inclusion homomorphism `N →+ E` -/\n inl : N →+ E\n /-- The projection homomorphism `E →+ G` -/\n rightHom : E →+ G\n /-- The inclusion map is injective. -/\n inl_injective : Function.Injective inl\n /-- The range of the inclusion map is equal to the kernel of the projection map. -/\n range_inl_eq_ker_rightHom : inl.range = rightHom.ker\n /-- The projection map is surjective. -/\n rightHom_surjective : Function.Surjective rightHom\n\n/-- `GroupExtension N E G` is a short exact sequence of groups `1 → N → E → G → 1`. -/\n@[to_additive]\nstructure GroupExtension [Group N] [Group E] [Group G] where\n /-- The inclusion homomorphism `N →* E` -/\n inl : N →* E\n /-- The projection homomorphism `E →* G` -/\n rightHom : E →* G\n /-- The inclusion map is injective. -/\n inl_injective : Function.Injective inl\n /-- The range of the inclusion map is equal to the kernel of the projection map. -/\n range_inl_eq_ker_rightHom : inl.range = rightHom.ker\n /-- The projection map is surjective. -/\n rightHom_surjective : Function.Surjective rightHom\n\nvariable {N E G}\n\nnamespace AddGroupExtension\n\nvariable [AddGroup N] [AddGroup E] [AddGroup G] (S : AddGroupExtension N E G)\n\n/-- `AddGroupExtension`s are equivalent iff there is an isomorphism making a commuting diagram.\n Use `AddGroupExtension.Equiv.ofMonoidHom` in `Mathlib/GroupTheory/GroupExtension/Basic.lean` to\n construct an equivalence without providing the inverse map. -/\nstructure Equiv {E' : Type*} [AddGroup E'] (S' : AddGroupExtension N E' G) extends E ≃+ E' where\n /-- The left-hand side of the diagram commutes. -/\n inl_comm : toAddEquiv ∘ S.inl = S'.inl\n /-- The right-hand side of the diagram commutes. -/\n rightHom_comm : S'.rightHom ∘ toAddEquiv = S.rightHom\n\n/-- `Section` of an additive group extension is a right inverse to `S.rightHom`. -/\nstructure Section where\n /-- The underlying function -/\n toFun : G → E\n /-- `Section` is a right inverse to `S.rightHom` -/\n rightInverse_rightHom : Function.RightInverse toFun S.rightHom\n\n/-- `Splitting` of an additive group extension is a section homomorphism. -/\nstructure Splitting extends G →+ E, S.Section\n\n/-- A splitting of an additive group extension as a (set-theoretic) section. -/\nadd_decl_doc Splitting.toSection\n\nend AddGroupExtension\n\nnamespace GroupExtension\n\nvariable [Group N] [Group E] [Group G] (S : GroupExtension N E G)\n\n/-- The range of the inclusion map is a normal subgroup. -/\n@[to_additive /-- The range of the inclusion map is a normal additive subgroup. -/]\ninstance normal_inl_range : S.inl.range.Normal :=\n S.range_inl_eq_ker_rightHom ▸ S.rightHom.normal_ker\n\n@[to_additive (attr := simp)]\n\nTarget:\ntheorem rightHom_inl (n : N) : S.rightHom (S.inl n) = 1 :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_ca02ea81322f","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"2da0d9862d41df74e81ff4b67ad4daabfee10991b4bba26a74eaa28022cd98be","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"GroupTheory/GroupExtension","family_id":"righthom_inl","file_id":"mathlib/Mathlib/GroupTheory/GroupExtension/Defs.lean","sample_id":"ca02ea81322f1fc81778a460bde26244fe65ec5faeb54e8c6ade9ea5e475356d"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5ff4fe1ce8ea0c1513443d99362da477a119bb068ccbcdbd0e1bf12aed838f28","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"2ffb7bc3cdc6661fedeaa8ff798c20a2df36f8d23e5658ee8f8eca3374b417bf","source_sha256":"c5f2821e1022912479225343e085671f902aa490700adbce0fd87ebd02ef26e6","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n have h_finrank_inf : finrank K ↑(s ⊓ t) = 0 := by\n rw [disjoint_iff_inf_le, le_bot_iff] at hdisjoint\n rw [hdisjoint, finrank_bot]\n apply eq_top_of_finrank_eq\n replace hdim : finrank K V = finrank K s + finrank K t :=\n le_antisymm hdim (finrank_add_finrank_le_of_disjoint hdisjoint)\n rw [hdim]\n convert! s.finrank_sup_add_finrank_inf_eq t\n rw [h_finrank_inf, add_zero]","hard_negative":false,"metrics":{"chosen_tokens":69,"rejected_tokens":2,"token_jaccard":0.026316,"token_length_ratio":0.028986},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"e08f52216a78ec1ba3bc7763e22ee9c277fadccb4895175d78f94098a9f1823b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Dimension.DivisionRing\npublic import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition\npublic import Mathlib.LinearAlgebra.FiniteDimensional.Basic\npublic import Mathlib.Tactic.IntervalCases\n\nNamespace:\nSubmodule\n\nLocal context:\n/-\nCopyright (c) 2019 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Finite-dimensional vector spaces\n\nThis file contains some further development of finite-dimensional vector spaces, their dimensions,\nand linear maps on such spaces.\n\nDefinitions are in `Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean`\nand results that require fewer imports are in `Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean`.\n-/\n\n@[expose] public section\n\nassert_not_exists Monoid.exponent Module.IsTorsion\n\n\nuniverse u v v'\n\nopen Cardinal Submodule Module Function\n\nvariable {K : Type u} {V : Type v}\n\nnamespace Submodule\n\nopen IsNoetherian Module\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V]\n\n/-- The dimension of a strict submodule is strictly bounded by the dimension of the ambient\nspace.\n\nSee also `Submodule.length_lt`. -/\ntheorem finrank_lt [FiniteDimensional K V] {s : Submodule K V} (h : s ≠ ⊤) :\n finrank K s < finrank K V := by\n rw [← s.finrank_quotient_add_finrank, add_comm]\n rw [← Quotient.nontrivial_iff] at h\n exact Nat.lt_add_of_pos_right finrank_pos\n\n/-- The sum of the dimensions of s + t and s ∩ t is the sum of the dimensions of s and t -/\ntheorem finrank_sup_add_finrank_inf_eq (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] :\n finrank K ↑(s ⊔ t) + finrank K ↑(s ⊓ t) = finrank K ↑s + finrank K ↑t := by\n have key : Module.rank K ↑(s ⊔ t) + Module.rank K ↑(s ⊓ t) = Module.rank K s + Module.rank K t :=\n rank_sup_add_rank_inf_eq s t\n repeat rw [← finrank_eq_rank] at key\n norm_cast at key\n\ntheorem finrank_add_le_finrank_add_finrank (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] : finrank K (s ⊔ t : Submodule K V) ≤ finrank K s + finrank K t := by\n rw [← finrank_sup_add_finrank_inf_eq]\n exact self_le_add_right _ _\n\ntheorem finrank_add_finrank_le_of_disjoint [FiniteDimensional K V]\n {s t : Submodule K V} (hdisjoint : Disjoint s t) :\n finrank K s + finrank K t ≤ finrank K V := by\n rw [← Submodule.finrank_sup_add_finrank_inf_eq s t, hdisjoint.eq_bot, finrank_bot, add_zero]\n exact Submodule.finrank_le _\n\nTarget:\ntheorem eq_top_of_disjoint [FiniteDimensional K V] (s t : Submodule K V)\n (hdim : finrank K V ≤ finrank K s + finrank K t) (hdisjoint : Disjoint s t) : s ⊔ t = ⊤ :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/FiniteDimensional","family_id":"eq_top_of_disjoint","file_id":"mathlib/Mathlib/LinearAlgebra/FiniteDimensional/Lemmas.lean","sample_id":"2ffb7bc3cdc6661fedeaa8ff798c20a2df36f8d23e5658ee8f8eca3374b417bf"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c47e0ebd9f6d5941669301d043ad9d7f2bf52308746a9fc9bca91a3ebea452d6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"25ff82aa69b0c6934ee96e07b5dc1405bc1556a826dc0b6f3fe17c771346776f","source_sha256":"4a09e6ef672a691d9ce797abf5331ef80bdb460134e85a17438c693b4627f9d9","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let F (n : ℕ) : ℂ := if n = 0 then 0 else f n\n have hF₀ : F 0 = 0 := rfl\n have hF {n : ℕ} (hn : n ≠ 0) : F n = f n := if_neg hn\n have ha' : abscissaOfAbsConv F < ⊤ := (abscissaOfAbsConv_congr hF).symm ▸ ha\n simp_rw [← LSeries_congr hF]\n convert! LSeries.tendsto_cpow_mul_atTop (n := 0) (fun _ hm ↦ Nat.le_zero.mp hm ▸ hF₀) ha' using 1\n simp","hard_negative":true,"metrics":{"chosen_tokens":104,"rejected_tokens":8,"token_jaccard":0.071429,"token_length_ratio":0.076923},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"e1ad2569bffdb4a56f6693e60b292a651877eec14d0e4b3e83f9e165bb3962dd","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.Normed.Group.Tannery\npublic import Mathlib.NumberTheory.LSeries.Convergence\npublic import Mathlib.NumberTheory.LSeries.Linearity\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Michael Stoll. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Michael Stoll\n-/\n/-!\n# A converging L-series determines its coefficients\n\nWe show that two functions `f` and `g : ℕ → ℂ` whose L-series agree and both converge somewhere\nmust agree on all nonzero arguments. See `LSeries_eq_iff_of_abscissaOfAbsConv_lt_top`\nand `LSeries_injOn`.\n-/\n\npublic section\n\nopen LSeries Complex\n\n-- The following two lemmas need both `LSeries.Linearity` and `LSeries.Convergence`,\n-- so cannot live in either of these files.\n\n/-- The abscissa of absolute convergence of `f + g` is at most the maximum of those\nof `f` and `g`. -/\nlemma LSeries.abscissaOfAbsConv_add_le (f g : ℕ → ℂ) :\n abscissaOfAbsConv (f + g) ≤ max (abscissaOfAbsConv f) (abscissaOfAbsConv g) :=\n abscissaOfAbsConv_binop_le LSeriesSummable.add f g\n\n/-- The abscissa of absolute convergence of `f - g` is at most the maximum of those\nof `f` and `g`. -/\nlemma LSeries.abscissaOfAbsConv_sub_le (f g : ℕ → ℂ) :\n abscissaOfAbsConv (f - g) ≤ max (abscissaOfAbsConv f) (abscissaOfAbsConv g) :=\n abscissaOfAbsConv_binop_le LSeriesSummable.sub f g\n\nprivate\nlemma cpow_mul_div_cpow_eq_div_div_cpow (m n : ℕ) (z : ℂ) (x : ℝ) :\n (n + 1) ^ (x : ℂ) * (z / m ^ (x : ℂ)) = z / (m / (n + 1)) ^ (x : ℂ) := by\n have Hn : (0 : ℝ) ≤ (n + 1 : ℝ)⁻¹ := by positivity\n rw [← mul_div_assoc, mul_comm, div_eq_mul_inv z, mul_div_assoc]\n congr\n simp_rw [div_eq_mul_inv]\n rw [show (n + 1 : ℂ)⁻¹ = (n + 1 : ℝ)⁻¹ by simp,\n show (n + 1 : ℂ) = (n + 1 : ℝ) by norm_cast, show (m : ℂ) = (m : ℝ) by norm_cast,\n mul_cpow_ofReal_nonneg m.cast_nonneg Hn, mul_inv, mul_comm]\n congr\n rw [← cpow_neg, show (-x : ℂ) = (-1 : ℝ) * x by simp, cpow_mul_ofReal_nonneg Hn,\n Real.rpow_neg_one, inv_inv]\n\nopen Filter Real in\n/-- If the coefficients `f m` of an L-series are zero for `m ≤ n` and the L-series converges\nat some point, then `f (n+1)` is the limit of `(n+1)^x * LSeries f x` as `x → ∞`. -/\nlemma LSeries.tendsto_cpow_mul_atTop {f : ℕ → ℂ} {n : ℕ} (h : ∀ m ≤ n, f m = 0)\n (ha : abscissaOfAbsConv f < ⊤) :\n Tendsto (fun x : ℝ ↦ (n + 1) ^ (x : ℂ) * LSeries f x) atTop (nhds (f (n + 1))) := by\n obtain ⟨y, hay, hyt⟩ := exists_between ha\n lift y to ℝ using ⟨hyt.ne, ((OrderBot.bot_le _).trans_lt hay).ne'⟩\n -- `F x m` is the `m`th term of `(n+1)^x * LSeries f x`, except that `F x (n+1) = 0`\n let F := fun (x : ℝ) ↦ {m | n + 1 < m}.indicator (fun m ↦ f m / (m / (n + 1) : ℂ) ^ (x : ℂ))\n have hF₀ (x : ℝ) {m : ℕ} (hm : m ≤ n + 1) : F x m = 0 := by simp [F, not_lt_of_ge hm]\n have hF (x : ℝ) {m : ℕ} (hm : m ≠ n + 1) : F x m = ((n + 1) ^ (x : ℂ)) * term f x m := by\n rcases lt_trichotomy m (n + 1) with H | rfl | H\n · simp [Nat.not_lt_of_gt H, term, h m <| Nat.lt_succ_iff.mp H, F]\n · exact (hm rfl).elim\n · simp [H, term, (n.zero_lt_succ.trans H).ne', F, cpow_mul_div_cpow_eq_div_div_cpow]\n have hs {x : ℝ} (hx : x ≥ y) : Summable fun m ↦ (n + 1) ^ (x : ℂ) * term f x m := by\n refine (summable_mul_left_iff <| natCast_add_one_cpow_ne_zero n _).mpr <|\n LSeriesSummable_of_abscissaOfAbsConv_lt_re ?_\n simpa only [ofReal_re] using hay.trans_le <| EReal.coe_le_coe_iff.mpr hx\n -- we can write `(n+1)^x * LSeries f x` as `f (n+1)` plus the series over `F x`\n have key : ∀ x ≥ y, (n + 1) ^ (x : ℂ) * LSeries f x = f (n + 1) + ∑' m : ℕ, F x m := by\n intro x hx\n rw [LSeries, ← tsum_mul_left, (hs hx).tsum_eq_add_tsum_ite (n + 1), pow_mul_term_eq f x n]\n congr\n ext1 m\n rcases eq_or_ne m (n + 1) with rfl | hm\n · simp [hF₀ x le_rfl]\n · simp [hm, hF]\n -- reduce to showing that `∑' m, F x m → 0` as `x → ∞`\n conv => enter [3, 1]; rw [← add_zero (f _)]\n refine Tendsto.congr'\n (eventuallyEq_of_mem (s := {x | y ≤ x}) (mem_atTop y) key).symm <| tendsto_const_nhds.add ?_\n -- get the prerequisites for applying dominated convergence\n have hys : Summable (F y) := by\n refine ((hs le_rfl).indicator {m | n + 1 < m}).congr fun m ↦ ?_\n by_cases! hm : n + 1 < m\n · simp [hF, hm, hm.ne']\n · simp [hm, hF₀ _ hm]\n have hc (k : ℕ) : Tendsto (F · k) atTop (nhds 0) := by\n rcases lt_or_ge (n + 1) k with H | H\n · have H₀ : (0 : ℝ) ≤ k / (n + 1) := by positivity\n have H₀' : (0 : ℝ) ≤ (n + 1) / k := by positivity\n have H₁ : (k / (n + 1) : ℂ) = (k / (n + 1) : ℝ) := by push_cast; rfl\n have H₂ : (n + 1) / k < (1 : ℝ) :=\n (div_lt_one <| mod_cast n.succ_pos.trans H).mpr <| mod_cast H\n simp only [Set.mem_setOf_eq, H, Set.indicator_of_mem, F]\n conv =>\n enter [1, x]\n rw [div_eq_mul_inv, H₁, ← ofReal_cpow H₀, ← ofReal_inv, ← Real.inv_rpow H₀, inv_div]\n conv => enter [3, 1]; rw [← mul_zero (f k)]\n exact\n (tendsto_rpow_atTop_of_base_lt_one _ (neg_one_lt_zero.trans_le H₀') H₂).ofReal.const_mul _\n · simp [hF₀ _ H]\n rw [show (0 : ℂ) = tsum (fun _ : ℕ ↦ 0) from tsum_zero.symm]\n refine tendsto_tsum_of_dominated_convergence hys.norm hc <| eventually_iff.mpr ?_\n filter_upwards [mem_atTop y] with y' hy' k\n -- it remains to show that `‖F y' k‖ ≤ ‖F y k‖` (for `y' ≥ y`)\n rcases lt_or_ge (n + 1) k with H | H\n · simp only [Set.mem_setOf_eq, H, Set.indicator_of_mem, norm_div, norm_cpow_real,\n Complex.norm_natCast, F]\n rw [← Nat.cast_one, ← Nat.cast_add, Complex.norm_natCast]\n have hkn : 1 ≤ (k / (n + 1 :) : ℝ) :=\n (one_le_div (by positivity)).mpr <| mod_cast Nat.le_of_succ_le H\n gcongr\n · simp [hF₀ _ H]\n\nopen Filter in\n/-- If the L-series of `f` converges at some point, then `f 1` is the limit of `LSeries f x`\nas `x → ∞`. -/\n\nTarget:\nlemma LSeries.tendsto_atTop {f : ℕ → ℂ} (ha : abscissaOfAbsConv f < ⊤) :\n Tendsto (fun x : ℝ ↦ LSeries f x) atTop (nhds (f 1)) :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"01852622bd580c59af868a9e07645179ad7474c6a61ef24519a8539444958460","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"NumberTheory/LSeries","family_id":"lseries","file_id":"mathlib/Mathlib/NumberTheory/LSeries/Injectivity.lean","sample_id":"25ff82aa69b0c6934ee96e07b5dc1405bc1556a826dc0b6f3fe17c771346776f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"62c9042c5bada54f7629265637e200109ebcc62aa86c0afc8c2ad4da09366c07","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d844d98ecac9aa249056187919e7ed142242d0e1e8531cad6f6a08f027ffd5c3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d86e4bf52041d047197ceb9d1f42dcbff6065adc46b4b00663a325a378883e3f","source_sha256":"b677be1637d0f0510422dcf696d28dc69e3d9a311a292b4280b55b63ec13d4f6","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rintro e he\n ext x\n exact hHG.isLoopAt_congr he","hard_negative":false,"metrics":{"chosen_tokens":11,"rejected_tokens":16,"token_jaccard":0.714286,"token_length_ratio":1.454545},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"e1c07a9caef7865eb30326d194728c4ea78742665310709c172f415ca0e48b4c","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Combinatorics.Graph.Basic\npublic import Mathlib.Tactic.TFAE\n\nNamespace:\nGraph\n\nLocal context:\n/-\nCopyright (c) 2025 Peter Nelson. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Peter Nelson, Jun Kwon\n-/\n/-!\n# Subgraphs of multigraphs\n\nThis file develops the basic theory of subgraphs for multigraphs `Graph α β`:\nthe subgraph relation, standard classes of subgraphs (spanning, induced, closed),\nand the bottom element `⊥`.\n\n## Main definitions\n\n- `H ≤ G`: the subgraph relation as a partial order on graphs. This is the preferred spelling over\n `H.IsSubgraph G` which it is definitionally equal to.\n- `H ≤s G` (`Graph.IsSpanningSubgraph`): `H` has the same vertex set as `G`.\n- `H ≤i G` (`Graph.IsInducedSubgraph`): `H` contains every ambient link between its vertices.\n- `H ≤c G` (`Graph.IsClosedSubgraph`): `H` is a union of components of `G`.\n- `⊥`: empty graph with no vertices or edges as its bottom element.\n\n## Implementation notes\n\nFollowing the overall design of `Graph`, subgraphs are terms of the same type `Graph α β`\nrather than a separate `Subgraph` structure. This allows us to reuse notation and lemmas\nuniformly and to express the subgraph order directly as a partial order on `Graph α β`.\n\n`G ≤ H` is the canonical spelling for \"G is a subgraph of H\". This is definitionally equal to\n`G.IsSubgraph H` which exists only for implementation reasons.\nThe explicit `IsSubgraph` structure is defined so that stronger subgraph notions\n(such as `IsSpanningSubgraph`, `IsInducedSubgraph`, and `IsClosedSubgraph`) can extend it.\nThis allows them to inherit fundamental fields and lemmas like `vertexSet_mono` and `edgeSet_mono`\nwithout lemma duplication. However, in statements and proofs, users use `G ≤ H` instead.\nThe relation `≤` is the `simp` normal form, and the API is developed entirely in terms of it.\n\n## Tags\n\ngraphs, subgraph, induced subgraph, spanning subgraph, closed subgraph\n-/\n\npublic section\n\nvariable {α β : Type*} {x y z u v w : α} {e f : β} {G G₁ G₂ H H₁ H₂ K : Graph α β} {F F₁ F₂ : Set β}\n {X Y : Set α}\n\nopen Set\n\nopen scoped Sym2\n\nnamespace Graph\n\nsection Subgraph\n\n/-- `IsSubgraph H G` is NOT the preferred spelling for the subgraph relation. Please use\n`H ≤ G` instead. -/\n@[mk_iff]\nstructure IsSubgraph (H G : Graph α β) : Prop where\n vertexSet_mono : V(H) ⊆ V(G) := by aesop\n isLink_mono : ∀ ⦃e x y⦄, H.IsLink e x y → G.IsLink e x y := by aesop\n\nattribute [gcongr, grind →] IsSubgraph.vertexSet_mono\n\nlemma IsSubgraph.trans (h₁ : H.IsSubgraph G) (h₂ : G.IsSubgraph G₁) : H.IsSubgraph G₁ :=\n ⟨h₁.1.trans h₂.1, fun _ _ _ h ↦ h₂.2 (h₁.2 h)⟩\n\nlemma IsSubgraph.antisymm (h₁ : H.IsSubgraph G) (h₂ : G.IsSubgraph H) : H = G :=\n Graph.ext (h₁.1.antisymm h₂.1) fun _ _ _ ↦ ⟨(h₁.2 ·), (h₂.2 ·)⟩\n\n/-- `H ≤ G` means `H` is a subgraph of `G`. It is defined as `V(H) ⊆ V(G)` and every link of `H`\nbeing a link of `G`. -/\ninstance : PartialOrder (Graph α β) where\n le := IsSubgraph\n le_refl _ := ⟨le_rfl, fun _ _ _ h ↦ h⟩\n le_trans _ _ _ h₁ h₂ := h₁.trans h₂\n le_antisymm G H h₁ h₂ := h₁.antisymm h₂\n\n@[simp]\nlemma isSubgraph_iff_le : H.IsSubgraph G ↔ H ≤ G := .rfl\n\n@[gcongr]\nlemma IsLink.mono (hHG : H ≤ G) (h : H.IsLink e x y) : G.IsLink e x y := hHG.2 h\n\n@[gcongr, grind →]\nlemma IsSubgraph.edgeSet_mono (h : H ≤ G) : E(H) ⊆ E(G) := by\n intro e he\n obtain ⟨x, y, h'⟩ := exists_isLink_of_mem_edgeSet he\n exact (h'.mono h).edge_mem\n\nprivate lemma IsLink.anti_of_mem (h : G.IsLink e x y) (hHG : H ≤ G) (he : e ∈ E(H)) :\n H.IsLink e x y := by\n obtain ⟨u, v, huv⟩ := exists_isLink_of_mem_edgeSet he\n obtain ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ := (huv.mono hHG).eq_and_eq_or_eq_and_eq h\n · assumption\n exact huv.symm\n\nlemma IsSubgraph.isLink_iff (hHG : H ≤ G) (he : e ∈ E(H)) : H.IsLink e x y ↔ G.IsLink e x y :=\n ⟨fun h ↦ h.mono hHG, fun h ↦ h.anti_of_mem hHG he⟩\n\nlemma IsSubgraph.isLink_eqOn (hHG : H ≤ G) : EqOn H.IsLink G.IsLink E(H) := by\n rintro e he\n ext x y\n exact isLink_iff hHG he\n\n/-- Two subgraphs of the same graph are compatible. -/\nlemma Compatible.of_le_le (hH₁G : H₁ ≤ G) (hH₂G : H₂ ≤ G) : H₁.Compatible H₂ :=\n fun _ he₁ he₂ _ _ ↦ hH₁G.isLink_iff he₁ |>.trans <| (hH₂G.isLink_iff he₂).symm\n\nlemma Compatible.of_le (hHG : H ≤ G) : H.Compatible G := .of_le_le hHG le_rfl\nlemma Compatible.of_ge (hHG : G ≤ H) : H.Compatible G := .of_le_le le_rfl hHG\n\nalias IsSubgraph.compatible := Compatible.of_le\nalias IsSubgraph.compatible' := Compatible.of_ge\n\nlemma Compatible.anti_left (hG₁G : G₁ ≤ G) (h : Compatible G H) : Compatible G₁ H :=\n fun _ he₁ he₂ _ _ ↦ hG₁G.isLink_iff he₁ |>.trans <| h (hG₁G.edgeSet_mono he₁) he₂ ..\n\nlemma Compatible.anti_right (hH₁H : H₁ ≤ H) (h : Compatible G H) : Compatible G H₁ :=\n (h.symm.anti_left hH₁H).symm\n\nlemma Compatible.anti (hG₁G : G₁ ≤ G) (hH₁H : H₁ ≤ H) (h : G.Compatible H) : G₁.Compatible H₁ :=\n (h.anti_left hG₁G).anti_right hH₁H\n\n@[gcongr]\nlemma Inc.mono (hHG : H ≤ G) (h : H.Inc e x) : G.Inc e x :=\n (h.choose_spec.mono hHG).inc_left\n\nlemma IsSubgraph.inc_congr (hHG : H ≤ G) (he : e ∈ E(H)) : H.Inc e x ↔ G.Inc e x := by\n simp_rw [Graph.Inc, hHG.isLink_iff he]\n\nlemma IsSubgraph.inc_eqOn (hHG : H ≤ G) : EqOn H.Inc G.Inc E(H) := by\n rintro e he\n ext x\n exact hHG.inc_congr he\n\nlemma IsLoopAt.mono (hHG : H ≤ G) (h : H.IsLoopAt e x) : G.IsLoopAt e x :=\n IsLink.mono hHG h\n\nlemma IsSubgraph.isLoopAt_congr (hHG : H ≤ G) (he : e ∈ E(H)) :\n H.IsLoopAt e x ↔ G.IsLoopAt e x := by\n unfold Graph.IsLoopAt\n rw [hHG.isLink_iff he]\n\nTarget:\nlemma IsSubgraph.isLoopAt_eqOn (hHG : H ≤ G) : EqOn H.IsLoopAt G.IsLoopAt E(H) :=\n\nProof body:\n","rejected":"by\n rintro e he\n ext x\n exact hHG.isLoopAt_congr he\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Combinatorics/Graph","family_id":"issubgraph","file_id":"mathlib/Mathlib/Combinatorics/Graph/Subgraph.lean","sample_id":"d86e4bf52041d047197ceb9d1f42dcbff6065adc46b4b00663a325a378883e3f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"7705d6eb19a9665f0206eeba301b6ce8e18e50335613523dc57f068240dd516d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"b2e48b9a117672e670b39a97a4d11deb71e3df508ca12c3c895d13eb1071268f","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"c34f306310edfad9ab85f28dd6a805e4bf0fcb55e44267f085d1a69e3cc49b66","source_sha256":"baf559ab5fd26edca1eca75118e019b5d41dddd237c03529db8e155c6d33c743","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let R := MvPolynomial σ F\n let K := FractionRing R\n refine ((rank_le_card _ _).trans ?_).antisymm ?_\n · rw [FractionRing.cardinalMk, MvPolynomial.cardinalMk_eq_max_lift]\n have hinj := IsFractionRing.injective R K\n have h1 := (IsScalarTower.toAlgHom F R K).toLinearMap.rank_le_of_injective hinj\n rw [MvPolynomial.rank_eq_lift, mk_finsupp_nat, lift_max, lift_aleph0, max_le_iff] at h1\n obtain ⟨i⟩ := ‹Nonempty σ›\n have hx : Transcendental F (algebraMap R K (MvPolynomial.X i)) :=\n (transcendental_algebraMap_iff hinj).2 (MvPolynomial.transcendental_X F i)\n have h2 := hx.linearIndependent_sub_inv.cardinal_lift_le_rank\n rw [lift_id'.{v, u}, lift_umax.{v, u}] at h2\n exact max_le (max_le h2 h1.1) h1.2","hard_negative":true,"metrics":{"chosen_tokens":158,"rejected_tokens":5,"token_jaccard":0.043478,"token_length_ratio":0.031646},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"e48560e9744b2131140b03f0896868dae4adfeeebb9ab25283509c68b7d6bb76","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.MvPolynomial.Cardinal\npublic import Mathlib.RingTheory.Algebraic.LinearIndependent\npublic import Mathlib.RingTheory.Algebraic.MvPolynomial\npublic import Mathlib.RingTheory.Localization.Cardinality\npublic import Mathlib.RingTheory.MvPolynomial\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jz Pan. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jz Pan\n-/\n/-!\n# Rank of multivariate rational function field\n-/\n\npublic section\n\nnoncomputable section\n\nuniverse u v\n\nopen Cardinal in\n\nTarget:\ntheorem MvRatFunc.rank_eq_max_lift\n {σ : Type u} {F : Type v} [Field F] [Nonempty σ] :\n Module.rank F (FractionRing (MvPolynomial σ F)) = lift.{u} #F ⊔ lift.{v} #σ ⊔ ℵ₀ :=\n\nProof body:\n","rejected":"by\n exact MvRatFunc.rank_eq_max_lift","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"5bbbcf78deaf8cfa65122cfd3e32b481ab3f1f8db33ae24d205057b704292751","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"FieldTheory/MvRatFunc","family_id":"mvratfunc","file_id":"mathlib/Mathlib/FieldTheory/MvRatFunc/Rank.lean","sample_id":"c34f306310edfad9ab85f28dd6a805e4bf0fcb55e44267f085d1a69e3cc49b66"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5da84bd0d1be7a3e6cf126249f34c2eb9e6110ebc8d9192701d4f2343420fb7f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"a10a5940ffd9e35becda0a35c77066b9be40540fbb462be95ac67016972bd5f8","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"15deaf5ee94786e6935d71ab270cadc448f09971bd8d7e2328049e45ac9129c6","source_sha256":"c5f2821e1022912479225343e085671f902aa490700adbce0fd87ebd02ef26e6","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [range_eq_top, ker_eq_bot, injective_iff_surjective_of_finrank_eq_finrank H]\n\n/-- Given a linear map `f` between two vector spaces with the same dimension, if\n`ker f = ⊥` then `linearEquivOfInjective` is the induced isomorphism\nbetween the two vector spaces. -/\nnoncomputable def linearEquivOfInjective [FiniteDimensional K V] [FiniteDimensional K V₂]\n (f : V →ₗ[K] V₂) (hf : Injective f) (hdim : finrank K V = finrank K V₂) : V ≃ₗ[K] V₂ :=\n LinearEquiv.ofBijective f\n ⟨hf, (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hdim).mp hf⟩","hard_negative":true,"metrics":{"chosen_tokens":123,"rejected_tokens":3,"token_jaccard":0.016667,"token_length_ratio":0.02439},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"e51498da61419514371debb40dc461ace0b4ea3c841f860a31b612fe3bc249bd","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Dimension.DivisionRing\npublic import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition\npublic import Mathlib.LinearAlgebra.FiniteDimensional.Basic\npublic import Mathlib.Tactic.IntervalCases\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\nCopyright (c) 2019 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Finite-dimensional vector spaces\n\nThis file contains some further development of finite-dimensional vector spaces, their dimensions,\nand linear maps on such spaces.\n\nDefinitions are in `Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean`\nand results that require fewer imports are in `Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean`.\n-/\n\n@[expose] public section\n\nassert_not_exists Monoid.exponent Module.IsTorsion\n\n\nuniverse u v v'\n\nopen Cardinal Submodule Module Function\n\nvariable {K : Type u} {V : Type v}\n\nnamespace Submodule\n\nopen IsNoetherian Module\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V]\n\n/-- The dimension of a strict submodule is strictly bounded by the dimension of the ambient\nspace.\n\nSee also `Submodule.length_lt`. -/\ntheorem finrank_lt [FiniteDimensional K V] {s : Submodule K V} (h : s ≠ ⊤) :\n finrank K s < finrank K V := by\n rw [← s.finrank_quotient_add_finrank, add_comm]\n rw [← Quotient.nontrivial_iff] at h\n exact Nat.lt_add_of_pos_right finrank_pos\n\n/-- The sum of the dimensions of s + t and s ∩ t is the sum of the dimensions of s and t -/\ntheorem finrank_sup_add_finrank_inf_eq (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] :\n finrank K ↑(s ⊔ t) + finrank K ↑(s ⊓ t) = finrank K ↑s + finrank K ↑t := by\n have key : Module.rank K ↑(s ⊔ t) + Module.rank K ↑(s ⊓ t) = Module.rank K s + Module.rank K t :=\n rank_sup_add_rank_inf_eq s t\n repeat rw [← finrank_eq_rank] at key\n norm_cast at key\n\ntheorem finrank_add_le_finrank_add_finrank (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] : finrank K (s ⊔ t : Submodule K V) ≤ finrank K s + finrank K t := by\n rw [← finrank_sup_add_finrank_inf_eq]\n exact self_le_add_right _ _\n\ntheorem finrank_add_finrank_le_of_disjoint [FiniteDimensional K V]\n {s t : Submodule K V} (hdisjoint : Disjoint s t) :\n finrank K s + finrank K t ≤ finrank K V := by\n rw [← Submodule.finrank_sup_add_finrank_inf_eq s t, hdisjoint.eq_bot, finrank_bot, add_zero]\n exact Submodule.finrank_le _\n\ntheorem eq_top_of_disjoint [FiniteDimensional K V] (s t : Submodule K V)\n (hdim : finrank K V ≤ finrank K s + finrank K t) (hdisjoint : Disjoint s t) : s ⊔ t = ⊤ := by\n have h_finrank_inf : finrank K ↑(s ⊓ t) = 0 := by\n rw [disjoint_iff_inf_le, le_bot_iff] at hdisjoint\n rw [hdisjoint, finrank_bot]\n apply eq_top_of_finrank_eq\n replace hdim : finrank K V = finrank K s + finrank K t :=\n le_antisymm hdim (finrank_add_finrank_le_of_disjoint hdisjoint)\n rw [hdim]\n convert! s.finrank_sup_add_finrank_inf_eq t\n rw [h_finrank_inf, add_zero]\n\ntheorem isCompl_iff_disjoint [FiniteDimensional K V] (s t : Submodule K V)\n (hdim : finrank K V ≤ finrank K s + finrank K t) :\n IsCompl s t ↔ Disjoint s t :=\n ⟨fun h ↦ h.1, fun h ↦ ⟨h, codisjoint_iff.mpr <| eq_top_of_disjoint s t hdim h⟩⟩\n\ntheorem sup_span_singleton_eq_top_iff [Module.Finite K V] {W : Submodule K V} {v : V} (hv : v ∉ W) :\n W ⊔ span K {v} = ⊤ ↔ finrank K (V ⧸ W) = 1 := by\n refine ⟨fun hW ↦ ?_, fun hW ↦ ?_⟩\n · suffices W ⊓ span K {v} = ⊥ by\n have hv₀ : v ≠ 0 := by aesop\n have aux := finrank_sup_add_finrank_inf_eq W (span K {v})\n rw [hW, finrank_span_singleton hv₀, this, finrank_bot, finrank_top,\n ← finrank_quotient_add_finrank W] at aux\n lia\n refine (Submodule.eq_bot_iff _).mpr fun w hw ↦ ?_\n obtain ⟨ht, t, rfl⟩ : w ∈ W ∧ ∃ t : K, t • v = w := by simpa [mem_span_singleton] using hw\n rcases eq_or_ne t 0 with rfl | ht₀; · simp\n rw [Submodule.smul_mem_iff _ ht₀] at ht\n contradiction\n · apply Submodule.eq_top_of_disjoint\n · rw [← W.finrank_quotient_add_finrank, add_comm, add_le_add_iff_left, hW]\n aesop\n · exact Submodule.disjoint_span_singleton_of_notMem hv\n\ntheorem finrank_sup_span_singleton [Module.Finite K V] {p : Submodule K V} {v : V} (hv : v ∉ p) :\n finrank K (p ⊔ Submodule.span K {v} : Submodule K V) = finrank K p + 1 := by\n rw [← Nat.add_left_inj, finrank_sup_add_finrank_inf_eq, add_assoc,\n Nat.add_left_cancel_iff, finrank_span_singleton (by aesop),\n Nat.left_eq_add, Submodule.finrank_eq_zero, eq_bot_iff]\n intro x\n simp only [mem_inf, mem_span_singleton]\n rintro ⟨hx, ⟨a, hx'⟩⟩\n rw [← hx'] at hx\n suffices a = 0 by simp [← hx', this]\n contrapose hv\n simpa [smul_mem_iff p hv] using hx\n\ntheorem eq_top_iff_finrank_eq [Module.Finite K V] {W : Submodule K V} :\n W = ⊤ ↔ finrank K W = finrank K V := by\n refine ⟨fun h ↦ by rw [h, finrank_top], fun h ↦ ?_⟩\n apply eq_of_le_of_finrank_eq le_top\n rw [finrank_top, h]\n\nend DivisionRing\n\nend Submodule\n\nnamespace FiniteDimensional\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]\n [Module K V₂]\n\nvariable [FiniteDimensional K V] [FiniteDimensional K V₂]\n\n/-- Given isomorphic subspaces `p q` of vector spaces `V` and `V₁` respectively,\n `p.quotient` is isomorphic to `q.quotient`. -/\nnoncomputable def LinearEquiv.quotEquivOfEquiv {p : Subspace K V} {q : Subspace K V₂}\n (f₁ : p ≃ₗ[K] q) (f₂ : V ≃ₗ[K] V₂) : (V ⧸ p) ≃ₗ[K] V₂ ⧸ q :=\n LinearEquiv.ofFinrankEq _ _\n (by\n rw [← @add_right_cancel_iff _ _ _ (finrank K p), Submodule.finrank_quotient_add_finrank,\n LinearEquiv.finrank_eq f₁, Submodule.finrank_quotient_add_finrank,\n LinearEquiv.finrank_eq f₂])\n\n-- TODO: generalize to the case where one of `p` and `q` is finite-dimensional.\n/-- Given the subspaces `p q`, if `p.quotient ≃ₗ[K] q`, then `q.quotient ≃ₗ[K] p` -/\nnoncomputable def LinearEquiv.quotEquivOfQuotEquiv {p q : Subspace K V} (f : (V ⧸ p) ≃ₗ[K] q) :\n (V ⧸ q) ≃ₗ[K] p :=\n LinearEquiv.ofFinrankEq _ _ <| by\n rw [← add_right_cancel_iff, Submodule.finrank_quotient_add_finrank, ← LinearEquiv.finrank_eq f,\n add_comm, Submodule.finrank_quotient_add_finrank]\n\nend DivisionRing\n\nend FiniteDimensional\n\nnamespace LinearMap\n\nopen Module\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]\n [Module K V₂]\n\n/-- rank-nullity theorem : the dimensions of the kernel and the range of a linear map add up to\nthe dimension of the source space. -/\ntheorem finrank_range_add_finrank_ker [FiniteDimensional K V] (f : V →ₗ[K] V₂) :\n finrank K (LinearMap.range f) + finrank K (LinearMap.ker f) = finrank K V := by\n rw [← f.quotKerEquivRange.finrank_eq]\n exact Submodule.finrank_quotient_add_finrank _\n\nlemma ker_ne_bot_of_finrank_lt [FiniteDimensional K V] [FiniteDimensional K V₂] {f : V →ₗ[K] V₂}\n (h : finrank K V₂ < finrank K V) :\n LinearMap.ker f ≠ ⊥ := by\n have h₁ := f.finrank_range_add_finrank_ker\n have h₂ : finrank K (LinearMap.range f) ≤ finrank K V₂ := (LinearMap.range f).finrank_le\n suffices 0 < finrank K (LinearMap.ker f) from Submodule.one_le_finrank_iff.mp this\n lia\n\nend DivisionRing\n\nend LinearMap\n\nopen Module\n\nnamespace LinearMap\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]\n [Module K V₂]\n\ntheorem injective_iff_surjective_of_finrank_eq_finrank [FiniteDimensional K V]\n [FiniteDimensional K V₂] (H : finrank K V = finrank K V₂) {f : V →ₗ[K] V₂} :\n Function.Injective f ↔ Function.Surjective f := by\n have := finrank_range_add_finrank_ker f\n rw [← ker_eq_bot, ← range_eq_top]; refine ⟨fun h => ?_, fun h => ?_⟩\n · rw [h, finrank_bot, add_zero, H] at this\n exact eq_top_of_finrank_eq this\n · rw [h, finrank_top, H] at this\n exact Submodule.finrank_eq_zero.1 (add_right_injective _ this)\n\nTarget:\ntheorem ker_eq_bot_iff_range_eq_top_of_finrank_eq_finrank [FiniteDimensional K V]\n [FiniteDimensional K V₂] (H : finrank K V = finrank K V₂) {f : V →ₗ[K] V₂} :\n LinearMap.ker f = ⊥ ↔ LinearMap.range f = ⊤ :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_15deaf5ee947","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"1a44faa2b14b78500bbdfc0c91e35e09268992916b403a4cc7b1fc3c70e4d467","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/FiniteDimensional","family_id":"ker_eq_bot_iff_range_eq_top_of_finrank_eq_finrank","file_id":"mathlib/Mathlib/LinearAlgebra/FiniteDimensional/Lemmas.lean","sample_id":"15deaf5ee94786e6935d71ab270cadc448f09971bd8d7e2328049e45ac9129c6"},"split":"validation"} {"binding":{"chosen_proof_sha256":"8efa52167af4dc6aed9cad04396233409251247d3b8dc17d938fdbd5acce7285","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"d703bedc00b8baa5507330089a3de74526d90fdf38960507d35b21e0299b1332","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4ac347a989fd8ea5e6ec0e3b87556922074b79295b78f1810c14980222c16f8c","source_sha256":"6dfadbed89161d0363647ee7f6757fe09c64d28a6da281daa18f41608b61c825","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n apply natTrans_ext <;> ext <;> simp [mapCompRight]","hard_negative":true,"metrics":{"chosen_tokens":14,"rejected_tokens":5,"token_jaccard":0.066667,"token_length_ratio":0.357143},"negative_category":"wrong_namespace_qualification","negative_mode":"wrong_namespace_qualification","pair_id":"e68b462a12e4046a7e5e8b782dbc90690f5154af4ac5f7b28358c119a25a30f9","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Join.Basic\npublic import Mathlib.CategoryTheory.Bicategory.Functor.Pseudofunctor\n\nNamespace:\nCategoryTheory.Join\n\nLocal context:\n/-\nCopyright (c) 2025 Robin Carlier. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Robin Carlier\n-/\n/-!\n# Pseudofunctoriality of categorical joins\n\nIn this file, we promote the join construction to two pseudofunctors\n`Join.pseudofunctorLeft` and `Join.pseudofunctorRight`, expressing its pseudofunctoriality in\neach variable.\n\n-/\n\n@[expose] public section\n\nuniverse v₁ v₂ u₁ u₂\n\nnamespace CategoryTheory.Join\n\nopen Bicategory Functor\n\n-- The proof gets too slow if we put it in a single `pseudofunctor` constructor,\n-- so we break down the component proofs for the pseudofunctors over several lemmas.\n\nsection\nvariable {A B C D : Type*} [Category* A] [Category* B] [Category* C] [Category* D]\n\n\nvariable (A) in\n/-- The structural isomorphism for composition of `pseudofunctorRight`. -/\ndef mapCompRight (F : B ⥤ C) (G : C ⥤ D) :\n mapPair (𝟭 A) (F ⋙ G) ≅ mapPair (𝟭 A) F ⋙ mapPair (𝟭 A) G :=\n mapIsoWhiskerRight (Functor.leftUnitor _).symm _ ≪≫ mapPairComp (𝟭 A) F (𝟭 A) G\n\nvariable (D) in\n/-- The structural isomorphism for composition of `pseudofunctorLeft`. -/\ndef mapCompLeft (F : A ⥤ B) (G : B ⥤ C) :\n mapPair (F ⋙ G) (𝟭 D) ≅ mapPair F (𝟭 D) ⋙ mapPair G (𝟭 D) :=\n mapIsoWhiskerLeft _ (Functor.leftUnitor _).symm ≪≫ mapPairComp F (𝟭 D) G (𝟭 D)\n\nset_option backward.defeqAttrib.useBackward true in\nvariable (A) in\n@[reassoc]\n\nTarget:\nlemma mapWhiskerLeft_whiskerLeft (F : B ⥤ C) {G H : C ⥤ D} (η : G ⟶ H) :\n mapWhiskerLeft _ (whiskerLeft F η) =\n (mapCompRight A F G).hom ≫ whiskerLeft (mapPair (𝟭 A) F) (mapWhiskerLeft _ η) ≫\n (mapCompRight A F H).inv :=\n\nProof body:\n","rejected":"by\n exact OProverMissing.missing_4ac347a989fd","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"cf5010a122cfa2691d5d7b94c6d8417fb1a4cac35333144f9d919cc8f31e508e","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Join","family_id":"mapwhiskerleft_whiskerleft","file_id":"mathlib/Mathlib/CategoryTheory/Join/Pseudofunctor.lean","sample_id":"4ac347a989fd8ea5e6ec0e3b87556922074b79295b78f1810c14980222c16f8c"},"split":"validation"} {"binding":{"chosen_proof_sha256":"cb9f44b11b2405abffc6cf02d9d6ca0828a51fac742a41f2c3aa8b22c89acf20","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"0d002db9cc8388d0bb048c967b6cc0ba1b001333a19addabc857b0bfa660e31e","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"5392c952d864de7d73f7a4f425440c3c7d14586f78c2e6b44435f523faea7ef2","source_sha256":"e123ed5591679e8fbff485a4307c62b93299618db2753a3e9ba7f6502bdbcbe7","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← π.biUnionIndex_of_mem (πi := fun J => (πi J).toPrepartition) hJ hJ']\n rfl","hard_negative":true,"metrics":{"chosen_tokens":26,"rejected_tokens":8,"token_jaccard":0.083333,"token_length_ratio":0.307692},"negative_category":"unsolved_goals","negative_mode":"unsolved_goals","pair_id":"e8927f86e813f171ab746357b8f2b0d3b0b343e81c5d510d09d64d0217f8845e","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Analysis.BoxIntegral.Partition.Basic\n\nNamespace:\nBoxIntegral.Prepartition\n\nLocal context:\n/-\nCopyright (c) 2021 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Tagged partitions\n\nA tagged (pre)partition is a (pre)partition `π` enriched with a tagged point for each box of\n`π`. For simplicity we require that the function `BoxIntegral.TaggedPrepartition.tag` is defined\non all boxes `J : Box ι` but use its values only on boxes of the partition. Given\n`π : BoxIntegral.TaggedPrepartition I`, we require that each `BoxIntegral.TaggedPrepartition π J`\nbelongs to `BoxIntegral.Box.Icc I`. If for every `J ∈ π`, `π.tag J` belongs to `J.Icc`, then `π` is\ncalled a *Henstock* partition. We do not include this assumption into the definition of a tagged\n(pre)partition because McShane integral is defined as a limit along tagged partitions without this\nrequirement.\n\n## Tags\n\nrectangular box, box partition\n-/\n\n@[expose] public section\n\n\nnoncomputable section\n\nopen Finset Function ENNReal NNReal Set\n\nnamespace BoxIntegral\n\nvariable {ι : Type*}\n\n/-- A tagged prepartition is a prepartition enriched with a tagged point for each box of the\nprepartition. For simplicity we require that `tag` is defined for all boxes in `ι → ℝ` but\nwe will use only the values of `tag` on the boxes of the partition. -/\nstructure TaggedPrepartition (I : Box ι) extends Prepartition I where\n /-- Choice of tagged point of each box in this prepartition:\n we extend this to a total function, on all boxes in `ι → ℝ`. -/\n tag : Box ι → ι → ℝ\n /-- Each tagged point belongs to `I` -/\n tag_mem_Icc : ∀ J, tag J ∈ Box.Icc I\n\nnamespace TaggedPrepartition\n\nvariable {I J J₁ J₂ : Box ι} (π : TaggedPrepartition I) {x : ι → ℝ}\n\ninstance : Membership (Box ι) (TaggedPrepartition I) :=\n ⟨fun π J => J ∈ π.boxes⟩\n\n@[simp]\ntheorem mem_toPrepartition {π : TaggedPrepartition I} : J ∈ π.toPrepartition ↔ J ∈ π := Iff.rfl\n\n@[simp]\ntheorem mem_mk (π : Prepartition I) (f h) : J ∈ mk π f h ↔ J ∈ π := Iff.rfl\n\n/-- Union of all boxes of a tagged prepartition. -/\ndef iUnion : Set (ι → ℝ) :=\n π.toPrepartition.iUnion\n\ntheorem iUnion_def : π.iUnion = ⋃ J ∈ π, ↑J := rfl\n\n@[simp]\ntheorem iUnion_mk (π : Prepartition I) (f h) : (mk π f h).iUnion = π.iUnion := rfl\n\n@[simp]\ntheorem iUnion_toPrepartition : π.toPrepartition.iUnion = π.iUnion := rfl\n\n@[simp]\ntheorem mem_iUnion : x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J := by\n convert! Set.mem_iUnion₂\n rw [Box.mem_coe, mem_toPrepartition, exists_prop]\n\ntheorem subset_iUnion (h : J ∈ π) : ↑J ⊆ π.iUnion :=\n subset_biUnion_of_mem h\n\ntheorem iUnion_subset : π.iUnion ⊆ I :=\n iUnion₂_subset π.le_of_mem'\n\n/-- A tagged prepartition is a partition if it covers the whole box. -/\ndef IsPartition :=\n π.toPrepartition.IsPartition\n\ntheorem isPartition_iff_iUnion_eq : IsPartition π ↔ π.iUnion = I :=\n Prepartition.isPartition_iff_iUnion_eq\n\n/-- The tagged partition made of boxes of `π` that satisfy predicate `p`. -/\n@[simps! -fullyApplied]\ndef filter (p : Box ι → Prop) : TaggedPrepartition I :=\n ⟨π.1.filter p, π.2, π.3⟩\n\n@[simp]\ntheorem mem_filter {p : Box ι → Prop} : J ∈ π.filter p ↔ J ∈ π ∧ p J := by\n classical exact Finset.mem_filter\n\n@[simp]\ntheorem iUnion_filter_not (π : TaggedPrepartition I) (p : Box ι → Prop) :\n (π.filter fun J => ¬p J).iUnion = π.iUnion \\ (π.filter p).iUnion :=\n π.toPrepartition.iUnion_filter_not p\n\nend TaggedPrepartition\n\nnamespace Prepartition\n\nvariable {I J : Box ι}\n\n/-- Given a partition `π` of `I : BoxIntegral.Box ι` and a collection of tagged partitions\n`πi J` of all boxes `J ∈ π`, returns the tagged partition of `I` into all the boxes of `πi J`\nwith tags coming from `(πi J).tag`. -/\ndef biUnionTagged (π : Prepartition I) (πi : ∀ J : Box ι, TaggedPrepartition J) :\n TaggedPrepartition I where\n toPrepartition := π.biUnion fun J => (πi J).toPrepartition\n tag J := (πi (π.biUnionIndex (fun J => (πi J).toPrepartition) J)).tag J\n tag_mem_Icc _ := Box.le_iff_Icc.1 (π.biUnionIndex_le _ _) ((πi _).tag_mem_Icc _)\n\n@[simp]\ntheorem mem_biUnionTagged (π : Prepartition I) {πi : ∀ J, TaggedPrepartition J} :\n J ∈ π.biUnionTagged πi ↔ ∃ J' ∈ π, J ∈ πi J' :=\n π.mem_biUnion\n\nTarget:\ntheorem tag_biUnionTagged (π : Prepartition I) {πi : ∀ J, TaggedPrepartition J} (hJ : J ∈ π) {J'}\n (hJ' : J' ∈ πi J) : (π.biUnionTagged πi).tag J' = (πi J).tag J' :=\n\nProof body:\n","rejected":"by\n have __oprover_safe_h : True := by trivial","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"83e34b061eb03a56332f3e264665f3b71da0e7ea2983e982f147a7f80745ad6e","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Analysis/BoxIntegral","family_id":"tag_biuniontagged","file_id":"mathlib/Mathlib/Analysis/BoxIntegral/Partition/Tagged.lean","sample_id":"5392c952d864de7d73f7a4f425440c3c7d14586f78c2e6b44435f523faea7ef2"},"split":"validation"} {"binding":{"chosen_proof_sha256":"c2d1b36b47fcd7b47b6135d0086a29b0331665d9175ab2341352e4ceeb8b56e6","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"f2f6cc2157092404dc010abfd644c5d445e78df6834a45281d5f2736e44ef469","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"13ff775f4d82f815741502e8f749c57138d039bac39dd4e71a59e8a02adc837f","source_sha256":"dfcdfb7def47f0bcbcab37ea254b17db55b5da584b38ce7ceb07bc11e4db6c04","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]","hard_negative":true,"metrics":{"chosen_tokens":15,"rejected_tokens":2,"token_jaccard":0.071429,"token_length_ratio":0.133333},"negative_category":"invalid_tactic","negative_mode":"invalid_tactic","pair_id":"ebb5de6fae50681aa82cccac073638147c263a420e8aeabfb9f81b2e282d1331","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Control.Bitraversable.Basic\n\nNamespace:\nBitraversable\n\nLocal context:\n/-\nCopyright (c) 2019 Simon Hudon. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Simon Hudon\n-/\n/-!\n# Bitraversable Lemmas\n\n## Main definitions\n * tfst - traverse on first functor argument\n * tsnd - traverse on second functor argument\n\n## Lemmas\n\nCombination of\n * bitraverse\n * tfst\n * tsnd\n\nwith the applicatives `id` and `comp`\n\n## References\n\n* Hackage: \n\n## Tags\n\ntraversable bitraversable functor bifunctor applicative\n\n\n-/\n\npublic section\n\n\nuniverse u\n\nvariable {t : Type u → Type u → Type u} [Bitraversable t]\nvariable {β : Type u}\n\nnamespace Bitraversable\n\nopen Functor LawfulApplicative\n\nvariable {F G : Type u → Type u} [Applicative F] [Applicative G]\n\n/-- traverse on the first functor argument -/\nabbrev tfst {α α'} (f : α → F α') : t α β → F (t α' β) :=\n bitraverse f pure\n\n/-- traverse on the second functor argument -/\nabbrev tsnd {α α'} (f : α → F α') : t β α → F (t β α') :=\n bitraverse pure f\n\nvariable [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G]\n\n@[higher_order tfst_id]\ntheorem id_tfst : ∀ {α β} (x : t α β), tfst (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tsnd_id]\ntheorem id_tsnd : ∀ {α β} (x : t α β), tsnd (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tfst_comp_tfst]\ntheorem comp_tfst {α₀ α₁ α₂ β} (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β) :\n Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, tfst, map_pure, Pure.pure]\n\n@[higher_order tfst_comp_tsnd]\ntheorem tfst_tsnd {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tfst f <$> tsnd f' x)\n = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n\n@[higher_order tsnd_comp_tfst]\n\nTarget:\ntheorem tsnd_tfst {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tsnd f' <$> tfst f x)\n = bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x :=\n\nProof body:\n","rejected":"by\n __oprover_invalid_tactic_13ff775f4d82","rejection":{"accepted":false,"failure_type":"unsolved_goals","output_sha256":"b3a8ba600bc048105669f5e986a394c4d4021647ff2d077511ef79bc40b29cd2","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Control/Bitraversable","family_id":"tsnd_tfst","file_id":"mathlib/Mathlib/Control/Bitraversable/Lemmas.lean","sample_id":"13ff775f4d82f815741502e8f749c57138d039bac39dd4e71a59e8a02adc837f"},"split":"validation"} {"binding":{"chosen_proof_sha256":"0905756c2396ecd50373c7495fa57410ab608eb21629d69318b9d171d1cbbd95","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"4d1a4e33cb25b2f5344cc085a1aad91ce8e04495864db138f336dd6921586b7c","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"24a50e7c923889ee600c6124112db36d9e99116f749fac0c7fb2453afa7f8437","source_sha256":"43006e022782a083a6e27e774534747103f94575f40281c1e1972ea93b801577","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rcases hs.exists_countable_dense_subset with ⟨t, hts, htc, hst⟩\n lift t to Set s using hts\n refine ⟨⟨t, countable_of_injective_of_countable_image Subtype.coe_injective.injOn htc, ?_⟩⟩\n rwa [IsInducing.subtypeVal.dense_iff, Subtype.forall]","hard_negative":false,"metrics":{"chosen_tokens":51,"rejected_tokens":58,"token_jaccard":0.941176,"token_length_ratio":1.137255},"negative_category":"markdown_preamble_trailing","negative_mode":"fence","pair_id":"ebf120b5055e44d7dafb5f803e8c2384170d517e68c5d6de3a6878bb17dbbc1b","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Topology.UniformSpace.Pi\n\nNamespace:\nTopologicalSpace\n\nLocal context:\n/-\nCopyright (c) 2021 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Metrizable Spaces\n\nIn this file we define metrizable topological spaces, i.e., topological spaces for which there\nexists a metric space structure that generates the same topology.\nWe define it without any reference to metric spaces in order to avoid importing the real numbers.\nFor the proof that metrizable spaces admit a compatible metric,\nsee `Mathlib/Topology/Metrizable/Uniformity.lean`.\n-/\n\n-- don't import the real numbers\nassert_not_exists AddMonoidWithOne\n\npublic section\n\nopen Filter Set Topology Uniformity UniformSpace SetRel\n\nnamespace TopologicalSpace\n\nvariable {ι X Y : Type*} {A : ι → Type*} [TopologicalSpace X] [TopologicalSpace Y] [Finite ι]\n [∀ i, TopologicalSpace (A i)]\n\n/-- A topological space is *pseudometrizable* if there exists a pseudometric space structure\ncompatible with the topology. To minimize imports, we implement this class in terms of the\nexistence of a countably generated uniformity inducing the topology, which is mathematically\nequivalent.\nTo endow such a space with a compatible uniformity, use\n`letI : UniformSpace X := TopologicalSpace.pseudoMetrizableSpaceUniformity X`.\nTo endow such a space with a compatible distance, use\n`letI : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X`. -/\nclass PseudoMetrizableSpace (X : Type*) [t : TopologicalSpace X] : Prop where\n exists_countably_generated :\n ∃ u : UniformSpace X, u.toTopologicalSpace = t ∧ (uniformity X).IsCountablyGenerated\n\n/-- A uniform space with countably generated `𝓤 X` is pseudometrizable. -/\ninstance (priority := 100) _root_.UniformSpace.pseudoMetrizableSpace {X : Type*}\n [u : UniformSpace X] [hu : IsCountablyGenerated (uniformity X)] : PseudoMetrizableSpace X :=\n ⟨⟨u, rfl, hu⟩⟩\n\n/-- Construct on a pseudometrizable space a countably generated uniformity\ncompatible with the topology. Use `pseudoMetrizableSpaceUniformity_countably_generated` for a proof\nthat this uniformity is countably generated. -/\n-- see note [reducible non-instances]\nnoncomputable abbrev pseudoMetrizableSpaceUniformity (X : Type*) [TopologicalSpace X]\n [h : PseudoMetrizableSpace X] : UniformSpace X :=\n h.exists_countably_generated.choose.replaceTopology\n h.exists_countably_generated.choose_spec.1.symm\n\nexample {X : Type*} [t : TopologicalSpace X] [PseudoMetrizableSpace X] :\n (pseudoMetrizableSpaceUniformity X).toTopologicalSpace = t := by\n with_reducible_and_instances rfl\n\n/-- The uniformity coming from `pseudoMetrizableSpaceUniformity` is countably generated.. -/\ntheorem pseudoMetrizableSpaceUniformity_countably_generated\n (X : Type*) [TopologicalSpace X] [h : PseudoMetrizableSpace X] :\n 𝓤[pseudoMetrizableSpaceUniformity X].IsCountablyGenerated :=\n h.exists_countably_generated.choose_spec.2\n\ninstance pseudoMetrizableSpace_prod [PseudoMetrizableSpace X] [PseudoMetrizableSpace Y] :\n PseudoMetrizableSpace (X × Y) :=\n let : UniformSpace X := pseudoMetrizableSpaceUniformity X\n have : (uniformity X).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated X\n let : UniformSpace Y := pseudoMetrizableSpaceUniformity Y\n have : (uniformity Y).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated Y\n inferInstance\n\n/-- Given an inducing map of a topological space into a pseudometrizable space, the source space\nis also pseudometrizable. -/\ntheorem _root_.Topology.IsInducing.pseudoMetrizableSpace [PseudoMetrizableSpace Y] {f : X → Y}\n (hf : IsInducing f) : PseudoMetrizableSpace X :=\n let u : UniformSpace Y := pseudoMetrizableSpaceUniformity Y\n have : (uniformity Y).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated Y\n ⟨⟨u.comap f, u.toTopologicalSpace_comap.trans hf.eq_induced.symm,\n Filter.comap.isCountablyGenerated (uniformity Y) (Prod.map f f)⟩⟩\n\n/-- Every pseudo-metrizable space is first countable. -/\ninstance (priority := 100) PseudoMetrizableSpace.firstCountableTopology\n [h : PseudoMetrizableSpace X] : FirstCountableTopology X :=\n let : UniformSpace X := pseudoMetrizableSpaceUniformity X\n have : (uniformity X).IsCountablyGenerated :=\n pseudoMetrizableSpaceUniformity_countably_generated X\n inferInstance\n\ninstance PseudoMetrizableSpace.subtype [PseudoMetrizableSpace X] (s : Set X) :\n PseudoMetrizableSpace s :=\n IsInducing.subtypeVal.pseudoMetrizableSpace\n\ninstance pseudoMetrizableSpace_pi [∀ i, PseudoMetrizableSpace (A i)] :\n PseudoMetrizableSpace (∀ i, A i) :=\n let := fun i => pseudoMetrizableSpaceUniformity (A i)\n have := fun i => pseudoMetrizableSpaceUniformity_countably_generated (A i)\n inferInstance\n\ninstance PseudoMetrizableSpace.regularSpace [PseudoMetrizableSpace X] : RegularSpace X :=\n let := pseudoMetrizableSpaceUniformity X\n inferInstance\n\ninstance (priority := 100) IndiscreteTopology.pseudoMetrizableSpace [IndiscreteTopology X] :\n PseudoMetrizableSpace X where\n exists_countably_generated :=\n ⟨⊤, (IndiscreteTopology.eq_top X).symm, isCountablyGenerated_top⟩\n\n/-- A topological space is metrizable if there exists a metric space structure compatible with the\ntopology. To minimize imports, we implement this class in terms of the existence of a\ncountably generated uniformity inducing the topology, which is mathematically\nequivalent.\nTo endow such a space with a compatible uniformity, use\n`letI : UniformSpace X := TopologicalSpace.pseudoMetrizableSpaceUniformity X`.\nTo endow such a space with a compatible distance, use\n`letI : MetricSpace X := TopologicalSpace.metrizableSpaceMetric X`. -/\nclass MetrizableSpace (X : Type*) [t : TopologicalSpace X] : Prop extends\n PseudoMetrizableSpace X, T0Space X\n\n-- See note [lower instance priority]\nattribute [instance 100] MetrizableSpace.toT0Space\nattribute [instance 100] MetrizableSpace.toPseudoMetrizableSpace\n\ninstance (priority := 100) PseudoMetrizableSpace.toMetrizableSpace\n [T0Space X] [h : PseudoMetrizableSpace X] : MetrizableSpace X where\n\ninstance (priority := 100) t2Space_of_metrizableSpace [MetrizableSpace X] : T2Space X :=\n letI : UniformSpace X := pseudoMetrizableSpaceUniformity X\n inferInstance\n\ninstance metrizableSpace_prod [MetrizableSpace X] [MetrizableSpace Y] :\n MetrizableSpace (X × Y) where\n\n/-- Given an embedding of a topological space into a metrizable space, the source space is also\nmetrizable. -/\ntheorem _root_.Topology.IsEmbedding.metrizableSpace [MetrizableSpace Y] {f : X → Y}\n (hf : IsEmbedding f) : MetrizableSpace X where\n toPseudoMetrizableSpace := hf.toIsInducing.pseudoMetrizableSpace\n toT0Space := hf.t0Space\n\ninstance MetrizableSpace.subtype [MetrizableSpace X] (s : Set X) : MetrizableSpace s :=\n IsEmbedding.subtypeVal.metrizableSpace\n\ninstance metrizableSpace_pi [∀ i, MetrizableSpace (A i)] : MetrizableSpace (∀ i, A i) where\n\ntheorem IsSeparable.secondCountableTopology [PseudoMetrizableSpace X] {s : Set X}\n (hs : IsSeparable s) : SecondCountableTopology s :=\n let ⟨u, hu, hs⟩ := hs\n have := hu.to_subtype\n have : SeparableSpace (closure u) :=\n ⟨Set.range (u.inclusion subset_closure), Set.countable_range (u.inclusion subset_closure),\n Subtype.dense_iff.2 <| by rw [← Set.range_comp, Set.val_comp_inclusion, Subtype.range_coe]⟩\n let := pseudoMetrizableSpaceUniformity (closure u)\n have := pseudoMetrizableSpaceUniformity_countably_generated (closure u)\n have := secondCountable_of_separable (closure u)\n (Topology.IsEmbedding.inclusion hs).secondCountableTopology\n\ninstance (X : Type*) [TopologicalSpace X] [LindelofSpace X] [PseudoMetrizableSpace X] :\n SecondCountableTopology X := by\n let := pseudoMetrizableSpaceUniformity X\n have := pseudoMetrizableSpaceUniformity_countably_generated X\n suffices _ : SeparableSpace X from secondCountable_of_separable X\n obtain ⟨V, hVb, hVs⟩ := has_seq_basis X\n choose U hUc hUu using fun n =>\n LindelofSpace.elim_nhds_subcover (fun x => ball x (V n))\n (fun x => ball_mem_nhds x (hVb.mem n))\n refine ⟨Set.iUnion U, Set.countable_iUnion hUc, fun x => ?_⟩\n rw [mem_closure_iff_frequently, nhds_eq_comap_uniformity, frequently_comap, hVb.frequently_iff]\n intro n _\n obtain ⟨i, hi, hx⟩ := Set.mem_iUnion₂.1 (Set.eq_univ_iff_forall.1 (hUu n) x)\n rw [ball_eq_of_symmetry] at hx\n exact ⟨(x, i), hx, i, rfl, Set.mem_iUnion_of_mem n hi⟩\n\n/-- If a set `s` is separable in a pseudo metrizable space, then it admits a countable dense\nsubset. This is not obvious, as the countable set whose closure covers `s` given by the definition\nof separability does not need in general to be contained in `s`. -/\ntheorem IsSeparable.exists_countable_dense_subset [PseudoMetrizableSpace X]\n {s : Set X} (hs : IsSeparable s) : ∃ t, t ⊆ s ∧ t.Countable ∧ s ⊆ closure t := by\n let := pseudoMetrizableSpaceUniformity X\n have := pseudoMetrizableSpaceUniformity_countably_generated X\n apply subset_countable_closure_of_almost_dense_set\n intro U hU\n obtain ⟨t, htc, hst⟩ := hs\n refine ⟨t, htc, fun x hx => ?_⟩\n obtain ⟨y, hyx, hyt⟩ := mem_closure_iff_ball.1 (hst hx) (symmetrize_mem_uniformity hU)\n exact mem_biUnion hyt (ball_mono SetRel.symmetrize_subset_inv x hyx)\n\n/-- If a set `s` is separable, then the corresponding subtype is separable in a\npseudo metrizable space.\nThis is not obvious, as the countable set whose closure covers `s` does not need in\ngeneral to be contained in `s`. -/\n\nTarget:\ntheorem IsSeparable.separableSpace [PseudoMetrizableSpace X] {s : Set X} (hs : IsSeparable s) :\n SeparableSpace s :=\n\nProof body:\n","rejected":"```lean\nby\n rcases hs.exists_countable_dense_subset with ⟨t, hts, htc, hst⟩\n lift t to Set s using hts\n refine ⟨⟨t, countable_of_injective_of_countable_image Subtype.coe_injective.injOn htc, ?_⟩⟩\n rwa [IsInducing.subtypeVal.dense_iff, Subtype.forall]\n```","rejection":{"accepted":false,"all_failure_types":["markdown_fence","not_exact_by_body"],"failure_type":"markdown_fence","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Topology/Metrizable","family_id":"isseparable","file_id":"mathlib/Mathlib/Topology/Metrizable/Basic.lean","sample_id":"24a50e7c923889ee600c6124112db36d9e99116f749fac0c7fb2453afa7f8437"},"split":"validation"} {"binding":{"chosen_proof_sha256":"be44aa8c9ebe00750f1b4f9b7a2c6e898434ab25d6c00ac01f949a805242eebf","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"4c623a36bee8dcfd0efdcf8de6397d779084b98592b30c2b764782a1367794d0","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"d20e2d9f94a4dc03c88048c984242f00c47dbce5585aec58706852df3126e7c0","source_sha256":"3b1ebdbfe4d3947834e2865eb5db92b25f69737c310e197f1baeb59959f0efe4","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← neg_right_iff] at h_comm\n rw [← isNilpotent_neg_iff] at hy\n rw [sub_eq_add_neg]\n exact h_comm.isNilpotent_add hx hy","hard_negative":false,"metrics":{"chosen_tokens":25,"rejected_tokens":29,"token_jaccard":0.833333,"token_length_ratio":1.16},"negative_category":"missing_wrong_import","negative_mode":"import","pair_id":"ee05d5094b96f8f7ebf18b32ae58752b5302f242b9a60a5be20b6820cdb4062e","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.BigOperators.Finprod\npublic import Mathlib.Algebra.FiniteSupport.Defs\npublic import Mathlib.Algebra.GroupWithZero.Action.Defs\npublic import Mathlib.Algebra.GroupWithZero.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.GeomSum\npublic import Mathlib.Data.Nat.Choose.Sum\npublic import Mathlib.Order.Lattice.Nat\npublic import Mathlib.RingTheory.Nilpotent.Defs\n\nNamespace:\nCommute\n\nLocal context:\n/-\nCopyright (c) 2021 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Nilpotent elements\n\nThis file develops the basic theory of nilpotent elements. In particular it shows that the\nnilpotent elements are closed under many operations.\n\nFor the definition of `nilradical`, see `Mathlib/RingTheory/Nilpotent/Lemmas.lean`.\n\n\n## Main definitions\n\n * `isNilpotent_neg_iff`\n * `Commute.isNilpotent_add`\n * `Commute.isNilpotent_sub`\n\n-/\n\npublic section\n\nuniverse u v\n\nopen Function Set\n\nvariable {R S : Type*} {x y : R}\n\ntheorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by\n obtain ⟨n, hn⟩ := h\n use n\n rw [neg_pow, hn, mul_zero]\n\n@[simp]\ntheorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x :=\n ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩\n\nlemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S]\n [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) :\n IsNilpotent (t • a) := by\n obtain ⟨k, ha⟩ := ha\n use k\n rw [smul_pow, ha, smul_zero]\n\ntheorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by\n obtain ⟨n, hn⟩ := hnil\n refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩\n · simp [mul_geom_sum, hn]\n · simp [geom_sum_mul, hn]\n\ntheorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by\n rw [← IsUnit.neg_iff, neg_sub]\n exact isUnit_sub_one hnil\n\ntheorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by\n rw [← IsUnit.neg_iff, neg_add']\n exact isUnit_sub_one hnil.neg\n\ntheorem IsNilpotent.isUnit_one_add [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 + r) :=\n add_comm r 1 ▸ isUnit_add_one hnil\n\ntheorem IsNilpotent.isUnit_add_left_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (u + r) := by\n rw [← Units.isUnit_mul_units _ hu.unit⁻¹, add_mul, IsUnit.mul_val_inv]\n replace h_comm : Commute r (↑hu.unit⁻¹) := Commute.units_inv_right h_comm\n refine IsNilpotent.isUnit_one_add ?_\n exact (hu.unit⁻¹.isUnit.isNilpotent_mul_unit_of_commute_iff h_comm).mpr hnil\n\ntheorem IsNilpotent.isUnit_add_right_of_commute [Ring R] {r u : R}\n (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) :\n IsUnit (r + u) :=\n add_comm r u ▸ hnil.isUnit_add_left_of_commute hu h_comm\n\nlemma IsUnit.not_isNilpotent [Ring R] [Nontrivial R] {x : R} (hx : IsUnit x) :\n ¬ IsNilpotent x := by\n intro H\n simpa using H.isUnit_add_right_of_commute hx.neg (by simp)\n\nlemma IsNilpotent.not_isUnit [Ring R] [Nontrivial R] {x : R} (hx : IsNilpotent x) :\n ¬ IsUnit x :=\n mt IsUnit.not_isNilpotent (by simpa only [not_not] using hx)\n\nlemma IsIdempotentElem.eq_zero_of_isNilpotent [MonoidWithZero R] {e : R}\n (idem : IsIdempotentElem e) (nilp : IsNilpotent e) : e = 0 := by\n obtain ⟨rfl | n, hn⟩ := nilp\n · rw [pow_zero] at hn; rw [← one_mul e, hn, zero_mul]\n · rw [← hn, idem.pow_succ_eq]\n\nalias IsNilpotent.eq_zero_of_isIdempotentElem := IsIdempotentElem.eq_zero_of_isNilpotent\n\ninstance [Zero R] [Pow R ℕ] [Zero S] [Pow S ℕ] [IsReduced R] [IsReduced S] : IsReduced (R × S) where\n eq_zero _ := fun ⟨n, hn⟩ ↦ have hn := Prod.ext_iff.1 hn\n Prod.ext (IsReduced.eq_zero _ ⟨n, hn.1⟩) (IsReduced.eq_zero _ ⟨n, hn.2⟩)\n\ntheorem Prime.isRadical [CommMonoidWithZero R] {y : R} (hy : Prime y) : IsRadical y :=\n fun _ _ ↦ hy.dvd_of_dvd_pow\n\ntheorem zero_isRadical_iff [MonoidWithZero R] : IsRadical (0 : R) ↔ IsReduced R := by\n simp_rw [isReduced_iff, IsNilpotent, exists_imp, ← zero_dvd_iff]\n exact forall_comm\n\ntheorem isReduced_iff_pow_one_lt [MonoidWithZero R] (k : ℕ) (hk : 1 < k) :\n IsReduced R ↔ ∀ x : R, x ^ k = 0 → x = 0 := by\n simp_rw [← zero_isRadical_iff, isRadical_iff_pow_one_lt k hk, zero_dvd_iff]\n\ntheorem IsRadical.of_dvd [CommMonoidWithZero R] [IsCancelMulZero R] {x y : R} (hy : IsRadical y)\n (h0 : y ≠ 0) (hxy : x ∣ y) : IsRadical x := (isRadical_iff_pow_one_lt 2 one_lt_two).2 <| by\n obtain ⟨z, rfl⟩ := hxy\n refine fun w dvd ↦ ((mul_dvd_mul_iff_right <| right_ne_zero_of_mul h0).mp <| hy 2 _ ?_)\n rw [mul_pow]\n gcongr\n exact dvd_pow_self _ two_ne_zero\n\nnamespace Commute\n\nsection Semiring\n\nvariable [Semiring R]\n\ntheorem add_pow_eq_zero_of_add_le_succ_of_pow_eq_zero (h_comm : Commute x y) {m n k : ℕ}\n (hx : x ^ m = 0) (hy : y ^ n = 0) (h : m + n ≤ k + 1) :\n (x + y) ^ k = 0 := by\n rw [h_comm.add_pow']\n apply Finset.sum_eq_zero\n rintro ⟨i, j⟩ hij\n suffices x ^ i * y ^ j = 0 by simp only [this, nsmul_eq_mul, mul_zero]\n by_cases hi : m ≤ i\n · rw [pow_eq_zero_of_le hi hx, zero_mul]\n rw [pow_eq_zero_of_le ?_ hy, mul_zero]\n linarith [Finset.mem_antidiagonal.mp hij]\n\ntheorem add_pow_add_eq_zero_of_pow_eq_zero (h_comm : Commute x y) {m n : ℕ}\n (hx : x ^ m = 0) (hy : y ^ n = 0) :\n (x + y) ^ (m + n - 1) = 0 :=\n h_comm.add_pow_eq_zero_of_add_le_succ_of_pow_eq_zero hx hy <| by rw [← Nat.sub_le_iff_le_add]\n\ntheorem isNilpotent_add (h_comm : Commute x y) (hx : IsNilpotent x) (hy : IsNilpotent y) :\n IsNilpotent (x + y) := by\n obtain ⟨n, hn⟩ := hx\n obtain ⟨m, hm⟩ := hy\n exact ⟨_, add_pow_add_eq_zero_of_pow_eq_zero h_comm hn hm⟩\n\nprotected lemma isNilpotent_sum {ι : Type*} {s : Finset ι} {f : ι → R}\n (hnp : ∀ i ∈ s, IsNilpotent (f i)) (h_comm : ∀ i j, i ∈ s → j ∈ s → Commute (f i) (f j)) :\n IsNilpotent (∑ i ∈ s, f i) := by\n classical\n induction s using Finset.induction with\n | empty => simp\n | insert j s hj ih => ?_\n rw [Finset.sum_insert hj]\n apply Commute.isNilpotent_add\n · exact Commute.sum_right _ _ _ (fun i hi ↦ h_comm _ _ (by simp) (by simp [hi]))\n · apply hnp; simp\n · exact ih (fun i hi ↦ hnp i (by simp [hi]))\n (fun i j hi hj ↦ h_comm i j (by simp [hi]) (by simp [hj]))\n\ntheorem isNilpotent_finsum {ι : Type*} {f : ι → R}\n (hf : ∀ b, IsNilpotent (f b)) (h_comm : ∀ i j, Commute (f i) (f j)) :\n IsNilpotent (finsum f) := by\n classical\n by_cases h : HasFiniteSupport f\n · rw [finsum_def, dif_pos h]\n exact Commute.isNilpotent_sum (fun b _ ↦ hf b) (fun _ _ _ _ ↦ h_comm _ _)\n · simp only [finsum_def, dif_neg h, IsNilpotent.zero]\n\nprotected lemma isNilpotent_mul_right_iff (h_comm : Commute x y) (hy : y ∈ nonZeroDivisorsRight R) :\n IsNilpotent (x * y) ↔ IsNilpotent x := by\n refine ⟨?_, h_comm.isNilpotent_mul_right⟩\n rintro ⟨k, hk⟩\n rw [mul_pow h_comm] at hk\n exact ⟨k, (nonZeroDivisorsRight R).pow_mem hy k _ hk⟩\n\nprotected lemma isNilpotent_mul_left_iff (h_comm : Commute x y) (hx : x ∈ nonZeroDivisorsLeft R) :\n IsNilpotent (x * y) ↔ IsNilpotent y := by\n refine ⟨?_, h_comm.isNilpotent_mul_left⟩\n rintro ⟨k, hk⟩\n rw [mul_pow h_comm] at hk\n exact ⟨k, (nonZeroDivisorsLeft R).pow_mem hx k _ hk⟩\n\nend Semiring\n\nsection Ring\n\nvariable [Ring R]\n\nTarget:\ntheorem isNilpotent_sub (h_comm : Commute x y) (hx : IsNilpotent x) (hy : IsNilpotent y) :\n IsNilpotent (x - y) :=\n\nProof body:\n","rejected":"import Mathlib.WrongImport\nby\n rw [← neg_right_iff] at h_comm\n rw [← isNilpotent_neg_iff] at hy\n rw [sub_eq_add_neg]\n exact h_comm.isNilpotent_add hx hy","rejection":{"accepted":false,"all_failure_types":["not_exact_by_body","top_level_command"],"failure_type":"not_exact_by_body","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/Nilpotent","family_id":"isnilpotent_sub","file_id":"mathlib/Mathlib/RingTheory/Nilpotent/Basic.lean","sample_id":"d20e2d9f94a4dc03c88048c984242f00c47dbce5585aec58706852df3126e7c0"},"split":"validation"} {"binding":{"chosen_proof_sha256":"fff0c136fa1018c43a5ab47ca0d1ac8e9ab63d604c861043055fb4b685b8a934","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"5eed3a8e57c4f9d7fbc27d1e442f8f2617d54687f8927dce48eb4832648f1286","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"5d7de265aaadb8918c3c49b38682eec68ccfac621445255fa00eca0ce57eac91","source_sha256":"03792f6e84a5ba12e3c2c48b0b57be56c9a721f9a7e26774b731337c63e84688","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← smul_eq_mul (a := x), idempotent, ← Submodule.coe_smul, ← smul_apply, ← decompose_smul,\n smul_eq_mul, mul_one]","hard_negative":false,"metrics":{"chosen_tokens":28,"rejected_tokens":33,"token_jaccard":0.826087,"token_length_ratio":1.178571},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"efd21e7883e1a53ea82909385fd7917c7a485f734ebd59132fde0f666b7dd8fe","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.Idempotents\npublic import Mathlib.Algebra.DirectSum.Decomposition\n\nNamespace:\nDirectSum\n\nLocal context:\n/-\nCopyright (c) 2025 Yunzhou Xie. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yunzhou Xie, Jujian Zhang, Andrew Yang\n-/\n/-!\n# Decomposition of the identity of a semiring into orthogonal idempotents\n\nIn this file we show that if a semiring `R` can be decomposed into a direct sum\nof (left) ideals `R = V₁ ⊕ V₂ ⊕ ⋯ ⊕ Vₙ` then in the corresponding decomposition\n`1 = e₁ + e₂ + ⋯ + eₙ` with `eᵢ ∈ Vᵢ`, each `eᵢ` is an idempotent and the\n`eᵢ`'s form a family of complete orthogonal idempotents.\n-/\n\n@[expose] public section\n\nnamespace DirectSum\n\nsection OrthogonalIdempotents\n\nvariable {R I : Type*} [Semiring R] [DecidableEq I] (V : I → Ideal R) [Decomposition V]\n\n/-- The decomposition of `(1 : R)` where `1 = e₁ + e₂ + ⋯ + eₙ` which is induced by\n the decomposition of the semiring `R = V1 ⊕ V2 ⊕ ⋯ ⊕ Vn`. -/\ndef idempotent (i : I) : R :=\n decompose V 1 i\n\nTarget:\nlemma decompose_eq_mul_idempotent (x : R) (i : I) : decompose V x i = x * idempotent V i :=\n\nProof body:\n","rejected":"by\n rw [← smul_eq_mul (a := x), idempotent, ← Submodule.coe_smul, ← smul_apply, ← decompose_smul,\n smul_eq_mul, mul_one]\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/DirectSum","family_id":"decompose_eq_mul_idempotent","file_id":"mathlib/Mathlib/Algebra/DirectSum/Idempotents.lean","sample_id":"5d7de265aaadb8918c3c49b38682eec68ccfac621445255fa00eca0ce57eac91"},"split":"validation"} {"binding":{"chosen_proof_sha256":"4335f9074abdc05faabccd34c6fb09ef844f44da8c968c1c4714c1b03c12405d","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"aa7d3562dbf336eb1110382304c2378e43017be9b380b15f8cccdfbf01716166","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"4436fa25191e3fc74c960f7d5ea5f788d15cfb8f8ae10f184cf8a52976c4d0c3","source_sha256":"8b955bbaffd2bc1eba2df1d6c668ffd5393bb009abfb2003a13272afec5c9b7d","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n cases isEmpty_or_nonempty ι with\n | inr _ =>\n refine ⟨fun _ hx ↦ hx.1, ?_⟩\n intro n hn x hx\n simp only [Ideal.mem_inf, mem_iInf] at hx ⊢\n exact ⟨hI.dpow_mem hn hx.1, fun i ↦ IsSubDPIdeal.dpow_mem (hJ i) n hn (hx.2 i)⟩\n | inl _ =>\n simp only [iInf_of_empty, le_top, inf_of_le_left]\n exact IsSubDPIdeal.self hI","hard_negative":false,"metrics":{"chosen_tokens":86,"rejected_tokens":91,"token_jaccard":0.92,"token_length_ratio":1.05814},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"f026c5646cf4d220c956d09ec7ca5003752d94857846623117a9186bdf57bae2","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.RingTheory.DividedPowers.DPMorphism\npublic import Mathlib.RingTheory.Ideal.Quotient.Operations\n\nNamespace:\nDividedPowers\n\nLocal context:\n/-\nCopyright (c) 2025 Antoine Chambert-Loir, María Inés de Frutos-Fernández. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Antoine Chambert-Loir, María Inés de Frutos-Fernández\n-/\n/-! # Sub-divided power-ideals\n\nLet `A` be a commutative (semi)ring and let `I` be an ideal of `A` with a divided power\nstructure `hI`. A subideal `J` of `I` is a *sub-dp-ideal* of `(I, hI)` if, for all `n ∈ ℕ > 0` and\nall `x ∈ J`, `hI.dpow n x ∈ J`.\n\n## Main definitions\n\n* `DividedPowers.IsSubDPIdeal` : A sub-ideal `J` of a divided power ideal `(I, hI)` is a\n *sub-dp-ideal* if for all `n > 0` and all `x ∈ J`, `hI.dpow n j ∈ J`.\n* `DividedPowers.SubDPIdeal` : A bundled version of `IsSubDPIdeal`.\n* `DividedPowers.IsSubDPIdeal.dividedPowers`: the divided power structure on a sub-dp-ideal.\n* `DividedPowers.IsSubDPIdeal.prod` : if `J` is an `A`-ideal, then `I ⬝ J` is a sub-dp-ideal of `I`.\n* `DividedPowers.IsSubDPIdeal.span` : the sub-dp-ideal of `I` generated by a set of elements of `A`.\n* `DividedPowers.subDPIdeal_inf_of_quot` : if there is a dp-structure on `I⬝(A/J)` such that the\n quotient map is a dp-morphism, then `J ⊓ I` is a sub-dp-ideal of `I`.\n* `DividedPowers.Quotient.OfSurjective.dividedPowers`: when `f : A → B` is a surjective map and\n `f.ker ⊓ I` is a sub-dp-ideal of `I`, this is the induced divided power structure on the ideal\n `I.map f` of the target.\n* `DividedPowers.Quotient.dividedPowers` : when `I ⊓ J` is a sub-dp-ideal of `I`, this is the\n divided power structure on the ideal `I(A⧸J)` of the quotient.\n\n## Main results\n\n* `DividedPowers.isSubDPIdeal_inf_iff` : the ideal `J ⊓ I` is a sub-dp-ideal of `I` if and only if\n (on `I`) the divided powers are compatible mod `J`.\n* `DividedPowers.span_isSubDPIdeal_iff` : the span of a set `S : Set A` is a sub-dp-ideal of `I`\n if and only if for all `n ∈ ℕ > 0` and all `s ∈ S`, hI.dpow n s ∈ span S.\n* `DividedPowers.isSubDPIdeal_ker` : the kernel of a divided power morphism from `I` to `J` is\n a sub-dp-ideal of `I`.\n* `DividedPowers.isSubDPIdeal_map` : the image of a divided power morphism from `I` to `J` is\n a sub-dp-ideal of `J`.\n* `DividedPowers.SubDPIdeal.instCompleteLattice` : sub-dp-ideals of `I` form a complete lattice\n under inclusion.\n* `DividedPowers.SubDPIdeal.span_carrier_eq_dpow_span` : the underlying ideal of\n `SubDPIdeal.span hI S` is generated by the elements of the form `hI.dpow n x` with `n > 0`\n and `x ∈ S`.\n* `DividedPowers.Quotient.OfSurjective.dividedPowers_unique` : the only divided power structure on\n `I.map f` such that the surjective map `f : A → B` is a divided power morphism is given by\n `DividedPowers.Quotient.OfSurjective.dividedPowers`.\n* `DividedPowers.Quotient.dividedPowers_unique` : the only divided power structure on `I(A⧸J)` such\n that the quotient map `A → A/J` is a divided power morphism is given by\n `DividedPowers.Quotient.dividedPowers`.\n\n## Implementation remarks\n\nWe provide both a bundled and an unbundled definition of sub-dp-ideals. The unbundled version is\noften more convenient when a larger proof requires to show that a certain ideal is a sub-dp-ideal.\nOn the other hand, a bundled version is required to prove that sub-dp-ideals form a complete\nlattice.\n\n## References\n\n* [P. Berthelot, *Cohomologie cristalline des schémas de caractéristique $p$ > 0*][Berthelot-1974]\n\n* [P. Berthelot and A. Ogus, *Notes on crystalline cohomology*][BerthelotOgus-1978]\n\n* [N. Roby, *Lois polynomes et lois formelles en théorie des modules*][Roby-1963]\n\n* [N. Roby, *Les algèbres à puissances dividées*][Roby-1965]\n-/\n\n@[expose] public section\n\nopen Subtype\n\nnamespace DividedPowers\n\n/-- A sub-ideal `J` of a divided power ideal `(I, hI)` is a sub-dp-ideal if for all `n > 0` and\n all `x ∈ J`, `hI.dpow n j ∈ J`. -/\nstructure IsSubDPIdeal {A : Type*} [CommSemiring A] {I : Ideal A} (hI : DividedPowers I)\n (J : Ideal A) : Prop where\n isSubideal : J ≤ I\n dpow_mem : ∀ (n : ℕ) (_ : n ≠ 0) {j : A} (_ : j ∈ J), hI.dpow n j ∈ J\n\nsection IsSubDPIdeal\n\nnamespace IsSubDPIdeal\n\nvariable {A : Type*} [CommSemiring A] {I : Ideal A} (hI : DividedPowers I)\n\nopen Ideal\n\ntheorem self : IsSubDPIdeal hI I where\n isSubideal := le_rfl\n dpow_mem _ hn _ ha := hI.dpow_mem hn ha\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The divided power structure on a sub-dp-ideal. -/\ndef dividedPowers {J : Ideal A} (hJ : IsSubDPIdeal hI J) [∀ x, Decidable (x ∈ J)] :\n DividedPowers J where\n dpow n x := if x ∈ J then hI.dpow n x else 0\n dpow_null hx := by simp [if_neg hx]\n dpow_zero hx := by simp [if_pos hx, hI.dpow_zero (hJ.isSubideal hx)]\n dpow_one hx := by simp [if_pos hx, hI.dpow_one (hJ.isSubideal hx)]\n dpow_mem hn hx := by simp [if_pos hx, hJ.dpow_mem _ hn hx]\n dpow_add hx hy := by simp_rw [if_pos hx, if_pos hy, if_pos (Ideal.add_mem J hx hy),\n hI.dpow_add (hJ.isSubideal hx) (hJ.isSubideal hy)]\n dpow_mul hx := by\n simp [if_pos hx, if_pos (mul_mem_left J _ hx), hI.dpow_mul (hJ.isSubideal hx)]\n mul_dpow hx := by simp [if_pos hx, hI.mul_dpow (hJ.isSubideal hx)]\n dpow_comp hn hx := by\n simp [if_pos hx, if_pos (hJ.dpow_mem _ hn hx), hI.dpow_comp hn (hJ.isSubideal hx)]\n\nvariable {J : Ideal A} (hJ : IsSubDPIdeal hI J) [∀ x, Decidable (x ∈ J)]\n\nlemma dpow_eq (n : ℕ) (a : A) :\n (IsSubDPIdeal.dividedPowers hI hJ).dpow n a = if a ∈ J then hI.dpow n a else 0 := rfl\n\nlemma dpow_eq_of_mem {n : ℕ} {a : A} (ha : a ∈ J) :\n (IsSubDPIdeal.dividedPowers hI hJ).dpow n a = hI.dpow n a := by rw [dpow_eq, if_pos ha]\n\ntheorem isDPMorphism (hJ : IsSubDPIdeal hI J) :\n (IsSubDPIdeal.dividedPowers hI hJ).IsDPMorphism hI (RingHom.id A) := by\n simpa only [isDPMorphism_iff, Ideal.map_id, RingHom.id_apply]\n using ⟨hJ.1, fun _ _ _ ha ↦ by rw [dpow_eq_of_mem _ _ ha]⟩\n\nend IsSubDPIdeal\n\nopen Finset Ideal\n\n/-- The ideal `J ⊓ I` is a sub-dp-ideal of `I` if and only if the divided powers have\n some compatibility mod `J`. (The necessity was proved as a sanity check.) -/\ntheorem isSubDPIdeal_inf_iff {A : Type*} [CommRing A] {I : Ideal A} (hI : DividedPowers I)\n {J : Ideal A} : IsSubDPIdeal hI (J ⊓ I) ↔\n ∀ {n : ℕ} {a b : A} (_ : a ∈ I) (_ : b ∈ I) (_ : a - b ∈ J), hI.dpow n a - hI.dpow n b ∈ J := by\n refine ⟨fun hIJ n a b ha hb hab ↦ ?_, fun hIJ ↦ ?_⟩\n · have hab' : a - b ∈ I := I.sub_mem ha hb\n rw [← add_sub_cancel b a, hI.dpow_add' hb hab', range_add_one, sum_insert notMem_range_self,\n tsub_self, hI.dpow_zero hab', mul_one, add_sub_cancel_left]\n exact J.sum_mem (fun i hi ↦ SemilatticeInf.inf_le_left J I ((J ⊓ I).smul_mem _\n (hIJ.dpow_mem _ (ne_of_gt (Nat.sub_pos_of_lt (mem_range.mp hi))) ⟨hab, hab'⟩)))\n · refine ⟨SemilatticeInf.inf_le_right J I, fun {n} hn {a} ha ↦ ⟨?_, hI.dpow_mem hn ha.right⟩⟩\n rw [← sub_zero (hI.dpow n a), ← hI.dpow_eval_zero hn]\n exact hIJ ha.right I.zero_mem (J.sub_mem ha.left J.zero_mem)\n\nvariable {A B : Type*} [CommSemiring A] {I : Ideal A} {hI : DividedPowers I} [CommSemiring B]\n {J : Ideal B} {hJ : DividedPowers J}\n\n/-- [P. Berthelot and A. Ogus, *Notes on crystalline cohomology* (Lemma 3.6)][BerthelotOgus-1978] -/\ntheorem span_isSubDPIdeal_iff {S : Set A} (hS : S ⊆ I) :\n IsSubDPIdeal hI (span S) ↔ ∀ {n : ℕ} (_ : n ≠ 0), ∀ s ∈ S, hI.dpow n s ∈ span S := by\n refine ⟨fun hhI n hn s hs ↦ hhI.dpow_mem n hn (subset_span hs), fun hhI ↦ ?_⟩\n · -- interesting direction\n have hSI := span_le.mpr hS\n apply IsSubDPIdeal.mk hSI\n intro m hm z hz\n induction hz using Submodule.span_induction generalizing m hm with\n | mem x h => exact hhI hm x h\n | zero =>\n rw [hI.dpow_eval_zero hm]\n exact (span S).zero_mem\n | add x y hxI hyI hx hy =>\n rw [hI.dpow_add' (hSI hxI) (hSI hyI)]\n apply Submodule.sum_mem (span S)\n intro m _\n by_cases hm0 : m = 0\n · exact hm0 ▸ mul_mem_left (span S) _ (hy _ hm)\n · exact mul_mem_right _ (span S) (hx _ hm0)\n | smul a x hxI hx =>\n rw [smul_eq_mul, hI.dpow_mul (hSI hxI)]\n exact mul_mem_left (span S) (a ^ m) (hx m hm)\n\ntheorem isSubDPIdeal_sup {J K : Ideal A} (hJ : IsSubDPIdeal hI J) (hK : IsSubDPIdeal hI K) :\n IsSubDPIdeal hI (J ⊔ K) := by\n rw [← J.span_eq, ← K.span_eq, ← span_union,\n span_isSubDPIdeal_iff (Set.union_subset_iff.mpr ⟨hJ.1, hK.1⟩)]\n intro n hn a ha\n rcases ha with ha | ha\n · exact span_mono Set.subset_union_left (subset_span (hJ.2 n hn ha))\n · exact span_mono Set.subset_union_right (subset_span (hK.2 n hn ha))\n\ntheorem isSubDPIdeal_iSup {ι : Type*} {J : ι → Ideal A} (hJ : ∀ i, IsSubDPIdeal hI (J i)) :\n IsSubDPIdeal hI (iSup J) := by\n rw [iSup_eq_span, span_isSubDPIdeal_iff (Set.iUnion_subset_iff.mpr <| fun i ↦ (hJ i).1)]\n simp_rw [Set.mem_iUnion]\n rintro n hn a ⟨i, ha⟩\n exact span_mono (Set.subset_iUnion _ i) (subset_span ((hJ i).2 n hn ha))\n\nTarget:\ntheorem isSubDPIdeal_iInf {ι : Type*} {J : ι → Ideal A} (hJ : ∀ i, IsSubDPIdeal hI (J i)) :\n IsSubDPIdeal hI (I ⊓ iInf (fun i ↦ J i)) :=\n\nProof body:\n","rejected":"by\n cases isEmpty_or_nonempty ι with\n | inr _ =>\n refine ⟨fun _ hx ↦ hx.1, ?_⟩\n intro n hn x hx\n simp only [Ideal.mem_inf, mem_iInf] at hx ⊢\n exact ⟨hI.dpow_mem hn hx.1, fun i ↦ IsSubDPIdeal.dpow_mem (hJ i) n hn (hx.2 i)⟩\n | inl _ =>\n simp only [iInf_of_empty, le_top, inf_of_le_left]\n exact IsSubDPIdeal.self hI\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/DividedPowers","family_id":"issubdpideal_iinf","file_id":"mathlib/Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean","sample_id":"4436fa25191e3fc74c960f7d5ea5f788d15cfb8f8ae10f184cf8a52976c4d0c3"},"split":"validation"} {"binding":{"chosen_proof_sha256":"05d3ba4bdf879c10e8524f55b940e5b3ca48adfcb0a89235de0ee63b150243f4","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8f7ef0d7e323ddacd62136d0f1456b9736fef6e1c80e1e52e41af3ec24357a35","source_sha256":"6d31abda8202e7c1354edbb9de4059c0a40330c2a375465bbf58a648a338b5af","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← ListBlank.cons_head_tail l]\n induction l.tail using Quotient.inductionOn'\n rfl","hard_negative":false,"metrics":{"chosen_tokens":18,"rejected_tokens":2,"token_jaccard":0.0625,"token_length_ratio":0.111111},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"f415310b42ddae2adc8e722f17e8b16321321363b1d96688e9a1ae60309eb87c","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Logic.Function.Iterate\npublic import Mathlib.Tactic.ApplyFun\npublic import Mathlib.Data.List.GetD\npublic import Mathlib.Algebra.Group.Int.Defs\npublic import Mathlib.Algebra.Group.Nat.Defs\npublic import Mathlib.Data.List.Basic\n\nNamespace:\nTuring\n\nLocal context:\n/-\nCopyright (c) 2018 Mario Carneiro. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Mario Carneiro\n-/\n/-!\n# Turing machine tapes\n\nThis file defines the notion of a Turing machine tape, and the operations on it. A tape is a\nbidirectional infinite sequence of cells, each of which stores an element of a given alphabet `Γ`.\nAll but finitely many of the cells are required to hold the blank symbol `default : Γ`.\n\n## Main definitions\n\n* `ListBlank Γ` is the type of one-directional tapes with alphabet `Γ`. Implemented as a quotient\n of `List Γ` by extension by blanks at the end.\n* `Tape Γ` is the type of Turing machine tapes with alphabet `Γ`. Implemented as two\n `ListBlank Γ` instances, one for each direction, as well as a head symbol.\n\n-/\n\n@[expose] public section\n\nassert_not_exists MonoidWithZero\n\nopen Function (iterate_succ iterate_succ_apply iterate_zero_apply)\n\nnamespace Turing\n\nsection ListBlank\n\n/-- The `BlankExtends` partial order holds of `l₁` and `l₂` if `l₂` is obtained by adding\nblanks (`default : Γ`) to the end of `l₁`. -/\ndef BlankExtends {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop :=\n ∃ n, l₂ = l₁ ++ List.replicate n default\n\n@[refl]\ntheorem BlankExtends.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankExtends l l :=\n ⟨0, by simp⟩\n\n@[trans]\ntheorem BlankExtends.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} :\n BlankExtends l₁ l₂ → BlankExtends l₂ l₃ → BlankExtends l₁ l₃ := by\n rintro ⟨i, rfl⟩ ⟨j, rfl⟩\n exact ⟨i + j, by simp⟩\n\ntheorem BlankExtends.below_of_le {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} :\n BlankExtends l l₁ → BlankExtends l l₂ → l₁.length ≤ l₂.length → BlankExtends l₁ l₂ := by\n rintro ⟨i, rfl⟩ ⟨j, rfl⟩ h; use j - i\n simp only [List.length_append, Nat.add_le_add_iff_left, List.length_replicate] at h\n simp only [← List.replicate_add, Nat.add_sub_cancel' h, List.append_assoc]\n\n/-- Any two extensions by blank `l₁,l₂` of `l` have a common join (which can be taken to be the\nlonger of `l₁` and `l₂`). -/\ndef BlankExtends.above {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} (h₁ : BlankExtends l l₁)\n (h₂ : BlankExtends l l₂) : { l' // BlankExtends l₁ l' ∧ BlankExtends l₂ l' } :=\n if h : l₁.length ≤ l₂.length then ⟨l₂, h₁.below_of_le h₂ h, BlankExtends.refl _⟩\n else ⟨l₁, BlankExtends.refl _, h₂.below_of_le h₁ (le_of_not_ge h)⟩\n\ntheorem BlankExtends.above_of_le {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} :\n BlankExtends l₁ l → BlankExtends l₂ l → l₁.length ≤ l₂.length → BlankExtends l₁ l₂ := by\n rintro ⟨i, rfl⟩ ⟨j, e⟩ h; use i - j\n refine List.append_cancel_right (e.symm.trans ?_)\n rw [List.append_assoc, ← List.replicate_add, Nat.sub_add_cancel]\n apply_fun List.length at e\n simp only [List.length_append, List.length_replicate] at e\n rwa [← Nat.add_le_add_iff_left, e, Nat.add_le_add_iff_right]\n\n/-- `BlankRel` is the symmetric closure of `BlankExtends`, turning it into an equivalence\nrelation. Two lists are related by `BlankRel` if one extends the other by blanks. -/\ndef BlankRel {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop :=\n BlankExtends l₁ l₂ ∨ BlankExtends l₂ l₁\n\n@[refl]\ntheorem BlankRel.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankRel l l :=\n Or.inl (BlankExtends.refl _)\n\n@[symm]\ntheorem BlankRel.symm {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} : BlankRel l₁ l₂ → BlankRel l₂ l₁ :=\n Or.symm\n\n@[trans]\ntheorem BlankRel.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} :\n BlankRel l₁ l₂ → BlankRel l₂ l₃ → BlankRel l₁ l₃ := by\n grind [eq_def, BlankExtends.below_of_le, BlankExtends.above_of_le, BlankExtends.trans]\n\n/-- Given two `BlankRel` lists, there exists (constructively) a common join. -/\ndef BlankRel.above {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} (h : BlankRel l₁ l₂) :\n { l // BlankExtends l₁ l ∧ BlankExtends l₂ l } := by\n refine\n if hl : l₁.length ≤ l₂.length then ⟨l₂, Or.elim h id fun h' ↦ ?_, BlankExtends.refl _⟩\n else ⟨l₁, BlankExtends.refl _, Or.elim h (fun h' ↦ ?_) id⟩\n · exact (BlankExtends.refl _).above_of_le h' hl\n · exact (BlankExtends.refl _).above_of_le h' (le_of_not_ge hl)\n\n/-- Given two `BlankRel` lists, there exists (constructively) a common meet. -/\ndef BlankRel.below {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} (h : BlankRel l₁ l₂) :\n { l // BlankExtends l l₁ ∧ BlankExtends l l₂ } := by\n refine\n if hl : l₁.length ≤ l₂.length then ⟨l₁, BlankExtends.refl _, Or.elim h id fun h' ↦ ?_⟩\n else ⟨l₂, Or.elim h (fun h' ↦ ?_) id, BlankExtends.refl _⟩\n · exact (BlankExtends.refl _).above_of_le h' hl\n · exact (BlankExtends.refl _).above_of_le h' (le_of_not_ge hl)\n\ntheorem BlankRel.equivalence (Γ) [Inhabited Γ] : Equivalence (@BlankRel Γ _) :=\n ⟨BlankRel.refl, @BlankRel.symm _ _, @BlankRel.trans _ _⟩\n\n/-- Construct a setoid instance for `BlankRel`. -/\n@[implicit_reducible]\ndef BlankRel.setoid (Γ) [Inhabited Γ] : Setoid (List Γ) :=\n ⟨_, BlankRel.equivalence _⟩\n\n/-- A `ListBlank Γ` is a quotient of `List Γ` by extension by blanks at the end. This is used to\nrepresent half-tapes of a Turing machine, so that we can pretend that the list continues\ninfinitely with blanks. -/\ndef ListBlank (Γ) [Inhabited Γ] :=\n Quotient (BlankRel.setoid Γ)\n\ninstance ListBlank.inhabited {Γ} [Inhabited Γ] : Inhabited (ListBlank Γ) :=\n ⟨Quotient.mk'' []⟩\n\ninstance ListBlank.hasEmptyc {Γ} [Inhabited Γ] : EmptyCollection (ListBlank Γ) :=\n ⟨Quotient.mk'' []⟩\n\n/-- A modified version of `Quotient.liftOn'` specialized for `ListBlank`, with the stronger\nprecondition `BlankExtends` instead of `BlankRel`. -/\nprotected abbrev ListBlank.liftOn {Γ} [Inhabited Γ] {α} (l : ListBlank Γ) (f : List Γ → α)\n (H : ∀ a b, BlankExtends a b → f a = f b) : α :=\n l.liftOn' f <| by rintro a b (h | h) <;> [exact H _ _ h; exact (H _ _ h).symm]\n\n/-- The quotient map turning a `List` into a `ListBlank`. -/\ndef ListBlank.mk {Γ} [Inhabited Γ] : List Γ → ListBlank Γ :=\n Quotient.mk''\n\n@[elab_as_elim]\nprotected theorem ListBlank.induction_on {Γ} [Inhabited Γ] {p : ListBlank Γ → Prop}\n (q : ListBlank Γ) (h : ∀ a, p (ListBlank.mk a)) : p q :=\n Quotient.inductionOn' q h\n\n/-- The head of a `ListBlank` is well defined. -/\ndef ListBlank.head {Γ} [Inhabited Γ] (l : ListBlank Γ) : Γ := by\n apply l.liftOn List.headI\n rintro a _ ⟨i, rfl⟩\n cases a\n · cases i <;> rfl\n rfl\n\n@[simp]\ntheorem ListBlank.head_mk {Γ} [Inhabited Γ] (l : List Γ) :\n ListBlank.head (ListBlank.mk l) = l.headI :=\n rfl\n\n/-- The tail of a `ListBlank` is well defined (up to the tail of blanks). -/\ndef ListBlank.tail {Γ} [Inhabited Γ] (l : ListBlank Γ) : ListBlank Γ := by\n apply l.liftOn (fun l ↦ ListBlank.mk l.tail)\n rintro a _ ⟨i, rfl⟩\n refine Quotient.sound' (Or.inl ?_)\n cases a\n · rcases i with - | i <;> [exact ⟨0, rfl⟩; exact ⟨i, rfl⟩]\n exact ⟨i, rfl⟩\n\n@[simp]\ntheorem ListBlank.tail_mk {Γ} [Inhabited Γ] (l : List Γ) :\n ListBlank.tail (ListBlank.mk l) = ListBlank.mk l.tail :=\n rfl\n\n/-- We can cons an element onto a `ListBlank`. -/\ndef ListBlank.cons {Γ} [Inhabited Γ] (a : Γ) (l : ListBlank Γ) : ListBlank Γ := by\n apply l.liftOn (fun l ↦ ListBlank.mk (List.cons a l))\n rintro _ _ ⟨i, rfl⟩\n exact Quotient.sound' (Or.inl ⟨i, rfl⟩)\n\n@[simp]\ntheorem ListBlank.cons_mk {Γ} [Inhabited Γ] (a : Γ) (l : List Γ) :\n ListBlank.cons a (ListBlank.mk l) = ListBlank.mk (a :: l) :=\n rfl\n\n@[simp]\ntheorem ListBlank.head_cons {Γ} [Inhabited Γ] (a : Γ) : ∀ l : ListBlank Γ, (l.cons a).head = a :=\n Quotient.ind' fun _ ↦ rfl\n\n@[simp]\ntheorem ListBlank.tail_cons {Γ} [Inhabited Γ] (a : Γ) : ∀ l : ListBlank Γ, (l.cons a).tail = l :=\n Quotient.ind' fun _ ↦ rfl\n\n/-- The `cons` and `head`/`tail` functions are mutually inverse, unlike in the case of `List` where\nthis only holds for nonempty lists. -/\n@[simp]\ntheorem ListBlank.cons_head_tail {Γ} [Inhabited Γ] : ∀ l : ListBlank Γ, l.tail.cons l.head = l := by\n apply Quotient.ind'\n refine fun l ↦ Quotient.sound' (Or.inr ?_)\n cases l\n · exact ⟨1, rfl⟩\n · rfl\n\n/-- The `cons` and `head`/`tail` functions are mutually inverse, unlike in the case of `List` where\nthis only holds for nonempty lists. -/\ntheorem ListBlank.exists_cons {Γ} [Inhabited Γ] (l : ListBlank Γ) :\n ∃ a l', l = ListBlank.cons a l' :=\n ⟨_, _, (ListBlank.cons_head_tail _).symm⟩\n\n/-- The n-th element of a `ListBlank` is well defined for all `n : ℕ`, unlike in a `List`. -/\ndef ListBlank.nth {Γ} [Inhabited Γ] (l : ListBlank Γ) (n : ℕ) : Γ := by\n apply l.liftOn (fun l ↦ List.getI l n)\n rintro l _ ⟨i, rfl⟩\n rcases lt_or_ge n _ with h | h\n · rw [List.getI_append _ _ _ h]\n rw [List.getI_eq_default _ h]\n rcases le_or_gt _ n with h₂ | h₂\n · rw [List.getI_eq_default _ h₂]\n rw [List.getI_eq_getElem _ h₂, List.getElem_append_right h, List.getElem_replicate]\n\n@[simp]\ntheorem ListBlank.nth_mk {Γ} [Inhabited Γ] (l : List Γ) (n : ℕ) :\n (ListBlank.mk l).nth n = l.getI n :=\n rfl\n\n@[simp]\ntheorem ListBlank.nth_zero {Γ} [Inhabited Γ] (l : ListBlank Γ) : l.nth 0 = l.head := by\n rw [← ListBlank.cons_head_tail l]\n induction l.tail using Quotient.inductionOn'\n rfl\n\n@[simp]\n\nTarget:\ntheorem ListBlank.nth_succ {Γ} [Inhabited Γ] (l : ListBlank Γ) (n : ℕ) :\n l.nth (n + 1) = l.tail.nth n :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Computability/TuringMachine","family_id":"listblank","file_id":"mathlib/Mathlib/Computability/TuringMachine/Tape.lean","sample_id":"8f7ef0d7e323ddacd62136d0f1456b9736fef6e1c80e1e52e41af3ec24357a35"},"split":"validation"} {"binding":{"chosen_proof_sha256":"80c6f3f1c03e3443ea332e065c3d8b8bfc34fc02cc2d451654028c2a3957e335","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"db22340c4773f1f3b0dc30135273a7618d21d5d418d139b7ff04d06d50ea8ba6","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"6fdad4d2ffe81718354610143a337f5eeb0e36697133ee4c8eca1fe5887abaeb","source_sha256":"50acf64242e7f5ba0eaecf90f2bb1d8dc0b0dc2be95b5ced05cba0f43f7fdac3","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← decompose_symm_of _, Equiv.apply_symm_apply]","hard_negative":true,"metrics":{"chosen_tokens":11,"rejected_tokens":3,"token_jaccard":0.076923,"token_length_ratio":0.272727},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"f72c5e220deb776630da3b0ffeba4dd133154850bcea3619c935b239695e498a","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.DirectSum.Module\npublic import Mathlib.Algebra.Module.Submodule.Basic\n\nNamespace:\nDirectSum\n\nLocal context:\n/-\nCopyright (c) 2022 Eric Wieser. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Eric Wieser, Jujian Zhang\n-/\n/-!\n# Decompositions of additive monoids, groups, and modules into direct sums\n\n## Main definitions\n\n* `DirectSum.Decomposition ℳ`: A typeclass to provide a constructive decomposition from\n an additive monoid `M` into a family of additive submonoids `ℳ`\n* `DirectSum.decompose ℳ`: The canonical equivalence provided by the above typeclass\n\n\n## Main statements\n\n* `DirectSum.Decomposition.isInternal`: The link to `DirectSum.IsInternal`.\n\n## Implementation details\n\nAs we want to talk about different types of decomposition (additive monoids, modules, rings, ...),\nwe choose to avoid heavily bundling `DirectSum.decompose`, instead making copies for the\n`AddEquiv`, `LinearEquiv`, etc. This means we have to repeat statements that follow from these\nbundled homs, but means we don't have to repeat statements for different types of decomposition.\n-/\n\n@[expose] public section\n\n\nvariable {ι R M σ : Type*}\n\nopen DirectSum\n\nnamespace DirectSum\n\nsection AddCommMonoid\n\nvariable [DecidableEq ι] [AddCommMonoid M]\nvariable [SetLike σ M] [AddSubmonoidClass σ M] (ℳ : ι → σ)\n\n/-- A decomposition is an equivalence between an additive monoid `M` and a direct sum of additive\nsubmonoids `ℳ i` of that `M`, such that the \"recomposition\" is canonical. This definition also\nworks for additive groups and modules.\n\nThis is a version of `DirectSum.IsInternal` which comes with a constructive inverse to the\ncanonical \"recomposition\" rather than just a proof that the \"recomposition\" is bijective.\n\nOften it is easier to construct a term of this type via `Decomposition.ofAddHom` or\n`Decomposition.ofLinearMap`. -/\nclass Decomposition where\n decompose' : M → ⨁ i, ℳ i\n left_inv : Function.LeftInverse (DirectSum.coeAddMonoidHom ℳ) decompose'\n right_inv : Function.RightInverse (DirectSum.coeAddMonoidHom ℳ) decompose'\n\n/-- `DirectSum.Decomposition` instances, while carrying data, are always equal. -/\ninstance : Subsingleton (Decomposition ℳ) :=\n ⟨fun x y ↦ by\n obtain ⟨_, _, xr⟩ := x\n obtain ⟨_, yl, _⟩ := y\n congr\n exact Function.LeftInverse.eq_rightInverse xr yl⟩\n\n/-- A convenience method to construct a decomposition from an `AddMonoidHom`, such that the proofs\nof left and right inverse can be constructed via `ext`. -/\nabbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i)\n (h_left_inv : (DirectSum.coeAddMonoidHom ℳ).comp decompose = .id _)\n (h_right_inv : decompose.comp (DirectSum.coeAddMonoidHom ℳ) = .id _) : Decomposition ℳ where\n decompose' := decompose\n left_inv := DFunLike.congr_fun h_left_inv\n right_inv := DFunLike.congr_fun h_right_inv\n\n/-- Noncomputably conjure a decomposition instance from a `DirectSum.IsInternal` proof. -/\n@[implicit_reducible]\nnoncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) :\n DirectSum.Decomposition ℳ where\n decompose' := (Equiv.ofBijective _ h).symm\n left_inv := (Equiv.ofBijective _ h).right_inv\n right_inv := (Equiv.ofBijective _ h).left_inv\n\nvariable [Decomposition ℳ]\n\nprotected theorem Decomposition.isInternal : DirectSum.IsInternal ℳ :=\n ⟨Decomposition.right_inv.injective, Decomposition.left_inv.surjective⟩\n\n/-- If `M` is graded by `ι` with degree `i` component `ℳ i`, then it is isomorphic as\nto a direct sum of components. This is the canonical spelling of the `decompose'` field. -/\ndef decompose : M ≃ ⨁ i, ℳ i where\n toFun := Decomposition.decompose'\n invFun := DirectSum.coeAddMonoidHom ℳ\n left_inv := Decomposition.left_inv\n right_inv := Decomposition.right_inv\n\nomit [AddSubmonoidClass σ M] in\n/-- A substructure `p ⊆ M` is homogeneous if for every `m ∈ p`, all homogeneous components\n of `m` are in `p`. -/\ndef SetLike.IsHomogeneous {P : Type*} [SetLike P M] (p : P) : Prop :=\n ∀ (i : ι) ⦃m : M⦄, m ∈ p → (DirectSum.decompose ℳ m i : M) ∈ p\n\n@[elab_as_elim]\nprotected theorem Decomposition.inductionOn {motive : M → Prop} (zero : motive 0)\n (homogeneous : ∀ {i} (m : ℳ i), motive (m : M))\n (add : ∀ m m' : M, motive m → motive m' → motive (m + m')) : ∀ m, motive m := by\n let ℳ' : ι → AddSubmonoid M := fun i ↦\n (⟨⟨ℳ i, fun x y ↦ AddMemClass.add_mem x y⟩, (ZeroMemClass.zero_mem _)⟩ : AddSubmonoid M)\n haveI t : DirectSum.Decomposition ℳ' :=\n { decompose' := DirectSum.decompose ℳ\n left_inv := fun _ ↦ (decompose ℳ).left_inv _\n right_inv := fun _ ↦ (decompose ℳ).right_inv _ }\n have mem : ∀ m, m ∈ iSup ℳ' := fun _m ↦\n (DirectSum.IsInternal.addSubmonoid_iSup_eq_top ℳ' (Decomposition.isInternal ℳ')).symm ▸ trivial\n -- Porting note: needs to use @ even though no implicit argument is provided\n exact fun m ↦ @AddSubmonoid.iSup_induction _ _ _ ℳ' _ _ (mem m)\n (fun i m h ↦ homogeneous ⟨m, h⟩) zero add\n-- exact fun m ↦\n-- AddSubmonoid.iSup_induction ℳ' (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add\n\n@[simp]\ntheorem Decomposition.decompose'_eq : Decomposition.decompose' = decompose ℳ := rfl\n\n@[simp]\ntheorem decompose_symm_of {i : ι} (x : ℳ i) : (decompose ℳ).symm (DirectSum.of _ i x) = x :=\n DirectSum.coeAddMonoidHom_of ℳ _ _\n\n@[simp]\n\nTarget:\ntheorem decompose_coe {i : ι} (x : ℳ i) : decompose ℳ (x : M) = DirectSum.of _ i x :=\n\nProof body:\n","rejected":"by\n exact decompose_coe","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"9630e6d495bcfa3012c0ede2a0e47e68f678d0ad37af6219fbc4722235b44068","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Algebra/DirectSum","family_id":"decompose_coe","file_id":"mathlib/Mathlib/Algebra/DirectSum/Decomposition.lean","sample_id":"6fdad4d2ffe81718354610143a337f5eeb0e36697133ee4c8eca1fe5887abaeb"},"split":"validation"} {"binding":{"chosen_proof_sha256":"b205002fc568c12815572bd8e5a82144be163527107151f5023428d9aa79e5e8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"ed284a93eb5c5b6fc8989d8ddddc21cbbe05e739ee063057f4647ce40a31e1fe","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"0f5d5b2142dd098a971cfed894d13ceb07152dafeb65b14609ac21cf2f161ec7","source_sha256":"37f17dacd5bcc157b99a90651c7281496dc8bcf5b9fd1ba77727f58502e618cc","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n let := Localization.AtPrime.algebraOfLiesOver (q.under R) q\n rw [inertiaDeg'_def]\n apply Module.finrank_pos","hard_negative":true,"metrics":{"chosen_tokens":23,"rejected_tokens":3,"token_jaccard":0.047619,"token_length_ratio":0.130435},"negative_category":"circular_dependency","negative_mode":"circular_dependency","pair_id":"fbb9309b62e3e6d66c64fc59606391467befdfded0956b32a478a6a5640ea275","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.NumberTheory.RamificationInertia.Inertia\npublic import Mathlib.RingTheory.QuasiFinite.Basic\n\nNamespace:\nIdeal\n\nLocal context:\n/-\nCopyright (c) 2026 Thomas Browning. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Thomas Browning\n-/\n/-!\n# Inertia degree\n\nGiven a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\n## Main definitions\n\n* `Ideal.inertiaDeg' q R`: The inertia degree of `q` over `R`.\n\n## Main statements\n\n* `inertiaDeg_eq_inertiaDeg'`: The inertia degree agrees with the usual definition in the case of\n maximal ideals.\n* `inertiaDeg'_tower`: Inertia degree is multiplicative in towers.\n-/\n\n@[expose] public section\n\nnamespace Ideal\n\nsection\n\nvariable {S : Type*} [CommRing S] (q : Ideal S) (R : Type*) [CommRing R] [Algebra R S]\n\nopen Classical in\n/-- Given a prime ideal `q` of an `R`-algebra `S`, the inertia degree of `q` over `R` is defined\nto be the degree of the residue field of `q` over the residue field of its preimage `p` in `R`.\n\nWhen `q` is not prime, we use a junk value of `0`.\n\nThis will eventually replace the existing definition of `Ideal.inertiaDeg`. -/\nnoncomputable def inertiaDeg' : ℕ :=\n if _ : q.IsPrime then\n letI := Localization.AtPrime.algebraOfLiesOver (q.under R) q\n Module.finrank (q.under R).ResidueField q.ResidueField else 0\n\ntheorem inertiaDeg'_def [hq : q.IsPrime]\n [Algebra (Localization.AtPrime (q.under R)) (Localization.AtPrime q)]\n [Localization.AtPrime.IsLiesOverAlgebra (q.under R) q] :\n q.inertiaDeg' R = Module.finrank (q.under R).ResidueField q.ResidueField := by\n convert! dif_pos hq\n simp [Algebra.algebra_ext_iff, Localization.AtPrime.IsLiesOverAlgebra.algebraMap_eq]\n\ntheorem inertiaDeg'_of_not_isPrime (hq : ¬ q.IsPrime) : q.inertiaDeg' R = 0 :=\n dif_neg hq\n\nTarget:\ntheorem inertiaDeg'_pos [hq : q.IsPrime] [Module.Finite R S] : 0 < q.inertiaDeg' R :=\n\nProof body:\n","rejected":"by\n exact inertiaDeg'_pos","rejection":{"accepted":false,"failure_type":"lean_elaboration_error","output_sha256":"64562decfd703b6db893c019383be571ea5c30bf5666c995e3e22856268e8463","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"RingTheory/RamificationInertia","family_id":"inertiadeg'_pos","file_id":"mathlib/Mathlib/RingTheory/RamificationInertia/Inertia.lean","sample_id":"0f5d5b2142dd098a971cfed894d13ceb07152dafeb65b14609ac21cf2f161ec7"},"split":"validation"} {"binding":{"chosen_proof_sha256":"1fae15e34064bf8ae673e8fec62409b09ae3c381e55cd7a1a8df15ff0a7a2c98","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"c9d53b75ff94d9ba91ecd885af73f8533c42e1c175a62180c1762b72f137eff3","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"8b4458963958caea7284c3b37c020627fee1b32d3d574c8e6e6d2422ef2fc8b5","source_sha256":"5843500cd428a65c65e242734937e92c0f0b5d9024ddf9d8f2d0ee127d9aacac","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [Topology.IsInducing.continuous_iff (autEmbedding_isClosedEmbedding _).isInducing,\n continuous_pi_iff]\n intro X\n change Continuous fun a ↦ G.mapAut (F.obj X) (autEmbedding F a X)\n fun_prop\n\n/-- If `G` is a fully faithful functor of categories finite types, this is the automorphism of\ntopological groups `Aut F ≃ Aut (F ⋙ G)`. -/\nnoncomputable def autEquivAutWhiskerRight {G : FintypeCat.{w} ⥤ FintypeCat.{v}}\n (h : G.FullyFaithful) :\n Aut F ≃ₜ* Aut (F ⋙ G) where\n __ := (h.whiskeringRight C).autMulEquivOfFullyFaithful F\n continuous_toFun := continuous_mapAut_whiskeringRight F G\n continuous_invFun := Continuous.continuous_symm_of_equiv_compact_to_t2\n (f := ((h.whiskeringRight C).autMulEquivOfFullyFaithful F).toEquiv)\n (continuous_mapAut_whiskeringRight F G)\n\nvariable [GaloisCategory C] [FiberFunctor F]","hard_negative":false,"metrics":{"chosen_tokens":168,"rejected_tokens":2,"token_jaccard":0.012821,"token_length_ratio":0.011905},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"admit","pair_id":"fbe7c83ad92eddd9350327cc8381912b26eb65ace71b13a92649777826a718ae","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.CategoryTheory.Galois.Prorepresentability\npublic import Mathlib.Topology.Algebra.ContinuousMonoidHom\npublic import Mathlib.Topology.Algebra.Group.Basic\n\nNamespace:\nCategoryTheory.PreGaloisCategory\n\nLocal context:\n/-\nCopyright (c) 2024 Christian Merten. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Christian Merten\n-/\n/-!\n\n# Topology of fundamental group\n\nIn this file we define a natural topology on the automorphism group of a functor\n`F : C ⥤ FintypeCat`: It is defined as the subspace topology induced by the natural\nembedding of `Aut F` into `∀ X, Aut (F.obj X)` where\n`Aut (F.obj X)` carries the discrete topology.\n\n## References\n\n- [Stacks 0BMQ](https://stacks.math.columbia.edu/tag/0BMQ)\n\n-/\n\n@[expose] public section\n\nopen Topology\n\nuniverse u₁ u₂ v₁ v₂ v w\n\nnamespace CategoryTheory\n\nnamespace PreGaloisCategory\n\nopen Functor\n\nvariable {C : Type u₁} [Category.{u₂} C] (F : C ⥤ FintypeCat.{w})\n\n/-- For a functor `F : C ⥤ FintypeCat`, the canonical embedding of `Aut F` into\nthe product over `Aut (F.obj X)` for all objects `X`. -/\ndef autEmbedding : Aut F →* ∀ X, Aut (F.obj X) :=\n MonoidHom.mk' (fun σ X ↦ σ.app X) (fun _ _ ↦ rfl)\n\n@[simp]\nlemma autEmbedding_apply (σ : Aut F) (X : C) : autEmbedding F σ X = σ.app X :=\n rfl\n\nlemma autEmbedding_injective : Function.Injective (autEmbedding F) := by\n intro σ τ h\n ext X x\n have : σ.app X = τ.app X := congr_fun h X\n rw [← Iso.app_hom, ← Iso.app_hom, this]\n\n/-- We put the discrete topology on `F.obj X`. -/\nscoped instance (X : C) : TopologicalSpace (F.obj X) := ⊥\n\n@[scoped instance]\nlemma obj_discreteTopology (X : C) : DiscreteTopology (F.obj X) := ⟨rfl⟩\n\n/-- We put the discrete topology on `Aut (F.obj X)`. -/\nscoped instance (X : C) : TopologicalSpace (Aut (F.obj X)) := ⊥\n\n/-- We give `F.obj X ⟶ F.obj Y` the product topology. -/\n@[local simp]\nscoped instance {X Y : C} : TopologicalSpace (F.obj X ⟶ F.obj Y) :=\n .coinduced (fun f ↦ ObjectProperty.homMk (↾f)) inferInstance\n\nscoped instance {X Y : C} : DiscreteTopology (F.obj X ⟶ F.obj Y) :=\n ⟨by simp [DiscreteTopology.eq_bot]⟩\n\n@[scoped instance]\nlemma aut_discreteTopology (X : C) : DiscreteTopology (Aut (F.obj X)) := ⟨rfl⟩\n\n/-- `Aut F` is equipped with the by the embedding into `∀ X, Aut (F.obj X)` induced embedding. -/\ninstance : TopologicalSpace (Aut F) :=\n TopologicalSpace.induced (autEmbedding F) inferInstance\n\n/-lemma autEmbedding_range :\n Set.range (autEmbedding F) =\n ⋂ (f : Arrow C), { a | F.map f.hom ≫ (a f.right).hom = (a f.left).hom ≫ F.map f.hom } := by\n ext a\n simp only [Set.mem_range, id_obj, Set.mem_iInter, Set.mem_setOf_eq]\n refine ⟨fun ⟨σ, h⟩ i ↦ h.symm ▸ σ.hom.naturality i.hom, fun h ↦ ?_⟩\n · use NatIso.ofComponents a (fun {X Y} f ↦ h ⟨X, Y, f⟩)\n rfl-/\n\n/-- The image of `Aut F` in `∀ X, Aut (F.obj X)` are precisely the compatible families of\nautomorphisms. -/\nlemma autEmbedding_range :\n Set.range (autEmbedding F) = ⋂ (f : Arrow C), { a | F.map f.hom ≫ (a f.right).hom =\n (a f.left).hom ≫ F.map f.hom } := by\n ext a\n simp +instances only [Set.mem_range, Set.mem_iInter, Set.mem_setOf_eq]\n refine ⟨fun ⟨σ, h⟩ i ↦ by cat_disch, fun h ↦ ?_⟩\n exact ⟨NatIso.ofComponents a (fun {X Y} f ↦ by\n ext; simpa using ConcreteCategory.congr_hom (h ⟨X, Y, f⟩) _), rfl⟩\n\n/-- The image of `Aut F` in `∀ X, Aut (F.obj X)` is closed. -/\nlemma autEmbedding_range_isClosed : IsClosed (Set.range (autEmbedding F)) := by\n rw [autEmbedding_range]\n exact isClosed_iInter (fun f ↦ isClosed_eq (by fun_prop) (by fun_prop))\n\nlemma autEmbedding_isClosedEmbedding : IsClosedEmbedding (autEmbedding F) where\n eq_induced := rfl\n injective := autEmbedding_injective F\n isClosed_range := autEmbedding_range_isClosed F\n\ninstance : CompactSpace (Aut F) := (autEmbedding_isClosedEmbedding F).compactSpace\n\ninstance : T2Space (Aut F) :=\n T2Space.of_injective_continuous (autEmbedding_injective F) continuous_induced_dom\n\ninstance : TotallyDisconnectedSpace (Aut F) :=\n (autEmbedding_isClosedEmbedding F).isEmbedding.isTotallyDisconnected_range.mp\n (isTotallyDisconnected_of_totallyDisconnectedSpace _)\n\ninstance : ContinuousMul (Aut F) :=\n (autEmbedding_isClosedEmbedding F).isInducing.continuousMul (autEmbedding F)\n\ninstance : ContinuousInv (Aut F) :=\n (autEmbedding_isClosedEmbedding F).isInducing.continuousInv fun _ ↦ rfl\n\ninstance : IsTopologicalGroup (Aut F) := ⟨⟩\n\ninstance (X : C) : SMul (Aut (F.obj X)) (F.obj X) := ⟨fun σ a => σ.hom a⟩\n\ninstance (X : C) : ContinuousSMul (Aut (F.obj X)) (F.obj X) := by\n constructor\n fun_prop\n\ninstance continuousSMul_aut_fiber (X : C) : ContinuousSMul (Aut F) (F.obj X) where\n continuous_smul := by\n let g : Aut (F.obj X) × F.obj X → F.obj X := fun ⟨σ, x⟩ ↦ σ.hom x\n let h (q : Aut F × F.obj X) : Aut (F.obj X) × F.obj X :=\n ⟨((fun p ↦ p X) ∘ autEmbedding F) q.1, q.2⟩\n change Continuous (g ∘ h)\n fun_prop\n\n/-- If `G` is a functor of categories of finite types, the induced map `Aut F → Aut (F ⋙ G)` is\ncontinuous. -/\n\nTarget:\nlemma continuous_mapAut_whiskeringRight (G : FintypeCat.{w} ⥤ FintypeCat.{v}) :\n Continuous (((whiskeringRight _ _ _).obj G).mapAut F) :=\n\nProof body:\n","rejected":"by\n admit","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"CategoryTheory/Galois","family_id":"continuous_mapaut_whiskeringright","file_id":"mathlib/Mathlib/CategoryTheory/Galois/Topology.lean","sample_id":"8b4458963958caea7284c3b37c020627fee1b32d3d574c8e6e6d2422ef2fc8b5"},"split":"validation"} {"binding":{"chosen_proof_sha256":"e15b99f0eb73b50a3658217852a3ecec3d538f7ab20646620ad2a6942cdf6a8f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"2fcee1cceb7dbe0530a27ee71bbaabb62450286a432a67fdfe99e96c786132ea","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"fc3c5dcea0d121e7d50618fa13f14653cb05b535558cfd36971f20d217d9f23d","source_sha256":"740bfb06835908c9077b160ff85d111cf738322bf1006fc19f108aa1f2da53d5","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n revert h\n induction x using q.P.wCases\n case ih a₀ f'₀ f₀ =>\n induction y using q.P.wCases\n apply WEquiv.abs","hard_negative":false,"metrics":{"chosen_tokens":32,"rejected_tokens":37,"token_jaccard":0.84,"token_length_ratio":1.15625},"negative_category":"markdown_preamble_trailing","negative_mode":"trailing","pair_id":"fc5acaefd03c2fd7bc693dc6562a806b0f801df033f62e3d4f592bde05bfedcc","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.PFunctor.Multivariate.W\npublic import Mathlib.Data.QPF.Multivariate.Basic\n\nNamespace:\nMvQPF\n\nLocal context:\n/-\nCopyright (c) 2018 Jeremy Avigad. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jeremy Avigad, Simon Hudon\n-/\n/-!\n# The initial algebra of a multivariate qpf is again a qpf.\n\nFor an `(n+1)`-ary QPF `F (α₀,..,αₙ)`, we take the least fixed point of `F` with\nregards to its last argument `αₙ`. The result is an `n`-ary functor: `Fix F (α₀,..,αₙ₋₁)`.\nMaking `Fix F` into a functor allows us to take the fixed point, compose with other functors\nand take a fixed point again.\n\n## Main definitions\n\n* `Fix.mk` - constructor\n* `Fix.dest` - destructor\n* `Fix.rec` - recursor: basis for defining functions by structural recursion on `Fix F α`\n* `Fix.drec` - dependent recursor: generalization of `Fix.rec` where\n the result type of the function is allowed to depend on the `Fix F α` value\n* `Fix.rec_eq` - defining equation for `recursor`\n* `Fix.ind` - induction principle for `Fix F α`\n\n## Implementation notes\n\nFor `F` a `QPF`, we define `Fix F α` in terms of the W-type of the polynomial functor `P` of `F`.\nWe define the relation `WEquiv` and take its quotient as the definition of `Fix F α`.\n\nSee [avigad-carneiro-hudon2019] for more details.\n\n## Reference\n\n* Jeremy Avigad, Mario M. Carneiro and Simon Hudon.\n [*Data Types as Quotients of Polynomial Functors*][avigad-carneiro-hudon2019]\n-/\n\n@[expose] public section\n\n\nuniverse u v\n\nnamespace MvQPF\n\nopen TypeVec\n\nopen MvFunctor (LiftP LiftR)\n\nopen MvFunctor\n\nvariable {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u} [q : MvQPF F]\n\n\n/-- `recF` is used as a basis for defining the recursor on `Fix F α`. `recF`\ntraverses recursively the W-type generated by `q.P` using a function on `F`\nas a recursive step -/\ndef recF {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) : q.P.W α → β :=\n q.P.wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)\n\ntheorem recF_eq {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (a : q.P.A)\n (f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :\n recF g (q.P.wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩) := by\n rw [recF, MvPFunctor.wRec_eq]; rfl\n\nset_option backward.isDefEq.respectTransparency false in\ntheorem recF_eq' {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (x : q.P.W α) :\n recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) := by\n induction x using q.P.wCases\n case ih a f' f =>\n rw [recF_eq, q.P.wDest'_wMk, MvPFunctor.map_eq, appendFun_comp_splitFun, TypeVec.id_comp]\n\n/-- Equivalence relation on W-types that represent the same `Fix F`\nvalue -/\ninductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop\n | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :\n (∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)\n | abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)\n (f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :\n abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →\n WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)\n | trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w\n\ntheorem recF_eq_of_wEquiv (α : TypeVec n) {β : Type u} (u : F (α.append1 β) → β) (x y : q.P.W α) :\n WEquiv x y → recF u x = recF u y := by\n induction x using q.P.wCases\n case ih a₀ f'₀ f₀ =>\n induction y using q.P.wCases\n case ih a₁ f'₁ f₁ =>\n intro h\n -- Porting note: induction on h doesn't work.\n refine @WEquiv.recOn _ _ _ _ (fun a a' _ ↦ recF u a = recF u a') _ _ h ?_ ?_ ?_\n · intro a f' f₀ f₁ _h ih; simp only [recF_eq]\n congr 4; funext; apply ih\n · intro a₀ f'₀ f₀ a₁ f'₁ f₁ h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h]\n · intro x y z _e₁ _e₂ ih₁ ih₂; exact Eq.trans ih₁ ih₂\n\nTarget:\ntheorem wEquiv.abs' {α : TypeVec n} (x y : q.P.W α)\n (h : MvQPF.abs (q.P.wDest' x) = MvQPF.abs (q.P.wDest' y)) :\n WEquiv x y :=\n\nProof body:\n","rejected":"by\n revert h\n induction x using q.P.wCases\n case ih a₀ f'₀ f₀ =>\n induction y using q.P.wCases\n apply WEquiv.abs\nThis completes the proof.","rejection":{"accepted":false,"all_failure_types":["prose_or_trailing_explanation"],"failure_type":"prose_or_trailing_explanation","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/QPF","family_id":"wequiv","file_id":"mathlib/Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean","sample_id":"fc3c5dcea0d121e7d50618fa13f14653cb05b535558cfd36971f20d217d9f23d"},"split":"validation"} {"binding":{"chosen_proof_sha256":"ae90afea975d466a86f226f9c1d1cbf95f542b52a7a48dcd083f95788078e8f8","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"8489c5d05c7bcd5bb160d3d095ed93befce321cf763ad454aa32d2cc212cc958","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"537b839d4d179ae06b973d3c6beadf96c30eedcd31679faa1560869a67c1fd11","source_sha256":"642b30fa88305a90316a98480946140fe1b161fdab4cf2ed2c8aff299abae1bf","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by grind [cases Bool]","hard_negative":true,"metrics":{"chosen_tokens":6,"rejected_tokens":3,"token_jaccard":0.125,"token_length_ratio":0.5},"negative_category":"unknown_identifier","negative_mode":"unknown_identifier","pair_id":"fe9aba966647642cf5e271c1a79f9ec0b98eb72a19978c159f774b964a4fef98","pair_index":1,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Data.Set.Insert\n\nNamespace:\nBool\n\nLocal context:\n/-\nCopyright (c) 2021 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Booleans and set operations\n\nThis file contains three trivial lemmas about `Bool`, `Set.univ`, and `Set.range`.\n-/\n\npublic section\n\n\nopen Set\n\nnamespace Bool\n\n@[simp]\ntheorem univ_eq : (univ : Set Bool) = {false, true} := by grind\n\n@[simp, grind =]\n\nTarget:\ntheorem range_eq {α : Type*} (f : Bool → α) : range f = {f false, f true} :=\n\nProof body:\n","rejected":"by\n exact __oprover_missing_537b839d4d17","rejection":{"accepted":false,"failure_type":"unknown_identifier","output_sha256":"c6404d433c5583a1bbb007d0ed0bc71faa584cec928997854ea98acec96312d7","rejection_layer":"lean","returncode":1,"timed_out":false,"warning":false},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Data/Bool","family_id":"range_eq","file_id":"mathlib/Mathlib/Data/Bool/Set.lean","sample_id":"537b839d4d179ae06b973d3c6beadf96c30eedcd31679faa1560869a67c1fd11"},"split":"validation"} {"binding":{"chosen_proof_sha256":"5da84bd0d1be7a3e6cf126249f34c2eb9e6110ebc8d9192701d4f2343420fb7f","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"15deaf5ee94786e6935d71ab270cadc448f09971bd8d7e2328049e45ac9129c6","source_sha256":"c5f2821e1022912479225343e085671f902aa490700adbce0fd87ebd02ef26e6","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [range_eq_top, ker_eq_bot, injective_iff_surjective_of_finrank_eq_finrank H]\n\n/-- Given a linear map `f` between two vector spaces with the same dimension, if\n`ker f = ⊥` then `linearEquivOfInjective` is the induced isomorphism\nbetween the two vector spaces. -/\nnoncomputable def linearEquivOfInjective [FiniteDimensional K V] [FiniteDimensional K V₂]\n (f : V →ₗ[K] V₂) (hf : Injective f) (hdim : finrank K V = finrank K V₂) : V ≃ₗ[K] V₂ :=\n LinearEquiv.ofBijective f\n ⟨hf, (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hdim).mp hf⟩","hard_negative":false,"metrics":{"chosen_tokens":123,"rejected_tokens":2,"token_jaccard":0.016949,"token_length_ratio":0.01626},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"fec89aa6f4df64d7c7a4d72bc578917de986f668d386117b799cd5f3a9a05411","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.LinearAlgebra.Dimension.DivisionRing\npublic import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition\npublic import Mathlib.LinearAlgebra.FiniteDimensional.Basic\npublic import Mathlib.Tactic.IntervalCases\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\nCopyright (c) 2019 Chris Hughes. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Chris Hughes\n-/\n/-!\n# Finite-dimensional vector spaces\n\nThis file contains some further development of finite-dimensional vector spaces, their dimensions,\nand linear maps on such spaces.\n\nDefinitions are in `Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean`\nand results that require fewer imports are in `Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean`.\n-/\n\n@[expose] public section\n\nassert_not_exists Monoid.exponent Module.IsTorsion\n\n\nuniverse u v v'\n\nopen Cardinal Submodule Module Function\n\nvariable {K : Type u} {V : Type v}\n\nnamespace Submodule\n\nopen IsNoetherian Module\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V]\n\n/-- The dimension of a strict submodule is strictly bounded by the dimension of the ambient\nspace.\n\nSee also `Submodule.length_lt`. -/\ntheorem finrank_lt [FiniteDimensional K V] {s : Submodule K V} (h : s ≠ ⊤) :\n finrank K s < finrank K V := by\n rw [← s.finrank_quotient_add_finrank, add_comm]\n rw [← Quotient.nontrivial_iff] at h\n exact Nat.lt_add_of_pos_right finrank_pos\n\n/-- The sum of the dimensions of s + t and s ∩ t is the sum of the dimensions of s and t -/\ntheorem finrank_sup_add_finrank_inf_eq (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] :\n finrank K ↑(s ⊔ t) + finrank K ↑(s ⊓ t) = finrank K ↑s + finrank K ↑t := by\n have key : Module.rank K ↑(s ⊔ t) + Module.rank K ↑(s ⊓ t) = Module.rank K s + Module.rank K t :=\n rank_sup_add_rank_inf_eq s t\n repeat rw [← finrank_eq_rank] at key\n norm_cast at key\n\ntheorem finrank_add_le_finrank_add_finrank (s t : Submodule K V) [FiniteDimensional K s]\n [FiniteDimensional K t] : finrank K (s ⊔ t : Submodule K V) ≤ finrank K s + finrank K t := by\n rw [← finrank_sup_add_finrank_inf_eq]\n exact self_le_add_right _ _\n\ntheorem finrank_add_finrank_le_of_disjoint [FiniteDimensional K V]\n {s t : Submodule K V} (hdisjoint : Disjoint s t) :\n finrank K s + finrank K t ≤ finrank K V := by\n rw [← Submodule.finrank_sup_add_finrank_inf_eq s t, hdisjoint.eq_bot, finrank_bot, add_zero]\n exact Submodule.finrank_le _\n\ntheorem eq_top_of_disjoint [FiniteDimensional K V] (s t : Submodule K V)\n (hdim : finrank K V ≤ finrank K s + finrank K t) (hdisjoint : Disjoint s t) : s ⊔ t = ⊤ := by\n have h_finrank_inf : finrank K ↑(s ⊓ t) = 0 := by\n rw [disjoint_iff_inf_le, le_bot_iff] at hdisjoint\n rw [hdisjoint, finrank_bot]\n apply eq_top_of_finrank_eq\n replace hdim : finrank K V = finrank K s + finrank K t :=\n le_antisymm hdim (finrank_add_finrank_le_of_disjoint hdisjoint)\n rw [hdim]\n convert! s.finrank_sup_add_finrank_inf_eq t\n rw [h_finrank_inf, add_zero]\n\ntheorem isCompl_iff_disjoint [FiniteDimensional K V] (s t : Submodule K V)\n (hdim : finrank K V ≤ finrank K s + finrank K t) :\n IsCompl s t ↔ Disjoint s t :=\n ⟨fun h ↦ h.1, fun h ↦ ⟨h, codisjoint_iff.mpr <| eq_top_of_disjoint s t hdim h⟩⟩\n\ntheorem sup_span_singleton_eq_top_iff [Module.Finite K V] {W : Submodule K V} {v : V} (hv : v ∉ W) :\n W ⊔ span K {v} = ⊤ ↔ finrank K (V ⧸ W) = 1 := by\n refine ⟨fun hW ↦ ?_, fun hW ↦ ?_⟩\n · suffices W ⊓ span K {v} = ⊥ by\n have hv₀ : v ≠ 0 := by aesop\n have aux := finrank_sup_add_finrank_inf_eq W (span K {v})\n rw [hW, finrank_span_singleton hv₀, this, finrank_bot, finrank_top,\n ← finrank_quotient_add_finrank W] at aux\n lia\n refine (Submodule.eq_bot_iff _).mpr fun w hw ↦ ?_\n obtain ⟨ht, t, rfl⟩ : w ∈ W ∧ ∃ t : K, t • v = w := by simpa [mem_span_singleton] using hw\n rcases eq_or_ne t 0 with rfl | ht₀; · simp\n rw [Submodule.smul_mem_iff _ ht₀] at ht\n contradiction\n · apply Submodule.eq_top_of_disjoint\n · rw [← W.finrank_quotient_add_finrank, add_comm, add_le_add_iff_left, hW]\n aesop\n · exact Submodule.disjoint_span_singleton_of_notMem hv\n\ntheorem finrank_sup_span_singleton [Module.Finite K V] {p : Submodule K V} {v : V} (hv : v ∉ p) :\n finrank K (p ⊔ Submodule.span K {v} : Submodule K V) = finrank K p + 1 := by\n rw [← Nat.add_left_inj, finrank_sup_add_finrank_inf_eq, add_assoc,\n Nat.add_left_cancel_iff, finrank_span_singleton (by aesop),\n Nat.left_eq_add, Submodule.finrank_eq_zero, eq_bot_iff]\n intro x\n simp only [mem_inf, mem_span_singleton]\n rintro ⟨hx, ⟨a, hx'⟩⟩\n rw [← hx'] at hx\n suffices a = 0 by simp [← hx', this]\n contrapose hv\n simpa [smul_mem_iff p hv] using hx\n\ntheorem eq_top_iff_finrank_eq [Module.Finite K V] {W : Submodule K V} :\n W = ⊤ ↔ finrank K W = finrank K V := by\n refine ⟨fun h ↦ by rw [h, finrank_top], fun h ↦ ?_⟩\n apply eq_of_le_of_finrank_eq le_top\n rw [finrank_top, h]\n\nend DivisionRing\n\nend Submodule\n\nnamespace FiniteDimensional\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]\n [Module K V₂]\n\nvariable [FiniteDimensional K V] [FiniteDimensional K V₂]\n\n/-- Given isomorphic subspaces `p q` of vector spaces `V` and `V₁` respectively,\n `p.quotient` is isomorphic to `q.quotient`. -/\nnoncomputable def LinearEquiv.quotEquivOfEquiv {p : Subspace K V} {q : Subspace K V₂}\n (f₁ : p ≃ₗ[K] q) (f₂ : V ≃ₗ[K] V₂) : (V ⧸ p) ≃ₗ[K] V₂ ⧸ q :=\n LinearEquiv.ofFinrankEq _ _\n (by\n rw [← @add_right_cancel_iff _ _ _ (finrank K p), Submodule.finrank_quotient_add_finrank,\n LinearEquiv.finrank_eq f₁, Submodule.finrank_quotient_add_finrank,\n LinearEquiv.finrank_eq f₂])\n\n-- TODO: generalize to the case where one of `p` and `q` is finite-dimensional.\n/-- Given the subspaces `p q`, if `p.quotient ≃ₗ[K] q`, then `q.quotient ≃ₗ[K] p` -/\nnoncomputable def LinearEquiv.quotEquivOfQuotEquiv {p q : Subspace K V} (f : (V ⧸ p) ≃ₗ[K] q) :\n (V ⧸ q) ≃ₗ[K] p :=\n LinearEquiv.ofFinrankEq _ _ <| by\n rw [← add_right_cancel_iff, Submodule.finrank_quotient_add_finrank, ← LinearEquiv.finrank_eq f,\n add_comm, Submodule.finrank_quotient_add_finrank]\n\nend DivisionRing\n\nend FiniteDimensional\n\nnamespace LinearMap\n\nopen Module\n\nsection DivisionRing\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]\n [Module K V₂]\n\n/-- rank-nullity theorem : the dimensions of the kernel and the range of a linear map add up to\nthe dimension of the source space. -/\ntheorem finrank_range_add_finrank_ker [FiniteDimensional K V] (f : V →ₗ[K] V₂) :\n finrank K (LinearMap.range f) + finrank K (LinearMap.ker f) = finrank K V := by\n rw [← f.quotKerEquivRange.finrank_eq]\n exact Submodule.finrank_quotient_add_finrank _\n\nlemma ker_ne_bot_of_finrank_lt [FiniteDimensional K V] [FiniteDimensional K V₂] {f : V →ₗ[K] V₂}\n (h : finrank K V₂ < finrank K V) :\n LinearMap.ker f ≠ ⊥ := by\n have h₁ := f.finrank_range_add_finrank_ker\n have h₂ : finrank K (LinearMap.range f) ≤ finrank K V₂ := (LinearMap.range f).finrank_le\n suffices 0 < finrank K (LinearMap.ker f) from Submodule.one_le_finrank_iff.mp this\n lia\n\nend DivisionRing\n\nend LinearMap\n\nopen Module\n\nnamespace LinearMap\n\nvariable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]\n [Module K V₂]\n\ntheorem injective_iff_surjective_of_finrank_eq_finrank [FiniteDimensional K V]\n [FiniteDimensional K V₂] (H : finrank K V = finrank K V₂) {f : V →ₗ[K] V₂} :\n Function.Injective f ↔ Function.Surjective f := by\n have := finrank_range_add_finrank_ker f\n rw [← ker_eq_bot, ← range_eq_top]; refine ⟨fun h => ?_, fun h => ?_⟩\n · rw [h, finrank_bot, add_zero, H] at this\n exact eq_top_of_finrank_eq this\n · rw [h, finrank_top, H] at this\n exact Submodule.finrank_eq_zero.1 (add_right_injective _ this)\n\nTarget:\ntheorem ker_eq_bot_iff_range_eq_top_of_finrank_eq_finrank [FiniteDimensional K V]\n [FiniteDimensional K V₂] (H : finrank K V = finrank K V₂) {f : V →ₗ[K] V₂} :\n LinearMap.ker f = ⊥ ↔ LinearMap.range f = ⊤ :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"LinearAlgebra/FiniteDimensional","family_id":"ker_eq_bot_iff_range_eq_top_of_finrank_eq_finrank","file_id":"mathlib/Mathlib/LinearAlgebra/FiniteDimensional/Lemmas.lean","sample_id":"15deaf5ee94786e6935d71ab270cadc448f09971bd8d7e2328049e45ac9129c6"},"split":"validation"} {"binding":{"chosen_proof_sha256":"f77ed22ce482683d941ce3730ae2e8f510d2678626103bd1f0ff988c81a4f296","mathlib_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","negative_generator_hash":"8285991fca7eded1551939aba257955b2916c5e9006a0b0c6c621296d1e6c2d9","rejected_proof_sha256":"9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b","source_artifact_hash":"5ebec3f7ed71d0af202924ea9d5ca12a857c5363b89b028dbf74268bf2e32f24","source_sample_id":"77efb6bce26e950b2369ecb305e9643f1ff5fc63afe9ac4a312413b2c8375881","source_sha256":"dfcdfb7def47f0bcbcab37ea254b17db55b5da584b38ce7ceb07bc11e4db6c04","toolchain":"leanprover/lean4:v4.32.0-rc1"},"chosen":"by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n rfl","hard_negative":false,"metrics":{"chosen_tokens":16,"rejected_tokens":2,"token_jaccard":0.066667,"token_length_ratio":0.125},"negative_category":"sorry_admit_sorryAx_proof_hole","negative_mode":"sorry","pair_id":"ff23ae617be2f05b8de254fb25dee7e359b65df21085a7d0df29e0708f45d97f","pair_index":0,"prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Control.Bitraversable.Basic\n\nNamespace:\nBitraversable\n\nLocal context:\n/-\nCopyright (c) 2019 Simon Hudon. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Simon Hudon\n-/\n/-!\n# Bitraversable Lemmas\n\n## Main definitions\n * tfst - traverse on first functor argument\n * tsnd - traverse on second functor argument\n\n## Lemmas\n\nCombination of\n * bitraverse\n * tfst\n * tsnd\n\nwith the applicatives `id` and `comp`\n\n## References\n\n* Hackage: \n\n## Tags\n\ntraversable bitraversable functor bifunctor applicative\n\n\n-/\n\npublic section\n\n\nuniverse u\n\nvariable {t : Type u → Type u → Type u} [Bitraversable t]\nvariable {β : Type u}\n\nnamespace Bitraversable\n\nopen Functor LawfulApplicative\n\nvariable {F G : Type u → Type u} [Applicative F] [Applicative G]\n\n/-- traverse on the first functor argument -/\nabbrev tfst {α α'} (f : α → F α') : t α β → F (t α' β) :=\n bitraverse f pure\n\n/-- traverse on the second functor argument -/\nabbrev tsnd {α α'} (f : α → F α') : t β α → F (t β α') :=\n bitraverse pure f\n\nvariable [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G]\n\n@[higher_order tfst_id]\ntheorem id_tfst : ∀ {α β} (x : t α β), tfst (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tsnd_id]\ntheorem id_tsnd : ∀ {α β} (x : t α β), tsnd (F := Id) pure x = pure x :=\n id_bitraverse\n\n@[higher_order tfst_comp_tfst]\ntheorem comp_tfst {α₀ α₁ α₂ β} (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β) :\n Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, tfst, map_pure, Pure.pure]\n\n@[higher_order tfst_comp_tsnd]\ntheorem tfst_tsnd {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tfst f <$> tsnd f' x)\n = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n\n@[higher_order tsnd_comp_tfst]\ntheorem tsnd_tfst {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) :\n Comp.mk (tsnd f' <$> tfst f x)\n = bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x := by\n rw [← comp_bitraverse]\n simp only [Function.comp_def, map_pure]\n\n@[higher_order tsnd_comp_tsnd]\n\nTarget:\ntheorem comp_tsnd {α β₀ β₁ β₂} (g : β₀ → F β₁) (g' : β₁ → G β₂) (x : t α β₀) :\n Comp.mk (tsnd g' <$> tsnd g x) = tsnd (Comp.mk ∘ map g' ∘ g) x :=\n\nProof body:\n","rejected":"by\n sorry","rejection":{"accepted":false,"all_failure_types":["proof_hole_or_search_placeholder"],"failure_type":"proof_hole_or_search_placeholder","rejection_layer":"strict_parser"},"safe_lean_text_only":true,"schema_version":1,"source":{"dependency_family_id":"Control/Bitraversable","family_id":"comp_tsnd","file_id":"mathlib/Mathlib/Control/Bitraversable/Lemmas.lean","sample_id":"77efb6bce26e950b2369ecb305e9643f1ff5fc63afe9ac4a312413b2c8375881"},"split":"validation"}