{"sample_id": "A-Mathlib.FieldTheory.Fixed.AlgHom", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.Fixed)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem AlgHom.card_le {F K : Type*} [Field F] [Field K] [Algebra F K] [FiniteDimensional F K] :\n Fintype.card (K \u2192\u2090[F] K) \u2264 Module.finrank F K\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.Fixed).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem AlgHom.card_le {F K : Type*} [Field F] [Field K] [Algebra F K] [FiniteDimensional F K] :\n Fintype.card (K \u2192\u2090[F] K) \u2264 Module.finrank F K\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/Fixed.lean", "module": "Mathlib.FieldTheory.Fixed", "declaration": "Mathlib.FieldTheory.Fixed.AlgHom", "span": "L327-L330", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/Fixed.lean#L327"}, "environment": {}, "measurements": {"input_tokens": 167, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 548, "lean_code_chars": 147, "natural_language_chars": 401, "lean_code_ratio": 0.2682, "line_count": 8, "imports_count": 0, "declarations_count": 68, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f42f6bbca0535a4b", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Action.Limits.preservesColimitsOfShape_of_preserves", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Action.Limits)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma preservesColimitsOfShape_of_preserves (F : C \u2964 Action V G) {J : Type*}\n [Category* J] (h : PreservesColimitsOfShape J (F \u22d9 Action.forget V G)) :\n PreservesColimitsOfShape J F\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Action.Limits).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma preservesColimitsOfShape_of_preserves (F : C \u2964 Action V G) {J : Type*}\n [Category* J] (h : PreservesColimitsOfShape J (F \u22d9 Action.forget V G)) :\n PreservesColimitsOfShape J F\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Action/Limits.lean", "module": "Mathlib.CategoryTheory.Action.Limits", "declaration": "Mathlib.CategoryTheory.Action.Limits.preservesColimitsOfShape_of_preserves", "span": "L136-L145", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Action/Limits.lean#L136"}, "environment": {}, "measurements": {"input_tokens": 174, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 599, "lean_code_chars": 187, "natural_language_chars": 412, "lean_code_ratio": 0.3122, "line_count": 9, "imports_count": 0, "declarations_count": 67, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7058f05e93734ad7", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.Geometry.Euclidean.Sphere.SecondInter.Sphere", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Euclidean.Sphere.SecondInter)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Sphere.eq_or_eq_secondInter_of_mem_mk'_span_singleton_iff_mem {s : Sphere P} {p : P}\n (hp : p \u2208 s) {v : V} {p' : P} (hp' : p' \u2208 AffineSubspace.mk' p (\u211d \u2219 v)) :\n p' = p \u2228 p' = s.secondInter p v \u2194 p' \u2208 s\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Euclidean.Sphere.SecondInter).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Sphere.eq_or_eq_secondInter_of_mem_mk'_span_singleton_iff_mem {s : Sphere P} {p : P}\n (hp : p \u2208 s) {v : V} {p' : P} (hp' : p' \u2208 AffineSubspace.mk' p (\u211d \u2219 v)) :\n p' = p \u2228 p' = s.secondInter p v \u2194 p' \u2208 s\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Euclidean/Sphere/SecondInter.lean", "module": "Mathlib.Geometry.Euclidean.Sphere.SecondInter", "declaration": "Mathlib.Geometry.Euclidean.Sphere.SecondInter.Sphere", "span": "L90-L109", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Euclidean/Sphere/SecondInter.lean#L90"}, "environment": {}, "measurements": {"input_tokens": 210, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 637, "lean_code_chars": 216, "natural_language_chars": 421, "lean_code_ratio": 0.3391, "line_count": 9, "imports_count": 0, "declarations_count": 73, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "388dcd34128a357c", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Limits.Connected.widePullbackShape_connected", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Connected)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ninstance widePullbackShape_connected (J : Type v\u2081) : IsConnected (WidePullbackShape J)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Connected).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance widePullbackShape_connected (J : Type v\u2081) : IsConnected (WidePullbackShape J)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Connected.lean", "module": "Mathlib.CategoryTheory.Limits.Connected", "declaration": "Mathlib.CategoryTheory.Limits.Connected.widePullbackShape_connected", "span": "L163-L169", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Connected.lean#L163"}, "environment": {}, "measurements": {"input_tokens": 136, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 502, "lean_code_chars": 87, "natural_language_chars": 415, "lean_code_ratio": 0.1733, "line_count": 7, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c35606ec1f0d299f", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.FieldTheory.AlgebraicClosure.le_algebraicClosure_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.AlgebraicClosure)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem le_algebraicClosure_iff (L : IntermediateField F E) :\n L \u2264 algebraicClosure F E \u2194 Algebra.IsAlgebraic F L\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.AlgebraicClosure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem le_algebraicClosure_iff (L : IntermediateField F E) :\n L \u2264 algebraicClosure F E \u2194 Algebra.IsAlgebraic F L\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/AlgebraicClosure.lean", "module": "Mathlib.FieldTheory.AlgebraicClosure", "declaration": "Mathlib.FieldTheory.AlgebraicClosure.le_algebraicClosure_iff", "span": "L138-L147", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/AlgebraicClosure.lean#L138"}, "environment": {}, "measurements": {"input_tokens": 148, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 529, "lean_code_chars": 117, "natural_language_chars": 412, "lean_code_ratio": 0.2212, "line_count": 8, "imports_count": 0, "declarations_count": 59, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c984c8484d7416b3", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Sites.GlobalSections.Sheaf", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Sites.GlobalSections)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma Sheaf.\u0393ObjEquivHom_naturality_symm [HasWeakSheafify J (Type w)]\n [HasGlobalSectionsFunctor J (Type w)] {X : Type w} [Unique X] {F G : Sheaf J (Type w)}\n (f : F \u27f6 G) (x : (constantSheaf J _).obj X \u27f6 F) :\n (\u0393ObjEquivHom J G X).symm (x \u226b f) = (\u0393 J _).map f ((\u0393ObjEquivHom J F X).symm x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Sites.GlobalSections).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Sheaf.\u0393ObjEquivHom_naturality_symm [HasWeakSheafify J (Type w)]\n [HasGlobalSectionsFunctor J (Type w)] {X : Type w} [Unique X] {F G : Sheaf J (Type w)}\n (f : F \u27f6 G) (x : (constantSheaf J _).obj X \u27f6 F) :\n (\u0393ObjEquivHom J G X).symm (x \u226b f) = (\u0393 J _).map f ((\u0393ObjEquivHom J F X).symm x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Sites/GlobalSections.lean", "module": "Mathlib.CategoryTheory.Sites.GlobalSections", "declaration": "Mathlib.CategoryTheory.Sites.GlobalSections.Sheaf", "span": "L228-L242", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Sites/GlobalSections.lean#L228"}, "environment": {}, "measurements": {"input_tokens": 237, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 718, "lean_code_chars": 299, "natural_language_chars": 419, "lean_code_ratio": 0.4164, "line_count": 10, "imports_count": 0, "declarations_count": 95, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7009801958c1e2cf", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.FieldTheory.AbelRuffini.gal_X_pow_isSolvable", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.AbelRuffini)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem gal_X_pow_isSolvable (n : \u2115) : IsSolvable (X ^ n : F[X]).Gal\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.AbelRuffini).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem gal_X_pow_isSolvable (n : \u2115) : IsSolvable (X ^ n : F[X]).Gal\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/AbelRuffini.lean", "module": "Mathlib.FieldTheory.AbelRuffini", "declaration": "Mathlib.FieldTheory.AbelRuffini.gal_X_pow_isSolvable", "span": "L45-L46", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/AbelRuffini.lean#L45"}, "environment": {}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 476, "lean_code_chars": 69, "natural_language_chars": 407, "lean_code_ratio": 0.145, "line_count": 7, "imports_count": 0, "declarations_count": 55, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f016819a7ecae9af", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms.Ioo_ae_eq_Ioc", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Ioo_ae_eq_Ioc : Ioo a b =\u1d50[\u03bc] Ioc a b\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Ioo_ae_eq_Ioc : Ioo a b =\u1d50[\u03bc] Ioc a b\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/Typeclasses/NoAtoms.lean", "module": "Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms", "declaration": "Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms.Ioo_ae_eq_Ioc", "span": "L106-L108", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/Typeclasses/NoAtoms.lean#L106"}, "environment": {}, "measurements": {"input_tokens": 143, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 471, "lean_code_chars": 46, "natural_language_chars": 425, "lean_code_ratio": 0.0977, "line_count": 7, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0cc1066f6d6b647c", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Shift.Linear.linear_of_localization", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Shift.Linear)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma linear_of_localization [L.IsLocalization W] [L.Linear R] [HasShift D M]\n [L.CommShift M] (n : M) : (shiftFunctor D n).Linear R\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Shift.Linear).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma linear_of_localization [L.IsLocalization W] [L.Linear R] [HasShift D M]\n [L.CommShift M] (n : M) : (shiftFunctor D n).Linear R\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Shift/Linear.lean", "module": "Mathlib.CategoryTheory.Shift.Linear", "declaration": "Mathlib.CategoryTheory.Shift.Linear.linear_of_localization", "span": "L33-L39", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Shift/Linear.lean#L33"}, "environment": {}, "measurements": {"input_tokens": 157, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 547, "lean_code_chars": 136, "natural_language_chars": 411, "lean_code_ratio": 0.2486, "line_count": 8, "imports_count": 0, "declarations_count": 64, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a75d3d4d3cd570a1", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Category.Cat.inv_hom_id_toNatTrans", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Category.Cat)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma inv_hom_id_toNatTrans {X Y : Cat.{v, u}} {F G : X \u27f6 Y} (e : F \u2245 G) :\n e.inv.toNatTrans \u226b e.hom.toNatTrans = \ud835\udfd9 _\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Category.Cat).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma inv_hom_id_toNatTrans {X Y : Cat.{v, u}} {F G : X \u27f6 Y} (e : F \u2245 G) :\n e.inv.toNatTrans \u226b e.hom.toNatTrans = \ud835\udfd9 _\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Category/Cat.lean", "module": "Mathlib.CategoryTheory.Category.Cat", "declaration": "Mathlib.CategoryTheory.Category.Cat.inv_hom_id_toNatTrans", "span": "L197-L200", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Category/Cat.lean#L197"}, "environment": {}, "measurements": {"input_tokens": 168, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 532, "lean_code_chars": 121, "natural_language_chars": 411, "lean_code_ratio": 0.2274, "line_count": 8, "imports_count": 0, "declarations_count": 63, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1ae85fd7d9bffb44", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Shift.Adjunction.compatibilityUnit_iso", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Shift.Adjunction)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma compatibilityUnit_iso (a : A) :\n CommShift.CompatibilityUnit adj (iso adj a) (G.commShiftIso a)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Shift.Adjunction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma compatibilityUnit_iso (a : A) :\n CommShift.CompatibilityUnit adj (iso adj a) (G.commShiftIso a)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Shift/Adjunction.lean", "module": "Mathlib.CategoryTheory.Shift.Adjunction", "declaration": "Mathlib.CategoryTheory.Shift.Adjunction.compatibilityUnit_iso", "span": "L452-L470", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Shift/Adjunction.lean#L452"}, "environment": {}, "measurements": {"input_tokens": 145, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 520, "lean_code_chars": 105, "natural_language_chars": 415, "lean_code_ratio": 0.2019, "line_count": 8, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "32f3f85ff8d35e7b", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Localization.Construction.natTransExtension", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Localization.Construction)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef natTransExtension {F\u2081 F\u2082 : W.Localization \u2964 D} (\u03c4 : W.Q \u22d9 F\u2081 \u27f6 W.Q \u22d9 F\u2082) : F\u2081 \u27f6 F\u2082 where\n app\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Localization.Construction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef natTransExtension {F\u2081 F\u2082 : W.Localization \u2964 D} (\u03c4 : W.Q \u22d9 F\u2081 \u27f6 W.Q \u22d9 F\u2082) : F\u2081 \u27f6 F\u2082 where\n app\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Localization/Construction.lean", "module": "Mathlib.CategoryTheory.Localization.Construction", "declaration": "Mathlib.CategoryTheory.Localization.Construction.natTransExtension", "span": "L263-L275", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Localization/Construction.lean#L263"}, "environment": {}, "measurements": {"input_tokens": 164, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 523, "lean_code_chars": 99, "natural_language_chars": 424, "lean_code_ratio": 0.1893, "line_count": 8, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3a2e7e6e7db81a7c", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.NatIso.trans_app", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.NatIso)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem trans_app {F G H : C \u2964 D} (\u03b1 : F \u2245 G) (\u03b2 : G \u2245 H) (X : C) :\n (\u03b1 \u226a\u226b \u03b2).app X = \u03b1.app X \u226a\u226b \u03b2.app X\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.NatIso).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem trans_app {F G H : C \u2964 D} (\u03b1 : F \u2245 G) (\u03b2 : G \u2245 H) (X : C) :\n (\u03b1 \u226a\u226b \u03b2).app X = \u03b1.app X \u226a\u226b \u03b2.app X\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/NatIso.lean", "module": "Mathlib.CategoryTheory.NatIso", "declaration": "Mathlib.CategoryTheory.NatIso.trans_app", "span": "L94-L99", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/NatIso.lean#L94"}, "environment": {}, "measurements": {"input_tokens": 171, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 513, "lean_code_chars": 108, "natural_language_chars": 405, "lean_code_ratio": 0.2105, "line_count": 8, "imports_count": 0, "declarations_count": 65, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "75f5d841c911bf4a", "near_duplicate_cluster_id": "", "triviality_score": 1.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.Measure.Count.count_apply_eq_top'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Count)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem count_apply_eq_top' (s_mble : MeasurableSet s) : count s = \u221e \u2194 s.Infinite\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Count).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem count_apply_eq_top' (s_mble : MeasurableSet s) : count s = \u221e \u2194 s.Infinite\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/Count.lean", "module": "Mathlib.MeasureTheory.Measure.Count", "declaration": "Mathlib.MeasureTheory.Measure.Count.count_apply_eq_top'", "span": "L73-L78", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/Count.lean#L73"}, "environment": {}, "measurements": {"input_tokens": 143, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 493, "lean_code_chars": 82, "natural_language_chars": 411, "lean_code_ratio": 0.1663, "line_count": 7, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "07eca89a2c87785d", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.Probability.Independence.Integration.IndepFun", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Independence.Integration)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem IndepFun.integrable_right_of_integrable_mul {\u03b2 : Type*} [MeasurableSpace \u03b2] {X Y : \u03a9 \u2192 \u03b2}\n [NormedDivisionRing \u03b2] [OpensMeasurableSpace \u03b2]\n (hXY : X \u27c2\u1d62[\u03bc] Y) (h'XY : Integrable (X * Y) \u03bc)\n (hX : AEStronglyMeasurable X \u03bc) (hY : AEStronglyMeasurable Y \u03bc) (h'X : \u00acX =\u1d50[\u03bc] 0) :\n Integrable Y \u03bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Independence.Integration).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem IndepFun.integrable_right_of_integrable_mul {\u03b2 : Type*} [MeasurableSpace \u03b2] {X Y : \u03a9 \u2192 \u03b2}\n [NormedDivisionRing \u03b2] [OpensMeasurableSpace \u03b2]\n (hXY : X \u27c2\u1d62[\u03bc] Y) (h'XY : Integrable (X * Y) \u03bc)\n (hX : AEStronglyMeasurable X \u03bc) (hY : AEStronglyMeasurable Y \u03bc) (h'X : \u00acX =\u1d50[\u03bc] 0) :\n Integrable Y \u03bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Probability/Independence/Integration.lean", "module": "Mathlib.Probability.Independence.Integration", "declaration": "Mathlib.Probability.Independence.Integration.IndepFun", "span": "L187-L205", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Independence/Integration.lean#L187"}, "environment": {}, "measurements": {"input_tokens": 254, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 730, "lean_code_chars": 310, "natural_language_chars": 420, "lean_code_ratio": 0.4247, "line_count": 11, "imports_count": 0, "declarations_count": 71, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8dcdc32c360b172b", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Abelian.RightDerived.toRightDerivedZero'_naturality", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Abelian.RightDerived)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma toRightDerivedZero'_naturality {C} [Category* C] [Abelian C] {X Y : C} (f : X \u27f6 Y)\n (P : InjectiveResolution X) (Q : InjectiveResolution Y)\n (\u03c6 : P.cocomplex \u27f6 Q.cocomplex) (comm : P.\u03b9.f 0 \u226b \u03c6.f 0 = f \u226b Q.\u03b9.f 0)\n (F : C \u2964 D) [F.Additive] :\n F.map f \u226b Q.toRightDerivedZero' F =\n P.toRightDerivedZero' F \u226b\n HomologicalComplex.cyclesMap ((F.mapHomologicalComplex _).map \u03c6) 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Abelian.RightDerived).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma toRightDerivedZero'_naturality {C} [Category* C] [Abelian C] {X Y : C} (f : X \u27f6 Y)\n (P : InjectiveResolution X) (Q : InjectiveResolution Y)\n (\u03c6 : P.cocomplex \u27f6 Q.cocomplex) (comm : P.\u03b9.f 0 \u226b \u03c6.f 0 = f \u226b Q.\u03b9.f 0)\n (F : C \u2964 D) [F.Additive] :\n F.map f \u226b Q.toRightDerivedZero' F =\n P.toRightDerivedZero' F \u226b\n HomologicalComplex.cyclesMap ((F.mapHomologicalComplex _).map \u03c6) 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Abelian/RightDerived.lean", "module": "Mathlib.CategoryTheory.Abelian.RightDerived", "declaration": "Mathlib.CategoryTheory.Abelian.RightDerived.toRightDerivedZero'_naturality", "span": "L276-L289", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Abelian/RightDerived.lean#L276"}, "environment": {}, "measurements": {"input_tokens": 272, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 821, "lean_code_chars": 402, "natural_language_chars": 419, "lean_code_ratio": 0.4896, "line_count": 13, "imports_count": 0, "declarations_count": 88, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "68f67ef7a72c7fde", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.Geometry.Manifold.MFDeriv.Defs.mfderiv", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.MFDeriv.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef mfderiv (f : M \u2192 M') (x : M) : TangentSpace I x \u2192L[\ud835\udd5c] TangentSpace I' (f x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.MFDeriv.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef mfderiv (f : M \u2192 M') (x : M) : TangentSpace I x \u2192L[\ud835\udd5c] TangentSpace I' (f x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/MFDeriv/Defs.lean", "module": "Mathlib.Geometry.Manifold.MFDeriv.Defs", "declaration": "Mathlib.Geometry.Manifold.MFDeriv.Defs.mfderiv", "span": "L334-L340", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/MFDeriv/Defs.lean#L334"}, "environment": {}, "measurements": {"input_tokens": 157, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 494, "lean_code_chars": 80, "natural_language_chars": 414, "lean_code_ratio": 0.1619, "line_count": 7, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7d0889d3a396b6fa", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Elements.Functor", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Elements)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma Functor.Elements.ext {F : C \u2964 Type w} (x y : F.Elements) (h\u2081 : x.fst = y.fst)\n (h\u2082 : F.map (eqToHom h\u2081) x.snd = y.snd) : x = y\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Elements).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Functor.Elements.ext {F : C \u2964 Type w} (x y : F.Elements) (h\u2081 : x.fst = y.fst)\n (h\u2082 : F.map (eqToHom h\u2081) x.snd = y.snd) : x = y\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Elements.lean", "module": "Mathlib.CategoryTheory.Elements", "declaration": "Mathlib.CategoryTheory.Elements.Functor", "span": "L54-L63", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Elements.lean#L54"}, "environment": {}, "measurements": {"input_tokens": 174, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 543, "lean_code_chars": 136, "natural_language_chars": 407, "lean_code_ratio": 0.2505, "line_count": 8, "imports_count": 0, "declarations_count": 66, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4dbcb438d5d45a68", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms.restrict_Ioo_eq_restrict_Icc", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem restrict_Ioo_eq_restrict_Icc : \u03bc.restrict (Ioo a b) = \u03bc.restrict (Icc a b)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem restrict_Ioo_eq_restrict_Icc : \u03bc.restrict (Ioo a b) = \u03bc.restrict (Icc a b)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/Typeclasses/NoAtoms.lean", "module": "Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms", "declaration": "Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms.restrict_Ioo_eq_restrict_Icc", "span": "L139-L141", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/Typeclasses/NoAtoms.lean#L139"}, "environment": {}, "measurements": {"input_tokens": 147, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 508, "lean_code_chars": 83, "natural_language_chars": 425, "lean_code_ratio": 0.1634, "line_count": 7, "imports_count": 0, "declarations_count": 56, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "bf61dabb725c6e26", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated.measurableSet_generateFrom_countablePartition_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma measurableSet_generateFrom_countablePartition_iff (n : \u2115) (s : Set \u03b1) :\n MeasurableSet[generateFrom (countablePartition \u03b1 n)] s\n \u2194 \u2203 S : Finset (Set \u03b1), \u2191S \u2286 countablePartition \u03b1 n \u2227 s = \u22c3\u2080 S\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma measurableSet_generateFrom_countablePartition_iff (n : \u2115) (s : Set \u03b1) :\n MeasurableSet[generateFrom (countablePartition \u03b1 n)] s\n \u2194 \u2203 S : Finset (Set \u03b1), \u2191S \u2286 countablePartition \u03b1 n \u2227 s = \u22c3\u2080 S\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean", "module": "Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated", "declaration": "Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated.measurableSet_generateFrom_countablePartition_iff", "span": "L477-L481", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean#L477"}, "environment": {}, "measurements": {"input_tokens": 192, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 638, "lean_code_chars": 206, "natural_language_chars": 432, "lean_code_ratio": 0.3229, "line_count": 9, "imports_count": 0, "declarations_count": 64, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d8b3eb71ed5c347b", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.Function.LpSeminorm.Basic.eLpNorm_le_add_measure_right", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.LpSeminorm.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem eLpNorm_le_add_measure_right (f : \u03b1 \u2192 \u03b5) (\u03bc \u03bd : Measure \u03b1) {p : \u211d\u22650\u221e} :\n eLpNorm f p \u03bc \u2264 eLpNorm f p (\u03bc + \u03bd)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.LpSeminorm.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eLpNorm_le_add_measure_right (f : \u03b1 \u2192 \u03b5) (\u03bc \u03bd : Measure \u03b1) {p : \u211d\u22650\u221e} :\n eLpNorm f p \u03bc \u2264 eLpNorm f p (\u03bc + \u03bd)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean", "module": "Mathlib.MeasureTheory.Function.LpSeminorm.Basic", "declaration": "Mathlib.MeasureTheory.Function.LpSeminorm.Basic.eLpNorm_le_add_measure_right", "span": "L719-L722", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean#L719"}, "environment": {}, "measurements": {"input_tokens": 173, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 543, "lean_code_chars": 120, "natural_language_chars": 423, "lean_code_ratio": 0.221, "line_count": 8, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c8ba393d6341890a", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.Measure.TightNormed.isTightMeasureSet_of_inner_tendsto", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.TightNormed)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma isTightMeasureSet_of_inner_tendsto\n (h : \u2200 y, Tendsto (fun r : \u211d \u21a6 \u2a06 \u03bc \u2208 S, \u03bc {x | r < \u2016\u27eay, x\u27eb_\ud835\udd5c\u2016}) atTop (\ud835\udcdd 0)) :\n IsTightMeasureSet S\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.TightNormed).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma isTightMeasureSet_of_inner_tendsto\n (h : \u2200 y, Tendsto (fun r : \u211d \u21a6 \u2a06 \u03bc \u2208 S, \u03bc {x | r < \u2016\u27eay, x\u27eb_\ud835\udd5c\u2016}) atTop (\ud835\udcdd 0)) :\n IsTightMeasureSet S\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/TightNormed.lean", "module": "Mathlib.MeasureTheory.Measure.TightNormed", "declaration": "Mathlib.MeasureTheory.Measure.TightNormed.isTightMeasureSet_of_inner_tendsto", "span": "L176-L184", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/TightNormed.lean#L176"}, "environment": {}, "measurements": {"input_tokens": 197, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 565, "lean_code_chars": 148, "natural_language_chars": 417, "lean_code_ratio": 0.2619, "line_count": 9, "imports_count": 0, "declarations_count": 62, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9519451417388e92", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.Geometry.Manifold.VectorField.LieBracket.mpullback_mlieBracket", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.VectorField.LieBracket)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma mpullback_mlieBracket\n {f : M \u2192 M'} {V W : \u03a0 (x : M'), TangentSpace I' x} {x\u2080 : M}\n (hV : MDiffAt (T% V) (f x\u2080)) (hW : MDiffAt (T% W) (f x\u2080))\n (hf : CMDiffAt n f x\u2080) (hn : minSmoothness \ud835\udd5c 2 \u2264 n) :\n mpullback I I' f (mlieBracket I' V W) x\u2080 =\n mlieBracket I (mpullback I I' f V) (mpullback I I' f W) x\u2080\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.VectorField.LieBracket).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma mpullback_mlieBracket\n {f : M \u2192 M'} {V W : \u03a0 (x : M'), TangentSpace I' x} {x\u2080 : M}\n (hV : MDiffAt (T% V) (f x\u2080)) (hW : MDiffAt (T% W) (f x\u2080))\n (hf : CMDiffAt n f x\u2080) (hn : minSmoothness \ud835\udd5c 2 \u2264 n) :\n mpullback I I' f (mlieBracket I' V W) x\u2080 =\n mlieBracket I (mpullback I I' f V) (mpullback I I' f W) x\u2080\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/VectorField/LieBracket.lean", "module": "Mathlib.Geometry.Manifold.VectorField.LieBracket", "declaration": "Mathlib.Geometry.Manifold.VectorField.LieBracket.mpullback_mlieBracket", "span": "L822-L895", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean#L822"}, "environment": {}, "measurements": {"input_tokens": 279, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 748, "lean_code_chars": 324, "natural_language_chars": 424, "lean_code_ratio": 0.4332, "line_count": 12, "imports_count": 0, "declarations_count": 102, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "365d161c181aeb38", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Limits.Shapes.BinaryBiproducts.biprod", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.BinaryBiproducts)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem biprod.inl_map {W X Y Z : C} [HasBinaryBiproduct W X] [HasBinaryBiproduct Y Z] (f : W \u27f6 Y)\n (g : X \u27f6 Z) : biprod.inl \u226b biprod.map f g = f \u226b biprod.inl\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.BinaryBiproducts).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem biprod.inl_map {W X Y Z : C} [HasBinaryBiproduct W X] [HasBinaryBiproduct Y Z] (f : W \u27f6 Y)\n (g : X \u27f6 Z) : biprod.inl \u226b biprod.map f g = f \u226b biprod.inl\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/BinaryBiproducts.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.BinaryBiproducts", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.BinaryBiproducts.biprod", "span": "L612-L616", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/BinaryBiproducts.lean#L612"}, "environment": {}, "measurements": {"input_tokens": 188, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 591, "lean_code_chars": 162, "natural_language_chars": 429, "lean_code_ratio": 0.2741, "line_count": 8, "imports_count": 0, "declarations_count": 71, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "682939ff199206be", "near_duplicate_cluster_id": "", "triviality_score": 1.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.MeasureTheory.SetSemiring.pairwiseDisjoint_disjointOfUnion", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.SetSemiring)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma pairwiseDisjoint_disjointOfUnion (hC : IsSetSemiring C) (hJ : \u2191J \u2286 C) :\n PairwiseDisjoint J (hC.disjointOfUnion hJ)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.SetSemiring).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma pairwiseDisjoint_disjointOfUnion (hC : IsSetSemiring C) (hJ : \u2191J \u2286 C) :\n PairwiseDisjoint J (hC.disjointOfUnion hJ)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/SetSemiring.lean", "module": "Mathlib.MeasureTheory.SetSemiring", "declaration": "Mathlib.MeasureTheory.SetSemiring.pairwiseDisjoint_disjointOfUnion", "span": "L481-L484", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/SetSemiring.lean#L481"}, "environment": {}, "measurements": {"input_tokens": 158, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 534, "lean_code_chars": 125, "natural_language_chars": 409, "lean_code_ratio": 0.2341, "line_count": 8, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1b2c1f4580487313", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing.f_invApp_f_app", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem f_invApp_f_app (i j k : D.J) (U : Opens (D.V (i, j)).carrier) :\n (D.f_open i j).invApp _ U \u226b (D.f i k).c.app _ =\n (\u03c0\u2081 i, j, k).c.app (op U) \u226b\n (\u03c0\u2082\u207b\u00b9 i, j, k) (unop _) \u226b\n (D.V _).presheaf.map\n (eqToHom\n (by\n delta IsOpenImmersion.opensFunctor IsOpenEmbedding.functor\n dsimp only [Functor.op, IsOpenMap.functor, Opens.map, unop_op]\n congr\n apply pullback_base))\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem f_invApp_f_app (i j k : D.J) (U : Opens (D.V (i, j)).carrier) :\n (D.f_open i j).invApp _ U \u226b (D.f i k).c.app _ =\n (\u03c0\u2081 i, j, k).c.app (op U) \u226b\n (\u03c0\u2082\u207b\u00b9 i, j, k) (unop _) \u226b\n (D.V _).presheaf.map\n (eqToHom\n (by\n delta IsOpenImmersion.opensFunctor IsOpenEmbedding.functor\n dsimp only [Functor.op, IsOpenMap.functor, Opens.map, unop_op]\n congr\n apply pullback_base))\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/RingedSpace/PresheafedSpace/Gluing.lean", "module": "Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing", "declaration": "Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing.f_invApp_f_app", "span": "L147-L171", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/RingedSpace/PresheafedSpace/Gluing.lean#L147"}, "environment": {}, "measurements": {"input_tokens": 289, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 903, "lean_code_chars": 476, "natural_language_chars": 427, "lean_code_ratio": 0.5271, "line_count": 17, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "953325122094d807", "near_duplicate_cluster_id": "", "triviality_score": 0.1, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "A-Mathlib.CategoryTheory.Limits.Shapes.Pullback.Assoc.pullbackAssocIsPullback", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.Assoc)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef pullbackAssocIsPullback [HasPullback (g\u2082 \u226b f\u2083) f\u2084] :\n IsLimit\n (PullbackCone.mk (l\u2081 \u226b g\u2081) l\u2082\n (show (l\u2081 \u226b g\u2081) \u226b f\u2081 = l\u2082 \u226b g\u2083 \u226b f\u2082 by\n rw [pullback.lift_fst_assoc, Category.assoc, Category.assoc, pullback.condition]))\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.Assoc).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef pullbackAssocIsPullback [HasPullback (g\u2082 \u226b f\u2083) f\u2084] :\n IsLimit\n (PullbackCone.mk (l\u2081 \u226b g\u2081) l\u2082\n (show (l\u2081 \u226b g\u2081) \u226b f\u2081 = l\u2082 \u226b g\u2083 \u226b f\u2082 by\n rw [pullback.lift_fst_assoc, Category.assoc, Category.assoc, pullback.condition]))\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/Pullback/Assoc.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.Assoc", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.Assoc.pullbackAssocIsPullback", "span": "L114-L121", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Pullback/Assoc.lean#L114"}, "environment": {}, "measurements": {"input_tokens": 225, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 672, "lean_code_chars": 245, "natural_language_chars": 427, "lean_code_ratio": 0.3646, "line_count": 11, "imports_count": 0, "declarations_count": 70, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9b46b7c49a66a15d", "near_duplicate_cluster_id": "", "triviality_score": 1.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_coordChangeL", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem mdifferentiableAt_coordChangeL {x : B}\n (h : x \u2208 e.baseSet) (h' : x \u2208 e'.baseSet) :\n MDiffAt (fun b : B \u21a6 (e.coordChangeL \ud835\udd5c e' b : F \u2192L[\ud835\udd5c] F)) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableWithinAt_totalSpace (L42-L63)\ntheorem mdifferentiableWithinAt_totalSpace (f : M \u2192 TotalSpace F E) {s : Set M} {x\u2080 : M} :\n MDifferentiableWithinAt IM (IB.prod \ud835\udcd8(\ud835\udd5c, F)) f s x\u2080 \u2194\n MDiffAt[s] (fun x => (f x).proj) x\u2080 \u2227\n MDiffAt[s] (fun x \u21a6 (trivializationAt F E (f x\u2080).proj (f x)).2) x\u2080\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_totalSpace (L64-L71)\ntheorem mdifferentiableAt_totalSpace (f : M \u2192 TotalSpace F E) {x\u2080 : M} :\n MDifferentiableAt IM (IB.prod \ud835\udcd8(\ud835\udd5c, F)) f x\u2080 \u2194\n MDiffAt (fun x => (f x).proj) x\u2080 \u2227\n MDiffAt (fun x \u21a6 (trivializationAt F E (f x\u2080).proj (f x)).2) x\u2080\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableWithinAt_section (L72-L80)\ntheorem mdifferentiableWithinAt_section (s : \u03a0 b, E b) {u : Set B} {b\u2080 : B} :\n MDifferentiableWithinAt IB (IB.prod \ud835\udcd8(\ud835\udd5c, F)) (T% s) u b\u2080 \u2194\n MDiffAt[u] (fun b \u21a6 (trivializationAt F E b\u2080 (s b)).2) b\u2080\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_section (L81-L88)\ntheorem mdifferentiableAt_section (s : \u03a0 b, E b) {b\u2080 : B} :\n MDiffAt (T% s) b\u2080 \u2194 MDiffAt (fun b \u21a6 (trivializationAt F E b\u2080 (s b)).2) b\u2080\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiable_proj (L89-L93)\ntheorem mdifferentiable_proj : MDifferentiable (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableOn_proj (L94-L97)\ntheorem mdifferentiableOn_proj {s : Set (TotalSpace F E)} :\n MDifferentiableOn (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E) s\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_proj (L98-L101)\ntheorem mdifferentiableAt_proj {p : TotalSpace F E} :\n MDifferentiableAt (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E) p\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableWithinAt_proj (L102-L108)\ntheorem mdifferentiableWithinAt_proj {s : Set (TotalSpace F E)} {p : TotalSpace F E} :\n MDifferentiableWithinAt (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E) s p\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem mdifferentiableAt_coordChangeL {x : B}\n (h : x \u2208 e.baseSet) (h' : x \u2208 e'.baseSet) :\n MDiffAt (fun b : B \u21a6 (e.coordChangeL \ud835\udd5c e' b : F \u2192L[\ud835\udd5c] F)) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableWithinAt_totalSpace (L42-L63)\ntheorem mdifferentiableWithinAt_totalSpace (f : M \u2192 TotalSpace F E) {s : Set M} {x\u2080 : M} :\n MDifferentiableWithinAt IM (IB.prod \ud835\udcd8(\ud835\udd5c, F)) f s x\u2080 \u2194\n MDiffAt[s] (fun x => (f x).proj) x\u2080 \u2227\n MDiffAt[s] (fun x \u21a6 (trivializationAt F E (f x\u2080).proj (f x)).2) x\u2080\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_totalSpace (L64-L71)\ntheorem mdifferentiableAt_totalSpace (f : M \u2192 TotalSpace F E) {x\u2080 : M} :\n MDifferentiableAt IM (IB.prod \ud835\udcd8(\ud835\udd5c, F)) f x\u2080 \u2194\n MDiffAt (fun x => (f x).proj) x\u2080 \u2227\n MDiffAt (fun x \u21a6 (trivializationAt F E (f x\u2080).proj (f x)).2) x\u2080\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableWithinAt_section (L72-L80)\ntheorem mdifferentiableWithinAt_section (s : \u03a0 b, E b) {u : Set B} {b\u2080 : B} :\n MDifferentiableWithinAt IB (IB.prod \ud835\udcd8(\ud835\udd5c, F)) (T% s) u b\u2080 \u2194\n MDiffAt[u] (fun b \u21a6 (trivializationAt F E b\u2080 (s b)).2) b\u2080\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_section (L81-L88)\ntheorem mdifferentiableAt_section (s : \u03a0 b, E b) {b\u2080 : B} :\n MDiffAt (T% s) b\u2080 \u2194 MDiffAt (fun b \u21a6 (trivializationAt F E b\u2080 (s b)).2) b\u2080\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiable_proj (L89-L93)\ntheorem mdifferentiable_proj : MDifferentiable (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableOn_proj (L94-L97)\ntheorem mdifferentiableOn_proj {s : Set (TotalSpace F E)} :\n MDifferentiableOn (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E) s\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_proj (L98-L101)\ntheorem mdifferentiableAt_proj {p : TotalSpace F E} :\n MDifferentiableAt (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E) p\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableWithinAt_proj (L102-L108)\ntheorem mdifferentiableWithinAt_proj {s : Set (TotalSpace F E)} {p : TotalSpace F E} :\n MDifferentiableWithinAt (IB.prod \ud835\udcd8(\ud835\udd5c, F)) IB (\u03c0 F E) s p\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/VectorBundle/MDifferentiable.lean", "module": "Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable", "declaration": "Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable.mdifferentiableAt_coordChangeL", "span": "L147-L206", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/VectorBundle/MDifferentiable.lean#L147"}, "environment": {}, "measurements": {"input_tokens": 1574, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4061, "lean_code_chars": 3240, "natural_language_chars": 821, "lean_code_ratio": 0.7978, "line_count": 109, "imports_count": 0, "declarations_count": 379, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "335f08123de6f259", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Sites.Sieves.BindStruct", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Sites.Sieves)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma BindStruct.bind {S : Presieve X} {R : \u2200 \u2983Y\u2984 \u2983f : Y \u27f6 X\u2984, S f \u2192 Presieve Y}\n {Z : C} {h : Z \u27f6 X} (b : BindStruct S R h) : bind S R h\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.Presieve (L41-L44)\ndef Presieve (X : C)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.top_apply (L46-L48)\nlemma top_apply (f : Y \u27f6 X) : (\u22a4 : Presieve X) f\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.bot_apply (L50-L56)\nlemma bot_apply (f : Y \u27f6 X) : (\u22a5 : Presieve X) f \u2194 False\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.category (L57-L60)\nabbrev category {X : C} (P : Presieve X)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.categoryMk (L61-L66)\nabbrev categoryMk {X : C} (P : Presieve X) {Y : C} (f : Y \u27f6 X) (hf : P f) : P.category\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.diagram (L67-L71)\nabbrev diagram (S : Presieve X) : S.category \u2964 C\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.cocone (L72-L78)\nabbrev cocone (S : Presieve X) : Cocone S.diagram\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.bind (L79-L95)\ndef bind (S : Presieve X) (R : \u2200 \u2983Y\u2984 \u2983f : Y \u27f6 X\u2984, S f \u2192 Presieve Y) : Presieve X\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Sites.Abelian.presheafToSheaf_additive (L46-L51)\ninstance presheafToSheaf_additive : (presheafToSheaf J D).Additive\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.adjunction_counit_app_hom (L68-L74)\nlemma adjunction_counit_app_hom [HasWeakSheafify J D] [HasSheafCompose J F] (adj : G \u22a3 F)\n (Y : Sheaf J D) : ((adjunction J adj).counit.app Y).hom =\n sheafifyLift J (((adj.whiskerRight C\u1d52\u1d56).counit.app Y.obj)) Y.property\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.sheafForget (L35-L46)\nabbrev sheafForget {FD : D \u2192 D \u2192 Type*} {CD : D \u2192 Type*}\n [\u2200 X Y, FunLike (FD X Y) (CD X) (CD Y)] [ConcreteCategory D FD]\n [HasSheafCompose J (forget D)] : Sheaf J D \u2964 Sheaf J (Type _)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.adjunction_unit_app_hom (L54-L63)\nlemma adjunction_unit_app_hom [HasWeakSheafify J D] [HasSheafCompose J F] (adj : G \u22a3 F)\n (X : Sheaf J E) : ((adjunction J adj).unit.app X).hom =\n (adj.whiskerRight C\u1d52\u1d56).unit.app _ \u226b whiskerRight (toSheafify J (X.obj \u22d9 G)) F\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Sites.Abelian.sheafIsAbelian (L40-L43)\ninstance sheafIsAbelian : Abelian (Sheaf J D)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.adjunction (L47-L52)\ndef adjunction [HasWeakSheafify J D] [HasSheafCompose J F] (adj : G \u22a3 F) :\n composeAndSheafify J G \u22a3 sheafCompose J F\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Sites.Sieves).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma BindStruct.bind {S : Presieve X} {R : \u2200 \u2983Y\u2984 \u2983f : Y \u27f6 X\u2984, S f \u2192 Presieve Y}\n {Z : C} {h : Z \u27f6 X} (b : BindStruct S R h) : bind S R h\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.Presieve (L41-L44)\ndef Presieve (X : C)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.top_apply (L46-L48)\nlemma top_apply (f : Y \u27f6 X) : (\u22a4 : Presieve X) f\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.bot_apply (L50-L56)\nlemma bot_apply (f : Y \u27f6 X) : (\u22a5 : Presieve X) f \u2194 False\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.category (L57-L60)\nabbrev category {X : C} (P : Presieve X)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.categoryMk (L61-L66)\nabbrev categoryMk {X : C} (P : Presieve X) {Y : C} (f : Y \u27f6 X) (hf : P f) : P.category\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.diagram (L67-L71)\nabbrev diagram (S : Presieve X) : S.category \u2964 C\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.cocone (L72-L78)\nabbrev cocone (S : Presieve X) : Cocone S.diagram\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Sites.Sieves.bind (L79-L95)\ndef bind (S : Presieve X) (R : \u2200 \u2983Y\u2984 \u2983f : Y \u27f6 X\u2984, S f \u2192 Presieve Y) : Presieve X\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Sites.Abelian.presheafToSheaf_additive (L46-L51)\ninstance presheafToSheaf_additive : (presheafToSheaf J D).Additive\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.adjunction_counit_app_hom (L68-L74)\nlemma adjunction_counit_app_hom [HasWeakSheafify J D] [HasSheafCompose J F] (adj : G \u22a3 F)\n (Y : Sheaf J D) : ((adjunction J adj).counit.app Y).hom =\n sheafifyLift J (((adj.whiskerRight C\u1d52\u1d56).counit.app Y.obj)) Y.property\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.sheafForget (L35-L46)\nabbrev sheafForget {FD : D \u2192 D \u2192 Type*} {CD : D \u2192 Type*}\n [\u2200 X Y, FunLike (FD X Y) (CD X) (CD Y)] [ConcreteCategory D FD]\n [HasSheafCompose J (forget D)] : Sheaf J D \u2964 Sheaf J (Type _)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.adjunction_unit_app_hom (L54-L63)\nlemma adjunction_unit_app_hom [HasWeakSheafify J D] [HasSheafCompose J F] (adj : G \u22a3 F)\n (X : Sheaf J E) : ((adjunction J adj).unit.app X).hom =\n (adj.whiskerRight C\u1d52\u1d56).unit.app _ \u226b whiskerRight (toSheafify J (X.obj \u22d9 G)) F\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Sites.Abelian.sheafIsAbelian (L40-L43)\ninstance sheafIsAbelian : Abelian (Sheaf J D)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Sites.Adjunction.adjunction (L47-L52)\ndef adjunction [HasWeakSheafify J D] [HasSheafCompose J F] (adj : G \u22a3 F) :\n composeAndSheafify J G \u22a3 sheafCompose J F\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Sites/Sieves.lean", "module": "Mathlib.CategoryTheory.Sites.Sieves", "declaration": "Mathlib.CategoryTheory.Sites.Sieves.BindStruct", "span": "L106-L109", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Sites/Sieves.lean#L106"}, "environment": {}, "measurements": {"input_tokens": 1192, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3149, "lean_code_chars": 2347, "natural_language_chars": 802, "lean_code_ratio": 0.7453, "line_count": 99, "imports_count": 0, "declarations_count": 340, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "44af437534f1dfe8", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.reindex_base", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma reindex_base {\u03b9 : Type*} {X : C} {Y : \u03b9 \u2192 C} {f : \u2200 i, Y i \u27f6 X} (s : WidePullbackCone f)\n {\u03b9' : Type*} (e : \u03b9' \u2243 \u03b9) :\n (s.reindex e).base = s.base\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.WidePullbackShape (L40-L41)\ndef WidePullbackShape\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.WidePushoutShape (L46-L47)\ndef WidePushoutShape\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.struct (L66-L74)\ninstance struct : CategoryStruct (WidePullbackShape J) where\n Hom\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.Hom (L75-L81)\ninstance Hom.inhabited : Inhabited (Hom (none : WidePullbackShape J) none)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.evalCasesBash (L82-L86)\ndef evalCasesBash : TacticM Unit\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.subsingleton_hom (L89-L96)\ninstance subsingleton_hom : Quiver.IsThin (WidePullbackShape J)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.category (L97-L99)\ninstance category : SmallCategory (WidePullbackShape J)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.hom_id (L101-L108)\ntheorem hom_id (X : WidePullbackShape J) : Hom.id X = \ud835\udfd9 X\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma reindex_base {\u03b9 : Type*} {X : C} {Y : \u03b9 \u2192 C} {f : \u2200 i, Y i \u27f6 X} (s : WidePullbackCone f)\n {\u03b9' : Type*} (e : \u03b9' \u2243 \u03b9) :\n (s.reindex e).base = s.base\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.WidePullbackShape (L40-L41)\ndef WidePullbackShape\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.WidePushoutShape (L46-L47)\ndef WidePushoutShape\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.struct (L66-L74)\ninstance struct : CategoryStruct (WidePullbackShape J) where\n Hom\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.Hom (L75-L81)\ninstance Hom.inhabited : Inhabited (Hom (none : WidePullbackShape J) none)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.evalCasesBash (L82-L86)\ndef evalCasesBash : TacticM Unit\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.subsingleton_hom (L89-L96)\ninstance subsingleton_hom : Quiver.IsThin (WidePullbackShape J)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.category (L97-L99)\ninstance category : SmallCategory (WidePullbackShape J)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.hom_id (L101-L108)\ntheorem hom_id (X : WidePullbackShape J) : Hom.id X = \ud835\udfd9 X\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/WidePullbacks.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks.reindex_base", "span": "L467-L470", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/WidePullbacks.lean#L467"}, "environment": {}, "measurements": {"input_tokens": 970, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2824, "lean_code_chars": 2007, "natural_language_chars": 817, "lean_code_ratio": 0.7107, "line_count": 98, "imports_count": 0, "declarations_count": 246, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "f233bee48dbf9895", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_b\u2086_eq", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.EllipticCurve.Reduction)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma integralModel_b\u2086_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).b\u2086 = W.b\u2086\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.baseChange_integralModel_eq (L67-L70)\nlemma baseChange_integralModel_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n (integralModel R W).baseChange K = W\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.isIntegral_of_exists_lift (L71-L86)\nlemma isIntegral_of_exists_lift {W : WeierstrassCurve K}\n (h\u2081 : \u2203 r\u2081, (algebraMap R K) r\u2081 = W.a\u2081)\n (h\u2082 : \u2203 r\u2082, (algebraMap R K) r\u2082 = W.a\u2082)\n (h\u2083 : \u2203 r\u2083, (algebraMap R K) r\u2083 = W.a\u2083)\n (h\u2084 : \u2203 r\u2084, (algebraMap R K) r\u2084 = W.a\u2084)\n (h\u2086 : \u2203 r\u2086, (algebraMap R K) r\u2086 = W.a\u2086) :\n IsIntegral R W\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.\u0394_integral_of_isIntegral (L87-L93)\nlemma \u0394_integral_of_isIntegral (W : WeierstrassCurve K) [IsIntegral R W] :\n \u2203 r : R, algebraMap R K r = W.\u0394\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2081_eq (L94-L98)\nlemma integralModel_a\u2081_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2081 = W.a\u2081\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2082_eq (L99-L103)\nlemma integralModel_a\u2082_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2082 = W.a\u2082\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2083_eq (L104-L108)\nlemma integralModel_a\u2083_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2083 = W.a\u2083\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2084_eq (L109-L113)\nlemma integralModel_a\u2084_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2084 = W.a\u2084\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2086_eq (L114-L118)\nlemma integralModel_a\u2086_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2086 = W.a\u2086\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.toAffine (L78-L97)\nabbrev toAffine (W : WeierstrassCurve R) : Affine R\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Affine (L74-L77)\nabbrev Affine : Type r\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_eq (L98-L104)\nlemma polynomial_eq : W.polynomial = Cubic.toPoly\n \u27e80, 1, Cubic.toPoly \u27e80, 0, W.a\u2081, W.a\u2083\u27e9, Cubic.toPoly \u27e8-1, -W.a\u2082, -W.a\u2084, -W.a\u2086\u27e9\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.natDegree_polynomial (L115-L118)\nlemma natDegree_polynomial [Nontrivial R] : W.polynomial.natDegree = 2\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_ne_zero (L105-L108)\nlemma polynomial_ne_zero [Nontrivial R] : W.polynomial \u2260 0\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.degree_polynomial (L110-L113)\nlemma degree_polynomial [Nontrivial R] : W.polynomial.degree = 2\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.EllipticCurve.Reduction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma integralModel_b\u2086_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).b\u2086 = W.b\u2086\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.baseChange_integralModel_eq (L67-L70)\nlemma baseChange_integralModel_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n (integralModel R W).baseChange K = W\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.isIntegral_of_exists_lift (L71-L86)\nlemma isIntegral_of_exists_lift {W : WeierstrassCurve K}\n (h\u2081 : \u2203 r\u2081, (algebraMap R K) r\u2081 = W.a\u2081)\n (h\u2082 : \u2203 r\u2082, (algebraMap R K) r\u2082 = W.a\u2082)\n (h\u2083 : \u2203 r\u2083, (algebraMap R K) r\u2083 = W.a\u2083)\n (h\u2084 : \u2203 r\u2084, (algebraMap R K) r\u2084 = W.a\u2084)\n (h\u2086 : \u2203 r\u2086, (algebraMap R K) r\u2086 = W.a\u2086) :\n IsIntegral R W\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.\u0394_integral_of_isIntegral (L87-L93)\nlemma \u0394_integral_of_isIntegral (W : WeierstrassCurve K) [IsIntegral R W] :\n \u2203 r : R, algebraMap R K r = W.\u0394\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2081_eq (L94-L98)\nlemma integralModel_a\u2081_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2081 = W.a\u2081\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2082_eq (L99-L103)\nlemma integralModel_a\u2082_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2082 = W.a\u2082\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2083_eq (L104-L108)\nlemma integralModel_a\u2083_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2083 = W.a\u2083\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2084_eq (L109-L113)\nlemma integralModel_a\u2084_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2084 = W.a\u2084\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_a\u2086_eq (L114-L118)\nlemma integralModel_a\u2086_eq (W : WeierstrassCurve K) [hW : IsIntegral R W] :\n algebraMap R K (integralModel R W).a\u2086 = W.a\u2086\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.toAffine (L78-L97)\nabbrev toAffine (W : WeierstrassCurve R) : Affine R\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Affine (L74-L77)\nabbrev Affine : Type r\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_eq (L98-L104)\nlemma polynomial_eq : W.polynomial = Cubic.toPoly\n \u27e80, 1, Cubic.toPoly \u27e80, 0, W.a\u2081, W.a\u2083\u27e9, Cubic.toPoly \u27e8-1, -W.a\u2082, -W.a\u2084, -W.a\u2086\u27e9\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.natDegree_polynomial (L115-L118)\nlemma natDegree_polynomial [Nontrivial R] : W.polynomial.natDegree = 2\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_ne_zero (L105-L108)\nlemma polynomial_ne_zero [Nontrivial R] : W.polynomial \u2260 0\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.degree_polynomial (L110-L113)\nlemma degree_polynomial [Nontrivial R] : W.polynomial.degree = 2\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/AlgebraicGeometry/EllipticCurve/Reduction.lean", "module": "Mathlib.AlgebraicGeometry.EllipticCurve.Reduction", "declaration": "Mathlib.AlgebraicGeometry.EllipticCurve.Reduction.integralModel_b\u2086_eq", "span": "L129-L133", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/EllipticCurve/Reduction.lean#L129"}, "environment": {}, "measurements": {"input_tokens": 1405, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3678, "lean_code_chars": 2862, "natural_language_chars": 816, "lean_code_ratio": 0.7781, "line_count": 106, "imports_count": 0, "declarations_count": 341, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "da98047ffd5735ec", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.FieldTheory.RatFunc.AsPolynomial.X", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.RatFunc.AsPolynomial)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef X : K\u27eeX\u27ef\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.C (L51-L52)\ndef C : K \u2192+* K\u27eeX\u27ef\n```\n\n-- snippet 2\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_eq_C (L54-L56)\ntheorem algebraMap_eq_C : algebraMap K K\u27eeX\u27ef = C\n```\n\n-- snippet 3\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_C (L58-L60)\ntheorem algebraMap_C (a : K) : algebraMap K[X] K\u27eeX\u27ef (Polynomial.C a) = C a\n```\n\n-- snippet 4\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_comp_C (L62-L64)\ntheorem algebraMap_comp_C : (algebraMap K[X] K\u27eeX\u27ef).comp Polynomial.C = C\n```\n\n-- snippet 5\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.smul_eq_C_mul (L65-L67)\ntheorem smul_eq_C_mul (r : K) (x : K\u27eeX\u27ef) : r \u2022 x = C r * x\n```\n\n-- snippet 6\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.C_injective (L68-L72)\ntheorem C_injective : Function.Injective (RatFunc.C (K\n```\n\n-- snippet 7\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_X (L77-L79)\ntheorem algebraMap_X : algebraMap K[X] K\u27eeX\u27ef Polynomial.X = X\n```\n\n-- snippet 8\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_monomial (L81-L84)\ntheorem algebraMap_monomial (n : \u2115) (a : K) :\n algebraMap K[X] K\u27eeX\u27ef (Polynomial.monomial n a) = C a * X ^ n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_zero (L73-L79)\ntheorem ofFractionRing_zero : (ofFractionRing 0 : K\u27eeX\u27ef) = 0\n```\n\n-- snippet 10\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_neg (L105-L112)\ntheorem ofFractionRing_neg (p : FractionRing K[X]) :\n ofFractionRing (-p) = -ofFractionRing p\n```\n\n-- snippet 11\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_one (L116-L122)\ntheorem ofFractionRing_one : (ofFractionRing 1 : K\u27eeX\u27ef) = 1\n```\n\n-- snippet 12\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_mul (L126-L137)\ntheorem ofFractionRing_mul (p q : FractionRing K[X]) :\n ofFractionRing (p * q) = ofFractionRing p * ofFractionRing q\n```\n\n-- snippet 13\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_sub (L94-L101)\ntheorem ofFractionRing_sub (p q : FractionRing K[X]) :\n ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q\n```\n\n-- snippet 14\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_add (L83-L90)\ntheorem ofFractionRing_add (p q : FractionRing K[X]) :\n ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.RatFunc.AsPolynomial).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef X : K\u27eeX\u27ef\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.C (L51-L52)\ndef C : K \u2192+* K\u27eeX\u27ef\n```\n\n-- snippet 2\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_eq_C (L54-L56)\ntheorem algebraMap_eq_C : algebraMap K K\u27eeX\u27ef = C\n```\n\n-- snippet 3\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_C (L58-L60)\ntheorem algebraMap_C (a : K) : algebraMap K[X] K\u27eeX\u27ef (Polynomial.C a) = C a\n```\n\n-- snippet 4\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_comp_C (L62-L64)\ntheorem algebraMap_comp_C : (algebraMap K[X] K\u27eeX\u27ef).comp Polynomial.C = C\n```\n\n-- snippet 5\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.smul_eq_C_mul (L65-L67)\ntheorem smul_eq_C_mul (r : K) (x : K\u27eeX\u27ef) : r \u2022 x = C r * x\n```\n\n-- snippet 6\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.C_injective (L68-L72)\ntheorem C_injective : Function.Injective (RatFunc.C (K\n```\n\n-- snippet 7\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_X (L77-L79)\ntheorem algebraMap_X : algebraMap K[X] K\u27eeX\u27ef Polynomial.X = X\n```\n\n-- snippet 8\n```lean\n-- Mathlib.FieldTheory.RatFunc.AsPolynomial.algebraMap_monomial (L81-L84)\ntheorem algebraMap_monomial (n : \u2115) (a : K) :\n algebraMap K[X] K\u27eeX\u27ef (Polynomial.monomial n a) = C a * X ^ n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_zero (L73-L79)\ntheorem ofFractionRing_zero : (ofFractionRing 0 : K\u27eeX\u27ef) = 0\n```\n\n-- snippet 10\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_neg (L105-L112)\ntheorem ofFractionRing_neg (p : FractionRing K[X]) :\n ofFractionRing (-p) = -ofFractionRing p\n```\n\n-- snippet 11\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_one (L116-L122)\ntheorem ofFractionRing_one : (ofFractionRing 1 : K\u27eeX\u27ef) = 1\n```\n\n-- snippet 12\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_mul (L126-L137)\ntheorem ofFractionRing_mul (p q : FractionRing K[X]) :\n ofFractionRing (p * q) = ofFractionRing p * ofFractionRing q\n```\n\n-- snippet 13\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_sub (L94-L101)\ntheorem ofFractionRing_sub (p q : FractionRing K[X]) :\n ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q\n```\n\n-- snippet 14\n```lean\n-- Mathlib.FieldTheory.RatFunc.Basic.ofFractionRing_add (L83-L90)\ntheorem ofFractionRing_add (p q : FractionRing K[X]) :\n ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/RatFunc/AsPolynomial.lean", "module": "Mathlib.FieldTheory.RatFunc.AsPolynomial", "declaration": "Mathlib.FieldTheory.RatFunc.AsPolynomial.X", "span": "L73-L75", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/RatFunc/AsPolynomial.lean#L73"}, "environment": {}, "measurements": {"input_tokens": 1031, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2841, "lean_code_chars": 2034, "natural_language_chars": 807, "lean_code_ratio": 0.7159, "line_count": 96, "imports_count": 0, "declarations_count": 261, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "7edde76f7feaf84f", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Bicategory.EqToHom)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef eqToHomTransIso {x y z : B} (e\u2081 : x = y) (e\u2082 : y = z) :\n eqToHom (e\u2081.trans e\u2082) \u2245 eqToHom e\u2081 \u226b eqToHom e\u2082\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso_refl_refl (L52-L55)\nlemma eqToHomTransIso_refl_refl (x : B) :\n eqToHomTransIso (rfl : x = x) rfl = (\u03bb_ (\ud835\udfd9 x)).symm\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso_refl_right (L56-L61)\nlemma eqToHomTransIso_refl_right {x y : B} (e\u2081 : x = y) :\n eqToHomTransIso e\u2081 rfl = (\u03c1_ (eqToHom e\u2081)).symm\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso_refl_left (L62-L67)\nlemma eqToHomTransIso_refl_left {x y : B} (e\u2081 : x = y) :\n eqToHomTransIso rfl e\u2081 = (\u03bb_ (eqToHom e\u2081)).symm\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_eqToHom_hom (L69-L78)\nlemma associator_eqToHom_hom {x y z t : B}\n (e\u2081 : x = y) (e\u2082 : y = z) (e\u2083 : z = t) :\n (\u03b1_ (eqToHom e\u2081) (eqToHom e\u2082) (eqToHom e\u2083)).hom =\n (eqToHomTransIso e\u2081 e\u2082).inv \u25b7 eqToHom e\u2083 \u226b\n (eqToHomTransIso (e\u2081.trans e\u2082) e\u2083).inv \u226b\n (eqToHomTransIso e\u2081 (e\u2082.trans e\u2083)).hom \u226b\n eqToHom e\u2081 \u25c1 (eqToHomTransIso e\u2082 e\u2083).hom\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_eqToHom_inv (L80-L89)\nlemma associator_eqToHom_inv {x y z t : B}\n (e\u2081 : x = y) (e\u2082 : y = z) (e\u2083 : z = t) :\n (\u03b1_ (eqToHom e\u2081) (eqToHom e\u2082) (eqToHom e\u2083)).inv =\n eqToHom e\u2081 \u25c1 (eqToHomTransIso e\u2082 e\u2083).inv \u226b\n (eqToHomTransIso e\u2081 (e\u2082.trans e\u2083)).inv \u226b\n (eqToHomTransIso (e\u2081.trans e\u2082) e\u2083).hom \u226b\n (eqToHomTransIso e\u2081 e\u2082).hom \u25b7 eqToHom e\u2083\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_hom_congr (L90-L96)\nlemma associator_hom_congr {x y z t : B} {f f' : x \u27f6 y} {g g' : y \u27f6 z}\n {h h' : z \u27f6 t} (ef : f = f') (eg : g = g') (eh : h = h') :\n (\u03b1_ f g h).hom =\n eqToHom (by grind) \u226b (\u03b1_ f' g' h').hom \u226b eqToHom (by grind)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_inv_congr (L97-L103)\nlemma associator_inv_congr {x y z t : B} {f f' : x \u27f6 y} {g g' : y \u27f6 z}\n {h h' : z \u27f6 t} (ef : f = f') (eg : g = g') (eh : h = h') :\n (\u03b1_ f g h).inv =\n eqToHom (by grind) \u226b (\u03b1_ f' g' h').inv \u226b eqToHom (by grind)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.congr_whiskerLeft (L104-L109)\nlemma congr_whiskerLeft {x y : B} {f f' : x \u27f6 y} (h : f = f') {z : B}\n {g g' : y \u27f6 z} (\u03b7 : g \u27f6 g') :\n f \u25c1 \u03b7 = eqToHom (by rw [h]) \u226b f' \u25c1 \u03b7 \u226b eqToHom (by rw [h])\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.iso\u2082Mk (L118-L134)\ndef iso\u2082Mk {\u03b1 \u03b2 : a \u27f6 b} (el : \u03b1.l \u2245 \u03b2.l) (er : \u03b2.r \u2245 \u03b1.r)\n (h : conjugateEquiv \u03b2.adj \u03b1.adj el.hom = er.hom\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.hom\u2082_ext (L111-L113)\nlemma hom\u2082_ext {\u03b1 \u03b2 : a \u27f6 b} {x y : \u03b1 \u27f6 \u03b2} (hl : x.\u03c4l = y.\u03c4l) : x = y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.associator (L136-L139)\ndef associator (\u03b1 : a \u27f6 b) (\u03b2 : b \u27f6 c) (\u03b3 : c \u27f6 d) : (\u03b1 \u226b \u03b2) \u226b \u03b3 \u2245 \u03b1 \u226b \u03b2 \u226b \u03b3\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.Hom\u2082 (L91-L94)\nlemma Hom\u2082.conjugateEquiv_symm_\u03c4r {\u03b1 \u03b2 : a \u27f6 b} (p : Hom\u2082 \u03b1 \u03b2) :\n (conjugateEquiv \u03b2.adj \u03b1.adj).symm p.\u03c4r = p.\u03c4l\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.rightUnitor (L147-L151)\ndef rightUnitor (\u03b1 : a \u27f6 b) : \u03b1 \u226b \ud835\udfd9 b \u2245 \u03b1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.leftUnitor (L141-L145)\ndef leftUnitor (\u03b1 : a \u27f6 b) : \ud835\udfd9 a \u226b \u03b1 \u2245 \u03b1\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Bicategory.EqToHom).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef eqToHomTransIso {x y z : B} (e\u2081 : x = y) (e\u2082 : y = z) :\n eqToHom (e\u2081.trans e\u2082) \u2245 eqToHom e\u2081 \u226b eqToHom e\u2082\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso_refl_refl (L52-L55)\nlemma eqToHomTransIso_refl_refl (x : B) :\n eqToHomTransIso (rfl : x = x) rfl = (\u03bb_ (\ud835\udfd9 x)).symm\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso_refl_right (L56-L61)\nlemma eqToHomTransIso_refl_right {x y : B} (e\u2081 : x = y) :\n eqToHomTransIso e\u2081 rfl = (\u03c1_ (eqToHom e\u2081)).symm\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso_refl_left (L62-L67)\nlemma eqToHomTransIso_refl_left {x y : B} (e\u2081 : x = y) :\n eqToHomTransIso rfl e\u2081 = (\u03bb_ (eqToHom e\u2081)).symm\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_eqToHom_hom (L69-L78)\nlemma associator_eqToHom_hom {x y z t : B}\n (e\u2081 : x = y) (e\u2082 : y = z) (e\u2083 : z = t) :\n (\u03b1_ (eqToHom e\u2081) (eqToHom e\u2082) (eqToHom e\u2083)).hom =\n (eqToHomTransIso e\u2081 e\u2082).inv \u25b7 eqToHom e\u2083 \u226b\n (eqToHomTransIso (e\u2081.trans e\u2082) e\u2083).inv \u226b\n (eqToHomTransIso e\u2081 (e\u2082.trans e\u2083)).hom \u226b\n eqToHom e\u2081 \u25c1 (eqToHomTransIso e\u2082 e\u2083).hom\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_eqToHom_inv (L80-L89)\nlemma associator_eqToHom_inv {x y z t : B}\n (e\u2081 : x = y) (e\u2082 : y = z) (e\u2083 : z = t) :\n (\u03b1_ (eqToHom e\u2081) (eqToHom e\u2082) (eqToHom e\u2083)).inv =\n eqToHom e\u2081 \u25c1 (eqToHomTransIso e\u2082 e\u2083).inv \u226b\n (eqToHomTransIso e\u2081 (e\u2082.trans e\u2083)).inv \u226b\n (eqToHomTransIso (e\u2081.trans e\u2082) e\u2083).hom \u226b\n (eqToHomTransIso e\u2081 e\u2082).hom \u25b7 eqToHom e\u2083\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_hom_congr (L90-L96)\nlemma associator_hom_congr {x y z t : B} {f f' : x \u27f6 y} {g g' : y \u27f6 z}\n {h h' : z \u27f6 t} (ef : f = f') (eg : g = g') (eh : h = h') :\n (\u03b1_ f g h).hom =\n eqToHom (by grind) \u226b (\u03b1_ f' g' h').hom \u226b eqToHom (by grind)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.associator_inv_congr (L97-L103)\nlemma associator_inv_congr {x y z t : B} {f f' : x \u27f6 y} {g g' : y \u27f6 z}\n {h h' : z \u27f6 t} (ef : f = f') (eg : g = g') (eh : h = h') :\n (\u03b1_ f g h).inv =\n eqToHom (by grind) \u226b (\u03b1_ f' g' h').inv \u226b eqToHom (by grind)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Bicategory.EqToHom.congr_whiskerLeft (L104-L109)\nlemma congr_whiskerLeft {x y : B} {f f' : x \u27f6 y} (h : f = f') {z : B}\n {g g' : y \u27f6 z} (\u03b7 : g \u27f6 g') :\n f \u25c1 \u03b7 = eqToHom (by rw [h]) \u226b f' \u25c1 \u03b7 \u226b eqToHom (by rw [h])\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.iso\u2082Mk (L118-L134)\ndef iso\u2082Mk {\u03b1 \u03b2 : a \u27f6 b} (el : \u03b1.l \u2245 \u03b2.l) (er : \u03b2.r \u2245 \u03b1.r)\n (h : conjugateEquiv \u03b2.adj \u03b1.adj el.hom = er.hom\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.hom\u2082_ext (L111-L113)\nlemma hom\u2082_ext {\u03b1 \u03b2 : a \u27f6 b} {x y : \u03b1 \u27f6 \u03b2} (hl : x.\u03c4l = y.\u03c4l) : x = y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.associator (L136-L139)\ndef associator (\u03b1 : a \u27f6 b) (\u03b2 : b \u27f6 c) (\u03b3 : c \u27f6 d) : (\u03b1 \u226b \u03b2) \u226b \u03b3 \u2245 \u03b1 \u226b \u03b2 \u226b \u03b3\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.Hom\u2082 (L91-L94)\nlemma Hom\u2082.conjugateEquiv_symm_\u03c4r {\u03b1 \u03b2 : a \u27f6 b} (p : Hom\u2082 \u03b1 \u03b2) :\n (conjugateEquiv \u03b2.adj \u03b1.adj).symm p.\u03c4r = p.\u03c4l\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.rightUnitor (L147-L151)\ndef rightUnitor (\u03b1 : a \u27f6 b) : \u03b1 \u226b \ud835\udfd9 b \u2245 \u03b1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Bicategory.Adjunction.Adj.leftUnitor (L141-L145)\ndef leftUnitor (\u03b1 : a \u27f6 b) : \ud835\udfd9 a \u226b \u03b1 \u2245 \u03b1\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Bicategory/EqToHom.lean", "module": "Mathlib.CategoryTheory.Bicategory.EqToHom", "declaration": "Mathlib.CategoryTheory.Bicategory.EqToHom.eqToHomTransIso", "span": "L47-L50", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Bicategory/EqToHom.lean#L47"}, "environment": {}, "measurements": {"input_tokens": 1755, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4025, "lean_code_chars": 3217, "natural_language_chars": 808, "lean_code_ratio": 0.7993, "line_count": 117, "imports_count": 0, "declarations_count": 460, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "0a22cff82de79142", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Yoneda.uliftCoyonedaEquiv_symm_map", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Yoneda)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma uliftCoyonedaEquiv_symm_map {X Y : C} (f : X \u27f6 Y) {F : C \u2964 Type max w v\u2081}\n (t : F.obj X) :\n uliftCoyonedaEquiv.{w}.symm (F.map f t) =\n uliftCoyoneda.map f.op \u226b uliftCoyonedaEquiv.symm t\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Yoneda.yoneda (L44-L52)\ndef yoneda : C \u2964 C\u1d52\u1d56 \u2964 Type v\u2081 where\n obj X :=\n{ obj := fun Y => unop Y \u27f6 X\n map := fun f g => f.unop \u226b g }\n map f :=\n { app := fun _ g => g \u226b f }\n\n/-- Variant of the Yoneda embedding which allows a raise in the universe level\nfor the category of types. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYoneda (L54-L56)\ndef uliftYoneda : C \u2964 C\u1d52\u1d56 \u2964 Type (max w v\u2081) :=\nyoneda \u22d9 (whiskeringRight _ _ _).obj uliftFunctor.{w}\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYoneda_obj_map_down (L58-L61)\nlemma uliftYoneda_obj_map_down (X : C) {Y Z : C\u1d52\u1d56} (f : Y \u27f6 Z) (a : (uliftYoneda.{w}.obj X).obj Y) :\n ((uliftYoneda.{w}.obj X).map f a).down = f.unop \u226b a.down :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYoneda_map_app_down (L63-L68)\nlemma uliftYoneda_map_app_down {X Y : C} (f : X \u27f6 Y) (Z : C\u1d52\u1d56) (a : (uliftYoneda.{w}.obj X).obj Z) :\n ((uliftYoneda.{w}.map f).app Z a).down = a.down \u226b f :=\nrfl\n\n/-- If `C` is a category with `[Category.{max w v\u2081} C]`, this is the isomorphism\n`uliftYoneda.{w} (C := C) \u2245 yoneda`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYonedaIsoYoneda (L70-L75)\ndef uliftYonedaIsoYoneda {C : Type u\u2081} [Category.{max w v\u2081} C] :\n uliftYoneda.{w} (C := C) \u2245 yoneda :=\nNatIso.ofComponents (fun _ \u21a6 NatIso.ofComponents (fun _ \u21a6 Equiv.ulift.toIso))\n\n/-- The co-Yoneda embedding, as a functor from `C\u1d52\u1d56` into co-presheaves on `C`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Yoneda.coyoneda (L76-L79)\nabbrev coyoneda : C\u1d52\u1d56 \u2964 C \u2964 Type v\u2081 := yoneda.flip\n/-- Variant of the Coyoneda embedding which allows a raise in the universe level\nfor the category of types. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftCoyoneda (L81-L84)\nabbrev uliftCoyoneda : C\u1d52\u1d56 \u2964 C \u2964 Type (max w v\u2081) := uliftYoneda.{w}.flip\n/-- If `C` is a category with `[Category.{max w v\u2081} C]`, this is the isomorphism\n`uliftCoyoneda.{w} (C := C) \u2245 coyoneda`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftCoyonedaIsoCoyoneda (L86-L91)\ndef uliftCoyonedaIsoCoyoneda {C : Type u\u2081} [Category.{max w v\u2081} C] :\n uliftCoyoneda.{w} (C := C) \u2245 coyoneda :=\nNatIso.ofComponents (fun _ \u21a6 NatIso.ofComponents (fun _ \u21a6 Equiv.ulift.toIso))\n\nnamespace Yoneda\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Yoneda.obj_map_id (L92-L95)\ntheorem obj_map_id {X Y : C} (f : op X \u27f6 op Y) :\n (yoneda.obj X).map f (\ud835\udfd9 X) = (yoneda.map f.unop).app (op Y) (\ud835\udfd9 Y) := by\nsimp\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Yoneda.naturality (L97-L101)\ntheorem naturality {X Y : C} (\u03b1 : yoneda.obj X \u27f6 yoneda.obj Y) {Z Z' : C} (f : Z \u27f6 Z')\n (h : Z' \u27f6 X) : f \u226b \u03b1.app (op Z') h = \u03b1.app (op Z) (f \u226b h) :=\n(FunctorToTypes.naturality _ _ \u03b1 f.op h).symm\n\n/-- The Yoneda embedding is fully faithful. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Yoneda.fullyFaithful (L102-L104)\ndef fullyFaithful : (yoneda (C := C)).FullyFaithful where\npreimage f := f.app _ (\ud835\udfd9 _)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Yoneda.fullyFaithful_preimage (L105-L108)\nlemma fullyFaithful_preimage {X Y : C} (f : yoneda.obj X \u27f6 yoneda.obj Y) :\n fullyFaithful.preimage f = f.app (op X) (\ud835\udfd9 X) := rfl\n/-- The Yoneda embedding is full. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Yoneda.yoneda_full (L110-L113)\ninstance yoneda_full : (yoneda : C \u2964 C\u1d52\u1d56 \u2964 Type v\u2081).Full :=\nfullyFaithful.full\n\n/-- The Yoneda embedding is faithful. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Yoneda.yoneda_faithful (L115-L125)\ninstance yoneda_faithful : (yoneda : C \u2964 C\u1d52\u1d56 \u2964 Type v\u2081).Faithful :=\nfullyFaithful.faithful\n\n/-- Extensionality via Yoneda. The typical usage would be\n```\n-- Goal is `X \u2245 Y`\napply Yoneda.ext\n-- Goals are now functions `(Z \u27f6 X) \u2192 (Z \u27f6 Y)`, `(Z \u27f6 Y) \u2192 (Z \u27f6 X)`, and the fact that these\n-- functions are inverses and natural in `Z`.\n```\n-/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Yoneda.ext (L126-L136)\ndef ext (X Y : C) (p : \u2200 {Z : C}, (Z \u27f6 X) \u2192 (Z \u27f6 Y))\n (q : \u2200 {Z : C}, (Z \u27f6 Y) \u2192 (Z \u27f6 X))\n (h\u2081 : \u2200 {Z : C} (f : Z \u27f6 X), q (p f) = f) (h\u2082 : \u2200 {Z : C} (f : Z \u27f6 Y), p (q f) = f)\n (n : \u2200 {Z Z' : C} (f : Z' \u27f6 Z) (g : Z \u27f6 X), p (f \u226b g) = f \u226b p g) : X \u2245 Y :=\nfullyFaithful.preimageIso\n (NatIso.ofComponents fun Z =>\n { hom := p\n inv := q })\n\n/-- If `yoneda.map f` is an isomorphism, so was `f`.\n-/\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Yoneda).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma uliftCoyonedaEquiv_symm_map {X Y : C} (f : X \u27f6 Y) {F : C \u2964 Type max w v\u2081}\n (t : F.obj X) :\n uliftCoyonedaEquiv.{w}.symm (F.map f t) =\n uliftCoyoneda.map f.op \u226b uliftCoyonedaEquiv.symm t\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Yoneda.yoneda (L44-L52)\ndef yoneda : C \u2964 C\u1d52\u1d56 \u2964 Type v\u2081 where\n obj X :=\n{ obj := fun Y => unop Y \u27f6 X\n map := fun f g => f.unop \u226b g }\n map f :=\n { app := fun _ g => g \u226b f }\n\n/-- Variant of the Yoneda embedding which allows a raise in the universe level\nfor the category of types. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYoneda (L54-L56)\ndef uliftYoneda : C \u2964 C\u1d52\u1d56 \u2964 Type (max w v\u2081) :=\nyoneda \u22d9 (whiskeringRight _ _ _).obj uliftFunctor.{w}\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYoneda_obj_map_down (L58-L61)\nlemma uliftYoneda_obj_map_down (X : C) {Y Z : C\u1d52\u1d56} (f : Y \u27f6 Z) (a : (uliftYoneda.{w}.obj X).obj Y) :\n ((uliftYoneda.{w}.obj X).map f a).down = f.unop \u226b a.down :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYoneda_map_app_down (L63-L68)\nlemma uliftYoneda_map_app_down {X Y : C} (f : X \u27f6 Y) (Z : C\u1d52\u1d56) (a : (uliftYoneda.{w}.obj X).obj Z) :\n ((uliftYoneda.{w}.map f).app Z a).down = a.down \u226b f :=\nrfl\n\n/-- If `C` is a category with `[Category.{max w v\u2081} C]`, this is the isomorphism\n`uliftYoneda.{w} (C := C) \u2245 yoneda`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftYonedaIsoYoneda (L70-L75)\ndef uliftYonedaIsoYoneda {C : Type u\u2081} [Category.{max w v\u2081} C] :\n uliftYoneda.{w} (C := C) \u2245 yoneda :=\nNatIso.ofComponents (fun _ \u21a6 NatIso.ofComponents (fun _ \u21a6 Equiv.ulift.toIso))\n\n/-- The co-Yoneda embedding, as a functor from `C\u1d52\u1d56` into co-presheaves on `C`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Yoneda.coyoneda (L76-L79)\nabbrev coyoneda : C\u1d52\u1d56 \u2964 C \u2964 Type v\u2081 := yoneda.flip\n/-- Variant of the Coyoneda embedding which allows a raise in the universe level\nfor the category of types. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftCoyoneda (L81-L84)\nabbrev uliftCoyoneda : C\u1d52\u1d56 \u2964 C \u2964 Type (max w v\u2081) := uliftYoneda.{w}.flip\n/-- If `C` is a category with `[Category.{max w v\u2081} C]`, this is the isomorphism\n`uliftCoyoneda.{w} (C := C) \u2245 coyoneda`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Yoneda.uliftCoyonedaIsoCoyoneda (L86-L91)\ndef uliftCoyonedaIsoCoyoneda {C : Type u\u2081} [Category.{max w v\u2081} C] :\n uliftCoyoneda.{w} (C := C) \u2245 coyoneda :=\nNatIso.ofComponents (fun _ \u21a6 NatIso.ofComponents (fun _ \u21a6 Equiv.ulift.toIso))\n\nnamespace Yoneda\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Yoneda.obj_map_id (L92-L95)\ntheorem obj_map_id {X Y : C} (f : op X \u27f6 op Y) :\n (yoneda.obj X).map f (\ud835\udfd9 X) = (yoneda.map f.unop).app (op Y) (\ud835\udfd9 Y) := by\nsimp\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Yoneda.naturality (L97-L101)\ntheorem naturality {X Y : C} (\u03b1 : yoneda.obj X \u27f6 yoneda.obj Y) {Z Z' : C} (f : Z \u27f6 Z')\n (h : Z' \u27f6 X) : f \u226b \u03b1.app (op Z') h = \u03b1.app (op Z) (f \u226b h) :=\n(FunctorToTypes.naturality _ _ \u03b1 f.op h).symm\n\n/-- The Yoneda embedding is fully faithful. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Yoneda.fullyFaithful (L102-L104)\ndef fullyFaithful : (yoneda (C := C)).FullyFaithful where\npreimage f := f.app _ (\ud835\udfd9 _)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Yoneda.fullyFaithful_preimage (L105-L108)\nlemma fullyFaithful_preimage {X Y : C} (f : yoneda.obj X \u27f6 yoneda.obj Y) :\n fullyFaithful.preimage f = f.app (op X) (\ud835\udfd9 X) := rfl\n/-- The Yoneda embedding is full. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Yoneda.yoneda_full (L110-L113)\ninstance yoneda_full : (yoneda : C \u2964 C\u1d52\u1d56 \u2964 Type v\u2081).Full :=\nfullyFaithful.full\n\n/-- The Yoneda embedding is faithful. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Yoneda.yoneda_faithful (L115-L125)\ninstance yoneda_faithful : (yoneda : C \u2964 C\u1d52\u1d56 \u2964 Type v\u2081).Faithful :=\nfullyFaithful.faithful\n\n/-- Extensionality via Yoneda. The typical usage would be\n```\n-- Goal is `X \u2245 Y`\napply Yoneda.ext\n-- Goals are now functions `(Z \u27f6 X) \u2192 (Z \u27f6 Y)`, `(Z \u27f6 Y) \u2192 (Z \u27f6 X)`, and the fact that these\n-- functions are inverses and natural in `Z`.\n```\n-/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Yoneda.ext (L126-L136)\ndef ext (X Y : C) (p : \u2200 {Z : C}, (Z \u27f6 X) \u2192 (Z \u27f6 Y))\n (q : \u2200 {Z : C}, (Z \u27f6 Y) \u2192 (Z \u27f6 X))\n (h\u2081 : \u2200 {Z : C} (f : Z \u27f6 X), q (p f) = f) (h\u2082 : \u2200 {Z : C} (f : Z \u27f6 Y), p (q f) = f)\n (n : \u2200 {Z Z' : C} (f : Z' \u27f6 Z) (g : Z \u27f6 X), p (f \u226b g) = f \u226b p g) : X \u2245 Y :=\nfullyFaithful.preimageIso\n (NatIso.ofComponents fun Z =>\n { hom := p\n inv := q })\n\n/-- If `yoneda.map f` is an isomorphism, so was `f`.\n-/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Yoneda.lean", "module": "Mathlib.CategoryTheory.Yoneda", "declaration": "Mathlib.CategoryTheory.Yoneda.uliftCoyonedaEquiv_symm_map", "span": "L1125-L1133", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Yoneda.lean#L1125"}, "environment": {}, "measurements": {"input_tokens": 2086, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 5074, "lean_code_chars": 4065, "natural_language_chars": 1009, "lean_code_ratio": 0.8011, "line_count": 161, "imports_count": 0, "declarations_count": 636, "diagnostics_count": 0, "retrieval_snippets_count": 15, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "37d436ba8068f6a5", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsCondKernelCDF", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Kernel.Disintegration.CDFToKernel)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma IsCondKernelCDF.toKernel_apply {hf : IsCondKernelCDF f \u03ba \u03bd} (p : \u03b1 \u00d7 \u03b2) :\n hf.toKernel f p = (f p).measure\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L78-L81)\nlemma IsRatCondKernelCDF.mono (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), Monotone (f (a, b)) := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.mono\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L82-L85)\nlemma IsRatCondKernelCDF.tendsto_atTop_one (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), Tendsto (f (a, b)) atTop (\ud835\udcdd 1) := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.tendsto_atTop_one\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L86-L89)\nlemma IsRatCondKernelCDF.tendsto_atBot_zero (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), Tendsto (f (a, b)) atBot (\ud835\udcdd 0) := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.tendsto_atBot_zero\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L90-L93)\nlemma IsRatCondKernelCDF.iInf_rat_gt_eq (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), \u2200 q, \u2a05 r : Ioi q, f (a, b) r = f (a, b) q := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.iInf_rat_gt_eq\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.stieltjesOfMeasurableRat_ae_eq (L94-L98)\nlemma stieltjesOfMeasurableRat_ae_eq (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) (q : \u211a) :\n (fun b \u21a6 stieltjesOfMeasurableRat f hf.measurable (a, b) q) =\u1d50[\u03bd a] fun b \u21a6 f (a, b) q := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with a ha\n rw [stieltjesOfMeasurableRat_eq, toRatCDF_of_isRatStieltjesPoint ha]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setIntegral_stieltjesOfMeasurableRat_rat (L99-L105)\nlemma setIntegral_stieltjesOfMeasurableRat_rat (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) (q : \u211a)\n {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b b in s, stieltjesOfMeasurableRat f hf.measurable (a, b) q \u2202(\u03bd a)\n = (\u03ba a).real (s \u00d7\u02e2 Iic (q : \u211d)) := by\nrw [setIntegral_congr_ae hs (g := fun b \u21a6 f (a, b) q) ?_, hf.setIntegral a hs]\n filter_upwards [stieltjesOfMeasurableRat_ae_eq hf a q] with b hb using fun _ \u21a6 hb\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setLIntegral_stieltjesOfMeasurableRat_rat (L106-L116)\nlemma setLIntegral_stieltjesOfMeasurableRat_rat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (q : \u211a) {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b\u207b b in s, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) q) \u2202(\u03bd a)\n = \u03ba a (s \u00d7\u02e2 Iic (q : \u211d)) := by\nrw [\u2190 ofReal_integral_eq_lintegral_ofReal]\n \u00b7 rw [setIntegral_stieltjesOfMeasurableRat_rat hf a q hs, ofReal_measureReal]\n \u00b7 refine Integrable.restrict ?_\n rw [integrable_congr (stieltjesOfMeasurableRat_ae_eq hf a q)]\n exact hf.integrable a q\n \u00b7 exact ae_of_all _ (fun x \u21a6 stieltjesOfMeasurableRat_nonneg _ _ _)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setLIntegral_stieltjesOfMeasurableRat (L117-L172)\nlemma setLIntegral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b\u207b b in s, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x) \u2202(\u03bd a)\n = \u03ba a (s \u00d7\u02e2 Iic x) := by\n-- We have the result for `x : \u211a` thanks to `setLIntegral_stieltjesOfMeasurableRat_rat`.\n -- We use a monotone convergence argument to extend it to the reals.\n by_cases h\u03c1_zero : (\u03bd a).restrict s = 0\n \u00b7 rw [h\u03c1_zero, lintegral_zero_measure]\n have \u27e8q, hq\u27e9 := exists_rat_gt x\n suffices \u03ba a (s \u00d7\u02e2 Iic (q : \u211d)) = 0 by\n symm\n refine measure_mono_null (fun p \u21a6 ?_) this\n simp only [mem_prod, mem_Iic, and_imp]\n exact fun h1 h2 \u21a6 \u27e8h1, h2.trans hq.le\u27e9\n suffices (\u03ba a).real (s \u00d7\u02e2 Iic (q : \u211d)) = 0 by\n rw [measureReal_eq_zero_iff] at this\n simpa [measure_ne_top] using this\n rw [\u2190 hf.setIntegral a hs q]\n simp [h\u03c1_zero]\n have h : \u222b\u207b b in s, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x) \u2202(\u03bd a)\n = \u222b\u207b b in s, \u2a05 r : { r' : \u211a // x < r' },\n ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) r) \u2202(\u03bd a) := by\n congr with b : 1\n simp_rw [\u2190 measure_stieltjesOfMeasurableRat_Iic]\n rw [\u2190 Monotone.measure_iInter]\n \u00b7 congr with y : 1\n simp only [mem_Iic, mem_iInter, Subtype.forall]\n exact le_iff_forall_lt_rat_imp_le\n \u00b7 exact fun r r' hrr' \u21a6 Iic_subset_Iic.mpr <| mod_cast hrr'\n \u00b7 exact fun _ \u21a6 nullMeasurableSet_Iic\n \u00b7 obtain \u27e8q, hq\u27e9 := exists_rat_gt x\n exact \u27e8\u27e8q, hq\u27e9, measure_ne_top _ _\u27e9\n have h_nonempty : Nonempty { r' : \u211a // x < \u2191r' } := by\n obtain \u27e8r, hrx\u27e9 := exists_rat_gt x\n exact \u27e8\u27e8r, hrx\u27e9\u27e9\n rw [h, lintegral_iInf_directed_of_measurable h\u03c1_zero fun q : { r' : \u211a // x < \u2191r' } \u21a6 ?_]\n rotate_left\n \u00b7 intro b\n rw [setLIntegral_stieltjesOfMeasurableRat_rat hf a _ hs]\n exact measure_ne_top _ _\n \u00b7 refine Monotone.directed_ge fun i j hij b \u21a6 ?_\n simp_rw [\u2190 measure_stieltjesOfMeasurableRat_Iic]\n refine measure_mono (Iic_subset_Iic.mpr ?_)\n exact mod_cast hij\n \u00b7 refine Measurable.ennreal_ofReal ?_\n exact (measurable_stieltjesOfMeasurableRat hf.measurable _).comp measurable_prodMk_left\n simp_rw [setLIntegral_stieltjesOfMeasurableRat_rat hf _ _ hs]\n rw [\u2190 Monotone.measure_iInter]\n \u00b7 rw [\u2190 prod_iInter]\n congr with y\n simp only [mem_iInter, mem_Iic, Subtype.forall]\n exact \u27e8le_of_forall_lt_rat_imp_le, fun hyx q hq \u21a6 hyx.trans hq.le\u27e9\n \u00b7 exact fun i j hij \u21a6 prod_mono_right (by gcongr)\n \u00b7 exact fun i \u21a6 (hs.prod measurableSet_Iic).nullMeasurableSet\n \u00b7 exact \u27e8h_nonempty.some, measure_ne_top _ _\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.lintegral_stieltjesOfMeasurableRat (L173-L178)\nlemma lintegral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) :\n \u222b\u207b b, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x) \u2202(\u03bd a)\n = \u03ba a (univ \u00d7\u02e2 Iic x) := by\nrw [\u2190 setLIntegral_univ, setLIntegral_stieltjesOfMeasurableRat hf _ _ MeasurableSet.univ]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.integrable_stieltjesOfMeasurableRat (L179-L193)\nlemma integrable_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) :\n Integrable (fun b \u21a6 stieltjesOfMeasurableRat f hf.measurable (a, b) x) (\u03bd a) := by\nhave : (fun b \u21a6 stieltjesOfMeasurableRat f hf.measurable (a, b) x)\n = fun b \u21a6 (ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x)).toReal := by\n ext t\n rw [ENNReal.toReal_ofReal]\n exact stieltjesOfMeasurableRat_nonneg _ _ _\n rw [this]\n refine integrable_toReal_of_lintegral_ne_top ?_ ?_\n \u00b7 refine (Measurable.ennreal_ofReal ?_).aemeasurable\n exact (measurable_stieltjesOfMeasurableRat hf.measurable x).comp measurable_prodMk_left\n \u00b7 rw [lintegral_stieltjesOfMeasurableRat hf]\n exact measure_ne_top _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setIntegral_stieltjesOfMeasurableRat (L194-L205)\nlemma setIntegral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b b in s, stieltjesOfMeasurableRat f hf.measurable (a, b) x \u2202(\u03bd a)\n = (\u03ba a).real (s \u00d7\u02e2 Iic x) := by\nrw [\u2190 ENNReal.ofReal_eq_ofReal_iff, ofReal_measureReal]\n rotate_left\n \u00b7 exact setIntegral_nonneg hs (fun _ _ \u21a6 stieltjesOfMeasurableRat_nonneg _ _ _)\n \u00b7 exact ENNReal.toReal_nonneg\n rw [ofReal_integral_eq_lintegral_ofReal, setLIntegral_stieltjesOfMeasurableRat hf _ _ hs]\n \u00b7 exact (integrable_stieltjesOfMeasurableRat hf _ _).restrict\n \u00b7 exact ae_of_all _ (fun _ \u21a6 stieltjesOfMeasurableRat_nonneg _ _ _)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.integral_stieltjesOfMeasurableRat (L206-L242)\nlemma integral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) :\n \u222b b, stieltjesOfMeasurableRat f hf.measurable (a, b) x \u2202(\u03bd a)\n = (\u03ba a).real (univ \u00d7\u02e2 Iic x) := by\nrw [\u2190 setIntegral_univ, setIntegral_stieltjesOfMeasurableRat hf _ _ MeasurableSet.univ]\n\nend stieltjesOfMeasurableRat\n\nsection isRatCondKernelCDFAux\n\nvariable {f : \u03b1 \u00d7 \u03b2 \u2192 \u211a \u2192 \u211d}\n\n/-- This property implies `IsRatCondKernelCDF`. The measurability, integrability and integral\nconditions are the same, but the limit properties of `IsRatCondKernelCDF` are replaced by\nlimits of integrals. -/\nstructure IsRatCondKernelCDFAux (f : \u03b1 \u00d7 \u03b2 \u2192 \u211a \u2192 \u211d) (\u03ba : Kernel \u03b1 (\u03b2 \u00d7 \u211d)) (\u03bd : Kernel \u03b1 \u03b2) :\n Prop where\n measurable : Measurable f\n mono' (a : \u03b1) {q r : \u211a} (_hqr : q \u2264 r) : \u2200\u1d50 c \u2202(\u03bd a), f (a, c) q \u2264 f (a, c) r\n nonneg' (a : \u03b1) (q : \u211a) : \u2200\u1d50 c \u2202(\u03bd a), 0 \u2264 f (a, c) q\n le_one' (a : \u03b1) (q : \u211a) : \u2200\u1d50 c \u2202(\u03bd a), f (a, c) q \u2264 1\n /- Same as `Tendsto (fun q : \u211a \u21a6 \u222b c, f (a, c) q \u2202(\u03bd a)) atBot (\ud835\udcdd 0)` but slightly easier\n to prove in the current applications of this definition (some integral convergence lemmas\n currently apply only to `\u2115`, not `\u211a`) -/\n tendsto_integral_of_antitone (a : \u03b1) (seq : \u2115 \u2192 \u211a) (_hs : Antitone seq)\n (_hs_tendsto : Tendsto seq atTop atBot) :\n Tendsto (fun m \u21a6 \u222b c, f (a, c) (seq m) \u2202(\u03bd a)) atTop (\ud835\udcdd 0)\n /- Same as `Tendsto (fun q : \u211a \u21a6 \u222b c, f (a, c) q \u2202(\u03bd a)) atTop (\ud835\udcdd ((\u03bd a).real univ))` but\n slightly easier to prove in the current applications of this definition (some integral convergence\n lemmas currently apply only to `\u2115`, not `\u211a`) -/\n tendsto_integral_of_monotone (a : \u03b1) (seq : \u2115 \u2192 \u211a) (_hs : Monotone seq)\n (_hs_tendsto : Tendsto seq atTop atTop) :\n Tendsto (fun m \u21a6 \u222b c, f (a, c) (seq m) \u2202(\u03bd a)) atTop (\ud835\udcdd ((\u03bd a).real univ))\n integrable (a : \u03b1) (q : \u211a) : Integrable (fun c \u21a6 f (a, c) q) (\u03bd a)\n setIntegral (a : \u03b1) {A : Set \u03b2} (_hA : MeasurableSet A) (q : \u211a) :\n \u222b c in A, f (a, c) q \u2202(\u03bd a) = (\u03ba a).real (A \u00d7\u02e2 Iic \u2191q)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDFAux (L243-L248)\nlemma IsRatCondKernelCDFAux.measurable_right (hf : IsRatCondKernelCDFAux f \u03ba \u03bd) (a : \u03b1) (q : \u211a) :\n Measurable (fun t \u21a6 f (a, t) q) := by\nlet h := hf.measurable\n rw [measurable_pi_iff] at h\n exact (h q).comp measurable_prodMk_left\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDFAux (L249-L254)\nlemma IsRatCondKernelCDFAux.mono (hf : IsRatCondKernelCDFAux f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 c \u2202(\u03bd a), Monotone (f (a, c)) := by\nunfold Monotone\n simp_rw [ae_all_iff]\n exact fun _ _ hqr \u21a6 hf.mono' a hqr\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDFAux (L255-L257)\nlemma IsRatCondKernelCDFAux.nonneg (hf : IsRatCondKernelCDFAux f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 c \u2202(\u03bd a), \u2200 q, 0 \u2264 f (a, c) q := ae_all_iff.mpr <| hf.nonneg' a\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Probability.Kernel.Basic.isSFiniteKernel_const (L216-L219)\nlemma isSFiniteKernel_const [Nonempty \u03b1] {\u03bc\u03b2 : Measure \u03b2} :\n IsSFiniteKernel (const \u03b1 \u03bc\u03b2) \u2194 SFinite \u03bc\u03b2 :=\n\u27e8fun h \u21a6 h.sFinite (Classical.arbitrary \u03b1), fun _ \u21a6 inferInstance\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Probability.Kernel.Basic.const (L178-L182)\ndef const (\u03b1 : Type*) {\u03b2 : Type*} [MeasurableSpace \u03b1] {_ : MeasurableSpace \u03b2} (\u03bc\u03b2 : Measure \u03b2) :\n Kernel \u03b1 \u03b2 where\n toFun _ := \u03bc\u03b2\nmeasurable' := measurable_const\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Probability.Kernel.Basic.discard_apply (L151-L158)\nlemma discard_apply (a : \u03b1) : discard \u03b1 a = Measure.dirac PUnit.unit := deterministic_apply _ _\nend Discard\n\nsection Swap\n\n/-- The deterministic kernel that maps `(x, y)` to the Dirac measure at `(y, x)`. -/\nnoncomputable\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Probability.Kernel.Basic.discard (L145-L147)\ndef discard (\u03b1 : Type*) [MeasurableSpace \u03b1] : Kernel \u03b1 PUnit :=\nKernel.deterministic (fun _ \u21a6 PUnit.unit) measurable_const\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Probability.Kernel.Basic.setLIntegral_deterministic (L100-L110)\ntheorem setLIntegral_deterministic {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n [MeasurableSingletonClass \u03b2] (s : Set \u03b2) [Decidable (g a \u2208 s)] :\n \u222b\u207b x in s, f x \u2202deterministic g hg a = if g a \u2208 s then f (g a) else 0 := by\nrw [deterministic_apply, setLIntegral_dirac f s]\n\nend Deterministic\n\nsection Id\n\n/-- The identity kernel, that maps `x : \u03b1` to the Dirac measure at `x`. -/\nprotected noncomputable\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Probability.Kernel.Basic.const_add (L191-L193)\nlemma const_add (\u03b2 : Type*) [MeasurableSpace \u03b2] (\u03bc \u03bd : Measure \u03b1) :\n const \u03b2 (\u03bc + \u03bd) = const \u03b2 \u03bc + const \u03b2 \u03bd := by ext; simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_deterministic (L90-L93)\ntheorem lintegral_deterministic {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n [MeasurableSingletonClass \u03b2] : \u222b\u207b x, f x \u2202deterministic g hg a = f (g a) := by\nrw [deterministic_apply, lintegral_dirac (g a) f]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_id (L122-L131)\nlemma lintegral_id [MeasurableSingletonClass \u03b1] {f : \u03b1 \u2192 \u211d\u22650\u221e} (a : \u03b1) :\n \u222b\u207b a, f a \u2202(@Kernel.id \u03b1 m\u03b1 a) = f a := by\nrw [id_apply, lintegral_dirac]\n\nend Id\n\nsection Copy\n\n/-- The deterministic kernel that maps `x : \u03b1` to the Dirac measure at `(x, x) : \u03b1 \u00d7 \u03b1`. -/\nnoncomputable\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Probability.Kernel.Basic.swap_apply (L165-L168)\nlemma swap_apply (ab : \u03b1 \u00d7 \u03b2) : swap \u03b1 \u03b2 ab = Measure.dirac ab.swap := by\nrw [swap, deterministic_apply]\n\n/-- See `swap_apply` for a partially applied version of this lemma. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_deterministic' (L85-L88)\ntheorem lintegral_deterministic' {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n (hf : Measurable f) : \u222b\u207b x, f x \u2202deterministic g hg a = f (g a) := by\nrw [deterministic_apply, lintegral_dirac' _ hf]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Probability.Kernel.Basic.deterministic_apply (L65-L68)\ntheorem deterministic_apply {f : \u03b1 \u2192 \u03b2} (hf : Measurable f) (a : \u03b1) :\n deterministic f hf a = Measure.dirac (f a) :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_id' (L118-L121)\nlemma lintegral_id' {f : \u03b1 \u2192 \u211d\u22650\u221e} (hf : Measurable f) (a : \u03b1) :\n \u222b\u207b a, f a \u2202(@Kernel.id \u03b1 m\u03b1 a) = f a := by\nrw [id_apply, lintegral_dirac' _ hf]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Probability.Kernel.Basic.swap (L159-L161)\ndef swap (\u03b1 \u03b2 : Type*) [MeasurableSpace \u03b1] [MeasurableSpace \u03b2] : Kernel (\u03b1 \u00d7 \u03b2) (\u03b2 \u00d7 \u03b1) :=\nKernel.deterministic Prod.swap measurable_swap\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Probability.Kernel.Basic.deterministic_congr (L77-L80)\ntheorem deterministic_congr {f g : \u03b1 \u2192 \u03b2} {hf : Measurable f} (h : f = g) :\n deterministic f hf = deterministic g (h \u25b8 hf) := by\ngrind\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Probability.Kernel.Basic.id (L111-L112)\ndef id : Kernel \u03b1 \u03b1 := Kernel.deterministic id measurable_id\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Probability.Kernel.Basic.setLIntegral_deterministic' (L94-L98)\ntheorem setLIntegral_deterministic' {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n (hf : Measurable f) {s : Set \u03b2} (hs : MeasurableSet s) [Decidable (g a \u2208 s)] :\n \u222b\u207b x in s, f x \u2202deterministic g hg a = if g a \u2208 s then f (g a) else 0 := by\nrw [deterministic_apply, setLIntegral_dirac' hf hs]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Probability.Kernel.Basic.copy_apply (L137-L144)\nlemma copy_apply (a : \u03b1) : copy \u03b1 a = Measure.dirac (a, a) := by simp [copy, deterministic_apply]\nend Copy\n\nsection Discard\n\n/-- The Markov kernel to the `PUnit` type. -/\nnoncomputable\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Probability.Kernel.Basic.const_apply (L184-L186)\ntheorem const_apply (\u03bc\u03b2 : Measure \u03b2) (a : \u03b1) : const \u03b1 \u03bc\u03b2 a = \u03bc\u03b2 :=\nrfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Probability.Kernel.Basic.const_zero (L188-L190)\nlemma const_zero : const \u03b1 (0 : Measure \u03b2) = 0 := by\next x s _; simp [const_apply]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Probability.Kernel.Basic.deterministic_apply' (L69-L76)\ntheorem deterministic_apply' {f : \u03b1 \u2192 \u03b2} (hf : Measurable f) (a : \u03b1) {s : Set \u03b2}\n (hs : MeasurableSet s) : deterministic f hf a s = s.indicator (fun _ => 1) (f a) := by\nrw [deterministic]\n change Measure.dirac (f a) s = s.indicator 1 (f a)\n simp_rw [Measure.dirac_apply' _ hs]\n\n/-- Because of the measurability field in `Kernel.deterministic`, `rw [h]` will not rewrite\n`deterministic f hf` to `deterministic g \u22ef`. Instead one can do `rw [deterministic_congr h]`. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Probability.Kernel.Basic.sum_const (L194-L196)\nlemma sum_const [Countable \u03b9] (\u03bc : \u03b9 \u2192 Measure \u03b2) :\n Kernel.sum (fun n \u21a6 const \u03b1 (\u03bc n)) = const \u03b1 (Measure.sum \u03bc) := rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Probability.Kernel.Basic.copy (L132-L134)\ndef copy (\u03b1 : Type*) [MeasurableSpace \u03b1] : Kernel \u03b1 (\u03b1 \u00d7 \u03b1) :=\nKernel.deterministic (fun x \u21a6 (x, x)) (measurable_id.prod measurable_id)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Probability.Kernel.Basic.id_apply (L115-L117)\nlemma id_apply (a : \u03b1) : Kernel.id a = Measure.dirac a := by\nrw [Kernel.id, deterministic_apply, id_def]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Probability.Kernel.Basic.isMarkovKernel_deterministic (L81-L84)\ninstance isMarkovKernel_deterministic {f : \u03b1 \u2192 \u03b2} (hf : Measurable f) :\n IsMarkovKernel (deterministic f hf) :=\n\u27e8fun a => by rw [deterministic_apply hf]; infer_instance\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Probability.Kernel.Basic.swap_apply' (L169-L177)\nlemma swap_apply' (ab : \u03b1 \u00d7 \u03b2) {s : Set (\u03b2 \u00d7 \u03b1)} (hs : MeasurableSet s) :\n swap \u03b1 \u03b2 ab s = s.indicator 1 ab.swap := by\nrw [swap_apply, Measure.dirac_apply' _ hs]\n\nend Swap\n\nsection Const\n\n/-- Constant kernel, which always returns the same measure. -/\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Kernel.Disintegration.CDFToKernel).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma IsCondKernelCDF.toKernel_apply {hf : IsCondKernelCDF f \u03ba \u03bd} (p : \u03b1 \u00d7 \u03b2) :\n hf.toKernel f p = (f p).measure\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L78-L81)\nlemma IsRatCondKernelCDF.mono (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), Monotone (f (a, b)) := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.mono\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L82-L85)\nlemma IsRatCondKernelCDF.tendsto_atTop_one (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), Tendsto (f (a, b)) atTop (\ud835\udcdd 1) := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.tendsto_atTop_one\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L86-L89)\nlemma IsRatCondKernelCDF.tendsto_atBot_zero (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), Tendsto (f (a, b)) atBot (\ud835\udcdd 0) := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.tendsto_atBot_zero\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDF (L90-L93)\nlemma IsRatCondKernelCDF.iInf_rat_gt_eq (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 b \u2202(\u03bd a), \u2200 q, \u2a05 r : Ioi q, f (a, b) r = f (a, b) q := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with b hb using hb.iInf_rat_gt_eq\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.stieltjesOfMeasurableRat_ae_eq (L94-L98)\nlemma stieltjesOfMeasurableRat_ae_eq (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) (q : \u211a) :\n (fun b \u21a6 stieltjesOfMeasurableRat f hf.measurable (a, b) q) =\u1d50[\u03bd a] fun b \u21a6 f (a, b) q := by\nfilter_upwards [hf.isRatStieltjesPoint_ae a] with a ha\n rw [stieltjesOfMeasurableRat_eq, toRatCDF_of_isRatStieltjesPoint ha]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setIntegral_stieltjesOfMeasurableRat_rat (L99-L105)\nlemma setIntegral_stieltjesOfMeasurableRat_rat (hf : IsRatCondKernelCDF f \u03ba \u03bd) (a : \u03b1) (q : \u211a)\n {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b b in s, stieltjesOfMeasurableRat f hf.measurable (a, b) q \u2202(\u03bd a)\n = (\u03ba a).real (s \u00d7\u02e2 Iic (q : \u211d)) := by\nrw [setIntegral_congr_ae hs (g := fun b \u21a6 f (a, b) q) ?_, hf.setIntegral a hs]\n filter_upwards [stieltjesOfMeasurableRat_ae_eq hf a q] with b hb using fun _ \u21a6 hb\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setLIntegral_stieltjesOfMeasurableRat_rat (L106-L116)\nlemma setLIntegral_stieltjesOfMeasurableRat_rat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (q : \u211a) {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b\u207b b in s, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) q) \u2202(\u03bd a)\n = \u03ba a (s \u00d7\u02e2 Iic (q : \u211d)) := by\nrw [\u2190 ofReal_integral_eq_lintegral_ofReal]\n \u00b7 rw [setIntegral_stieltjesOfMeasurableRat_rat hf a q hs, ofReal_measureReal]\n \u00b7 refine Integrable.restrict ?_\n rw [integrable_congr (stieltjesOfMeasurableRat_ae_eq hf a q)]\n exact hf.integrable a q\n \u00b7 exact ae_of_all _ (fun x \u21a6 stieltjesOfMeasurableRat_nonneg _ _ _)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setLIntegral_stieltjesOfMeasurableRat (L117-L172)\nlemma setLIntegral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b\u207b b in s, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x) \u2202(\u03bd a)\n = \u03ba a (s \u00d7\u02e2 Iic x) := by\n-- We have the result for `x : \u211a` thanks to `setLIntegral_stieltjesOfMeasurableRat_rat`.\n -- We use a monotone convergence argument to extend it to the reals.\n by_cases h\u03c1_zero : (\u03bd a).restrict s = 0\n \u00b7 rw [h\u03c1_zero, lintegral_zero_measure]\n have \u27e8q, hq\u27e9 := exists_rat_gt x\n suffices \u03ba a (s \u00d7\u02e2 Iic (q : \u211d)) = 0 by\n symm\n refine measure_mono_null (fun p \u21a6 ?_) this\n simp only [mem_prod, mem_Iic, and_imp]\n exact fun h1 h2 \u21a6 \u27e8h1, h2.trans hq.le\u27e9\n suffices (\u03ba a).real (s \u00d7\u02e2 Iic (q : \u211d)) = 0 by\n rw [measureReal_eq_zero_iff] at this\n simpa [measure_ne_top] using this\n rw [\u2190 hf.setIntegral a hs q]\n simp [h\u03c1_zero]\n have h : \u222b\u207b b in s, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x) \u2202(\u03bd a)\n = \u222b\u207b b in s, \u2a05 r : { r' : \u211a // x < r' },\n ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) r) \u2202(\u03bd a) := by\n congr with b : 1\n simp_rw [\u2190 measure_stieltjesOfMeasurableRat_Iic]\n rw [\u2190 Monotone.measure_iInter]\n \u00b7 congr with y : 1\n simp only [mem_Iic, mem_iInter, Subtype.forall]\n exact le_iff_forall_lt_rat_imp_le\n \u00b7 exact fun r r' hrr' \u21a6 Iic_subset_Iic.mpr <| mod_cast hrr'\n \u00b7 exact fun _ \u21a6 nullMeasurableSet_Iic\n \u00b7 obtain \u27e8q, hq\u27e9 := exists_rat_gt x\n exact \u27e8\u27e8q, hq\u27e9, measure_ne_top _ _\u27e9\n have h_nonempty : Nonempty { r' : \u211a // x < \u2191r' } := by\n obtain \u27e8r, hrx\u27e9 := exists_rat_gt x\n exact \u27e8\u27e8r, hrx\u27e9\u27e9\n rw [h, lintegral_iInf_directed_of_measurable h\u03c1_zero fun q : { r' : \u211a // x < \u2191r' } \u21a6 ?_]\n rotate_left\n \u00b7 intro b\n rw [setLIntegral_stieltjesOfMeasurableRat_rat hf a _ hs]\n exact measure_ne_top _ _\n \u00b7 refine Monotone.directed_ge fun i j hij b \u21a6 ?_\n simp_rw [\u2190 measure_stieltjesOfMeasurableRat_Iic]\n refine measure_mono (Iic_subset_Iic.mpr ?_)\n exact mod_cast hij\n \u00b7 refine Measurable.ennreal_ofReal ?_\n exact (measurable_stieltjesOfMeasurableRat hf.measurable _).comp measurable_prodMk_left\n simp_rw [setLIntegral_stieltjesOfMeasurableRat_rat hf _ _ hs]\n rw [\u2190 Monotone.measure_iInter]\n \u00b7 rw [\u2190 prod_iInter]\n congr with y\n simp only [mem_iInter, mem_Iic, Subtype.forall]\n exact \u27e8le_of_forall_lt_rat_imp_le, fun hyx q hq \u21a6 hyx.trans hq.le\u27e9\n \u00b7 exact fun i j hij \u21a6 prod_mono_right (by gcongr)\n \u00b7 exact fun i \u21a6 (hs.prod measurableSet_Iic).nullMeasurableSet\n \u00b7 exact \u27e8h_nonempty.some, measure_ne_top _ _\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.lintegral_stieltjesOfMeasurableRat (L173-L178)\nlemma lintegral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) :\n \u222b\u207b b, ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x) \u2202(\u03bd a)\n = \u03ba a (univ \u00d7\u02e2 Iic x) := by\nrw [\u2190 setLIntegral_univ, setLIntegral_stieltjesOfMeasurableRat hf _ _ MeasurableSet.univ]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.integrable_stieltjesOfMeasurableRat (L179-L193)\nlemma integrable_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) :\n Integrable (fun b \u21a6 stieltjesOfMeasurableRat f hf.measurable (a, b) x) (\u03bd a) := by\nhave : (fun b \u21a6 stieltjesOfMeasurableRat f hf.measurable (a, b) x)\n = fun b \u21a6 (ENNReal.ofReal (stieltjesOfMeasurableRat f hf.measurable (a, b) x)).toReal := by\n ext t\n rw [ENNReal.toReal_ofReal]\n exact stieltjesOfMeasurableRat_nonneg _ _ _\n rw [this]\n refine integrable_toReal_of_lintegral_ne_top ?_ ?_\n \u00b7 refine (Measurable.ennreal_ofReal ?_).aemeasurable\n exact (measurable_stieltjesOfMeasurableRat hf.measurable x).comp measurable_prodMk_left\n \u00b7 rw [lintegral_stieltjesOfMeasurableRat hf]\n exact measure_ne_top _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.setIntegral_stieltjesOfMeasurableRat (L194-L205)\nlemma setIntegral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) {s : Set \u03b2} (hs : MeasurableSet s) :\n \u222b b in s, stieltjesOfMeasurableRat f hf.measurable (a, b) x \u2202(\u03bd a)\n = (\u03ba a).real (s \u00d7\u02e2 Iic x) := by\nrw [\u2190 ENNReal.ofReal_eq_ofReal_iff, ofReal_measureReal]\n rotate_left\n \u00b7 exact setIntegral_nonneg hs (fun _ _ \u21a6 stieltjesOfMeasurableRat_nonneg _ _ _)\n \u00b7 exact ENNReal.toReal_nonneg\n rw [ofReal_integral_eq_lintegral_ofReal, setLIntegral_stieltjesOfMeasurableRat hf _ _ hs]\n \u00b7 exact (integrable_stieltjesOfMeasurableRat hf _ _).restrict\n \u00b7 exact ae_of_all _ (fun _ \u21a6 stieltjesOfMeasurableRat_nonneg _ _ _)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.integral_stieltjesOfMeasurableRat (L206-L242)\nlemma integral_stieltjesOfMeasurableRat [IsFiniteKernel \u03ba] (hf : IsRatCondKernelCDF f \u03ba \u03bd)\n (a : \u03b1) (x : \u211d) :\n \u222b b, stieltjesOfMeasurableRat f hf.measurable (a, b) x \u2202(\u03bd a)\n = (\u03ba a).real (univ \u00d7\u02e2 Iic x) := by\nrw [\u2190 setIntegral_univ, setIntegral_stieltjesOfMeasurableRat hf _ _ MeasurableSet.univ]\n\nend stieltjesOfMeasurableRat\n\nsection isRatCondKernelCDFAux\n\nvariable {f : \u03b1 \u00d7 \u03b2 \u2192 \u211a \u2192 \u211d}\n\n/-- This property implies `IsRatCondKernelCDF`. The measurability, integrability and integral\nconditions are the same, but the limit properties of `IsRatCondKernelCDF` are replaced by\nlimits of integrals. -/\nstructure IsRatCondKernelCDFAux (f : \u03b1 \u00d7 \u03b2 \u2192 \u211a \u2192 \u211d) (\u03ba : Kernel \u03b1 (\u03b2 \u00d7 \u211d)) (\u03bd : Kernel \u03b1 \u03b2) :\n Prop where\n measurable : Measurable f\n mono' (a : \u03b1) {q r : \u211a} (_hqr : q \u2264 r) : \u2200\u1d50 c \u2202(\u03bd a), f (a, c) q \u2264 f (a, c) r\n nonneg' (a : \u03b1) (q : \u211a) : \u2200\u1d50 c \u2202(\u03bd a), 0 \u2264 f (a, c) q\n le_one' (a : \u03b1) (q : \u211a) : \u2200\u1d50 c \u2202(\u03bd a), f (a, c) q \u2264 1\n /- Same as `Tendsto (fun q : \u211a \u21a6 \u222b c, f (a, c) q \u2202(\u03bd a)) atBot (\ud835\udcdd 0)` but slightly easier\n to prove in the current applications of this definition (some integral convergence lemmas\n currently apply only to `\u2115`, not `\u211a`) -/\n tendsto_integral_of_antitone (a : \u03b1) (seq : \u2115 \u2192 \u211a) (_hs : Antitone seq)\n (_hs_tendsto : Tendsto seq atTop atBot) :\n Tendsto (fun m \u21a6 \u222b c, f (a, c) (seq m) \u2202(\u03bd a)) atTop (\ud835\udcdd 0)\n /- Same as `Tendsto (fun q : \u211a \u21a6 \u222b c, f (a, c) q \u2202(\u03bd a)) atTop (\ud835\udcdd ((\u03bd a).real univ))` but\n slightly easier to prove in the current applications of this definition (some integral convergence\n lemmas currently apply only to `\u2115`, not `\u211a`) -/\n tendsto_integral_of_monotone (a : \u03b1) (seq : \u2115 \u2192 \u211a) (_hs : Monotone seq)\n (_hs_tendsto : Tendsto seq atTop atTop) :\n Tendsto (fun m \u21a6 \u222b c, f (a, c) (seq m) \u2202(\u03bd a)) atTop (\ud835\udcdd ((\u03bd a).real univ))\n integrable (a : \u03b1) (q : \u211a) : Integrable (fun c \u21a6 f (a, c) q) (\u03bd a)\n setIntegral (a : \u03b1) {A : Set \u03b2} (_hA : MeasurableSet A) (q : \u211a) :\n \u222b c in A, f (a, c) q \u2202(\u03bd a) = (\u03ba a).real (A \u00d7\u02e2 Iic \u2191q)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDFAux (L243-L248)\nlemma IsRatCondKernelCDFAux.measurable_right (hf : IsRatCondKernelCDFAux f \u03ba \u03bd) (a : \u03b1) (q : \u211a) :\n Measurable (fun t \u21a6 f (a, t) q) := by\nlet h := hf.measurable\n rw [measurable_pi_iff] at h\n exact (h q).comp measurable_prodMk_left\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDFAux (L249-L254)\nlemma IsRatCondKernelCDFAux.mono (hf : IsRatCondKernelCDFAux f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 c \u2202(\u03bd a), Monotone (f (a, c)) := by\nunfold Monotone\n simp_rw [ae_all_iff]\n exact fun _ _ hqr \u21a6 hf.mono' a hqr\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsRatCondKernelCDFAux (L255-L257)\nlemma IsRatCondKernelCDFAux.nonneg (hf : IsRatCondKernelCDFAux f \u03ba \u03bd) (a : \u03b1) :\n \u2200\u1d50 c \u2202(\u03bd a), \u2200 q, 0 \u2264 f (a, c) q := ae_all_iff.mpr <| hf.nonneg' a\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Probability.Kernel.Basic.isSFiniteKernel_const (L216-L219)\nlemma isSFiniteKernel_const [Nonempty \u03b1] {\u03bc\u03b2 : Measure \u03b2} :\n IsSFiniteKernel (const \u03b1 \u03bc\u03b2) \u2194 SFinite \u03bc\u03b2 :=\n\u27e8fun h \u21a6 h.sFinite (Classical.arbitrary \u03b1), fun _ \u21a6 inferInstance\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Probability.Kernel.Basic.const (L178-L182)\ndef const (\u03b1 : Type*) {\u03b2 : Type*} [MeasurableSpace \u03b1] {_ : MeasurableSpace \u03b2} (\u03bc\u03b2 : Measure \u03b2) :\n Kernel \u03b1 \u03b2 where\n toFun _ := \u03bc\u03b2\nmeasurable' := measurable_const\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Probability.Kernel.Basic.discard_apply (L151-L158)\nlemma discard_apply (a : \u03b1) : discard \u03b1 a = Measure.dirac PUnit.unit := deterministic_apply _ _\nend Discard\n\nsection Swap\n\n/-- The deterministic kernel that maps `(x, y)` to the Dirac measure at `(y, x)`. -/\nnoncomputable\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Probability.Kernel.Basic.discard (L145-L147)\ndef discard (\u03b1 : Type*) [MeasurableSpace \u03b1] : Kernel \u03b1 PUnit :=\nKernel.deterministic (fun _ \u21a6 PUnit.unit) measurable_const\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Probability.Kernel.Basic.setLIntegral_deterministic (L100-L110)\ntheorem setLIntegral_deterministic {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n [MeasurableSingletonClass \u03b2] (s : Set \u03b2) [Decidable (g a \u2208 s)] :\n \u222b\u207b x in s, f x \u2202deterministic g hg a = if g a \u2208 s then f (g a) else 0 := by\nrw [deterministic_apply, setLIntegral_dirac f s]\n\nend Deterministic\n\nsection Id\n\n/-- The identity kernel, that maps `x : \u03b1` to the Dirac measure at `x`. -/\nprotected noncomputable\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Probability.Kernel.Basic.const_add (L191-L193)\nlemma const_add (\u03b2 : Type*) [MeasurableSpace \u03b2] (\u03bc \u03bd : Measure \u03b1) :\n const \u03b2 (\u03bc + \u03bd) = const \u03b2 \u03bc + const \u03b2 \u03bd := by ext; simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_deterministic (L90-L93)\ntheorem lintegral_deterministic {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n [MeasurableSingletonClass \u03b2] : \u222b\u207b x, f x \u2202deterministic g hg a = f (g a) := by\nrw [deterministic_apply, lintegral_dirac (g a) f]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_id (L122-L131)\nlemma lintegral_id [MeasurableSingletonClass \u03b1] {f : \u03b1 \u2192 \u211d\u22650\u221e} (a : \u03b1) :\n \u222b\u207b a, f a \u2202(@Kernel.id \u03b1 m\u03b1 a) = f a := by\nrw [id_apply, lintegral_dirac]\n\nend Id\n\nsection Copy\n\n/-- The deterministic kernel that maps `x : \u03b1` to the Dirac measure at `(x, x) : \u03b1 \u00d7 \u03b1`. -/\nnoncomputable\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Probability.Kernel.Basic.swap_apply (L165-L168)\nlemma swap_apply (ab : \u03b1 \u00d7 \u03b2) : swap \u03b1 \u03b2 ab = Measure.dirac ab.swap := by\nrw [swap, deterministic_apply]\n\n/-- See `swap_apply` for a partially applied version of this lemma. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_deterministic' (L85-L88)\ntheorem lintegral_deterministic' {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n (hf : Measurable f) : \u222b\u207b x, f x \u2202deterministic g hg a = f (g a) := by\nrw [deterministic_apply, lintegral_dirac' _ hf]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Probability.Kernel.Basic.deterministic_apply (L65-L68)\ntheorem deterministic_apply {f : \u03b1 \u2192 \u03b2} (hf : Measurable f) (a : \u03b1) :\n deterministic f hf a = Measure.dirac (f a) :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Probability.Kernel.Basic.lintegral_id' (L118-L121)\nlemma lintegral_id' {f : \u03b1 \u2192 \u211d\u22650\u221e} (hf : Measurable f) (a : \u03b1) :\n \u222b\u207b a, f a \u2202(@Kernel.id \u03b1 m\u03b1 a) = f a := by\nrw [id_apply, lintegral_dirac' _ hf]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Probability.Kernel.Basic.swap (L159-L161)\ndef swap (\u03b1 \u03b2 : Type*) [MeasurableSpace \u03b1] [MeasurableSpace \u03b2] : Kernel (\u03b1 \u00d7 \u03b2) (\u03b2 \u00d7 \u03b1) :=\nKernel.deterministic Prod.swap measurable_swap\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Probability.Kernel.Basic.deterministic_congr (L77-L80)\ntheorem deterministic_congr {f g : \u03b1 \u2192 \u03b2} {hf : Measurable f} (h : f = g) :\n deterministic f hf = deterministic g (h \u25b8 hf) := by\ngrind\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Probability.Kernel.Basic.id (L111-L112)\ndef id : Kernel \u03b1 \u03b1 := Kernel.deterministic id measurable_id\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Probability.Kernel.Basic.setLIntegral_deterministic' (L94-L98)\ntheorem setLIntegral_deterministic' {f : \u03b2 \u2192 \u211d\u22650\u221e} {g : \u03b1 \u2192 \u03b2} {a : \u03b1} (hg : Measurable g)\n (hf : Measurable f) {s : Set \u03b2} (hs : MeasurableSet s) [Decidable (g a \u2208 s)] :\n \u222b\u207b x in s, f x \u2202deterministic g hg a = if g a \u2208 s then f (g a) else 0 := by\nrw [deterministic_apply, setLIntegral_dirac' hf hs]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Probability.Kernel.Basic.copy_apply (L137-L144)\nlemma copy_apply (a : \u03b1) : copy \u03b1 a = Measure.dirac (a, a) := by simp [copy, deterministic_apply]\nend Copy\n\nsection Discard\n\n/-- The Markov kernel to the `PUnit` type. -/\nnoncomputable\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Probability.Kernel.Basic.const_apply (L184-L186)\ntheorem const_apply (\u03bc\u03b2 : Measure \u03b2) (a : \u03b1) : const \u03b1 \u03bc\u03b2 a = \u03bc\u03b2 :=\nrfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Probability.Kernel.Basic.const_zero (L188-L190)\nlemma const_zero : const \u03b1 (0 : Measure \u03b2) = 0 := by\next x s _; simp [const_apply]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Probability.Kernel.Basic.deterministic_apply' (L69-L76)\ntheorem deterministic_apply' {f : \u03b1 \u2192 \u03b2} (hf : Measurable f) (a : \u03b1) {s : Set \u03b2}\n (hs : MeasurableSet s) : deterministic f hf a s = s.indicator (fun _ => 1) (f a) := by\nrw [deterministic]\n change Measure.dirac (f a) s = s.indicator 1 (f a)\n simp_rw [Measure.dirac_apply' _ hs]\n\n/-- Because of the measurability field in `Kernel.deterministic`, `rw [h]` will not rewrite\n`deterministic f hf` to `deterministic g \u22ef`. Instead one can do `rw [deterministic_congr h]`. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Probability.Kernel.Basic.sum_const (L194-L196)\nlemma sum_const [Countable \u03b9] (\u03bc : \u03b9 \u2192 Measure \u03b2) :\n Kernel.sum (fun n \u21a6 const \u03b1 (\u03bc n)) = const \u03b1 (Measure.sum \u03bc) := rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Probability.Kernel.Basic.copy (L132-L134)\ndef copy (\u03b1 : Type*) [MeasurableSpace \u03b1] : Kernel \u03b1 (\u03b1 \u00d7 \u03b1) :=\nKernel.deterministic (fun x \u21a6 (x, x)) (measurable_id.prod measurable_id)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Probability.Kernel.Basic.id_apply (L115-L117)\nlemma id_apply (a : \u03b1) : Kernel.id a = Measure.dirac a := by\nrw [Kernel.id, deterministic_apply, id_def]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Probability.Kernel.Basic.isMarkovKernel_deterministic (L81-L84)\ninstance isMarkovKernel_deterministic {f : \u03b1 \u2192 \u03b2} (hf : Measurable f) :\n IsMarkovKernel (deterministic f hf) :=\n\u27e8fun a => by rw [deterministic_apply hf]; infer_instance\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Probability.Kernel.Basic.swap_apply' (L169-L177)\nlemma swap_apply' (ab : \u03b1 \u00d7 \u03b2) {s : Set (\u03b2 \u00d7 \u03b1)} (hs : MeasurableSet s) :\n swap \u03b1 \u03b2 ab s = s.indicator 1 ab.swap := by\nrw [swap_apply, Measure.dirac_apply' _ hs]\n\nend Swap\n\nsection Const\n\n/-- Constant kernel, which always returns the same measure. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Probability/Kernel/Disintegration/CDFToKernel.lean", "module": "Mathlib.Probability.Kernel.Disintegration.CDFToKernel", "declaration": "Mathlib.Probability.Kernel.Disintegration.CDFToKernel.IsCondKernelCDF", "span": "L458-L460", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Kernel/Disintegration/CDFToKernel.lean#L458"}, "environment": {}, "measurements": {"input_tokens": 7186, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 18409, "lean_code_chars": 16887, "natural_language_chars": 1522, "lean_code_ratio": 0.9173, "line_count": 475, "imports_count": 0, "declarations_count": 1827, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "5880bacabe0a5dcf", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.MeasureTheory.Measure.MeasureSpace.Ioc_ae_eq_Icc'", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.MeasureSpace)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Ioc_ae_eq_Icc' (ha : \u03bc {a} = 0) : Ioc a b =\u1d50[\u03bc] Icc a b\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.ae_isMeasurablyGenerated (L102-L107)\ninstance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae \u03bc) :=\n\u27e8fun _s hs =>\n let \u27e8t, hst, htm, ht\u03bc\u27e9 := exists_measurable_superset_of_null hs\n \u27e8t\u1d9c, compl_mem_ae_iff.2 ht\u03bc, htm.compl, compl_subset_comm.1 hst\u27e9\u27e9\n\n/-- See also `MeasureTheory.ae_restrict_uIoc_iff`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.ae_uIoc_iff (L108-L111)\ntheorem ae_uIoc_iff [LinearOrder \u03b1] {a b : \u03b1} {P : \u03b1 \u2192 Prop} :\n (\u2200\u1d50 x \u2202\u03bc, x \u2208 \u0399 a b \u2192 P x) \u2194 (\u2200\u1d50 x \u2202\u03bc, x \u2208 Ioc a b \u2192 P x) \u2227 \u2200\u1d50 x \u2202\u03bc, x \u2208 Ioc b a \u2192 P x := by\nsimp only [uIoc_eq_union, mem_union, or_imp, eventually_and]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union (L112-L114)\ntheorem measure_union (hd : Disjoint s\u2081 s\u2082) (h : MeasurableSet s\u2082) : \u03bc (s\u2081 \u222a s\u2082) = \u03bc s\u2081 + \u03bc s\u2082 :=\nmeasure_union\u2080 h.nullMeasurableSet hd.aedisjoint\n```\n\n-- snippet 4\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union' (L115-L117)\ntheorem measure_union' (hd : Disjoint s\u2081 s\u2082) (h : MeasurableSet s\u2081) : \u03bc (s\u2081 \u222a s\u2082) = \u03bc s\u2081 + \u03bc s\u2082 :=\nmeasure_union\u2080' h.nullMeasurableSet hd.aedisjoint\n```\n\n-- snippet 5\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_inter_add_diff (L118-L120)\ntheorem measure_inter_add_diff (s : Set \u03b1) (ht : MeasurableSet t) : \u03bc (s \u2229 t) + \u03bc (s \\ t) = \u03bc s :=\nmeasure_inter_add_diff\u2080 _ ht.nullMeasurableSet\n```\n\n-- snippet 6\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_add_inter (L121-L123)\ntheorem measure_diff_add_inter (s : Set \u03b1) (ht : MeasurableSet t) : \u03bc (s \\ t) + \u03bc (s \u2229 t) = \u03bc s :=\n(add_comm _ _).trans (measure_inter_add_diff s ht)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_eq_top (L124-L128)\ntheorem measure_diff_eq_top (hs : \u03bc s = \u221e) (ht : \u03bc t \u2260 \u221e) : \u03bc (s \\ t) = \u221e := by\ncontrapose! hs\n exact ((measure_mono (subset_diff_union s t)).trans_lt\n ((measure_union_le _ _).trans_lt (ENNReal.add_lt_top.2 \u27e8hs.lt_top, ht.lt_top\u27e9))).ne\n```\n\n-- snippet 8\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union_add_inter (L129-L134)\ntheorem measure_union_add_inter (s : Set \u03b1) (ht : MeasurableSet t) :\n \u03bc (s \u222a t) + \u03bc (s \u2229 t) = \u03bc s + \u03bc t := by\nrw [\u2190 measure_inter_add_diff (s \u222a t) ht, Set.union_inter_cancel_right, union_diff_right, \u2190\n measure_inter_add_diff s ht]\n ac_rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union_add_inter' (L135-L138)\ntheorem measure_union_add_inter' (hs : MeasurableSet s) (t : Set \u03b1) :\n \u03bc (s \u222a t) + \u03bc (s \u2229 t) = \u03bc s + \u03bc t := by\nrw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_symmDiff_eq (L139-L143)\nlemma measure_symmDiff_eq (hs : NullMeasurableSet s \u03bc) (ht : NullMeasurableSet t \u03bc) :\n \u03bc (s \u2206 t) = \u03bc (s \\ t) + \u03bc (t \\ s) := by\nsimpa only [symmDiff_def, sup_eq_union]\n using measure_union\u2080 (ht.diff hs) disjoint_sdiff_sdiff.aedisjoint\n```\n\n-- snippet 11\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_symmDiff_le (L144-L147)\nlemma measure_symmDiff_le (s t u : Set \u03b1) :\n \u03bc (s \u2206 u) \u2264 \u03bc (s \u2206 t) + \u03bc (t \u2206 u) :=\nle_trans (\u03bc.mono <| symmDiff_triangle s t u) (measure_union_le (s \u2206 t) (t \u2206 u))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_symmDiff_eq_top (L148-L150)\ntheorem measure_symmDiff_eq_top (hs : \u03bc s \u2260 \u221e) (ht : \u03bc t = \u221e) : \u03bc (s \u2206 t) = \u221e :=\nmeasure_mono_top subset_union_right (measure_diff_eq_top ht hs)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_add_measure_compl (L151-L153)\ntheorem measure_add_measure_compl (h : MeasurableSet s) : \u03bc s + \u03bc s\u1d9c = \u03bc univ :=\nmeasure_add_measure_compl\u2080 h.nullMeasurableSet\n```\n\n-- snippet 14\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_biUnion\u2080 (L154-L160)\ntheorem measure_biUnion\u2080 {s : Set \u03b2} {f : \u03b2 \u2192 Set \u03b1} (hs : s.Countable)\n (hd : s.Pairwise (AEDisjoint \u03bc on f)) (h : \u2200 b \u2208 s, NullMeasurableSet (f b) \u03bc) :\n \u03bc (\u22c3 b \u2208 s, f b) = \u2211' p : s, \u03bc (f p) := by\nhaveI := hs.toEncodable\n rw [biUnion_eq_iUnion]\n exact measure_iUnion\u2080 (hd.on_injective Subtype.coe_injective fun x => x.2) fun x => h x x.2\n```\n\n-- snippet 15\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_biUnion (L161-L164)\ntheorem measure_biUnion {s : Set \u03b2} {f : \u03b2 \u2192 Set \u03b1} (hs : s.Countable) (hd : s.PairwiseDisjoint f)\n (h : \u2200 b \u2208 s, MeasurableSet (f b)) : \u03bc (\u22c3 b \u2208 s, f b) = \u2211' p : s, \u03bc (f p) :=\nmeasure_biUnion\u2080 hs hd.aedisjoint fun b hb => (h b hb).nullMeasurableSet\n```\n\n-- snippet 16\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_left (L101-L103)\ntheorem union_left (hs : AEDisjoint \u03bc s u) (ht : AEDisjoint \u03bc t u) : AEDisjoint \u03bc (s \u222a t) u :=\nunion_left_iff.mpr \u27e8hs, ht\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.of_null_left (L130-L134)\ntheorem of_null_left (h : \u03bc s = 0) : AEDisjoint \u03bc s t :=\nAEDisjoint.symm (of_null_right h)\n\nend AEDisjoint\n```\n\n-- snippet 18\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.AEDisjoint (L28-L34)\ndef AEDisjoint (s t : Set \u03b1) :=\n\u03bc (s \u2229 t) = 0\n\nvariable {\u03bc} {s t u v : Set \u03b1}\n\n/-- If `s : \u03b9 \u2192 Set \u03b1` is a countable family of pairwise a.e. disjoint sets, then there exists a\nfamily of measurable null sets `t i` such that `s i \\ t i` are pairwise disjoint. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.mono_measure (L56-L58)\ntheorem mono_measure (h : AEMeasurable f \u03bc) (h' : \u03bd \u2264 \u03bc) : AEMeasurable f \u03bd :=\nmono_ac h h'.absolutelyContinuous\n```\n\n-- snippet 20\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.of_null_right (L127-L129)\ntheorem of_null_right (h : \u03bc t = 0) : AEDisjoint \u03bc s t :=\nmeasure_mono_null inter_subset_right h\n```\n\n-- snippet 21\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.Subsingleton (L29-L31)\ntheorem Subsingleton.aemeasurable [Subsingleton \u03b1] : AEMeasurable f \u03bc :=\nSubsingleton.measurable.aemeasurable\n```\n\n-- snippet 22\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.measure_diff_left (L113-L115)\ntheorem measure_diff_left (h : AEDisjoint \u03bc s t) : \u03bc (s \\ t) = \u03bc s :=\nmeasure_congr <| AEDisjoint.diff_ae_eq_left h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_of_map_neZero (L45-L52)\nlemma aemeasurable_of_map_neZero {\u03bc : Measure \u03b1}\n {f : \u03b1 \u2192 \u03b2} (h : NeZero (\u03bc.map f)) :\n AEMeasurable f \u03bc := by\nby_contra h'\n simp [h'] at h\n\nnamespace AEMeasurable\n```\n\n-- snippet 24\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_right_iff (L98-L100)\ntheorem union_right_iff : AEDisjoint \u03bc s (t \u222a u) \u2194 AEDisjoint \u03bc s t \u2227 AEDisjoint \u03bc s u := by\nsimp [union_eq_iUnion, and_comm]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.mono_ac (L53-L55)\nlemma mono_ac (hf : AEMeasurable f \u03bd) (h\u03bc\u03bd : \u03bc \u226a \u03bd) : AEMeasurable f \u03bc :=\n\u27e8hf.mk f, hf.measurable_mk, h\u03bc\u03bd.ae_le hf.ae_eq_mk\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.exists_disjoint_diff (L121-L126)\ntheorem exists_disjoint_diff (h : AEDisjoint \u03bc s t) :\n \u2203 u, MeasurableSet u \u2227 \u03bc u = 0 \u2227 Disjoint (s \\ u) t :=\n\u27e8toMeasurable \u03bc (s \u2229 t), measurableSet_toMeasurable _ _, (measure_toMeasurable _).trans h,\n disjoint_sdiff_self_left.mono_left (b := s \\ t) fun x hx => by\n simpa using \u27e8hx.1, fun hxt => hx.2 <| subset_toMeasurable _ _ \u27e8hx.1, hxt\u27e9\u27e9\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.iUnion_right_iff (L89-L92)\ntheorem iUnion_right_iff {\u03b9 : Sort*} [Countable \u03b9] {t : \u03b9 \u2192 Set \u03b1} :\n AEDisjoint \u03bc s (\u22c3 i, t i) \u2194 \u2200 i, AEDisjoint \u03bc s (t i) := by\nsimp only [AEDisjoint, inter_iUnion, measure_iUnion_null_iff]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_id'' (L41-L44)\ntheorem aemeasurable_id'' (\u03bc : Measure \u03b1) {m : MeasurableSpace \u03b1} (hm : m \u2264 m0) :\n @AEMeasurable \u03b1 \u03b1 m m0 id \u03bc :=\n@Measurable.aemeasurable \u03b1 \u03b1 m0 m id \u03bc (measurable_id'' hm)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.exists_null_pairwise_disjoint_diff (L35-L53)\ntheorem exists_null_pairwise_disjoint_diff [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1}\n (hd : Pairwise (AEDisjoint \u03bc on s)) : \u2203 t : \u03b9 \u2192 Set \u03b1, (\u2200 i, MeasurableSet (t i)) \u2227\n (\u2200 i, \u03bc (t i) = 0) \u2227 Pairwise (Disjoint on fun i => s i \\ t i) := by\nrefine \u27e8fun i => toMeasurable \u03bc (s i \u2229 \u22c3 j \u2208 ({i}\u1d9c : Set \u03b9), s j), fun i =>\n measurableSet_toMeasurable _ _, fun i => ?_, ?_\u27e9\n \u00b7 simp only [measure_toMeasurable, inter_iUnion]\n exact (measure_biUnion_null_iff <| to_countable _).2 fun j hj => hd (Ne.symm hj)\n \u00b7 simp only [Pairwise, disjoint_left, onFun, mem_diff, not_and, and_imp, Classical.not_not]\n intro i j hne x hi hU hj\n replace hU : x \u2209 s i \u2229 iUnion fun j \u21a6 iUnion fun _ \u21a6 s j :=\n fun h \u21a6 hU (subset_toMeasurable _ _ h)\n simp only [mem_inter_iff, mem_iUnion, not_and, not_exists] at hU\n exact (hU hi j hne.symm hj).elim\n\nnamespace AEDisjoint\n\nprotected theorem eq (h : AEDisjoint \u03bc s t) : \u03bc (s \u2229 t) = 0 :=\n h\n```\n\n-- snippet 30\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_of_subsingleton_codomain (L33-L35)\ntheorem aemeasurable_of_subsingleton_codomain [Subsingleton \u03b2] : AEMeasurable f \u03bc :=\n(measurable_of_subsingleton_codomain f).aemeasurable\n```\n\n-- snippet 31\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.measure_diff_right (L116-L120)\ntheorem measure_diff_right (h : AEDisjoint \u03bc s t) : \u03bc (t \\ s) = \u03bc t :=\nmeasure_congr <| AEDisjoint.diff_ae_eq_right h\n\n/-- If `s` and `t` are `\u03bc`-a.e. disjoint, then `s \\ u` and `t` are disjoint for some measurable null\nset `u`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.diff_ae_eq_right (L110-L112)\ntheorem diff_ae_eq_right (h : AEDisjoint \u03bc s t) : (t \\ s : Set \u03b1) =\u1d50[\u03bc] t :=\ndiff_ae_eq_left <| AEDisjoint.symm h\n```\n\n-- snippet 33\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_left_iff (L94-L96)\ntheorem union_left_iff : AEDisjoint \u03bc (s \u222a t) u \u2194 AEDisjoint \u03bc s u \u2227 AEDisjoint \u03bc t u := by\nsimp [union_eq_iUnion, and_comm]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.iUnion_left_iff (L84-L87)\ntheorem iUnion_left_iff {\u03b9 : Sort*} [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1} :\n AEDisjoint \u03bc (\u22c3 i, s i) t \u2194 \u2200 i, AEDisjoint \u03bc (s i) t := by\nsimp only [AEDisjoint, iUnion_inter, measure_iUnion_null_iff]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_right (L104-L106)\ntheorem union_right (ht : AEDisjoint \u03bc s t) (hu : AEDisjoint \u03bc s u) : AEDisjoint \u03bc s (t \u222a u) :=\nunion_right_iff.2 \u27e8ht, hu\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.diff_ae_eq_left (L107-L109)\ntheorem diff_ae_eq_left (h : AEDisjoint \u03bc s t) : (s \\ t : Set \u03b1) =\u1d50[\u03bc] s :=\n@diff_self_inter _ s t \u25b8 diff_null_ae_eq_self h\n```\n\n-- snippet 37\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.aedisjoint_compl_right (L138-L141)\ntheorem aedisjoint_compl_right : AEDisjoint \u03bc s s\u1d9c :=\n(@disjoint_compl_right _ _ s).aedisjoint\n\nend MeasureTheory\n```\n\n-- snippet 38\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.aedisjoint_compl_left (L135-L137)\ntheorem aedisjoint_compl_left : AEDisjoint \u03bc s\u1d9c s :=\n(@disjoint_compl_left _ _ s).aedisjoint\n```\n\n-- snippet 39\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_zero_measure (L37-L40)\ntheorem aemeasurable_zero_measure : AEMeasurable f (0 : Measure \u03b1) := by\nnontriviality \u03b1; inhabit \u03b1\n exact \u27e8fun _ => f default, measurable_const, rfl\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.mono_ae (L73-L82)\ntheorem mono_ae (h : AEDisjoint \u03bc s t) (hu : u \u2264\u1d50[\u03bc] s) (hv : v \u2264\u1d50[\u03bc] t) : AEDisjoint \u03bc u v :=\nmeasure_mono_null_ae (hu.inter hv) h\n\nprotected theorem mono (h : AEDisjoint \u03bc s t) (hu : u \u2286 s) (hv : v \u2286 t) : AEDisjoint \u03bc u v :=\n mono_ae h (HasSubset.Subset.eventuallyLE hu) (HasSubset.Subset.eventuallyLE hv)\n\nprotected theorem congr (h : AEDisjoint \u03bc s t) (hu : u =\u1d50[\u03bc] s) (hv : v =\u1d50[\u03bc] t) :\n AEDisjoint \u03bc u v :=\n mono_ae h (Filter.EventuallyEq.le hu) (Filter.EventuallyEq.le hv)\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.MeasureSpace).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Ioc_ae_eq_Icc' (ha : \u03bc {a} = 0) : Ioc a b =\u1d50[\u03bc] Icc a b\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.ae_isMeasurablyGenerated (L102-L107)\ninstance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae \u03bc) :=\n\u27e8fun _s hs =>\n let \u27e8t, hst, htm, ht\u03bc\u27e9 := exists_measurable_superset_of_null hs\n \u27e8t\u1d9c, compl_mem_ae_iff.2 ht\u03bc, htm.compl, compl_subset_comm.1 hst\u27e9\u27e9\n\n/-- See also `MeasureTheory.ae_restrict_uIoc_iff`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.ae_uIoc_iff (L108-L111)\ntheorem ae_uIoc_iff [LinearOrder \u03b1] {a b : \u03b1} {P : \u03b1 \u2192 Prop} :\n (\u2200\u1d50 x \u2202\u03bc, x \u2208 \u0399 a b \u2192 P x) \u2194 (\u2200\u1d50 x \u2202\u03bc, x \u2208 Ioc a b \u2192 P x) \u2227 \u2200\u1d50 x \u2202\u03bc, x \u2208 Ioc b a \u2192 P x := by\nsimp only [uIoc_eq_union, mem_union, or_imp, eventually_and]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union (L112-L114)\ntheorem measure_union (hd : Disjoint s\u2081 s\u2082) (h : MeasurableSet s\u2082) : \u03bc (s\u2081 \u222a s\u2082) = \u03bc s\u2081 + \u03bc s\u2082 :=\nmeasure_union\u2080 h.nullMeasurableSet hd.aedisjoint\n```\n\n-- snippet 4\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union' (L115-L117)\ntheorem measure_union' (hd : Disjoint s\u2081 s\u2082) (h : MeasurableSet s\u2081) : \u03bc (s\u2081 \u222a s\u2082) = \u03bc s\u2081 + \u03bc s\u2082 :=\nmeasure_union\u2080' h.nullMeasurableSet hd.aedisjoint\n```\n\n-- snippet 5\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_inter_add_diff (L118-L120)\ntheorem measure_inter_add_diff (s : Set \u03b1) (ht : MeasurableSet t) : \u03bc (s \u2229 t) + \u03bc (s \\ t) = \u03bc s :=\nmeasure_inter_add_diff\u2080 _ ht.nullMeasurableSet\n```\n\n-- snippet 6\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_add_inter (L121-L123)\ntheorem measure_diff_add_inter (s : Set \u03b1) (ht : MeasurableSet t) : \u03bc (s \\ t) + \u03bc (s \u2229 t) = \u03bc s :=\n(add_comm _ _).trans (measure_inter_add_diff s ht)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_eq_top (L124-L128)\ntheorem measure_diff_eq_top (hs : \u03bc s = \u221e) (ht : \u03bc t \u2260 \u221e) : \u03bc (s \\ t) = \u221e := by\ncontrapose! hs\n exact ((measure_mono (subset_diff_union s t)).trans_lt\n ((measure_union_le _ _).trans_lt (ENNReal.add_lt_top.2 \u27e8hs.lt_top, ht.lt_top\u27e9))).ne\n```\n\n-- snippet 8\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union_add_inter (L129-L134)\ntheorem measure_union_add_inter (s : Set \u03b1) (ht : MeasurableSet t) :\n \u03bc (s \u222a t) + \u03bc (s \u2229 t) = \u03bc s + \u03bc t := by\nrw [\u2190 measure_inter_add_diff (s \u222a t) ht, Set.union_inter_cancel_right, union_diff_right, \u2190\n measure_inter_add_diff s ht]\n ac_rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_union_add_inter' (L135-L138)\ntheorem measure_union_add_inter' (hs : MeasurableSet s) (t : Set \u03b1) :\n \u03bc (s \u222a t) + \u03bc (s \u2229 t) = \u03bc s + \u03bc t := by\nrw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_symmDiff_eq (L139-L143)\nlemma measure_symmDiff_eq (hs : NullMeasurableSet s \u03bc) (ht : NullMeasurableSet t \u03bc) :\n \u03bc (s \u2206 t) = \u03bc (s \\ t) + \u03bc (t \\ s) := by\nsimpa only [symmDiff_def, sup_eq_union]\n using measure_union\u2080 (ht.diff hs) disjoint_sdiff_sdiff.aedisjoint\n```\n\n-- snippet 11\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_symmDiff_le (L144-L147)\nlemma measure_symmDiff_le (s t u : Set \u03b1) :\n \u03bc (s \u2206 u) \u2264 \u03bc (s \u2206 t) + \u03bc (t \u2206 u) :=\nle_trans (\u03bc.mono <| symmDiff_triangle s t u) (measure_union_le (s \u2206 t) (t \u2206 u))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_symmDiff_eq_top (L148-L150)\ntheorem measure_symmDiff_eq_top (hs : \u03bc s \u2260 \u221e) (ht : \u03bc t = \u221e) : \u03bc (s \u2206 t) = \u221e :=\nmeasure_mono_top subset_union_right (measure_diff_eq_top ht hs)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_add_measure_compl (L151-L153)\ntheorem measure_add_measure_compl (h : MeasurableSet s) : \u03bc s + \u03bc s\u1d9c = \u03bc univ :=\nmeasure_add_measure_compl\u2080 h.nullMeasurableSet\n```\n\n-- snippet 14\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_biUnion\u2080 (L154-L160)\ntheorem measure_biUnion\u2080 {s : Set \u03b2} {f : \u03b2 \u2192 Set \u03b1} (hs : s.Countable)\n (hd : s.Pairwise (AEDisjoint \u03bc on f)) (h : \u2200 b \u2208 s, NullMeasurableSet (f b) \u03bc) :\n \u03bc (\u22c3 b \u2208 s, f b) = \u2211' p : s, \u03bc (f p) := by\nhaveI := hs.toEncodable\n rw [biUnion_eq_iUnion]\n exact measure_iUnion\u2080 (hd.on_injective Subtype.coe_injective fun x => x.2) fun x => h x x.2\n```\n\n-- snippet 15\n```lean\n-- Mathlib.MeasureTheory.Measure.MeasureSpace.measure_biUnion (L161-L164)\ntheorem measure_biUnion {s : Set \u03b2} {f : \u03b2 \u2192 Set \u03b1} (hs : s.Countable) (hd : s.PairwiseDisjoint f)\n (h : \u2200 b \u2208 s, MeasurableSet (f b)) : \u03bc (\u22c3 b \u2208 s, f b) = \u2211' p : s, \u03bc (f p) :=\nmeasure_biUnion\u2080 hs hd.aedisjoint fun b hb => (h b hb).nullMeasurableSet\n```\n\n-- snippet 16\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_left (L101-L103)\ntheorem union_left (hs : AEDisjoint \u03bc s u) (ht : AEDisjoint \u03bc t u) : AEDisjoint \u03bc (s \u222a t) u :=\nunion_left_iff.mpr \u27e8hs, ht\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.of_null_left (L130-L134)\ntheorem of_null_left (h : \u03bc s = 0) : AEDisjoint \u03bc s t :=\nAEDisjoint.symm (of_null_right h)\n\nend AEDisjoint\n```\n\n-- snippet 18\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.AEDisjoint (L28-L34)\ndef AEDisjoint (s t : Set \u03b1) :=\n\u03bc (s \u2229 t) = 0\n\nvariable {\u03bc} {s t u v : Set \u03b1}\n\n/-- If `s : \u03b9 \u2192 Set \u03b1` is a countable family of pairwise a.e. disjoint sets, then there exists a\nfamily of measurable null sets `t i` such that `s i \\ t i` are pairwise disjoint. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.mono_measure (L56-L58)\ntheorem mono_measure (h : AEMeasurable f \u03bc) (h' : \u03bd \u2264 \u03bc) : AEMeasurable f \u03bd :=\nmono_ac h h'.absolutelyContinuous\n```\n\n-- snippet 20\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.of_null_right (L127-L129)\ntheorem of_null_right (h : \u03bc t = 0) : AEDisjoint \u03bc s t :=\nmeasure_mono_null inter_subset_right h\n```\n\n-- snippet 21\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.Subsingleton (L29-L31)\ntheorem Subsingleton.aemeasurable [Subsingleton \u03b1] : AEMeasurable f \u03bc :=\nSubsingleton.measurable.aemeasurable\n```\n\n-- snippet 22\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.measure_diff_left (L113-L115)\ntheorem measure_diff_left (h : AEDisjoint \u03bc s t) : \u03bc (s \\ t) = \u03bc s :=\nmeasure_congr <| AEDisjoint.diff_ae_eq_left h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_of_map_neZero (L45-L52)\nlemma aemeasurable_of_map_neZero {\u03bc : Measure \u03b1}\n {f : \u03b1 \u2192 \u03b2} (h : NeZero (\u03bc.map f)) :\n AEMeasurable f \u03bc := by\nby_contra h'\n simp [h'] at h\n\nnamespace AEMeasurable\n```\n\n-- snippet 24\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_right_iff (L98-L100)\ntheorem union_right_iff : AEDisjoint \u03bc s (t \u222a u) \u2194 AEDisjoint \u03bc s t \u2227 AEDisjoint \u03bc s u := by\nsimp [union_eq_iUnion, and_comm]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.mono_ac (L53-L55)\nlemma mono_ac (hf : AEMeasurable f \u03bd) (h\u03bc\u03bd : \u03bc \u226a \u03bd) : AEMeasurable f \u03bc :=\n\u27e8hf.mk f, hf.measurable_mk, h\u03bc\u03bd.ae_le hf.ae_eq_mk\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.exists_disjoint_diff (L121-L126)\ntheorem exists_disjoint_diff (h : AEDisjoint \u03bc s t) :\n \u2203 u, MeasurableSet u \u2227 \u03bc u = 0 \u2227 Disjoint (s \\ u) t :=\n\u27e8toMeasurable \u03bc (s \u2229 t), measurableSet_toMeasurable _ _, (measure_toMeasurable _).trans h,\n disjoint_sdiff_self_left.mono_left (b := s \\ t) fun x hx => by\n simpa using \u27e8hx.1, fun hxt => hx.2 <| subset_toMeasurable _ _ \u27e8hx.1, hxt\u27e9\u27e9\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.iUnion_right_iff (L89-L92)\ntheorem iUnion_right_iff {\u03b9 : Sort*} [Countable \u03b9] {t : \u03b9 \u2192 Set \u03b1} :\n AEDisjoint \u03bc s (\u22c3 i, t i) \u2194 \u2200 i, AEDisjoint \u03bc s (t i) := by\nsimp only [AEDisjoint, inter_iUnion, measure_iUnion_null_iff]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_id'' (L41-L44)\ntheorem aemeasurable_id'' (\u03bc : Measure \u03b1) {m : MeasurableSpace \u03b1} (hm : m \u2264 m0) :\n @AEMeasurable \u03b1 \u03b1 m m0 id \u03bc :=\n@Measurable.aemeasurable \u03b1 \u03b1 m0 m id \u03bc (measurable_id'' hm)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.exists_null_pairwise_disjoint_diff (L35-L53)\ntheorem exists_null_pairwise_disjoint_diff [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1}\n (hd : Pairwise (AEDisjoint \u03bc on s)) : \u2203 t : \u03b9 \u2192 Set \u03b1, (\u2200 i, MeasurableSet (t i)) \u2227\n (\u2200 i, \u03bc (t i) = 0) \u2227 Pairwise (Disjoint on fun i => s i \\ t i) := by\nrefine \u27e8fun i => toMeasurable \u03bc (s i \u2229 \u22c3 j \u2208 ({i}\u1d9c : Set \u03b9), s j), fun i =>\n measurableSet_toMeasurable _ _, fun i => ?_, ?_\u27e9\n \u00b7 simp only [measure_toMeasurable, inter_iUnion]\n exact (measure_biUnion_null_iff <| to_countable _).2 fun j hj => hd (Ne.symm hj)\n \u00b7 simp only [Pairwise, disjoint_left, onFun, mem_diff, not_and, and_imp, Classical.not_not]\n intro i j hne x hi hU hj\n replace hU : x \u2209 s i \u2229 iUnion fun j \u21a6 iUnion fun _ \u21a6 s j :=\n fun h \u21a6 hU (subset_toMeasurable _ _ h)\n simp only [mem_inter_iff, mem_iUnion, not_and, not_exists] at hU\n exact (hU hi j hne.symm hj).elim\n\nnamespace AEDisjoint\n\nprotected theorem eq (h : AEDisjoint \u03bc s t) : \u03bc (s \u2229 t) = 0 :=\n h\n```\n\n-- snippet 30\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_of_subsingleton_codomain (L33-L35)\ntheorem aemeasurable_of_subsingleton_codomain [Subsingleton \u03b2] : AEMeasurable f \u03bc :=\n(measurable_of_subsingleton_codomain f).aemeasurable\n```\n\n-- snippet 31\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.measure_diff_right (L116-L120)\ntheorem measure_diff_right (h : AEDisjoint \u03bc s t) : \u03bc (t \\ s) = \u03bc t :=\nmeasure_congr <| AEDisjoint.diff_ae_eq_right h\n\n/-- If `s` and `t` are `\u03bc`-a.e. disjoint, then `s \\ u` and `t` are disjoint for some measurable null\nset `u`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.diff_ae_eq_right (L110-L112)\ntheorem diff_ae_eq_right (h : AEDisjoint \u03bc s t) : (t \\ s : Set \u03b1) =\u1d50[\u03bc] t :=\ndiff_ae_eq_left <| AEDisjoint.symm h\n```\n\n-- snippet 33\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_left_iff (L94-L96)\ntheorem union_left_iff : AEDisjoint \u03bc (s \u222a t) u \u2194 AEDisjoint \u03bc s u \u2227 AEDisjoint \u03bc t u := by\nsimp [union_eq_iUnion, and_comm]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.iUnion_left_iff (L84-L87)\ntheorem iUnion_left_iff {\u03b9 : Sort*} [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1} :\n AEDisjoint \u03bc (\u22c3 i, s i) t \u2194 \u2200 i, AEDisjoint \u03bc (s i) t := by\nsimp only [AEDisjoint, iUnion_inter, measure_iUnion_null_iff]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.union_right (L104-L106)\ntheorem union_right (ht : AEDisjoint \u03bc s t) (hu : AEDisjoint \u03bc s u) : AEDisjoint \u03bc s (t \u222a u) :=\nunion_right_iff.2 \u27e8ht, hu\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.diff_ae_eq_left (L107-L109)\ntheorem diff_ae_eq_left (h : AEDisjoint \u03bc s t) : (s \\ t : Set \u03b1) =\u1d50[\u03bc] s :=\n@diff_self_inter _ s t \u25b8 diff_null_ae_eq_self h\n```\n\n-- snippet 37\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.aedisjoint_compl_right (L138-L141)\ntheorem aedisjoint_compl_right : AEDisjoint \u03bc s s\u1d9c :=\n(@disjoint_compl_right _ _ s).aedisjoint\n\nend MeasureTheory\n```\n\n-- snippet 38\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.aedisjoint_compl_left (L135-L137)\ntheorem aedisjoint_compl_left : AEDisjoint \u03bc s\u1d9c s :=\n(@disjoint_compl_left _ _ s).aedisjoint\n```\n\n-- snippet 39\n```lean\n-- Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_zero_measure (L37-L40)\ntheorem aemeasurable_zero_measure : AEMeasurable f (0 : Measure \u03b1) := by\nnontriviality \u03b1; inhabit \u03b1\n exact \u27e8fun _ => f default, measurable_const, rfl\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.MeasureTheory.Measure.AEDisjoint.mono_ae (L73-L82)\ntheorem mono_ae (h : AEDisjoint \u03bc s t) (hu : u \u2264\u1d50[\u03bc] s) (hv : v \u2264\u1d50[\u03bc] t) : AEDisjoint \u03bc u v :=\nmeasure_mono_null_ae (hu.inter hv) h\n\nprotected theorem mono (h : AEDisjoint \u03bc s t) (hu : u \u2286 s) (hv : v \u2286 t) : AEDisjoint \u03bc u v :=\n mono_ae h (HasSubset.Subset.eventuallyLE hu) (HasSubset.Subset.eventuallyLE hv)\n\nprotected theorem congr (h : AEDisjoint \u03bc s t) (hu : u =\u1d50[\u03bc] s) (hv : v =\u1d50[\u03bc] t) :\n AEDisjoint \u03bc u v :=\n mono_ae h (Filter.EventuallyEq.le hu) (Filter.EventuallyEq.le hv)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/MeasureSpace.lean", "module": "Mathlib.MeasureTheory.Measure.MeasureSpace", "declaration": "Mathlib.MeasureTheory.Measure.MeasureSpace.Ioc_ae_eq_Icc'", "span": "L1439-L1441", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/MeasureSpace.lean#L1439"}, "environment": {}, "measurements": {"input_tokens": 4973, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 12512, "lean_code_chars": 11001, "natural_language_chars": 1511, "lean_code_ratio": 0.8792, "line_count": 353, "imports_count": 0, "declarations_count": 1196, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "9c4a5689c97e0975", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.pullback", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance pullback.snd_of_mono {X Y Z : C} {f : X \u27f6 Z} {g : Y \u27f6 Z} [HasPullback f g] [Mono f] :\n Mono (pullback.snd f g)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_snd_of_is_pullback_of_mono (L50-L56)\ntheorem mono_snd_of_is_pullback_of_mono {t : PullbackCone f g} (ht : IsLimit t) [Mono f] :\n Mono t.snd := by\nrefine \u27e8fun {W} h k i => IsLimit.hom_ext ht ?_ i\u27e9\n rw [\u2190 cancel_mono f, Category.assoc, Category.assoc, condition]\n apply reassoc_of% i\n\n/-- Monomorphisms are stable under pullback in the second argument. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_fst_of_is_pullback_of_mono (L57-L66)\ntheorem mono_fst_of_is_pullback_of_mono {t : PullbackCone f g} (ht : IsLimit t) [Mono g] :\n Mono t.fst := by\nrefine \u27e8fun {W} h k i => IsLimit.hom_ext ht i ?_\u27e9\n rw [\u2190 cancel_mono g, Category.assoc, Category.assoc, \u2190 condition]\n apply reassoc_of% i\n\n/--\nThe pullback cone `(\ud835\udfd9 X, \ud835\udfd9 X)` for the pair `(f, f)` is a limit if `f` is a mono. The converse is\nshown in `mono_of_pullback_is_id`.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.isLimitMkIdId (L67-L75)\ndef isLimitMkIdId (f : X \u27f6 Y) [Mono f] : IsLimit (mk (\ud835\udfd9 X) (\ud835\udfd9 X) rfl : PullbackCone f f) :=\nIsLimit.mk _ (fun s => s.fst) (fun _ => Category.comp_id _)\n (fun s => by rw [\u2190 cancel_mono f, Category.comp_id, s.condition]) fun s m m\u2081 _ => by\n simpa using m\u2081\n\n/--\n`f` is a mono if the pullback cone `(\ud835\udfd9 X, \ud835\udfd9 X)` is a limit for the pair `(f, f)`. The converse is\ngiven in `PullbackCone.is_id_of_mono`.\n-/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_of_isLimitMkIdId (L76-L85)\ntheorem mono_of_isLimitMkIdId (f : X \u27f6 Y) (t : IsLimit (mk (\ud835\udfd9 X) (\ud835\udfd9 X) rfl : PullbackCone f f)) :\n Mono f :=\n\u27e8fun {Z} g h eq => by\n rcases PullbackCone.IsLimit.lift' t _ _ eq with \u27e8_, rfl, rfl\u27e9\n rfl\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Suppose `f` and `g` are two morphisms with a common codomain and `s` is a limit cone over the\ndiagram formed by `f` and `g`. Suppose `f` and `g` both factor through a monomorphism `h` via\n`x` and `y`, respectively. Then `s` is also a limit cone over the diagram formed by `x` and `y`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.isLimitOfFactors (L86-L104)\ndef isLimitOfFactors (f : X \u27f6 Z) (g : Y \u27f6 Z) (h : W \u27f6 Z) [Mono h] (x : X \u27f6 W) (y : Y \u27f6 W)\n (hxh : x \u226b h = f) (hyh : y \u226b h = g) (s : PullbackCone f g) (hs : IsLimit s) :\n IsLimit\n (PullbackCone.mk _ _\n (show s.fst \u226b x = s.snd \u226b y from\n (cancel_mono h).1 <| by simp only [Category.assoc, hxh, hyh, s.condition])) :=\nPullbackCone.isLimitAux' _ fun t =>\n have : fst t \u226b x \u226b h = snd t \u226b y \u226b h := by -- Porting note: reassoc workaround\n rw [\u2190 Category.assoc, \u2190 Category.assoc]\n apply congrArg (\u00b7 \u226b h) t.condition\n \u27e8hs.lift (PullbackCone.mk t.fst t.snd <| by rw [\u2190 hxh, \u2190 hyh, this]),\n \u27e8hs.fac _ WalkingCospan.left, hs.fac _ WalkingCospan.right, fun hr hr' => by\n apply PullbackCone.IsLimit.hom_ext hs <;>\n simp only [PullbackCone.mk_fst, PullbackCone.mk_snd] at hr hr' \u22a2 <;>\n simp only [hr, hr'] <;>\n symm\n exacts [hs.fac _ WalkingCospan.left, hs.fac _ WalkingCospan.right]\u27e9\u27e9\n\n/-- If `W` is the pullback of `f, g`, it is also the pullback of `f \u226b i, g \u226b i` for any mono `i`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.isLimitOfCompMono (L105-L124)\ndef isLimitOfCompMono (f : X \u27f6 W) (g : Y \u27f6 W) (i : W \u27f6 Z) [Mono i] (s : PullbackCone f g)\n (H : IsLimit s) :\n IsLimit\n (PullbackCone.mk _ _\n (show s.fst \u226b f \u226b i = s.snd \u226b g \u226b i by\n rw [\u2190 Category.assoc, \u2190 Category.assoc, s.condition])) := by\napply PullbackCone.isLimitAux'\n intro s\n rcases PullbackCone.IsLimit.lift' H s.fst s.snd\n ((cancel_mono i).mp (by simpa using s.condition)) with\n \u27e8l, h\u2081, h\u2082\u27e9\n refine \u27e8l, h\u2081, h\u2082, ?_\u27e9\n intro m hm\u2081 hm\u2082\n exact (PullbackCone.IsLimit.hom_ext H (hm\u2081.trans h\u2081.symm) (hm\u2082.trans h\u2082.symm) :)\n\nend PullbackCone\n\nend Monomorphisms\n\n/-- The pullback of a monomorphism is a monomorphism -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_pullback_to_prod (L136-L151)\ninstance mono_pullback_to_prod {C : Type*} [Category* C] {X Y Z : C} (f : X \u27f6 Z) (g : Y \u27f6 Z)\n [HasPullback f g] [HasBinaryProduct X Y] :\n Mono (prod.lift (pullback.fst f g) (pullback.snd f g)) :=\n\u27e8fun {W} i\u2081 i\u2082 h => by\n ext\n \u00b7 simpa using congrArg (fun f => f \u226b prod.fst) h\n \u00b7 simpa using congrArg (fun f => f \u226b prod.snd) h\u27e9\n\n/-- The pullback of `f, g` is also the pullback of `f \u226b i, g \u226b i` for any mono `i`. -/\nnoncomputable def pullbackIsPullbackOfCompMono (f : X \u27f6 W) (g : Y \u27f6 W) (i : W \u27f6 Z) [Mono i]\n [HasPullback f g] : IsLimit (PullbackCone.mk (pullback.fst f g) (pullback.snd f g)\n -- Porting note: following used to be _\n (show (pullback.fst f g) \u226b f \u226b i = (pullback.snd f g) \u226b g \u226b i by\n simp only [\u2190 Category.assoc]; rw [cancel_mono]; apply pullback.condition)) :=\n PullbackCone.isLimitOfCompMono f g i _ (limit.isLimit (cospan f g))\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.hasPullback_of_comp_mono (L152-L155)\ninstance hasPullback_of_comp_mono (f : X \u27f6 W) (g : Y \u27f6 W) (i : W \u27f6 Z) [Mono i] [HasPullback f g] :\n HasPullback (f \u226b i) (g \u226b i) :=\n\u27e8\u27e8\u27e8_, pullbackIsPullbackOfCompMono f g i\u27e9\u27e9\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.hasPullback_of_right_factors_mono (L162-L164)\ninstance hasPullback_of_right_factors_mono : HasPullback i (f \u226b i) := by\nsimpa only [Category.id_comp] using hasPullback_of_comp_mono (\ud835\udfd9 Z) f i\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.pullback_snd_iso_of_right_factors_mono (L165-L171)\ninstance pullback_snd_iso_of_right_factors_mono :\n IsIso (pullback.snd i (f \u226b i)) := by\nhave := limit.isoLimitCone_hom_\u03c0 \u27e8_, pullbackIsPullbackOfCompMono (\ud835\udfd9 _) f i\u27e9 WalkingCospan.right\n convert (congrArg IsIso (show _ \u226b pullback.snd (\ud835\udfd9 Z) f = _ from this)).mp inferInstance\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.hasPullback_of_left_factors_mono (L174-L176)\ninstance hasPullback_of_left_factors_mono : HasPullback (f \u226b i) i := by\nsimpa only [Category.id_comp] using hasPullback_of_comp_mono f (\ud835\udfd9 Z) i\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.pullback_snd_iso_of_left_factors_mono (L177-L183)\ninstance pullback_snd_iso_of_left_factors_mono :\n IsIso (pullback.fst (f \u226b i) i) := by\nhave := limit.isoLimitCone_hom_\u03c0 \u27e8_, pullbackIsPullbackOfCompMono f (\ud835\udfd9 _) i\u27e9 WalkingCospan.left\n convert (congrArg IsIso (show _ \u226b pullback.fst f (\ud835\udfd9 Z) = _ from this)).mp inferInstance\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.has_kernel_pair_of_mono (L192-L194)\ninstance has_kernel_pair_of_mono : HasPullback f f :=\n\u27e8\u27e8\u27e8_, PullbackCone.isLimitMkIdId f\u27e9\u27e9\u27e9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.PullbackCone (L195-L198)\ntheorem PullbackCone.fst_eq_snd_of_mono_eq {f : X \u27f6 Y} [Mono f] (t : PullbackCone f f) :\n t.fst = t.snd :=\n(cancel_mono f).1 t.condition\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.fst_eq_snd_of_mono_eq (L199-L201)\ntheorem fst_eq_snd_of_mono_eq : pullback.fst f f = pullback.snd f f :=\nPullbackCone.fst_eq_snd_of_mono_eq (getLimitCone (cospan f f)).cone\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in\n```\n\n-- snippet 39\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance pullback.snd_of_mono {X Y Z : C} {f : X \u27f6 Z} {g : Y \u27f6 Z} [HasPullback f g] [Mono f] :\n Mono (pullback.snd f g)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_snd_of_is_pullback_of_mono (L50-L56)\ntheorem mono_snd_of_is_pullback_of_mono {t : PullbackCone f g} (ht : IsLimit t) [Mono f] :\n Mono t.snd := by\nrefine \u27e8fun {W} h k i => IsLimit.hom_ext ht ?_ i\u27e9\n rw [\u2190 cancel_mono f, Category.assoc, Category.assoc, condition]\n apply reassoc_of% i\n\n/-- Monomorphisms are stable under pullback in the second argument. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_fst_of_is_pullback_of_mono (L57-L66)\ntheorem mono_fst_of_is_pullback_of_mono {t : PullbackCone f g} (ht : IsLimit t) [Mono g] :\n Mono t.fst := by\nrefine \u27e8fun {W} h k i => IsLimit.hom_ext ht i ?_\u27e9\n rw [\u2190 cancel_mono g, Category.assoc, Category.assoc, \u2190 condition]\n apply reassoc_of% i\n\n/--\nThe pullback cone `(\ud835\udfd9 X, \ud835\udfd9 X)` for the pair `(f, f)` is a limit if `f` is a mono. The converse is\nshown in `mono_of_pullback_is_id`.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.isLimitMkIdId (L67-L75)\ndef isLimitMkIdId (f : X \u27f6 Y) [Mono f] : IsLimit (mk (\ud835\udfd9 X) (\ud835\udfd9 X) rfl : PullbackCone f f) :=\nIsLimit.mk _ (fun s => s.fst) (fun _ => Category.comp_id _)\n (fun s => by rw [\u2190 cancel_mono f, Category.comp_id, s.condition]) fun s m m\u2081 _ => by\n simpa using m\u2081\n\n/--\n`f` is a mono if the pullback cone `(\ud835\udfd9 X, \ud835\udfd9 X)` is a limit for the pair `(f, f)`. The converse is\ngiven in `PullbackCone.is_id_of_mono`.\n-/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_of_isLimitMkIdId (L76-L85)\ntheorem mono_of_isLimitMkIdId (f : X \u27f6 Y) (t : IsLimit (mk (\ud835\udfd9 X) (\ud835\udfd9 X) rfl : PullbackCone f f)) :\n Mono f :=\n\u27e8fun {Z} g h eq => by\n rcases PullbackCone.IsLimit.lift' t _ _ eq with \u27e8_, rfl, rfl\u27e9\n rfl\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Suppose `f` and `g` are two morphisms with a common codomain and `s` is a limit cone over the\ndiagram formed by `f` and `g`. Suppose `f` and `g` both factor through a monomorphism `h` via\n`x` and `y`, respectively. Then `s` is also a limit cone over the diagram formed by `x` and `y`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.isLimitOfFactors (L86-L104)\ndef isLimitOfFactors (f : X \u27f6 Z) (g : Y \u27f6 Z) (h : W \u27f6 Z) [Mono h] (x : X \u27f6 W) (y : Y \u27f6 W)\n (hxh : x \u226b h = f) (hyh : y \u226b h = g) (s : PullbackCone f g) (hs : IsLimit s) :\n IsLimit\n (PullbackCone.mk _ _\n (show s.fst \u226b x = s.snd \u226b y from\n (cancel_mono h).1 <| by simp only [Category.assoc, hxh, hyh, s.condition])) :=\nPullbackCone.isLimitAux' _ fun t =>\n have : fst t \u226b x \u226b h = snd t \u226b y \u226b h := by -- Porting note: reassoc workaround\n rw [\u2190 Category.assoc, \u2190 Category.assoc]\n apply congrArg (\u00b7 \u226b h) t.condition\n \u27e8hs.lift (PullbackCone.mk t.fst t.snd <| by rw [\u2190 hxh, \u2190 hyh, this]),\n \u27e8hs.fac _ WalkingCospan.left, hs.fac _ WalkingCospan.right, fun hr hr' => by\n apply PullbackCone.IsLimit.hom_ext hs <;>\n simp only [PullbackCone.mk_fst, PullbackCone.mk_snd] at hr hr' \u22a2 <;>\n simp only [hr, hr'] <;>\n symm\n exacts [hs.fac _ WalkingCospan.left, hs.fac _ WalkingCospan.right]\u27e9\u27e9\n\n/-- If `W` is the pullback of `f, g`, it is also the pullback of `f \u226b i, g \u226b i` for any mono `i`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.isLimitOfCompMono (L105-L124)\ndef isLimitOfCompMono (f : X \u27f6 W) (g : Y \u27f6 W) (i : W \u27f6 Z) [Mono i] (s : PullbackCone f g)\n (H : IsLimit s) :\n IsLimit\n (PullbackCone.mk _ _\n (show s.fst \u226b f \u226b i = s.snd \u226b g \u226b i by\n rw [\u2190 Category.assoc, \u2190 Category.assoc, s.condition])) := by\napply PullbackCone.isLimitAux'\n intro s\n rcases PullbackCone.IsLimit.lift' H s.fst s.snd\n ((cancel_mono i).mp (by simpa using s.condition)) with\n \u27e8l, h\u2081, h\u2082\u27e9\n refine \u27e8l, h\u2081, h\u2082, ?_\u27e9\n intro m hm\u2081 hm\u2082\n exact (PullbackCone.IsLimit.hom_ext H (hm\u2081.trans h\u2081.symm) (hm\u2082.trans h\u2082.symm) :)\n\nend PullbackCone\n\nend Monomorphisms\n\n/-- The pullback of a monomorphism is a monomorphism -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.mono_pullback_to_prod (L136-L151)\ninstance mono_pullback_to_prod {C : Type*} [Category* C] {X Y Z : C} (f : X \u27f6 Z) (g : Y \u27f6 Z)\n [HasPullback f g] [HasBinaryProduct X Y] :\n Mono (prod.lift (pullback.fst f g) (pullback.snd f g)) :=\n\u27e8fun {W} i\u2081 i\u2082 h => by\n ext\n \u00b7 simpa using congrArg (fun f => f \u226b prod.fst) h\n \u00b7 simpa using congrArg (fun f => f \u226b prod.snd) h\u27e9\n\n/-- The pullback of `f, g` is also the pullback of `f \u226b i, g \u226b i` for any mono `i`. -/\nnoncomputable def pullbackIsPullbackOfCompMono (f : X \u27f6 W) (g : Y \u27f6 W) (i : W \u27f6 Z) [Mono i]\n [HasPullback f g] : IsLimit (PullbackCone.mk (pullback.fst f g) (pullback.snd f g)\n -- Porting note: following used to be _\n (show (pullback.fst f g) \u226b f \u226b i = (pullback.snd f g) \u226b g \u226b i by\n simp only [\u2190 Category.assoc]; rw [cancel_mono]; apply pullback.condition)) :=\n PullbackCone.isLimitOfCompMono f g i _ (limit.isLimit (cospan f g))\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.hasPullback_of_comp_mono (L152-L155)\ninstance hasPullback_of_comp_mono (f : X \u27f6 W) (g : Y \u27f6 W) (i : W \u27f6 Z) [Mono i] [HasPullback f g] :\n HasPullback (f \u226b i) (g \u226b i) :=\n\u27e8\u27e8\u27e8_, pullbackIsPullbackOfCompMono f g i\u27e9\u27e9\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.hasPullback_of_right_factors_mono (L162-L164)\ninstance hasPullback_of_right_factors_mono : HasPullback i (f \u226b i) := by\nsimpa only [Category.id_comp] using hasPullback_of_comp_mono (\ud835\udfd9 Z) f i\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.pullback_snd_iso_of_right_factors_mono (L165-L171)\ninstance pullback_snd_iso_of_right_factors_mono :\n IsIso (pullback.snd i (f \u226b i)) := by\nhave := limit.isoLimitCone_hom_\u03c0 \u27e8_, pullbackIsPullbackOfCompMono (\ud835\udfd9 _) f i\u27e9 WalkingCospan.right\n convert (congrArg IsIso (show _ \u226b pullback.snd (\ud835\udfd9 Z) f = _ from this)).mp inferInstance\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.hasPullback_of_left_factors_mono (L174-L176)\ninstance hasPullback_of_left_factors_mono : HasPullback (f \u226b i) i := by\nsimpa only [Category.id_comp] using hasPullback_of_comp_mono f (\ud835\udfd9 Z) i\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.pullback_snd_iso_of_left_factors_mono (L177-L183)\ninstance pullback_snd_iso_of_left_factors_mono :\n IsIso (pullback.fst (f \u226b i) i) := by\nhave := limit.isoLimitCone_hom_\u03c0 \u27e8_, pullbackIsPullbackOfCompMono f (\ud835\udfd9 _) i\u27e9 WalkingCospan.left\n convert (congrArg IsIso (show _ \u226b pullback.fst f (\ud835\udfd9 Z) = _ from this)).mp inferInstance\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.has_kernel_pair_of_mono (L192-L194)\ninstance has_kernel_pair_of_mono : HasPullback f f :=\n\u27e8\u27e8\u27e8_, PullbackCone.isLimitMkIdId f\u27e9\u27e9\u27e9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.PullbackCone (L195-L198)\ntheorem PullbackCone.fst_eq_snd_of_mono_eq {f : X \u27f6 Y} [Mono f] (t : PullbackCone f f) :\n t.fst = t.snd :=\n(cancel_mono f).1 t.condition\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.fst_eq_snd_of_mono_eq (L199-L201)\ntheorem fst_eq_snd_of_mono_eq : pullback.fst f f = pullback.snd f f :=\nPullbackCone.fst_eq_snd_of_mono_eq (getLimitCone (cospan f f)).cone\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in\n```\n\n-- snippet 39\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/Pullback/Mono.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.Mono.pullback", "span": "L130-L135", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Pullback/Mono.lean#L130"}, "environment": {}, "measurements": {"input_tokens": 7482, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 20374, "lean_code_chars": 18855, "natural_language_chars": 1519, "lean_code_ratio": 0.9254, "line_count": 560, "imports_count": 0, "declarations_count": 2241, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "07ff8af7ee97794b", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimitsOfSize_of_leftOp", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Preserves.Opposites)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma preservesColimitsOfSize_of_leftOp (F : C \u2964 D\u1d52\u1d56) [PreservesLimitsOfSize.{w, w'} F.leftOp] :\n PreservesColimitsOfSize.{w, w'} F where\n preservesColimitsOfShape {_} _\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_op (L35-L41)\nlemma preservesLimit_op (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D) [PreservesColimit K.leftOp F] :\n PreservesLimit K F.op where\n preserves {_} hc :=\n\u27e8isLimitConeRightOpOfCocone _ (isColimitOfPreserves F (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F.op : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_op (L42-L47)\nlemma preservesLimit_of_op (K : J \u2964 C) (F : C \u2964 D) [PreservesColimit K.op F.op] :\n PreservesLimit K F where\n preserves {_} hc := \u27e8isLimitOfOp (isColimitOfPreserves F.op (IsLimit.op hc))\u27e9\n/-- If `F : C \u2964 D\u1d52\u1d56` preserves colimits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F.leftOp : C\u1d52\u1d56 \u2964 D`\npreserves limits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_leftOp (L48-L54)\nlemma preservesLimit_leftOp (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D\u1d52\u1d56) [PreservesColimit K.leftOp F] :\n PreservesLimit K F.leftOp where\n preserves {_} hc :=\n\u27e8isLimitConeUnopOfCocone _ (isColimitOfPreserves F (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F.leftOp : C\u1d52\u1d56 \u2964 D` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D\u1d52\u1d56` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_leftOp (L55-L61)\nlemma preservesLimit_of_leftOp (K : J \u2964 C) (F : C \u2964 D\u1d52\u1d56) [PreservesColimit K.op F.leftOp] :\n PreservesLimit K F where\n preserves {_} hc :=\n\u27e8isLimitOfCoconeLeftOpOfCone _ (isColimitOfPreserves F.leftOp (IsLimit.op hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.rightOp : C \u2964 D\u1d52\u1d56` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_rightOp (L62-L68)\nlemma preservesLimit_rightOp (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D) [PreservesColimit K.op F] :\n PreservesLimit K F.rightOp where\n preserves {_} hc :=\n\u27e8isLimitConeRightOpOfCocone _ (isColimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.rightOp : C \u2964 D\u1d52\u1d56` preserves colimits of `K.leftOp : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C\u1d52\u1d56 \u2964 D`\npreserves limits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_rightOp (L69-L75)\nlemma preservesLimit_of_rightOp (K : J \u2964 C\u1d52\u1d56) (F : C\u1d52\u1d56 \u2964 D) [PreservesColimit K.leftOp F.rightOp] :\n PreservesLimit K F where\n preserves {_} hc :=\n\u27e8isLimitOfOp (isColimitOfPreserves F.rightOp (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.unop : C \u2964 D` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_unop (L76-L82)\nlemma preservesLimit_unop (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56) [PreservesColimit K.op F] :\n PreservesLimit K F.unop where\n preserves {_} hc :=\n\u27e8isLimitConeUnopOfCocone _ (isColimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.unop : C \u2964 D` preserves colimits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves\nlimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_unop (L83-L89)\nlemma preservesLimit_of_unop (K : J \u2964 C\u1d52\u1d56) (F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56) [PreservesColimit K.leftOp F.unop] :\n PreservesLimit K F where\n preserves {_} hc :=\n\u27e8isLimitOfCoconeLeftOpOfCone _ (isColimitOfPreserves F.unop (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F : C \u2964 D` preserves limits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F.op : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_op (L90-L96)\nlemma preservesColimit_op (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D) [PreservesLimit K.leftOp F] :\n PreservesColimit K F.op where\n preserves {_} hc :=\n\u27e8isColimitCoconeRightOpOfCone _ (isLimitOfPreserves F (isLimitConeLeftOpOfCocone _ hc))\u27e9\n\n/-- If `F.op : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_of_op (L97-L102)\nlemma preservesColimit_of_op (K : J \u2964 C) (F : C \u2964 D) [PreservesLimit K.op F.op] :\n PreservesColimit K F where\n preserves {_} hc := \u27e8isColimitOfOp (isLimitOfPreserves F.op (IsColimit.op hc))\u27e9\n/-- If `F : C \u2964 D\u1d52\u1d56` preserves limits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F.leftOp : C\u1d52\u1d56 \u2964 D` preserves\ncolimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_leftOp (L103-L109)\nlemma preservesColimit_leftOp (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D\u1d52\u1d56) [PreservesLimit K.leftOp F] :\n PreservesColimit K F.leftOp where\n preserves {_} hc :=\n\u27e8isColimitCoconeUnopOfCone _ (isLimitOfPreserves F (isLimitConeLeftOpOfCocone _ hc))\u27e9\n\n/-- If `F.leftOp : C\u1d52\u1d56 \u2964 D` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_of_leftOp (L110-L116)\nlemma preservesColimit_of_leftOp (K : J \u2964 C) (F : C \u2964 D\u1d52\u1d56) [PreservesLimit K.op F.leftOp] :\n PreservesColimit K F where\n preserves {_} hc :=\n\u27e8isColimitOfConeLeftOpOfCocone _ (isLimitOfPreserves F.leftOp (IsColimit.op hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.rightOp : C \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_rightOp (L117-L123)\nlemma preservesColimit_rightOp (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D) [PreservesLimit K.op F] :\n PreservesColimit K F.rightOp where\n preserves {_} hc :=\n\u27e8isColimitCoconeRightOpOfCone _ (isLimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.rightOp : C \u2964 D\u1d52\u1d56` preserves limits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F : C\u1d52\u1d56 \u2964 D`\npreserves colimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_of_rightOp (L124-L130)\nlemma preservesColimit_of_rightOp (K : J \u2964 C\u1d52\u1d56) (F : C\u1d52\u1d56 \u2964 D) [PreservesLimit K.leftOp F.rightOp] :\n PreservesColimit K F where\n preserves {_} hc :=\n\u27e8isColimitOfOp (isLimitOfPreserves F.rightOp (isLimitConeLeftOpOfCocone _ hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.unop : C \u2964 D` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_unop (L131-L137)\nlemma preservesColimit_unop (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56) [PreservesLimit K.op F] :\n PreservesColimit K F.unop where\n preserves {_} hc :=\n\u27e8isColimitCoconeUnopOfCone _ (isLimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.unop : C \u2964 D` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C`, then `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Preserves.Opposites).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma preservesColimitsOfSize_of_leftOp (F : C \u2964 D\u1d52\u1d56) [PreservesLimitsOfSize.{w, w'} F.leftOp] :\n PreservesColimitsOfSize.{w, w'} F where\n preservesColimitsOfShape {_} _\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_op (L35-L41)\nlemma preservesLimit_op (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D) [PreservesColimit K.leftOp F] :\n PreservesLimit K F.op where\n preserves {_} hc :=\n\u27e8isLimitConeRightOpOfCocone _ (isColimitOfPreserves F (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F.op : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_op (L42-L47)\nlemma preservesLimit_of_op (K : J \u2964 C) (F : C \u2964 D) [PreservesColimit K.op F.op] :\n PreservesLimit K F where\n preserves {_} hc := \u27e8isLimitOfOp (isColimitOfPreserves F.op (IsLimit.op hc))\u27e9\n/-- If `F : C \u2964 D\u1d52\u1d56` preserves colimits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F.leftOp : C\u1d52\u1d56 \u2964 D`\npreserves limits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_leftOp (L48-L54)\nlemma preservesLimit_leftOp (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D\u1d52\u1d56) [PreservesColimit K.leftOp F] :\n PreservesLimit K F.leftOp where\n preserves {_} hc :=\n\u27e8isLimitConeUnopOfCocone _ (isColimitOfPreserves F (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F.leftOp : C\u1d52\u1d56 \u2964 D` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D\u1d52\u1d56` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_leftOp (L55-L61)\nlemma preservesLimit_of_leftOp (K : J \u2964 C) (F : C \u2964 D\u1d52\u1d56) [PreservesColimit K.op F.leftOp] :\n PreservesLimit K F where\n preserves {_} hc :=\n\u27e8isLimitOfCoconeLeftOpOfCone _ (isColimitOfPreserves F.leftOp (IsLimit.op hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.rightOp : C \u2964 D\u1d52\u1d56` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_rightOp (L62-L68)\nlemma preservesLimit_rightOp (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D) [PreservesColimit K.op F] :\n PreservesLimit K F.rightOp where\n preserves {_} hc :=\n\u27e8isLimitConeRightOpOfCocone _ (isColimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.rightOp : C \u2964 D\u1d52\u1d56` preserves colimits of `K.leftOp : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C\u1d52\u1d56 \u2964 D`\npreserves limits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_rightOp (L69-L75)\nlemma preservesLimit_of_rightOp (K : J \u2964 C\u1d52\u1d56) (F : C\u1d52\u1d56 \u2964 D) [PreservesColimit K.leftOp F.rightOp] :\n PreservesLimit K F where\n preserves {_} hc :=\n\u27e8isLimitOfOp (isColimitOfPreserves F.rightOp (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves colimits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.unop : C \u2964 D` preserves\nlimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_unop (L76-L82)\nlemma preservesLimit_unop (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56) [PreservesColimit K.op F] :\n PreservesLimit K F.unop where\n preserves {_} hc :=\n\u27e8isLimitConeUnopOfCocone _ (isColimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.unop : C \u2964 D` preserves colimits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves\nlimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesLimit_of_unop (L83-L89)\nlemma preservesLimit_of_unop (K : J \u2964 C\u1d52\u1d56) (F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56) [PreservesColimit K.leftOp F.unop] :\n PreservesLimit K F where\n preserves {_} hc :=\n\u27e8isLimitOfCoconeLeftOpOfCone _ (isColimitOfPreserves F.unop (isColimitCoconeLeftOpOfCone _ hc))\u27e9\n\n/-- If `F : C \u2964 D` preserves limits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F.op : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_op (L90-L96)\nlemma preservesColimit_op (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D) [PreservesLimit K.leftOp F] :\n PreservesColimit K F.op where\n preserves {_} hc :=\n\u27e8isColimitCoconeRightOpOfCone _ (isLimitOfPreserves F (isLimitConeLeftOpOfCocone _ hc))\u27e9\n\n/-- If `F.op : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_of_op (L97-L102)\nlemma preservesColimit_of_op (K : J \u2964 C) (F : C \u2964 D) [PreservesLimit K.op F.op] :\n PreservesColimit K F where\n preserves {_} hc := \u27e8isColimitOfOp (isLimitOfPreserves F.op (IsColimit.op hc))\u27e9\n/-- If `F : C \u2964 D\u1d52\u1d56` preserves limits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F.leftOp : C\u1d52\u1d56 \u2964 D` preserves\ncolimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_leftOp (L103-L109)\nlemma preservesColimit_leftOp (K : J \u2964 C\u1d52\u1d56) (F : C \u2964 D\u1d52\u1d56) [PreservesLimit K.leftOp F] :\n PreservesColimit K F.leftOp where\n preserves {_} hc :=\n\u27e8isColimitCoconeUnopOfCone _ (isLimitOfPreserves F (isLimitConeLeftOpOfCocone _ hc))\u27e9\n\n/-- If `F.leftOp : C\u1d52\u1d56 \u2964 D` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F : C \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_of_leftOp (L110-L116)\nlemma preservesColimit_of_leftOp (K : J \u2964 C) (F : C \u2964 D\u1d52\u1d56) [PreservesLimit K.op F.leftOp] :\n PreservesColimit K F where\n preserves {_} hc :=\n\u27e8isColimitOfConeLeftOpOfCocone _ (isLimitOfPreserves F.leftOp (IsColimit.op hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.rightOp : C \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_rightOp (L117-L123)\nlemma preservesColimit_rightOp (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D) [PreservesLimit K.op F] :\n PreservesColimit K F.rightOp where\n preserves {_} hc :=\n\u27e8isColimitCoconeRightOpOfCone _ (isLimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.rightOp : C \u2964 D\u1d52\u1d56` preserves limits of `K.leftOp : J\u1d52\u1d56 \u2964 C`, then `F : C\u1d52\u1d56 \u2964 D`\npreserves colimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_of_rightOp (L124-L130)\nlemma preservesColimit_of_rightOp (K : J \u2964 C\u1d52\u1d56) (F : C\u1d52\u1d56 \u2964 D) [PreservesLimit K.leftOp F.rightOp] :\n PreservesColimit K F where\n preserves {_} hc :=\n\u27e8isColimitOfOp (isLimitOfPreserves F.rightOp (isLimitConeLeftOpOfCocone _ hc))\u27e9\n\n/-- If `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C\u1d52\u1d56`, then `F.unop : C \u2964 D` preserves\ncolimits of `K : J \u2964 C`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimit_unop (L131-L137)\nlemma preservesColimit_unop (K : J \u2964 C) (F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56) [PreservesLimit K.op F] :\n PreservesColimit K F.unop where\n preserves {_} hc :=\n\u27e8isColimitCoconeUnopOfCone _ (isLimitOfPreserves F hc.op)\u27e9\n\n/-- If `F.unop : C \u2964 D` preserves limits of `K.op : J\u1d52\u1d56 \u2964 C`, then `F : C\u1d52\u1d56 \u2964 D\u1d52\u1d56` preserves\ncolimits of `K : J \u2964 C\u1d52\u1d56`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Preserves/Opposites.lean", "module": "Mathlib.CategoryTheory.Limits.Preserves.Opposites", "declaration": "Mathlib.CategoryTheory.Limits.Preserves.Opposites.preservesColimitsOfSize_of_leftOp", "span": "L295-L299", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Preserves/Opposites.lean#L295"}, "environment": {}, "measurements": {"input_tokens": 7734, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 19714, "lean_code_chars": 18196, "natural_language_chars": 1518, "lean_code_ratio": 0.923, "line_count": 546, "imports_count": 0, "declarations_count": 2111, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "88c053a210bf326b", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.Geometry.Manifold.ContMDiff.Defs.contMDiffWithinAt_iff_of_mem_source'", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.ContMDiff.Defs)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem contMDiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' \u2208 (chartAt H x).source)\n (hy : f x' \u2208 (chartAt H' y).source) :\n ContMDiffWithinAt I I' n f s x' \u2194\n ContinuousWithinAt f s x' \u2227\n ContDiffWithinAt \ud835\udd5c n (extChartAt I' y \u2218 f \u2218 (extChartAt I x).symm)\n ((extChartAt I x).target \u2229 (extChartAt I x).symm \u207b\u00b9' (s \u2229 f \u207b\u00b9' (extChartAt I' y).source))\n (extChartAt I x x')\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContDiffWithinAtProp (L79-L81)\ndef ContDiffWithinAtProp (n : WithTop \u2115\u221e) (f : H \u2192 H') (s : Set H) (x : H) : Prop :=\nContDiffWithinAt \ud835\udd5c n (I' \u2218 f \u2218 I.symm) (I.symm \u207b\u00b9' s \u2229 range I) (I x)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_self_source (L82-L86)\ntheorem contDiffWithinAtProp_self_source {f : E \u2192 H'} {s : Set E} {x : E} :\n ContDiffWithinAtProp \ud835\udcd8(\ud835\udd5c, E) I' n f s x \u2194 ContDiffWithinAt \ud835\udd5c n (I' \u2218 f) s x := by\nsimp_rw [ContDiffWithinAtProp, modelWithCornersSelf_coe, range_id, inter_univ,\n modelWithCornersSelf_coe_symm, CompTriple.comp_eq, preimage_id_eq, id_eq]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_self (L87-L90)\ntheorem contDiffWithinAtProp_self {f : E \u2192 E'} {s : Set E} {x : E} :\n ContDiffWithinAtProp \ud835\udcd8(\ud835\udd5c, E) \ud835\udcd8(\ud835\udd5c, E') n f s x \u2194 ContDiffWithinAt \ud835\udd5c n f s x :=\ncontDiffWithinAtProp_self_source\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_self_target (L91-L97)\ntheorem contDiffWithinAtProp_self_target {f : H \u2192 E'} {s : Set H} {x : H} :\n ContDiffWithinAtProp I \ud835\udcd8(\ud835\udd5c, E') n f s x \u2194\n ContDiffWithinAt \ud835\udd5c n (f \u2218 I.symm) (I.symm \u207b\u00b9' s \u2229 range I) (I x) :=\nIff.rfl\n\n/-- Being `C\u207f` in the model space is a local property, invariant under `C\u207f` maps. Therefore,\nit lifts nicely to manifolds. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAt_localInvariantProp_of_le (L98-L140)\ntheorem contDiffWithinAt_localInvariantProp_of_le (n m : WithTop \u2115\u221e) (hmn : m \u2264 n) :\n (contDiffGroupoid n I).LocalInvariantProp (contDiffGroupoid n I')\n (ContDiffWithinAtProp I I' m) where\n is_local {s x u f} u_open xu := by\nhave : I.symm \u207b\u00b9' (s \u2229 u) \u2229 range I = I.symm \u207b\u00b9' s \u2229 range I \u2229 I.symm \u207b\u00b9' u := by\n simp only [inter_right_comm, preimage_inter]\n rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this]\n symm\n apply contDiffWithinAt_inter\n have : u \u2208 \ud835\udcdd (I.symm (I x)) := by\n rw [ModelWithCorners.left_inv]\n exact u_open.mem_nhds xu\n apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this\n right_invariance' {s x f e} he hx h := by\n rw [ContDiffWithinAtProp] at h \u22a2\n have : I x = (I \u2218 e.symm \u2218 I.symm) (I (e x)) := by simp only [hx, mfld_simps]\n rw [this] at h\n have : I (e x) \u2208 I.symm \u207b\u00b9' e.target \u2229 range I := by simp only [hx, mfld_simps]\n have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this\n convert (h.comp_inter _ (this.of_le hmn)).mono_of_mem_nhdsWithin _\n using 1\n \u00b7 ext y; simp only [mfld_simps]\n refine mem_nhdsWithin.mpr\n \u27e8I.symm \u207b\u00b9' e.target, e.open_target.preimage I.continuous_symm, by\n simp_rw [mem_preimage, I.left_inv, e.mapsTo hx], ?_\u27e9\n mfld_set_tac\n congr_of_forall {s x f g} h hx hf := by\n apply hf.congr\n \u00b7 intro y hy\n simp only [mfld_simps] at hy\n simp only [h, hy, mfld_simps]\n \u00b7 simp only [hx, mfld_simps]\n left_invariance' {s x f e'} he' hs hx h := by\n rw [ContDiffWithinAtProp] at h \u22a2\n have A : (I' \u2218 f \u2218 I.symm) (I x) \u2208 I'.symm \u207b\u00b9' e'.source \u2229 range I' := by\n simp only [hx, mfld_simps]\n have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A\n convert (this.of_le hmn).comp _ h _\n \u00b7 ext y; simp only [mfld_simps]\n \u00b7 intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1\n\n/-- Being `C\u207f` in the model space is a local property, invariant under `C^n` maps. Therefore,\nit lifts nicely to manifolds. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAt_localInvariantProp (L141-L145)\ntheorem contDiffWithinAt_localInvariantProp (n : WithTop \u2115\u221e) :\n (contDiffGroupoid n I).LocalInvariantProp (contDiffGroupoid n I')\n (ContDiffWithinAtProp I I' n) :=\ncontDiffWithinAt_localInvariantProp_of_le n n le_rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_mono_of_mem_nhdsWithin (L146-L152)\ntheorem contDiffWithinAtProp_mono_of_mem_nhdsWithin\n (n : WithTop \u2115\u221e) \u2983s x t\u2984 \u2983f : H \u2192 H'\u2984 (hts : s \u2208 \ud835\udcdd[t] x)\n (h : ContDiffWithinAtProp I I' n f s x) : ContDiffWithinAtProp I I' n f t x := by\nrefine h.mono_of_mem_nhdsWithin ?_\n refine inter_mem ?_ (mem_of_superset self_mem_nhdsWithin inter_subset_right)\n rwa [\u2190 Filter.mem_map, \u2190 I.image_eq, I.symm_map_nhdsWithin_image]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_id (L153-L163)\ntheorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x := by\nsimp only [ContDiffWithinAtProp, id_comp, preimage_univ, univ_inter]\n have : ContDiffWithinAt \ud835\udd5c n id (range I) (I x) := contDiff_id.contDiffAt.contDiffWithinAt\n refine this.congr (fun y hy => ?_) ?_\n \u00b7 simp only [ModelWithCorners.right_inv I hy, mfld_simps]\n \u00b7 simp only [mfld_simps]\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable within a set at a point in a manifold if\nit is continuous and it is `n` times continuously differentiable in this set around this point, when\nread in the preferred chart at this point. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffWithinAt (L164-L170)\ndef ContMDiffWithinAt (n : WithTop \u2115\u221e) (f : M \u2192 M') (s : Set M) (x : M) :=\nLiftPropWithinAt (ContDiffWithinAtProp I I' n) f s x\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable at a point in a manifold if\nit is continuous and it is `n` times continuously differentiable around this point, when\nread in the preferred chart at this point. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffAt (L171-L173)\ndef ContMDiffAt (n : WithTop \u2115\u221e) (f : M \u2192 M') (x : M) :=\nContMDiffWithinAt I I' n f univ x\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contMDiffAt_iff (L174-L184)\ntheorem contMDiffAt_iff {n : WithTop \u2115\u221e} {f : M \u2192 M'} {x : M} :\n ContMDiffAt I I' n f x \u2194\n ContinuousAt f x \u2227\n ContDiffWithinAt \ud835\udd5c n (extChartAt I' (f x) \u2218 f \u2218 (extChartAt I x).symm) (range I)\n (extChartAt I x x) :=\nliftPropAt_iff.trans <| by rw [ContDiffWithinAtProp, preimage_univ, univ_inter]; rfl\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable in a set of a manifold if it is continuous\nand, for any pair of points, it is `n` times continuously differentiable on this set in the charts\naround these points. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffOn (L185-L191)\ndef ContMDiffOn (n : WithTop \u2115\u221e) (f : M \u2192 M') (s : Set M) :=\n\u2200 x \u2208 s, ContMDiffWithinAt I I' n f s x\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable in a manifold if it is continuous\nand, for any pair of points, it is `n` times continuously differentiable in the charts\naround these points. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiff (L192-L196)\ndef ContMDiff (n : WithTop \u2115\u221e) (f : M \u2192 M') :=\n\u2200 x, ContMDiffAt I I' n f x\n\n/-! ### Deducing smoothness from higher smoothness -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffWithinAt (L197-L201)\ntheorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m \u2264 n) :\n ContMDiffWithinAt I I' m f s x := by\nsimp only [ContMDiffWithinAt] at hf \u22a2\n exact \u27e8hf.1, hf.2.of_le (mod_cast le)\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffAt (L202-L204)\ntheorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m \u2264 n) : ContMDiffAt I I' m f x :=\nContMDiffWithinAt.of_le hf le\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.leibniz (L107-L109)\ntheorem leibniz : X (f * f') = f \u2022 X f' + f' \u2022 X f :=\nX.leibniz' _ _\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt (L189-L193)\ndef evalAt : LeftInvariantDerivation I G \u2192\u2097[\ud835\udd5c] PointDerivation I g where\n toFun X := Derivation.evalAt g X.1\nmap_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_neg (L136-L138)\ntheorem coe_neg : \u21d1(-X) = -X :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_mul (L205-L211)\ntheorem evalAt_mul : evalAt (g * h) X = \ud835\udc85\u2095 (L_apply I g h) (evalAt h X) := by\next f\n rw [\u2190 left_invariant, hfdifferential_apply, hfdifferential_apply, L_mul, fdifferential_comp,\n fdifferential_apply]\n simp only [ContMDiffMap.comp_apply, LinearMap.comp_apply]\n rw [fdifferential_apply, \u2190 hfdifferential_apply (smoothLeftMul_one I h), left_invariant]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_sub (L140-L142)\ntheorem coe_sub : \u21d1(X - Y) = X - Y :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coeFnAddMonoidHom (L179-L183)\ndef coeFnAddMonoidHom : LeftInvariantDerivation I G \u2192+ C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef :=\n\u27e8\u27e8DFunLike.coe, coe_zero\u27e9, coe_add\u27e9\n\nvariable {I G}\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_coe_derivation (L231-L236)\ntheorem commutator_coe_derivation :\n \u21d1\u2045X, Y\u2046 =\n (\u2045(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef), Y\u2046 :\n Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_smul (L172-L177)\ntheorem lift_smul (k : \ud835\udd5c) : (k \u2022 X).1 = k \u2022 X.1 :=\nrfl\n\nvariable (I G)\n\n/-- The coercion to function is a monoid homomorphism. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant (L201-L204)\ntheorem left_invariant : \ud835\udc85\u2095 (smoothLeftMul_one I g) (evalAt (1 : G) X) = evalAt g X :=\nX.left_invariant'' g\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasNatScalar (L152-L154)\ninstance hasNatScalar : SMul \u2115 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y := DFunLike.ext _ _ h\nvariable (X Y f)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n\n/-- Premature version of the lemma. Prefer using `left_invariant` instead. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_zero (L132-L134)\ntheorem coe_zero : \u21d1(0 : LeftInvariantDerivation I G) = 0 :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_coe (L198-L200)\ntheorem evalAt_coe : Derivation.evalAt g \u2191X = evalAt g X :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_add (L128-L130)\ntheorem coe_add : \u21d1(X + Y) = X + Y :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_smul (L168-L170)\ntheorem coe_smul : \u21d1(r \u2022 X) = r \u2022 \u21d1X :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X :=\nleft_invariant'' X g\n\nprotected theorem map_add : X (f + f') = X f + X f' := by simp\n\nprotected theorem map_zero : X 0 = 0 := by simp\n\nprotected theorem map_neg : X (-f) = -X f := by simp\n\nprotected theorem map_sub : X (f - f') = X f - X f' := by simp\n\nprotected theorem map_smul : X (r \u2022 f) = r \u2022 X f := by simp\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X :=\nrfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasIntScalar (L155-L157)\ninstance hasIntScalar : SMul \u2124 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_zero (L148-L151)\ntheorem lift_zero :\n (\u2191(0 : LeftInvariantDerivation I G) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = 0 :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _) :=\nfun X Y h => by cases X; cases Y; congr\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_apply (L194-L196)\ntheorem evalAt_apply : evalAt g X f = (X f) g :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_add (L144-L146)\ntheorem lift_add : (\u2191(X + Y) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = X + Y :=\nrfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.comp_L (L212-L216)\ntheorem comp_L : (X f).comp (\ud835\udc73 I g) = X (f.comp (\ud835\udc73 I g)) := by\next h\n rw [ContMDiffMap.comp_apply, L_apply, \u2190 evalAt_apply, evalAt_mul, hfdifferential_apply,\n fdifferential_apply, evalAt_apply]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe :=\nDFunLike.coe_injective\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.ContMDiff.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem contMDiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' \u2208 (chartAt H x).source)\n (hy : f x' \u2208 (chartAt H' y).source) :\n ContMDiffWithinAt I I' n f s x' \u2194\n ContinuousWithinAt f s x' \u2227\n ContDiffWithinAt \ud835\udd5c n (extChartAt I' y \u2218 f \u2218 (extChartAt I x).symm)\n ((extChartAt I x).target \u2229 (extChartAt I x).symm \u207b\u00b9' (s \u2229 f \u207b\u00b9' (extChartAt I' y).source))\n (extChartAt I x x')\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContDiffWithinAtProp (L79-L81)\ndef ContDiffWithinAtProp (n : WithTop \u2115\u221e) (f : H \u2192 H') (s : Set H) (x : H) : Prop :=\nContDiffWithinAt \ud835\udd5c n (I' \u2218 f \u2218 I.symm) (I.symm \u207b\u00b9' s \u2229 range I) (I x)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_self_source (L82-L86)\ntheorem contDiffWithinAtProp_self_source {f : E \u2192 H'} {s : Set E} {x : E} :\n ContDiffWithinAtProp \ud835\udcd8(\ud835\udd5c, E) I' n f s x \u2194 ContDiffWithinAt \ud835\udd5c n (I' \u2218 f) s x := by\nsimp_rw [ContDiffWithinAtProp, modelWithCornersSelf_coe, range_id, inter_univ,\n modelWithCornersSelf_coe_symm, CompTriple.comp_eq, preimage_id_eq, id_eq]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_self (L87-L90)\ntheorem contDiffWithinAtProp_self {f : E \u2192 E'} {s : Set E} {x : E} :\n ContDiffWithinAtProp \ud835\udcd8(\ud835\udd5c, E) \ud835\udcd8(\ud835\udd5c, E') n f s x \u2194 ContDiffWithinAt \ud835\udd5c n f s x :=\ncontDiffWithinAtProp_self_source\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_self_target (L91-L97)\ntheorem contDiffWithinAtProp_self_target {f : H \u2192 E'} {s : Set H} {x : H} :\n ContDiffWithinAtProp I \ud835\udcd8(\ud835\udd5c, E') n f s x \u2194\n ContDiffWithinAt \ud835\udd5c n (f \u2218 I.symm) (I.symm \u207b\u00b9' s \u2229 range I) (I x) :=\nIff.rfl\n\n/-- Being `C\u207f` in the model space is a local property, invariant under `C\u207f` maps. Therefore,\nit lifts nicely to manifolds. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAt_localInvariantProp_of_le (L98-L140)\ntheorem contDiffWithinAt_localInvariantProp_of_le (n m : WithTop \u2115\u221e) (hmn : m \u2264 n) :\n (contDiffGroupoid n I).LocalInvariantProp (contDiffGroupoid n I')\n (ContDiffWithinAtProp I I' m) where\n is_local {s x u f} u_open xu := by\nhave : I.symm \u207b\u00b9' (s \u2229 u) \u2229 range I = I.symm \u207b\u00b9' s \u2229 range I \u2229 I.symm \u207b\u00b9' u := by\n simp only [inter_right_comm, preimage_inter]\n rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this]\n symm\n apply contDiffWithinAt_inter\n have : u \u2208 \ud835\udcdd (I.symm (I x)) := by\n rw [ModelWithCorners.left_inv]\n exact u_open.mem_nhds xu\n apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this\n right_invariance' {s x f e} he hx h := by\n rw [ContDiffWithinAtProp] at h \u22a2\n have : I x = (I \u2218 e.symm \u2218 I.symm) (I (e x)) := by simp only [hx, mfld_simps]\n rw [this] at h\n have : I (e x) \u2208 I.symm \u207b\u00b9' e.target \u2229 range I := by simp only [hx, mfld_simps]\n have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this\n convert (h.comp_inter _ (this.of_le hmn)).mono_of_mem_nhdsWithin _\n using 1\n \u00b7 ext y; simp only [mfld_simps]\n refine mem_nhdsWithin.mpr\n \u27e8I.symm \u207b\u00b9' e.target, e.open_target.preimage I.continuous_symm, by\n simp_rw [mem_preimage, I.left_inv, e.mapsTo hx], ?_\u27e9\n mfld_set_tac\n congr_of_forall {s x f g} h hx hf := by\n apply hf.congr\n \u00b7 intro y hy\n simp only [mfld_simps] at hy\n simp only [h, hy, mfld_simps]\n \u00b7 simp only [hx, mfld_simps]\n left_invariance' {s x f e'} he' hs hx h := by\n rw [ContDiffWithinAtProp] at h \u22a2\n have A : (I' \u2218 f \u2218 I.symm) (I x) \u2208 I'.symm \u207b\u00b9' e'.source \u2229 range I' := by\n simp only [hx, mfld_simps]\n have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A\n convert (this.of_le hmn).comp _ h _\n \u00b7 ext y; simp only [mfld_simps]\n \u00b7 intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1\n\n/-- Being `C\u207f` in the model space is a local property, invariant under `C^n` maps. Therefore,\nit lifts nicely to manifolds. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAt_localInvariantProp (L141-L145)\ntheorem contDiffWithinAt_localInvariantProp (n : WithTop \u2115\u221e) :\n (contDiffGroupoid n I).LocalInvariantProp (contDiffGroupoid n I')\n (ContDiffWithinAtProp I I' n) :=\ncontDiffWithinAt_localInvariantProp_of_le n n le_rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_mono_of_mem_nhdsWithin (L146-L152)\ntheorem contDiffWithinAtProp_mono_of_mem_nhdsWithin\n (n : WithTop \u2115\u221e) \u2983s x t\u2984 \u2983f : H \u2192 H'\u2984 (hts : s \u2208 \ud835\udcdd[t] x)\n (h : ContDiffWithinAtProp I I' n f s x) : ContDiffWithinAtProp I I' n f t x := by\nrefine h.mono_of_mem_nhdsWithin ?_\n refine inter_mem ?_ (mem_of_superset self_mem_nhdsWithin inter_subset_right)\n rwa [\u2190 Filter.mem_map, \u2190 I.image_eq, I.symm_map_nhdsWithin_image]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contDiffWithinAtProp_id (L153-L163)\ntheorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x := by\nsimp only [ContDiffWithinAtProp, id_comp, preimage_univ, univ_inter]\n have : ContDiffWithinAt \ud835\udd5c n id (range I) (I x) := contDiff_id.contDiffAt.contDiffWithinAt\n refine this.congr (fun y hy => ?_) ?_\n \u00b7 simp only [ModelWithCorners.right_inv I hy, mfld_simps]\n \u00b7 simp only [mfld_simps]\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable within a set at a point in a manifold if\nit is continuous and it is `n` times continuously differentiable in this set around this point, when\nread in the preferred chart at this point. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffWithinAt (L164-L170)\ndef ContMDiffWithinAt (n : WithTop \u2115\u221e) (f : M \u2192 M') (s : Set M) (x : M) :=\nLiftPropWithinAt (ContDiffWithinAtProp I I' n) f s x\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable at a point in a manifold if\nit is continuous and it is `n` times continuously differentiable around this point, when\nread in the preferred chart at this point. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffAt (L171-L173)\ndef ContMDiffAt (n : WithTop \u2115\u221e) (f : M \u2192 M') (x : M) :=\nContMDiffWithinAt I I' n f univ x\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.contMDiffAt_iff (L174-L184)\ntheorem contMDiffAt_iff {n : WithTop \u2115\u221e} {f : M \u2192 M'} {x : M} :\n ContMDiffAt I I' n f x \u2194\n ContinuousAt f x \u2227\n ContDiffWithinAt \ud835\udd5c n (extChartAt I' (f x) \u2218 f \u2218 (extChartAt I x).symm) (range I)\n (extChartAt I x x) :=\nliftPropAt_iff.trans <| by rw [ContDiffWithinAtProp, preimage_univ, univ_inter]; rfl\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable in a set of a manifold if it is continuous\nand, for any pair of points, it is `n` times continuously differentiable on this set in the charts\naround these points. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffOn (L185-L191)\ndef ContMDiffOn (n : WithTop \u2115\u221e) (f : M \u2192 M') (s : Set M) :=\n\u2200 x \u2208 s, ContMDiffWithinAt I I' n f s x\n\nvariable (I I') in\n/-- A function is `n` times continuously differentiable in a manifold if it is continuous\nand, for any pair of points, it is `n` times continuously differentiable in the charts\naround these points. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiff (L192-L196)\ndef ContMDiff (n : WithTop \u2115\u221e) (f : M \u2192 M') :=\n\u2200 x, ContMDiffAt I I' n f x\n\n/-! ### Deducing smoothness from higher smoothness -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffWithinAt (L197-L201)\ntheorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m \u2264 n) :\n ContMDiffWithinAt I I' m f s x := by\nsimp only [ContMDiffWithinAt] at hf \u22a2\n exact \u27e8hf.1, hf.2.of_le (mod_cast le)\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Geometry.Manifold.ContMDiff.Defs.ContMDiffAt (L202-L204)\ntheorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m \u2264 n) : ContMDiffAt I I' m f x :=\nContMDiffWithinAt.of_le hf le\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.leibniz (L107-L109)\ntheorem leibniz : X (f * f') = f \u2022 X f' + f' \u2022 X f :=\nX.leibniz' _ _\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt (L189-L193)\ndef evalAt : LeftInvariantDerivation I G \u2192\u2097[\ud835\udd5c] PointDerivation I g where\n toFun X := Derivation.evalAt g X.1\nmap_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_neg (L136-L138)\ntheorem coe_neg : \u21d1(-X) = -X :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_mul (L205-L211)\ntheorem evalAt_mul : evalAt (g * h) X = \ud835\udc85\u2095 (L_apply I g h) (evalAt h X) := by\next f\n rw [\u2190 left_invariant, hfdifferential_apply, hfdifferential_apply, L_mul, fdifferential_comp,\n fdifferential_apply]\n simp only [ContMDiffMap.comp_apply, LinearMap.comp_apply]\n rw [fdifferential_apply, \u2190 hfdifferential_apply (smoothLeftMul_one I h), left_invariant]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_sub (L140-L142)\ntheorem coe_sub : \u21d1(X - Y) = X - Y :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coeFnAddMonoidHom (L179-L183)\ndef coeFnAddMonoidHom : LeftInvariantDerivation I G \u2192+ C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef :=\n\u27e8\u27e8DFunLike.coe, coe_zero\u27e9, coe_add\u27e9\n\nvariable {I G}\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_coe_derivation (L231-L236)\ntheorem commutator_coe_derivation :\n \u21d1\u2045X, Y\u2046 =\n (\u2045(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef), Y\u2046 :\n Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_smul (L172-L177)\ntheorem lift_smul (k : \ud835\udd5c) : (k \u2022 X).1 = k \u2022 X.1 :=\nrfl\n\nvariable (I G)\n\n/-- The coercion to function is a monoid homomorphism. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant (L201-L204)\ntheorem left_invariant : \ud835\udc85\u2095 (smoothLeftMul_one I g) (evalAt (1 : G) X) = evalAt g X :=\nX.left_invariant'' g\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasNatScalar (L152-L154)\ninstance hasNatScalar : SMul \u2115 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y := DFunLike.ext _ _ h\nvariable (X Y f)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n\n/-- Premature version of the lemma. Prefer using `left_invariant` instead. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_zero (L132-L134)\ntheorem coe_zero : \u21d1(0 : LeftInvariantDerivation I G) = 0 :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_coe (L198-L200)\ntheorem evalAt_coe : Derivation.evalAt g \u2191X = evalAt g X :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_add (L128-L130)\ntheorem coe_add : \u21d1(X + Y) = X + Y :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_smul (L168-L170)\ntheorem coe_smul : \u21d1(r \u2022 X) = r \u2022 \u21d1X :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X :=\nleft_invariant'' X g\n\nprotected theorem map_add : X (f + f') = X f + X f' := by simp\n\nprotected theorem map_zero : X 0 = 0 := by simp\n\nprotected theorem map_neg : X (-f) = -X f := by simp\n\nprotected theorem map_sub : X (f - f') = X f - X f' := by simp\n\nprotected theorem map_smul : X (r \u2022 f) = r \u2022 X f := by simp\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X :=\nrfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasIntScalar (L155-L157)\ninstance hasIntScalar : SMul \u2124 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_zero (L148-L151)\ntheorem lift_zero :\n (\u2191(0 : LeftInvariantDerivation I G) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = 0 :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _) :=\nfun X Y h => by cases X; cases Y; congr\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_apply (L194-L196)\ntheorem evalAt_apply : evalAt g X f = (X f) g :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_add (L144-L146)\ntheorem lift_add : (\u2191(X + Y) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = X + Y :=\nrfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.comp_L (L212-L216)\ntheorem comp_L : (X f).comp (\ud835\udc73 I g) = X (f.comp (\ud835\udc73 I g)) := by\next h\n rw [ContMDiffMap.comp_apply, L_apply, \u2190 evalAt_apply, evalAt_mul, hfdifferential_apply,\n fdifferential_apply, evalAt_apply]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe :=\nDFunLike.coe_injective\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/ContMDiff/Defs.lean", "module": "Mathlib.Geometry.Manifold.ContMDiff.Defs", "declaration": "Mathlib.Geometry.Manifold.ContMDiff.Defs.contMDiffWithinAt_iff_of_mem_source'", "span": "L397-L414", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/ContMDiff/Defs.lean#L397"}, "environment": {}, "measurements": {"input_tokens": 5688, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 14572, "lean_code_chars": 13063, "natural_language_chars": 1509, "lean_code_ratio": 0.8964, "line_count": 416, "imports_count": 0, "declarations_count": 1552, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "e9da17be724f8144", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.FiniteDimensional", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.IsManifold.ExtChartAt)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem FiniteDimensional.of_locallyCompact_manifold\n [CompleteSpace \ud835\udd5c] (I : ModelWithCorners \ud835\udd5c E H) [Nonempty M] [LocallyCompactSpace M] :\n FiniteDimensional \ud835\udd5c E\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend (L75-L77)\ndef extend : PartialEquiv M E :=\nf.toPartialEquiv \u226b I.toPartialEquiv\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe (L78-L80)\ntheorem extend_coe : \u21d1(f.extend I) = I \u2218 f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe_symm (L81-L83)\ntheorem extend_coe_symm : \u21d1(f.extend I).symm = f.symm \u2218 I.symm :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source (L84-L86)\ntheorem extend_source : (f.extend I).source = f.source := by\nrw [extend, PartialEquiv.trans_source, I.source_eq, preimage_univ, inter_univ]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_source (L87-L90)\ntheorem isOpen_extend_source : IsOpen (f.extend I).source := by\nrw [extend_source]\n exact f.open_source\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target (L91-L93)\ntheorem extend_target : (f.extend I).target = I.symm \u207b\u00b9' f.target \u2229 range I := by\nsimp_rw [extend, PartialEquiv.trans_target, I.target_eq, I.toPartialEquiv_coe_symm, inter_comm]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target' (L94-L96)\ntheorem extend_target' : (f.extend I).target = I '' f.target := by\nrw [extend, PartialEquiv.trans_target'', I.source_eq, univ_inter, I.toPartialEquiv_coe]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_eq_image_source (L97-L99)\ntheorem extend_target_eq_image_source : (f.extend I).target = (f.extend I) '' f.source := by\nrw [f.extend_target', \u2190 f.image_source_eq_target, \u2190 image_comp, f.extend_coe]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_target (L100-L103)\nlemma isOpen_extend_target [I.Boundaryless] : IsOpen (f.extend I).target := by\nrw [extend_target, I.range_eq_univ, inter_univ]\n exact I.continuous_symm.isOpen_preimage _ f.open_target\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.mapsTo_extend (L104-L109)\ntheorem mapsTo_extend (hs : s \u2286 f.source) :\n MapsTo (f.extend I) s ((f.extend I).symm \u207b\u00b9' s \u2229 range I) := by\nrw [mapsTo_iff_image_subset, extend_coe, extend_coe_symm, preimage_comp, \u2190 I.image_eq, image_comp,\n f.image_eq_target_inter_inv_preimage hs]\n exact image_mono inter_subset_right\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv (L110-L113)\ntheorem extend_left_inv {x : M} (hxf : x \u2208 f.source) : (f.extend I).symm (f.extend I x) = x :=\n(f.extend I).left_inv <| by rwa [f.extend_source]\n\n/-- Variant of `f.extend_left_inv I`, stated in terms of images. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv' (L114-L116)\nlemma extend_left_inv' (ht : t \u2286 f.source) : ((f.extend I).symm \u2218 (f.extend I)) '' t = t :=\nEqOn.image_eq_self (fun _ hx \u21a6 f.extend_left_inv (ht hx))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhds (L117-L119)\ntheorem extend_source_mem_nhds {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd x :=\n(isOpen_extend_source f).mem_nhds <| by rwa [f.extend_source]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhdsWithin (L120-L122)\ntheorem extend_source_mem_nhdsWithin {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd[s] x :=\nmem_nhdsWithin_of_mem_nhds <| extend_source_mem_nhds f h\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.continuousOn_extend (L123-L127)\ntheorem continuousOn_extend : ContinuousOn (f.extend I) (f.extend I).source := by\nrefine I.continuous.comp_continuousOn ?_\n rw [extend_source]\n exact f.continuousOn\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasNatScalar (L152-L154)\ninstance hasNatScalar : SMul \u2115 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_apply (L194-L196)\ntheorem evalAt_apply : evalAt g X f = (X f) g :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_zero (L132-L134)\ntheorem coe_zero : \u21d1(0 : LeftInvariantDerivation I G) = 0 :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_add (L144-L146)\ntheorem lift_add : (\u2191(X + Y) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = X + Y :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_coe_derivation (L231-L236)\ntheorem commutator_coe_derivation :\n \u21d1\u2045X, Y\u2046 =\n (\u2045(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef), Y\u2046 :\n Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_smul (L172-L177)\ntheorem lift_smul (k : \ud835\udd5c) : (k \u2022 X).1 = k \u2022 X.1 :=\nrfl\n\nvariable (I G)\n\n/-- The coercion to function is a monoid homomorphism. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_mul (L205-L211)\ntheorem evalAt_mul : evalAt (g * h) X = \ud835\udc85\u2095 (L_apply I g h) (evalAt h X) := by\next f\n rw [\u2190 left_invariant, hfdifferential_apply, hfdifferential_apply, L_mul, fdifferential_comp,\n fdifferential_apply]\n simp only [ContMDiffMap.comp_apply, LinearMap.comp_apply]\n rw [fdifferential_apply, \u2190 hfdifferential_apply (smoothLeftMul_one I h), left_invariant]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y := DFunLike.ext _ _ h\nvariable (X Y f)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt (L189-L193)\ndef evalAt : LeftInvariantDerivation I G \u2192\u2097[\ud835\udd5c] PointDerivation I g where\n toFun X := Derivation.evalAt g X.1\nmap_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_add (L128-L130)\ntheorem coe_add : \u21d1(X + Y) = X + Y :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_neg (L136-L138)\ntheorem coe_neg : \u21d1(-X) = -X :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coeFnAddMonoidHom (L179-L183)\ndef coeFnAddMonoidHom : LeftInvariantDerivation I G \u2192+ C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef :=\n\u27e8\u27e8DFunLike.coe, coe_zero\u27e9, coe_add\u27e9\n\nvariable {I G}\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_smul (L168-L170)\ntheorem coe_smul : \u21d1(r \u2022 X) = r \u2022 \u21d1X :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_coe (L198-L200)\ntheorem evalAt_coe : Derivation.evalAt g \u2191X = evalAt g X :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.comp_L (L212-L216)\ntheorem comp_L : (X f).comp (\ud835\udc73 I g) = X (f.comp (\ud835\udc73 I g)) := by\next h\n rw [ContMDiffMap.comp_apply, L_apply, \u2190 evalAt_apply, evalAt_mul, hfdifferential_apply,\n fdifferential_apply, evalAt_apply]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n\n/-- Premature version of the lemma. Prefer using `left_invariant` instead. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X :=\nleft_invariant'' X g\n\nprotected theorem map_add : X (f + f') = X f + X f' := by simp\n\nprotected theorem map_zero : X 0 = 0 := by simp\n\nprotected theorem map_neg : X (-f) = -X f := by simp\n\nprotected theorem map_sub : X (f - f') = X f - X f' := by simp\n\nprotected theorem map_smul : X (r \u2022 f) = r \u2022 X f := by simp\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_zero (L148-L151)\ntheorem lift_zero :\n (\u2191(0 : LeftInvariantDerivation I G) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = 0 :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_sub (L140-L142)\ntheorem coe_sub : \u21d1(X - Y) = X - Y :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasIntScalar (L155-L157)\ninstance hasIntScalar : SMul \u2124 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _) :=\nfun X Y h => by cases X; cases Y; congr\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.leibniz (L107-L109)\ntheorem leibniz : X (f * f') = f \u2022 X f' + f' \u2022 X f :=\nX.leibniz' _ _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant (L201-L204)\ntheorem left_invariant : \ud835\udc85\u2095 (smoothLeftMul_one I g) (evalAt (1 : G) X) = evalAt g X :=\nX.left_invariant'' g\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe :=\nDFunLike.coe_injective\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.IsManifold.ExtChartAt).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem FiniteDimensional.of_locallyCompact_manifold\n [CompleteSpace \ud835\udd5c] (I : ModelWithCorners \ud835\udd5c E H) [Nonempty M] [LocallyCompactSpace M] :\n FiniteDimensional \ud835\udd5c E\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend (L75-L77)\ndef extend : PartialEquiv M E :=\nf.toPartialEquiv \u226b I.toPartialEquiv\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe (L78-L80)\ntheorem extend_coe : \u21d1(f.extend I) = I \u2218 f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe_symm (L81-L83)\ntheorem extend_coe_symm : \u21d1(f.extend I).symm = f.symm \u2218 I.symm :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source (L84-L86)\ntheorem extend_source : (f.extend I).source = f.source := by\nrw [extend, PartialEquiv.trans_source, I.source_eq, preimage_univ, inter_univ]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_source (L87-L90)\ntheorem isOpen_extend_source : IsOpen (f.extend I).source := by\nrw [extend_source]\n exact f.open_source\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target (L91-L93)\ntheorem extend_target : (f.extend I).target = I.symm \u207b\u00b9' f.target \u2229 range I := by\nsimp_rw [extend, PartialEquiv.trans_target, I.target_eq, I.toPartialEquiv_coe_symm, inter_comm]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target' (L94-L96)\ntheorem extend_target' : (f.extend I).target = I '' f.target := by\nrw [extend, PartialEquiv.trans_target'', I.source_eq, univ_inter, I.toPartialEquiv_coe]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_eq_image_source (L97-L99)\ntheorem extend_target_eq_image_source : (f.extend I).target = (f.extend I) '' f.source := by\nrw [f.extend_target', \u2190 f.image_source_eq_target, \u2190 image_comp, f.extend_coe]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_target (L100-L103)\nlemma isOpen_extend_target [I.Boundaryless] : IsOpen (f.extend I).target := by\nrw [extend_target, I.range_eq_univ, inter_univ]\n exact I.continuous_symm.isOpen_preimage _ f.open_target\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.mapsTo_extend (L104-L109)\ntheorem mapsTo_extend (hs : s \u2286 f.source) :\n MapsTo (f.extend I) s ((f.extend I).symm \u207b\u00b9' s \u2229 range I) := by\nrw [mapsTo_iff_image_subset, extend_coe, extend_coe_symm, preimage_comp, \u2190 I.image_eq, image_comp,\n f.image_eq_target_inter_inv_preimage hs]\n exact image_mono inter_subset_right\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv (L110-L113)\ntheorem extend_left_inv {x : M} (hxf : x \u2208 f.source) : (f.extend I).symm (f.extend I x) = x :=\n(f.extend I).left_inv <| by rwa [f.extend_source]\n\n/-- Variant of `f.extend_left_inv I`, stated in terms of images. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv' (L114-L116)\nlemma extend_left_inv' (ht : t \u2286 f.source) : ((f.extend I).symm \u2218 (f.extend I)) '' t = t :=\nEqOn.image_eq_self (fun _ hx \u21a6 f.extend_left_inv (ht hx))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhds (L117-L119)\ntheorem extend_source_mem_nhds {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd x :=\n(isOpen_extend_source f).mem_nhds <| by rwa [f.extend_source]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhdsWithin (L120-L122)\ntheorem extend_source_mem_nhdsWithin {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd[s] x :=\nmem_nhdsWithin_of_mem_nhds <| extend_source_mem_nhds f h\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.continuousOn_extend (L123-L127)\ntheorem continuousOn_extend : ContinuousOn (f.extend I) (f.extend I).source := by\nrefine I.continuous.comp_continuousOn ?_\n rw [extend_source]\n exact f.continuousOn\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasNatScalar (L152-L154)\ninstance hasNatScalar : SMul \u2115 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_apply (L194-L196)\ntheorem evalAt_apply : evalAt g X f = (X f) g :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_zero (L132-L134)\ntheorem coe_zero : \u21d1(0 : LeftInvariantDerivation I G) = 0 :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_add (L144-L146)\ntheorem lift_add : (\u2191(X + Y) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = X + Y :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_coe_derivation (L231-L236)\ntheorem commutator_coe_derivation :\n \u21d1\u2045X, Y\u2046 =\n (\u2045(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef), Y\u2046 :\n Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_smul (L172-L177)\ntheorem lift_smul (k : \ud835\udd5c) : (k \u2022 X).1 = k \u2022 X.1 :=\nrfl\n\nvariable (I G)\n\n/-- The coercion to function is a monoid homomorphism. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_mul (L205-L211)\ntheorem evalAt_mul : evalAt (g * h) X = \ud835\udc85\u2095 (L_apply I g h) (evalAt h X) := by\next f\n rw [\u2190 left_invariant, hfdifferential_apply, hfdifferential_apply, L_mul, fdifferential_comp,\n fdifferential_apply]\n simp only [ContMDiffMap.comp_apply, LinearMap.comp_apply]\n rw [fdifferential_apply, \u2190 hfdifferential_apply (smoothLeftMul_one I h), left_invariant]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y := DFunLike.ext _ _ h\nvariable (X Y f)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt (L189-L193)\ndef evalAt : LeftInvariantDerivation I G \u2192\u2097[\ud835\udd5c] PointDerivation I g where\n toFun X := Derivation.evalAt g X.1\nmap_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_add (L128-L130)\ntheorem coe_add : \u21d1(X + Y) = X + Y :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_neg (L136-L138)\ntheorem coe_neg : \u21d1(-X) = -X :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coeFnAddMonoidHom (L179-L183)\ndef coeFnAddMonoidHom : LeftInvariantDerivation I G \u2192+ C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef :=\n\u27e8\u27e8DFunLike.coe, coe_zero\u27e9, coe_add\u27e9\n\nvariable {I G}\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_smul (L168-L170)\ntheorem coe_smul : \u21d1(r \u2022 X) = r \u2022 \u21d1X :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_coe (L198-L200)\ntheorem evalAt_coe : Derivation.evalAt g \u2191X = evalAt g X :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.comp_L (L212-L216)\ntheorem comp_L : (X f).comp (\ud835\udc73 I g) = X (f.comp (\ud835\udc73 I g)) := by\next h\n rw [ContMDiffMap.comp_apply, L_apply, \u2190 evalAt_apply, evalAt_mul, hfdifferential_apply,\n fdifferential_apply, evalAt_apply]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n\n/-- Premature version of the lemma. Prefer using `left_invariant` instead. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X :=\nleft_invariant'' X g\n\nprotected theorem map_add : X (f + f') = X f + X f' := by simp\n\nprotected theorem map_zero : X 0 = 0 := by simp\n\nprotected theorem map_neg : X (-f) = -X f := by simp\n\nprotected theorem map_sub : X (f - f') = X f - X f' := by simp\n\nprotected theorem map_smul : X (r \u2022 f) = r \u2022 X f := by simp\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_zero (L148-L151)\ntheorem lift_zero :\n (\u2191(0 : LeftInvariantDerivation I G) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = 0 :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_sub (L140-L142)\ntheorem coe_sub : \u21d1(X - Y) = X - Y :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasIntScalar (L155-L157)\ninstance hasIntScalar : SMul \u2124 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _) :=\nfun X Y h => by cases X; cases Y; congr\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.leibniz (L107-L109)\ntheorem leibniz : X (f * f') = f \u2022 X f' + f' \u2022 X f :=\nX.leibniz' _ _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant (L201-L204)\ntheorem left_invariant : \ud835\udc85\u2095 (smoothLeftMul_one I g) (evalAt (1 : G) X) = evalAt g X :=\nX.left_invariant'' g\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe :=\nDFunLike.coe_injective\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean", "module": "Mathlib.Geometry.Manifold.IsManifold.ExtChartAt", "declaration": "Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.FiniteDimensional", "span": "L929-L935", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean#L929"}, "environment": {}, "measurements": {"input_tokens": 4049, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 10525, "lean_code_chars": 9009, "natural_language_chars": 1516, "lean_code_ratio": 0.856, "line_count": 334, "imports_count": 0, "declarations_count": 919, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "dfa11a1b63ce0123", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_norm", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Constructions.BorelSpace.Metric)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem measurable_norm : Measurable (norm : \u03b1 \u2192 \u211d)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurableSet_ball (L46-L48)\ntheorem measurableSet_ball : MeasurableSet (Metric.ball x \u03b5) :=\nMetric.isOpen_ball.measurableSet\n```\n\n-- snippet 2\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurableSet_closedBall (L50-L52)\ntheorem measurableSet_closedBall : MeasurableSet (Metric.closedBall x \u03b5) :=\nMetric.isClosed_closedBall.measurableSet\n```\n\n-- snippet 3\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_infDist (L53-L55)\ntheorem measurable_infDist {s : Set \u03b1} : Measurable fun x => infDist x s :=\n(continuous_infDist_pt s).measurable\n```\n\n-- snippet 4\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L57-L60)\ntheorem Measurable.infDist {f : \u03b2 \u2192 \u03b1} (hf : Measurable f) {s : Set \u03b1} :\n Measurable fun x => infDist (f x) s :=\nmeasurable_infDist.comp hf\n```\n\n-- snippet 5\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_infNndist (L61-L63)\ntheorem measurable_infNndist {s : Set \u03b1} : Measurable fun x => infNndist x s :=\n(continuous_infNndist_pt s).measurable\n```\n\n-- snippet 6\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L65-L68)\ntheorem Measurable.infNndist {f : \u03b2 \u2192 \u03b1} (hf : Measurable f) {s : Set \u03b1} :\n Measurable fun x => infNndist (f x) s :=\nmeasurable_infNndist.comp hf\n```\n\n-- snippet 7\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_dist (L73-L75)\ntheorem measurable_dist : Measurable fun p : \u03b1 \u00d7 \u03b1 => dist p.1 p.2 :=\ncontinuous_dist.measurable\n```\n\n-- snippet 8\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L77-L80)\ntheorem Measurable.dist {f g : \u03b2 \u2192 \u03b1} (hf : Measurable f) (hg : Measurable g) :\n Measurable fun b => dist (f b) (g b) :=\ncontinuous_dist.measurable2 hf hg\n```\n\n-- snippet 9\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.AEMeasurable (L82-L86)\nlemma AEMeasurable.dist {f g : \u03b2 \u2192 \u03b1} {\u03bc : Measure \u03b2}\n (hf : AEMeasurable f \u03bc) (hg : AEMeasurable g \u03bc) :\n AEMeasurable (fun b \u21a6 dist (f b) (g b)) \u03bc :=\ncontinuous_dist.aemeasurable2 hf hg\n```\n\n-- snippet 10\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_nndist (L87-L89)\ntheorem measurable_nndist : Measurable fun p : \u03b1 \u00d7 \u03b1 => nndist p.1 p.2 :=\ncontinuous_nndist.measurable\n```\n\n-- snippet 11\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L91-L94)\ntheorem Measurable.nndist {f g : \u03b2 \u2192 \u03b1} (hf : Measurable f) (hg : Measurable g) :\n Measurable fun b => nndist (f b) (g b) :=\ncontinuous_nndist.measurable2 hf hg\n```\n\n-- snippet 12\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurableSet_eball (L107-L109)\ntheorem measurableSet_eball : MeasurableSet (Metric.eball x \u03b5) :=\nMetric.isOpen_eball.measurableSet\n```\n\n-- snippet 13\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_edist_right (L111-L112)\ntheorem measurable_edist_right : Measurable (edist x) := by fun_prop\n```\n\n-- snippet 14\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_edist_left (L114-L115)\ntheorem measurable_edist_left : Measurable fun y \u21a6 edist y x := by fun_prop\n```\n\n-- snippet 15\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_infEDist (L116-L118)\ntheorem measurable_infEDist {s : Set \u03b1} : Measurable fun x => infEDist x s :=\ncontinuous_infEDist.measurable\n```\n\n-- snippet 16\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Countable (L193-L198)\ninstance Countable.instBorelSpace [Countable \u03b1] [MeasurableSpace \u03b1] [MeasurableSingletonClass \u03b1]\n [TopologicalSpace \u03b1] [DiscreteTopology \u03b1] : BorelSpace \u03b1 := by\nhave : \u2200 s, @MeasurableSet \u03b1 inferInstance s := fun s \u21a6 s.to_countable.measurableSet\n have : \u2200 s, @MeasurableSet \u03b1 (borel \u03b1) s := fun s \u21a6 measurableSet_generateFrom (isOpen_discrete s)\n exact \u27e8by aesop\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_anti (L56-L58)\ntheorem borel_anti : Antitone (@borel \u03b1) := fun _ _ h =>\nMeasurableSpace.generateFrom_le fun _ hs => .basic _ (h _ hs)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_eq_generateFrom_isClosed (L89-L97)\ntheorem borel_eq_generateFrom_isClosed [TopologicalSpace \u03b1] :\n borel \u03b1 = .generateFrom { s | IsClosed s } :=\nle_antisymm\n (generateFrom_le fun _t ht =>\n @MeasurableSet.of_compl \u03b1 _ (generateFrom { s | IsClosed s })\n (GenerateMeasurable.basic _ <| isClosed_compl_iff.2 ht))\n (generateFrom_le fun _t ht =>\n @MeasurableSet.of_compl \u03b1 _ (borel \u03b1) (GenerateMeasurable.basic _ <| isOpen_compl_iff.2 ht))\n```\n\n-- snippet 19\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsG\u03b4 (L250-L253)\ntheorem IsG\u03b4.measurableSet (h : IsG\u03b4 s) : MeasurableSet s := by\nrcases h with \u27e8S, hSo, hSc, rfl\u27e9\n exact MeasurableSet.sInter hSc fun t ht => (hSo t ht).measurableSet\n```\n\n-- snippet 20\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_eq_generateFrom_of_subbasis (L62-L77)\ntheorem borel_eq_generateFrom_of_subbasis {s : Set (Set \u03b1)} [t : TopologicalSpace \u03b1]\n [SecondCountableTopology \u03b1] (hs : t = .generateFrom s) : borel \u03b1 = .generateFrom s :=\nle_antisymm\n (generateFrom_le fun u (hu : t.IsOpen u) => by\n rw [hs] at hu\n induction hu with\n | basic u hu => exact GenerateMeasurable.basic u hu\n | univ => exact @MeasurableSet.univ \u03b1 (generateFrom s)\n | inter s\u2081 s\u2082 _ _ hs\u2081 hs\u2082 => exact @MeasurableSet.inter \u03b1 (generateFrom s) _ _ hs\u2081 hs\u2082\n | sUnion f hf ih =>\n rcases isOpen_sUnion_countable f (by rwa [hs]) with \u27e8v, hv, vf, vu\u27e9\n rw [\u2190 vu]\n exact @MeasurableSet.sUnion \u03b1 (generateFrom s) _ hv fun x xv => ih _ (vf xv))\n (generateFrom_le fun u hu =>\n GenerateMeasurable.basic _ <| show t.IsOpen u by rw [hs]; exact GenerateOpen.basic _ hu)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel (L53-L55)\ndef borel (\u03b1 : Type u) [TopologicalSpace \u03b1] : MeasurableSpace \u03b1 :=\ngenerateFrom { s : Set \u03b1 | IsOpen s }\n```\n\n-- snippet 22\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsCompact (L264-L266)\ntheorem IsCompact.measurableSet [T2Space \u03b1] (h : IsCompact s) : MeasurableSet s :=\nh.isClosed.measurableSet\n```\n\n-- snippet 23\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_of_continuousAt (L254-L257)\ntheorem measurableSet_of_continuousAt {\u03b2} [PseudoEMetricSpace \u03b2] (f : \u03b1 \u2192 \u03b2) :\n MeasurableSet { x | ContinuousAt f x } :=\n(IsG\u03b4.setOf_continuousAt f).measurableSet\n```\n\n-- snippet 24\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Inseparable (L272-L278)\ntheorem Inseparable.mem_measurableSet_iff {x y : \u03b3} (h : Inseparable x y) {s : Set \u03b3}\n (hs : MeasurableSet s) : x \u2208 s \u2194 y \u2208 s :=\nMeasurableSet.induction_on_open (fun _ \u21a6 h.mem_open_iff) (fun _ _ \u21a6 Iff.not)\n (fun _ _ _ h \u21a6 by simp [h]) s hs\n\n/-- If `K` is a compact set in an R\u2081 space and `s \u2287 K` is a Borel measurable superset,\nthen `s` includes the closure of `K` as well. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_eq_top_of_discrete (L59-L61)\ntheorem borel_eq_top_of_discrete [TopologicalSpace \u03b1] [DiscreteTopology \u03b1] : borel \u03b1 = \u22a4 :=\ntop_le_iff.1 fun s _ => GenerateMeasurable.basic s (isOpen_discrete s)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.MeasureTheory.Constructions.AddChar.instDiscreteMeasurableSpace (L32-L36)\ninstance instDiscreteMeasurableSpace [DiscreteMeasurableSpace A] [Finite A] :\n DiscreteMeasurableSpace (AddChar A M) :=\n\u27e8fun _ \u21a6 trivial\u27e9\n\nend AddChar\n```\n\n-- snippet 27\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsClosed (L258-L260)\ntheorem IsClosed.measurableSet (h : IsClosed s) : MeasurableSet s :=\nh.isOpen_compl.measurableSet.of_compl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.isPiSystem_isClosed (L86-L88)\nlemma isPiSystem_isClosed [TopologicalSpace \u03b1] : IsPiSystem ({s : Set \u03b1 | IsClosed s}) :=\nfun _s hs _t ht _ \u21a6 IsClosed.inter hs ht\n```\n\n-- snippet 29\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Subtype (L189-L192)\ninstance Subtype.borelSpace {\u03b1 : Type*} [TopologicalSpace \u03b1] [MeasurableSpace \u03b1]\n [h\u03b1 : BorelSpace \u03b1] (p : \u03b1 \u2192 Prop) : BorelSpace (Subtype p) :=\n\u27e8by borelize \u03b1; symm; apply borel_comap\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.TopologicalSpace (L78-L82)\ntheorem TopologicalSpace.IsTopologicalBasis.borel_eq_generateFrom [TopologicalSpace \u03b1]\n [SecondCountableTopology \u03b1] {s : Set (Set \u03b1)} (hs : IsTopologicalBasis s) :\n borel \u03b1 = .generateFrom s :=\nborel_eq_generateFrom_of_subbasis hs.eq_generateFrom\n```\n\n-- snippet 31\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_frontier (L303-L305)\ntheorem measurableSet_frontier : MeasurableSet (frontier s) :=\nmeasurableSet_closure.diff measurableSet_interior\n```\n\n-- snippet 32\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_comap (L98-L101)\ntheorem borel_comap {f : \u03b1 \u2192 \u03b2} {t : TopologicalSpace \u03b2} :\n @borel \u03b1 (t.induced f) = (@borel \u03b2 t).comap f :=\ncomap_generateFrom.symm\n```\n\n-- snippet 33\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_interior (L247-L249)\ntheorem measurableSet_interior : MeasurableSet (interior s) :=\nisOpen_interior.measurableSet\n```\n\n-- snippet 34\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.isPiSystem_isOpen (L83-L85)\ntheorem isPiSystem_isOpen [TopologicalSpace \u03b1] : IsPiSystem ({s : Set \u03b1 | IsOpen s}) :=\nfun _s hs _t ht _ => IsOpen.inter hs ht\n```\n\n-- snippet 35\n```lean\n-- Mathlib.MeasureTheory.Constructions.AddChar.instMeasurableSpace (L28-L31)\ninstance instMeasurableSpace [DiscreteMeasurableSpace A] [Finite A] :\n MeasurableSpace (AddChar A M) :=\n\u22a4\n```\n\n-- snippet 36\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_closure (L299-L301)\ntheorem measurableSet_closure : MeasurableSet (closure s) :=\nisClosed_closure.measurableSet\n```\n\n-- snippet 37\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.opensMeasurableSpace_iff_forall_measurableSet (L205-L210)\nlemma opensMeasurableSpace_iff_forall_measurableSet\n [TopologicalSpace \u03b1] [MeasurableSpace \u03b1] :\n OpensMeasurableSpace \u03b1 \u2194 (\u2200 (s : Set \u03b1), IsOpen s \u2192 MeasurableSet s) := by\nrefine \u27e8fun h s hs \u21a6 ?_, fun h \u21a6 \u27e8generateFrom_le h\u27e9\u27e9\n exact OpensMeasurableSpace.borel_le _ <| GenerateMeasurable.basic _ hs\n```\n\n-- snippet 38\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.MeasurableSet (L232-L240)\ntheorem MeasurableSet.induction_on_open {C : \u2200 s : Set \u03b3, MeasurableSet s \u2192 Prop}\n (isOpen : \u2200 U (hU : IsOpen U), C U hU.measurableSet)\n (compl : \u2200 t (ht : MeasurableSet t), C t ht \u2192 C t\u1d9c ht.compl)\n (iUnion : \u2200 f : \u2115 \u2192 Set \u03b3, Pairwise (Disjoint on f) \u2192 \u2200 (hf : \u2200 i, MeasurableSet (f i)),\n (\u2200 i, C (f i) (hf i)) \u2192 C (\u22c3 i, f i) (.iUnion hf)) :\n \u2200 t (ht : MeasurableSet t), C t ht := fun t ht \u21a6\nMeasurableSpace.induction_on_inter BorelSpace.measurable_eq isPiSystem_isOpen\n (isOpen _ isOpen_empty) isOpen compl iUnion t ht\n```\n\n-- snippet 39\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsOpen (L224-L226)\ntheorem IsOpen.measurableSet (h : IsOpen s) : MeasurableSet s :=\nOpensMeasurableSpace.borel_le _ <| GenerateMeasurable.basic _ h\n```\n\n-- snippet 40\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Continuous (L102-L175)\ntheorem Continuous.borel_measurable [TopologicalSpace \u03b1] [TopologicalSpace \u03b2] {f : \u03b1 \u2192 \u03b2}\n (hf : Continuous f) : @Measurable \u03b1 \u03b2 (borel \u03b1) (borel \u03b2) f :=\nMeasurable.of_le_map <|\n generateFrom_le fun s hs => GenerateMeasurable.basic (f \u207b\u00b9' s) (hs.preimage hf)\n\n/-- A space with `MeasurableSpace` and `TopologicalSpace` structures such that\nall open sets are measurable. -/\nclass OpensMeasurableSpace (\u03b1 : Type*) [TopologicalSpace \u03b1] [h : MeasurableSpace \u03b1] : Prop where\n /-- Borel-measurable sets are measurable. -/\n borel_le : borel \u03b1 \u2264 h\n\n/-- A space with `MeasurableSpace` and `TopologicalSpace` structures such that\nthe `\u03c3`-algebra of measurable sets is exactly the `\u03c3`-algebra generated by open sets. -/\nclass BorelSpace (\u03b1 : Type*) [TopologicalSpace \u03b1] [MeasurableSpace \u03b1] : Prop where\n /-- The measurable sets are exactly the Borel-measurable sets. -/\n measurable_eq : \u2039MeasurableSpace \u03b1\u203a = borel \u03b1\n\nnamespace Mathlib.Tactic.Borelize\n\nopen Lean Elab Term Tactic Meta\n\n/-- The behaviour of `borelize \u03b1` depends on the existing assumptions on `\u03b1`.\n\n- if `\u03b1` is a topological space with instances `[MeasurableSpace \u03b1] [BorelSpace \u03b1]`, then\n `borelize \u03b1` replaces the former instance by `borel \u03b1`;\n- otherwise, `borelize \u03b1` adds instances `borel \u03b1 : MeasurableSpace \u03b1` and `\u27e8rfl\u27e9 : BorelSpace \u03b1`.\n\nFinally, `borelize \u03b1 \u03b2 \u03b3` runs `borelize \u03b1; borelize \u03b2; borelize \u03b3`.\n-/\nsyntax \"borelize\" (ppSpace colGt term:max)* : tactic\n\n/-- Add instances `borel e : MeasurableSpace e` and `\u27e8rfl\u27e9 : BorelSpace e`. -/\nmeta def addBorelInstance (e : Expr) : TacticM Unit := do\n let t \u2190 Lean.Elab.Term.exprToSyntax e\n evalTactic <| \u2190 `(tactic|\n refine_lift\n letI : MeasurableSpace $t := borel $t\n haveI : BorelSpace $t := \u27e8rfl\u27e9\n ?_)\n\n/-- Given a type `e`, an assumption `i : MeasurableSpace e`, and an instance `[BorelSpace e]`,\nreplace `i` with `borel e`. -/\nmeta def borelToRefl (e : Expr) (i : FVarId) : TacticM Unit := do\n let te \u2190 Lean.Elab.Term.exprToSyntax e\n evalTactic <| \u2190 `(tactic|\n have := @BorelSpace.measurable_eq $te _ _ _)\n try\n liftMetaTactic fun m => return [\u2190 subst m i]\n catch _ =>\n let et \u2190 synthInstance (\u2190 mkAppOptM ``TopologicalSpace #[e])\n throwError m!\"\\\n `\u2039TopologicalSpace {e}\u203a := {et}\\n\\\n depends on\\n\\\n {Expr.fvar i} : MeasurableSpace {e}`\\n\\\n so `borelize` isn't available\"\n evalTactic <| \u2190 `(tactic|\n refine_lift\n letI : MeasurableSpace $te := borel $te\n ?_)\n\n/-- Given a type `$t`, if there is an assumption `[i : MeasurableSpace $t]`, then try to prove\n`[BorelSpace $t]` and replace `i` with `borel $t`. Otherwise, add instances\n`borel $t : MeasurableSpace $t` and `\u27e8rfl\u27e9 : BorelSpace $t`. -/\nmeta def borelize (t : Term) : TacticM Unit := withMainContext do\n let u \u2190 mkFreshLevelMVar\n let e \u2190 withoutRecover <| Tactic.elabTermEnsuringType t (mkSort (mkLevelSucc u))\n let i? \u2190 findLocalDeclWithType? (\u2190 mkAppOptM ``MeasurableSpace #[e])\n i?.elim (addBorelInstance e) (borelToRefl e)\n\nelab_rules : tactic\n | `(tactic| borelize $[$t:term]*) => t.forM borelize\n\nend Mathlib.Tactic.Borelize\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Constructions.BorelSpace.Metric).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem measurable_norm : Measurable (norm : \u03b1 \u2192 \u211d)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurableSet_ball (L46-L48)\ntheorem measurableSet_ball : MeasurableSet (Metric.ball x \u03b5) :=\nMetric.isOpen_ball.measurableSet\n```\n\n-- snippet 2\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurableSet_closedBall (L50-L52)\ntheorem measurableSet_closedBall : MeasurableSet (Metric.closedBall x \u03b5) :=\nMetric.isClosed_closedBall.measurableSet\n```\n\n-- snippet 3\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_infDist (L53-L55)\ntheorem measurable_infDist {s : Set \u03b1} : Measurable fun x => infDist x s :=\n(continuous_infDist_pt s).measurable\n```\n\n-- snippet 4\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L57-L60)\ntheorem Measurable.infDist {f : \u03b2 \u2192 \u03b1} (hf : Measurable f) {s : Set \u03b1} :\n Measurable fun x => infDist (f x) s :=\nmeasurable_infDist.comp hf\n```\n\n-- snippet 5\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_infNndist (L61-L63)\ntheorem measurable_infNndist {s : Set \u03b1} : Measurable fun x => infNndist x s :=\n(continuous_infNndist_pt s).measurable\n```\n\n-- snippet 6\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L65-L68)\ntheorem Measurable.infNndist {f : \u03b2 \u2192 \u03b1} (hf : Measurable f) {s : Set \u03b1} :\n Measurable fun x => infNndist (f x) s :=\nmeasurable_infNndist.comp hf\n```\n\n-- snippet 7\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_dist (L73-L75)\ntheorem measurable_dist : Measurable fun p : \u03b1 \u00d7 \u03b1 => dist p.1 p.2 :=\ncontinuous_dist.measurable\n```\n\n-- snippet 8\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L77-L80)\ntheorem Measurable.dist {f g : \u03b2 \u2192 \u03b1} (hf : Measurable f) (hg : Measurable g) :\n Measurable fun b => dist (f b) (g b) :=\ncontinuous_dist.measurable2 hf hg\n```\n\n-- snippet 9\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.AEMeasurable (L82-L86)\nlemma AEMeasurable.dist {f g : \u03b2 \u2192 \u03b1} {\u03bc : Measure \u03b2}\n (hf : AEMeasurable f \u03bc) (hg : AEMeasurable g \u03bc) :\n AEMeasurable (fun b \u21a6 dist (f b) (g b)) \u03bc :=\ncontinuous_dist.aemeasurable2 hf hg\n```\n\n-- snippet 10\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_nndist (L87-L89)\ntheorem measurable_nndist : Measurable fun p : \u03b1 \u00d7 \u03b1 => nndist p.1 p.2 :=\ncontinuous_nndist.measurable\n```\n\n-- snippet 11\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.Measurable (L91-L94)\ntheorem Measurable.nndist {f g : \u03b2 \u2192 \u03b1} (hf : Measurable f) (hg : Measurable g) :\n Measurable fun b => nndist (f b) (g b) :=\ncontinuous_nndist.measurable2 hf hg\n```\n\n-- snippet 12\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurableSet_eball (L107-L109)\ntheorem measurableSet_eball : MeasurableSet (Metric.eball x \u03b5) :=\nMetric.isOpen_eball.measurableSet\n```\n\n-- snippet 13\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_edist_right (L111-L112)\ntheorem measurable_edist_right : Measurable (edist x) := by fun_prop\n```\n\n-- snippet 14\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_edist_left (L114-L115)\ntheorem measurable_edist_left : Measurable fun y \u21a6 edist y x := by fun_prop\n```\n\n-- snippet 15\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_infEDist (L116-L118)\ntheorem measurable_infEDist {s : Set \u03b1} : Measurable fun x => infEDist x s :=\ncontinuous_infEDist.measurable\n```\n\n-- snippet 16\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Countable (L193-L198)\ninstance Countable.instBorelSpace [Countable \u03b1] [MeasurableSpace \u03b1] [MeasurableSingletonClass \u03b1]\n [TopologicalSpace \u03b1] [DiscreteTopology \u03b1] : BorelSpace \u03b1 := by\nhave : \u2200 s, @MeasurableSet \u03b1 inferInstance s := fun s \u21a6 s.to_countable.measurableSet\n have : \u2200 s, @MeasurableSet \u03b1 (borel \u03b1) s := fun s \u21a6 measurableSet_generateFrom (isOpen_discrete s)\n exact \u27e8by aesop\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_anti (L56-L58)\ntheorem borel_anti : Antitone (@borel \u03b1) := fun _ _ h =>\nMeasurableSpace.generateFrom_le fun _ hs => .basic _ (h _ hs)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_eq_generateFrom_isClosed (L89-L97)\ntheorem borel_eq_generateFrom_isClosed [TopologicalSpace \u03b1] :\n borel \u03b1 = .generateFrom { s | IsClosed s } :=\nle_antisymm\n (generateFrom_le fun _t ht =>\n @MeasurableSet.of_compl \u03b1 _ (generateFrom { s | IsClosed s })\n (GenerateMeasurable.basic _ <| isClosed_compl_iff.2 ht))\n (generateFrom_le fun _t ht =>\n @MeasurableSet.of_compl \u03b1 _ (borel \u03b1) (GenerateMeasurable.basic _ <| isOpen_compl_iff.2 ht))\n```\n\n-- snippet 19\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsG\u03b4 (L250-L253)\ntheorem IsG\u03b4.measurableSet (h : IsG\u03b4 s) : MeasurableSet s := by\nrcases h with \u27e8S, hSo, hSc, rfl\u27e9\n exact MeasurableSet.sInter hSc fun t ht => (hSo t ht).measurableSet\n```\n\n-- snippet 20\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_eq_generateFrom_of_subbasis (L62-L77)\ntheorem borel_eq_generateFrom_of_subbasis {s : Set (Set \u03b1)} [t : TopologicalSpace \u03b1]\n [SecondCountableTopology \u03b1] (hs : t = .generateFrom s) : borel \u03b1 = .generateFrom s :=\nle_antisymm\n (generateFrom_le fun u (hu : t.IsOpen u) => by\n rw [hs] at hu\n induction hu with\n | basic u hu => exact GenerateMeasurable.basic u hu\n | univ => exact @MeasurableSet.univ \u03b1 (generateFrom s)\n | inter s\u2081 s\u2082 _ _ hs\u2081 hs\u2082 => exact @MeasurableSet.inter \u03b1 (generateFrom s) _ _ hs\u2081 hs\u2082\n | sUnion f hf ih =>\n rcases isOpen_sUnion_countable f (by rwa [hs]) with \u27e8v, hv, vf, vu\u27e9\n rw [\u2190 vu]\n exact @MeasurableSet.sUnion \u03b1 (generateFrom s) _ hv fun x xv => ih _ (vf xv))\n (generateFrom_le fun u hu =>\n GenerateMeasurable.basic _ <| show t.IsOpen u by rw [hs]; exact GenerateOpen.basic _ hu)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel (L53-L55)\ndef borel (\u03b1 : Type u) [TopologicalSpace \u03b1] : MeasurableSpace \u03b1 :=\ngenerateFrom { s : Set \u03b1 | IsOpen s }\n```\n\n-- snippet 22\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsCompact (L264-L266)\ntheorem IsCompact.measurableSet [T2Space \u03b1] (h : IsCompact s) : MeasurableSet s :=\nh.isClosed.measurableSet\n```\n\n-- snippet 23\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_of_continuousAt (L254-L257)\ntheorem measurableSet_of_continuousAt {\u03b2} [PseudoEMetricSpace \u03b2] (f : \u03b1 \u2192 \u03b2) :\n MeasurableSet { x | ContinuousAt f x } :=\n(IsG\u03b4.setOf_continuousAt f).measurableSet\n```\n\n-- snippet 24\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Inseparable (L272-L278)\ntheorem Inseparable.mem_measurableSet_iff {x y : \u03b3} (h : Inseparable x y) {s : Set \u03b3}\n (hs : MeasurableSet s) : x \u2208 s \u2194 y \u2208 s :=\nMeasurableSet.induction_on_open (fun _ \u21a6 h.mem_open_iff) (fun _ _ \u21a6 Iff.not)\n (fun _ _ _ h \u21a6 by simp [h]) s hs\n\n/-- If `K` is a compact set in an R\u2081 space and `s \u2287 K` is a Borel measurable superset,\nthen `s` includes the closure of `K` as well. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_eq_top_of_discrete (L59-L61)\ntheorem borel_eq_top_of_discrete [TopologicalSpace \u03b1] [DiscreteTopology \u03b1] : borel \u03b1 = \u22a4 :=\ntop_le_iff.1 fun s _ => GenerateMeasurable.basic s (isOpen_discrete s)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.MeasureTheory.Constructions.AddChar.instDiscreteMeasurableSpace (L32-L36)\ninstance instDiscreteMeasurableSpace [DiscreteMeasurableSpace A] [Finite A] :\n DiscreteMeasurableSpace (AddChar A M) :=\n\u27e8fun _ \u21a6 trivial\u27e9\n\nend AddChar\n```\n\n-- snippet 27\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsClosed (L258-L260)\ntheorem IsClosed.measurableSet (h : IsClosed s) : MeasurableSet s :=\nh.isOpen_compl.measurableSet.of_compl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.isPiSystem_isClosed (L86-L88)\nlemma isPiSystem_isClosed [TopologicalSpace \u03b1] : IsPiSystem ({s : Set \u03b1 | IsClosed s}) :=\nfun _s hs _t ht _ \u21a6 IsClosed.inter hs ht\n```\n\n-- snippet 29\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Subtype (L189-L192)\ninstance Subtype.borelSpace {\u03b1 : Type*} [TopologicalSpace \u03b1] [MeasurableSpace \u03b1]\n [h\u03b1 : BorelSpace \u03b1] (p : \u03b1 \u2192 Prop) : BorelSpace (Subtype p) :=\n\u27e8by borelize \u03b1; symm; apply borel_comap\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.TopologicalSpace (L78-L82)\ntheorem TopologicalSpace.IsTopologicalBasis.borel_eq_generateFrom [TopologicalSpace \u03b1]\n [SecondCountableTopology \u03b1] {s : Set (Set \u03b1)} (hs : IsTopologicalBasis s) :\n borel \u03b1 = .generateFrom s :=\nborel_eq_generateFrom_of_subbasis hs.eq_generateFrom\n```\n\n-- snippet 31\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_frontier (L303-L305)\ntheorem measurableSet_frontier : MeasurableSet (frontier s) :=\nmeasurableSet_closure.diff measurableSet_interior\n```\n\n-- snippet 32\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.borel_comap (L98-L101)\ntheorem borel_comap {f : \u03b1 \u2192 \u03b2} {t : TopologicalSpace \u03b2} :\n @borel \u03b1 (t.induced f) = (@borel \u03b2 t).comap f :=\ncomap_generateFrom.symm\n```\n\n-- snippet 33\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_interior (L247-L249)\ntheorem measurableSet_interior : MeasurableSet (interior s) :=\nisOpen_interior.measurableSet\n```\n\n-- snippet 34\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.isPiSystem_isOpen (L83-L85)\ntheorem isPiSystem_isOpen [TopologicalSpace \u03b1] : IsPiSystem ({s : Set \u03b1 | IsOpen s}) :=\nfun _s hs _t ht _ => IsOpen.inter hs ht\n```\n\n-- snippet 35\n```lean\n-- Mathlib.MeasureTheory.Constructions.AddChar.instMeasurableSpace (L28-L31)\ninstance instMeasurableSpace [DiscreteMeasurableSpace A] [Finite A] :\n MeasurableSpace (AddChar A M) :=\n\u22a4\n```\n\n-- snippet 36\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.measurableSet_closure (L299-L301)\ntheorem measurableSet_closure : MeasurableSet (closure s) :=\nisClosed_closure.measurableSet\n```\n\n-- snippet 37\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.opensMeasurableSpace_iff_forall_measurableSet (L205-L210)\nlemma opensMeasurableSpace_iff_forall_measurableSet\n [TopologicalSpace \u03b1] [MeasurableSpace \u03b1] :\n OpensMeasurableSpace \u03b1 \u2194 (\u2200 (s : Set \u03b1), IsOpen s \u2192 MeasurableSet s) := by\nrefine \u27e8fun h s hs \u21a6 ?_, fun h \u21a6 \u27e8generateFrom_le h\u27e9\u27e9\n exact OpensMeasurableSpace.borel_le _ <| GenerateMeasurable.basic _ hs\n```\n\n-- snippet 38\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.MeasurableSet (L232-L240)\ntheorem MeasurableSet.induction_on_open {C : \u2200 s : Set \u03b3, MeasurableSet s \u2192 Prop}\n (isOpen : \u2200 U (hU : IsOpen U), C U hU.measurableSet)\n (compl : \u2200 t (ht : MeasurableSet t), C t ht \u2192 C t\u1d9c ht.compl)\n (iUnion : \u2200 f : \u2115 \u2192 Set \u03b3, Pairwise (Disjoint on f) \u2192 \u2200 (hf : \u2200 i, MeasurableSet (f i)),\n (\u2200 i, C (f i) (hf i)) \u2192 C (\u22c3 i, f i) (.iUnion hf)) :\n \u2200 t (ht : MeasurableSet t), C t ht := fun t ht \u21a6\nMeasurableSpace.induction_on_inter BorelSpace.measurable_eq isPiSystem_isOpen\n (isOpen _ isOpen_empty) isOpen compl iUnion t ht\n```\n\n-- snippet 39\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.IsOpen (L224-L226)\ntheorem IsOpen.measurableSet (h : IsOpen s) : MeasurableSet s :=\nOpensMeasurableSpace.borel_le _ <| GenerateMeasurable.basic _ h\n```\n\n-- snippet 40\n```lean\n-- Mathlib.MeasureTheory.Constructions.BorelSpace.Basic.Continuous (L102-L175)\ntheorem Continuous.borel_measurable [TopologicalSpace \u03b1] [TopologicalSpace \u03b2] {f : \u03b1 \u2192 \u03b2}\n (hf : Continuous f) : @Measurable \u03b1 \u03b2 (borel \u03b1) (borel \u03b2) f :=\nMeasurable.of_le_map <|\n generateFrom_le fun s hs => GenerateMeasurable.basic (f \u207b\u00b9' s) (hs.preimage hf)\n\n/-- A space with `MeasurableSpace` and `TopologicalSpace` structures such that\nall open sets are measurable. -/\nclass OpensMeasurableSpace (\u03b1 : Type*) [TopologicalSpace \u03b1] [h : MeasurableSpace \u03b1] : Prop where\n /-- Borel-measurable sets are measurable. -/\n borel_le : borel \u03b1 \u2264 h\n\n/-- A space with `MeasurableSpace` and `TopologicalSpace` structures such that\nthe `\u03c3`-algebra of measurable sets is exactly the `\u03c3`-algebra generated by open sets. -/\nclass BorelSpace (\u03b1 : Type*) [TopologicalSpace \u03b1] [MeasurableSpace \u03b1] : Prop where\n /-- The measurable sets are exactly the Borel-measurable sets. -/\n measurable_eq : \u2039MeasurableSpace \u03b1\u203a = borel \u03b1\n\nnamespace Mathlib.Tactic.Borelize\n\nopen Lean Elab Term Tactic Meta\n\n/-- The behaviour of `borelize \u03b1` depends on the existing assumptions on `\u03b1`.\n\n- if `\u03b1` is a topological space with instances `[MeasurableSpace \u03b1] [BorelSpace \u03b1]`, then\n `borelize \u03b1` replaces the former instance by `borel \u03b1`;\n- otherwise, `borelize \u03b1` adds instances `borel \u03b1 : MeasurableSpace \u03b1` and `\u27e8rfl\u27e9 : BorelSpace \u03b1`.\n\nFinally, `borelize \u03b1 \u03b2 \u03b3` runs `borelize \u03b1; borelize \u03b2; borelize \u03b3`.\n-/\nsyntax \"borelize\" (ppSpace colGt term:max)* : tactic\n\n/-- Add instances `borel e : MeasurableSpace e` and `\u27e8rfl\u27e9 : BorelSpace e`. -/\nmeta def addBorelInstance (e : Expr) : TacticM Unit := do\n let t \u2190 Lean.Elab.Term.exprToSyntax e\n evalTactic <| \u2190 `(tactic|\n refine_lift\n letI : MeasurableSpace $t := borel $t\n haveI : BorelSpace $t := \u27e8rfl\u27e9\n ?_)\n\n/-- Given a type `e`, an assumption `i : MeasurableSpace e`, and an instance `[BorelSpace e]`,\nreplace `i` with `borel e`. -/\nmeta def borelToRefl (e : Expr) (i : FVarId) : TacticM Unit := do\n let te \u2190 Lean.Elab.Term.exprToSyntax e\n evalTactic <| \u2190 `(tactic|\n have := @BorelSpace.measurable_eq $te _ _ _)\n try\n liftMetaTactic fun m => return [\u2190 subst m i]\n catch _ =>\n let et \u2190 synthInstance (\u2190 mkAppOptM ``TopologicalSpace #[e])\n throwError m!\"\\\n `\u2039TopologicalSpace {e}\u203a := {et}\\n\\\n depends on\\n\\\n {Expr.fvar i} : MeasurableSpace {e}`\\n\\\n so `borelize` isn't available\"\n evalTactic <| \u2190 `(tactic|\n refine_lift\n letI : MeasurableSpace $te := borel $te\n ?_)\n\n/-- Given a type `$t`, if there is an assumption `[i : MeasurableSpace $t]`, then try to prove\n`[BorelSpace $t]` and replace `i` with `borel $t`. Otherwise, add instances\n`borel $t : MeasurableSpace $t` and `\u27e8rfl\u27e9 : BorelSpace $t`. -/\nmeta def borelize (t : Term) : TacticM Unit := withMainContext do\n let u \u2190 mkFreshLevelMVar\n let e \u2190 withoutRecover <| Tactic.elabTermEnsuringType t (mkSort (mkLevelSucc u))\n let i? \u2190 findLocalDeclWithType? (\u2190 mkAppOptM ``MeasurableSpace #[e])\n i?.elim (addBorelInstance e) (borelToRefl e)\n\nelab_rules : tactic\n | `(tactic| borelize $[$t:term]*) => t.forM borelize\n\nend Mathlib.Tactic.Borelize\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Constructions/BorelSpace/Metric.lean", "module": "Mathlib.MeasureTheory.Constructions.BorelSpace.Metric", "declaration": "Mathlib.MeasureTheory.Constructions.BorelSpace.Metric.measurable_norm", "span": "L244-L246", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Constructions/BorelSpace/Metric.lean#L244"}, "environment": {}, "measurements": {"input_tokens": 5305, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 15171, "lean_code_chars": 13649, "natural_language_chars": 1522, "lean_code_ratio": 0.8997, "line_count": 408, "imports_count": 0, "declarations_count": 1346, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "934a1d357b574aed", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.ModelTheory.Substructures.comap_le_comap_iff_of_surjective", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.Substructures)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem comap_le_comap_iff_of_surjective {S T : L.Substructure N} : S.comap f \u2264 T.comap f \u2194 S \u2264 T\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.ModelTheory.Substructures.ClosedUnder (L66-L70)\ndef ClosedUnder : Prop :=\n\u2200 x : Fin n \u2192 M, (\u2200 i : Fin n, x i \u2208 s) \u2192 funMap f x \u2208 s\n\nvariable (L)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.ModelTheory.Substructures.closedUnder_univ (L72-L77)\ntheorem closedUnder_univ : ClosedUnder f (univ : Set M) := fun _ _ => mem_univ _\nvariable {L f s} {t : Set M}\n\nnamespace ClosedUnder\n```\n\n-- snippet 3\n```lean\n-- Mathlib.ModelTheory.Substructures.inter (L78-L80)\ntheorem inter (hs : ClosedUnder f s) (ht : ClosedUnder f t) : ClosedUnder f (s \u2229 t) := fun x h =>\nmem_inter (hs x fun i => mem_of_mem_inter_left (h i)) (ht x fun i => mem_of_mem_inter_right (h i))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.ModelTheory.Substructures.inf (L81-L85)\ntheorem inf (hs : ClosedUnder f s) (ht : ClosedUnder f t) : ClosedUnder f (s \u2293 t) :=\nhs.inter ht\n\nvariable {S : Set (Set M)}\n```\n\n-- snippet 5\n```lean\n-- Mathlib.ModelTheory.Substructures.sInf (L86-L104)\ntheorem sInf (hS : \u2200 s, s \u2208 S \u2192 ClosedUnder f s) : ClosedUnder f (sInf S) := fun x h s hs =>\nhS s hs x fun i => h i s hs\n\nend ClosedUnder\n\nend ClosedUnder\n\nvariable (L) (M)\n\n/-- A substructure of a structure `M` is a set closed under application of function symbols. -/\nstructure Substructure where\n /-- The underlying set of this substructure -/\n carrier : Set M\n fun_mem : \u2200 {n}, \u2200 f : L.Functions n, ClosedUnder f carrier\n\nvariable {L} {M}\n\nnamespace Substructure\n```\n\n-- snippet 6\n```lean\n-- Mathlib.ModelTheory.Substructures.instSetLike (L107-L109)\ninstance instSetLike : SetLike (L.Substructure M) M :=\n\u27e8Substructure.carrier, fun p q h => by cases p; cases q; congr\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.ModelTheory.Substructures.Simps (L113-L117)\ndef Simps.coe (S : L.Substructure M) : Set M :=\nS\n\ninitialize_simps_projections Substructure (carrier \u2192 coe, as_prefix coe)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.ModelTheory.Substructures.mem_carrier (L119-L122)\ntheorem mem_carrier {s : L.Substructure M} {x : M} : x \u2208 s.carrier \u2194 x \u2208 s :=\nIff.rfl\n\n/-- Two substructures are equal if they have the same elements. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.ModelTheory.Substructures.ext (L124-L135)\ntheorem ext {S T : L.Substructure M} (h : \u2200 x, x \u2208 S \u2194 x \u2208 T) : S = T :=\nSetLike.ext h\n\n/-- Copy a substructure replacing `carrier` with a set that is equal to it. -/\nprotected def copy (S : L.Substructure M) (s : Set M) (hs : s = S) : L.Substructure M where\n carrier := s\n fun_mem _ f := hs.symm \u25b8 S.fun_mem _ f\n\nend Substructure\n\nvariable {S : L.Substructure M}\n```\n\n-- snippet 10\n```lean\n-- Mathlib.ModelTheory.Substructures.Term (L136-L143)\ntheorem Term.realize_mem {\u03b1 : Type*} (t : L.Term \u03b1) (xs : \u03b1 \u2192 M) (h : \u2200 a, xs a \u2208 S) :\n t.realize xs \u2208 S := by\ninduction t with\n | var a => exact h a\n | func f ts ih => exact Substructure.fun_mem _ _ _ ih\n\nnamespace Substructure\n```\n\n-- snippet 11\n```lean\n-- Mathlib.ModelTheory.Substructures.coe_copy (L145-L147)\ntheorem coe_copy {s : Set M} (hs : s = S) : (S.copy s hs : Set M) = s :=\nrfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.ModelTheory.Substructures.copy_eq (L148-L150)\ntheorem copy_eq {s : Set M} (hs : s = S) : S.copy s hs = S :=\nSetLike.coe_injective hs\n```\n\n-- snippet 13\n```lean\n-- Mathlib.ModelTheory.Substructures.constants_mem (L151-L154)\ntheorem constants_mem (c : L.Constants) : (c : M) \u2208 S :=\nmem_carrier.2 (S.fun_mem c _ finZeroElim)\n\n/-- The substructure `M` of the structure `M`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.ModelTheory.Substructures.instTop (L155-L158)\ninstance instTop : Top (L.Substructure M) :=\n\u27e8{ carrier := Set.univ\n fun_mem := fun {_} _ _ _ => Set.mem_univ _ }\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.ModelTheory.Substructures.instInhabited (L159-L161)\ninstance instInhabited : Inhabited (L.Substructure M) :=\n\u27e8\u22a4\u27e9\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.Substructures).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem comap_le_comap_iff_of_surjective {S T : L.Substructure N} : S.comap f \u2264 T.comap f \u2194 S \u2264 T\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.ModelTheory.Substructures.ClosedUnder (L66-L70)\ndef ClosedUnder : Prop :=\n\u2200 x : Fin n \u2192 M, (\u2200 i : Fin n, x i \u2208 s) \u2192 funMap f x \u2208 s\n\nvariable (L)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.ModelTheory.Substructures.closedUnder_univ (L72-L77)\ntheorem closedUnder_univ : ClosedUnder f (univ : Set M) := fun _ _ => mem_univ _\nvariable {L f s} {t : Set M}\n\nnamespace ClosedUnder\n```\n\n-- snippet 3\n```lean\n-- Mathlib.ModelTheory.Substructures.inter (L78-L80)\ntheorem inter (hs : ClosedUnder f s) (ht : ClosedUnder f t) : ClosedUnder f (s \u2229 t) := fun x h =>\nmem_inter (hs x fun i => mem_of_mem_inter_left (h i)) (ht x fun i => mem_of_mem_inter_right (h i))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.ModelTheory.Substructures.inf (L81-L85)\ntheorem inf (hs : ClosedUnder f s) (ht : ClosedUnder f t) : ClosedUnder f (s \u2293 t) :=\nhs.inter ht\n\nvariable {S : Set (Set M)}\n```\n\n-- snippet 5\n```lean\n-- Mathlib.ModelTheory.Substructures.sInf (L86-L104)\ntheorem sInf (hS : \u2200 s, s \u2208 S \u2192 ClosedUnder f s) : ClosedUnder f (sInf S) := fun x h s hs =>\nhS s hs x fun i => h i s hs\n\nend ClosedUnder\n\nend ClosedUnder\n\nvariable (L) (M)\n\n/-- A substructure of a structure `M` is a set closed under application of function symbols. -/\nstructure Substructure where\n /-- The underlying set of this substructure -/\n carrier : Set M\n fun_mem : \u2200 {n}, \u2200 f : L.Functions n, ClosedUnder f carrier\n\nvariable {L} {M}\n\nnamespace Substructure\n```\n\n-- snippet 6\n```lean\n-- Mathlib.ModelTheory.Substructures.instSetLike (L107-L109)\ninstance instSetLike : SetLike (L.Substructure M) M :=\n\u27e8Substructure.carrier, fun p q h => by cases p; cases q; congr\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.ModelTheory.Substructures.Simps (L113-L117)\ndef Simps.coe (S : L.Substructure M) : Set M :=\nS\n\ninitialize_simps_projections Substructure (carrier \u2192 coe, as_prefix coe)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.ModelTheory.Substructures.mem_carrier (L119-L122)\ntheorem mem_carrier {s : L.Substructure M} {x : M} : x \u2208 s.carrier \u2194 x \u2208 s :=\nIff.rfl\n\n/-- Two substructures are equal if they have the same elements. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.ModelTheory.Substructures.ext (L124-L135)\ntheorem ext {S T : L.Substructure M} (h : \u2200 x, x \u2208 S \u2194 x \u2208 T) : S = T :=\nSetLike.ext h\n\n/-- Copy a substructure replacing `carrier` with a set that is equal to it. -/\nprotected def copy (S : L.Substructure M) (s : Set M) (hs : s = S) : L.Substructure M where\n carrier := s\n fun_mem _ f := hs.symm \u25b8 S.fun_mem _ f\n\nend Substructure\n\nvariable {S : L.Substructure M}\n```\n\n-- snippet 10\n```lean\n-- Mathlib.ModelTheory.Substructures.Term (L136-L143)\ntheorem Term.realize_mem {\u03b1 : Type*} (t : L.Term \u03b1) (xs : \u03b1 \u2192 M) (h : \u2200 a, xs a \u2208 S) :\n t.realize xs \u2208 S := by\ninduction t with\n | var a => exact h a\n | func f ts ih => exact Substructure.fun_mem _ _ _ ih\n\nnamespace Substructure\n```\n\n-- snippet 11\n```lean\n-- Mathlib.ModelTheory.Substructures.coe_copy (L145-L147)\ntheorem coe_copy {s : Set M} (hs : s = S) : (S.copy s hs : Set M) = s :=\nrfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.ModelTheory.Substructures.copy_eq (L148-L150)\ntheorem copy_eq {s : Set M} (hs : s = S) : S.copy s hs = S :=\nSetLike.coe_injective hs\n```\n\n-- snippet 13\n```lean\n-- Mathlib.ModelTheory.Substructures.constants_mem (L151-L154)\ntheorem constants_mem (c : L.Constants) : (c : M) \u2208 S :=\nmem_carrier.2 (S.fun_mem c _ finZeroElim)\n\n/-- The substructure `M` of the structure `M`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.ModelTheory.Substructures.instTop (L155-L158)\ninstance instTop : Top (L.Substructure M) :=\n\u27e8{ carrier := Set.univ\n fun_mem := fun {_} _ _ _ => Set.mem_univ _ }\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.ModelTheory.Substructures.instInhabited (L159-L161)\ninstance instInhabited : Inhabited (L.Substructure M) :=\n\u27e8\u22a4\u27e9\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/ModelTheory/Substructures.lean", "module": "Mathlib.ModelTheory.Substructures", "declaration": "Mathlib.ModelTheory.Substructures.comap_le_comap_iff_of_surjective", "span": "L620-L622", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/Substructures.lean#L620"}, "environment": {}, "measurements": {"input_tokens": 1486, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4302, "lean_code_chars": 3475, "natural_language_chars": 827, "lean_code_ratio": 0.8078, "line_count": 155, "imports_count": 0, "declarations_count": 518, "diagnostics_count": 0, "retrieval_snippets_count": 15, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "0d222353f19ac741", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2086", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma variableChange_b\u2086 : (C \u2022 W).b\u2086 =\n C.u\u207b\u00b9 ^ 6 * (W.b\u2086 + 2 * C.r * W.b\u2084 + C.r ^ 2 * W.b\u2082 + 4 * C.r ^ 3)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.one_def (L75-L76)\nlemma one_def : (1 : VariableChange R) = \u27e81, 0, 0, 0\u27e9 := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.mul_def (L85-L90)\nlemma mul_def : C * C' = {\n u := C.u * C'.u\nr := C.r * C'.u ^ 2 + C'.r\n s := C'.u * C.s + C'.s\n t := C.t * C'.u ^ 3 + C.r * C'.s * C'.u ^ 2 + C'.t } := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.inv_def (L99-L104)\nlemma inv_def : C\u207b\u00b9 = {\n u := C.u\u207b\u00b9\nr := -C.r * C.u\u207b\u00b9 ^ 2\n s := -C.s * C.u\u207b\u00b9\n t := (C.r * C.s - C.t) * C.u\u207b\u00b9 ^ 3 } := rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_def (L137-L145)\nlemma variableChange_def : C \u2022 W = {\n a\u2081 := C.u\u207b\u00b9 * (W.a\u2081 + 2 * C.s)\na\u2082 := C.u\u207b\u00b9 ^ 2 * (W.a\u2082 - C.s * W.a\u2081 + 3 * C.r - C.s ^ 2)\n a\u2083 := C.u\u207b\u00b9 ^ 3 * (W.a\u2083 + C.r * W.a\u2081 + 2 * C.t)\n a\u2084 := C.u\u207b\u00b9 ^ 4 * (W.a\u2084 - C.s * W.a\u2083 + 2 * C.r * W.a\u2082 - (C.t + C.r * C.s) * W.a\u2081 + 3 * C.r ^ 2\n - 2 * C.s * C.t)\n a\u2086 := C.u\u207b\u00b9 ^ 6 * (W.a\u2086 + C.r * W.a\u2084 + C.r ^ 2 * W.a\u2082 + C.r ^ 3 - C.t * W.a\u2083 - C.t ^ 2\n - C.r * C.t * W.a\u2081) } := rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2081 (L177-L178)\nlemma variableChange_a\u2081 : (C \u2022 W).a\u2081 = C.u\u207b\u00b9 * (W.a\u2081 + 2 * C.s) := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2082 (L179-L180)\nlemma variableChange_a\u2082 : (C \u2022 W).a\u2082 = C.u\u207b\u00b9 ^ 2 * (W.a\u2082 - C.s * W.a\u2081 + 3 * C.r - C.s ^ 2) := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2083 (L181-L182)\nlemma variableChange_a\u2083 : (C \u2022 W).a\u2083 = C.u\u207b\u00b9 ^ 3 * (W.a\u2083 + C.r * W.a\u2081 + 2 * C.t) := rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2084 (L183-L186)\nlemma variableChange_a\u2084 : (C \u2022 W).a\u2084 =\n C.u\u207b\u00b9 ^ 4 * (W.a\u2084 - C.s * W.a\u2083 + 2 * C.r * W.a\u2082 - (C.t + C.r * C.s) * W.a\u2081 + 3 * C.r ^ 2\n - 2 * C.s * C.t) := rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2086 (L187-L190)\nlemma variableChange_a\u2086 : (C \u2022 W).a\u2086 =\n C.u\u207b\u00b9 ^ 6 * (W.a\u2086 + C.r * W.a\u2084 + C.r ^ 2 * W.a\u2082 + C.r ^ 3 - C.t * W.a\u2083 - C.t ^ 2\n - C.r * C.t * W.a\u2081) := rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2082 (L191-L194)\nlemma variableChange_b\u2082 : (C \u2022 W).b\u2082 = C.u\u207b\u00b9 ^ 2 * (W.b\u2082 + 12 * C.r) := by\nsimp only [b\u2082, variableChange_a\u2081, variableChange_a\u2082]\n ring1\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2084 (L195-L198)\nlemma variableChange_b\u2084 : (C \u2022 W).b\u2084 = C.u\u207b\u00b9 ^ 4 * (W.b\u2084 + C.r * W.b\u2082 + 6 * C.r ^ 2) := by\nsimp only [b\u2082, b\u2084, variableChange_a\u2081, variableChange_a\u2083, variableChange_a\u2084]\n ring1\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2088 (L204-L209)\nlemma variableChange_b\u2088 : (C \u2022 W).b\u2088 = C.u\u207b\u00b9 ^ 8 *\n (W.b\u2088 + 3 * C.r * W.b\u2086 + 3 * C.r ^ 2 * W.b\u2084 + C.r ^ 3 * W.b\u2082 + 3 * C.r ^ 4) := by\nsimp only [b\u2082, b\u2084, b\u2086, b\u2088, variableChange_a\u2081, variableChange_a\u2082, variableChange_a\u2083,\n variableChange_a\u2084, variableChange_a\u2086]\n ring1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_c\u2084 (L210-L213)\nlemma variableChange_c\u2084 : (C \u2022 W).c\u2084 = C.u\u207b\u00b9 ^ 4 * W.c\u2084 := by\nsimp only [c\u2084, variableChange_b\u2082, variableChange_b\u2084]\n ring1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_c\u2086 (L214-L217)\nlemma variableChange_c\u2086 : (C \u2022 W).c\u2086 = C.u\u207b\u00b9 ^ 6 * W.c\u2086 := by\nsimp only [c\u2086, variableChange_b\u2082, variableChange_b\u2084, variableChange_b\u2086]\n ring1\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_\u0394 (L218-L224)\nlemma variableChange_\u0394 : (C \u2022 W).\u0394 = C.u\u207b\u00b9 ^ 12 * W.\u0394 := by\nsimp only [b\u2082, b\u2084, b\u2086, b\u2088, \u0394, variableChange_a\u2081, variableChange_a\u2082, variableChange_a\u2083,\n variableChange_a\u2084, variableChange_a\u2086]\n ring1\n\nvariable [W.IsElliptic]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_\u0394' (L230-L233)\nlemma variableChange_\u0394' : (C \u2022 W).\u0394' = C.u\u207b\u00b9 ^ 12 * W.\u0394' := by\nsimp_rw [Units.ext_iff, Units.val_mul, coe_\u0394', variableChange_\u0394, Units.val_pow_eq_pow_val]\n\nset_option linter.docPrime false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.coe_variableChange_\u0394' (L234-L237)\nlemma coe_variableChange_\u0394' : ((C \u2022 W).\u0394' : R) = C.u\u207b\u00b9 ^ 12 * W.\u0394' := by\nsimp_rw [coe_\u0394', variableChange_\u0394]\n\nset_option linter.docPrime false in\n```\n\n-- snippet 18\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.inv_variableChange_\u0394' (L238-L241)\nlemma inv_variableChange_\u0394' : (C \u2022 W).\u0394'\u207b\u00b9 = C.u ^ 12 * W.\u0394'\u207b\u00b9 := by\nrw [variableChange_\u0394', mul_inv, inv_pow, inv_inv]\n\nset_option linter.docPrime false in\n```\n\n-- snippet 19\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.coe_inv_variableChange_\u0394' (L242-L244)\nlemma coe_inv_variableChange_\u0394' : (\u2191(C \u2022 W).\u0394'\u207b\u00b9 : R) = C.u ^ 12 * W.\u0394'\u207b\u00b9 := by\nrw [inv_variableChange_\u0394', Units.val_mul, Units.val_pow_eq_pow_val]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_j (L246-L262)\nlemma variableChange_j : (C \u2022 W).j = W.j := by\nrw [j, coe_inv_variableChange_\u0394', variableChange_c\u2084, j, mul_pow, \u2190 pow_mul, \u2190 mul_assoc,\n mul_right_comm (C.u.val ^ 12), \u2190 mul_pow, C.u.mul_inv, one_pow, one_mul]\n\nend VariableChange\n\nsection BaseChange\n\n/-! ## Maps and base changes -/\n\nvariable {A : Type v} [CommRing A] (\u03c6 : R \u2192+* A)\n\nnamespace VariableChange\n\nvariable (C : VariableChange R)\n\n/-- The change of variables mapped over a ring homomorphism `\u03c6 : R \u2192+* A`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map (L264-L268)\ndef map : VariableChange A :=\n\u27e8Units.map \u03c6 C.u, \u03c6 C.r, \u03c6 C.s, \u03c6 C.t\u27e9\n\nvariable (A) in\n/-- The change of variables base changed to an algebra `A` over `R`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.baseChange (L269-L271)\nabbrev baseChange [Algebra R A] : VariableChange A :=\nC.map <| algebraMap R A\n```\n\n-- snippet 23\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map_id (L273-L275)\nlemma map_id : C.map (RingHom.id R) = C :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map_map (L276-L279)\nlemma map_map {A : Type v} [CommRing A] (\u03c6 : R \u2192+* A) {B : Type w} [CommRing B] (\u03c8 : A \u2192+* B) :\n (C.map \u03c6).map \u03c8 = C.map (\u03c8.comp \u03c6) :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map_baseChange (L281-L285)\nlemma map_baseChange {S : Type s} [CommRing S] [Algebra R S] {A : Type v} [CommRing A] [Algebra R A]\n [Algebra S A] [IsScalarTower R S A] {B : Type w} [CommRing B] [Algebra R B] [Algebra S B]\n [IsScalarTower R S B] (\u03c8 : A \u2192\u2090[S] B) : (C.baseChange A).map \u03c8 = C.baseChange B :=\ncongr_arg C.map <| \u03c8.comp_algebraMap_of_tower R\n```\n\n-- snippet 26\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_negPolynomial (L396-L400)\nlemma map_negPolynomial :\n (W'.map f).toAffine.negPolynomial = W'.negPolynomial.map (mapRingHom f) := by\nsimp only [negPolynomial]\n map_simp\n```\n\n-- snippet 27\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_polynomial (L286-L290)\nlemma baseChange_polynomial : (W.baseChange B).toAffine.polynomial =\n (W.baseChange A).toAffine.polynomial.map (mapRingHom f) := by\nrw [\u2190 map_polynomial, map_baseChange]\n\nvariable {x y} in\n```\n\n-- snippet 28\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addY_sub_negY_addY (L382-L395)\nlemma addY_sub_negY_addY {x\u2081 x\u2082 : F} (y\u2081 y\u2082 : F) (hx : x\u2081 \u2260 x\u2082) :\n let x\u2083 := W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082)\nlet y\u2083 := W.addY x\u2081 x\u2082 y\u2081 (W.slope x\u2081 x\u2082 y\u2081 y\u2082)\n y\u2083 - W.negY x\u2083 y\u2083 =\n ((y\u2082 - W.negY x\u2082 y\u2082) * (x\u2081 - x\u2083) - (y\u2081 - W.negY x\u2081 y\u2081) * (x\u2082 - x\u2083)) / (x\u2082 - x\u2081) := by\n simp_rw [addY, negY, eq_div_iff (sub_ne_zero.mpr hx.symm)]\n linear_combination (norm := ring1) 2 * cyclic_sum_Y_mul_X_sub_X y\u2081 y\u2082 hx\n\nend slope\n\n/-! ## Maps and base changes -/\n\nvariable (f : R \u2192+* S) (x y x\u2081 y\u2081 x\u2082 y\u2082 \u2113 : R)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomial_zero (L141-L147)\nlemma evalEval_polynomial_zero : W.polynomial.evalEval 0 0 = -W.a\u2086 := by\nsimp only [evalEval_polynomial, zero_add, zero_sub, mul_zero, zero_pow <| Nat.succ_ne_zero _]\n\nvariable (W) in\n/-- The proposition that an affine point `(x, y)` lies in a Weierstrass curve `W`.\n\nIn other words, it satisfies the Weierstrass equation `W(X, Y) = 0`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_polynomialY (L273-L277)\nlemma map_polynomialY : (W.map f).toAffine.polynomialY = W.polynomialY.map (mapRingHom f) := by\nsimp only [polynomialY]\n map_simp\n\nvariable {f} in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.negY_negY (L116-L119)\nlemma negY_negY (x y : R) : W'.negY x (W'.negY x y) = y := by\nsimp only [negY]\n ring1\n```\n\n-- snippet 32\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff_variableChange (L163-L177)\nlemma equation_iff_variableChange (x y : R) :\n W.Equation x y \u2194 (VariableChange.mk 1 x 0 y \u2022 W).toAffine.Equation 0 0 := by\nrw [equation_iff', \u2190 neg_eq_zero, equation_zero, variableChange_a\u2086, inv_one, Units.val_one]\n congr! 1\n ring1\n\n/-! ## The nonsingular condition in affine coordinates -/\n\nvariable (W) in\n/-- The partial derivative `W_X(X, Y)` with respect to `X` of the polynomial `W(X, Y)` associated to\na Weierstrass curve `W` in affine coordinates. -/\n-- TODO: define this in terms of `Polynomial.derivative`.\nnoncomputable def polynomialX : R[X][Y] :=\n C (C W.a\u2081) * Y - C (C 3 * X ^ 2 + C (2 * W.a\u2082) * X + C W.a\u2084)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.evalEval_negPolynomial (L120-L123)\nlemma evalEval_negPolynomial (x y : R) : W'.negPolynomial.evalEval x y = W'.negY x y := by\nrw [negY, sub_sub, negPolynomial]\n eval_simp\n```\n\n-- snippet 34\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addX_eq_addX_negY_sub (L360-L372)\nlemma addX_eq_addX_negY_sub {x\u2081 x\u2082 : F} (y\u2081 y\u2082 : F) (hx : x\u2081 \u2260 x\u2082) :\n W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) = W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 <| W.negY x\u2082 y\u2082) -\n (y\u2081 - W.negY x\u2081 y\u2081) * (y\u2082 - W.negY x\u2082 y\u2082) / (x\u2082 - x\u2081) ^ 2 := by\nsimp_rw [slope_of_X_ne hx, addX, negY, \u2190 neg_sub x\u2081, neg_sq]\n simp [field]\n ring1\n\n-- Non-terminal simp, used to be field_simp\nset_option linter.flexible false in\n-- see https://github.com/leanprover-community/mathlib4/issues/29041\nset_option linter.unusedSimpArgs false in\n/-- The formula `y(P\u2081)(x(P\u2082) - x(P\u2083)) + y(P\u2082)(x(P\u2083) - x(P\u2081)) + y(P\u2083)(x(P\u2081) - x(P\u2082)) = 0`,\nassuming that `P\u2081 + P\u2082 + P\u2083 = O`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_negY (L401-L404)\nlemma map_negY : (W'.map f).toAffine.negY (f x) (f y) = f (W'.negY x y) := by\nsimp only [negY]\n map_simp\n```\n\n-- snippet 36\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addPolynomial_slope (L265-L287)\nlemma addPolynomial_slope {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : W.addPolynomial x\u2081 y\u2081 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) =\n -((X - C x\u2081) * (X - C x\u2082) * (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082))) := by\nrw [addPolynomial_eq, neg_inj, Cubic.prod_X_sub_C_eq, Cubic.toPoly_injective]\n by_cases hx : x\u2081 = x\u2082\n \u00b7 have hy : y\u2081 \u2260 W.negY x\u2082 y\u2082 := fun h => hxy \u27e8hx, h\u27e9\n rcases hx, Y_eq_of_Y_ne h\u2081 h\u2082 hx hy with \u27e8rfl, rfl\u27e9\n rw [equation_iff] at h\u2081 h\u2082\n rw [slope_of_Y_ne rfl hy]\n rw [negY, \u2190 sub_ne_zero] at hy\n replace hy : y\u2081 - (-y\u2081 - x\u2081 * W.a\u2081 - W.a\u2083) \u2260 0 := by convert hy using 1; ring\n ext\n \u00b7 rfl\n \u00b7 simp only [addX]\n ring1\n \u00b7 simp [field]\n ring1\n \u00b7 linear_combination (norm := (simp [field]; ring1)) -h\u2081\n \u00b7 rw [equation_iff] at h\u2081 h\u2082\n rw [slope_of_X_ne hx]\n simp only [addX]\n grind\n```\n\n-- snippet 37\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_neg (L134-L138)\nlemma equation_neg (x y : R) : W'.Equation x (W'.negY x y) \u2194 W'.Equation x y := by\nrw [equation_iff, equation_iff, negY]\n congr! 1\n ring1\n```\n\n-- snippet 38\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Nonsingular (L210-L212)\ndef Nonsingular (x y : R) : Prop :=\nW.Equation x y \u2227 (W.polynomialX.evalEval x y \u2260 0 \u2228 W.polynomialY.evalEval x y \u2260 0)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_equation (L297-L300)\nlemma baseChange_equation (hf : Function.Injective f) :\n (W.baseChange B).toAffine.Equation (f x) (f y) \u2194 (W.baseChange A).toAffine.Equation x y := by\nrw [\u2190 map_equation _ _ hf, AlgHom.toRingHom_eq_coe, map_baseChange, RingHom.coe_coe]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_zero (L224-L227)\nlemma nonsingular_zero : W.Nonsingular 0 0 \u2194 W.a\u2086 = 0 \u2227 (W.a\u2083 \u2260 0 \u2228 W.a\u2084 \u2260 0) := by\nrw [Nonsingular, equation_zero, evalEval_polynomialX_zero, neg_ne_zero, evalEval_polynomialY_zero,\n or_comm]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_polynomial (L256-L260)\nlemma map_polynomial : (W.map f).toAffine.polynomial = W.polynomial.map (mapRingHom f) := by\nsimp only [polynomial]\n map_simp\n\nvariable {x y} in\n```\n\n-- snippet 42\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_ne_zero (L105-L108)\nlemma polynomial_ne_zero [Nontrivial R] : W.polynomial \u2260 0 := by\nrw [polynomial_eq]\n exact Cubic.ne_zero_of_b_ne_zero one_ne_zero\n```\n\n-- snippet 43\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.derivative_addPolynomial_slope (L294-L302)\nlemma derivative_addPolynomial_slope {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081)\n (h\u2082 : W.Equation x\u2082 y\u2082) (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) :\n derivative (W.addPolynomial x\u2081 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) =\n -((X - C x\u2081) * (X - C x\u2082) + (X - C x\u2081) * (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082)) +\n (X - C x\u2082) * (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082))) := by\nrw [addPolynomial_slope h\u2081 h\u2082 hxy]\n derivative_simp\n ring1\n```\n\n-- snippet 44\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_equation (L265-L268)\nlemma map_equation (hf : Function.Injective f) :\n (W.map f).toAffine.Equation (f x) (f y) \u2194 W.Equation x y := by\nsimp only [Equation, map_polynomial, map_mapRingHom_evalEval, map_eq_zero_iff f hf]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.cyclic_sum_Y_mul_X_sub_X (L373-L381)\nlemma cyclic_sum_Y_mul_X_sub_X {x\u2081 x\u2082 : F} (y\u2081 y\u2082 : F) (hx : x\u2081 \u2260 x\u2082) :\n let x\u2083 := W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082)\ny\u2081 * (x\u2082 - x\u2083) + y\u2082 * (x\u2083 - x\u2081) + W.negAddY x\u2081 x\u2082 y\u2081 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) * (x\u2081 - x\u2082) = 0 := by\n simp_rw [slope_of_X_ne hx, negAddY, addX]\n simp [field, sub_ne_zero.mpr hx]\n ring1\n\n/-- The formula `\u03c8(P\u2081 + P\u2082) = (\u03c8(P\u2082)(x(P\u2081) - x(P\u2083)) - \u03c8(P\u2081)(x(P\u2082) - x(P\u2083))) / (x(P\u2082) - x(P\u2081))`,\nwhere `\u03c8(x,y) = 2y + a\u2081x + a\u2083`. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.monic_polynomial (L119-L121)\nlemma monic_polynomial : W.polynomial.Monic := by\nsimpa only [polynomial_eq] using Cubic.monic_of_b_eq_one'\n```\n\n-- snippet 47\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_add (L329-L333)\nlemma equation_add {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) :\n W.Equation (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.addY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) :=\n(equation_neg ..).mpr <| equation_negAdd h\u2081 h\u2082 hxy\n```\n\n-- snippet 48\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_negAdd (L334-L350)\nlemma nonsingular_negAdd {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Nonsingular x\u2081 y\u2081) (h\u2082 : W.Nonsingular x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : W.Nonsingular\n (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.negAddY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) := by\nby_cases hx\u2081 : W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) = x\u2081\n \u00b7 rwa [negAddY, hx\u2081, sub_self, mul_zero, zero_add]\n \u00b7 by_cases hx\u2082 : W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) = x\u2082\n \u00b7 by_cases hx : x\u2081 = x\u2082\n \u00b7 subst hx\n contradiction\n \u00b7 rwa [negAddY, \u2190 neg_sub, mul_neg, hx\u2082, slope_of_X_ne hx,\n div_mul_cancel\u2080 _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]\n \u00b7 apply nonsingular_negAdd_of_eval_derivative_ne_zero <| equation_negAdd h\u2081.left h\u2082.left hxy\n rw [derivative_addPolynomial_slope h\u2081.left h\u2082.left hxy]\n eval_simp\n simp only [neg_ne_zero, sub_self, mul_zero, add_zero]\n exact mul_ne_zero (sub_ne_zero_of_ne hx\u2081) (sub_ne_zero_of_ne hx\u2082)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff_nonsingular (L248-L255)\nlemma equation_iff_nonsingular [Nontrivial R] [W.IsElliptic] {x y : R} :\n W.toAffine.Equation x y \u2194 W.toAffine.Nonsingular x y :=\nW.toAffine.equation_iff_nonsingular_of_\u0394_ne_zero <| W.coe_\u0394' \u25b8 W.\u0394'.ne_zero\n\n/-! ## Maps and base changes -/\n\nvariable (f : R \u2192+* S) (x y : R)\n```\n\n-- snippet 50\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.negY (L113-L115)\ndef negY (x y : R) : R :=\n-y - W'.a\u2081 * x - W'.a\u2083\n```\n\n-- snippet 51\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_iff' (L213-L216)\nlemma nonsingular_iff' (x y : R) : W.Nonsingular x y \u2194 W.Equation x y \u2227\n (W.a\u2081 * y - (3 * x ^ 2 + 2 * W.a\u2082 * x + W.a\u2084) \u2260 0 \u2228 2 * y + W.a\u2081 * x + W.a\u2083 \u2260 0) := by\nrw [Nonsingular, equation_iff', evalEval_polynomialX, evalEval_polynomialY]\n```\n\n-- snippet 52\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_addPolynomial (L450-L453)\nlemma baseChange_addPolynomial : (W'.baseChange B).toAffine.addPolynomial (f x) (f y) (f \u2113) =\n ((W'.baseChange A).toAffine.addPolynomial x y \u2113).map f := by\nrw [\u2190 RingHom.coe_coe, \u2190 map_addPolynomial, map_baseChange]\n```\n\n-- snippet 53\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_negAdd (L322-L328)\nlemma equation_negAdd {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : W.Equation\n (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.negAddY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) := by\nrw [equation_add_iff, addPolynomial_slope h\u2081 h\u2082 hxy]\n eval_simp\n rw [neg_eq_zero, sub_self, mul_zero]\n```\n\n-- snippet 54\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_sub_polynomialY (L99-L103)\nlemma Y_sub_polynomialY : Y - W'.polynomialY = W'.negPolynomial := by\nrw [polynomialY, negPolynomial]\n C_simp\n ring1\n```\n\n-- snippet 55\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_ne (L184-L188)\nlemma slope_of_Y_ne {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 = x\u2082) (hy : y\u2081 \u2260 W.negY x\u2082 y\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 =\n (3 * x\u2081 ^ 2 + 2 * W.a\u2082 * x\u2081 + W.a\u2084 - W.a\u2081 * y\u2081) / (y\u2081 - W.negY x\u2081 y\u2081) := by\nsimp_all\n```\n\n-- snippet 56\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_X_ne (L190-L193)\nlemma slope_of_X_ne {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 \u2260 x\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 = (y\u2081 - y\u2082) / (x\u2081 - x\u2082) := by\nrw [slope, if_neg hx]\n```\n\n-- snippet 57\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_neg (L139-L167)\nlemma nonsingular_neg (x y : R) : W'.Nonsingular x (W'.negY x y) \u2194 W'.Nonsingular x y := by\nrw [nonsingular_iff, equation_neg, \u2190 negY, negY_negY, \u2190 @ne_comm _ y, nonsingular_iff]\n exact and_congr_right' <| (iff_congr not_and_or.symm not_and_or.symm).mpr <|\n not_congr <| and_congr_left fun h => by rw [\u2190 h]\n\n/-! ## Slope formulae in affine coordinates -/\n\nvariable (W') in\n/-- The line polynomial `\u2113(X - x) + y` associated to the line `Y = \u2113(X - x) + y` that passes through\na nonsingular affine point `(x, y)` on a Weierstrass curve `W` with a slope of `\u2113`.\n\nThis does not depend on `W`, and has argument order: `x`, `y`, `\u2113`. -/\nnoncomputable def linePolynomial (x y \u2113 : R) : R[X] :=\n C \u2113 * (X - C x) + C y\n\nsection slope\n\nvariable [DecidableEq F]\n\nvariable (W) in\n/-- The slope of the line through two nonsingular affine points `(x\u2081, y\u2081)` and `(x\u2082, y\u2082)` on a\nWeierstrass curve `W`.\n\nIf `x\u2081 \u2260 x\u2082`, then this line is the secant of `W` through `(x\u2081, y\u2081)` and `(x\u2082, y\u2082)`, and has slope\n`(y\u2081 - y\u2082) / (x\u2081 - x\u2082)`. Otherwise, if `y\u2081 \u2260 -y\u2081 - a\u2081x\u2081 - a\u2083`, then this line is the tangent of `W`\nat `(x\u2081, y\u2081) = (x\u2082, y\u2082)`, and has slope `(3x\u2081\u00b2 + 2a\u2082x\u2081 + a\u2084 - a\u2081y\u2081) / (2y\u2081 + a\u2081x\u2081 + a\u2083)`. Otherwise,\nthis line is vertical, in which case this returns the value `0`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `y\u2081`, `y\u2082`. -/\n```\n\n-- snippet 58\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addX (L238-L245)\ndef addX (x\u2081 x\u2082 \u2113 : R) : R :=\n\u2113 ^ 2 + W'.a\u2081 * \u2113 - W'.a\u2082 - x\u2081 - x\u2082\n\nvariable (W') in\n/-- The `Y`-coordinate of `-((x\u2081, y\u2081) + (x\u2082, y\u2082))` for two nonsingular affine points `(x\u2081, y\u2081)` and\n`(x\u2082, y\u2082)` on a Weierstrass curve `W`, where the line through them has a slope of `\u2113`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `y\u2081`, `\u2113`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_negAdd_of_eval_derivative_ne_zero (L303-L316)\nlemma nonsingular_negAdd_of_eval_derivative_ne_zero {x\u2081 x\u2082 y\u2081 \u2113 : R}\n (hx' : W'.Equation (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113))\n (hx : (W'.addPolynomial x\u2081 y\u2081 \u2113).derivative.eval (W'.addX x\u2081 x\u2082 \u2113) \u2260 0) :\n W'.Nonsingular (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113) := by\nrw [Nonsingular, and_iff_right hx', negAddY, polynomialX, polynomialY]\n eval_simp\n contrapose! hx\n rw [addPolynomial, linePolynomial, polynomial]\n eval_simp\n derivative_simp\n simp only [zero_add, add_zero, sub_zero, zero_mul, mul_one]\n eval_simp\n linear_combination (norm := (norm_num1; ring1)) hx.left + \u2113 * hx.right\n```\n\n-- snippet 60\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialY_zero (L200-L209)\nlemma evalEval_polynomialY_zero : W.polynomialY.evalEval 0 0 = W.a\u2083 := by\nsimp only [evalEval_polynomialY, zero_add, mul_zero]\n\nvariable (W) in\n/-- The proposition that an affine point `(x, y)` on a Weierstrass curve `W` is nonsingular.\n\nIn other words, either `W_X(x, y) \u2260 0` or `W_Y(x, y) \u2260 0`.\n\nNote that this definition is only mathematically accurate for fields. -/\n-- TODO: generalise this definition to be mathematically accurate for a larger class of rings.\n```\n\n-- snippet 61\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_addX (L415-L418)\nlemma map_addX : (W'.map f).toAffine.addX (f x\u2081) (f x\u2082) (f \u2113) = f (W'.addX x\u2081 x\u2082 \u2113) := by\nsimp only [addX]\n map_simp\n```\n\n-- snippet 62\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_eq_of_Y_ne (L130-L133)\nlemma Y_eq_of_Y_ne {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082) (hx : x\u2081 = x\u2082)\n (hy : y\u2081 \u2260 W.negY x\u2082 y\u2082) : y\u2081 = y\u2082 :=\n(Y_eq_of_X_eq h\u2081 h\u2082 hx).resolve_right hy\n```\n\n-- snippet 63\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_sub_negPolynomial (L104-L111)\nlemma Y_sub_negPolynomial : Y - W'.negPolynomial = W'.polynomialY := by\nrw [\u2190 Y_sub_polynomialY, sub_sub_cancel]\n\nvariable (W') in\n/-- The `Y`-coordinate of `-(x, y)` for a nonsingular affine point `(x, y)` on a Weierstrass curve\n`W`.\n\nThis depends on `W`, and has argument order: `x`, `y`. -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_polynomialY (L305-L309)\nlemma baseChange_polynomialY : (W.baseChange B).toAffine.polynomialY =\n (W.baseChange A).toAffine.polynomialY.map (mapRingHom f) := by\nrw [\u2190 map_polynomialY, map_baseChange]\n\nvariable {f} in\n```\n\n-- snippet 65\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Equation (L148-L150)\ndef Equation (x y : R) : Prop :=\nW.polynomial.evalEval x y = 0\n```\n\n-- snippet 66\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope (L168-L172)\ndef slope (x\u2081 x\u2082 y\u2081 y\u2082 : F) : F :=\nif x\u2081 = x\u2082 then if y\u2081 = W.negY x\u2082 y\u2082 then 0\n else (3 * x\u2081 ^ 2 + 2 * W.a\u2082 * x\u2081 + W.a\u2084 - W.a\u2081 * y\u2081) / (y\u2081 - W.negY x\u2081 y\u2081)\n else (y\u2081 - y\u2082) / (x\u2081 - x\u2082)\n```\n\n-- snippet 67\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_zero (L160-L162)\nlemma equation_zero : W.Equation 0 0 \u2194 W.a\u2086 = 0 := by\nrw [Equation, evalEval_polynomial_zero, neg_eq_zero]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_iff_variableChange (L228-L241)\nlemma nonsingular_iff_variableChange (x y : R) :\n W.Nonsingular x y \u2194 (VariableChange.mk 1 x 0 y \u2022 W).toAffine.Nonsingular 0 0 := by\nrw [nonsingular_iff', equation_iff_variableChange, equation_zero, \u2190 neg_ne_zero, or_comm,\n nonsingular_zero, variableChange_a\u2083, variableChange_a\u2084, inv_one, Units.val_one]\n simp only [variableChange_def]\n congr! 3 <;> ring1\n\nprivate lemma equation_zero_iff_nonsingular_zero_of_\u0394_ne_zero (h\u0394 : W.\u0394 \u2260 0) :\n W.Equation 0 0 \u2194 W.Nonsingular 0 0 := by\n simp only [equation_zero, nonsingular_zero, iff_self_and]\n contrapose! h\u0394\n simp only [b\u2082, b\u2084, b\u2086, b\u2088, \u0394, h\u0394]\n ring1\n```\n\n-- snippet 69\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_polynomialX (L269-L272)\nlemma map_polynomialX : (W.map f).toAffine.polynomialX = W.polynomialX.map (mapRingHom f) := by\nsimp only [polynomialX]\n map_simp\n```\n\n-- snippet 70\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_slope (L428-L441)\nlemma map_slope [DecidableEq F] [DecidableEq K] (f : F \u2192+* K) (x\u2081 x\u2082 y\u2081 y\u2082 : F) :\n (W.map f).toAffine.slope (f x\u2081) (f x\u2082) (f y\u2081) (f y\u2082) = f (W.slope x\u2081 x\u2082 y\u2081 y\u2082) := by\nby_cases hx : x\u2081 = x\u2082\n \u00b7 by_cases hy : y\u2081 = W.negY x\u2082 y\u2082\n \u00b7 rw [slope_of_Y_eq (congr_arg f hx) <| by rw [hy, map_negY], slope_of_Y_eq hx hy, map_zero]\n \u00b7 rw [slope_of_Y_ne (congr_arg f hx) <| map_negY f x\u2082 y\u2082 \u25b8 fun h => hy <| f.injective h,\n map_negY, slope_of_Y_ne hx hy]\n map_simp\n \u00b7 rw [slope_of_X_ne fun h => hx <| f.injective h, slope_of_X_ne hx]\n map_simp\n\nvariable [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] [Algebra R B] [Algebra S B]\n [IsScalarTower R S B] (f : A \u2192\u2090[S] B) (x y x\u2081 y\u2081 x\u2082 y\u2082 \u2113 : A)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff (L155-L158)\nlemma equation_iff (x y : R) : W.Equation x y \u2194\n y ^ 2 + W.a\u2081 * x * y + W.a\u2083 * y = x ^ 3 + W.a\u2082 * x ^ 2 + W.a\u2084 * x + W.a\u2086 := by\nrw [equation_iff', sub_eq_zero]\n```\n\n-- snippet 72\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_addX (L454-L457)\nlemma baseChange_addX : (W'.baseChange B).toAffine.addX (f x\u2081) (f x\u2082) (f \u2113) =\n f ((W'.baseChange A).toAffine.addX x\u2081 x\u2082 \u2113) := by\nrw [\u2190 RingHom.coe_coe, \u2190 map_addX, map_baseChange]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff' (L151-L154)\nlemma equation_iff' (x y : R) : W.Equation x y \u2194\n y ^ 2 + W.a\u2081 * x * y + W.a\u2083 * y - (x ^ 3 + W.a\u2082 * x ^ 2 + W.a\u2084 * x + W.a\u2086) = 0 := by\nrw [Equation, evalEval_polynomial]\n```\n\n-- snippet 74\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Affine (L74-L77)\nabbrev Affine : Type r :=\nWeierstrassCurve R\n\n/-- The conversion from a Weierstrass curve to affine coordinates. -/\n```\n\n-- snippet 75\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialX (L178-L182)\nlemma evalEval_polynomialX (x y : R) :\n W.polynomialX.evalEval x y = W.a\u2081 * y - (3 * x ^ 2 + 2 * W.a\u2082 * x + W.a\u2084) := by\nsimp only [polynomialX]\n eval_simp\n```\n\n-- snippet 76\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_addPolynomial (L409-L414)\nlemma map_addPolynomial :\n (W'.map f).toAffine.addPolynomial (f x) (f y) (f \u2113) = (W'.addPolynomial x y \u2113).map f := by\nrw [addPolynomial, map_polynomial, eval_map, linePolynomial, addPolynomial, \u2190 coe_mapRingHom,\n \u2190 eval\u2082_hom, linePolynomial]\n simp\n```\n\n-- snippet 77\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.C_addPolynomial_slope (L288-L293)\nlemma C_addPolynomial_slope {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : C (W.addPolynomial x\u2081 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) =\n -(C (X - C x\u2081) * C (X - C x\u2082) * C (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082))) := by\nrw [addPolynomial_slope h\u2081 h\u2082 hxy]\n simp\n```\n\n-- snippet 78\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_negY (L446-L449)\nlemma baseChange_negY :\n (W'.baseChange B).toAffine.negY (f x) (f y) = f ((W'.baseChange A).toAffine.negY x y) := by\nrw [\u2190 RingHom.coe_coe, \u2190 map_negY, map_baseChange]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_eq_of_X_eq (L124-L129)\nlemma Y_eq_of_X_eq {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hx : x\u2081 = x\u2082) : y\u2081 = y\u2082 \u2228 y\u2081 = W.negY x\u2082 y\u2082 := by\nrw [equation_iff] at h\u2081 h\u2082\n rw [\u2190 sub_eq_zero, \u2190 sub_eq_zero (a := y\u2081), \u2190 mul_eq_zero, negY]\n linear_combination (norm := (rw [hx]; ring1)) h\u2081 - h\u2082\n```\n\n-- snippet 80\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_nonsingular (L278-L285)\nlemma map_nonsingular (hf : Function.Injective f) :\n (W.map f).toAffine.Nonsingular (f x) (f y) \u2194 W.Nonsingular x y := by\nsimp only [Nonsingular, evalEval, map_equation _ _ hf, map_polynomialX, map_polynomialY,\n map_mapRingHom_evalEval, map_ne_zero_iff f hf]\n\nvariable [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] [Algebra R B] [Algebra S B]\n [IsScalarTower R S B] (f : A \u2192\u2090[S] B) (x y : A)\n```\n\n-- snippet 81\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_iff (L217-L222)\nlemma nonsingular_iff (x y : R) : W.Nonsingular x y \u2194 W.Equation x y \u2227\n (W.a\u2081 * y \u2260 3 * x ^ 2 + 2 * W.a\u2082 * x + W.a\u2084 \u2228 y \u2260 -y - W.a\u2081 * x - W.a\u2083) := by\nrw [nonsingular_iff', sub_ne_zero, \u2190 sub_ne_zero (a := y)]\n congr! 3\n ring1\n```\n\n-- snippet 82\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_addY (L424-L427)\nlemma map_addY :\n (W'.map f).toAffine.addY (f x\u2081) (f x\u2082) (f y\u2081) (f \u2113) = f (W'.toAffine.addY x\u2081 x\u2082 y\u2081 \u2113) := by\nsimp only [addY, map_negAddY, map_addX, map_negY]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff_nonsingular_of_\u0394_ne_zero (L242-L247)\nlemma equation_iff_nonsingular_of_\u0394_ne_zero {x y : R} (h\u0394 : W.\u0394 \u2260 0) :\n W.Equation x y \u2194 W.Nonsingular x y := by\nrw [equation_iff_variableChange, nonsingular_iff_variableChange,\n equation_zero_iff_nonsingular_zero_of_\u0394_ne_zero <| by\n rwa [variableChange_\u0394, inv_one, Units.val_one, one_pow, one_mul]]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_negPolynomial (L442-L445)\nlemma baseChange_negPolynomial : (W'.baseChange B).toAffine.negPolynomial =\n (W'.baseChange A).toAffine.negPolynomial.map (mapRingHom f) := by\nrw [\u2190 map_negPolynomial, map_baseChange]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.irreducible_polynomial (L122-L133)\nlemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by\nby_contra h\n rcases (monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff natDegree_polynomial).mp h\n with \u27e8f, g, h0, h1\u27e9\n simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1\n apply_fun degree at h0 h1\n rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0\n apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_gt\n rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h\n iterate 2 rw [degree_add_eq_right_of_degree_lt] <;> simp only [h] <;> decide\n iterate 2 rw [degree_add_eq_left_of_degree_lt] <;> simp only [h] <;> decide\n```\n\n-- snippet 86\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_linePolynomial (L405-L408)\nlemma map_linePolynomial : linePolynomial (f x) (f y) (f \u2113) = (linePolynomial x y \u2113).map f := by\nsimp only [linePolynomial]\n map_simp\n```\n\n-- snippet 87\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_eq (L174-L177)\nlemma slope_of_Y_eq {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 = x\u2082) (hy : y\u2081 = W.negY x\u2082 y\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 = 0 := by\nrw [slope, if_pos hx, if_pos hy]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_polynomialX (L301-L304)\nlemma baseChange_polynomialX : (W.baseChange B).toAffine.polynomialX =\n (W.baseChange A).toAffine.polynomialX.map (mapRingHom f) := by\nrw [\u2190 map_polynomialX, map_baseChange]\n```\n\n-- snippet 89\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.C_addPolynomial (L215-L222)\nlemma C_addPolynomial (x y \u2113 : R) : C (W'.addPolynomial x y \u2113) =\n (Y - C (linePolynomial x y \u2113)) * (W'.negPolynomial - C (linePolynomial x y \u2113)) +\n W'.polynomial := by\nrw [addPolynomial, linePolynomial, polynomial, negPolynomial]\n eval_simp\n C_simp\n ring1\n```\n\n-- snippet 90\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_ne' (L179-L183)\nlemma slope_of_Y_ne' {x\u2082 y\u2081 y\u2082 : F} (hy : \u00acy\u2081 = -y\u2082 - W.a\u2081 * x\u2082 - W.a\u2083) :\n W.slope x\u2082 x\u2082 y\u2081 y\u2082 =\n (3 * x\u2082 ^ 2 + 2 * W.a\u2082 * x\u2082 + W.a\u2084 - W.a\u2081 * y\u2081) / (y\u2081 - (-y\u2081 - W.a\u2081 * x\u2082 - W.a\u2083)) := by\nsimp [slope, hy]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.natDegree_polynomial (L115-L118)\nlemma natDegree_polynomial [Nontrivial R] : W.polynomial.natDegree = 2 := by\nrw [polynomial_eq]\n exact Cubic.natDegree_of_b_ne_zero' one_ne_zero\n```\n\n-- snippet 92\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_eq (L98-L104)\nlemma polynomial_eq : W.polynomial = Cubic.toPoly\n \u27e80, 1, Cubic.toPoly \u27e80, 0, W.a\u2081, W.a\u2083\u27e9, Cubic.toPoly \u27e8-1, -W.a\u2082, -W.a\u2084, -W.a\u2086\u27e9\u27e9 := by\nsimp_rw [polynomial, Cubic.toPoly]\n map_simp\n simp only [C_0, C_1]\n ring1\n```\n\n-- snippet 93\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_nonsingular (L310-L317)\nlemma baseChange_nonsingular (hf : Function.Injective f) :\n (W.baseChange B).toAffine.Nonsingular (f x) (f y) \u2194\n (W.baseChange A).toAffine.Nonsingular x y := by\nrw [\u2190 map_nonsingular _ _ hf, AlgHom.toRingHom_eq_coe, map_baseChange, RingHom.coe_coe]\n\nend Affine\n\nend WeierstrassCurve\n```\n\n-- snippet 94\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addY (L256-L264)\ndef addY (x\u2081 x\u2082 y\u2081 \u2113 : R) : R :=\nW'.negY (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113)\n\nsection slope\n\nvariable [DecidableEq F]\n\n-- Non-terminal simps, used to be field_simp\nset_option linter.flexible false in\n```\n\n-- snippet 95\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.degree_polynomial (L110-L113)\nlemma degree_polynomial [Nontrivial R] : W.polynomial.degree = 2 := by\nrw [polynomial_eq]\n exact Cubic.degree_of_b_ne_zero' one_ne_zero\n```\n\n-- snippet 96\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.negAddY (L247-L254)\ndef negAddY (x\u2081 x\u2082 y\u2081 \u2113 : R) : R :=\n\u2113 * (W'.addX x\u2081 x\u2082 \u2113 - x\u2081) + y\u2081\n\nvariable (W') in\n/-- The `Y`-coordinate of `(x\u2081, y\u2081) + (x\u2082, y\u2082)` for two nonsingular affine points `(x\u2081, y\u2081)` and\n`(x\u2082, y\u2082)` on a Weierstrass curve `W`, where the line through them has a slope of `\u2113`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `y\u2081`, `\u2113`. -/\n```\n\n-- snippet 97\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialX_zero (L184-L193)\nlemma evalEval_polynomialX_zero : W.polynomialX.evalEval 0 0 = -W.a\u2084 := by\nsimp only [evalEval_polynomialX, zero_add, zero_sub, mul_zero, zero_pow <| Nat.succ_ne_zero _]\n\nvariable (W) in\n/-- The partial derivative `W_Y(X, Y)` with respect to `Y` of the polynomial `W(X, Y)` associated to\na Weierstrass curve `W` in affine coordinates. -/\n-- TODO: define this in terms of `Polynomial.derivative`.\nnoncomputable def polynomialY : R[X][Y] :=\n C (C 2) * Y + C (C W.a\u2081 * X + C W.a\u2083)\n```\n\n-- snippet 98\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_ne_eq_evalEval (L194-L214)\nlemma slope_of_Y_ne_eq_evalEval {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 = x\u2082) (hy : y\u2081 \u2260 W.negY x\u2082 y\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 = -W.polynomialX.evalEval x\u2081 y\u2081 / W.polynomialY.evalEval x\u2081 y\u2081 := by\nrw [slope_of_Y_ne hx hy, evalEval_polynomialX, neg_sub]\n congr 1\n rw [negY, evalEval_polynomialY]\n ring1\n\nend slope\n\n/-! ## Addition formulae in affine coordinates -/\n\nvariable (W') in\n/-- The addition polynomial obtained by substituting the line `Y = \u2113(X - x) + y` into the polynomial\n`W(X, Y)` associated to a Weierstrass curve `W`. If such a line intersects `W` at another\nnonsingular affine point `(x', y')` on `W`, then the roots of this polynomial are precisely `x`,\n`x'`, and the `X`-coordinate of the addition of `(x, y)` and `(x', y')`.\n\nThis depends on `W`, and has argument order: `x`, `y`, `\u2113`. -/\nnoncomputable def addPolynomial (x y \u2113 : R) : R[X] :=\n W'.polynomial.eval <| linePolynomial x y \u2113\n```\n\n-- snippet 99\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomial (L134-L139)\nlemma evalEval_polynomial (x y : R) : W.polynomial.evalEval x y =\n y ^ 2 + W.a\u2081 * x * y + W.a\u2083 * y - (x ^ 3 + W.a\u2082 * x ^ 2 + W.a\u2084 * x + W.a\u2086) := by\nsimp only [polynomial]\n eval_simp\n rw [add_mul, \u2190 add_assoc]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_negAddY (L419-L423)\nlemma map_negAddY :\n (W'.map f).toAffine.negAddY (f x\u2081) (f x\u2082) (f y\u2081) (f \u2113) = f (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113) := by\nsimp only [negAddY, map_addX]\n map_simp\n```\n\n-- snippet 101\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_add (L351-L359)\nlemma nonsingular_add {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Nonsingular x\u2081 y\u2081) (h\u2082 : W.Nonsingular x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) :\n W.Nonsingular (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.addY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) :=\n(nonsingular_neg ..).mpr <| nonsingular_negAdd h\u2081 h\u2082 hxy\n\n-- Non-terminal simp, used to be field_simp\nset_option linter.flexible false in\n/-- The formula `x(P\u2081 + P\u2082) = x(P\u2081 - P\u2082) - \u03c8(P\u2081)\u03c8(P\u2082) / (x(P\u2082) - x(P\u2081))\u00b2`,\nwhere `\u03c8(x,y) = 2y + a\u2081x + a\u2083`. -/\n```\n\n-- snippet 102\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.toAffine (L78-L97)\nabbrev toAffine (W : WeierstrassCurve R) : Affine R :=\nW\n\nvariable [CommRing R] [CommRing S] [CommRing A] [CommRing B] {W : Affine R}\n\nnamespace Affine\n\n/-! ## Weierstrass equations in affine coordinates -/\n\nvariable (W) in\n/-- The polynomial `W(X, Y) := Y\u00b2 + a\u2081XY + a\u2083Y - (X\u00b3 + a\u2082X\u00b2 + a\u2084X + a\u2086)` associated to a Weierstrass\ncurve `W` over a ring `R` in affine coordinates.\n\nFor ease of polynomial manipulation, this is represented as a term of type `R[X][X]`, where the\ninner variable represents `X` and the outer variable represents `Y`. For clarity, the alternative\nnotations `Y` and `R[X][Y]` are provided in the `Polynomial.Bivariate` scope to represent the outer\nvariable and the bivariate polynomial ring `R[X][X]` respectively. -/\nnoncomputable def polynomial : R[X][Y] :=\n Y ^ 2 + C (C W.a\u2081 * X + C W.a\u2083) * Y - C (X ^ 3 + C W.a\u2082 * X ^ 2 + C W.a\u2084 * X + C W.a\u2086)\n```\n\n-- snippet 103\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addPolynomial_eq (L223-L236)\nlemma addPolynomial_eq (x y \u2113 : R) : W'.addPolynomial x y \u2113 = -Cubic.toPoly\n \u27e81, -\u2113 ^ 2 - W'.a\u2081 * \u2113 + W'.a\u2082,\n 2 * x * \u2113 ^ 2 + (W'.a\u2081 * x - 2 * y - W'.a\u2083) * \u2113 + (-W'.a\u2081 * y + W'.a\u2084),\n -x ^ 2 * \u2113 ^ 2 + (2 * x * y + W'.a\u2083 * x) * \u2113 - (y ^ 2 + W'.a\u2083 * y - W'.a\u2086)\u27e9 := by\nrw [addPolynomial, linePolynomial, polynomial, Cubic.toPoly]\n eval_simp\n C_simp\n ring1\n\nvariable (W') in\n/-- The `X`-coordinate of `(x\u2081, y\u2081) + (x\u2082, y\u2082)` for two nonsingular affine points `(x\u2081, y\u2081)` and\n`(x\u2082, y\u2082)` on a Weierstrass curve `W`, where the line through them has a slope of `\u2113`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `\u2113`. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialY (L194-L198)\nlemma evalEval_polynomialY (x y : R) : W.polynomialY.evalEval x y = 2 * y + W.a\u2081 * x + W.a\u2083 := by\nsimp only [polynomialY]\n eval_simp\n rw [\u2190 add_assoc]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_add_iff (L317-L321)\nlemma equation_add_iff (x\u2081 x\u2082 y\u2081 \u2113 : R) : W'.Equation (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113) \u2194\n (W'.addPolynomial x\u2081 y\u2081 \u2113).eval (W'.addX x\u2081 x\u2082 \u2113) = 0 := by\nrw [Equation, negAddY, addPolynomial, linePolynomial, polynomial]\n eval_simp\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma variableChange_b\u2086 : (C \u2022 W).b\u2086 =\n C.u\u207b\u00b9 ^ 6 * (W.b\u2086 + 2 * C.r * W.b\u2084 + C.r ^ 2 * W.b\u2082 + 4 * C.r ^ 3)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.one_def (L75-L76)\nlemma one_def : (1 : VariableChange R) = \u27e81, 0, 0, 0\u27e9 := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.mul_def (L85-L90)\nlemma mul_def : C * C' = {\n u := C.u * C'.u\nr := C.r * C'.u ^ 2 + C'.r\n s := C'.u * C.s + C'.s\n t := C.t * C'.u ^ 3 + C.r * C'.s * C'.u ^ 2 + C'.t } := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.inv_def (L99-L104)\nlemma inv_def : C\u207b\u00b9 = {\n u := C.u\u207b\u00b9\nr := -C.r * C.u\u207b\u00b9 ^ 2\n s := -C.s * C.u\u207b\u00b9\n t := (C.r * C.s - C.t) * C.u\u207b\u00b9 ^ 3 } := rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_def (L137-L145)\nlemma variableChange_def : C \u2022 W = {\n a\u2081 := C.u\u207b\u00b9 * (W.a\u2081 + 2 * C.s)\na\u2082 := C.u\u207b\u00b9 ^ 2 * (W.a\u2082 - C.s * W.a\u2081 + 3 * C.r - C.s ^ 2)\n a\u2083 := C.u\u207b\u00b9 ^ 3 * (W.a\u2083 + C.r * W.a\u2081 + 2 * C.t)\n a\u2084 := C.u\u207b\u00b9 ^ 4 * (W.a\u2084 - C.s * W.a\u2083 + 2 * C.r * W.a\u2082 - (C.t + C.r * C.s) * W.a\u2081 + 3 * C.r ^ 2\n - 2 * C.s * C.t)\n a\u2086 := C.u\u207b\u00b9 ^ 6 * (W.a\u2086 + C.r * W.a\u2084 + C.r ^ 2 * W.a\u2082 + C.r ^ 3 - C.t * W.a\u2083 - C.t ^ 2\n - C.r * C.t * W.a\u2081) } := rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2081 (L177-L178)\nlemma variableChange_a\u2081 : (C \u2022 W).a\u2081 = C.u\u207b\u00b9 * (W.a\u2081 + 2 * C.s) := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2082 (L179-L180)\nlemma variableChange_a\u2082 : (C \u2022 W).a\u2082 = C.u\u207b\u00b9 ^ 2 * (W.a\u2082 - C.s * W.a\u2081 + 3 * C.r - C.s ^ 2) := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2083 (L181-L182)\nlemma variableChange_a\u2083 : (C \u2022 W).a\u2083 = C.u\u207b\u00b9 ^ 3 * (W.a\u2083 + C.r * W.a\u2081 + 2 * C.t) := rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2084 (L183-L186)\nlemma variableChange_a\u2084 : (C \u2022 W).a\u2084 =\n C.u\u207b\u00b9 ^ 4 * (W.a\u2084 - C.s * W.a\u2083 + 2 * C.r * W.a\u2082 - (C.t + C.r * C.s) * W.a\u2081 + 3 * C.r ^ 2\n - 2 * C.s * C.t) := rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_a\u2086 (L187-L190)\nlemma variableChange_a\u2086 : (C \u2022 W).a\u2086 =\n C.u\u207b\u00b9 ^ 6 * (W.a\u2086 + C.r * W.a\u2084 + C.r ^ 2 * W.a\u2082 + C.r ^ 3 - C.t * W.a\u2083 - C.t ^ 2\n - C.r * C.t * W.a\u2081) := rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2082 (L191-L194)\nlemma variableChange_b\u2082 : (C \u2022 W).b\u2082 = C.u\u207b\u00b9 ^ 2 * (W.b\u2082 + 12 * C.r) := by\nsimp only [b\u2082, variableChange_a\u2081, variableChange_a\u2082]\n ring1\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2084 (L195-L198)\nlemma variableChange_b\u2084 : (C \u2022 W).b\u2084 = C.u\u207b\u00b9 ^ 4 * (W.b\u2084 + C.r * W.b\u2082 + 6 * C.r ^ 2) := by\nsimp only [b\u2082, b\u2084, variableChange_a\u2081, variableChange_a\u2083, variableChange_a\u2084]\n ring1\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2088 (L204-L209)\nlemma variableChange_b\u2088 : (C \u2022 W).b\u2088 = C.u\u207b\u00b9 ^ 8 *\n (W.b\u2088 + 3 * C.r * W.b\u2086 + 3 * C.r ^ 2 * W.b\u2084 + C.r ^ 3 * W.b\u2082 + 3 * C.r ^ 4) := by\nsimp only [b\u2082, b\u2084, b\u2086, b\u2088, variableChange_a\u2081, variableChange_a\u2082, variableChange_a\u2083,\n variableChange_a\u2084, variableChange_a\u2086]\n ring1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_c\u2084 (L210-L213)\nlemma variableChange_c\u2084 : (C \u2022 W).c\u2084 = C.u\u207b\u00b9 ^ 4 * W.c\u2084 := by\nsimp only [c\u2084, variableChange_b\u2082, variableChange_b\u2084]\n ring1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_c\u2086 (L214-L217)\nlemma variableChange_c\u2086 : (C \u2022 W).c\u2086 = C.u\u207b\u00b9 ^ 6 * W.c\u2086 := by\nsimp only [c\u2086, variableChange_b\u2082, variableChange_b\u2084, variableChange_b\u2086]\n ring1\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_\u0394 (L218-L224)\nlemma variableChange_\u0394 : (C \u2022 W).\u0394 = C.u\u207b\u00b9 ^ 12 * W.\u0394 := by\nsimp only [b\u2082, b\u2084, b\u2086, b\u2088, \u0394, variableChange_a\u2081, variableChange_a\u2082, variableChange_a\u2083,\n variableChange_a\u2084, variableChange_a\u2086]\n ring1\n\nvariable [W.IsElliptic]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_\u0394' (L230-L233)\nlemma variableChange_\u0394' : (C \u2022 W).\u0394' = C.u\u207b\u00b9 ^ 12 * W.\u0394' := by\nsimp_rw [Units.ext_iff, Units.val_mul, coe_\u0394', variableChange_\u0394, Units.val_pow_eq_pow_val]\n\nset_option linter.docPrime false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.coe_variableChange_\u0394' (L234-L237)\nlemma coe_variableChange_\u0394' : ((C \u2022 W).\u0394' : R) = C.u\u207b\u00b9 ^ 12 * W.\u0394' := by\nsimp_rw [coe_\u0394', variableChange_\u0394]\n\nset_option linter.docPrime false in\n```\n\n-- snippet 18\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.inv_variableChange_\u0394' (L238-L241)\nlemma inv_variableChange_\u0394' : (C \u2022 W).\u0394'\u207b\u00b9 = C.u ^ 12 * W.\u0394'\u207b\u00b9 := by\nrw [variableChange_\u0394', mul_inv, inv_pow, inv_inv]\n\nset_option linter.docPrime false in\n```\n\n-- snippet 19\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.coe_inv_variableChange_\u0394' (L242-L244)\nlemma coe_inv_variableChange_\u0394' : (\u2191(C \u2022 W).\u0394'\u207b\u00b9 : R) = C.u ^ 12 * W.\u0394'\u207b\u00b9 := by\nrw [inv_variableChange_\u0394', Units.val_mul, Units.val_pow_eq_pow_val]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_j (L246-L262)\nlemma variableChange_j : (C \u2022 W).j = W.j := by\nrw [j, coe_inv_variableChange_\u0394', variableChange_c\u2084, j, mul_pow, \u2190 pow_mul, \u2190 mul_assoc,\n mul_right_comm (C.u.val ^ 12), \u2190 mul_pow, C.u.mul_inv, one_pow, one_mul]\n\nend VariableChange\n\nsection BaseChange\n\n/-! ## Maps and base changes -/\n\nvariable {A : Type v} [CommRing A] (\u03c6 : R \u2192+* A)\n\nnamespace VariableChange\n\nvariable (C : VariableChange R)\n\n/-- The change of variables mapped over a ring homomorphism `\u03c6 : R \u2192+* A`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map (L264-L268)\ndef map : VariableChange A :=\n\u27e8Units.map \u03c6 C.u, \u03c6 C.r, \u03c6 C.s, \u03c6 C.t\u27e9\n\nvariable (A) in\n/-- The change of variables base changed to an algebra `A` over `R`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.baseChange (L269-L271)\nabbrev baseChange [Algebra R A] : VariableChange A :=\nC.map <| algebraMap R A\n```\n\n-- snippet 23\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map_id (L273-L275)\nlemma map_id : C.map (RingHom.id R) = C :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map_map (L276-L279)\nlemma map_map {A : Type v} [CommRing A] (\u03c6 : R \u2192+* A) {B : Type w} [CommRing B] (\u03c8 : A \u2192+* B) :\n (C.map \u03c6).map \u03c8 = C.map (\u03c8.comp \u03c6) :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.map_baseChange (L281-L285)\nlemma map_baseChange {S : Type s} [CommRing S] [Algebra R S] {A : Type v} [CommRing A] [Algebra R A]\n [Algebra S A] [IsScalarTower R S A] {B : Type w} [CommRing B] [Algebra R B] [Algebra S B]\n [IsScalarTower R S B] (\u03c8 : A \u2192\u2090[S] B) : (C.baseChange A).map \u03c8 = C.baseChange B :=\ncongr_arg C.map <| \u03c8.comp_algebraMap_of_tower R\n```\n\n-- snippet 26\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_negPolynomial (L396-L400)\nlemma map_negPolynomial :\n (W'.map f).toAffine.negPolynomial = W'.negPolynomial.map (mapRingHom f) := by\nsimp only [negPolynomial]\n map_simp\n```\n\n-- snippet 27\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_polynomial (L286-L290)\nlemma baseChange_polynomial : (W.baseChange B).toAffine.polynomial =\n (W.baseChange A).toAffine.polynomial.map (mapRingHom f) := by\nrw [\u2190 map_polynomial, map_baseChange]\n\nvariable {x y} in\n```\n\n-- snippet 28\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addY_sub_negY_addY (L382-L395)\nlemma addY_sub_negY_addY {x\u2081 x\u2082 : F} (y\u2081 y\u2082 : F) (hx : x\u2081 \u2260 x\u2082) :\n let x\u2083 := W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082)\nlet y\u2083 := W.addY x\u2081 x\u2082 y\u2081 (W.slope x\u2081 x\u2082 y\u2081 y\u2082)\n y\u2083 - W.negY x\u2083 y\u2083 =\n ((y\u2082 - W.negY x\u2082 y\u2082) * (x\u2081 - x\u2083) - (y\u2081 - W.negY x\u2081 y\u2081) * (x\u2082 - x\u2083)) / (x\u2082 - x\u2081) := by\n simp_rw [addY, negY, eq_div_iff (sub_ne_zero.mpr hx.symm)]\n linear_combination (norm := ring1) 2 * cyclic_sum_Y_mul_X_sub_X y\u2081 y\u2082 hx\n\nend slope\n\n/-! ## Maps and base changes -/\n\nvariable (f : R \u2192+* S) (x y x\u2081 y\u2081 x\u2082 y\u2082 \u2113 : R)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomial_zero (L141-L147)\nlemma evalEval_polynomial_zero : W.polynomial.evalEval 0 0 = -W.a\u2086 := by\nsimp only [evalEval_polynomial, zero_add, zero_sub, mul_zero, zero_pow <| Nat.succ_ne_zero _]\n\nvariable (W) in\n/-- The proposition that an affine point `(x, y)` lies in a Weierstrass curve `W`.\n\nIn other words, it satisfies the Weierstrass equation `W(X, Y) = 0`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_polynomialY (L273-L277)\nlemma map_polynomialY : (W.map f).toAffine.polynomialY = W.polynomialY.map (mapRingHom f) := by\nsimp only [polynomialY]\n map_simp\n\nvariable {f} in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.negY_negY (L116-L119)\nlemma negY_negY (x y : R) : W'.negY x (W'.negY x y) = y := by\nsimp only [negY]\n ring1\n```\n\n-- snippet 32\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff_variableChange (L163-L177)\nlemma equation_iff_variableChange (x y : R) :\n W.Equation x y \u2194 (VariableChange.mk 1 x 0 y \u2022 W).toAffine.Equation 0 0 := by\nrw [equation_iff', \u2190 neg_eq_zero, equation_zero, variableChange_a\u2086, inv_one, Units.val_one]\n congr! 1\n ring1\n\n/-! ## The nonsingular condition in affine coordinates -/\n\nvariable (W) in\n/-- The partial derivative `W_X(X, Y)` with respect to `X` of the polynomial `W(X, Y)` associated to\na Weierstrass curve `W` in affine coordinates. -/\n-- TODO: define this in terms of `Polynomial.derivative`.\nnoncomputable def polynomialX : R[X][Y] :=\n C (C W.a\u2081) * Y - C (C 3 * X ^ 2 + C (2 * W.a\u2082) * X + C W.a\u2084)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.evalEval_negPolynomial (L120-L123)\nlemma evalEval_negPolynomial (x y : R) : W'.negPolynomial.evalEval x y = W'.negY x y := by\nrw [negY, sub_sub, negPolynomial]\n eval_simp\n```\n\n-- snippet 34\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addX_eq_addX_negY_sub (L360-L372)\nlemma addX_eq_addX_negY_sub {x\u2081 x\u2082 : F} (y\u2081 y\u2082 : F) (hx : x\u2081 \u2260 x\u2082) :\n W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) = W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 <| W.negY x\u2082 y\u2082) -\n (y\u2081 - W.negY x\u2081 y\u2081) * (y\u2082 - W.negY x\u2082 y\u2082) / (x\u2082 - x\u2081) ^ 2 := by\nsimp_rw [slope_of_X_ne hx, addX, negY, \u2190 neg_sub x\u2081, neg_sq]\n simp [field]\n ring1\n\n-- Non-terminal simp, used to be field_simp\nset_option linter.flexible false in\n-- see https://github.com/leanprover-community/mathlib4/issues/29041\nset_option linter.unusedSimpArgs false in\n/-- The formula `y(P\u2081)(x(P\u2082) - x(P\u2083)) + y(P\u2082)(x(P\u2083) - x(P\u2081)) + y(P\u2083)(x(P\u2081) - x(P\u2082)) = 0`,\nassuming that `P\u2081 + P\u2082 + P\u2083 = O`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_negY (L401-L404)\nlemma map_negY : (W'.map f).toAffine.negY (f x) (f y) = f (W'.negY x y) := by\nsimp only [negY]\n map_simp\n```\n\n-- snippet 36\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addPolynomial_slope (L265-L287)\nlemma addPolynomial_slope {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : W.addPolynomial x\u2081 y\u2081 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) =\n -((X - C x\u2081) * (X - C x\u2082) * (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082))) := by\nrw [addPolynomial_eq, neg_inj, Cubic.prod_X_sub_C_eq, Cubic.toPoly_injective]\n by_cases hx : x\u2081 = x\u2082\n \u00b7 have hy : y\u2081 \u2260 W.negY x\u2082 y\u2082 := fun h => hxy \u27e8hx, h\u27e9\n rcases hx, Y_eq_of_Y_ne h\u2081 h\u2082 hx hy with \u27e8rfl, rfl\u27e9\n rw [equation_iff] at h\u2081 h\u2082\n rw [slope_of_Y_ne rfl hy]\n rw [negY, \u2190 sub_ne_zero] at hy\n replace hy : y\u2081 - (-y\u2081 - x\u2081 * W.a\u2081 - W.a\u2083) \u2260 0 := by convert hy using 1; ring\n ext\n \u00b7 rfl\n \u00b7 simp only [addX]\n ring1\n \u00b7 simp [field]\n ring1\n \u00b7 linear_combination (norm := (simp [field]; ring1)) -h\u2081\n \u00b7 rw [equation_iff] at h\u2081 h\u2082\n rw [slope_of_X_ne hx]\n simp only [addX]\n grind\n```\n\n-- snippet 37\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_neg (L134-L138)\nlemma equation_neg (x y : R) : W'.Equation x (W'.negY x y) \u2194 W'.Equation x y := by\nrw [equation_iff, equation_iff, negY]\n congr! 1\n ring1\n```\n\n-- snippet 38\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Nonsingular (L210-L212)\ndef Nonsingular (x y : R) : Prop :=\nW.Equation x y \u2227 (W.polynomialX.evalEval x y \u2260 0 \u2228 W.polynomialY.evalEval x y \u2260 0)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_equation (L297-L300)\nlemma baseChange_equation (hf : Function.Injective f) :\n (W.baseChange B).toAffine.Equation (f x) (f y) \u2194 (W.baseChange A).toAffine.Equation x y := by\nrw [\u2190 map_equation _ _ hf, AlgHom.toRingHom_eq_coe, map_baseChange, RingHom.coe_coe]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_zero (L224-L227)\nlemma nonsingular_zero : W.Nonsingular 0 0 \u2194 W.a\u2086 = 0 \u2227 (W.a\u2083 \u2260 0 \u2228 W.a\u2084 \u2260 0) := by\nrw [Nonsingular, equation_zero, evalEval_polynomialX_zero, neg_ne_zero, evalEval_polynomialY_zero,\n or_comm]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_polynomial (L256-L260)\nlemma map_polynomial : (W.map f).toAffine.polynomial = W.polynomial.map (mapRingHom f) := by\nsimp only [polynomial]\n map_simp\n\nvariable {x y} in\n```\n\n-- snippet 42\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_ne_zero (L105-L108)\nlemma polynomial_ne_zero [Nontrivial R] : W.polynomial \u2260 0 := by\nrw [polynomial_eq]\n exact Cubic.ne_zero_of_b_ne_zero one_ne_zero\n```\n\n-- snippet 43\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.derivative_addPolynomial_slope (L294-L302)\nlemma derivative_addPolynomial_slope {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081)\n (h\u2082 : W.Equation x\u2082 y\u2082) (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) :\n derivative (W.addPolynomial x\u2081 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) =\n -((X - C x\u2081) * (X - C x\u2082) + (X - C x\u2081) * (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082)) +\n (X - C x\u2082) * (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082))) := by\nrw [addPolynomial_slope h\u2081 h\u2082 hxy]\n derivative_simp\n ring1\n```\n\n-- snippet 44\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_equation (L265-L268)\nlemma map_equation (hf : Function.Injective f) :\n (W.map f).toAffine.Equation (f x) (f y) \u2194 W.Equation x y := by\nsimp only [Equation, map_polynomial, map_mapRingHom_evalEval, map_eq_zero_iff f hf]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.cyclic_sum_Y_mul_X_sub_X (L373-L381)\nlemma cyclic_sum_Y_mul_X_sub_X {x\u2081 x\u2082 : F} (y\u2081 y\u2082 : F) (hx : x\u2081 \u2260 x\u2082) :\n let x\u2083 := W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082)\ny\u2081 * (x\u2082 - x\u2083) + y\u2082 * (x\u2083 - x\u2081) + W.negAddY x\u2081 x\u2082 y\u2081 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) * (x\u2081 - x\u2082) = 0 := by\n simp_rw [slope_of_X_ne hx, negAddY, addX]\n simp [field, sub_ne_zero.mpr hx]\n ring1\n\n/-- The formula `\u03c8(P\u2081 + P\u2082) = (\u03c8(P\u2082)(x(P\u2081) - x(P\u2083)) - \u03c8(P\u2081)(x(P\u2082) - x(P\u2083))) / (x(P\u2082) - x(P\u2081))`,\nwhere `\u03c8(x,y) = 2y + a\u2081x + a\u2083`. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.monic_polynomial (L119-L121)\nlemma monic_polynomial : W.polynomial.Monic := by\nsimpa only [polynomial_eq] using Cubic.monic_of_b_eq_one'\n```\n\n-- snippet 47\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_add (L329-L333)\nlemma equation_add {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) :\n W.Equation (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.addY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) :=\n(equation_neg ..).mpr <| equation_negAdd h\u2081 h\u2082 hxy\n```\n\n-- snippet 48\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_negAdd (L334-L350)\nlemma nonsingular_negAdd {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Nonsingular x\u2081 y\u2081) (h\u2082 : W.Nonsingular x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : W.Nonsingular\n (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.negAddY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) := by\nby_cases hx\u2081 : W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) = x\u2081\n \u00b7 rwa [negAddY, hx\u2081, sub_self, mul_zero, zero_add]\n \u00b7 by_cases hx\u2082 : W.addX x\u2081 x\u2082 (W.slope x\u2081 x\u2082 y\u2081 y\u2082) = x\u2082\n \u00b7 by_cases hx : x\u2081 = x\u2082\n \u00b7 subst hx\n contradiction\n \u00b7 rwa [negAddY, \u2190 neg_sub, mul_neg, hx\u2082, slope_of_X_ne hx,\n div_mul_cancel\u2080 _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]\n \u00b7 apply nonsingular_negAdd_of_eval_derivative_ne_zero <| equation_negAdd h\u2081.left h\u2082.left hxy\n rw [derivative_addPolynomial_slope h\u2081.left h\u2082.left hxy]\n eval_simp\n simp only [neg_ne_zero, sub_self, mul_zero, add_zero]\n exact mul_ne_zero (sub_ne_zero_of_ne hx\u2081) (sub_ne_zero_of_ne hx\u2082)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff_nonsingular (L248-L255)\nlemma equation_iff_nonsingular [Nontrivial R] [W.IsElliptic] {x y : R} :\n W.toAffine.Equation x y \u2194 W.toAffine.Nonsingular x y :=\nW.toAffine.equation_iff_nonsingular_of_\u0394_ne_zero <| W.coe_\u0394' \u25b8 W.\u0394'.ne_zero\n\n/-! ## Maps and base changes -/\n\nvariable (f : R \u2192+* S) (x y : R)\n```\n\n-- snippet 50\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.negY (L113-L115)\ndef negY (x y : R) : R :=\n-y - W'.a\u2081 * x - W'.a\u2083\n```\n\n-- snippet 51\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_iff' (L213-L216)\nlemma nonsingular_iff' (x y : R) : W.Nonsingular x y \u2194 W.Equation x y \u2227\n (W.a\u2081 * y - (3 * x ^ 2 + 2 * W.a\u2082 * x + W.a\u2084) \u2260 0 \u2228 2 * y + W.a\u2081 * x + W.a\u2083 \u2260 0) := by\nrw [Nonsingular, equation_iff', evalEval_polynomialX, evalEval_polynomialY]\n```\n\n-- snippet 52\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_addPolynomial (L450-L453)\nlemma baseChange_addPolynomial : (W'.baseChange B).toAffine.addPolynomial (f x) (f y) (f \u2113) =\n ((W'.baseChange A).toAffine.addPolynomial x y \u2113).map f := by\nrw [\u2190 RingHom.coe_coe, \u2190 map_addPolynomial, map_baseChange]\n```\n\n-- snippet 53\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_negAdd (L322-L328)\nlemma equation_negAdd {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : W.Equation\n (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.negAddY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) := by\nrw [equation_add_iff, addPolynomial_slope h\u2081 h\u2082 hxy]\n eval_simp\n rw [neg_eq_zero, sub_self, mul_zero]\n```\n\n-- snippet 54\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_sub_polynomialY (L99-L103)\nlemma Y_sub_polynomialY : Y - W'.polynomialY = W'.negPolynomial := by\nrw [polynomialY, negPolynomial]\n C_simp\n ring1\n```\n\n-- snippet 55\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_ne (L184-L188)\nlemma slope_of_Y_ne {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 = x\u2082) (hy : y\u2081 \u2260 W.negY x\u2082 y\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 =\n (3 * x\u2081 ^ 2 + 2 * W.a\u2082 * x\u2081 + W.a\u2084 - W.a\u2081 * y\u2081) / (y\u2081 - W.negY x\u2081 y\u2081) := by\nsimp_all\n```\n\n-- snippet 56\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_X_ne (L190-L193)\nlemma slope_of_X_ne {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 \u2260 x\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 = (y\u2081 - y\u2082) / (x\u2081 - x\u2082) := by\nrw [slope, if_neg hx]\n```\n\n-- snippet 57\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_neg (L139-L167)\nlemma nonsingular_neg (x y : R) : W'.Nonsingular x (W'.negY x y) \u2194 W'.Nonsingular x y := by\nrw [nonsingular_iff, equation_neg, \u2190 negY, negY_negY, \u2190 @ne_comm _ y, nonsingular_iff]\n exact and_congr_right' <| (iff_congr not_and_or.symm not_and_or.symm).mpr <|\n not_congr <| and_congr_left fun h => by rw [\u2190 h]\n\n/-! ## Slope formulae in affine coordinates -/\n\nvariable (W') in\n/-- The line polynomial `\u2113(X - x) + y` associated to the line `Y = \u2113(X - x) + y` that passes through\na nonsingular affine point `(x, y)` on a Weierstrass curve `W` with a slope of `\u2113`.\n\nThis does not depend on `W`, and has argument order: `x`, `y`, `\u2113`. -/\nnoncomputable def linePolynomial (x y \u2113 : R) : R[X] :=\n C \u2113 * (X - C x) + C y\n\nsection slope\n\nvariable [DecidableEq F]\n\nvariable (W) in\n/-- The slope of the line through two nonsingular affine points `(x\u2081, y\u2081)` and `(x\u2082, y\u2082)` on a\nWeierstrass curve `W`.\n\nIf `x\u2081 \u2260 x\u2082`, then this line is the secant of `W` through `(x\u2081, y\u2081)` and `(x\u2082, y\u2082)`, and has slope\n`(y\u2081 - y\u2082) / (x\u2081 - x\u2082)`. Otherwise, if `y\u2081 \u2260 -y\u2081 - a\u2081x\u2081 - a\u2083`, then this line is the tangent of `W`\nat `(x\u2081, y\u2081) = (x\u2082, y\u2082)`, and has slope `(3x\u2081\u00b2 + 2a\u2082x\u2081 + a\u2084 - a\u2081y\u2081) / (2y\u2081 + a\u2081x\u2081 + a\u2083)`. Otherwise,\nthis line is vertical, in which case this returns the value `0`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `y\u2081`, `y\u2082`. -/\n```\n\n-- snippet 58\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addX (L238-L245)\ndef addX (x\u2081 x\u2082 \u2113 : R) : R :=\n\u2113 ^ 2 + W'.a\u2081 * \u2113 - W'.a\u2082 - x\u2081 - x\u2082\n\nvariable (W') in\n/-- The `Y`-coordinate of `-((x\u2081, y\u2081) + (x\u2082, y\u2082))` for two nonsingular affine points `(x\u2081, y\u2081)` and\n`(x\u2082, y\u2082)` on a Weierstrass curve `W`, where the line through them has a slope of `\u2113`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `y\u2081`, `\u2113`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_negAdd_of_eval_derivative_ne_zero (L303-L316)\nlemma nonsingular_negAdd_of_eval_derivative_ne_zero {x\u2081 x\u2082 y\u2081 \u2113 : R}\n (hx' : W'.Equation (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113))\n (hx : (W'.addPolynomial x\u2081 y\u2081 \u2113).derivative.eval (W'.addX x\u2081 x\u2082 \u2113) \u2260 0) :\n W'.Nonsingular (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113) := by\nrw [Nonsingular, and_iff_right hx', negAddY, polynomialX, polynomialY]\n eval_simp\n contrapose! hx\n rw [addPolynomial, linePolynomial, polynomial]\n eval_simp\n derivative_simp\n simp only [zero_add, add_zero, sub_zero, zero_mul, mul_one]\n eval_simp\n linear_combination (norm := (norm_num1; ring1)) hx.left + \u2113 * hx.right\n```\n\n-- snippet 60\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialY_zero (L200-L209)\nlemma evalEval_polynomialY_zero : W.polynomialY.evalEval 0 0 = W.a\u2083 := by\nsimp only [evalEval_polynomialY, zero_add, mul_zero]\n\nvariable (W) in\n/-- The proposition that an affine point `(x, y)` on a Weierstrass curve `W` is nonsingular.\n\nIn other words, either `W_X(x, y) \u2260 0` or `W_Y(x, y) \u2260 0`.\n\nNote that this definition is only mathematically accurate for fields. -/\n-- TODO: generalise this definition to be mathematically accurate for a larger class of rings.\n```\n\n-- snippet 61\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_addX (L415-L418)\nlemma map_addX : (W'.map f).toAffine.addX (f x\u2081) (f x\u2082) (f \u2113) = f (W'.addX x\u2081 x\u2082 \u2113) := by\nsimp only [addX]\n map_simp\n```\n\n-- snippet 62\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_eq_of_Y_ne (L130-L133)\nlemma Y_eq_of_Y_ne {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082) (hx : x\u2081 = x\u2082)\n (hy : y\u2081 \u2260 W.negY x\u2082 y\u2082) : y\u2081 = y\u2082 :=\n(Y_eq_of_X_eq h\u2081 h\u2082 hx).resolve_right hy\n```\n\n-- snippet 63\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_sub_negPolynomial (L104-L111)\nlemma Y_sub_negPolynomial : Y - W'.negPolynomial = W'.polynomialY := by\nrw [\u2190 Y_sub_polynomialY, sub_sub_cancel]\n\nvariable (W') in\n/-- The `Y`-coordinate of `-(x, y)` for a nonsingular affine point `(x, y)` on a Weierstrass curve\n`W`.\n\nThis depends on `W`, and has argument order: `x`, `y`. -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_polynomialY (L305-L309)\nlemma baseChange_polynomialY : (W.baseChange B).toAffine.polynomialY =\n (W.baseChange A).toAffine.polynomialY.map (mapRingHom f) := by\nrw [\u2190 map_polynomialY, map_baseChange]\n\nvariable {f} in\n```\n\n-- snippet 65\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Equation (L148-L150)\ndef Equation (x y : R) : Prop :=\nW.polynomial.evalEval x y = 0\n```\n\n-- snippet 66\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope (L168-L172)\ndef slope (x\u2081 x\u2082 y\u2081 y\u2082 : F) : F :=\nif x\u2081 = x\u2082 then if y\u2081 = W.negY x\u2082 y\u2082 then 0\n else (3 * x\u2081 ^ 2 + 2 * W.a\u2082 * x\u2081 + W.a\u2084 - W.a\u2081 * y\u2081) / (y\u2081 - W.negY x\u2081 y\u2081)\n else (y\u2081 - y\u2082) / (x\u2081 - x\u2082)\n```\n\n-- snippet 67\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_zero (L160-L162)\nlemma equation_zero : W.Equation 0 0 \u2194 W.a\u2086 = 0 := by\nrw [Equation, evalEval_polynomial_zero, neg_eq_zero]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_iff_variableChange (L228-L241)\nlemma nonsingular_iff_variableChange (x y : R) :\n W.Nonsingular x y \u2194 (VariableChange.mk 1 x 0 y \u2022 W).toAffine.Nonsingular 0 0 := by\nrw [nonsingular_iff', equation_iff_variableChange, equation_zero, \u2190 neg_ne_zero, or_comm,\n nonsingular_zero, variableChange_a\u2083, variableChange_a\u2084, inv_one, Units.val_one]\n simp only [variableChange_def]\n congr! 3 <;> ring1\n\nprivate lemma equation_zero_iff_nonsingular_zero_of_\u0394_ne_zero (h\u0394 : W.\u0394 \u2260 0) :\n W.Equation 0 0 \u2194 W.Nonsingular 0 0 := by\n simp only [equation_zero, nonsingular_zero, iff_self_and]\n contrapose! h\u0394\n simp only [b\u2082, b\u2084, b\u2086, b\u2088, \u0394, h\u0394]\n ring1\n```\n\n-- snippet 69\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_polynomialX (L269-L272)\nlemma map_polynomialX : (W.map f).toAffine.polynomialX = W.polynomialX.map (mapRingHom f) := by\nsimp only [polynomialX]\n map_simp\n```\n\n-- snippet 70\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_slope (L428-L441)\nlemma map_slope [DecidableEq F] [DecidableEq K] (f : F \u2192+* K) (x\u2081 x\u2082 y\u2081 y\u2082 : F) :\n (W.map f).toAffine.slope (f x\u2081) (f x\u2082) (f y\u2081) (f y\u2082) = f (W.slope x\u2081 x\u2082 y\u2081 y\u2082) := by\nby_cases hx : x\u2081 = x\u2082\n \u00b7 by_cases hy : y\u2081 = W.negY x\u2082 y\u2082\n \u00b7 rw [slope_of_Y_eq (congr_arg f hx) <| by rw [hy, map_negY], slope_of_Y_eq hx hy, map_zero]\n \u00b7 rw [slope_of_Y_ne (congr_arg f hx) <| map_negY f x\u2082 y\u2082 \u25b8 fun h => hy <| f.injective h,\n map_negY, slope_of_Y_ne hx hy]\n map_simp\n \u00b7 rw [slope_of_X_ne fun h => hx <| f.injective h, slope_of_X_ne hx]\n map_simp\n\nvariable [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] [Algebra R B] [Algebra S B]\n [IsScalarTower R S B] (f : A \u2192\u2090[S] B) (x y x\u2081 y\u2081 x\u2082 y\u2082 \u2113 : A)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff (L155-L158)\nlemma equation_iff (x y : R) : W.Equation x y \u2194\n y ^ 2 + W.a\u2081 * x * y + W.a\u2083 * y = x ^ 3 + W.a\u2082 * x ^ 2 + W.a\u2084 * x + W.a\u2086 := by\nrw [equation_iff', sub_eq_zero]\n```\n\n-- snippet 72\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_addX (L454-L457)\nlemma baseChange_addX : (W'.baseChange B).toAffine.addX (f x\u2081) (f x\u2082) (f \u2113) =\n f ((W'.baseChange A).toAffine.addX x\u2081 x\u2082 \u2113) := by\nrw [\u2190 RingHom.coe_coe, \u2190 map_addX, map_baseChange]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff' (L151-L154)\nlemma equation_iff' (x y : R) : W.Equation x y \u2194\n y ^ 2 + W.a\u2081 * x * y + W.a\u2083 * y - (x ^ 3 + W.a\u2082 * x ^ 2 + W.a\u2084 * x + W.a\u2086) = 0 := by\nrw [Equation, evalEval_polynomial]\n```\n\n-- snippet 74\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.Affine (L74-L77)\nabbrev Affine : Type r :=\nWeierstrassCurve R\n\n/-- The conversion from a Weierstrass curve to affine coordinates. -/\n```\n\n-- snippet 75\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialX (L178-L182)\nlemma evalEval_polynomialX (x y : R) :\n W.polynomialX.evalEval x y = W.a\u2081 * y - (3 * x ^ 2 + 2 * W.a\u2082 * x + W.a\u2084) := by\nsimp only [polynomialX]\n eval_simp\n```\n\n-- snippet 76\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_addPolynomial (L409-L414)\nlemma map_addPolynomial :\n (W'.map f).toAffine.addPolynomial (f x) (f y) (f \u2113) = (W'.addPolynomial x y \u2113).map f := by\nrw [addPolynomial, map_polynomial, eval_map, linePolynomial, addPolynomial, \u2190 coe_mapRingHom,\n \u2190 eval\u2082_hom, linePolynomial]\n simp\n```\n\n-- snippet 77\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.C_addPolynomial_slope (L288-L293)\nlemma C_addPolynomial_slope {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) : C (W.addPolynomial x\u2081 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) =\n -(C (X - C x\u2081) * C (X - C x\u2082) * C (X - C (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082))) := by\nrw [addPolynomial_slope h\u2081 h\u2082 hxy]\n simp\n```\n\n-- snippet 78\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_negY (L446-L449)\nlemma baseChange_negY :\n (W'.baseChange B).toAffine.negY (f x) (f y) = f ((W'.baseChange A).toAffine.negY x y) := by\nrw [\u2190 RingHom.coe_coe, \u2190 map_negY, map_baseChange]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.Y_eq_of_X_eq (L124-L129)\nlemma Y_eq_of_X_eq {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Equation x\u2081 y\u2081) (h\u2082 : W.Equation x\u2082 y\u2082)\n (hx : x\u2081 = x\u2082) : y\u2081 = y\u2082 \u2228 y\u2081 = W.negY x\u2082 y\u2082 := by\nrw [equation_iff] at h\u2081 h\u2082\n rw [\u2190 sub_eq_zero, \u2190 sub_eq_zero (a := y\u2081), \u2190 mul_eq_zero, negY]\n linear_combination (norm := (rw [hx]; ring1)) h\u2081 - h\u2082\n```\n\n-- snippet 80\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.map_nonsingular (L278-L285)\nlemma map_nonsingular (hf : Function.Injective f) :\n (W.map f).toAffine.Nonsingular (f x) (f y) \u2194 W.Nonsingular x y := by\nsimp only [Nonsingular, evalEval, map_equation _ _ hf, map_polynomialX, map_polynomialY,\n map_mapRingHom_evalEval, map_ne_zero_iff f hf]\n\nvariable [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] [Algebra R B] [Algebra S B]\n [IsScalarTower R S B] (f : A \u2192\u2090[S] B) (x y : A)\n```\n\n-- snippet 81\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.nonsingular_iff (L217-L222)\nlemma nonsingular_iff (x y : R) : W.Nonsingular x y \u2194 W.Equation x y \u2227\n (W.a\u2081 * y \u2260 3 * x ^ 2 + 2 * W.a\u2082 * x + W.a\u2084 \u2228 y \u2260 -y - W.a\u2081 * x - W.a\u2083) := by\nrw [nonsingular_iff', sub_ne_zero, \u2190 sub_ne_zero (a := y)]\n congr! 3\n ring1\n```\n\n-- snippet 82\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_addY (L424-L427)\nlemma map_addY :\n (W'.map f).toAffine.addY (f x\u2081) (f x\u2082) (f y\u2081) (f \u2113) = f (W'.toAffine.addY x\u2081 x\u2082 y\u2081 \u2113) := by\nsimp only [addY, map_negAddY, map_addX, map_negY]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.equation_iff_nonsingular_of_\u0394_ne_zero (L242-L247)\nlemma equation_iff_nonsingular_of_\u0394_ne_zero {x y : R} (h\u0394 : W.\u0394 \u2260 0) :\n W.Equation x y \u2194 W.Nonsingular x y := by\nrw [equation_iff_variableChange, nonsingular_iff_variableChange,\n equation_zero_iff_nonsingular_zero_of_\u0394_ne_zero <| by\n rwa [variableChange_\u0394, inv_one, Units.val_one, one_pow, one_mul]]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.baseChange_negPolynomial (L442-L445)\nlemma baseChange_negPolynomial : (W'.baseChange B).toAffine.negPolynomial =\n (W'.baseChange A).toAffine.negPolynomial.map (mapRingHom f) := by\nrw [\u2190 map_negPolynomial, map_baseChange]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.irreducible_polynomial (L122-L133)\nlemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by\nby_contra h\n rcases (monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff natDegree_polynomial).mp h\n with \u27e8f, g, h0, h1\u27e9\n simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1\n apply_fun degree at h0 h1\n rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0\n apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_gt\n rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h\n iterate 2 rw [degree_add_eq_right_of_degree_lt] <;> simp only [h] <;> decide\n iterate 2 rw [degree_add_eq_left_of_degree_lt] <;> simp only [h] <;> decide\n```\n\n-- snippet 86\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_linePolynomial (L405-L408)\nlemma map_linePolynomial : linePolynomial (f x) (f y) (f \u2113) = (linePolynomial x y \u2113).map f := by\nsimp only [linePolynomial]\n map_simp\n```\n\n-- snippet 87\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_eq (L174-L177)\nlemma slope_of_Y_eq {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 = x\u2082) (hy : y\u2081 = W.negY x\u2082 y\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 = 0 := by\nrw [slope, if_pos hx, if_pos hy]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_polynomialX (L301-L304)\nlemma baseChange_polynomialX : (W.baseChange B).toAffine.polynomialX =\n (W.baseChange A).toAffine.polynomialX.map (mapRingHom f) := by\nrw [\u2190 map_polynomialX, map_baseChange]\n```\n\n-- snippet 89\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.C_addPolynomial (L215-L222)\nlemma C_addPolynomial (x y \u2113 : R) : C (W'.addPolynomial x y \u2113) =\n (Y - C (linePolynomial x y \u2113)) * (W'.negPolynomial - C (linePolynomial x y \u2113)) +\n W'.polynomial := by\nrw [addPolynomial, linePolynomial, polynomial, negPolynomial]\n eval_simp\n C_simp\n ring1\n```\n\n-- snippet 90\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_ne' (L179-L183)\nlemma slope_of_Y_ne' {x\u2082 y\u2081 y\u2082 : F} (hy : \u00acy\u2081 = -y\u2082 - W.a\u2081 * x\u2082 - W.a\u2083) :\n W.slope x\u2082 x\u2082 y\u2081 y\u2082 =\n (3 * x\u2082 ^ 2 + 2 * W.a\u2082 * x\u2082 + W.a\u2084 - W.a\u2081 * y\u2081) / (y\u2081 - (-y\u2081 - W.a\u2081 * x\u2082 - W.a\u2083)) := by\nsimp [slope, hy]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.natDegree_polynomial (L115-L118)\nlemma natDegree_polynomial [Nontrivial R] : W.polynomial.natDegree = 2 := by\nrw [polynomial_eq]\n exact Cubic.natDegree_of_b_ne_zero' one_ne_zero\n```\n\n-- snippet 92\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.polynomial_eq (L98-L104)\nlemma polynomial_eq : W.polynomial = Cubic.toPoly\n \u27e80, 1, Cubic.toPoly \u27e80, 0, W.a\u2081, W.a\u2083\u27e9, Cubic.toPoly \u27e8-1, -W.a\u2082, -W.a\u2084, -W.a\u2086\u27e9\u27e9 := by\nsimp_rw [polynomial, Cubic.toPoly]\n map_simp\n simp only [C_0, C_1]\n ring1\n```\n\n-- snippet 93\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.baseChange_nonsingular (L310-L317)\nlemma baseChange_nonsingular (hf : Function.Injective f) :\n (W.baseChange B).toAffine.Nonsingular (f x) (f y) \u2194\n (W.baseChange A).toAffine.Nonsingular x y := by\nrw [\u2190 map_nonsingular _ _ hf, AlgHom.toRingHom_eq_coe, map_baseChange, RingHom.coe_coe]\n\nend Affine\n\nend WeierstrassCurve\n```\n\n-- snippet 94\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addY (L256-L264)\ndef addY (x\u2081 x\u2082 y\u2081 \u2113 : R) : R :=\nW'.negY (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113)\n\nsection slope\n\nvariable [DecidableEq F]\n\n-- Non-terminal simps, used to be field_simp\nset_option linter.flexible false in\n```\n\n-- snippet 95\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.degree_polynomial (L110-L113)\nlemma degree_polynomial [Nontrivial R] : W.polynomial.degree = 2 := by\nrw [polynomial_eq]\n exact Cubic.degree_of_b_ne_zero' one_ne_zero\n```\n\n-- snippet 96\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.negAddY (L247-L254)\ndef negAddY (x\u2081 x\u2082 y\u2081 \u2113 : R) : R :=\n\u2113 * (W'.addX x\u2081 x\u2082 \u2113 - x\u2081) + y\u2081\n\nvariable (W') in\n/-- The `Y`-coordinate of `(x\u2081, y\u2081) + (x\u2082, y\u2082)` for two nonsingular affine points `(x\u2081, y\u2081)` and\n`(x\u2082, y\u2082)` on a Weierstrass curve `W`, where the line through them has a slope of `\u2113`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `y\u2081`, `\u2113`. -/\n```\n\n-- snippet 97\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialX_zero (L184-L193)\nlemma evalEval_polynomialX_zero : W.polynomialX.evalEval 0 0 = -W.a\u2084 := by\nsimp only [evalEval_polynomialX, zero_add, zero_sub, mul_zero, zero_pow <| Nat.succ_ne_zero _]\n\nvariable (W) in\n/-- The partial derivative `W_Y(X, Y)` with respect to `Y` of the polynomial `W(X, Y)` associated to\na Weierstrass curve `W` in affine coordinates. -/\n-- TODO: define this in terms of `Polynomial.derivative`.\nnoncomputable def polynomialY : R[X][Y] :=\n C (C 2) * Y + C (C W.a\u2081 * X + C W.a\u2083)\n```\n\n-- snippet 98\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.slope_of_Y_ne_eq_evalEval (L194-L214)\nlemma slope_of_Y_ne_eq_evalEval {x\u2081 x\u2082 y\u2081 y\u2082 : F} (hx : x\u2081 = x\u2082) (hy : y\u2081 \u2260 W.negY x\u2082 y\u2082) :\n W.slope x\u2081 x\u2082 y\u2081 y\u2082 = -W.polynomialX.evalEval x\u2081 y\u2081 / W.polynomialY.evalEval x\u2081 y\u2081 := by\nrw [slope_of_Y_ne hx hy, evalEval_polynomialX, neg_sub]\n congr 1\n rw [negY, evalEval_polynomialY]\n ring1\n\nend slope\n\n/-! ## Addition formulae in affine coordinates -/\n\nvariable (W') in\n/-- The addition polynomial obtained by substituting the line `Y = \u2113(X - x) + y` into the polynomial\n`W(X, Y)` associated to a Weierstrass curve `W`. If such a line intersects `W` at another\nnonsingular affine point `(x', y')` on `W`, then the roots of this polynomial are precisely `x`,\n`x'`, and the `X`-coordinate of the addition of `(x, y)` and `(x', y')`.\n\nThis depends on `W`, and has argument order: `x`, `y`, `\u2113`. -/\nnoncomputable def addPolynomial (x y \u2113 : R) : R[X] :=\n W'.polynomial.eval <| linePolynomial x y \u2113\n```\n\n-- snippet 99\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomial (L134-L139)\nlemma evalEval_polynomial (x y : R) : W.polynomial.evalEval x y =\n y ^ 2 + W.a\u2081 * x * y + W.a\u2083 * y - (x ^ 3 + W.a\u2082 * x ^ 2 + W.a\u2084 * x + W.a\u2086) := by\nsimp only [polynomial]\n eval_simp\n rw [add_mul, \u2190 add_assoc]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.map_negAddY (L419-L423)\nlemma map_negAddY :\n (W'.map f).toAffine.negAddY (f x\u2081) (f x\u2082) (f y\u2081) (f \u2113) = f (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113) := by\nsimp only [negAddY, map_addX]\n map_simp\n```\n\n-- snippet 101\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.nonsingular_add (L351-L359)\nlemma nonsingular_add {x\u2081 x\u2082 y\u2081 y\u2082 : F} (h\u2081 : W.Nonsingular x\u2081 y\u2081) (h\u2082 : W.Nonsingular x\u2082 y\u2082)\n (hxy : \u00ac(x\u2081 = x\u2082 \u2227 y\u2081 = W.negY x\u2082 y\u2082)) :\n W.Nonsingular (W.addX x\u2081 x\u2082 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) (W.addY x\u2081 x\u2082 y\u2081 <| W.slope x\u2081 x\u2082 y\u2081 y\u2082) :=\n(nonsingular_neg ..).mpr <| nonsingular_negAdd h\u2081 h\u2082 hxy\n\n-- Non-terminal simp, used to be field_simp\nset_option linter.flexible false in\n/-- The formula `x(P\u2081 + P\u2082) = x(P\u2081 - P\u2082) - \u03c8(P\u2081)\u03c8(P\u2082) / (x(P\u2082) - x(P\u2081))\u00b2`,\nwhere `\u03c8(x,y) = 2y + a\u2081x + a\u2083`. -/\n```\n\n-- snippet 102\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.toAffine (L78-L97)\nabbrev toAffine (W : WeierstrassCurve R) : Affine R :=\nW\n\nvariable [CommRing R] [CommRing S] [CommRing A] [CommRing B] {W : Affine R}\n\nnamespace Affine\n\n/-! ## Weierstrass equations in affine coordinates -/\n\nvariable (W) in\n/-- The polynomial `W(X, Y) := Y\u00b2 + a\u2081XY + a\u2083Y - (X\u00b3 + a\u2082X\u00b2 + a\u2084X + a\u2086)` associated to a Weierstrass\ncurve `W` over a ring `R` in affine coordinates.\n\nFor ease of polynomial manipulation, this is represented as a term of type `R[X][X]`, where the\ninner variable represents `X` and the outer variable represents `Y`. For clarity, the alternative\nnotations `Y` and `R[X][Y]` are provided in the `Polynomial.Bivariate` scope to represent the outer\nvariable and the bivariate polynomial ring `R[X][X]` respectively. -/\nnoncomputable def polynomial : R[X][Y] :=\n Y ^ 2 + C (C W.a\u2081 * X + C W.a\u2083) * Y - C (X ^ 3 + C W.a\u2082 * X ^ 2 + C W.a\u2084 * X + C W.a\u2086)\n```\n\n-- snippet 103\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.addPolynomial_eq (L223-L236)\nlemma addPolynomial_eq (x y \u2113 : R) : W'.addPolynomial x y \u2113 = -Cubic.toPoly\n \u27e81, -\u2113 ^ 2 - W'.a\u2081 * \u2113 + W'.a\u2082,\n 2 * x * \u2113 ^ 2 + (W'.a\u2081 * x - 2 * y - W'.a\u2083) * \u2113 + (-W'.a\u2081 * y + W'.a\u2084),\n -x ^ 2 * \u2113 ^ 2 + (2 * x * y + W'.a\u2083 * x) * \u2113 - (y ^ 2 + W'.a\u2083 * y - W'.a\u2086)\u27e9 := by\nrw [addPolynomial, linePolynomial, polynomial, Cubic.toPoly]\n eval_simp\n C_simp\n ring1\n\nvariable (W') in\n/-- The `X`-coordinate of `(x\u2081, y\u2081) + (x\u2082, y\u2082)` for two nonsingular affine points `(x\u2081, y\u2081)` and\n`(x\u2082, y\u2082)` on a Weierstrass curve `W`, where the line through them has a slope of `\u2113`.\n\nThis depends on `W`, and has argument order: `x\u2081`, `x\u2082`, `\u2113`. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Basic.evalEval_polynomialY (L194-L198)\nlemma evalEval_polynomialY (x y : R) : W.polynomialY.evalEval x y = 2 * y + W.a\u2081 * x + W.a\u2083 := by\nsimp only [polynomialY]\n eval_simp\n rw [\u2190 add_assoc]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Formula.equation_add_iff (L317-L321)\nlemma equation_add_iff (x\u2081 x\u2082 y\u2081 \u2113 : R) : W'.Equation (W'.addX x\u2081 x\u2082 \u2113) (W'.negAddY x\u2081 x\u2082 y\u2081 \u2113) \u2194\n (W'.addPolynomial x\u2081 y\u2081 \u2113).eval (W'.addX x\u2081 x\u2082 \u2113) = 0 := by\nrw [Equation, negAddY, addPolynomial, linePolynomial, polynomial]\n eval_simp\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/AlgebraicGeometry/EllipticCurve/VariableChange.lean", "module": "Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "declaration": "Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange.variableChange_b\u2086", "span": "L199-L203", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/EllipticCurve/VariableChange.lean#L199"}, "environment": {}, "measurements": {"input_tokens": 17176, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 41113, "lean_code_chars": 37829, "natural_language_chars": 3284, "lean_code_ratio": 0.9201, "line_count": 1147, "imports_count": 0, "declarations_count": 4363, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "da636ab62db6134c", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extChartAt_target_subset_range", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.IsManifold.ExtChartAt)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem extChartAt_target_subset_range (x : M) : (extChartAt I x).target \u2286 range I\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend (L75-L77)\ndef extend : PartialEquiv M E :=\nf.toPartialEquiv \u226b I.toPartialEquiv\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe (L78-L80)\ntheorem extend_coe : \u21d1(f.extend I) = I \u2218 f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe_symm (L81-L83)\ntheorem extend_coe_symm : \u21d1(f.extend I).symm = f.symm \u2218 I.symm :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source (L84-L86)\ntheorem extend_source : (f.extend I).source = f.source := by\nrw [extend, PartialEquiv.trans_source, I.source_eq, preimage_univ, inter_univ]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_source (L87-L90)\ntheorem isOpen_extend_source : IsOpen (f.extend I).source := by\nrw [extend_source]\n exact f.open_source\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target (L91-L93)\ntheorem extend_target : (f.extend I).target = I.symm \u207b\u00b9' f.target \u2229 range I := by\nsimp_rw [extend, PartialEquiv.trans_target, I.target_eq, I.toPartialEquiv_coe_symm, inter_comm]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target' (L94-L96)\ntheorem extend_target' : (f.extend I).target = I '' f.target := by\nrw [extend, PartialEquiv.trans_target'', I.source_eq, univ_inter, I.toPartialEquiv_coe]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_eq_image_source (L97-L99)\ntheorem extend_target_eq_image_source : (f.extend I).target = (f.extend I) '' f.source := by\nrw [f.extend_target', \u2190 f.image_source_eq_target, \u2190 image_comp, f.extend_coe]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_target (L100-L103)\nlemma isOpen_extend_target [I.Boundaryless] : IsOpen (f.extend I).target := by\nrw [extend_target, I.range_eq_univ, inter_univ]\n exact I.continuous_symm.isOpen_preimage _ f.open_target\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.mapsTo_extend (L104-L109)\ntheorem mapsTo_extend (hs : s \u2286 f.source) :\n MapsTo (f.extend I) s ((f.extend I).symm \u207b\u00b9' s \u2229 range I) := by\nrw [mapsTo_iff_image_subset, extend_coe, extend_coe_symm, preimage_comp, \u2190 I.image_eq, image_comp,\n f.image_eq_target_inter_inv_preimage hs]\n exact image_mono inter_subset_right\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv (L110-L113)\ntheorem extend_left_inv {x : M} (hxf : x \u2208 f.source) : (f.extend I).symm (f.extend I x) = x :=\n(f.extend I).left_inv <| by rwa [f.extend_source]\n\n/-- Variant of `f.extend_left_inv I`, stated in terms of images. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv' (L114-L116)\nlemma extend_left_inv' (ht : t \u2286 f.source) : ((f.extend I).symm \u2218 (f.extend I)) '' t = t :=\nEqOn.image_eq_self (fun _ hx \u21a6 f.extend_left_inv (ht hx))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhds (L117-L119)\ntheorem extend_source_mem_nhds {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd x :=\n(isOpen_extend_source f).mem_nhds <| by rwa [f.extend_source]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhdsWithin (L120-L122)\ntheorem extend_source_mem_nhdsWithin {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd[s] x :=\nmem_nhdsWithin_of_mem_nhds <| extend_source_mem_nhds f h\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.continuousOn_extend (L123-L127)\ntheorem continuousOn_extend : ContinuousOn (f.extend I) (f.extend I).source := by\nrefine I.continuous.comp_continuousOn ?_\n rw [extend_source]\n exact f.continuousOn\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.continuousAt_extend (L128-L130)\ntheorem continuousAt_extend {x : M} (h : x \u2208 f.source) : ContinuousAt (f.extend I) x :=\n(continuousOn_extend f).continuousAt <| extend_source_mem_nhds f h\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.map_extend_nhds (L131-L134)\ntheorem map_extend_nhds {x : M} (hy : x \u2208 f.source) :\n map (f.extend I) (\ud835\udcdd x) = \ud835\udcdd[range I] f.extend I x := by\nrwa [extend_coe, comp_apply, \u2190 I.map_nhds_eq, \u2190 f.map_nhds_eq, map_map]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.map_extend_nhds_of_mem_interior_range (L135-L140)\ntheorem map_extend_nhds_of_mem_interior_range {x : M} (hx : x \u2208 f.source)\n (h'x : f.extend I x \u2208 interior (range I)) :\n map (f.extend I) (\ud835\udcdd x) = \ud835\udcdd (f.extend I x) := by\nrw [f.map_extend_nhds hx, nhdsWithin_eq_nhds]\n exact mem_of_superset (isOpen_interior.mem_nhds h'x) interior_subset\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.map_extend_nhds_of_boundaryless (L141-L144)\ntheorem map_extend_nhds_of_boundaryless [I.Boundaryless] {x : M} (hx : x \u2208 f.source) :\n map (f.extend I) (\ud835\udcdd x) = \ud835\udcdd (f.extend I x) := by\nrw [f.map_extend_nhds hx, I.range_eq_univ, nhdsWithin_univ]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_mem_nhdsWithin (L145-L149)\ntheorem extend_target_mem_nhdsWithin {y : M} (hy : y \u2208 f.source) :\n (f.extend I).target \u2208 \ud835\udcdd[range I] f.extend I y := by\nrw [\u2190 PartialEquiv.image_source_eq_target, \u2190 map_extend_nhds f hy]\n exact image_mem_map (extend_source_mem_nhds _ hy)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_image_target_mem_nhds (L150-L155)\nlemma extend_image_target_mem_nhds {x : M} (hx : x \u2208 f.source) :\n I '' f.target \u2208 \ud835\udcdd[range I] (f.extend I) x := by\nrw [\u2190 f.map_extend_nhds hx, Filter.mem_map,\n f.extend_coe, Set.preimage_comp, I.preimage_image f.target]\n exact (f.continuousAt hx).preimage_mem_nhds (f.open_target.mem_nhds (f.map_source hx))\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_image_nhds_mem_nhds_of_boundaryless (L156-L160)\ntheorem extend_image_nhds_mem_nhds_of_boundaryless [I.Boundaryless] {x} (hx : x \u2208 f.source)\n {s : Set M} (h : s \u2208 \ud835\udcdd x) : (f.extend I) '' s \u2208 \ud835\udcdd ((f.extend I) x) := by\nrw [\u2190 f.map_extend_nhds_of_boundaryless hx, Filter.mem_map]\n filter_upwards [h] using subset_preimage_image (f.extend I) s\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_image_nhds_mem_nhds_of_mem_interior_range (L161-L166)\ntheorem extend_image_nhds_mem_nhds_of_mem_interior_range {x} (hx : x \u2208 f.source)\n (h'x : f.extend I x \u2208 interior (range I)) {s : Set M} (h : s \u2208 \ud835\udcdd x) :\n (f.extend I) '' s \u2208 \ud835\udcdd ((f.extend I) x) := by\nrw [\u2190 f.map_extend_nhds_of_mem_interior_range hx h'x, Filter.mem_map]\n filter_upwards [h] using subset_preimage_image (f.extend I) s\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_subset_range (L167-L168)\ntheorem extend_target_subset_range : (f.extend I).target \u2286 range I := by simp only [mfld_simps]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.interior_extend_target_subset_interior_range (L169-L175)\nlemma interior_extend_target_subset_interior_range :\n interior (f.extend I).target \u2286 interior (range I) := by\nrw [f.extend_target, interior_inter, (f.open_target.preimage I.continuous_symm).interior_eq]\n exact inter_subset_right\n\n/-- If `y \u2208 f.target` and `I y \u2208 interior (range I)`,\nthen `I y` is an interior point of `(I \u2218 f).target`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_mul_left (L144-L146)\ntheorem contMDiffAt_mul_left {a b : G} : CMDiffAt n (a * \u00b7) b :=\ncontMDiff_mul_left.contMDiffAt\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiableAt_mul_left (L166-L168)\ntheorem mdifferentiableAt_mul_left {a b : G} : MDiffAt (a * \u00b7) b :=\ncontMDiffAt_mul_left.mdifferentiableAt one_ne_zero\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffOn_finprod (L375-L379)\ntheorem contMDiffOn_finprod\n (lf : LocallyFinite fun i \u21a6 Function.mulSupport <| f i) (h : \u2200 i, CMDiff[s] n (f i)) :\n CMDiff[s] n (fun x \u21a6 \u220f\u1da0 i, f i x) := fun x hx \u21a6\ncontMDiffWithinAt_finprod lf fun i \u21a6 h i x hx\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.coe_mul (L41-L44)\ntheorem coe_mul {G : Type*} [Mul G] [TopologicalSpace G] [ChartedSpace H' G] [ContMDiffMul I' n G]\n (f g : C^n\u27eeI, N; I', G\u27ef) : \u21d1(f * g) = f * g :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finset_prod' (L396-L398)\ntheorem contMDiff_finset_prod' (h : \u2200 i \u2208 t, CMDiff n (f i)) :\n CMDiff n (\u220f i \u2208 t, f i) := fun x \u21a6 contMDiffAt_finset_prod' fun i hi \u21a6 h i hi x\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_sub (L140-L142)\ntheorem coe_sub : \u21d1(X - Y) = X - Y :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothRightMul_one (L232-L234)\ntheorem smoothRightMul_one : (\ud835\udc79 I g') 1 = g' :=\none_mul g'\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_zero (L148-L151)\ntheorem lift_zero :\n (\u2191(0 : LeftInvariantDerivation I G) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = 0 :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.instNormedSpaceLieAddGroup (L197-L217)\ninstance instNormedSpaceLieAddGroup {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {n : WithTop \u2115\u221e}\n {E : Type*} [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] : LieAddGroup \ud835\udcd8(\ud835\udd5c, E) n E where\n contMDiff_neg := contDiff_neg.contMDiff\n/-! ## `C^n` manifolds with `C^n` inversion away from zero\n\nTypeclass for `C^n` manifolds with `0` and `Inv` such that inversion is `C^n` at all non-zero\npoints. (This includes multiplicative Lie groups, but also complete normed semifields.)\nPoint-wise inversion is `C^n` when the function/denominator is non-zero. -/\nsection ContMDiffInv\u2080\n\n-- See note [Design choices about smooth algebraic structures]\n/-- A `C^n` manifold with `0` and `Inv` such that `fun x \u21a6 x\u207b\u00b9` is `C^n` at all nonzero points.\nAny complete normed (semi)field has this property. -/\nclass ContMDiffInv\u2080 {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {H : Type*} [TopologicalSpace H]\n {E : Type*} [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] (I : ModelWithCorners \ud835\udd5c E H)\n (n : WithTop \u2115\u221e) (G : Type*)\n [Inv G] [Zero G] [TopologicalSpace G] [ChartedSpace H G] : Prop where\n /-- Inversion is `C^n` away from `0`. -/\n contMDiffAt_inv\u2080 : \u2200 \u2983x : G\u2984, x \u2260 0 \u2192 CMDiffAt n (fun (y : G) \u21a6 y\u207b\u00b9) x\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiff (L136-L138)\ntheorem ContMDiff.mul (hf : CMDiff n f) (hg : CMDiff n g) : CMDiff n (f * g) :=\nfun x \u21a6 (hf x).mul (hg x)\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.instPow (L61-L65)\ninstance instPow {G : Type*} [Monoid G] [TopologicalSpace G] [ChartedSpace H' G]\n [ContMDiffMul I' n G] :\n Pow C^n\u27eeI, N; I', G\u27ef \u2115 where\n pow f n := \u27e8(f : N \u2192 G) ^ n, (contMDiff_pow n).comp f.contMDiff\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_smul (L172-L177)\ntheorem lift_smul (k : \ud835\udd5c) : (k \u2022 X).1 = k \u2022 X.1 :=\nrfl\n\nvariable (I G)\n\n/-- The coercion to function is a monoid homomorphism. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_apply (L237-L239)\ntheorem commutator_apply : \u2045X, Y\u2046 f = X (Y f) - Y (X f) :=\nrfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt (L189-L193)\ndef evalAt : LeftInvariantDerivation I G \u2192\u2097[\ud835\udd5c] PointDerivation I g where\n toFun X := Derivation.evalAt g X.1\nmap_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothLeftMul (L186-L192)\ndef smoothLeftMul : C^\u221e\u27eeI, G; I, G\u27ef :=\n\u27e8(g * \u00b7), contMDiff_mul_left\u27e9\n\n/-- Right multiplication by `g`. It is meant to mimic the usual notation in Lie groups.\nUsed mostly through the notation `\ud835\udc79`.\nLemmas involving `smoothRightMul` with the notation `\ud835\udc79` usually use `R` instead of `\ud835\udc79` in the\nnames. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffOn_finset_prod' (L381-L384)\ntheorem contMDiffOn_finset_prod' (h : \u2200 i \u2208 t, CMDiff[s] n (f i)) :\n CMDiff[s] n (\u220f i \u2208 t, f i) :=\nfun x hx \u21a6 contMDiffWithinAt_finset_prod' fun i hi \u21a6 h i hi x hx\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiffAt (L145-L148)\ntheorem ContMDiffAt.inv {f : M \u2192 G} {x\u2080 : M} (hf : CMDiffAt n f x\u2080) :\n CMDiffAt n (fun x \u21a6 (f x)\u207b\u00b9) x\u2080 :=\n(contMDiff_inv I n).contMDiffAt.comp x\u2080 hf\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffWithinAt_finset_prod (L347-L351)\ntheorem contMDiffWithinAt_finset_prod (h : \u2200 i \u2208 t, CMDiffAt[s] n (f i) x) :\n CMDiffAt[s] n (fun x \u21a6 \u220f i \u2208 t, f i x) x := by\nsimp only [\u2190 Finset.prod_apply]\n exact contMDiffWithinAt_finset_prod' h\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.mul_comp (L46-L49)\ntheorem mul_comp {G : Type*} [Mul G] [TopologicalSpace G] [ChartedSpace H' G] [ContMDiffMul I' n G]\n (f g : C^n\u27eeI'', N'; I', G\u27ef) (h : C^n\u27eeI, N; I'', N'\u27ef) : (f * g).comp h = f.comp h * g.comp h :=\nrfl\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiable_mul_left (L162-L164)\ntheorem mdifferentiable_mul_left {a : G} : MDiff (a * \u00b7) :=\ncontMDiff_mul_left.mdifferentiable one_ne_zero\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_finset_prod' (L365-L368)\ntheorem contMDiffAt_finset_prod' (h : \u2200 i \u2208 t, CMDiffAt n (f i) x) :\n CMDiffAt n (\u220f i \u2208 t, f i) x :=\ncontMDiffWithinAt_finset_prod' h\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_mul (L105-L110)\ntheorem contMDiff_mul [ContMDiffMul I n G] : CMDiff n fun p : G \u00d7 G \u21a6 p.1 * p.2 :=\nContMDiffMul.contMDiff_mul\n\ninclude I n in\n/-- If the multiplication is `C^n`, then it is continuous. This is not an instance for technical\nreasons, see note [Design choices about smooth algebraic structures]. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coeFnAddMonoidHom (L179-L183)\ndef coeFnAddMonoidHom : LeftInvariantDerivation I G \u2192+ C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef :=\n\u27e8\u27e8DFunLike.coe, coe_zero\u27e9, coe_add\u27e9\n\nvariable {I G}\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_add (L144-L146)\ntheorem lift_add : (\u2191(X + Y) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = X + Y :=\nrfl\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.Prod (L184-L196)\ninstance Prod.instLieGroup {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {n : WithTop \u2115\u221e}\n {H : Type*} [TopologicalSpace H] {E : Type*}\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] {I : ModelWithCorners \ud835\udd5c E H} {G : Type*}\n [TopologicalSpace G] [ChartedSpace H G] [Group G] [LieGroup I n G] {E' : Type*}\n [NormedAddCommGroup E'] [NormedSpace \ud835\udd5c E'] {H' : Type*} [TopologicalSpace H']\n {I' : ModelWithCorners \ud835\udd5c E' H'} {G' : Type*} [TopologicalSpace G'] [ChartedSpace H' G']\n [Group G'] [LieGroup I' n G'] : LieGroup (I.prod I') n (G \u00d7 G') :=\n{ ContMDiffMul.prod _ _ _ _ with contMDiff_inv := contMDiff_fst.inv.prodMk contMDiff_snd.inv }\n\nend Product\n\n/-! ### Normed spaces are Lie groups -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.L_apply (L205-L207)\ntheorem L_apply : (\ud835\udc73 I g) h = g * h :=\nrfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_finprod (L359-L363)\ntheorem contMDiffAt_finprod\n (lf : LocallyFinite fun i \u21a6 mulSupport <| f i) (h : \u2200 i, CMDiffAt n (f i) x\u2080) :\n CMDiffAt n (fun x \u21a6 \u220f\u1da0 i, f i x) x\u2080 :=\ncontMDiffWithinAt_finprod lf h\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiff (L154-L156)\ntheorem ContMDiff.inv {f : M \u2192 G} (hf : CMDiff n f) : CMDiff n fun x \u21a6 (f x)\u207b\u00b9 :=\nfun x \u21a6 (hf x).inv\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.coe_one (L56-L59)\ntheorem coe_one {G : Type*} [One G] [TopologicalSpace G] [ChartedSpace H' G] :\n \u21d1(1 : C^n\u27eeI, N; I', G\u27ef) = 1 :=\nrfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffOn_finset_prod (L386-L389)\ntheorem contMDiffOn_finset_prod (h : \u2200 i \u2208 t, CMDiff[s] n (f i)) :\n CMDiff[s] n (fun x \u21a6 \u220f i \u2208 t, f i x) :=\nfun x hx \u21a6 contMDiffWithinAt_finset_prod fun i hi \u21a6 h i hi x hx\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiableAt_mul_right (L174-L176)\ntheorem mdifferentiableAt_mul_right {a b : G} : MDiffAt (\u00b7 * a) b :=\ncontMDiffAt_mul_right.mdifferentiableAt one_ne_zero\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.leibniz (L107-L109)\ntheorem leibniz : X (f * f') = f \u2022 X f' + f' \u2022 X f :=\nX.leibniz' _ _\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.contMDiffOn_inv\u2080 (L268-L272)\ntheorem contMDiffOn_inv\u2080 : CMDiff[{0}\u1d9c] n (Inv.inv : G \u2192 G) :=\nfun _x hx \u21a6 (contMDiffAt_inv\u2080 hx).contMDiffWithinAt\n\nvariable {s : Set M} {a : M}\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finprod (L405-L408)\ntheorem contMDiff_finprod (h : \u2200 i, CMDiff n (f i))\n (hfin : LocallyFinite fun i \u21a6 mulSupport (f i)) : CMDiff n fun x \u21a6 \u220f\u1da0 i, f i x :=\nfun x \u21a6 contMDiffAt_finprod hfin fun i \u21a6 h i x\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.continuousInv\u2080_of_contMDiffInv\u2080 (L265-L267)\ntheorem continuousInv\u2080_of_contMDiffInv\u2080 : ContinuousInv\u2080 G :=\n{ continuousAt_inv\u2080 := fun _ hx \u21a6 (contMDiffAt_inv\u2080 (I := I) (n := n) hx).continuousAt }\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothLeftMul_one (L229-L231)\ntheorem smoothLeftMul_one : (\ud835\udc73 I g') 1 = g' :=\nmul_one g'\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.contMDiffAt_inv\u2080 (L258-L264)\ntheorem contMDiffAt_inv\u2080 {x : G} (hx : x \u2260 0) : ContMDiffAt I I n (fun y \u21a6 y\u207b\u00b9) x :=\nContMDiffInv\u2080.contMDiffAt_inv\u2080 hx\n\ninclude I n in\n/-- In a manifold with `C^n` inverse away from `0`, the inverse is continuous away from `0`.\nThis is not an instance for technical reasons, see\nnote [Design choices about smooth algebraic structures]. -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_mul_left (L140-L142)\ntheorem contMDiff_mul_left {a : G} : CMDiff n (a * \u00b7) :=\ncontMDiff_const.mul contMDiff_id\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.instContMDiffAddSelf (L445-L449)\ninstance instContMDiffAddSelf : ContMDiffAdd \ud835\udcd8(\ud835\udd5c, E) n E := by\nconstructor\n rw [\u2190 modelWithCornersSelf_prod, chartedSpaceSelf_prod]\n exact contDiff_add.contMDiff\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_mul_right (L152-L154)\ntheorem contMDiffAt_mul_right {a b : G} : CMDiffAt n (\u00b7 * a) b :=\ncontMDiff_mul_right.contMDiffAt\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.semigroup (L82-L85)\ninstance semigroup {G : Type*} [Semigroup G] [TopologicalSpace G] [ChartedSpace H' G]\n [ContMDiffMul I' n G] : Semigroup C^n\u27eeI, N; I', G\u27ef :=\nDFunLike.coe_injective.semigroup _ coe_mul\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _) :=\nfun X Y h => by cases X; cases Y; congr\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffAt (L353-L357)\ntheorem ContMDiffAt.prod (h : \u2200 i \u2208 t, CMDiffAt n (f i) x\u2080) :\n CMDiffAt n (fun x \u21a6 \u220f i \u2208 t, f i x) x\u2080 := by\nsimp only [\u2190 contMDiffWithinAt_univ] at *\n exact ContMDiffWithinAt.prod h\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiable_mul_right (L170-L172)\ntheorem mdifferentiable_mul_right {a : G} : MDiff (\u00b7 * a) :=\ncontMDiff_mul_right.mdifferentiable one_ne_zero\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothRightMul (L193-L196)\ndef smoothRightMul : C^\u221e\u27eeI, G; I, G\u27ef :=\n\u27e8(\u00b7 * g), contMDiff_mul_right\u27e9\n\n-- Left multiplication. The abbreviation is `MIL`.\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.comp_L (L212-L216)\ntheorem comp_L : (X f).comp (\ud835\udc73 I g) = X (f.comp (\ud835\udc73 I g)) := by\next h\n rw [ContMDiffMap.comp_apply, L_apply, \u2190 evalAt_apply, evalAt_mul, hfdifferential_apply,\n fdifferential_apply, evalAt_apply]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiffWithinAt (L140-L143)\ntheorem ContMDiffWithinAt.inv {f : M \u2192 G} {s : Set M} {x\u2080 : M}\n (hf : CMDiffAt[s] n f x\u2080) : CMDiffAt[s] n (fun x \u21a6 (f x)\u207b\u00b9) x\u2080 :=\n(contMDiff_inv I n).contMDiffAt.contMDiffWithinAt.comp x\u2080 hf <| Set.mapsTo_univ _ _\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.R_apply (L209-L211)\ntheorem R_apply : (\ud835\udc79 I g) h = h * g :=\nrfl\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiffOn (L150-L152)\ntheorem ContMDiffOn.inv {f : M \u2192 G} {s : Set M} (hf : CMDiff[s] n f) :\n CMDiff[s] n (fun x \u21a6 (f x)\u207b\u00b9) := fun x hx \u21a6 (hf x hx).inv\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n\n/-- Premature version of the lemma. Prefer using `left_invariant` instead. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_coe_derivation (L231-L236)\ntheorem commutator_coe_derivation :\n \u21d1\u2045X, Y\u2046 =\n (\u2045(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef), Y\u2046 :\n Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.L_mul (L213-L217)\ntheorem L_mul {G : Type*} [Semigroup G] [TopologicalSpace G] [ChartedSpace H G] [ContMDiffMul I \u221e G]\n (g h : G) : \ud835\udc73 I (g * h) = (\ud835\udc73 I g).comp (\ud835\udc73 I h) := by\next\n simp only [ContMDiffMap.comp_apply, L_apply, mul_assoc]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.R_mul (L219-L223)\ntheorem R_mul {G : Type*} [Semigroup G] [TopologicalSpace G] [ChartedSpace H G] [ContMDiffMul I \u221e G]\n (g h : G) : \ud835\udc79 I (g * h) = (\ud835\udc79 I h).comp (\ud835\udc79 I g) := by\next\n simp only [ContMDiffMap.comp_apply, R_apply, mul_assoc]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasNatScalar (L152-L154)\ninstance hasNatScalar : SMul \u2115 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_neg (L136-L138)\ntheorem coe_neg : \u21d1(-X) = -X :=\nrfl\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_zero (L132-L134)\ntheorem coe_zero : \u21d1(0 : LeftInvariantDerivation I G) = 0 :=\nrfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffOn (L132-L134)\ntheorem ContMDiffOn.mul (hf : CMDiff[s] n f) (hg : CMDiff[s] n g) : CMDiff[s] n (f * g) :=\nfun x hx \u21a6 (hf x hx).mul (hg x hx)\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffMul (L239-L260)\ninstance ContMDiffMul.prod {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {E : Type*}\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] {H : Type*} [TopologicalSpace H]\n (I : ModelWithCorners \ud835\udd5c E H) (G : Type*) [TopologicalSpace G] [ChartedSpace H G] [Mul G]\n [ContMDiffMul I n G] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace \ud835\udd5c E'] {H' : Type*}\n [TopologicalSpace H'] (I' : ModelWithCorners \ud835\udd5c E' H') (G' : Type*) [TopologicalSpace G']\n [ChartedSpace H' G'] [Mul G'] [ContMDiffMul I' n G'] : ContMDiffMul (I.prod I') n (G \u00d7 G') :=\n{ IsManifold.prod G G' with\n contMDiff_mul :=\n ((contMDiff_fst.comp contMDiff_fst).mul (contMDiff_fst.comp contMDiff_snd)).prodMk\n ((contMDiff_snd.comp contMDiff_fst).mul (contMDiff_snd.comp contMDiff_snd)) }\n\nend ContMDiffMul\n\nsection Monoid\n\nvariable {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {n : WithTop \u2115\u221e}\n {H : Type*} [TopologicalSpace H] {E : Type*}\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] {I : ModelWithCorners \ud835\udd5c E H} {G : Type*} [Monoid G]\n [TopologicalSpace G] [ChartedSpace H G] [ContMDiffMul I n G] {H' : Type*} [TopologicalSpace H']\n {E' : Type*} [NormedAddCommGroup E'] [NormedSpace \ud835\udd5c E'] {I' : ModelWithCorners \ud835\udd5c E' H'}\n {G' : Type*} [Monoid G'] [TopologicalSpace G'] [ChartedSpace H' G'] [ContMDiffMul I' n G']\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffWithinAt_finset_prod' (L341-L345)\ntheorem contMDiffWithinAt_finset_prod' (h : \u2200 i \u2208 t, CMDiffAt[s] n (f i) x) :\n CMDiffAt[s] n (\u220f i \u2208 t, f i) x :=\nFinset.prod_induction f (fun f \u21a6 CMDiffAt[s] n f x) (fun _ _ hf hg \u21a6 hf.mul hg)\n (contMDiffWithinAt_const (c := 1)) h\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasIntScalar (L155-L157)\ninstance hasIntScalar : SMul \u2124 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finset_prod (L400-L403)\ntheorem contMDiff_finset_prod (h : \u2200 i \u2208 t, CMDiff n (f i)) :\n CMDiff n fun x \u21a6 \u220f i \u2208 t, f i x :=\nfun x \u21a6 contMDiffAt_finset_prod fun i hi \u21a6 h i hi x\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.topologicalGroup_of_lieGroup (L134-L136)\ntheorem topologicalGroup_of_lieGroup : IsTopologicalGroup G :=\n{ continuousMul_of_contMDiffMul I n with continuous_inv := (contMDiff_inv I n).continuous }\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_apply (L194-L196)\ntheorem evalAt_apply : evalAt g X f = (X f) g :=\nrfl\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant (L201-L204)\ntheorem left_invariant : \ud835\udc85\u2095 (smoothLeftMul_one I g) (evalAt (1 : G) X) = evalAt g X :=\nX.left_invariant'' g\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_coe (L198-L200)\ntheorem evalAt_coe : Derivation.evalAt g \u2191X = evalAt g X :=\nrfl\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.coe_pow (L67-L80)\ntheorem coe_pow {G : Type*} [Monoid G] [TopologicalSpace G] [ChartedSpace H' G]\n [ContMDiffMul I' n G] (f : C^n\u27eeI, N; I', G\u27ef) (n : \u2115) :\n \u21d1(f ^ n) = (f : N \u2192 G) ^ n :=\nrfl\n\nsection GroupStructure\n\n/-!\n### Group structure\n\nIn this section we show that `C^n` functions valued in a Lie group inherit a group structure\nunder pointwise multiplication.\n-/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_smul (L168-L170)\ntheorem coe_smul : \u21d1(r \u2022 X) = r \u2022 \u21d1X :=\nrfl\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y := DFunLike.ext _ _ h\nvariable (X Y f)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffWithinAt_finprod (L333-L339)\ntheorem contMDiffWithinAt_finprod (lf : LocallyFinite fun i \u21a6 mulSupport <| f i) {x\u2080 : M}\n (h : \u2200 i, CMDiffAt[s] n (f i) x\u2080) :\n CMDiffAt[s] n (fun x \u21a6 \u220f\u1da0 i, f i x) x\u2080 :=\nlet \u27e8_I, hI\u27e9 := finprod_eventually_eq_prod lf x\u2080\n (ContMDiffWithinAt.prod fun i _hi \u21a6 h i).congr_of_eventuallyEq\n (eventually_nhdsWithin_of_eventually_nhds hI) hI.self_of_nhds\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_mul_right (L148-L150)\ntheorem contMDiff_mul_right {a : G} : CMDiff n (\u00b7 * a) :=\ncontMDiff_id.mul contMDiff_const\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffWithinAt (L123-L126)\ntheorem ContMDiffWithinAt.mul (hf : CMDiffAt[s] n f x) (hg : CMDiffAt[s] n g x) :\n CMDiffAt[s] n (f * g) x :=\n(contMDiff_mul I n).contMDiffAt.comp_contMDiffWithinAt x (hf.prodMk hg)\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_finset_prod (L370-L373)\ntheorem contMDiffAt_finset_prod (h : \u2200 i \u2208 t, CMDiffAt n (f i) x) :\n CMDiffAt n (fun x \u21a6 \u220f i \u2208 t, f i x) x :=\ncontMDiffWithinAt_finset_prod h\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X :=\nleft_invariant'' X g\n\nprotected theorem map_add : X (f + f') = X f + X f' := by simp\n\nprotected theorem map_zero : X 0 = 0 := by simp\n\nprotected theorem map_neg : X (-f) = -X f := by simp\n\nprotected theorem map_sub : X (f - f') = X f - X f' := by simp\n\nprotected theorem map_smul : X (r \u2022 f) = r \u2022 X f := by simp\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_mul (L205-L211)\ntheorem evalAt_mul : evalAt (g * h) X = \ud835\udc85\u2095 (L_apply I g h) (evalAt h X) := by\next f\n rw [\u2190 left_invariant, hfdifferential_apply, hfdifferential_apply, L_mul, fdifferential_comp,\n fdifferential_apply]\n simp only [ContMDiffMap.comp_apply, LinearMap.comp_apply]\n rw [fdifferential_apply, \u2190 hfdifferential_apply (smoothLeftMul_one I h), left_invariant]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.continuousMul_of_contMDiffMul (L113-L115)\ntheorem continuousMul_of_contMDiffMul [ContMDiffMul I n G] : ContinuousMul G :=\n\u27e8(contMDiff_mul I n).continuous\u27e9\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe :=\nDFunLike.coe_injective\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finprod_cond (L410-L417)\ntheorem contMDiff_finprod_cond (hc : \u2200 i, p i \u2192 CMDiff n (f i))\n (hf : LocallyFinite fun i \u21a6 mulSupport (f i)) :\n CMDiff n fun x \u21a6 \u220f\u1da0 (i) (_ : p i), f i x := by\nsimp only [\u2190 finprod_subtype_eq_finprod_cond]\n exact contMDiff_finprod (fun i \u21a6 hc i i.2) (hf.comp_injective Subtype.coe_injective)\n\nvariable {g : M \u2192 G}\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.contMDiff_inv (L126-L131)\ntheorem contMDiff_inv : CMDiff n fun x : G \u21a6 x\u207b\u00b9 :=\nLieGroup.contMDiff_inv\n\ninclude I n in\n/-- A Lie group is a topological group. This is not an instance for technical reasons,\nsee note [Design choices about smooth algebraic structures]. -/\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_add (L128-L130)\ntheorem coe_add : \u21d1(X + Y) = X + Y :=\nrfl\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.IsManifold.ExtChartAt).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem extChartAt_target_subset_range (x : M) : (extChartAt I x).target \u2286 range I\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend (L75-L77)\ndef extend : PartialEquiv M E :=\nf.toPartialEquiv \u226b I.toPartialEquiv\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe (L78-L80)\ntheorem extend_coe : \u21d1(f.extend I) = I \u2218 f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_coe_symm (L81-L83)\ntheorem extend_coe_symm : \u21d1(f.extend I).symm = f.symm \u2218 I.symm :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source (L84-L86)\ntheorem extend_source : (f.extend I).source = f.source := by\nrw [extend, PartialEquiv.trans_source, I.source_eq, preimage_univ, inter_univ]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_source (L87-L90)\ntheorem isOpen_extend_source : IsOpen (f.extend I).source := by\nrw [extend_source]\n exact f.open_source\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target (L91-L93)\ntheorem extend_target : (f.extend I).target = I.symm \u207b\u00b9' f.target \u2229 range I := by\nsimp_rw [extend, PartialEquiv.trans_target, I.target_eq, I.toPartialEquiv_coe_symm, inter_comm]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target' (L94-L96)\ntheorem extend_target' : (f.extend I).target = I '' f.target := by\nrw [extend, PartialEquiv.trans_target'', I.source_eq, univ_inter, I.toPartialEquiv_coe]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_eq_image_source (L97-L99)\ntheorem extend_target_eq_image_source : (f.extend I).target = (f.extend I) '' f.source := by\nrw [f.extend_target', \u2190 f.image_source_eq_target, \u2190 image_comp, f.extend_coe]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.isOpen_extend_target (L100-L103)\nlemma isOpen_extend_target [I.Boundaryless] : IsOpen (f.extend I).target := by\nrw [extend_target, I.range_eq_univ, inter_univ]\n exact I.continuous_symm.isOpen_preimage _ f.open_target\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.mapsTo_extend (L104-L109)\ntheorem mapsTo_extend (hs : s \u2286 f.source) :\n MapsTo (f.extend I) s ((f.extend I).symm \u207b\u00b9' s \u2229 range I) := by\nrw [mapsTo_iff_image_subset, extend_coe, extend_coe_symm, preimage_comp, \u2190 I.image_eq, image_comp,\n f.image_eq_target_inter_inv_preimage hs]\n exact image_mono inter_subset_right\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv (L110-L113)\ntheorem extend_left_inv {x : M} (hxf : x \u2208 f.source) : (f.extend I).symm (f.extend I x) = x :=\n(f.extend I).left_inv <| by rwa [f.extend_source]\n\n/-- Variant of `f.extend_left_inv I`, stated in terms of images. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_left_inv' (L114-L116)\nlemma extend_left_inv' (ht : t \u2286 f.source) : ((f.extend I).symm \u2218 (f.extend I)) '' t = t :=\nEqOn.image_eq_self (fun _ hx \u21a6 f.extend_left_inv (ht hx))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhds (L117-L119)\ntheorem extend_source_mem_nhds {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd x :=\n(isOpen_extend_source f).mem_nhds <| by rwa [f.extend_source]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_source_mem_nhdsWithin (L120-L122)\ntheorem extend_source_mem_nhdsWithin {x : M} (h : x \u2208 f.source) : (f.extend I).source \u2208 \ud835\udcdd[s] x :=\nmem_nhdsWithin_of_mem_nhds <| extend_source_mem_nhds f h\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.continuousOn_extend (L123-L127)\ntheorem continuousOn_extend : ContinuousOn (f.extend I) (f.extend I).source := by\nrefine I.continuous.comp_continuousOn ?_\n rw [extend_source]\n exact f.continuousOn\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.continuousAt_extend (L128-L130)\ntheorem continuousAt_extend {x : M} (h : x \u2208 f.source) : ContinuousAt (f.extend I) x :=\n(continuousOn_extend f).continuousAt <| extend_source_mem_nhds f h\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.map_extend_nhds (L131-L134)\ntheorem map_extend_nhds {x : M} (hy : x \u2208 f.source) :\n map (f.extend I) (\ud835\udcdd x) = \ud835\udcdd[range I] f.extend I x := by\nrwa [extend_coe, comp_apply, \u2190 I.map_nhds_eq, \u2190 f.map_nhds_eq, map_map]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.map_extend_nhds_of_mem_interior_range (L135-L140)\ntheorem map_extend_nhds_of_mem_interior_range {x : M} (hx : x \u2208 f.source)\n (h'x : f.extend I x \u2208 interior (range I)) :\n map (f.extend I) (\ud835\udcdd x) = \ud835\udcdd (f.extend I x) := by\nrw [f.map_extend_nhds hx, nhdsWithin_eq_nhds]\n exact mem_of_superset (isOpen_interior.mem_nhds h'x) interior_subset\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.map_extend_nhds_of_boundaryless (L141-L144)\ntheorem map_extend_nhds_of_boundaryless [I.Boundaryless] {x : M} (hx : x \u2208 f.source) :\n map (f.extend I) (\ud835\udcdd x) = \ud835\udcdd (f.extend I x) := by\nrw [f.map_extend_nhds hx, I.range_eq_univ, nhdsWithin_univ]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_mem_nhdsWithin (L145-L149)\ntheorem extend_target_mem_nhdsWithin {y : M} (hy : y \u2208 f.source) :\n (f.extend I).target \u2208 \ud835\udcdd[range I] f.extend I y := by\nrw [\u2190 PartialEquiv.image_source_eq_target, \u2190 map_extend_nhds f hy]\n exact image_mem_map (extend_source_mem_nhds _ hy)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_image_target_mem_nhds (L150-L155)\nlemma extend_image_target_mem_nhds {x : M} (hx : x \u2208 f.source) :\n I '' f.target \u2208 \ud835\udcdd[range I] (f.extend I) x := by\nrw [\u2190 f.map_extend_nhds hx, Filter.mem_map,\n f.extend_coe, Set.preimage_comp, I.preimage_image f.target]\n exact (f.continuousAt hx).preimage_mem_nhds (f.open_target.mem_nhds (f.map_source hx))\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_image_nhds_mem_nhds_of_boundaryless (L156-L160)\ntheorem extend_image_nhds_mem_nhds_of_boundaryless [I.Boundaryless] {x} (hx : x \u2208 f.source)\n {s : Set M} (h : s \u2208 \ud835\udcdd x) : (f.extend I) '' s \u2208 \ud835\udcdd ((f.extend I) x) := by\nrw [\u2190 f.map_extend_nhds_of_boundaryless hx, Filter.mem_map]\n filter_upwards [h] using subset_preimage_image (f.extend I) s\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_image_nhds_mem_nhds_of_mem_interior_range (L161-L166)\ntheorem extend_image_nhds_mem_nhds_of_mem_interior_range {x} (hx : x \u2208 f.source)\n (h'x : f.extend I x \u2208 interior (range I)) {s : Set M} (h : s \u2208 \ud835\udcdd x) :\n (f.extend I) '' s \u2208 \ud835\udcdd ((f.extend I) x) := by\nrw [\u2190 f.map_extend_nhds_of_mem_interior_range hx h'x, Filter.mem_map]\n filter_upwards [h] using subset_preimage_image (f.extend I) s\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extend_target_subset_range (L167-L168)\ntheorem extend_target_subset_range : (f.extend I).target \u2286 range I := by simp only [mfld_simps]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.interior_extend_target_subset_interior_range (L169-L175)\nlemma interior_extend_target_subset_interior_range :\n interior (f.extend I).target \u2286 interior (range I) := by\nrw [f.extend_target, interior_inter, (f.open_target.preimage I.continuous_symm).interior_eq]\n exact inter_subset_right\n\n/-- If `y \u2208 f.target` and `I y \u2208 interior (range I)`,\nthen `I y` is an interior point of `(I \u2218 f).target`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_mul_left (L144-L146)\ntheorem contMDiffAt_mul_left {a b : G} : CMDiffAt n (a * \u00b7) b :=\ncontMDiff_mul_left.contMDiffAt\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiableAt_mul_left (L166-L168)\ntheorem mdifferentiableAt_mul_left {a b : G} : MDiffAt (a * \u00b7) b :=\ncontMDiffAt_mul_left.mdifferentiableAt one_ne_zero\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffOn_finprod (L375-L379)\ntheorem contMDiffOn_finprod\n (lf : LocallyFinite fun i \u21a6 Function.mulSupport <| f i) (h : \u2200 i, CMDiff[s] n (f i)) :\n CMDiff[s] n (fun x \u21a6 \u220f\u1da0 i, f i x) := fun x hx \u21a6\ncontMDiffWithinAt_finprod lf fun i \u21a6 h i x hx\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toFun_eq_coe (L75-L77)\ntheorem toFun_eq_coe : X.toFun = \u21d1X :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.coe_mul (L41-L44)\ntheorem coe_mul {G : Type*} [Mul G] [TopologicalSpace G] [ChartedSpace H' G] [ContMDiffMul I' n G]\n (f g : C^n\u27eeI, N; I', G\u27ef) : \u21d1(f * g) = f * g :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finset_prod' (L396-L398)\ntheorem contMDiff_finset_prod' (h : \u2200 i \u2208 t, CMDiff n (f i)) :\n CMDiff n (\u220f i \u2208 t, f i) := fun x \u21a6 contMDiffAt_finset_prod' fun i hi \u21a6 h i hi x\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_sub (L140-L142)\ntheorem coe_sub : \u21d1(X - Y) = X - Y :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothRightMul_one (L232-L234)\ntheorem smoothRightMul_one : (\ud835\udc79 I g') 1 = g' :=\none_mul g'\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_zero (L148-L151)\ntheorem lift_zero :\n (\u2191(0 : LeftInvariantDerivation I G) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = 0 :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.instNormedSpaceLieAddGroup (L197-L217)\ninstance instNormedSpaceLieAddGroup {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {n : WithTop \u2115\u221e}\n {E : Type*} [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] : LieAddGroup \ud835\udcd8(\ud835\udd5c, E) n E where\n contMDiff_neg := contDiff_neg.contMDiff\n/-! ## `C^n` manifolds with `C^n` inversion away from zero\n\nTypeclass for `C^n` manifolds with `0` and `Inv` such that inversion is `C^n` at all non-zero\npoints. (This includes multiplicative Lie groups, but also complete normed semifields.)\nPoint-wise inversion is `C^n` when the function/denominator is non-zero. -/\nsection ContMDiffInv\u2080\n\n-- See note [Design choices about smooth algebraic structures]\n/-- A `C^n` manifold with `0` and `Inv` such that `fun x \u21a6 x\u207b\u00b9` is `C^n` at all nonzero points.\nAny complete normed (semi)field has this property. -/\nclass ContMDiffInv\u2080 {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {H : Type*} [TopologicalSpace H]\n {E : Type*} [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] (I : ModelWithCorners \ud835\udd5c E H)\n (n : WithTop \u2115\u221e) (G : Type*)\n [Inv G] [Zero G] [TopologicalSpace G] [ChartedSpace H G] : Prop where\n /-- Inversion is `C^n` away from `0`. -/\n contMDiffAt_inv\u2080 : \u2200 \u2983x : G\u2984, x \u2260 0 \u2192 CMDiffAt n (fun (y : G) \u21a6 y\u207b\u00b9) x\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiff (L136-L138)\ntheorem ContMDiff.mul (hf : CMDiff n f) (hg : CMDiff n g) : CMDiff n (f * g) :=\nfun x \u21a6 (hf x).mul (hg x)\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.instPow (L61-L65)\ninstance instPow {G : Type*} [Monoid G] [TopologicalSpace G] [ChartedSpace H' G]\n [ContMDiffMul I' n G] :\n Pow C^n\u27eeI, N; I', G\u27ef \u2115 where\n pow f n := \u27e8(f : N \u2192 G) ^ n, (contMDiff_pow n).comp f.contMDiff\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_smul (L172-L177)\ntheorem lift_smul (k : \ud835\udd5c) : (k \u2022 X).1 = k \u2022 X.1 :=\nrfl\n\nvariable (I G)\n\n/-- The coercion to function is a monoid homomorphism. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_apply (L237-L239)\ntheorem commutator_apply : \u2045X, Y\u2046 f = X (Y f) - Y (X f) :=\nrfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt (L189-L193)\ndef evalAt : LeftInvariantDerivation I G \u2192\u2097[\ud835\udd5c] PointDerivation I g where\n toFun X := Derivation.evalAt g X.1\nmap_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothLeftMul (L186-L192)\ndef smoothLeftMul : C^\u221e\u27eeI, G; I, G\u27ef :=\n\u27e8(g * \u00b7), contMDiff_mul_left\u27e9\n\n/-- Right multiplication by `g`. It is meant to mimic the usual notation in Lie groups.\nUsed mostly through the notation `\ud835\udc79`.\nLemmas involving `smoothRightMul` with the notation `\ud835\udc79` usually use `R` instead of `\ud835\udc79` in the\nnames. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffOn_finset_prod' (L381-L384)\ntheorem contMDiffOn_finset_prod' (h : \u2200 i \u2208 t, CMDiff[s] n (f i)) :\n CMDiff[s] n (\u220f i \u2208 t, f i) :=\nfun x hx \u21a6 contMDiffWithinAt_finset_prod' fun i hi \u21a6 h i hi x hx\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiffAt (L145-L148)\ntheorem ContMDiffAt.inv {f : M \u2192 G} {x\u2080 : M} (hf : CMDiffAt n f x\u2080) :\n CMDiffAt n (fun x \u21a6 (f x)\u207b\u00b9) x\u2080 :=\n(contMDiff_inv I n).contMDiffAt.comp x\u2080 hf\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffWithinAt_finset_prod (L347-L351)\ntheorem contMDiffWithinAt_finset_prod (h : \u2200 i \u2208 t, CMDiffAt[s] n (f i) x) :\n CMDiffAt[s] n (fun x \u21a6 \u220f i \u2208 t, f i x) x := by\nsimp only [\u2190 Finset.prod_apply]\n exact contMDiffWithinAt_finset_prod' h\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.mul_comp (L46-L49)\ntheorem mul_comp {G : Type*} [Mul G] [TopologicalSpace G] [ChartedSpace H' G] [ContMDiffMul I' n G]\n (f g : C^n\u27eeI'', N'; I', G\u27ef) (h : C^n\u27eeI, N; I'', N'\u27ef) : (f * g).comp h = f.comp h * g.comp h :=\nrfl\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiable_mul_left (L162-L164)\ntheorem mdifferentiable_mul_left {a : G} : MDiff (a * \u00b7) :=\ncontMDiff_mul_left.mdifferentiable one_ne_zero\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_finset_prod' (L365-L368)\ntheorem contMDiffAt_finset_prod' (h : \u2200 i \u2208 t, CMDiffAt n (f i) x) :\n CMDiffAt n (\u220f i \u2208 t, f i) x :=\ncontMDiffWithinAt_finset_prod' h\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_mul (L105-L110)\ntheorem contMDiff_mul [ContMDiffMul I n G] : CMDiff n fun p : G \u00d7 G \u21a6 p.1 * p.2 :=\nContMDiffMul.contMDiff_mul\n\ninclude I n in\n/-- If the multiplication is `C^n`, then it is continuous. This is not an instance for technical\nreasons, see note [Design choices about smooth algebraic structures]. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coeFnAddMonoidHom (L179-L183)\ndef coeFnAddMonoidHom : LeftInvariantDerivation I G \u2192+ C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef :=\n\u27e8\u27e8DFunLike.coe, coe_zero\u27e9, coe_add\u27e9\n\nvariable {I G}\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.lift_add (L144-L146)\ntheorem lift_add : (\u2191(X + Y) : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = X + Y :=\nrfl\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.Prod (L184-L196)\ninstance Prod.instLieGroup {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {n : WithTop \u2115\u221e}\n {H : Type*} [TopologicalSpace H] {E : Type*}\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] {I : ModelWithCorners \ud835\udd5c E H} {G : Type*}\n [TopologicalSpace G] [ChartedSpace H G] [Group G] [LieGroup I n G] {E' : Type*}\n [NormedAddCommGroup E'] [NormedSpace \ud835\udd5c E'] {H' : Type*} [TopologicalSpace H']\n {I' : ModelWithCorners \ud835\udd5c E' H'} {G' : Type*} [TopologicalSpace G'] [ChartedSpace H' G']\n [Group G'] [LieGroup I' n G'] : LieGroup (I.prod I') n (G \u00d7 G') :=\n{ ContMDiffMul.prod _ _ _ _ with contMDiff_inv := contMDiff_fst.inv.prodMk contMDiff_snd.inv }\n\nend Product\n\n/-! ### Normed spaces are Lie groups -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.L_apply (L205-L207)\ntheorem L_apply : (\ud835\udc73 I g) h = g * h :=\nrfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_finprod (L359-L363)\ntheorem contMDiffAt_finprod\n (lf : LocallyFinite fun i \u21a6 mulSupport <| f i) (h : \u2200 i, CMDiffAt n (f i) x\u2080) :\n CMDiffAt n (fun x \u21a6 \u220f\u1da0 i, f i x) x\u2080 :=\ncontMDiffWithinAt_finprod lf h\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiff (L154-L156)\ntheorem ContMDiff.inv {f : M \u2192 G} (hf : CMDiff n f) : CMDiff n fun x \u21a6 (f x)\u207b\u00b9 :=\nfun x \u21a6 (hf x).inv\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.coe_one (L56-L59)\ntheorem coe_one {G : Type*} [One G] [TopologicalSpace G] [ChartedSpace H' G] :\n \u21d1(1 : C^n\u27eeI, N; I', G\u27ef) = 1 :=\nrfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffOn_finset_prod (L386-L389)\ntheorem contMDiffOn_finset_prod (h : \u2200 i \u2208 t, CMDiff[s] n (f i)) :\n CMDiff[s] n (fun x \u21a6 \u220f i \u2208 t, f i x) :=\nfun x hx \u21a6 contMDiffWithinAt_finset_prod fun i hi \u21a6 h i hi x hx\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiableAt_mul_right (L174-L176)\ntheorem mdifferentiableAt_mul_right {a b : G} : MDiffAt (\u00b7 * a) b :=\ncontMDiffAt_mul_right.mdifferentiableAt one_ne_zero\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.leibniz (L107-L109)\ntheorem leibniz : X (f * f') = f \u2022 X f' + f' \u2022 X f :=\nX.leibniz' _ _\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.contMDiffOn_inv\u2080 (L268-L272)\ntheorem contMDiffOn_inv\u2080 : CMDiff[{0}\u1d9c] n (Inv.inv : G \u2192 G) :=\nfun _x hx \u21a6 (contMDiffAt_inv\u2080 hx).contMDiffWithinAt\n\nvariable {s : Set M} {a : M}\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finprod (L405-L408)\ntheorem contMDiff_finprod (h : \u2200 i, CMDiff n (f i))\n (hfin : LocallyFinite fun i \u21a6 mulSupport (f i)) : CMDiff n fun x \u21a6 \u220f\u1da0 i, f i x :=\nfun x \u21a6 contMDiffAt_finprod hfin fun i \u21a6 h i x\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.continuousInv\u2080_of_contMDiffInv\u2080 (L265-L267)\ntheorem continuousInv\u2080_of_contMDiffInv\u2080 : ContinuousInv\u2080 G :=\n{ continuousAt_inv\u2080 := fun _ hx \u21a6 (contMDiffAt_inv\u2080 (I := I) (n := n) hx).continuousAt }\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothLeftMul_one (L229-L231)\ntheorem smoothLeftMul_one : (\ud835\udc73 I g') 1 = g' :=\nmul_one g'\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.contMDiffAt_inv\u2080 (L258-L264)\ntheorem contMDiffAt_inv\u2080 {x : G} (hx : x \u2260 0) : ContMDiffAt I I n (fun y \u21a6 y\u207b\u00b9) x :=\nContMDiffInv\u2080.contMDiffAt_inv\u2080 hx\n\ninclude I n in\n/-- In a manifold with `C^n` inverse away from `0`, the inverse is continuous away from `0`.\nThis is not an instance for technical reasons, see\nnote [Design choices about smooth algebraic structures]. -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_mul_left (L140-L142)\ntheorem contMDiff_mul_left {a : G} : CMDiff n (a * \u00b7) :=\ncontMDiff_const.mul contMDiff_id\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.instContMDiffAddSelf (L445-L449)\ninstance instContMDiffAddSelf : ContMDiffAdd \ud835\udcd8(\ud835\udd5c, E) n E := by\nconstructor\n rw [\u2190 modelWithCornersSelf_prod, chartedSpaceSelf_prod]\n exact contDiff_add.contMDiff\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_mul_right (L152-L154)\ntheorem contMDiffAt_mul_right {a b : G} : CMDiffAt n (\u00b7 * a) b :=\ncontMDiff_mul_right.contMDiffAt\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.semigroup (L82-L85)\ninstance semigroup {G : Type*} [Semigroup G] [TopologicalSpace G] [ChartedSpace H' G]\n [ContMDiffMul I' n G] : Semigroup C^n\u27eeI, N; I', G\u27ef :=\nDFunLike.coe_injective.semigroup _ coe_mul\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.toDerivation_injective (L61-L64)\ntheorem toDerivation_injective :\n Function.Injective (toDerivation : LeftInvariantDerivation I G \u2192 _) :=\nfun X Y h => by cases X; cases Y; congr\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffAt (L353-L357)\ntheorem ContMDiffAt.prod (h : \u2200 i \u2208 t, CMDiffAt n (f i) x\u2080) :\n CMDiffAt n (fun x \u21a6 \u220f i \u2208 t, f i x) x\u2080 := by\nsimp only [\u2190 contMDiffWithinAt_univ] at *\n exact ContMDiffWithinAt.prod h\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.mdifferentiable_mul_right (L170-L172)\ntheorem mdifferentiable_mul_right {a : G} : MDiff (\u00b7 * a) :=\ncontMDiff_mul_right.mdifferentiable one_ne_zero\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.smoothRightMul (L193-L196)\ndef smoothRightMul : C^\u221e\u27eeI, G; I, G\u27ef :=\n\u27e8(\u00b7 * g), contMDiff_mul_right\u27e9\n\n-- Left multiplication. The abbreviation is `MIL`.\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.comp_L (L212-L216)\ntheorem comp_L : (X f).comp (\ud835\udc73 I g) = X (f.comp (\ud835\udc73 I g)) := by\next h\n rw [ContMDiffMap.comp_apply, L_apply, \u2190 evalAt_apply, evalAt_mul, hfdifferential_apply,\n fdifferential_apply, evalAt_apply]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiffWithinAt (L140-L143)\ntheorem ContMDiffWithinAt.inv {f : M \u2192 G} {s : Set M} {x\u2080 : M}\n (hf : CMDiffAt[s] n f x\u2080) : CMDiffAt[s] n (fun x \u21a6 (f x)\u207b\u00b9) x\u2080 :=\n(contMDiff_inv I n).contMDiffAt.contMDiffWithinAt.comp x\u2080 hf <| Set.mapsTo_univ _ _\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.R_apply (L209-L211)\ntheorem R_apply : (\ud835\udc79 I g) h = h * g :=\nrfl\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.ContMDiffOn (L150-L152)\ntheorem ContMDiffOn.inv {f : M \u2192 G} {s : Set M} (hf : CMDiff[s] n f) :\n CMDiff[s] n (fun x \u21a6 (f x)\u207b\u00b9) := fun x hx \u21a6 (hf x hx).inv\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_derivation (L87-L91)\ntheorem coe_derivation :\n \u21d1(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) = (X : C^\u221e\u27eeI, G; \ud835\udd5c\u27ef \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n\n/-- Premature version of the lemma. Prefer using `left_invariant` instead. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.commutator_coe_derivation (L231-L236)\ntheorem commutator_coe_derivation :\n \u21d1\u2045X, Y\u2046 =\n (\u2045(X : Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef), Y\u2046 :\n Derivation \ud835\udd5c C^\u221e\u27eeI, G; \ud835\udd5c\u27ef C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) :=\nrfl\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.L_mul (L213-L217)\ntheorem L_mul {G : Type*} [Semigroup G] [TopologicalSpace G] [ChartedSpace H G] [ContMDiffMul I \u221e G]\n (g h : G) : \ud835\udc73 I (g * h) = (\ud835\udc73 I g).comp (\ud835\udc73 I h) := by\next\n simp only [ContMDiffMap.comp_apply, L_apply, mul_assoc]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.R_mul (L219-L223)\ntheorem R_mul {G : Type*} [Semigroup G] [TopologicalSpace G] [ChartedSpace H G] [ContMDiffMul I \u221e G]\n (g h : G) : \ud835\udc79 I (g * h) = (\ud835\udc79 I h).comp (\ud835\udc79 I g) := by\next\n simp only [ContMDiffMap.comp_apply, R_apply, mul_assoc]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasNatScalar (L152-L154)\ninstance hasNatScalar : SMul \u2115 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_neg (L136-L138)\ntheorem coe_neg : \u21d1(-X) = -X :=\nrfl\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_zero (L132-L134)\ntheorem coe_zero : \u21d1(0 : LeftInvariantDerivation I G) = 0 :=\nrfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffOn (L132-L134)\ntheorem ContMDiffOn.mul (hf : CMDiff[s] n f) (hg : CMDiff[s] n g) : CMDiff[s] n (f * g) :=\nfun x hx \u21a6 (hf x hx).mul (hg x hx)\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffMul (L239-L260)\ninstance ContMDiffMul.prod {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {E : Type*}\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] {H : Type*} [TopologicalSpace H]\n (I : ModelWithCorners \ud835\udd5c E H) (G : Type*) [TopologicalSpace G] [ChartedSpace H G] [Mul G]\n [ContMDiffMul I n G] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace \ud835\udd5c E'] {H' : Type*}\n [TopologicalSpace H'] (I' : ModelWithCorners \ud835\udd5c E' H') (G' : Type*) [TopologicalSpace G']\n [ChartedSpace H' G'] [Mul G'] [ContMDiffMul I' n G'] : ContMDiffMul (I.prod I') n (G \u00d7 G') :=\n{ IsManifold.prod G G' with\n contMDiff_mul :=\n ((contMDiff_fst.comp contMDiff_fst).mul (contMDiff_fst.comp contMDiff_snd)).prodMk\n ((contMDiff_snd.comp contMDiff_fst).mul (contMDiff_snd.comp contMDiff_snd)) }\n\nend ContMDiffMul\n\nsection Monoid\n\nvariable {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c] {n : WithTop \u2115\u221e}\n {H : Type*} [TopologicalSpace H] {E : Type*}\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] {I : ModelWithCorners \ud835\udd5c E H} {G : Type*} [Monoid G]\n [TopologicalSpace G] [ChartedSpace H G] [ContMDiffMul I n G] {H' : Type*} [TopologicalSpace H']\n {E' : Type*} [NormedAddCommGroup E'] [NormedSpace \ud835\udd5c E'] {I' : ModelWithCorners \ud835\udd5c E' H'}\n {G' : Type*} [Monoid G'] [TopologicalSpace G'] [ChartedSpace H' G'] [ContMDiffMul I' n G']\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffWithinAt_finset_prod' (L341-L345)\ntheorem contMDiffWithinAt_finset_prod' (h : \u2200 i \u2208 t, CMDiffAt[s] n (f i) x) :\n CMDiffAt[s] n (\u220f i \u2208 t, f i) x :=\nFinset.prod_induction f (fun f \u21a6 CMDiffAt[s] n f x) (fun _ _ hf hg \u21a6 hf.mul hg)\n (contMDiffWithinAt_const (c := 1)) h\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.hasIntScalar (L155-L157)\ninstance hasIntScalar : SMul \u2124 (LeftInvariantDerivation I G) where\n smul r X := \u27e8r \u2022 X.1, fun g => by simp_rw [LinearMap.map_smul_of_tower _ r, left_invariant']\u27e9\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finset_prod (L400-L403)\ntheorem contMDiff_finset_prod (h : \u2200 i \u2208 t, CMDiff n (f i)) :\n CMDiff n fun x \u21a6 \u220f i \u2208 t, f i x :=\nfun x \u21a6 contMDiffAt_finset_prod fun i hi \u21a6 h i hi x\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.topologicalGroup_of_lieGroup (L134-L136)\ntheorem topologicalGroup_of_lieGroup : IsTopologicalGroup G :=\n{ continuousMul_of_contMDiffMul I n with continuous_inv := (contMDiff_inv I n).continuous }\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_apply (L194-L196)\ntheorem evalAt_apply : evalAt g X f = (X f) g :=\nrfl\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant (L201-L204)\ntheorem left_invariant : \ud835\udc85\u2095 (smoothLeftMul_one I g) (evalAt (1 : G) X) = evalAt g X :=\nX.left_invariant'' g\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_coe (L198-L200)\ntheorem evalAt_coe : Derivation.evalAt g \u2191X = evalAt g X :=\nrfl\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.SmoothFunctions.coe_pow (L67-L80)\ntheorem coe_pow {G : Type*} [Monoid G] [TopologicalSpace G] [ChartedSpace H' G]\n [ContMDiffMul I' n G] (f : C^n\u27eeI, N; I', G\u27ef) (n : \u2115) :\n \u21d1(f ^ n) = (f : N \u2192 G) ^ n :=\nrfl\n\nsection GroupStructure\n\n/-!\n### Group structure\n\nIn this section we show that `C^n` functions valued in a Lie group inherit a group structure\nunder pointwise multiplication.\n-/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_smul (L168-L170)\ntheorem coe_smul : \u21d1(r \u2022 X) = r \u2022 \u21d1X :=\nrfl\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.ext (L83-L86)\ntheorem ext (h : \u2200 f, X f = Y f) : X = Y := DFunLike.ext _ _ h\nvariable (X Y f)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffWithinAt_finprod (L333-L339)\ntheorem contMDiffWithinAt_finprod (lf : LocallyFinite fun i \u21a6 mulSupport <| f i) {x\u2080 : M}\n (h : \u2200 i, CMDiffAt[s] n (f i) x\u2080) :\n CMDiffAt[s] n (fun x \u21a6 \u220f\u1da0 i, f i x) x\u2080 :=\nlet \u27e8_I, hI\u27e9 := finprod_eventually_eq_prod lf x\u2080\n (ContMDiffWithinAt.prod fun i _hi \u21a6 h i).congr_of_eventuallyEq\n (eventually_nhdsWithin_of_eventually_nhds hI) hI.self_of_nhds\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_mul_right (L148-L150)\ntheorem contMDiff_mul_right {a : G} : CMDiff n (\u00b7 * a) :=\ncontMDiff_id.mul contMDiff_const\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.ContMDiffWithinAt (L123-L126)\ntheorem ContMDiffWithinAt.mul (hf : CMDiffAt[s] n f x) (hg : CMDiffAt[s] n g x) :\n CMDiffAt[s] n (f * g) x :=\n(contMDiff_mul I n).contMDiffAt.comp_contMDiffWithinAt x (hf.prodMk hg)\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiffAt_finset_prod (L370-L373)\ntheorem contMDiffAt_finset_prod (h : \u2200 i \u2208 t, CMDiffAt n (f i) x) :\n CMDiffAt n (fun x \u21a6 \u220f i \u2208 t, f i x) x :=\ncontMDiffWithinAt_finset_prod h\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.left_invariant' (L92-L105)\ntheorem left_invariant' :\n \ud835\udc85\u2095 (smoothLeftMul_one I g) (Derivation.evalAt (1 : G) \u2191X) = Derivation.evalAt g \u2191X :=\nleft_invariant'' X g\n\nprotected theorem map_add : X (f + f') = X f + X f' := by simp\n\nprotected theorem map_zero : X 0 = 0 := by simp\n\nprotected theorem map_neg : X (-f) = -X f := by simp\n\nprotected theorem map_sub : X (f - f') = X f - X f' := by simp\n\nprotected theorem map_smul : X (r \u2022 f) = r \u2022 X f := by simp\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.evalAt_mul (L205-L211)\ntheorem evalAt_mul : evalAt (g * h) X = \ud835\udc85\u2095 (L_apply I g h) (evalAt h X) := by\next f\n rw [\u2190 left_invariant, hfdifferential_apply, hfdifferential_apply, L_mul, fdifferential_comp,\n fdifferential_apply]\n simp only [ContMDiffMap.comp_apply, LinearMap.comp_apply]\n rw [fdifferential_apply, \u2190 hfdifferential_apply (smoothLeftMul_one I h), left_invariant]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.continuousMul_of_contMDiffMul (L113-L115)\ntheorem continuousMul_of_contMDiffMul [ContMDiffMul I n G] : ContinuousMul G :=\n\u27e8(contMDiff_mul I n).continuous\u27e9\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_injective (L78-L81)\ntheorem coe_injective :\n @Function.Injective (LeftInvariantDerivation I G) (_ \u2192 C^\u221e\u27eeI, G; \ud835\udd5c\u27ef) DFunLike.coe :=\nDFunLike.coe_injective\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.Monoid.contMDiff_finprod_cond (L410-L417)\ntheorem contMDiff_finprod_cond (hc : \u2200 i, p i \u2192 CMDiff n (f i))\n (hf : LocallyFinite fun i \u21a6 mulSupport (f i)) :\n CMDiff n fun x \u21a6 \u220f\u1da0 (i) (_ : p i), f i x := by\nsimp only [\u2190 finprod_subtype_eq_finprod_cond]\n exact contMDiff_finprod (fun i \u21a6 hc i i.2) (hf.comp_injective Subtype.coe_injective)\n\nvariable {g : M \u2192 G}\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LieGroup.contMDiff_inv (L126-L131)\ntheorem contMDiff_inv : CMDiff n fun x : G \u21a6 x\u207b\u00b9 :=\nLieGroup.contMDiff_inv\n\ninclude I n in\n/-- A Lie group is a topological group. This is not an instance for technical reasons,\nsee note [Design choices about smooth algebraic structures]. -/\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation.coe_add (L128-L130)\ntheorem coe_add : \u21d1(X + Y) = X + Y :=\nrfl\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean", "module": "Mathlib.Geometry.Manifold.IsManifold.ExtChartAt", "declaration": "Mathlib.Geometry.Manifold.IsManifold.ExtChartAt.extChartAt_target_subset_range", "span": "L580-L584", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean#L580"}, "environment": {}, "measurements": {"input_tokens": 12539, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 31545, "lean_code_chars": 28268, "natural_language_chars": 3277, "lean_code_ratio": 0.8961, "line_count": 925, "imports_count": 0, "declarations_count": 3150, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "ff233ffa17b01c12", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "C-Mathlib.CategoryTheory.Discrete.Basic.eq_of_hom", "category": "C", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Discrete.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem eq_of_hom {X Y : Discrete \u03b1} (i : X \u27f6 Y) : X.as = Y.as\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.Discrete (L56-L59)\ntheorem Discrete.mk_as {\u03b1 : Type u\u2081} (X : Discrete \u03b1) : Discrete.mk X.as = X :=\nrfl\n\n/-- `Discrete \u03b1` is equivalent to the original type `\u03b1`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.discreteEquiv (L61-L66)\ndef discreteEquiv {\u03b1 : Type u\u2081} : Discrete \u03b1 \u2243 \u03b1 where\n toFun := Discrete.as\ninvFun := Discrete.mk\n left_inv := by cat_disch\n right_inv := by cat_disch\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.discreteCategory (L75-L88)\ninstance discreteCategory (\u03b1 : Type u\u2081) : SmallCategory (Discrete \u03b1) where\n Hom X Y := ULift (PLift (X.as = Y.as))\nid _ := ULift.up (PLift.up rfl)\n comp {X Y Z} g f := by\n cases X\n cases Y\n cases Z\n rcases f with \u27e8\u27e8\u27e8\u27e9\u27e9\u27e9\n exact g\n\nnamespace Discrete\n\nvariable {\u03b1 : Type u\u2081}\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.instSubsingletonDiscreteHom (L95-L105)\ninstance instSubsingletonDiscreteHom (X Y : Discrete \u03b1) : Subsingleton (X \u27f6 Y) :=\nshow Subsingleton (ULift (PLift _)) from inferInstance\n\n/-- A simple tactic to run `cases` on any `Discrete \u03b1` hypotheses. -/\nmacro \"discrete_cases\" : tactic =>\n `(tactic| fail_if_no_progress casesm* Discrete _, (_ : Discrete _) \u27f6 (_ : Discrete _), PLift _)\n\nopen Lean Elab Tactic in\n/--\nUse:\n```\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.eqToHom' (L139-L142)\nabbrev eqToHom' {a b : \u03b1} (h : a = b) : Discrete.mk a \u27f6 Discrete.mk b :=\nDiscrete.eqToHom h\n\n/-- A variant of `eqToIso` that lifts terms to the discrete category. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.eqToIso' (L143-L145)\nabbrev eqToIso' {a b : \u03b1} (h : a = b) : Discrete.mk a \u2245 Discrete.mk b :=\nDiscrete.eqToIso h\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.id_def (L147-L149)\ntheorem id_def (X : Discrete \u03b1) : ULift.up (PLift.up (Eq.refl X.as)) = \ud835\udfd9 X :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.id_def' (L151-L155)\ntheorem id_def' (X : \u03b1) : ULift.up (PLift.up (Eq.refl X)) = \ud835\udfd9 (\u27e8X\u27e9 : Discrete \u03b1) :=\nrfl\n\nvariable {C : Type u\u2082} [Category.{v\u2082} C]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor (L163-L169)\ndef functor {I : Type u\u2081} (F : I \u2192 C) : Discrete I \u2964 C where\n obj := F \u2218 Discrete.as\nmap {X Y} f := by\n dsimp\n rcases f with \u27e8\u27e8h\u27e9\u27e9\n exact eqToHom (congrArg _ h)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_obj (L171-L174)\ntheorem functor_obj {I : Type u\u2081} (F : I \u2192 C) (i : I) :\n (Discrete.functor F).obj (Discrete.mk i) = F i :=\nrfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_map (L175-L177)\ntheorem functor_map {I : Type u\u2081} (F : I \u2192 C) {i : Discrete I} (f : i \u27f6 i) :\n (Discrete.functor F).map f = \ud835\udfd9 (F i.as) := by cat_disch\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_obj_eq_as (L179-L182)\ntheorem functor_obj_eq_as {I : Type u\u2081} (F : I \u2192 C) (X : Discrete I) :\n (Discrete.functor F).obj X = F X.as :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_ext (L184-L192)\nlemma functor_ext {I : Type u\u2081} {G F : Discrete I \u2964 C} (h : (i : I) \u2192 G.obj \u27e8i\u27e9 = F.obj \u27e8i\u27e9) :\n G = F := by\nfapply Functor.ext\n \u00b7 intro I; rw [h]\n \u00b7 intro \u27e8X\u27e9 \u27e8Y\u27e9 \u27e8\u27e8p\u27e9\u27e9; simp only at p; induction p; simp\n\n/-- The discrete functor induced by a composition of maps can be written as a\ncomposition of two discrete functors.\n-/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functorComp (L194-L201)\ndef functorComp {I : Type u\u2081} {J : Type u\u2081'} (f : J \u2192 C) (g : I \u2192 J) :\n Discrete.functor (f \u2218 g) \u2245 Discrete.functor (Discrete.mk \u2218 g) \u22d9 Discrete.functor f :=\nNatIso.ofComponents fun _ => Iso.refl _\n\n/-- For functors out of a discrete category,\na natural transformation is just a collection of maps,\nas the naturality squares are trivial.\n-/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natTrans (L203-L215)\ndef natTrans {I : Type u\u2081} {F G : Discrete I \u2964 C} (f : \u2200 i : Discrete I, F.obj i \u27f6 G.obj i) :\n F \u27f6 G where\n app := f\nnaturality := fun {X Y} \u27e8\u27e8g\u27e9\u27e9 => by\n discrete_cases\n rcases g\n change F.map (\ud835\udfd9 _) \u226b _ = _ \u226b G.map (\ud835\udfd9 _)\n simp\n\n/-- For functors out of a discrete category,\na natural isomorphism is just a collection of isomorphisms,\nas the naturality squares are trivial.\n-/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natIso (L217-L224)\ndef natIso {I : Type u\u2081} {F G : Discrete I \u2964 C} (f : \u2200 i : Discrete I, F.obj i \u2245 G.obj i) :\n F \u2245 G :=\nNatIso.ofComponents f fun \u27e8\u27e8g\u27e9\u27e9 => by\n discrete_cases\n rcases g\n change F.map (\ud835\udfd9 _) \u226b _ = _ \u226b G.map (\ud835\udfd9 _)\n simp\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natIso_app (L231-L235)\ntheorem natIso_app {I : Type u\u2081} {F G : Discrete I \u2964 C} (f : \u2200 i : Discrete I, F.obj i \u2245 G.obj i)\n (i : Discrete I) : (Discrete.natIso f).app i = f i := by cat_disch\n/-- Every functor `F` from a discrete category is naturally isomorphic (actually, equal) to\n `Discrete.functor (F.obj)`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natIsoFunctor (L237-L240)\ndef natIsoFunctor {I : Type u\u2081} {F : Discrete I \u2964 C} : F \u2245 Discrete.functor (F.obj \u2218 Discrete.mk) :=\nnatIso fun _ => Iso.refl _\n\n/-- Composing `Discrete.functor F` with another functor `G` amounts to composing `F` with `G.obj` -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.compNatIsoDiscrete (L242-L248)\ndef compNatIsoDiscrete {I : Type u\u2081} {D : Type u\u2083} [Category.{v\u2083} D] (F : I \u2192 C) (G : C \u2964 D) :\n Discrete.functor F \u22d9 G \u2245 Discrete.functor (G.obj \u2218 F) :=\nnatIso fun _ => Iso.refl _\n\n/-- We can promote a type-level `Equiv` to\nan equivalence between the corresponding `discrete` categories.\n-/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.equivalence (L250-L258)\ndef equivalence {I : Type u\u2081} {J : Type u\u2082} (e : I \u2243 J) : Discrete I \u224c Discrete J where\n functor := Discrete.functor (Discrete.mk \u2218 (e : I \u2192 J))\ninverse := Discrete.functor (Discrete.mk \u2218 (e.symm : J \u2192 I))\n unitIso :=\n Discrete.natIso fun i => eqToIso (by simp)\n counitIso :=\n Discrete.natIso fun j => eqToIso (by simp)\n\n/-- We can convert an equivalence of `discrete` categories to a type-level `Equiv`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.equivOfEquivalence (L260-L274)\ndef equivOfEquivalence {\u03b1 : Type u\u2081} {\u03b2 : Type u\u2082} (h : Discrete \u03b1 \u224c Discrete \u03b2) : \u03b1 \u2243 \u03b2 where\n toFun := Discrete.as \u2218 h.functor.obj \u2218 Discrete.mk\ninvFun := Discrete.as \u2218 h.inverse.obj \u2218 Discrete.mk\n left_inv a := by simpa using eq_of_hom (h.unitIso.app (Discrete.mk a)).2\n right_inv a := by simpa using eq_of_hom (h.counitIso.app (Discrete.mk a)).1\n\nend Discrete\n\nnamespace Discrete\n\nvariable {J : Type v\u2081}\n\nopen Opposite\n\n/-- A discrete category is equivalent to its opposite category. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_map_id (L286-L293)\ntheorem functor_map_id (F : Discrete J \u2964 C) {j : Discrete J} (f : j \u27f6 j) :\n F.map f = \ud835\udfd9 (F.obj j) := by\nhave h : f = \ud835\udfd9 j := by cat_disch\n rw [h]\n simp\n\nend Discrete\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.Discrete (L295-L299)\nlemma Discrete.forall {\u03b1 : Type*} {p : Discrete \u03b1 \u2192 Prop} :\n (\u2200 (a : Discrete \u03b1), p a) \u2194 \u2200 (a' : \u03b1), p \u27e8a'\u27e9 := by\nrw [iff_iff_eq, discreteEquiv.forall_congr_left]\n simp [discreteEquiv]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.Discrete (L301-L306)\nlemma Discrete.exists {\u03b1 : Type*} {p : Discrete \u03b1 \u2192 Prop} :\n (\u2203 (a : Discrete \u03b1), p a) \u2194 \u2203 (a' : \u03b1), p \u27e8a'\u27e9 := by\nrw [iff_iff_eq, discreteEquiv.exists_congr_left]\n simp [discreteEquiv]\n\n/-- The equivalence of categories `(J \u2192 C) \u224c (Discrete J \u2964 C)`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.piEquivalenceFunctorDiscrete (L308-L329)\ndef piEquivalenceFunctorDiscrete (J : Type u\u2082) (C : Type u\u2081) [Category.{v\u2081} C] :\n (J \u2192 C) \u224c (Discrete J \u2964 C) where\n functor :=\n{ obj := fun F => Discrete.functor F\n map := fun f => Discrete.natTrans (fun j => f j.as) }\n inverse :=\n { obj := fun F j => F.obj \u27e8j\u27e9\n map := fun f j => f.app \u27e8j\u27e9 }\n unitIso := Iso.refl _\n counitIso := NatIso.ofComponents (fun F => (NatIso.ofComponents (fun _ => Iso.refl _)\n (by\n rintro \u27e8x\u27e9 \u27e8y\u27e9 f\n obtain rfl : x = y := Discrete.eq_of_hom f\n obtain rfl : f = \ud835\udfd9 _ := rfl\n simp))) (by cat_disch)\n\n/-- A category is discrete when there is at most one morphism between two objects,\nin which case they are equal. -/\nclass IsDiscrete (C : Type*) [Category* C] : Prop where\n subsingleton (X Y : C) : Subsingleton (X \u27f6 Y) := by infer_instance\n eq_of_hom {X Y : C} (f : X \u27f6 Y) : X = Y\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Discrete.StructuredArrow.costructuredArrowEquivalenceOfUnique (L46-L57)\ndef costructuredArrowEquivalenceOfUnique\n (F : C \u2964 Discrete T) (t : T) [Subsingleton T] :\n CostructuredArrow F (.mk t) \u224c C where\n functor := CostructuredArrow.proj _ _\ninverse.obj X := CostructuredArrow.mk (Y := X) (eqToHom (by subsingleton))\n inverse.map f := CostructuredArrow.homMk f\n unitIso := NatIso.ofComponents (fun _ \u21a6 CostructuredArrow.isoMk (Iso.refl _))\n counitIso := Iso.refl _\n\nend Discrete\n\nend CategoryTheory\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.sumEquiv (L49-L71)\ndef sumEquiv {J K : Type*} : Discrete (J \u2295 K) \u224c Discrete J \u2295 Discrete K where\n functor := Discrete.functor <| fun t \u21a6\nmatch t with\n | .inl j => Sum.inl (Discrete.mk j)\n | .inr k => Sum.inr (Discrete.mk k)\n inverse := (Discrete.functor <| fun t \u21a6 Discrete.mk (Sum.inl t)).sum'\n (Discrete.functor <| fun t \u21a6 Discrete.mk (Sum.inr t))\n unitIso := NatIso.ofComponents (fun \u27e8x\u27e9 \u21a6\n match x with\n | .inl x => Iso.refl _\n | .inr x => Iso.refl _)\n counitIso := Functor.sumIsoExt\n (Discrete.natIso <| fun _ \u21a6 Iso.refl _)\n (Discrete.natIso <| fun _ \u21a6 Iso.refl _)\n\nend Discrete\n\nnamespace IsDiscrete\n\nvariable (C C' : Type*) [Category* C] [Category* C'] (D : Type*) [Category* D]\n [IsDiscrete C] [IsDiscrete C'] [IsDiscrete D]\n\n/-- A product of discrete categories is discrete. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Discrete.StructuredArrow.structuredArrowEquivalenceOfUnique (L34-L45)\ndef structuredArrowEquivalenceOfUnique\n (F : C \u2964 Discrete T) (t : T) [Subsingleton T] :\n StructuredArrow (.mk t) F \u224c C where\n functor := StructuredArrow.proj _ _\ninverse.obj X := StructuredArrow.mk (Y := X) (eqToHom (by subsingleton))\n inverse.map f := StructuredArrow.homMk f\n unitIso := NatIso.ofComponents (fun _ \u21a6 StructuredArrow.isoMk (Iso.refl _))\n counitIso := Iso.refl _\n\n/-- If `F : C \u2964 Discrete T` is a functor with `T` containing\na unique element `t`, then this is the equivalence\n`CostructuredArrow F (Discrete.mk t) \u224c C`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.productEquiv (L38-L47)\ndef productEquiv {J K : Type*} : Discrete (J \u00d7 K) \u224c Discrete J \u00d7 Discrete K where\n functor := Discrete.functor <| fun \u27e8j, k\u27e9 \u21a6 \u27e8.mk j, .mk k\u27e9\ninverse := {\n obj := fun \u27e8x, y\u27e9 \u21a6 .mk (\u27e8x.as, y.as\u27e9)\n map := fun \u27e8f\u2081, f\u2082\u27e9 \u21a6 eqToHom (by discrete_cases; dsimp; rw [f\u2081, f\u2082]) }\n unitIso := NatIso.ofComponents (fun _ \u21a6 Iso.refl _)\n counitIso := NatIso.ofComponents (fun _ \u21a6 Iso.refl _)\n\n/-- The discrete category on a sum is equivalent to the sum of the\ndiscrete categories. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.sum (L77-L88)\ninstance sum : IsDiscrete (C \u2295 C') where\n subsingleton x y :=\n{ allEq f g := by\n cases f <;> cases g\n \u00b7 case inl x y f g => rw [((by assumption : IsDiscrete C).subsingleton x y).allEq f g]\n \u00b7 case inr x y f g => rw [((by assumption : IsDiscrete C').subsingleton x y).allEq f g] }\n eq_of_hom {x y} f := by\n cases f with\n | inl x y f => rw [(by assumption : IsDiscrete C).eq_of_hom f]\n | inr x y f => rw [(by assumption : IsDiscrete C').eq_of_hom f]\n\nend CategoryTheory.IsDiscrete\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.prod (L72-L76)\ninstance prod : IsDiscrete (C \u00d7 D) where\n subsingleton x y := inferInstanceAs (Subsingleton ((x.1 \u27f6 y.1) \u00d7 (x.2 \u27f6 y.2)))\neq_of_hom f := Prod.ext (IsDiscrete.eq_of_hom f.1) (IsDiscrete.eq_of_hom f.2)\n\n/-- A product of discrete categories is discrete. -/\n```\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Discrete.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem eq_of_hom {X Y : Discrete \u03b1} (i : X \u27f6 Y) : X.as = Y.as\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.Discrete (L56-L59)\ntheorem Discrete.mk_as {\u03b1 : Type u\u2081} (X : Discrete \u03b1) : Discrete.mk X.as = X :=\nrfl\n\n/-- `Discrete \u03b1` is equivalent to the original type `\u03b1`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.discreteEquiv (L61-L66)\ndef discreteEquiv {\u03b1 : Type u\u2081} : Discrete \u03b1 \u2243 \u03b1 where\n toFun := Discrete.as\ninvFun := Discrete.mk\n left_inv := by cat_disch\n right_inv := by cat_disch\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.discreteCategory (L75-L88)\ninstance discreteCategory (\u03b1 : Type u\u2081) : SmallCategory (Discrete \u03b1) where\n Hom X Y := ULift (PLift (X.as = Y.as))\nid _ := ULift.up (PLift.up rfl)\n comp {X Y Z} g f := by\n cases X\n cases Y\n cases Z\n rcases f with \u27e8\u27e8\u27e8\u27e9\u27e9\u27e9\n exact g\n\nnamespace Discrete\n\nvariable {\u03b1 : Type u\u2081}\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.instSubsingletonDiscreteHom (L95-L105)\ninstance instSubsingletonDiscreteHom (X Y : Discrete \u03b1) : Subsingleton (X \u27f6 Y) :=\nshow Subsingleton (ULift (PLift _)) from inferInstance\n\n/-- A simple tactic to run `cases` on any `Discrete \u03b1` hypotheses. -/\nmacro \"discrete_cases\" : tactic =>\n `(tactic| fail_if_no_progress casesm* Discrete _, (_ : Discrete _) \u27f6 (_ : Discrete _), PLift _)\n\nopen Lean Elab Tactic in\n/--\nUse:\n```\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.eqToHom' (L139-L142)\nabbrev eqToHom' {a b : \u03b1} (h : a = b) : Discrete.mk a \u27f6 Discrete.mk b :=\nDiscrete.eqToHom h\n\n/-- A variant of `eqToIso` that lifts terms to the discrete category. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.eqToIso' (L143-L145)\nabbrev eqToIso' {a b : \u03b1} (h : a = b) : Discrete.mk a \u2245 Discrete.mk b :=\nDiscrete.eqToIso h\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.id_def (L147-L149)\ntheorem id_def (X : Discrete \u03b1) : ULift.up (PLift.up (Eq.refl X.as)) = \ud835\udfd9 X :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.id_def' (L151-L155)\ntheorem id_def' (X : \u03b1) : ULift.up (PLift.up (Eq.refl X)) = \ud835\udfd9 (\u27e8X\u27e9 : Discrete \u03b1) :=\nrfl\n\nvariable {C : Type u\u2082} [Category.{v\u2082} C]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor (L163-L169)\ndef functor {I : Type u\u2081} (F : I \u2192 C) : Discrete I \u2964 C where\n obj := F \u2218 Discrete.as\nmap {X Y} f := by\n dsimp\n rcases f with \u27e8\u27e8h\u27e9\u27e9\n exact eqToHom (congrArg _ h)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_obj (L171-L174)\ntheorem functor_obj {I : Type u\u2081} (F : I \u2192 C) (i : I) :\n (Discrete.functor F).obj (Discrete.mk i) = F i :=\nrfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_map (L175-L177)\ntheorem functor_map {I : Type u\u2081} (F : I \u2192 C) {i : Discrete I} (f : i \u27f6 i) :\n (Discrete.functor F).map f = \ud835\udfd9 (F i.as) := by cat_disch\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_obj_eq_as (L179-L182)\ntheorem functor_obj_eq_as {I : Type u\u2081} (F : I \u2192 C) (X : Discrete I) :\n (Discrete.functor F).obj X = F X.as :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_ext (L184-L192)\nlemma functor_ext {I : Type u\u2081} {G F : Discrete I \u2964 C} (h : (i : I) \u2192 G.obj \u27e8i\u27e9 = F.obj \u27e8i\u27e9) :\n G = F := by\nfapply Functor.ext\n \u00b7 intro I; rw [h]\n \u00b7 intro \u27e8X\u27e9 \u27e8Y\u27e9 \u27e8\u27e8p\u27e9\u27e9; simp only at p; induction p; simp\n\n/-- The discrete functor induced by a composition of maps can be written as a\ncomposition of two discrete functors.\n-/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functorComp (L194-L201)\ndef functorComp {I : Type u\u2081} {J : Type u\u2081'} (f : J \u2192 C) (g : I \u2192 J) :\n Discrete.functor (f \u2218 g) \u2245 Discrete.functor (Discrete.mk \u2218 g) \u22d9 Discrete.functor f :=\nNatIso.ofComponents fun _ => Iso.refl _\n\n/-- For functors out of a discrete category,\na natural transformation is just a collection of maps,\nas the naturality squares are trivial.\n-/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natTrans (L203-L215)\ndef natTrans {I : Type u\u2081} {F G : Discrete I \u2964 C} (f : \u2200 i : Discrete I, F.obj i \u27f6 G.obj i) :\n F \u27f6 G where\n app := f\nnaturality := fun {X Y} \u27e8\u27e8g\u27e9\u27e9 => by\n discrete_cases\n rcases g\n change F.map (\ud835\udfd9 _) \u226b _ = _ \u226b G.map (\ud835\udfd9 _)\n simp\n\n/-- For functors out of a discrete category,\na natural isomorphism is just a collection of isomorphisms,\nas the naturality squares are trivial.\n-/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natIso (L217-L224)\ndef natIso {I : Type u\u2081} {F G : Discrete I \u2964 C} (f : \u2200 i : Discrete I, F.obj i \u2245 G.obj i) :\n F \u2245 G :=\nNatIso.ofComponents f fun \u27e8\u27e8g\u27e9\u27e9 => by\n discrete_cases\n rcases g\n change F.map (\ud835\udfd9 _) \u226b _ = _ \u226b G.map (\ud835\udfd9 _)\n simp\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natIso_app (L231-L235)\ntheorem natIso_app {I : Type u\u2081} {F G : Discrete I \u2964 C} (f : \u2200 i : Discrete I, F.obj i \u2245 G.obj i)\n (i : Discrete I) : (Discrete.natIso f).app i = f i := by cat_disch\n/-- Every functor `F` from a discrete category is naturally isomorphic (actually, equal) to\n `Discrete.functor (F.obj)`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.natIsoFunctor (L237-L240)\ndef natIsoFunctor {I : Type u\u2081} {F : Discrete I \u2964 C} : F \u2245 Discrete.functor (F.obj \u2218 Discrete.mk) :=\nnatIso fun _ => Iso.refl _\n\n/-- Composing `Discrete.functor F` with another functor `G` amounts to composing `F` with `G.obj` -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.compNatIsoDiscrete (L242-L248)\ndef compNatIsoDiscrete {I : Type u\u2081} {D : Type u\u2083} [Category.{v\u2083} D] (F : I \u2192 C) (G : C \u2964 D) :\n Discrete.functor F \u22d9 G \u2245 Discrete.functor (G.obj \u2218 F) :=\nnatIso fun _ => Iso.refl _\n\n/-- We can promote a type-level `Equiv` to\nan equivalence between the corresponding `discrete` categories.\n-/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.equivalence (L250-L258)\ndef equivalence {I : Type u\u2081} {J : Type u\u2082} (e : I \u2243 J) : Discrete I \u224c Discrete J where\n functor := Discrete.functor (Discrete.mk \u2218 (e : I \u2192 J))\ninverse := Discrete.functor (Discrete.mk \u2218 (e.symm : J \u2192 I))\n unitIso :=\n Discrete.natIso fun i => eqToIso (by simp)\n counitIso :=\n Discrete.natIso fun j => eqToIso (by simp)\n\n/-- We can convert an equivalence of `discrete` categories to a type-level `Equiv`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.equivOfEquivalence (L260-L274)\ndef equivOfEquivalence {\u03b1 : Type u\u2081} {\u03b2 : Type u\u2082} (h : Discrete \u03b1 \u224c Discrete \u03b2) : \u03b1 \u2243 \u03b2 where\n toFun := Discrete.as \u2218 h.functor.obj \u2218 Discrete.mk\ninvFun := Discrete.as \u2218 h.inverse.obj \u2218 Discrete.mk\n left_inv a := by simpa using eq_of_hom (h.unitIso.app (Discrete.mk a)).2\n right_inv a := by simpa using eq_of_hom (h.counitIso.app (Discrete.mk a)).1\n\nend Discrete\n\nnamespace Discrete\n\nvariable {J : Type v\u2081}\n\nopen Opposite\n\n/-- A discrete category is equivalent to its opposite category. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.functor_map_id (L286-L293)\ntheorem functor_map_id (F : Discrete J \u2964 C) {j : Discrete J} (f : j \u27f6 j) :\n F.map f = \ud835\udfd9 (F.obj j) := by\nhave h : f = \ud835\udfd9 j := by cat_disch\n rw [h]\n simp\n\nend Discrete\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.Discrete (L295-L299)\nlemma Discrete.forall {\u03b1 : Type*} {p : Discrete \u03b1 \u2192 Prop} :\n (\u2200 (a : Discrete \u03b1), p a) \u2194 \u2200 (a' : \u03b1), p \u27e8a'\u27e9 := by\nrw [iff_iff_eq, discreteEquiv.forall_congr_left]\n simp [discreteEquiv]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.Discrete (L301-L306)\nlemma Discrete.exists {\u03b1 : Type*} {p : Discrete \u03b1 \u2192 Prop} :\n (\u2203 (a : Discrete \u03b1), p a) \u2194 \u2203 (a' : \u03b1), p \u27e8a'\u27e9 := by\nrw [iff_iff_eq, discreteEquiv.exists_congr_left]\n simp [discreteEquiv]\n\n/-- The equivalence of categories `(J \u2192 C) \u224c (Discrete J \u2964 C)`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Discrete.Basic.piEquivalenceFunctorDiscrete (L308-L329)\ndef piEquivalenceFunctorDiscrete (J : Type u\u2082) (C : Type u\u2081) [Category.{v\u2081} C] :\n (J \u2192 C) \u224c (Discrete J \u2964 C) where\n functor :=\n{ obj := fun F => Discrete.functor F\n map := fun f => Discrete.natTrans (fun j => f j.as) }\n inverse :=\n { obj := fun F j => F.obj \u27e8j\u27e9\n map := fun f j => f.app \u27e8j\u27e9 }\n unitIso := Iso.refl _\n counitIso := NatIso.ofComponents (fun F => (NatIso.ofComponents (fun _ => Iso.refl _)\n (by\n rintro \u27e8x\u27e9 \u27e8y\u27e9 f\n obtain rfl : x = y := Discrete.eq_of_hom f\n obtain rfl : f = \ud835\udfd9 _ := rfl\n simp))) (by cat_disch)\n\n/-- A category is discrete when there is at most one morphism between two objects,\nin which case they are equal. -/\nclass IsDiscrete (C : Type*) [Category* C] : Prop where\n subsingleton (X Y : C) : Subsingleton (X \u27f6 Y) := by infer_instance\n eq_of_hom {X Y : C} (f : X \u27f6 Y) : X = Y\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Discrete.StructuredArrow.costructuredArrowEquivalenceOfUnique (L46-L57)\ndef costructuredArrowEquivalenceOfUnique\n (F : C \u2964 Discrete T) (t : T) [Subsingleton T] :\n CostructuredArrow F (.mk t) \u224c C where\n functor := CostructuredArrow.proj _ _\ninverse.obj X := CostructuredArrow.mk (Y := X) (eqToHom (by subsingleton))\n inverse.map f := CostructuredArrow.homMk f\n unitIso := NatIso.ofComponents (fun _ \u21a6 CostructuredArrow.isoMk (Iso.refl _))\n counitIso := Iso.refl _\n\nend Discrete\n\nend CategoryTheory\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.sumEquiv (L49-L71)\ndef sumEquiv {J K : Type*} : Discrete (J \u2295 K) \u224c Discrete J \u2295 Discrete K where\n functor := Discrete.functor <| fun t \u21a6\nmatch t with\n | .inl j => Sum.inl (Discrete.mk j)\n | .inr k => Sum.inr (Discrete.mk k)\n inverse := (Discrete.functor <| fun t \u21a6 Discrete.mk (Sum.inl t)).sum'\n (Discrete.functor <| fun t \u21a6 Discrete.mk (Sum.inr t))\n unitIso := NatIso.ofComponents (fun \u27e8x\u27e9 \u21a6\n match x with\n | .inl x => Iso.refl _\n | .inr x => Iso.refl _)\n counitIso := Functor.sumIsoExt\n (Discrete.natIso <| fun _ \u21a6 Iso.refl _)\n (Discrete.natIso <| fun _ \u21a6 Iso.refl _)\n\nend Discrete\n\nnamespace IsDiscrete\n\nvariable (C C' : Type*) [Category* C] [Category* C'] (D : Type*) [Category* D]\n [IsDiscrete C] [IsDiscrete C'] [IsDiscrete D]\n\n/-- A product of discrete categories is discrete. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Discrete.StructuredArrow.structuredArrowEquivalenceOfUnique (L34-L45)\ndef structuredArrowEquivalenceOfUnique\n (F : C \u2964 Discrete T) (t : T) [Subsingleton T] :\n StructuredArrow (.mk t) F \u224c C where\n functor := StructuredArrow.proj _ _\ninverse.obj X := StructuredArrow.mk (Y := X) (eqToHom (by subsingleton))\n inverse.map f := StructuredArrow.homMk f\n unitIso := NatIso.ofComponents (fun _ \u21a6 StructuredArrow.isoMk (Iso.refl _))\n counitIso := Iso.refl _\n\n/-- If `F : C \u2964 Discrete T` is a functor with `T` containing\na unique element `t`, then this is the equivalence\n`CostructuredArrow F (Discrete.mk t) \u224c C`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.productEquiv (L38-L47)\ndef productEquiv {J K : Type*} : Discrete (J \u00d7 K) \u224c Discrete J \u00d7 Discrete K where\n functor := Discrete.functor <| fun \u27e8j, k\u27e9 \u21a6 \u27e8.mk j, .mk k\u27e9\ninverse := {\n obj := fun \u27e8x, y\u27e9 \u21a6 .mk (\u27e8x.as, y.as\u27e9)\n map := fun \u27e8f\u2081, f\u2082\u27e9 \u21a6 eqToHom (by discrete_cases; dsimp; rw [f\u2081, f\u2082]) }\n unitIso := NatIso.ofComponents (fun _ \u21a6 Iso.refl _)\n counitIso := NatIso.ofComponents (fun _ \u21a6 Iso.refl _)\n\n/-- The discrete category on a sum is equivalent to the sum of the\ndiscrete categories. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.sum (L77-L88)\ninstance sum : IsDiscrete (C \u2295 C') where\n subsingleton x y :=\n{ allEq f g := by\n cases f <;> cases g\n \u00b7 case inl x y f g => rw [((by assumption : IsDiscrete C).subsingleton x y).allEq f g]\n \u00b7 case inr x y f g => rw [((by assumption : IsDiscrete C').subsingleton x y).allEq f g] }\n eq_of_hom {x y} f := by\n cases f with\n | inl x y f => rw [(by assumption : IsDiscrete C).eq_of_hom f]\n | inr x y f => rw [(by assumption : IsDiscrete C').eq_of_hom f]\n\nend CategoryTheory.IsDiscrete\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Discrete.SumsProducts.prod (L72-L76)\ninstance prod : IsDiscrete (C \u00d7 D) where\n subsingleton x y := inferInstanceAs (Subsingleton ((x.1 \u27f6 y.1) \u00d7 (x.2 \u27f6 y.2)))\neq_of_hom f := Prod.ext (IsDiscrete.eq_of_hom f.1) (IsDiscrete.eq_of_hom f.2)\n\n/-- A product of discrete categories is discrete. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Discrete/Basic.lean", "module": "Mathlib.CategoryTheory.Discrete.Basic", "declaration": "Mathlib.CategoryTheory.Discrete.Basic.eq_of_hom", "span": "L125-L138", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Discrete/Basic.lean#L125"}, "environment": {}, "measurements": {"input_tokens": 4870, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 12919, "lean_code_chars": 11652, "natural_language_chars": 1267, "lean_code_ratio": 0.9019, "line_count": 409, "imports_count": 0, "declarations_count": 1506, "diagnostics_count": 0, "retrieval_snippets_count": 31, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "6c92384f718c2987", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Adjunction.Reflective.unitCompPartialBijective_symm_natural", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Adjunction.Reflective)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Adjunction/Reflective.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Adjunction.Reflective.unitCompPartialBijective_symm_natural`, L148-L152)\n```lean\ntheorem unitCompPartialBijective_symm_natural [Reflective i] (A : C) {B B' : C} (h : B \u27f6 B')\n (hB : i.essImage B) (hB' : i.essImage B') (f : i.obj ((reflector i).obj A) \u27f6 B) :\n (unitCompPartialBijective A hB').symm (f \u226b h) = (unitCompPartialBijective A hB).symm f \u226b h := by\nsimp\n```\n\n## Edit instruction\nEdit `unitCompPartialBijective_symm_natural` so it still compiles and the proof is simplified where possible. Return the full updated `unitCompPartialBijective_symm_natural` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Adjunction.Reflective).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Adjunction/Reflective.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Adjunction.Reflective.unitCompPartialBijective_symm_natural`, L148-L152)\n```lean\ntheorem unitCompPartialBijective_symm_natural [Reflective i] (A : C) {B B' : C} (h : B \u27f6 B')\n (hB : i.essImage B) (hB' : i.essImage B') (f : i.obj ((reflector i).obj A) \u27f6 B) :\n (unitCompPartialBijective A hB').symm (f \u226b h) = (unitCompPartialBijective A hB).symm f \u226b h := by\nsimp\n```\n\n## Edit instruction\nEdit `unitCompPartialBijective_symm_natural` so it still compiles and the proof is simplified where possible. Return the full updated `unitCompPartialBijective_symm_natural` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Adjunction/Reflective.lean", "module": "Mathlib.CategoryTheory.Adjunction.Reflective", "declaration": "Mathlib.CategoryTheory.Adjunction.Reflective.unitCompPartialBijective_symm_natural", "span": "L148-L152", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Adjunction/Reflective.lean#L148"}, "environment": {}, "measurements": {"input_tokens": 359, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1102, "lean_code_chars": 285, "natural_language_chars": 817, "lean_code_ratio": 0.2586, "line_count": 13, "imports_count": 0, "declarations_count": 114, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "dfdd4866ffc49c90", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products.opProductIsoCoproduct'", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Limits/Shapes/Opposites/Products.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products.opProductIsoCoproduct'`, L228-L236)\n```lean\ndef opProductIsoCoproduct' {f : Fan Z} {c : Cofan (op <| Z \u00b7)}\n (hf : IsLimit f) (hc : IsColimit c) : op f.pt \u2245 c.pt := IsColimit.coconePointUniqueUpToIso (Fan.IsLimit.op hf) hc\n\nvariable (Z) in\n/--\nThe canonical isomorphism from the opposite of the product to the coproduct in the opposite\ncategory.\n-/\n```\n\n## Edit instruction\nEdit `opProductIsoCoproduct'` so it still compiles and the proof is simplified where possible. Return the full updated `opProductIsoCoproduct'` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Limits/Shapes/Opposites/Products.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products.opProductIsoCoproduct'`, L228-L236)\n```lean\ndef opProductIsoCoproduct' {f : Fan Z} {c : Cofan (op <| Z \u00b7)}\n (hf : IsLimit f) (hc : IsColimit c) : op f.pt \u2245 c.pt := IsColimit.coconePointUniqueUpToIso (Fan.IsLimit.op hf) hc\n\nvariable (Z) in\n/--\nThe canonical isomorphism from the opposite of the product to the coproduct in the opposite\ncategory.\n-/\n```\n\n## Edit instruction\nEdit `opProductIsoCoproduct'` so it still compiles and the proof is simplified where possible. Return the full updated `opProductIsoCoproduct'` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/Opposites/Products.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products.opProductIsoCoproduct'", "span": "L228-L236", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Opposites/Products.lean#L228"}, "environment": {}, "measurements": {"input_tokens": 359, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1112, "lean_code_chars": 307, "natural_language_chars": 805, "lean_code_ratio": 0.2761, "line_count": 17, "imports_count": 0, "declarations_count": 118, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "235d1a87781b5a9c", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym.rnDeriv_eq_zero_ae_singularPart", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym)."}, {"role": "user", "content": "You are editing a file in `Mathlib/MeasureTheory/Measure/Decomposition/RadonNikodym.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym.rnDeriv_eq_zero_ae_singularPart`, L204-L209)\n```lean\nlemma rnDeriv_eq_zero_ae_singularPart [SigmaFinite \u03bc] [SigmaFinite \u03bd] :\n \u2200\u1d50 x \u2202(\u03bd.singularPart \u03bc), \u03bc.rnDeriv \u03bd x = 0 := by\nrefine rnDeriv_eq_zero_of_mutuallySingular (mutuallySingular_singularPart \u03bd \u03bc).symm ?_\n exact (Measure.singularPart_le _ _).absolutelyContinuous\n\n/-- Auxiliary lemma for `rnDeriv_add_right_of_mutuallySingular`. -/\n```\n\n## Edit instruction\nEdit `rnDeriv_eq_zero_ae_singularPart` so it still compiles and the proof is simplified where possible. Return the full updated `rnDeriv_eq_zero_ae_singularPart` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/MeasureTheory/Measure/Decomposition/RadonNikodym.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym.rnDeriv_eq_zero_ae_singularPart`, L204-L209)\n```lean\nlemma rnDeriv_eq_zero_ae_singularPart [SigmaFinite \u03bc] [SigmaFinite \u03bd] :\n \u2200\u1d50 x \u2202(\u03bd.singularPart \u03bc), \u03bc.rnDeriv \u03bd x = 0 := by\nrefine rnDeriv_eq_zero_of_mutuallySingular (mutuallySingular_singularPart \u03bd \u03bc).symm ?_\n exact (Measure.singularPart_le _ _).absolutelyContinuous\n\n/-- Auxiliary lemma for `rnDeriv_add_right_of_mutuallySingular`. -/\n```\n\n## Edit instruction\nEdit `rnDeriv_eq_zero_ae_singularPart` so it still compiles and the proof is simplified where possible. Return the full updated `rnDeriv_eq_zero_ae_singularPart` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/Decomposition/RadonNikodym.lean", "module": "Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym", "declaration": "Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym.rnDeriv_eq_zero_ae_singularPart", "span": "L204-L209", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/Decomposition/RadonNikodym.lean#L204"}, "environment": {}, "measurements": {"input_tokens": 387, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1176, "lean_code_chars": 341, "natural_language_chars": 835, "lean_code_ratio": 0.29, "line_count": 15, "imports_count": 0, "declarations_count": 99, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3dc9ae836b946c0c", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_add_inter", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.MeasureSpace)."}, {"role": "user", "content": "You are editing a file in `Mathlib/MeasureTheory/Measure/MeasureSpace.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_add_inter`, L121-L123)\n```lean\ntheorem measure_diff_add_inter (s : Set \u03b1) (ht : MeasurableSet t) : \u03bc (s \\ t) + \u03bc (s \u2229 t) = \u03bc s := (add_comm _ _).trans (measure_inter_add_diff s ht)\n```\n\n## Edit instruction\nEdit `measure_diff_add_inter` so it still compiles and the proof is simplified where possible. Return the full updated `measure_diff_add_inter` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.MeasureSpace).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/MeasureTheory/Measure/MeasureSpace.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_add_inter`, L121-L123)\n```lean\ntheorem measure_diff_add_inter (s : Set \u03b1) (ht : MeasurableSet t) : \u03bc (s \\ t) + \u03bc (s \u2229 t) = \u03bc s := (add_comm _ _).trans (measure_inter_add_diff s ht)\n```\n\n## Edit instruction\nEdit `measure_diff_add_inter` so it still compiles and the proof is simplified where possible. Return the full updated `measure_diff_add_inter` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/MeasureSpace.lean", "module": "Mathlib.MeasureTheory.Measure.MeasureSpace", "declaration": "Mathlib.MeasureTheory.Measure.MeasureSpace.measure_diff_add_inter", "span": "L121-L123", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/MeasureSpace.lean#L121"}, "environment": {}, "measurements": {"input_tokens": 289, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 916, "lean_code_chars": 150, "natural_language_chars": 766, "lean_code_ratio": 0.1638, "line_count": 10, "imports_count": 0, "declarations_count": 94, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d013e1b4e7d89994", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Limits.HasLimits.limMap_mono'", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.HasLimits)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Limits/HasLimits.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.HasLimits.limMap_mono'`, L545-L547)\n```lean\ninstance limMap_mono' {F G : J \u2964 C} [HasLimitsOfShape J C] (\u03b1 : F \u27f6 G) [Mono \u03b1] : Mono (limMap \u03b1) := (lim : (J \u2964 C) \u2964 C).map_mono \u03b1\n```\n\n## Edit instruction\nEdit `limMap_mono'` so it still compiles and the proof is simplified where possible. Return the full updated `limMap_mono'` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.HasLimits).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Limits/HasLimits.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.HasLimits.limMap_mono'`, L545-L547)\n```lean\ninstance limMap_mono' {F G : J \u2964 C} [HasLimitsOfShape J C] (\u03b1 : F \u27f6 G) [Mono \u03b1] : Mono (limMap \u03b1) := (lim : (J \u2964 C) \u2964 C).map_mono \u03b1\n```\n\n## Edit instruction\nEdit `limMap_mono'` so it still compiles and the proof is simplified where possible. Return the full updated `limMap_mono'` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/HasLimits.lean", "module": "Mathlib.CategoryTheory.Limits.HasLimits", "declaration": "Mathlib.CategoryTheory.Limits.HasLimits.limMap_mono'", "span": "L545-L547", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/HasLimits.lean#L545"}, "environment": {}, "measurements": {"input_tokens": 293, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 859, "lean_code_chars": 132, "natural_language_chars": 727, "lean_code_ratio": 0.1537, "line_count": 10, "imports_count": 0, "declarations_count": 94, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "074ff27bff1b4728", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.SetTheory.Descriptive.Tree.mem_of_prefix", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Descriptive.Tree)."}, {"role": "user", "content": "You are editing a file in `Mathlib/SetTheory/Descriptive/Tree.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.SetTheory.Descriptive.Tree.mem_of_prefix`, L46-L48)\n```lean\nlemma mem_of_prefix {x y : List A} (h' : x <+: y) (h : y \u2208 T) : x \u2208 T := by\nobtain \u27e8_, rfl\u27e9 := h'; exact mem_of_append h\n```\n\n## Edit instruction\nEdit `mem_of_prefix` so it still compiles and the proof is simplified where possible. Return the full updated `mem_of_prefix` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Descriptive.Tree).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/SetTheory/Descriptive/Tree.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.SetTheory.Descriptive.Tree.mem_of_prefix`, L46-L48)\n```lean\nlemma mem_of_prefix {x y : List A} (h' : x <+: y) (h : y \u2208 T) : x \u2208 T := by\nobtain \u27e8_, rfl\u27e9 := h'; exact mem_of_append h\n```\n\n## Edit instruction\nEdit `mem_of_prefix` so it still compiles and the proof is simplified where possible. Return the full updated `mem_of_prefix` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/SetTheory/Descriptive/Tree.lean", "module": "Mathlib.SetTheory.Descriptive.Tree", "declaration": "Mathlib.SetTheory.Descriptive.Tree.mem_of_prefix", "span": "L46-L48", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/SetTheory/Descriptive/Tree.lean#L46"}, "environment": {}, "measurements": {"input_tokens": 270, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 834, "lean_code_chars": 121, "natural_language_chars": 713, "lean_code_ratio": 0.1451, "line_count": 11, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "50386b17e7d7f925", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived.hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Functor/Derived/PointwiseRightDerived.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived.hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor`, L78-L84)\n```lean\nlemma hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor [L.IsLocalization W] :\n HasPointwiseLeftKanExtension L F := fun Y \u21a6 by\nhave := Localization.essSurj L W\n rw [\u2190 hasPointwiseLeftKanExtensionAt_iff_of_iso _ F (L.objObjPreimageIso Y),\n \u2190 F.hasPointwiseRightDerivedFunctorAt_iff L W]\n infer_instance\n```\n\n## Edit instruction\nEdit `hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor` so it still compiles and the proof is simplified where possible. Return the full updated `hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Functor/Derived/PointwiseRightDerived.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived.hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor`, L78-L84)\n```lean\nlemma hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor [L.IsLocalization W] :\n HasPointwiseLeftKanExtension L F := fun Y \u21a6 by\nhave := Localization.essSurj L W\n rw [\u2190 hasPointwiseLeftKanExtensionAt_iff_of_iso _ F (L.objObjPreimageIso Y),\n \u2190 F.hasPointwiseRightDerivedFunctorAt_iff L W]\n infer_instance\n```\n\n## Edit instruction\nEdit `hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor` so it still compiles and the proof is simplified where possible. Return the full updated `hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Functor/Derived/PointwiseRightDerived.lean", "module": "Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived", "declaration": "Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived.hasPointwiseLeftKanExtension_of_hasPointwiseRightDerivedFunctor", "span": "L78-L84", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Functor/Derived/PointwiseRightDerived.lean#L78"}, "environment": {}, "measurements": {"input_tokens": 381, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1265, "lean_code_chars": 324, "natural_language_chars": 941, "lean_code_ratio": 0.2561, "line_count": 15, "imports_count": 0, "declarations_count": 100, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6b9e94330fc5f269", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Abelian.Exact.exact_cokernel", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Abelian.Exact)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Abelian/Exact.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Abelian.Exact.exact_cokernel`, L159-L164)\n```lean\ntheorem exact_cokernel {X Y : C} (f : X \u27f6 Y) :\n (ShortComplex.mk f (cokernel.\u03c0 f) (by simp)).Exact := exact_of_g_is_cokernel _ (cokernelIsCokernel f)\n\nvariable (S)\n```\n\n## Edit instruction\nEdit `exact_cokernel` so it still compiles and the proof is simplified where possible. Return the full updated `exact_cokernel` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Abelian.Exact).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Abelian/Exact.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Abelian.Exact.exact_cokernel`, L159-L164)\n```lean\ntheorem exact_cokernel {X Y : C} (f : X \u27f6 Y) :\n (ShortComplex.mk f (cokernel.\u03c0 f) (by simp)).Exact := exact_of_g_is_cokernel _ (cokernelIsCokernel f)\n\nvariable (S)\n```\n\n## Edit instruction\nEdit `exact_cokernel` so it still compiles and the proof is simplified where possible. Return the full updated `exact_cokernel` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Abelian/Exact.lean", "module": "Mathlib.CategoryTheory.Abelian.Exact", "declaration": "Mathlib.CategoryTheory.Abelian.Exact.exact_cokernel", "span": "L159-L164", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Abelian/Exact.lean#L159"}, "environment": {}, "measurements": {"input_tokens": 292, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 891, "lean_code_chars": 167, "natural_language_chars": 724, "lean_code_ratio": 0.1874, "line_count": 13, "imports_count": 0, "declarations_count": 96, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9ea7a001e3f50415", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Functor.KanExtension.Basic.rightExtensionEquivalenceOfIso\u2081", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Functor.KanExtension.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Functor/KanExtension/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Functor.KanExtension.Basic.rightExtensionEquivalenceOfIso\u2081`, L511-L514)\n```lean\ndef rightExtensionEquivalenceOfIso\u2081 : RightExtension L F \u224c RightExtension L' F := CostructuredArrow.mapNatIso ((whiskeringLeft C D H).mapIso iso\u2081)\n\ninclude iso\u2081 in\n```\n\n## Edit instruction\nEdit `rightExtensionEquivalenceOfIso\u2081` so it still compiles and the proof is simplified where possible. Return the full updated `rightExtensionEquivalenceOfIso\u2081` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Functor.KanExtension.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Functor/KanExtension/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Functor.KanExtension.Basic.rightExtensionEquivalenceOfIso\u2081`, L511-L514)\n```lean\ndef rightExtensionEquivalenceOfIso\u2081 : RightExtension L F \u224c RightExtension L' F := CostructuredArrow.mapNatIso ((whiskeringLeft C D H).mapIso iso\u2081)\n\ninclude iso\u2081 in\n```\n\n## Edit instruction\nEdit `rightExtensionEquivalenceOfIso\u2081` so it still compiles and the proof is simplified where possible. Return the full updated `rightExtensionEquivalenceOfIso\u2081` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Functor/KanExtension/Basic.lean", "module": "Mathlib.CategoryTheory.Functor.KanExtension.Basic", "declaration": "Mathlib.CategoryTheory.Functor.KanExtension.Basic.rightExtensionEquivalenceOfIso\u2081", "span": "L511-L514", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Functor/KanExtension/Basic.lean#L511"}, "environment": {}, "measurements": {"input_tokens": 301, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 978, "lean_code_chars": 164, "natural_language_chars": 814, "lean_code_ratio": 0.1677, "line_count": 12, "imports_count": 0, "declarations_count": 94, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2a5a425dbf53f7ea", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Endomorphism.asHom", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Endomorphism)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Endomorphism.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Endomorphism.asHom`, L55-L58)\n```lean\nabbrev asHom (f : End X) : X \u27f6 X := f\n-- TODO: to fix defeq abuse, this should be `(1 : End x) = of (\ud835\udfd9 X)`.\n-- But that would require many more extra simp lemmas to get rid of the `of`.\n```\n\n## Edit instruction\nEdit `asHom` so it still compiles and the proof is simplified where possible. Return the full updated `asHom` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Endomorphism).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Endomorphism.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Endomorphism.asHom`, L55-L58)\n```lean\nabbrev asHom (f : End X) : X \u27f6 X := f\n-- TODO: to fix defeq abuse, this should be `(1 : End x) = of (\ud835\udfd9 X)`.\n-- But that would require many more extra simp lemmas to get rid of the `of`.\n```\n\n## Edit instruction\nEdit `asHom` so it still compiles and the proof is simplified where possible. Return the full updated `asHom` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Endomorphism.lean", "module": "Mathlib.CategoryTheory.Endomorphism", "declaration": "Mathlib.CategoryTheory.Endomorphism.asHom", "span": "L55-L58", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Endomorphism.lean#L55"}, "environment": {}, "measurements": {"input_tokens": 275, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 878, "lean_code_chars": 186, "natural_language_chars": 692, "lean_code_ratio": 0.2118, "line_count": 12, "imports_count": 0, "declarations_count": 109, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "66c79a960ad832b4", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.MeasureTheory.Function.LocallyIntegrable.integrable_iff_integrableAtFilter_atBot", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.LocallyIntegrable)."}, {"role": "user", "content": "You are editing a file in `Mathlib/MeasureTheory/Function/LocallyIntegrable.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Function.LocallyIntegrable.integrable_iff_integrableAtFilter_atBot`, L473-L479)\n```lean\ntheorem integrable_iff_integrableAtFilter_atBot [LinearOrder X] [OrderTop X] [CompactIccSpace X] :\n Integrable f \u03bc \u2194 IntegrableAtFilter f atBot \u03bc \u2227 LocallyIntegrable f \u03bc := by\nconstructor\n \u00b7 exact fun hf \u21a6 \u27e8hf.integrableAtFilter _, hf.locallyIntegrable\u27e9\n \u00b7 refine fun h \u21a6 integrable_iff_integrableAtFilter_cocompact.mpr \u27e8?_, h.2\u27e9\n exact h.1.filter_mono cocompact_le_atBot\n```\n\n## Edit instruction\nEdit `integrable_iff_integrableAtFilter_atBot` so it still compiles and the proof is simplified where possible. Return the full updated `integrable_iff_integrableAtFilter_atBot` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.LocallyIntegrable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/MeasureTheory/Function/LocallyIntegrable.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Function.LocallyIntegrable.integrable_iff_integrableAtFilter_atBot`, L473-L479)\n```lean\ntheorem integrable_iff_integrableAtFilter_atBot [LinearOrder X] [OrderTop X] [CompactIccSpace X] :\n Integrable f \u03bc \u2194 IntegrableAtFilter f atBot \u03bc \u2227 LocallyIntegrable f \u03bc := by\nconstructor\n \u00b7 exact fun hf \u21a6 \u27e8hf.integrableAtFilter _, hf.locallyIntegrable\u27e9\n \u00b7 refine fun h \u21a6 integrable_iff_integrableAtFilter_cocompact.mpr \u27e8?_, h.2\u27e9\n exact h.1.filter_mono cocompact_le_atBot\n```\n\n## Edit instruction\nEdit `integrable_iff_integrableAtFilter_atBot` so it still compiles and the proof is simplified where possible. Return the full updated `integrable_iff_integrableAtFilter_atBot` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Function/LocallyIntegrable.lean", "module": "Mathlib.MeasureTheory.Function.LocallyIntegrable", "declaration": "Mathlib.MeasureTheory.Function.LocallyIntegrable.integrable_iff_integrableAtFilter_atBot", "span": "L473-L479", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Function/LocallyIntegrable.lean#L473"}, "environment": {}, "measurements": {"input_tokens": 410, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1215, "lean_code_chars": 380, "natural_language_chars": 835, "lean_code_ratio": 0.3128, "line_count": 15, "imports_count": 0, "declarations_count": 107, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "764f2d8cbb800523", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.Geometry.Manifold.Diffeomorph.coe_toDiffeomorph_symm", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.Diffeomorph)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Geometry/Manifold/Diffeomorph.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Geometry.Manifold.Diffeomorph.coe_toDiffeomorph_symm`, L387-L396)\n```lean\ntheorem coe_toDiffeomorph_symm : \u21d1e.toDiffeomorph.symm = e.symm := rfl\n\nend ContinuousLinearEquiv\n\nnamespace ModelWithCorners\n\nvariable (I) (e : E \u2243L[\ud835\udd5c] E')\n\n/-- Apply a continuous linear equivalence to the model vector space. -/\n```\n\n## Edit instruction\nEdit `coe_toDiffeomorph_symm` so it still compiles and the proof is simplified where possible. Return the full updated `coe_toDiffeomorph_symm` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.Diffeomorph).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Geometry/Manifold/Diffeomorph.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Geometry.Manifold.Diffeomorph.coe_toDiffeomorph_symm`, L387-L396)\n```lean\ntheorem coe_toDiffeomorph_symm : \u21d1e.toDiffeomorph.symm = e.symm := rfl\n\nend ContinuousLinearEquiv\n\nnamespace ModelWithCorners\n\nvariable (I) (e : E \u2243L[\ud835\udd5c] E')\n\n/-- Apply a continuous linear equivalence to the model vector space. -/\n```\n\n## Edit instruction\nEdit `coe_toDiffeomorph_symm` so it still compiles and the proof is simplified where possible. Return the full updated `coe_toDiffeomorph_symm` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/Diffeomorph.lean", "module": "Mathlib.Geometry.Manifold.Diffeomorph", "declaration": "Mathlib.Geometry.Manifold.Diffeomorph.coe_toDiffeomorph_symm", "span": "L387-L396", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/Diffeomorph.lean#L387"}, "environment": {}, "measurements": {"input_tokens": 314, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 981, "lean_code_chars": 230, "natural_language_chars": 751, "lean_code_ratio": 0.2345, "line_count": 18, "imports_count": 0, "declarations_count": 100, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b7c5ea047bcfc3ad", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.GradedObject.eval", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.GradedObject)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/GradedObject.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.GradedObject.eval`, L74-L77)\n```lean\ndef eval {\u03b2 : Type w} (b : \u03b2) : GradedObject \u03b2 C \u2964 C where\n obj X := X b\nmap f := f b\n```\n\n## Edit instruction\nEdit `eval` so it still compiles and the proof is simplified where possible. Return the full updated `eval` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.GradedObject).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/GradedObject.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.GradedObject.eval`, L74-L77)\n```lean\ndef eval {\u03b2 : Type w} (b : \u03b2) : GradedObject \u03b2 C \u2964 C where\n obj X := X b\nmap f := f b\n```\n\n## Edit instruction\nEdit `eval` so it still compiles and the proof is simplified where possible. Return the full updated `eval` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/GradedObject.lean", "module": "Mathlib.CategoryTheory.GradedObject", "declaration": "Mathlib.CategoryTheory.GradedObject.eval", "span": "L74-L77", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/GradedObject.lean#L74"}, "environment": {}, "measurements": {"input_tokens": 248, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 776, "lean_code_chars": 87, "natural_language_chars": 689, "lean_code_ratio": 0.1121, "line_count": 12, "imports_count": 0, "declarations_count": 91, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f5f53e1540e02b27", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "D-Mathlib.CategoryTheory.Bicategory.Free.of", "category": "D", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Bicategory.Free)."}, {"role": "user", "content": "You are editing a file in `Mathlib/CategoryTheory/Bicategory/Free.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Bicategory.Free.of`, L273-L276)\n```lean\ndef of : Prefunctor B (FreeBicategory B) where\n obj := id\nmap := @fun _ _ => Hom.of\n```\n\n## Edit instruction\nEdit `of` so it still compiles and the proof is simplified where possible. Return the full updated `of` block.\n"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Bicategory.Free).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Bicategory/Free.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Bicategory.Free.of`, L273-L276)\n```lean\ndef of : Prefunctor B (FreeBicategory B) where\n obj := id\nmap := @fun _ _ => Hom.of\n```\n\n## Edit instruction\nEdit `of` so it still compiles and the proof is simplified where possible. Return the full updated `of` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Bicategory/Free.lean", "module": "Mathlib.CategoryTheory.Bicategory.Free", "declaration": "Mathlib.CategoryTheory.Bicategory.Free.of", "span": "L273-L276", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Bicategory/Free.lean#L273"}, "environment": {}, "measurements": {"input_tokens": 246, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 779, "lean_code_chars": 85, "natural_language_chars": 694, "lean_code_ratio": 0.1091, "line_count": 12, "imports_count": 0, "declarations_count": 89, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e592d29eb6c38499", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_indicator_iff\u2080", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.AEMeasurable)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem aemeasurable_indicator_iff\u2080 {s} (hs : NullMeasurableSet s \u03bc) :\n AEMeasurable (indicator s f) \u03bc \u2194 AEMeasurable f (\u03bc.restrict s)\n```\n\nDeclaration: `Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_indicator_iff\u2080` (module Mathlib.MeasureTheory.Measure.AEMeasurable)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.AEMeasurable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem aemeasurable_indicator_iff\u2080 {s} (hs : NullMeasurableSet s \u03bc) :\n AEMeasurable (indicator s f) \u03bc \u2194 AEMeasurable f (\u03bc.restrict s)\n```\n\nDeclaration: `Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_indicator_iff\u2080` (module Mathlib.MeasureTheory.Measure.AEMeasurable).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/AEMeasurable.lean", "module": "Mathlib.MeasureTheory.Measure.AEMeasurable", "declaration": "Mathlib.MeasureTheory.Measure.AEMeasurable.aemeasurable_indicator_iff\u2080", "span": "L338-L345", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/AEMeasurable.lean#L338"}, "environment": {}, "measurements": {"input_tokens": 213, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 680, "lean_code_chars": 138, "natural_language_chars": 542, "lean_code_ratio": 0.2029, "line_count": 8, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2007de83ad7fcce9", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument.isSmall", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma isSmall : IsSmall.{w} I\n```\n\nDeclaration: `Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument.isSmall` (module Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma isSmall : IsSmall.{w} I\n```\n\nDeclaration: `Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument.isSmall` (module Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/SmallObject/IsCardinalForSmallObjectArgument.lean", "module": "Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument", "declaration": "Mathlib.CategoryTheory.SmallObject.IsCardinalForSmallObjectArgument.isSmall", "span": "L98-L100", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/SmallObject/IsCardinalForSmallObjectArgument.lean#L98"}, "environment": {}, "measurements": {"input_tokens": 165, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 627, "lean_code_chars": 30, "natural_language_chars": 597, "lean_code_ratio": 0.0478, "line_count": 7, "imports_count": 0, "declarations_count": 51, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f2c9ece06d40590a", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.MeasureTheory.Measure.FiniteMeasure.mass_map_le", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.FiniteMeasure)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma mass_map_le (f : \u03a9 \u2192 \u03a9') (\u03bc : FiniteMeasure \u03a9) : (\u03bc.map f).mass \u2264 \u03bc.mass\n```\n\nDeclaration: `Mathlib.MeasureTheory.Measure.FiniteMeasure.mass_map_le` (module Mathlib.MeasureTheory.Measure.FiniteMeasure)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.FiniteMeasure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma mass_map_le (f : \u03a9 \u2192 \u03a9') (\u03bc : FiniteMeasure \u03a9) : (\u03bc.map f).mass \u2264 \u03bc.mass\n```\n\nDeclaration: `Mathlib.MeasureTheory.Measure.FiniteMeasure.mass_map_le` (module Mathlib.MeasureTheory.Measure.FiniteMeasure).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/FiniteMeasure.lean", "module": "Mathlib.MeasureTheory.Measure.FiniteMeasure", "declaration": "Mathlib.MeasureTheory.Measure.FiniteMeasure.mass_map_le", "span": "L944-L957", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/FiniteMeasure.lean#L944"}, "environment": {}, "measurements": {"input_tokens": 181, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 608, "lean_code_chars": 79, "natural_language_chars": 529, "lean_code_ratio": 0.1299, "line_count": 7, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b96ec312ff9e75e3", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.MeasureTheory.Measure.Prod.prod", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Prod)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ninstance prod.instNoAtoms_fst [NoAtoms \u03bc] :\n NoAtoms (Measure.prod \u03bc \u03bd) where\n measure_singleton\n | (x, y) => nonpos_iff_eq_zero.mp <| calc\n \u03bc.prod \u03bd {(x, y)} = \u03bc.prod \u03bd ({x} \u00d7\u02e2 {y})\n```\n\nDeclaration: `Mathlib.MeasureTheory.Measure.Prod.prod` (module Mathlib.MeasureTheory.Measure.Prod)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Measure.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ninstance prod.instNoAtoms_fst [NoAtoms \u03bc] :\n NoAtoms (Measure.prod \u03bc \u03bd) where\n measure_singleton\n | (x, y) => nonpos_iff_eq_zero.mp <| calc\n \u03bc.prod \u03bd {(x, y)} = \u03bc.prod \u03bd ({x} \u00d7\u02e2 {y})\n```\n\nDeclaration: `Mathlib.MeasureTheory.Measure.Prod.prod` (module Mathlib.MeasureTheory.Measure.Prod).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Measure/Prod.lean", "module": "Mathlib.MeasureTheory.Measure.Prod", "declaration": "Mathlib.MeasureTheory.Measure.Prod.prod", "span": "L208-L215", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/Prod.lean#L208"}, "environment": {}, "measurements": {"input_tokens": 222, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 686, "lean_code_chars": 191, "natural_language_chars": 495, "lean_code_ratio": 0.2784, "line_count": 11, "imports_count": 0, "declarations_count": 63, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ccdf6d3c2864be01", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.FieldTheory.SeparableDegree.natSepDegree_X_sub_C", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.SeparableDegree)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem natSepDegree_X_sub_C (x : F) : (X - C x).natSepDegree = 1\n```\n\nDeclaration: `Mathlib.FieldTheory.SeparableDegree.natSepDegree_X_sub_C` (module Mathlib.FieldTheory.SeparableDegree)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.SeparableDegree).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem natSepDegree_X_sub_C (x : F) : (X - C x).natSepDegree = 1\n```\n\nDeclaration: `Mathlib.FieldTheory.SeparableDegree.natSepDegree_X_sub_C` (module Mathlib.FieldTheory.SeparableDegree).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/SeparableDegree.lean", "module": "Mathlib.FieldTheory.SeparableDegree", "declaration": "Mathlib.FieldTheory.SeparableDegree.natSepDegree_X_sub_C", "span": "L310-L312", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/SeparableDegree.lean#L310"}, "environment": {}, "measurements": {"input_tokens": 171, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 580, "lean_code_chars": 66, "natural_language_chars": 514, "lean_code_ratio": 0.1138, "line_count": 7, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b77dffe904389ba2", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator.condExp_ae_eq_restrict_of_measurableSpace_eq_on", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem condExp_ae_eq_restrict_of_measurableSpace_eq_on {m m\u2082 m0 : MeasurableSpace \u03b1}\n {\u03bc : Measure \u03b1} (hm : m \u2264 m0) (hm\u2082 : m\u2082 \u2264 m0) [SigmaFinite (\u03bc.trim hm)]\n [SigmaFinite (\u03bc.trim hm\u2082)] (hs_m : MeasurableSet[m] s)\n (hs : \u2200 t, MeasurableSet[m] (s \u2229 t) \u2194 MeasurableSet[m\u2082] (s \u2229 t)) :\n \u03bc[f | m] =\u1d50[\u03bc.restrict s] \u03bc[f | m\u2082]\n```\n\nDeclaration: `Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator.condExp_ae_eq_restrict_of_measurableSpace_eq_on` (module Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem condExp_ae_eq_restrict_of_measurableSpace_eq_on {m m\u2082 m0 : MeasurableSpace \u03b1}\n {\u03bc : Measure \u03b1} (hm : m \u2264 m0) (hm\u2082 : m\u2082 \u2264 m0) [SigmaFinite (\u03bc.trim hm)]\n [SigmaFinite (\u03bc.trim hm\u2082)] (hs_m : MeasurableSet[m] s)\n (hs : \u2200 t, MeasurableSet[m] (s \u2229 t) \u2194 MeasurableSet[m\u2082] (s \u2229 t)) :\n \u03bc[f | m] =\u1d50[\u03bc.restrict s] \u03bc[f | m\u2082]\n```\n\nDeclaration: `Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator.condExp_ae_eq_restrict_of_measurableSpace_eq_on` (module Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean", "module": "Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator", "declaration": "Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator.condExp_ae_eq_restrict_of_measurableSpace_eq_on", "span": "L141-L180", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean#L141"}, "environment": {}, "measurements": {"input_tokens": 310, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 957, "lean_code_chars": 332, "natural_language_chars": 625, "lean_code_ratio": 0.3469, "line_count": 11, "imports_count": 0, "declarations_count": 85, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a2cc432b2d3e7d7a", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.SetTheory.Cardinal.ToNat.one_toNat", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Cardinal.ToNat)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem one_toNat : toNat 1 = 1\n```\n\nDeclaration: `Mathlib.SetTheory.Cardinal.ToNat.one_toNat` (module Mathlib.SetTheory.Cardinal.ToNat)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Cardinal.ToNat).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem one_toNat : toNat 1 = 1\n```\n\nDeclaration: `Mathlib.SetTheory.Cardinal.ToNat.one_toNat` (module Mathlib.SetTheory.Cardinal.ToNat).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/SetTheory/Cardinal/ToNat.lean", "module": "Mathlib.SetTheory.Cardinal.ToNat", "declaration": "Mathlib.SetTheory.Cardinal.ToNat.one_toNat", "span": "L120-L121", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/SetTheory/Cardinal/ToNat.lean#L120"}, "environment": {}, "measurements": {"input_tokens": 154, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 526, "lean_code_chars": 32, "natural_language_chars": 494, "lean_code_ratio": 0.0608, "line_count": 7, "imports_count": 0, "declarations_count": 49, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1c99a6e784624ad8", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "F-Mathlib.Geometry.Manifold.VectorField.Pullback.mpullback_zero", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.VectorField.Pullback)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma mpullback_zero : mpullback I I' f 0 = 0\n```\n\nDeclaration: `Mathlib.Geometry.Manifold.VectorField.Pullback.mpullback_zero` (module Mathlib.Geometry.Manifold.VectorField.Pullback)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.VectorField.Pullback).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma mpullback_zero : mpullback I I' f 0 = 0\n```\n\nDeclaration: `Mathlib.Geometry.Manifold.VectorField.Pullback.mpullback_zero` (module Mathlib.Geometry.Manifold.VectorField.Pullback).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/VectorField/Pullback.lean", "module": "Mathlib.Geometry.Manifold.VectorField.Pullback", "declaration": "Mathlib.Geometry.Manifold.VectorField.Pullback.mpullback_zero", "span": "L205-L206", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/VectorField/Pullback.lean#L205"}, "environment": {}, "measurements": {"input_tokens": 172, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 587, "lean_code_chars": 46, "natural_language_chars": 541, "lean_code_ratio": 0.0784, "line_count": 7, "imports_count": 0, "declarations_count": 52, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d9e0f4160d70777a", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.FieldTheory.Galois.Basic.galoisInsertionIntermediateFieldSubgroup", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.Galois.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef galoisInsertionIntermediateFieldSubgroup [FiniteDimensional F E] :\n GaloisInsertion (OrderDual.toDual \u2218\n (IntermediateField.fixingSubgroup : IntermediateField F E \u2192 Subgroup Gal(E/F)))\n ((IntermediateField.fixedField : Subgroup Gal(E/F) \u2192 IntermediateField F E) \u2218\n OrderDual.toDual) where\n choice K _\n:= IntermediateField.fixingSubgroup K .someMissingNamespaceXYZ\ngc K H := (IntermediateField.le_iff_le H K).symm\n le_l_u H := le_of_eq (IntermediateField.fixingSubgroup_fixedField H).symm\n choice_eq _ _ := rfl\n\n/-- The Galois correspondence as a `GaloisCoinsertion`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=397, messages=[Message(data='failed to synthesize instance of type class\\n DivisionRing F\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=46), pos_end=Position(line=1, column=67), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=397, i_end=604, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=8, column=0), pos_end=Position(line=8, column=2), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=58), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.Galois.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef galoisInsertionIntermediateFieldSubgroup [FiniteDimensional F E] :\n GaloisInsertion (OrderDual.toDual \u2218\n (IntermediateField.fixingSubgroup : IntermediateField F E \u2192 Subgroup Gal(E/F)))\n ((IntermediateField.fixedField : Subgroup Gal(E/F) \u2192 IntermediateField F E) \u2218\n OrderDual.toDual) where\n choice K _\n:= IntermediateField.fixingSubgroup K .someMissingNamespaceXYZ\ngc K H := (IntermediateField.le_iff_le H K).symm\n le_l_u H := le_of_eq (IntermediateField.fixingSubgroup_fixedField H).symm\n choice_eq _ _ := rfl\n\n/-- The Galois correspondence as a `GaloisCoinsertion`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=397, messages=[Message(data='failed to synthesize instance of type class\\n DivisionRing F\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=46), pos_end=Position(line=1, column=67), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=397, i_end=604, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=8, column=0), pos_end=Position(line=8, column=2), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=58), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/Galois/Basic.lean", "module": "Mathlib.FieldTheory.Galois.Basic", "declaration": "Mathlib.FieldTheory.Galois.Basic.galoisInsertionIntermediateFieldSubgroup", "span": "L382-L392", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/Galois/Basic.lean#L382"}, "environment": {}, "measurements": {"input_tokens": 555, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2002, "lean_code_chars": 597, "natural_language_chars": 1405, "lean_code_ratio": 0.2982, "line_count": 23, "imports_count": 0, "declarations_count": 208, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "44e386a7b0e23b64", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.MeasureTheory.Group.Action.measure_preimage_smul_of_nullMeasurableSet", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Group.Action)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem measure_preimage_smul_of_nullMeasurableSet (hs : NullMeasurableSet s \u03bc) (c : G) :\n \u03bc ((c \u2022 \u00b7) \u207b\u00b9' s) = \u03bc s\n frobnicateTacticThatDoesNotExist := by\nrw [\u2190 measure_toMeasurable s,\n \u2190 SMulInvariantMeasure.measure_preimage_smul c (measurableSet_toMeasurable \u03bc s)]\n exact measure_congr (tendsto_smul_ae \u03bc c hs.toMeasurable_ae_eq) |>.symm\n\nend AE_smul\n\nsection AE\n\nvariable {m : MeasurableSpace \u03b1} [Group G] [MulAction G \u03b1]\n (\u03bc : Measure \u03b1) [SMulInvariantMeasure G \u03b1 \u03bc]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=290, messages=[Message(data=\"Function expected at\\n NullMeasurableSet\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n s\\n\\nHint: The identifier `NullMeasurableSet` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=57), pos_end=Position(line=1, column=78), severity=, kind=None), Message(data=\"Function expected at\\n \u03bc\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n ((c \u2022 \u00b7) \u207b\u00b9' s)\\n\\nHint: The identifier `\u03bc` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n \u03bc\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n s\\n\\nHint: The identifier `\u03bc` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=24), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='Unknown identifier `measure_toMeasurable`', pos=Position(line=4, column=6), pos_end=Position(line=4, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nNullMeasurableSet : x\u271d\u00b9\\nG : Sort u_2\\nx\u271d : Sort u_3\\n\u03bc : x\u271d\\nhs : sorry\\nc : G\\n\u22a2 sorry = sorry', pos=Position(line=3, column=38), pos_end=Position(line=5, column=84), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=290, i_end=377, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=6, column=2), pos_end=Position(line=6, column=7), severity=, kind=None), Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=8, column=0), pos_end=Position(line=8, column=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=377, i_end=389, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=389, i_end=500, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.7\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=13, column=19), pos_end=Position(line=13, column=45), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Group.Action).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem measure_preimage_smul_of_nullMeasurableSet (hs : NullMeasurableSet s \u03bc) (c : G) :\n \u03bc ((c \u2022 \u00b7) \u207b\u00b9' s) = \u03bc s\n frobnicateTacticThatDoesNotExist := by\nrw [\u2190 measure_toMeasurable s,\n \u2190 SMulInvariantMeasure.measure_preimage_smul c (measurableSet_toMeasurable \u03bc s)]\n exact measure_congr (tendsto_smul_ae \u03bc c hs.toMeasurable_ae_eq) |>.symm\n\nend AE_smul\n\nsection AE\n\nvariable {m : MeasurableSpace \u03b1} [Group G] [MulAction G \u03b1]\n (\u03bc : Measure \u03b1) [SMulInvariantMeasure G \u03b1 \u03bc]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=290, messages=[Message(data=\"Function expected at\\n NullMeasurableSet\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n s\\n\\nHint: The identifier `NullMeasurableSet` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=57), pos_end=Position(line=1, column=78), severity=, kind=None), Message(data=\"Function expected at\\n \u03bc\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n ((c \u2022 \u00b7) \u207b\u00b9' s)\\n\\nHint: The identifier `\u03bc` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n \u03bc\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n s\\n\\nHint: The identifier `\u03bc` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=24), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='Unknown identifier `measure_toMeasurable`', pos=Position(line=4, column=6), pos_end=Position(line=4, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nNullMeasurableSet : x\u271d\u00b9\\nG : Sort u_2\\nx\u271d : Sort u_3\\n\u03bc : x\u271d\\nhs : sorry\\nc : G\\n\u22a2 sorry = sorry', pos=Position(line=3, column=38), pos_end=Position(line=5, column=84), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=290, i_end=377, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=6, column=2), pos_end=Position(line=6, column=7), severity=, kind=None), Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=8, column=0), pos_end=Position(line=8, column=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=377, i_end=389, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=389, i_end=500, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.7\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=13, column=19), pos_end=Position(line=13, column=45), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Group/Action.lean", "module": "Mathlib.MeasureTheory.Group.Action", "declaration": "Mathlib.MeasureTheory.Group.Action.measure_preimage_smul_of_nullMeasurableSet", "span": "L86-L98", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Group/Action.lean#L86"}, "environment": {}, "measurements": {"input_tokens": 1286, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4524, "lean_code_chars": 480, "natural_language_chars": 4044, "lean_code_ratio": 0.1061, "line_count": 24, "imports_count": 0, "declarations_count": 578, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "3b1c1b245fca75f2", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.BicartesianSq.inr_fst'", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.BicartesianSq)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem inr_fst' {b : BinaryBicone X Y} (h : b.IsBilimit) :\n IsPullback b.inr (0 : Y \u27f6 0) b.fst (0 : 0 \u27f6 X)\n:= by .someMissingNamespaceXYZ\napply flip\n refine of_bot ?_ (by simp) (of_isBilimit h)\n simp\n\n/-- The square\n```\n Y --inr--> X \u229e Y\n | |\n 0 fst\n | |\n v v\n 0 ---0-----> X\n```\nis a pullback square.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=123, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n BinaryBicone\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n X\\n\\nHint: The identifier `BinaryBicone` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=22), pos_end=Position(line=1, column=38), severity=, kind=None), Message(data=\"Function expected at\\n IsPullback\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n b.inr\\n\\nHint: The identifier `IsPullback` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nBinaryBicone : x\u271d\u00b9\\nx\u271d : Sort u_2\\nIsPullback : x\u271d\\nb : sorry\\nh : sorry\\n\u22a2 sorry', pos=Position(line=3, column=6), pos_end=Position(line=3, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=123, i_end=365, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=18, column=2), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.BicartesianSq).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem inr_fst' {b : BinaryBicone X Y} (h : b.IsBilimit) :\n IsPullback b.inr (0 : Y \u27f6 0) b.fst (0 : 0 \u27f6 X)\n:= by .someMissingNamespaceXYZ\napply flip\n refine of_bot ?_ (by simp) (of_isBilimit h)\n simp\n\n/-- The square\n```\n Y --inr--> X \u229e Y\n | |\n 0 fst\n | |\n v v\n 0 ---0-----> X\n```\nis a pullback square.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=123, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n BinaryBicone\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n X\\n\\nHint: The identifier `BinaryBicone` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=22), pos_end=Position(line=1, column=38), severity=, kind=None), Message(data=\"Function expected at\\n IsPullback\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n b.inr\\n\\nHint: The identifier `IsPullback` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nBinaryBicone : x\u271d\u00b9\\nx\u271d : Sort u_2\\nIsPullback : x\u271d\\nb : sorry\\nh : sorry\\n\u22a2 sorry', pos=Position(line=3, column=6), pos_end=Position(line=3, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=123, i_end=365, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=18, column=2), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/Pullback/IsPullback/BicartesianSq.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.BicartesianSq", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.BicartesianSq.inr_fst'", "span": "L131-L147", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Pullback/IsPullback/BicartesianSq.lean#L131"}, "environment": {}, "measurements": {"input_tokens": 854, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2924, "lean_code_chars": 222, "natural_language_chars": 2702, "lean_code_ratio": 0.0759, "line_count": 29, "imports_count": 0, "declarations_count": 381, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6dd2488854401594", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.Probability.Distributions.Gaussian.Real.gaussianPDFReal", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Distributions.Gaussian.Real)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef gaussianPDFReal (\u03bc : \u211d) (v : \u211d\u22650) (x : \u211d) : \u211d\n:= thisIsWrongLemmaNameXYZ\n(\u221a(2 * \u03c0 * v))\u207b\u00b9 * rexp (-(x - \u03bc) ^ 2 / (2 * v))\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=143, messages=[Message(data='failed to synthesize instance of type class\\n LE Type\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=33), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat Type 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n Type\\ndue to the absence of the instance above\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=35), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `rexp`', pos=Position(line=3, column=19), pos_end=Position(line=3, column=23), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Distributions.Gaussian.Real).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef gaussianPDFReal (\u03bc : \u211d) (v : \u211d\u22650) (x : \u211d) : \u211d\n:= thisIsWrongLemmaNameXYZ\n(\u221a(2 * \u03c0 * v))\u207b\u00b9 * rexp (-(x - \u03bc) ^ 2 / (2 * v))\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=143, messages=[Message(data='failed to synthesize instance of type class\\n LE Type\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=33), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat Type 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n Type\\ndue to the absence of the instance above\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=35), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `rexp`', pos=Position(line=3, column=19), pos_end=Position(line=3, column=23), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Probability/Distributions/Gaussian/Real.lean", "module": "Mathlib.Probability.Distributions.Gaussian.Real", "declaration": "Mathlib.Probability.Distributions.Gaussian.Real.gaussianPDFReal", "span": "L48-L50", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Distributions/Gaussian/Real.lean#L48"}, "environment": {}, "measurements": {"input_tokens": 558, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1991, "lean_code_chars": 126, "natural_language_chars": 1865, "lean_code_ratio": 0.0633, "line_count": 14, "imports_count": 0, "declarations_count": 218, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "17df39aee2aa6526", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.Geometry.Euclidean.Sphere.Basic.sbtw_of_collinear_of_dist_center_lt_radius", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Euclidean.Sphere.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem sbtw_of_collinear_of_dist_center_lt_radius {s : Sphere P} {p\u2081 p\u2082 p\u2083 : P}\n (h : Collinear \u211d ({p\u2081, p\u2082, p\u2083} : Set P)) (hp\u2081 : p\u2081 \u2208 s) (hp\u2082 : dist p\u2082 s.center < s.radius)\n (hp\u2083 : p\u2083 \u2208 s) (hp\u2081p\u2083 : p\u2081 \u2260 p\u2083) : Sbtw \u211d p\u2081 p\u2082 p\u2083\n:= .someMissingNamespaceXYZ\nh.sbtw_of_dist_eq_of_dist_lt hp\u2081 hp\u2082 hp\u2083 hp\u2081p\u2083\n\nnamespace Sphere\n\nvariable {s : Sphere P} {p\u2081 p\u2082 : P}\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=366, messages=[Message(data='failed to synthesize instance of type class\\n AddTorsor ?m.4 P\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=9), pos_end=Position(line=2, column=43), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Dist P\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=67), pos_end=Position(line=2, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n AddTorsor ?m.34 P\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=39), pos_end=Position(line=3, column=54), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n Sphere\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n P\\n\\nHint: The identifier `Sphere` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=56), pos_end=Position(line=1, column=64), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=366, i_end=384, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=384, i_end=423, messages=[Message(data='Function expected at\\n Sphere\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n P', pos=Position(line=9, column=14), pos_end=Position(line=9, column=22), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Euclidean.Sphere.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem sbtw_of_collinear_of_dist_center_lt_radius {s : Sphere P} {p\u2081 p\u2082 p\u2083 : P}\n (h : Collinear \u211d ({p\u2081, p\u2082, p\u2083} : Set P)) (hp\u2081 : p\u2081 \u2208 s) (hp\u2082 : dist p\u2082 s.center < s.radius)\n (hp\u2083 : p\u2083 \u2208 s) (hp\u2081p\u2083 : p\u2081 \u2260 p\u2083) : Sbtw \u211d p\u2081 p\u2082 p\u2083\n:= .someMissingNamespaceXYZ\nh.sbtw_of_dist_eq_of_dist_lt hp\u2081 hp\u2082 hp\u2083 hp\u2081p\u2083\n\nnamespace Sphere\n\nvariable {s : Sphere P} {p\u2081 p\u2082 : P}\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=366, messages=[Message(data='failed to synthesize instance of type class\\n AddTorsor ?m.4 P\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=9), pos_end=Position(line=2, column=43), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Dist P\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=67), pos_end=Position(line=2, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n AddTorsor ?m.34 P\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=39), pos_end=Position(line=3, column=54), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n Sphere\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n P\\n\\nHint: The identifier `Sphere` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=56), pos_end=Position(line=1, column=64), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=366, i_end=384, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=384, i_end=423, messages=[Message(data='Function expected at\\n Sphere\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n P', pos=Position(line=9, column=14), pos_end=Position(line=9, column=22), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Euclidean/Sphere/Basic.lean", "module": "Mathlib.Geometry.Euclidean.Sphere.Basic", "declaration": "Mathlib.Geometry.Euclidean.Sphere.Basic.sbtw_of_collinear_of_dist_center_lt_radius", "span": "L571-L579", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Euclidean/Sphere/Basic.lean#L571"}, "environment": {}, "measurements": {"input_tokens": 927, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3188, "lean_code_chars": 362, "natural_language_chars": 2826, "lean_code_ratio": 0.1136, "line_count": 20, "imports_count": 0, "declarations_count": 405, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a1cdbe7bcef08ffd", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.SetTheory.Ordinal.Veblen.veblenWith_eq_self_of_le", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Ordinal.Veblen)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem veblenWith_eq_self_of_le (h : o\u2081 \u2264 o\u2082) (h' : veblenWith f o\u2082 a = a) :\n veblenWith f o\u2081 a = a\n:= by thisIsWrongLemmaNameXYZ\nobtain rfl | h := h.eq_or_lt\n \u00b7 assumption\n \u00b7 rw [\u2190 h', veblenWith_veblenWith_of_lt hf h]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=121, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n veblenWith\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `veblenWith` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=53), pos_end=Position(line=1, column=70), severity=, kind=None), Message(data=\"Function expected at\\n veblenWith\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `veblenWith` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"unsolved goals\\n\u03b1\u271d\u00b9 : Type u_1\\no\u2081 o\u2082 : \u03b1\u271d\u00b9\\nx\u271d : Sort u_2\\nveblenWith : x\u271d\\n\u03b1\u271d : Sort u_3\\na : \u03b1\u271d\\nh : o\u2081 \u2264 o\u2082\\nh' : sorry = a\\n\u22a2 sorry = a\", pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=121, i_end=239, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Ordinal.Veblen).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem veblenWith_eq_self_of_le (h : o\u2081 \u2264 o\u2082) (h' : veblenWith f o\u2082 a = a) :\n veblenWith f o\u2081 a = a\n:= by thisIsWrongLemmaNameXYZ\nobtain rfl | h := h.eq_or_lt\n \u00b7 assumption\n \u00b7 rw [\u2190 h', veblenWith_veblenWith_of_lt hf h]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=121, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n veblenWith\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `veblenWith` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=53), pos_end=Position(line=1, column=70), severity=, kind=None), Message(data=\"Function expected at\\n veblenWith\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `veblenWith` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"unsolved goals\\n\u03b1\u271d\u00b9 : Type u_1\\no\u2081 o\u2082 : \u03b1\u271d\u00b9\\nx\u271d : Sort u_2\\nveblenWith : x\u271d\\n\u03b1\u271d : Sort u_3\\na : \u03b1\u271d\\nh : o\u2081 \u2264 o\u2082\\nh' : sorry = a\\n\u22a2 sorry = a\", pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=121, i_end=239, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/SetTheory/Ordinal/Veblen.lean", "module": "Mathlib.SetTheory.Ordinal.Veblen", "declaration": "Mathlib.SetTheory.Ordinal.Veblen.veblenWith_eq_self_of_le", "span": "L107-L112", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/SetTheory/Ordinal/Veblen.lean#L107"}, "environment": {}, "measurements": {"input_tokens": 786, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2626, "lean_code_chars": 226, "natural_language_chars": 2400, "lean_code_ratio": 0.0861, "line_count": 17, "imports_count": 0, "declarations_count": 359, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "7986d380ddcadb32", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.InformationTheory.Hamming.nndist_eq_hammingDist", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.Hamming)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem nndist_eq_hammingDist (x y : Hamming \u03b2) :\n nndist x y = hammingDist (ofHamming x) (ofHamming y)\n:= thisIsWrongLemmaNameXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=138, messages=[Message(data=\"Function expected at\\n ofHamming\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n x\\n\\nHint: The identifier `ofHamming` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=30), pos_end=Position(line=2, column=41), severity=, kind=None), Message(data=\"Function expected at\\n ofHamming\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n y\\n\\nHint: The identifier `ofHamming` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=44), pos_end=Position(line=2, column=55), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=3, column=3), pos_end=Position(line=3, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.Hamming).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem nndist_eq_hammingDist (x y : Hamming \u03b2) :\n nndist x y = hammingDist (ofHamming x) (ofHamming y)\n:= thisIsWrongLemmaNameXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=138, messages=[Message(data=\"Function expected at\\n ofHamming\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n x\\n\\nHint: The identifier `ofHamming` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=30), pos_end=Position(line=2, column=41), severity=, kind=None), Message(data=\"Function expected at\\n ofHamming\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n y\\n\\nHint: The identifier `ofHamming` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=44), pos_end=Position(line=2, column=55), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=3, column=3), pos_end=Position(line=3, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/InformationTheory/Hamming.lean", "module": "Mathlib.InformationTheory.Hamming", "declaration": "Mathlib.InformationTheory.Hamming.nndist_eq_hammingDist", "span": "L383-L386", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/InformationTheory/Hamming.lean#L383"}, "environment": {}, "measurements": {"input_tokens": 585, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2200, "lean_code_chars": 138, "natural_language_chars": 2062, "lean_code_ratio": 0.0627, "line_count": 15, "imports_count": 0, "declarations_count": 298, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "22667ac4d32c7955", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.ModelTheory.FinitelyGenerated.Substructure", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.FinitelyGenerated)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG \u2194 Structure.CG L S\n:= by _unbalancedParenXYZ\nrw [Structure.cg_def]\n refine \u27e8fun h => CG.of_map_embedding S.subtype ?_, fun h => ?_\u27e9\n \u00b7 rw [\u2190 Hom.range_eq_map, range_subtype]\n exact h\n \u00b7 have h := h.map S.subtype.toHom\n rw [\u2190 Hom.range_eq_map, range_subtype] at h\n exact h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `L.Substructure`', pos=Position(line=1, column=46), pos_end=Position(line=1, column=60), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `Structure.CG`', pos=Position(line=1, column=73), pos_end=Position(line=1, column=85), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nS : sorry\\n\u22a2 sorry \u2194 sorry', pos=Position(line=2, column=3), pos_end=Position(line=2, column=25), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=99, i_end=366, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.FinitelyGenerated).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG \u2194 Structure.CG L S\n:= by _unbalancedParenXYZ\nrw [Structure.cg_def]\n refine \u27e8fun h => CG.of_map_embedding S.subtype ?_, fun h => ?_\u27e9\n \u00b7 rw [\u2190 Hom.range_eq_map, range_subtype]\n exact h\n \u00b7 have h := h.map S.subtype.toHom\n rw [\u2190 Hom.range_eq_map, range_subtype] at h\n exact h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `L.Substructure`', pos=Position(line=1, column=46), pos_end=Position(line=1, column=60), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `Structure.CG`', pos=Position(line=1, column=73), pos_end=Position(line=1, column=85), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nS : sorry\\n\u22a2 sorry \u2194 sorry', pos=Position(line=2, column=3), pos_end=Position(line=2, column=25), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=99, i_end=366, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/ModelTheory/FinitelyGenerated.lean", "module": "Mathlib.ModelTheory.FinitelyGenerated", "declaration": "Mathlib.ModelTheory.FinitelyGenerated.Substructure", "span": "L305-L313", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/FinitelyGenerated.lean#L305"}, "environment": {}, "measurements": {"input_tokens": 526, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1797, "lean_code_chars": 355, "natural_language_chars": 1442, "lean_code_ratio": 0.1976, "line_count": 20, "imports_count": 0, "declarations_count": 185, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "012045dc2d343ad8", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.RepresentationTheory.Invariants.invariants_eq_inter", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RepresentationTheory.Invariants)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem invariants_eq_inter : (invariants \u03c1).carrier = \u22c2 g : G, Function.fixedPoints (\u03c1 g)\n:= by thisIsWrongLemmaNameXYZ\next; simp [Function.IsFixedPt]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=102, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n invariants\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c1\\n\\nHint: The identifier `invariants` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=31), pos_end=Position(line=1, column=43), severity=, kind=None), Message(data=\"Function expected at\\n \u03c1\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n g\\n\\nHint: The identifier `\u03c1` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=86), pos_end=Position(line=1, column=89), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\ninvariants : x\u271d\u00b9\\nG : Sort u_2\\nx\u271d : Sort u_3\\n\u03c1 : x\u271d\\n\u22a2 sorry = \u22c2 g, Function.fixedPoints ?m.10', pos=Position(line=2, column=3), pos_end=Position(line=2, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=102, i_end=155, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RepresentationTheory.Invariants).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem invariants_eq_inter : (invariants \u03c1).carrier = \u22c2 g : G, Function.fixedPoints (\u03c1 g)\n:= by thisIsWrongLemmaNameXYZ\next; simp [Function.IsFixedPt]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=102, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n invariants\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c1\\n\\nHint: The identifier `invariants` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=31), pos_end=Position(line=1, column=43), severity=, kind=None), Message(data=\"Function expected at\\n \u03c1\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n g\\n\\nHint: The identifier `\u03c1` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=86), pos_end=Position(line=1, column=89), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\ninvariants : x\u271d\u00b9\\nG : Sort u_2\\nx\u271d : Sort u_3\\n\u03c1 : x\u271d\\n\u22a2 sorry = \u22c2 g, Function.fixedPoints ?m.10', pos=Position(line=2, column=3), pos_end=Position(line=2, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=102, i_end=155, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RepresentationTheory/Invariants.lean", "module": "Mathlib.RepresentationTheory.Invariants", "declaration": "Mathlib.RepresentationTheory.Invariants.invariants_eq_inter", "span": "L83-L85", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Invariants.lean#L83"}, "environment": {}, "measurements": {"input_tokens": 711, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2530, "lean_code_chars": 152, "natural_language_chars": 2378, "lean_code_ratio": 0.0601, "line_count": 14, "imports_count": 0, "declarations_count": 336, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a48e48b5941ca721", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.AlgebraicGeometry.AffineScheme.isAffineOpen_opensRange", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.AffineScheme)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isAffineOpen_opensRange {X Y : Scheme} [IsAffine X] (f : X \u27f6 Y)\n [H : IsOpenImmersion f] : IsAffineOpen f.opensRange\n:= by .someMissingNamespaceXYZ\nrefine .of_isIso (IsOpenImmersion.isoOfRangeEq f (Y.ofRestrict _) ?_).inv\n exact Subtype.range_val.symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=138, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=138, i_end=265, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.AffineScheme).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isAffineOpen_opensRange {X Y : Scheme} [IsAffine X] (f : X \u27f6 Y)\n [H : IsOpenImmersion f] : IsAffineOpen f.opensRange\n:= by .someMissingNamespaceXYZ\nrefine .of_isIso (IsOpenImmersion.isoOfRangeEq f (Y.ofRestrict _) ?_).inv\n exact Subtype.range_val.symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=138, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=138, i_end=265, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/AlgebraicGeometry/AffineScheme.lean", "module": "Mathlib.AlgebraicGeometry.AffineScheme", "declaration": "Mathlib.AlgebraicGeometry.AffineScheme.isAffineOpen_opensRange", "span": "L261-L265", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/AffineScheme.lean#L261"}, "environment": {}, "measurements": {"input_tokens": 329, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1131, "lean_code_chars": 264, "natural_language_chars": 867, "lean_code_ratio": 0.2334, "line_count": 16, "imports_count": 0, "declarations_count": 119, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e5b414743f74b1a8", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.FieldTheory.PurelyInseparable.PerfectClosure.LinearIndependent", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.PurelyInseparable.PerfectClosure)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem LinearIndependent.map_pow_expChar_pow_of_isSeparable'\n (hsep : \u2200 i : \u03b9, IsSeparable F (v i))\n (h : LinearIndependent F v) : LinearIndependent F (v \u00b7 ^ q ^ n)\n frobnicateTacticThatDoesNotExist := by\nlet E' := adjoin F (Set.range v)\n haveI : Algebra.IsSeparable F E' := (isSeparable_adjoin_iff_isSeparable F _).2 <| by\n rintro _ \u27e8y, rfl\u27e9; exact hsep y\n let v' (i : \u03b9) : E' := \u27e8v i, subset_adjoin F _ \u27e8i, rfl\u27e9\u27e9\n have h' : LinearIndependent F v' := h.of_comp E'.val.toLinearMap\n exact (h'.map_pow_expChar_pow_of_isSeparable q n).map'\n E'.val.toLinearMap (LinearMap.ker_eq_bot_of_injective E'.val.injective)\n\n/-- If `E / F` is a separable extension of exponential characteristic `q`, if `{ u_i }` is an\n`F`-basis of `E`, then `{ u_i ^ (q ^ n) }` is also an `F`-basis of `E`\nfor any natural number `n`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=646, messages=[Message(data=\"`LinearIndependent.map_pow_expChar_pow_of_isSeparable'` has already been declared\", pos=Position(line=1, column=8), pos_end=Position(line=1, column=61), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=646, i_end=841, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=15, column=30), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.PurelyInseparable.PerfectClosure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem LinearIndependent.map_pow_expChar_pow_of_isSeparable'\n (hsep : \u2200 i : \u03b9, IsSeparable F (v i))\n (h : LinearIndependent F v) : LinearIndependent F (v \u00b7 ^ q ^ n)\n frobnicateTacticThatDoesNotExist := by\nlet E' := adjoin F (Set.range v)\n haveI : Algebra.IsSeparable F E' := (isSeparable_adjoin_iff_isSeparable F _).2 <| by\n rintro _ \u27e8y, rfl\u27e9; exact hsep y\n let v' (i : \u03b9) : E' := \u27e8v i, subset_adjoin F _ \u27e8i, rfl\u27e9\u27e9\n have h' : LinearIndependent F v' := h.of_comp E'.val.toLinearMap\n exact (h'.map_pow_expChar_pow_of_isSeparable q n).map'\n E'.val.toLinearMap (LinearMap.ker_eq_bot_of_injective E'.val.injective)\n\n/-- If `E / F` is a separable extension of exponential characteristic `q`, if `{ u_i }` is an\n`F`-basis of `E`, then `{ u_i ^ (q ^ n) }` is also an `F`-basis of `E`\nfor any natural number `n`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=646, messages=[Message(data=\"`LinearIndependent.map_pow_expChar_pow_of_isSeparable'` has already been declared\", pos=Position(line=1, column=8), pos_end=Position(line=1, column=61), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=646, i_end=841, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=15, column=30), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/PurelyInseparable/PerfectClosure.lean", "module": "Mathlib.FieldTheory.PurelyInseparable.PerfectClosure", "declaration": "Mathlib.FieldTheory.PurelyInseparable.PerfectClosure.LinearIndependent", "span": "L363-L376", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/PurelyInseparable/PerfectClosure.lean#L363"}, "environment": {}, "measurements": {"input_tokens": 607, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1942, "lean_code_chars": 825, "natural_language_chars": 1117, "lean_code_ratio": 0.4248, "line_count": 26, "imports_count": 0, "declarations_count": 216, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "508e9b21d097d61d", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.MeasureTheory.Constructions.Polish.Basic.Continuous", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Constructions.Polish.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Continuous.map_eq_borel {X Y : Type*} [TopologicalSpace X] [PolishSpace X]\n [MeasurableSpace X] [BorelSpace X] [TopologicalSpace Y] [T0Space Y] [SecondCountableTopology Y]\n {f : X \u2192 Y} (hf : Continuous f) (hsurj : Surjective f) :\n MeasurableSpace.map f \u2039MeasurableSpace X\u203a = borel Y\n:= by thisIsWrongLemmaNameXYZ\nborelize Y\n exact hf.measurable.map_measurableSpace_eq hsurj\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=313, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=313, i_end=397, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Constructions.Polish.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Continuous.map_eq_borel {X Y : Type*} [TopologicalSpace X] [PolishSpace X]\n [MeasurableSpace X] [BorelSpace X] [TopologicalSpace Y] [T0Space Y] [SecondCountableTopology Y]\n {f : X \u2192 Y} (hf : Continuous f) (hsurj : Surjective f) :\n MeasurableSpace.map f \u2039MeasurableSpace X\u203a = borel Y\n:= by thisIsWrongLemmaNameXYZ\nborelize Y\n exact hf.measurable.map_measurableSpace_eq hsurj\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=313, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=313, i_end=397, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Constructions/Polish/Basic.lean", "module": "Mathlib.MeasureTheory.Constructions.Polish.Basic", "declaration": "Mathlib.MeasureTheory.Constructions.Polish.Basic.Continuous", "span": "L608-L614", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean#L608"}, "environment": {}, "measurements": {"input_tokens": 375, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1269, "lean_code_chars": 392, "natural_language_chars": 877, "lean_code_ratio": 0.3089, "line_count": 18, "imports_count": 0, "declarations_count": 133, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "25e7022912789288", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.CategoryTheory.Limits.Shapes.Pullback.Cospan.Hom", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.Cospan)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev Hom.snd : zero \u27f6 right\n:= thisIsWrongLemmaNameXYZ\nWidePushoutShape.Hom.init _\n\n/-- The identity arrows of the walking span. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=88, messages=[Message(data='typeclass instance problem is stuck\\n Quiver ?m.5\\n\\nNote: Lean will not try to resolve this typeclass instance problem because the type argument to `Quiver` is a metavariable. This argument must be fully determined before Lean will try to resolve the typeclass.\\n\\nHint: Adding type annotations and supplying implicit arguments to functions can give Lean more information for typeclass resolution. For example, if you have a variable `x` that you intend to be a `Nat`, but Lean reports it as having an unresolved type like `?m`, replacing `x` with `(x : Nat)` can get typeclass resolution un-stuck.', pos=Position(line=1, column=17), pos_end=Position(line=1, column=29), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=88, i_end=135, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=47), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.Shapes.Pullback.Cospan).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev Hom.snd : zero \u27f6 right\n:= thisIsWrongLemmaNameXYZ\nWidePushoutShape.Hom.init _\n\n/-- The identity arrows of the walking span. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=88, messages=[Message(data='typeclass instance problem is stuck\\n Quiver ?m.5\\n\\nNote: Lean will not try to resolve this typeclass instance problem because the type argument to `Quiver` is a metavariable. This argument must be fully determined before Lean will try to resolve the typeclass.\\n\\nHint: Adding type annotations and supplying implicit arguments to functions can give Lean more information for typeclass resolution. For example, if you have a variable `x` that you intend to be a `Nat`, but Lean reports it as having an unresolved type like `?m`, replacing `x` with `(x : Nat)` can get typeclass resolution un-stuck.', pos=Position(line=1, column=17), pos_end=Position(line=1, column=29), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=88, i_end=135, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=47), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/CategoryTheory/Limits/Shapes/Pullback/Cospan.lean", "module": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.Cospan", "declaration": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.Cospan.Hom", "span": "L116-L119", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Pullback/Cospan.lean#L116"}, "environment": {}, "measurements": {"input_tokens": 461, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1768, "lean_code_chars": 134, "natural_language_chars": 1634, "lean_code_ratio": 0.0758, "line_count": 16, "imports_count": 0, "declarations_count": 223, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "98c3d74245ee0db0", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.Probability.ProbabilityMassFunction.Binomial.binomial_apply_self", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.ProbabilityMassFunction.Binomial)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem binomial_apply_self (p : \u211d\u22650) (h : p \u2264 1) (n : \u2115) :\n binomial p h n (.last n) = p ^ n\n:= by simp \u27e8\u27e9\u27e8\u27e9\n/-- The binomial distribution on one coin is the Bernoulli distribution. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=116, messages=[Message(data='failed to synthesize instance of type class\\n LE Type\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=33), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat Type 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n Type\\ndue to the absence of the instance above\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=35), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n binomial\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n p\\n\\nHint: The identifier `binomial` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=28), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nbinomial : x\u271d\\np : sorry\\nh : sorry\\nn : \u2115\\n\u22a2 sorry ()', pos=Position(line=3, column=3), pos_end=Position(line=3, column=10), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=116, i_end=204, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=11), pos_end=Position(line=3, column=12), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=4, column=75), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.ProbabilityMassFunction.Binomial).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem binomial_apply_self (p : \u211d\u22650) (h : p \u2264 1) (n : \u2115) :\n binomial p h n (.last n) = p ^ n\n:= by simp \u27e8\u27e9\u27e8\u27e9\n/-- The binomial distribution on one coin is the Bernoulli distribution. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=116, messages=[Message(data='failed to synthesize instance of type class\\n LE Type\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=33), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat Type 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n Type\\ndue to the absence of the instance above\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=35), pos_end=Position(line=1, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n binomial\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n p\\n\\nHint: The identifier `binomial` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=28), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nbinomial : x\u271d\\np : sorry\\nh : sorry\\nn : \u2115\\n\u22a2 sorry ()', pos=Position(line=3, column=3), pos_end=Position(line=3, column=10), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=116, i_end=204, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=11), pos_end=Position(line=3, column=12), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=4, column=75), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Probability/ProbabilityMassFunction/Binomial.lean", "module": "Mathlib.Probability.ProbabilityMassFunction.Binomial", "declaration": "Mathlib.Probability.ProbabilityMassFunction.Binomial.binomial_apply_self", "span": "L56-L59", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/ProbabilityMassFunction/Binomial.lean#L56"}, "environment": {}, "measurements": {"input_tokens": 825, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2969, "lean_code_chars": 189, "natural_language_chars": 2780, "lean_code_ratio": 0.0637, "line_count": 15, "imports_count": 0, "declarations_count": 377, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "8a4451b653d898e3", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.Geometry.Manifold.LocalDiffeomorph.IsLocalDiffeomorph", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.LocalDiffeomorph)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma IsLocalDiffeomorph.mfderivToContinuousLinearEquiv_coe\n (hf : IsLocalDiffeomorph I J n f) (hn : n \u2260 0) (x : M) :\n hf.mfderivToContinuousLinearEquiv hn x = mfderiv% f x\n:= \u27e8\u27e9\u27e8\u27e9\n(hf x).mfderivToContinuousLinearEquiv_coe hn\n\nend Differential\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=190, messages=[Message(data='`IsLocalDiffeomorph.mfderivToContinuousLinearEquiv_coe` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=59), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=190, i_end=259, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=4, column=5), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=7, column=0), pos_end=Position(line=7, column=16), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Geometry.Manifold.LocalDiffeomorph).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma IsLocalDiffeomorph.mfderivToContinuousLinearEquiv_coe\n (hf : IsLocalDiffeomorph I J n f) (hn : n \u2260 0) (x : M) :\n hf.mfderivToContinuousLinearEquiv hn x = mfderiv% f x\n:= \u27e8\u27e9\u27e8\u27e9\n(hf x).mfderivToContinuousLinearEquiv_coe hn\n\nend Differential\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=190, messages=[Message(data='`IsLocalDiffeomorph.mfderivToContinuousLinearEquiv_coe` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=59), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=190, i_end=259, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=4, column=5), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=7, column=0), pos_end=Position(line=7, column=16), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Geometry/Manifold/LocalDiffeomorph.lean", "module": "Mathlib.Geometry.Manifold.LocalDiffeomorph", "declaration": "Mathlib.Geometry.Manifold.LocalDiffeomorph.IsLocalDiffeomorph", "span": "L418-L423", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/LocalDiffeomorph.lean#L418"}, "environment": {}, "measurements": {"input_tokens": 490, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1612, "lean_code_chars": 250, "natural_language_chars": 1362, "lean_code_ratio": 0.1551, "line_count": 18, "imports_count": 0, "declarations_count": 171, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6f269ecafc43b665", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.SetTheory.Ordinal.Basic.small_Iio", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Ordinal.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance small_Iio (o : Ordinal.{u}) : Small.{u} (Iio o)\n:= \u27e8\u27e9\u27e8\u27e9\n\u27e8_, \u27e8ToType.mk.toEquiv\u27e9\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=66, messages=[Message(data=\"Function expected at\\n Iio\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n o\\n\\nHint: The identifier `Iio` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=50), pos_end=Position(line=1, column=55), severity=, kind=None), Message(data='Insufficient number of fields for `\u27e8...\u27e9` constructor: Constructor `Small.mk` has 1 explicit fields, but none were provided', pos=Position(line=2, column=3), pos_end=Position(line=2, column=5), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=66, i_end=105, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=6), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.SetTheory.Ordinal.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance small_Iio (o : Ordinal.{u}) : Small.{u} (Iio o)\n:= \u27e8\u27e9\u27e8\u27e9\n\u27e8_, \u27e8ToType.mk.toEquiv\u27e9\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=66, messages=[Message(data=\"Function expected at\\n Iio\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n o\\n\\nHint: The identifier `Iio` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=50), pos_end=Position(line=1, column=55), severity=, kind=None), Message(data='Insufficient number of fields for `\u27e8...\u27e9` constructor: Constructor `Small.mk` has 1 explicit fields, but none were provided', pos=Position(line=2, column=3), pos_end=Position(line=2, column=5), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=66, i_end=105, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=6), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/SetTheory/Ordinal/Basic.lean", "module": "Mathlib.SetTheory.Ordinal.Basic", "declaration": "Mathlib.SetTheory.Ordinal.Basic.small_Iio", "span": "L543-L545", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/SetTheory/Ordinal/Basic.lean#L543"}, "environment": {}, "measurements": {"input_tokens": 528, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1855, "lean_code_chars": 90, "natural_language_chars": 1765, "lean_code_ratio": 0.0485, "line_count": 14, "imports_count": 0, "declarations_count": 236, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "2862d4aa155a9f45", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.InformationTheory.KullbackLeibler.Basic.mul_log_le_klDiv", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.KullbackLeibler.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mul_log_le_klDiv (\u03bc \u03bd : Measure \u03b1) [IsFiniteMeasure \u03bc] [IsFiniteMeasure \u03bd] :\n ENNReal.ofReal (\u03bc.real univ * log (\u03bc.real univ / \u03bd.real univ)\n + \u03bd.real univ - \u03bc.real univ)\n \u2264 klDiv \u03bc \u03bd\n:= by .someMissingNamespaceXYZ\nby_cases h\u03bc\u03bd : \u03bc \u226a \u03bd\n swap; \u00b7 simp [h\u03bc\u03bd]\n by_cases h_int : Integrable (llr \u03bc \u03bd) \u03bc\n swap; \u00b7 simp [h_int]\n rw [\u2190 ENNReal.ofReal_toReal (a := klDiv \u03bc \u03bd)]\n \u00b7 exact ENNReal.ofReal_le_ofReal (mul_log_le_toReal_klDiv h\u03bc\u03bd h_int)\n \u00b7 rw [klDiv_ne_top_iff]\n exact \u27e8h\u03bc\u03bd, h_int\u27e9\n\nend Inequalities\n\n/-- **Converse Gibbs' inequality**: the Kullback-Leibler divergence between two finite measures is\nzero if and only if the two measures are equal. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=226, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=226, i_end=570, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=15, column=0), pos_end=Position(line=15, column=16), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=570, i_end=719, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=18, column=50), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.KullbackLeibler.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mul_log_le_klDiv (\u03bc \u03bd : Measure \u03b1) [IsFiniteMeasure \u03bc] [IsFiniteMeasure \u03bd] :\n ENNReal.ofReal (\u03bc.real univ * log (\u03bc.real univ / \u03bd.real univ)\n + \u03bd.real univ - \u03bc.real univ)\n \u2264 klDiv \u03bc \u03bd\n:= by .someMissingNamespaceXYZ\nby_cases h\u03bc\u03bd : \u03bc \u226a \u03bd\n swap; \u00b7 simp [h\u03bc\u03bd]\n by_cases h_int : Integrable (llr \u03bc \u03bd) \u03bc\n swap; \u00b7 simp [h_int]\n rw [\u2190 ENNReal.ofReal_toReal (a := klDiv \u03bc \u03bd)]\n \u00b7 exact ENNReal.ofReal_le_ofReal (mul_log_le_toReal_klDiv h\u03bc\u03bd h_int)\n \u00b7 rw [klDiv_ne_top_iff]\n exact \u27e8h\u03bc\u03bd, h_int\u27e9\n\nend Inequalities\n\n/-- **Converse Gibbs' inequality**: the Kullback-Leibler divergence between two finite measures is\nzero if and only if the two measures are equal. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=226, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=226, i_end=570, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=15, column=0), pos_end=Position(line=15, column=16), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=570, i_end=719, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=18, column=50), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/InformationTheory/KullbackLeibler/Basic.lean", "module": "Mathlib.InformationTheory.KullbackLeibler.Basic", "declaration": "Mathlib.InformationTheory.KullbackLeibler.Basic.mul_log_le_klDiv", "span": "L365-L381", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/InformationTheory/KullbackLeibler/Basic.lean#L365"}, "environment": {}, "measurements": {"input_tokens": 631, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2074, "lean_code_chars": 679, "natural_language_chars": 1395, "lean_code_ratio": 0.3274, "line_count": 29, "imports_count": 0, "declarations_count": 224, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "8adb29321866905b", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.ModelTheory.Satisfiability.IsSatisfiable", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.Satisfiability)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsSatisfiable.mono (h : T'.IsSatisfiable) (hs : T \u2286 T') : T.IsSatisfiable\n:= .someMissingNamespaceXYZ\n\u27e8(Theory.Model.mono (ModelType.is_model h.some) hs).bundled\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=176, messages=[Message(data=\"Invalid field notation: Type of\\n T'\\nis not known; cannot resolve field `IsSatisfiable`\\n\\nHint: Consider replacing the field projection `.IsSatisfiable` with a call to the function `FirstOrder.Language.Theory.IsSatisfiable`.\", pos=Position(line=1, column=32), pos_end=Position(line=1, column=48), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n T\\nis not known; cannot resolve field `IsSatisfiable`\\n\\nHint: Consider replacing the field projection `.IsSatisfiable` with a call to the function `FirstOrder.Language.Theory.IsSatisfiable`.', pos=Position(line=1, column=66), pos_end=Position(line=1, column=81), severity=, kind='lean.invalidField._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.Satisfiability).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsSatisfiable.mono (h : T'.IsSatisfiable) (hs : T \u2286 T') : T.IsSatisfiable\n:= .someMissingNamespaceXYZ\n\u27e8(Theory.Model.mono (ModelType.is_model h.some) hs).bundled\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=176, messages=[Message(data=\"Invalid field notation: Type of\\n T'\\nis not known; cannot resolve field `IsSatisfiable`\\n\\nHint: Consider replacing the field projection `.IsSatisfiable` with a call to the function `FirstOrder.Language.Theory.IsSatisfiable`.\", pos=Position(line=1, column=32), pos_end=Position(line=1, column=48), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n T\\nis not known; cannot resolve field `IsSatisfiable`\\n\\nHint: Consider replacing the field projection `.IsSatisfiable` with a call to the function `FirstOrder.Language.Theory.IsSatisfiable`.', pos=Position(line=1, column=66), pos_end=Position(line=1, column=81), severity=, kind='lean.invalidField._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/ModelTheory/Satisfiability.lean", "module": "Mathlib.ModelTheory.Satisfiability", "declaration": "Mathlib.ModelTheory.Satisfiability.IsSatisfiable", "span": "L78-L80", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/Satisfiability.lean#L78"}, "environment": {}, "measurements": {"input_tokens": 447, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1545, "lean_code_chars": 171, "natural_language_chars": 1374, "lean_code_ratio": 0.1107, "line_count": 14, "imports_count": 0, "declarations_count": 166, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4c61fe892202de42", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.RepresentationTheory.Rep.Basic.ofHom", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RepresentationTheory.Rep.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev ofHom (f : \u03c1.IntertwiningMap \u03c3) : of \u03c1 \u27f6 of \u03c3\n:= thisIsWrongLemmaNameXYZ\nConcreteCategory.ofHom (C := Rep.{w} k G) f\n\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=131, messages=[Message(data='Unknown identifier `\u03c1.IntertwiningMap`', pos=Position(line=1, column=18), pos_end=Position(line=1, column=35), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n of\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c1\\n\\nHint: The identifier `of` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=41), pos_end=Position(line=1, column=45), severity=, kind=None), Message(data=\"Function expected at\\n of\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c3\\n\\nHint: The identifier `of` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=48), pos_end=Position(line=1, column=52), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=131, i_end=202, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=71), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RepresentationTheory.Rep.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev ofHom (f : \u03c1.IntertwiningMap \u03c3) : of \u03c1 \u27f6 of \u03c3\n:= thisIsWrongLemmaNameXYZ\nConcreteCategory.ofHom (C := Rep.{w} k G) f\n\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=131, messages=[Message(data='Unknown identifier `\u03c1.IntertwiningMap`', pos=Position(line=1, column=18), pos_end=Position(line=1, column=35), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n of\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c1\\n\\nHint: The identifier `of` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=41), pos_end=Position(line=1, column=45), severity=, kind=None), Message(data=\"Function expected at\\n of\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c3\\n\\nHint: The identifier `of` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=48), pos_end=Position(line=1, column=52), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=131, i_end=202, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=71), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RepresentationTheory/Rep/Basic.lean", "module": "Mathlib.RepresentationTheory.Rep.Basic", "declaration": "Mathlib.RepresentationTheory.Rep.Basic.ofHom", "span": "L97-L100", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Rep/Basic.lean#L97"}, "environment": {}, "measurements": {"input_tokens": 734, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2715, "lean_code_chars": 197, "natural_language_chars": 2518, "lean_code_ratio": 0.0726, "line_count": 16, "imports_count": 0, "declarations_count": 349, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "524fe3b1caf3c116", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.AlgebraicGeometry.PullbackCarrier.range_snd_comp", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.PullbackCarrier)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma range_snd_comp :\n Set.range (pullback.snd f g \u226b g) = Set.range f \u2229 Set.range g\n:= by .someMissingNamespaceXYZ\nrw [\u2190 pullback.condition, range_fst_comp]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=55, messages=[Message(data='expected token', pos=Position(line=2, column=32), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=55, i_end=224, messages=[Message(data='unexpected end of input', pos=Position(line=6, column=56), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.PullbackCarrier).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma range_snd_comp :\n Set.range (pullback.snd f g \u226b g) = Set.range f \u2229 Set.range g\n:= by .someMissingNamespaceXYZ\nrw [\u2190 pullback.condition, range_fst_comp]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=55, messages=[Message(data='expected token', pos=Position(line=2, column=32), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=55, i_end=224, messages=[Message(data='unexpected end of input', pos=Position(line=6, column=56), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/AlgebraicGeometry/PullbackCarrier.lean", "module": "Mathlib.AlgebraicGeometry.PullbackCarrier", "declaration": "Mathlib.AlgebraicGeometry.PullbackCarrier.range_snd_comp", "span": "L353-L357", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/PullbackCarrier.lean#L353"}, "environment": {}, "measurements": {"input_tokens": 334, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1215, "lean_code_chars": 219, "natural_language_chars": 996, "lean_code_ratio": 0.1802, "line_count": 17, "imports_count": 0, "declarations_count": 128, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5ea9021bbdd7e98d", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "B-Mathlib.FieldTheory.NormalizedTrace.normalizedTrace_algebraMap_apply_eq_self", "category": "B", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.NormalizedTrace)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem normalizedTrace_algebraMap_apply_eq_self (a : F) :\n normalizedTrace F K (algebraMap F K a) = a\n:= by simp .someMissingNamespaceXYZ\n/-- The normalized trace map is a left inverse of the algebra map. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=117, messages=[Message(data=\"Function expected at\\n normalizedTrace\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n F\\n\\nHint: The identifier `normalizedTrace` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=42), severity=, kind=None), Message(data='unsolved goals\\nF : Sort u_1\\nx\u271d : Sort u_2\\nnormalizedTrace : x\u271d\\na : F\\n\u22a2 sorry () = a', pos=Position(line=3, column=3), pos_end=Position(line=3, column=10), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=117, i_end=211, messages=[Message(data=\"unexpected token '.'; expected command\", pos=Position(line=3, column=11), pos_end=Position(line=3, column=12), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=4, column=69), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.NormalizedTrace).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem normalizedTrace_algebraMap_apply_eq_self (a : F) :\n normalizedTrace F K (algebraMap F K a) = a\n:= by simp .someMissingNamespaceXYZ\n/-- The normalized trace map is a left inverse of the algebra map. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=117, messages=[Message(data=\"Function expected at\\n normalizedTrace\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n F\\n\\nHint: The identifier `normalizedTrace` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=42), severity=, kind=None), Message(data='unsolved goals\\nF : Sort u_1\\nx\u271d : Sort u_2\\nnormalizedTrace : x\u271d\\na : F\\n\u22a2 sorry () = a', pos=Position(line=3, column=3), pos_end=Position(line=3, column=10), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=117, i_end=211, messages=[Message(data=\"unexpected token '.'; expected command\", pos=Position(line=3, column=11), pos_end=Position(line=3, column=12), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=4, column=69), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/NormalizedTrace.lean", "module": "Mathlib.FieldTheory.NormalizedTrace", "declaration": "Mathlib.FieldTheory.NormalizedTrace.normalizedTrace_algebraMap_apply_eq_self", "span": "L237-L240", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/NormalizedTrace.lean#L237"}, "environment": {}, "measurements": {"input_tokens": 591, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2139, "lean_code_chars": 212, "natural_language_chars": 1927, "lean_code_ratio": 0.0991, "line_count": 15, "imports_count": 0, "declarations_count": 270, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "fb7c2235abd65a77", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.FieldTheory.RatFunc.Luroth.swap_\u03a6_natDegree_eq_\u03b8_natDegree", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.RatFunc.Luroth)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.RatFunc.Luroth.swap_\u03a6_natDegree_eq_\u03b8_natDegree`:\nState 0: \u22a2 lemma swap_\u03a6_natDegree_eq_\u03b8_natDegree (h : E \u2260 \u22a5) :\n (Bivariate.swap (\u03a6 E)).natDegree = (\u03b8 E).natDegree\nTactic: have := congr((Bivariate.swap $(Q\u2083_mul_\u03a6 h)).natDegree) rwa [map_mul, Polynomial.map_C, Bivariate.swap_C_C, natDegree_mul (C_ne_zero.mpr (Q\u2083_map h \u25b8 Q\u2082_ne_zero h)) ((map_ne_zero_iff _ Bivariate.swap.injective).mpr (\u03a6_ne_zero h)), natDegree_C, zero_add, swap_\u03b8, natDegree_neg] at this /-- L\u00fcroth's theorem. Any intermediate field between `K` and `K\u27eeX\u27ef` is generated by a single element `generator E`. See also `transcendental_generator` for the statement that the generator is transcendental if `E \u2260 \u22a5`. -/ public theorem eq_adjoin_generator : E = K\u27eegenerator E\u27ef := by by_cases h : E = \u22a5 \u00b7 rwa [generator_eq_zero h, adjoin_zero]\nState 1: \u22a2 \nTactic: refine le_antisymm (relfinrank_eq_one_iff.mp ?_) adjoin_generator_le suffices (\u03c6 E).natDegree = m E by\nState 2: \u22a2 \nTactic: refine (mul_eq_right\u2080 ?_).mp <| this \u25b8 (generator E).finrank_eq_max_natDegree \u25b8 \u03c6_natDegree h \u25b8 relfinrank_mul_finrank_top (adjoin_generator_le (E := E))\nState 3: \u22a2 \nTactic: intro H\nState 4: \u22a2 \nTactic: exact generator_ne_C h ((eq_C_iff _).mpr (Nat.max_eq_zero_iff.mp H))\nState 5: \u22a2 \nTactic: rw [\u2190 \u03a6_natDegree_eq_\u03c6_natDegree h, \u03a6_natDegree_eq_\u03b8_natDegree h]\nState 6: \u22a2 \nTactic: exact le_antisymm (\u03b8_natDegree_le h) (swap_\u03a6_natDegree_eq_\u03b8_natDegree h \u25b8 m_le_swap_\u03a6_natDegree h) /-- The `K`-algebra equivalence between `K\u27eeX\u27ef` and an intermediate field `E` given by sending `X` to `generator E`. See also `Luroth.eq_adjoin_generator`. -/ public def algEquiv (h : E \u2260 \u22a5) : K\u27eeX\u27ef \u2243\u2090[K] E := (algEquivOfTranscendental (generator E) (transcendental_of_ne_C _ (generator_ne_C h))).trans <| IntermediateField.equivOfEq eq_adjoin_generator.symm\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.RatFunc.Luroth).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.RatFunc.Luroth.swap_\u03a6_natDegree_eq_\u03b8_natDegree`:\nState 0: \u22a2 lemma swap_\u03a6_natDegree_eq_\u03b8_natDegree (h : E \u2260 \u22a5) :\n (Bivariate.swap (\u03a6 E)).natDegree = (\u03b8 E).natDegree\nTactic: have := congr((Bivariate.swap $(Q\u2083_mul_\u03a6 h)).natDegree) rwa [map_mul, Polynomial.map_C, Bivariate.swap_C_C, natDegree_mul (C_ne_zero.mpr (Q\u2083_map h \u25b8 Q\u2082_ne_zero h)) ((map_ne_zero_iff _ Bivariate.swap.injective).mpr (\u03a6_ne_zero h)), natDegree_C, zero_add, swap_\u03b8, natDegree_neg] at this /-- L\u00fcroth's theorem. Any intermediate field between `K` and `K\u27eeX\u27ef` is generated by a single element `generator E`. See also `transcendental_generator` for the statement that the generator is transcendental if `E \u2260 \u22a5`. -/ public theorem eq_adjoin_generator : E = K\u27eegenerator E\u27ef := by by_cases h : E = \u22a5 \u00b7 rwa [generator_eq_zero h, adjoin_zero]\nState 1: \u22a2 \nTactic: refine le_antisymm (relfinrank_eq_one_iff.mp ?_) adjoin_generator_le suffices (\u03c6 E).natDegree = m E by\nState 2: \u22a2 \nTactic: refine (mul_eq_right\u2080 ?_).mp <| this \u25b8 (generator E).finrank_eq_max_natDegree \u25b8 \u03c6_natDegree h \u25b8 relfinrank_mul_finrank_top (adjoin_generator_le (E := E))\nState 3: \u22a2 \nTactic: intro H\nState 4: \u22a2 \nTactic: exact generator_ne_C h ((eq_C_iff _).mpr (Nat.max_eq_zero_iff.mp H))\nState 5: \u22a2 \nTactic: rw [\u2190 \u03a6_natDegree_eq_\u03c6_natDegree h, \u03a6_natDegree_eq_\u03b8_natDegree h]\nState 6: \u22a2 \nTactic: exact le_antisymm (\u03b8_natDegree_le h) (swap_\u03a6_natDegree_eq_\u03b8_natDegree h \u25b8 m_le_swap_\u03a6_natDegree h) /-- The `K`-algebra equivalence between `K\u27eeX\u27ef` and an intermediate field `E` given by sending `X` to `generator E`. See also `Luroth.eq_adjoin_generator`. -/ public def algEquiv (h : E \u2260 \u22a5) : K\u27eeX\u27ef \u2243\u2090[K] E := (algEquivOfTranscendental (generator E) (transcendental_of_ne_C _ (generator_ne_C h))).trans <| IntermediateField.equivOfEq eq_adjoin_generator.symm\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/RatFunc/Luroth.lean", "module": "Mathlib.FieldTheory.RatFunc.Luroth", "declaration": "Mathlib.FieldTheory.RatFunc.Luroth.swap_\u03a6_natDegree_eq_\u03b8_natDegree", "span": "L634-L662", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/RatFunc/Luroth.lean#L634"}, "environment": {}, "measurements": {"input_tokens": 973, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2797, "lean_code_chars": 0, "natural_language_chars": 2797, "lean_code_ratio": 0.0, "line_count": 22, "imports_count": 0, "declarations_count": 320, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "edf9d144045a6436", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.MeasureTheory.Function.EssSup.essSup_map_measure_of_measurable", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.EssSup)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.MeasureTheory.Function.EssSup.essSup_map_measure_of_measurable`:\nState 0: \u22a2 theorem essSup_map_measure_of_measurable (hg : Measurable g) (hf : AEMeasurable f \u03bc) :\n essSup g (Measure.map f \u03bc) = essSup (g \u2218 f) \u03bc\nTactic: refine le_antisymm ?_ (essSup_comp_le_essSup_map_measure hf)\nState 1: \u22a2 \nTactic: refine limsSup_le_limsSup (by isBoundedDefault) (by isBoundedDefault) (fun c h_le => ?_)\nState 2: \u22a2 ?_)>\nTactic: rw [eventually_map] at h_le \u22a2\nState 3: \u22a2 \nTactic: rw [ae_map_iff hf (measurableSet_le hg measurable_const)]\nState 4: \u22a2 \nTactic: exact h_le\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.EssSup).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.MeasureTheory.Function.EssSup.essSup_map_measure_of_measurable`:\nState 0: \u22a2 theorem essSup_map_measure_of_measurable (hg : Measurable g) (hf : AEMeasurable f \u03bc) :\n essSup g (Measure.map f \u03bc) = essSup (g \u2218 f) \u03bc\nTactic: refine le_antisymm ?_ (essSup_comp_le_essSup_map_measure hf)\nState 1: \u22a2 \nTactic: refine limsSup_le_limsSup (by isBoundedDefault) (by isBoundedDefault) (fun c h_le => ?_)\nState 2: \u22a2 ?_)>\nTactic: rw [eventually_map] at h_le \u22a2\nState 3: \u22a2 \nTactic: rw [ae_map_iff hf (measurableSet_le hg measurable_const)]\nState 4: \u22a2 \nTactic: exact h_le\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Function/EssSup.lean", "module": "Mathlib.MeasureTheory.Function.EssSup", "declaration": "Mathlib.MeasureTheory.Function.EssSup.essSup_map_measure_of_measurable", "span": "L250-L257", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Function/EssSup.lean#L250"}, "environment": {}, "measurements": {"input_tokens": 458, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1408, "lean_code_chars": 0, "natural_language_chars": 1408, "lean_code_ratio": 0.0, "line_count": 18, "imports_count": 0, "declarations_count": 157, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "fa30454d31af950a", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.Probability.Martingale.BorelCantelli.Submartingale", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Martingale.BorelCantelli)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.Probability.Martingale.BorelCantelli.Submartingale`:\nState 0: \u22a2 theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure \u03bc]\n (hf : Submartingale f \u2131 \u03bc) (hf0 : f 0 = 0) (hbdd : \u2200\u1d50 \u03c9 \u2202\u03bc, \u2200 i, |f (i + 1) \u03c9 - f i \u03c9| \u2264 R) :\n \u2200\u1d50 \u03c9 \u2202\u03bc, BddAbove (Set.range fun n => f n \u03c9) \u2192 \u2203 c, Tendsto (fun n => f n \u03c9) atTop (\ud835\udcdd c)\nTactic: have ht : \u2200\u1d50 \u03c9 \u2202\u03bc, \u2200 i : \u2115, \u2203 c, Tendsto (fun n => stoppedAbove f i n \u03c9) atTop (\ud835\udcdd c) := by\nState 1: \u22a2 stoppedAbove f i n \u03c9) atTop (\ud835\udcdd c) := by>\nTactic: rw [ae_all_iff]\nState 2: \u22a2 \nTactic: exact fun i \u21a6 Submartingale.exists_ae_tendsto_of_bdd (hf.stoppedAbove i) (hf.eLpNorm_stoppedAbove_le' i.cast_nonneg hf0 hbdd) filter_upwards [ht] with \u03c9 h\u03c9 h\u03c9b\nState 3: \u22a2 \nTactic: rw [BddAbove] at h\u03c9b\nState 4: \u22a2 \nTactic: obtain \u27e8i, hi\u27e9 := exists_nat_gt h\u03c9b.some\nState 5: \u22a2 \nTactic: have hib : \u2200 n, f n \u03c9 < i := by\nState 6: \u22a2 \nTactic: intro n\nState 7: \u22a2 \nTactic: exact lt_of_le_of_lt ((mem_upperBounds.1 h\u03c9b.some_mem) _ \u27e8n, rfl\u27e9) hi\nState 8: \u22a2 \nTactic: have heq : \u2200 n, stoppedAbove f i n \u03c9 = f n \u03c9 := by\nState 9: \u22a2 \nTactic: intro n\nState 10: \u22a2 \nTactic: rw [stoppedAbove, stoppedProcess, leastGE, hittingAfter_eq_top_iff.mpr] \u00b7 simp only [le_top, inf_of_le_left] congr \u00b7 simp [hib]\nState 11: \u22a2 \nTactic: simp only [\u2190 heq, h\u03c9 i]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Probability.Martingale.BorelCantelli).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.Probability.Martingale.BorelCantelli.Submartingale`:\nState 0: \u22a2 theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure \u03bc]\n (hf : Submartingale f \u2131 \u03bc) (hf0 : f 0 = 0) (hbdd : \u2200\u1d50 \u03c9 \u2202\u03bc, \u2200 i, |f (i + 1) \u03c9 - f i \u03c9| \u2264 R) :\n \u2200\u1d50 \u03c9 \u2202\u03bc, BddAbove (Set.range fun n => f n \u03c9) \u2192 \u2203 c, Tendsto (fun n => f n \u03c9) atTop (\ud835\udcdd c)\nTactic: have ht : \u2200\u1d50 \u03c9 \u2202\u03bc, \u2200 i : \u2115, \u2203 c, Tendsto (fun n => stoppedAbove f i n \u03c9) atTop (\ud835\udcdd c) := by\nState 1: \u22a2 stoppedAbove f i n \u03c9) atTop (\ud835\udcdd c) := by>\nTactic: rw [ae_all_iff]\nState 2: \u22a2 \nTactic: exact fun i \u21a6 Submartingale.exists_ae_tendsto_of_bdd (hf.stoppedAbove i) (hf.eLpNorm_stoppedAbove_le' i.cast_nonneg hf0 hbdd) filter_upwards [ht] with \u03c9 h\u03c9 h\u03c9b\nState 3: \u22a2 \nTactic: rw [BddAbove] at h\u03c9b\nState 4: \u22a2 \nTactic: obtain \u27e8i, hi\u27e9 := exists_nat_gt h\u03c9b.some\nState 5: \u22a2 \nTactic: have hib : \u2200 n, f n \u03c9 < i := by\nState 6: \u22a2 \nTactic: intro n\nState 7: \u22a2 \nTactic: exact lt_of_le_of_lt ((mem_upperBounds.1 h\u03c9b.some_mem) _ \u27e8n, rfl\u27e9) hi\nState 8: \u22a2 \nTactic: have heq : \u2200 n, stoppedAbove f i n \u03c9 = f n \u03c9 := by\nState 9: \u22a2 \nTactic: intro n\nState 10: \u22a2 \nTactic: rw [stoppedAbove, stoppedProcess, leastGE, hittingAfter_eq_top_iff.mpr] \u00b7 simp only [le_top, inf_of_le_left] congr \u00b7 simp [hib]\nState 11: \u22a2 \nTactic: simp only [\u2190 heq, h\u03c9 i]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Probability/Martingale/BorelCantelli.lean", "module": "Mathlib.Probability.Martingale.BorelCantelli", "declaration": "Mathlib.Probability.Martingale.BorelCantelli.Submartingale", "span": "L128-L148", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Martingale/BorelCantelli.lean#L128"}, "environment": {}, "measurements": {"input_tokens": 947, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2411, "lean_code_chars": 0, "natural_language_chars": 2411, "lean_code_ratio": 0.0, "line_count": 33, "imports_count": 0, "declarations_count": 305, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6b67c1962740fb21", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.InformationTheory.KullbackLeibler.KLFun.deriv_klFun", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.KullbackLeibler.KLFun)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.InformationTheory.KullbackLeibler.KLFun.deriv_klFun`:\nState 0: \u22a2 lemma deriv_klFun : deriv klFun = log\nTactic: ext x by_cases h0 : x = 0 \u00b7 simp only [h0, log_zero]\nState 1: \u22a2 \nTactic: exact deriv_zero_of_not_differentiableAt not_differentiableAt_klFun_zero \u00b7 exact (hasDerivAt_klFun h0).deriv\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.KullbackLeibler.KLFun).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.InformationTheory.KullbackLeibler.KLFun.deriv_klFun`:\nState 0: \u22a2 lemma deriv_klFun : deriv klFun = log\nTactic: ext x by_cases h0 : x = 0 \u00b7 simp only [h0, log_zero]\nState 1: \u22a2 \nTactic: exact deriv_zero_of_not_differentiableAt not_differentiableAt_klFun_zero \u00b7 exact (hasDerivAt_klFun h0).deriv\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/InformationTheory/KullbackLeibler/KLFun.lean", "module": "Mathlib.InformationTheory.KullbackLeibler.KLFun", "declaration": "Mathlib.InformationTheory.KullbackLeibler.KLFun.deriv_klFun", "span": "L99-L105", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/InformationTheory/KullbackLeibler/KLFun.lean#L99"}, "environment": {}, "measurements": {"input_tokens": 267, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 896, "lean_code_chars": 0, "natural_language_chars": 896, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 101, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "af770e149ca274f1", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed.universallyClosed_eq_universallySpecializing", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed.universallyClosed_eq_universallySpecializing`:\nState 0: \u22a2 lemma universallyClosed_eq_universallySpecializing :\n @UniversallyClosed = (topologically @SpecializingMap).universally \u2293 @QuasiCompact\nTactic: rw [\u2190 universally_eq_iff (P := @QuasiCompact).mpr inferInstance, \u2190 universally_inf]\nState 1: \u22a2 \nTactic: apply le_antisymm \u00b7 rw [\u2190 universally_eq_iff (P := @UniversallyClosed).mpr inferInstance]\nState 2: \u22a2 \nTactic: exact universally_mono fun X Y f H \u21a6 \u27e8f.isClosedMap.specializingMap, inferInstance\u27e9 \u00b7 rw [universallyClosed_eq]\nState 3: \u22a2 \nTactic: exact universally_mono fun X Y f \u27e8h\u2081, h\u2082\u27e9 \u21a6 (isClosedMap_iff_specializingMap _).mpr h\u2081\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed.universallyClosed_eq_universallySpecializing`:\nState 0: \u22a2 lemma universallyClosed_eq_universallySpecializing :\n @UniversallyClosed = (topologically @SpecializingMap).universally \u2293 @QuasiCompact\nTactic: rw [\u2190 universally_eq_iff (P := @QuasiCompact).mpr inferInstance, \u2190 universally_inf]\nState 1: \u22a2 \nTactic: apply le_antisymm \u00b7 rw [\u2190 universally_eq_iff (P := @UniversallyClosed).mpr inferInstance]\nState 2: \u22a2 \nTactic: exact universally_mono fun X Y f H \u21a6 \u27e8f.isClosedMap.specializingMap, inferInstance\u27e9 \u00b7 rw [universallyClosed_eq]\nState 3: \u22a2 \nTactic: exact universally_mono fun X Y f \u27e8h\u2081, h\u2082\u27e9 \u21a6 (isClosedMap_iff_specializingMap _).mpr h\u2081\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/AlgebraicGeometry/Morphisms/UniversallyClosed.lean", "module": "Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed", "declaration": "Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed.universallyClosed_eq_universallySpecializing", "span": "L167-L175", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/Morphisms/UniversallyClosed.lean#L167"}, "environment": {}, "measurements": {"input_tokens": 442, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1496, "lean_code_chars": 0, "natural_language_chars": 1496, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 149, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9c76252de99b8e5d", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.FieldTheory.SeparableClosure.IsSepClosed", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.SeparableClosure)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.SeparableClosure.IsSepClosed`:\nState 0: \u22a2 theorem IsSepClosed.separableClosure_eq_bot_iff [IsSepClosed E] :\n separableClosure F E = \u22a5 \u2194 IsSepClosed F\nTactic: refine \u27e8fun h \u21a6 IsSepClosed.of_exists_root _ fun p _ hirr hsep \u21a6 ?_, fun _ \u21a6 IntermediateField.eq_bot_of_isSepClosed_of_isSeparable _\u27e9\nState 1: \u22a2 \nTactic: obtain \u27e8x, hx\u27e9 := IsSepClosed.exists_aeval_eq_zero E p (degree_pos_of_irreducible hirr).ne' hsep\nState 2: \u22a2 \nTactic: obtain \u27e8x, rfl\u27e9 := h \u25b8 mem_separableClosure_iff.2 (hsep.of_dvd <| minpoly.dvd _ x hx)\nState 3: \u22a2 \nTactic: exact \u27e8x, by simpa [Algebra.ofId_apply] using hx\u27e9 /-- If `E` is separably closed, then the separable closure of `F` in `E` is an absolute separable closure of `F`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.SeparableClosure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.SeparableClosure.IsSepClosed`:\nState 0: \u22a2 theorem IsSepClosed.separableClosure_eq_bot_iff [IsSepClosed E] :\n separableClosure F E = \u22a5 \u2194 IsSepClosed F\nTactic: refine \u27e8fun h \u21a6 IsSepClosed.of_exists_root _ fun p _ hirr hsep \u21a6 ?_, fun _ \u21a6 IntermediateField.eq_bot_of_isSepClosed_of_isSeparable _\u27e9\nState 1: \u22a2 \nTactic: obtain \u27e8x, hx\u27e9 := IsSepClosed.exists_aeval_eq_zero E p (degree_pos_of_irreducible hirr).ne' hsep\nState 2: \u22a2 \nTactic: obtain \u27e8x, rfl\u27e9 := h \u25b8 mem_separableClosure_iff.2 (hsep.of_dvd <| minpoly.dvd _ x hx)\nState 3: \u22a2 \nTactic: exact \u27e8x, by simpa [Algebra.ofId_apply] using hx\u27e9 /-- If `E` is separably closed, then the separable closure of `F` in `E` is an absolute separable closure of `F`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/SeparableClosure.lean", "module": "Mathlib.FieldTheory.SeparableClosure", "declaration": "Mathlib.FieldTheory.SeparableClosure.IsSepClosed", "span": "L194-L203", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/SeparableClosure.lean#L194"}, "environment": {}, "measurements": {"input_tokens": 526, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1580, "lean_code_chars": 0, "natural_language_chars": 1580, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 188, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "71de3df6401ae4cb", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.MeasureTheory.OuterMeasure.OfFunction.comap_ofFunction", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.OuterMeasure.OfFunction)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.MeasureTheory.OuterMeasure.OfFunction.comap_ofFunction`:\nState 0: \u22a2 theorem comap_ofFunction {\u03b2} (f : \u03b2 \u2192 \u03b1) (h : Monotone m \u2228 Surjective f) :\n comap f (OuterMeasure.ofFunction m m_empty) =\n OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty])\nTactic: refine le_antisymm (le_ofFunction.2 fun s => ?_) fun s => ?_ \u00b7 rw [comap_apply]\nState 1: \u22a2 ?_) fun s => ?_>\nTactic: apply ofFunction_le \u00b7 rw [comap_apply, ofFunction_apply, ofFunction_apply]\nState 2: \u22a2 \nTactic: refine iInf_mono' fun t => \u27e8fun k => f \u207b\u00b9' t k, ?_\u27e9\nState 3: \u22a2 \u27e8fun k => f \u207b\u00b9' t k, ?_\u27e9>\nTactic: refine iInf_mono' fun ht => ?_\nState 4: \u22a2 ?_>\nTactic: rw [Set.image_subset_iff, preimage_iUnion] at ht\nState 5: \u22a2 \nTactic: refine \u27e8ht, ENNReal.tsum_le_tsum fun n => ?_\u27e9 rcases h with hl | hr exacts [hl (image_preimage_subset _ _), (congr_arg m (hr.image_preimage (t n))).le]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.OuterMeasure.OfFunction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.MeasureTheory.OuterMeasure.OfFunction.comap_ofFunction`:\nState 0: \u22a2 theorem comap_ofFunction {\u03b2} (f : \u03b2 \u2192 \u03b1) (h : Monotone m \u2228 Surjective f) :\n comap f (OuterMeasure.ofFunction m m_empty) =\n OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty])\nTactic: refine le_antisymm (le_ofFunction.2 fun s => ?_) fun s => ?_ \u00b7 rw [comap_apply]\nState 1: \u22a2 ?_) fun s => ?_>\nTactic: apply ofFunction_le \u00b7 rw [comap_apply, ofFunction_apply, ofFunction_apply]\nState 2: \u22a2 \nTactic: refine iInf_mono' fun t => \u27e8fun k => f \u207b\u00b9' t k, ?_\u27e9\nState 3: \u22a2 \u27e8fun k => f \u207b\u00b9' t k, ?_\u27e9>\nTactic: refine iInf_mono' fun ht => ?_\nState 4: \u22a2 ?_>\nTactic: rw [Set.image_subset_iff, preimage_iUnion] at ht\nState 5: \u22a2 \nTactic: refine \u27e8ht, ENNReal.tsum_le_tsum fun n => ?_\u27e9 rcases h with hl | hr exacts [hl (image_preimage_subset _ _), (congr_arg m (hr.image_preimage (t n))).le]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/OuterMeasure/OfFunction.lean", "module": "Mathlib.MeasureTheory.OuterMeasure.OfFunction", "declaration": "Mathlib.MeasureTheory.OuterMeasure.OfFunction.comap_ofFunction", "span": "L189-L202", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/OuterMeasure/OfFunction.lean#L189"}, "environment": {}, "measurements": {"input_tokens": 560, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1675, "lean_code_chars": 0, "natural_language_chars": 1675, "lean_code_ratio": 0.0, "line_count": 21, "imports_count": 0, "declarations_count": 207, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "88069751a2d5e810", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.InformationTheory.KullbackLeibler.Basic.klDiv_smul_same", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.KullbackLeibler.Basic)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.InformationTheory.KullbackLeibler.Basic.klDiv_smul_same`:\nState 0: \u22a2 lemma klDiv_smul_same [IsFiniteMeasure \u03bc] [IsFiniteMeasure \u03bd] (c : \u211d\u22650) :\n klDiv (c \u2022 \u03bc) (c \u2022 \u03bd) = c * klDiv \u03bc \u03bd\nTactic: have hc' : (c : \u211d\u22650\u221e) \u2260 0 := by simpa\nState 1: \u22a2 \nTactic: have h\u03bc_smul (\u03bc : Measure \u03b1) : \u03bc = c\u207b\u00b9 \u2022 (c \u2022 \u03bc) := by\nState 2: \u22a2 \nTactic: rw [smul_smul, inv_mul_cancel\u2080 hc, one_smul] by_cases h\u03bc\u03bd : \u03bc \u226a \u03bd swap \u00b7 rw [klDiv_of_not_ac h\u03bc\u03bd, klDiv_of_not_ac, ENNReal.mul_top hc']\nState 3: \u22a2 \nTactic: refine fun h_contra \u21a6 h\u03bc\u03bd ?_\nState 4: \u22a2 \nTactic: rw [h\u03bc_smul \u03bc, h\u03bc_smul \u03bd]\nState 5: \u22a2 \nTactic: exact h_contra.smul _ by_cases h_int : Integrable (llr \u03bc \u03bd) \u03bc swap \u00b7 rw [klDiv_of_not_integrable h_int, klDiv_of_not_integrable, ENNReal.mul_top hc']\nState 6: \u22a2 \nTactic: refine fun h_contra \u21a6 h_int ?_\nState 7: \u22a2 \nTactic: rw [h\u03bc_smul \u03bc, h\u03bc_smul \u03bd]\nState 8: \u22a2 \nTactic: refine Integrable.smul_measure_nnreal ?_\nState 9: \u22a2 \nTactic: rw [integrable_congr (llr_smul_nnreal_same (h\u03bc\u03bd.smul c) c\u207b\u00b9 (by simpa))] fun_prop\nState 10: \u22a2 \nTactic: rw [\u2190 ENNReal.ofReal_toReal (klDiv_ne_top (h\u03bc\u03bd.smul c) _), \u2190 ENNReal.ofReal_toReal (klDiv_ne_top h\u03bc\u03bd h_int)] swap \u00b7 refine Integrable.smul_measure_nnreal ?_\nState 11: \u22a2 \nTactic: rw [integrable_congr (llr_smul_nnreal_same h\u03bc\u03bd c hc)] fun_prop\nState 12: \u22a2 \nTactic: simp [toReal_klDiv_smul_same h\u03bc\u03bd h_int] section Inequalities variable [IsFiniteMeasure \u03bc] [IsFiniteMeasure \u03bd]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.InformationTheory.KullbackLeibler.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.InformationTheory.KullbackLeibler.Basic.klDiv_smul_same`:\nState 0: \u22a2 lemma klDiv_smul_same [IsFiniteMeasure \u03bc] [IsFiniteMeasure \u03bd] (c : \u211d\u22650) :\n klDiv (c \u2022 \u03bc) (c \u2022 \u03bd) = c * klDiv \u03bc \u03bd\nTactic: have hc' : (c : \u211d\u22650\u221e) \u2260 0 := by simpa\nState 1: \u22a2 \nTactic: have h\u03bc_smul (\u03bc : Measure \u03b1) : \u03bc = c\u207b\u00b9 \u2022 (c \u2022 \u03bc) := by\nState 2: \u22a2 \nTactic: rw [smul_smul, inv_mul_cancel\u2080 hc, one_smul] by_cases h\u03bc\u03bd : \u03bc \u226a \u03bd swap \u00b7 rw [klDiv_of_not_ac h\u03bc\u03bd, klDiv_of_not_ac, ENNReal.mul_top hc']\nState 3: \u22a2 \nTactic: refine fun h_contra \u21a6 h\u03bc\u03bd ?_\nState 4: \u22a2 \nTactic: rw [h\u03bc_smul \u03bc, h\u03bc_smul \u03bd]\nState 5: \u22a2 \nTactic: exact h_contra.smul _ by_cases h_int : Integrable (llr \u03bc \u03bd) \u03bc swap \u00b7 rw [klDiv_of_not_integrable h_int, klDiv_of_not_integrable, ENNReal.mul_top hc']\nState 6: \u22a2 \nTactic: refine fun h_contra \u21a6 h_int ?_\nState 7: \u22a2 \nTactic: rw [h\u03bc_smul \u03bc, h\u03bc_smul \u03bd]\nState 8: \u22a2 \nTactic: refine Integrable.smul_measure_nnreal ?_\nState 9: \u22a2 \nTactic: rw [integrable_congr (llr_smul_nnreal_same (h\u03bc\u03bd.smul c) c\u207b\u00b9 (by simpa))] fun_prop\nState 10: \u22a2 \nTactic: rw [\u2190 ENNReal.ofReal_toReal (klDiv_ne_top (h\u03bc\u03bd.smul c) _), \u2190 ENNReal.ofReal_toReal (klDiv_ne_top h\u03bc\u03bd h_int)] swap \u00b7 refine Integrable.smul_measure_nnreal ?_\nState 11: \u22a2 \nTactic: rw [integrable_congr (llr_smul_nnreal_same h\u03bc\u03bd c hc)] fun_prop\nState 12: \u22a2 \nTactic: simp [toReal_klDiv_smul_same h\u03bc\u03bd h_int] section Inequalities variable [IsFiniteMeasure \u03bc] [IsFiniteMeasure \u03bd]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/InformationTheory/KullbackLeibler/Basic.lean", "module": "Mathlib.InformationTheory.KullbackLeibler.Basic", "declaration": "Mathlib.InformationTheory.KullbackLeibler.Basic.klDiv_smul_same", "span": "L291-L323", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/InformationTheory/KullbackLeibler/Basic.lean#L291"}, "environment": {}, "measurements": {"input_tokens": 1049, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2618, "lean_code_chars": 0, "natural_language_chars": 2618, "lean_code_ratio": 0.0, "line_count": 34, "imports_count": 0, "declarations_count": 301, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "29cac63f93c4e1f9", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.ModelTheory.Substructures.codRestrict", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.Substructures)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.ModelTheory.Substructures.codRestrict`:\nState 0: \u22a2 def codRestrict (p : L.Substructure N) (f : M \u21aa[L] N) (h : \u2200 c, f c \u2208 p) : M \u21aa[L] p where\n toFun\nTactic: rw [\u2190 p.subtype.map_rel] change RelMap r (Hom.comp p.subtype.toHom (f.toHom.codRestrict p h) \u2218 x) \u2194 _\nState 1: \u22a2 \nTactic: rw [Hom.subtype_comp_codRestrict, \u2190 f.map_rel]\nState 2: \u22a2 \nTactic: rfl\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.ModelTheory.Substructures).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.ModelTheory.Substructures.codRestrict`:\nState 0: \u22a2 def codRestrict (p : L.Substructure N) (f : M \u21aa[L] N) (h : \u2200 c, f c \u2208 p) : M \u21aa[L] p where\n toFun\nTactic: rw [\u2190 p.subtype.map_rel] change RelMap r (Hom.comp p.subtype.toHom (f.toHom.codRestrict p h) \u2218 x) \u2194 _\nState 1: \u22a2 \nTactic: rw [Hom.subtype_comp_codRestrict, \u2190 f.map_rel]\nState 2: \u22a2 \nTactic: rfl\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/ModelTheory/Substructures.lean", "module": "Mathlib.ModelTheory.Substructures", "declaration": "Mathlib.ModelTheory.Substructures.codRestrict", "span": "L865-L874", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/Substructures.lean#L865"}, "environment": {}, "measurements": {"input_tokens": 327, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1015, "lean_code_chars": 0, "natural_language_chars": 1015, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 122, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "479382d46552ff7b", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.FieldTheory.IsAlgClosed.Classification.ringEquiv_of_equiv_of_char_eq", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.IsAlgClosed.Classification)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.IsAlgClosed.Classification.ringEquiv_of_equiv_of_char_eq`:\nState 0: \u22a2 theorem ringEquiv_of_equiv_of_char_eq (p : \u2115) [CharP K p] [CharP L p] (hK : \u2135\u2080 < #K)\n (hKL : Nonempty (K \u2243 L)) : Nonempty (K \u2243+* L)\nTactic: exact ringEquiv_of_Cardinal_eq_of_charP p hK hKL \u00b7 simp only [hp] at * letI : CharZero K := CharP.charP_to_charZero K letI : CharZero L := CharP.charP_to_charZero L\nState 1: \u22a2 \nTactic: exact ringEquiv_of_equiv_of_charZero hK hKL end IsAlgClosed\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.FieldTheory.IsAlgClosed.Classification).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.IsAlgClosed.Classification.ringEquiv_of_equiv_of_char_eq`:\nState 0: \u22a2 theorem ringEquiv_of_equiv_of_char_eq (p : \u2115) [CharP K p] [CharP L p] (hK : \u2135\u2080 < #K)\n (hKL : Nonempty (K \u2243 L)) : Nonempty (K \u2243+* L)\nTactic: exact ringEquiv_of_Cardinal_eq_of_charP p hK hKL \u00b7 simp only [hp] at * letI : CharZero K := CharP.charP_to_charZero K letI : CharZero L := CharP.charP_to_charZero L\nState 1: \u22a2 \nTactic: exact ringEquiv_of_equiv_of_charZero hK hKL end IsAlgClosed\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/FieldTheory/IsAlgClosed/Classification.lean", "module": "Mathlib.FieldTheory.IsAlgClosed.Classification", "declaration": "Mathlib.FieldTheory.IsAlgClosed.Classification.ringEquiv_of_equiv_of_char_eq", "span": "L193-L203", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/IsAlgClosed/Classification.lean#L193"}, "environment": {}, "measurements": {"input_tokens": 352, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1116, "lean_code_chars": 0, "natural_language_chars": 1116, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 126, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "01d431ff9a4b0f02", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.MeasureTheory.Integral.BoundedContinuousFunction.norm_integral_le_mul_norm", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Integral.BoundedContinuousFunction)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.MeasureTheory.Integral.BoundedContinuousFunction.norm_integral_le_mul_norm`:\nState 0: \u22a2 lemma norm_integral_le_mul_norm [IsFiniteMeasure \u03bc] (f : X \u2192\u1d47 E) :\n \u2016\u222b x, f x \u2202\u03bc\u2016 \u2264 \u03bc.real Set.univ * \u2016f\u2016\nTactic: calc \u2016\u222b x, f x \u2202\u03bc\u2016 _ \u2264 \u222b x, \u2016f x\u2016 \u2202\u03bc := norm_integral_le_integral_norm _ _ \u2264 \u222b _, \u2016f\u2016 \u2202\u03bc := ?_ _ = \u03bc.real Set.univ \u2022 \u2016f\u2016 := by rw [integral_const]\nState 1: \u22a2 \nTactic: apply integral_mono _ (integrable_const \u2016f\u2016) (fun x \u21a6 f.norm_coe_le_norm x) -- NOTE: `gcongr`?\nState 2: \u22a2 \nTactic: exact (integrable_norm_iff f.continuous.measurable.aestronglyMeasurable).mpr (f.integrable \u03bc)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Integral.BoundedContinuousFunction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.MeasureTheory.Integral.BoundedContinuousFunction.norm_integral_le_mul_norm`:\nState 0: \u22a2 lemma norm_integral_le_mul_norm [IsFiniteMeasure \u03bc] (f : X \u2192\u1d47 E) :\n \u2016\u222b x, f x \u2202\u03bc\u2016 \u2264 \u03bc.real Set.univ * \u2016f\u2016\nTactic: calc \u2016\u222b x, f x \u2202\u03bc\u2016 _ \u2264 \u222b x, \u2016f x\u2016 \u2202\u03bc := norm_integral_le_integral_norm _ _ \u2264 \u222b _, \u2016f\u2016 \u2202\u03bc := ?_ _ = \u03bc.real Set.univ \u2022 \u2016f\u2016 := by rw [integral_const]\nState 1: \u22a2 \nTactic: apply integral_mono _ (integrable_const \u2016f\u2016) (fun x \u21a6 f.norm_coe_le_norm x) -- NOTE: `gcongr`?\nState 2: \u22a2 \nTactic: exact (integrable_norm_iff f.continuous.measurable.aestronglyMeasurable).mpr (f.integrable \u03bc)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/MeasureTheory/Integral/BoundedContinuousFunction.lean", "module": "Mathlib.MeasureTheory.Integral.BoundedContinuousFunction", "declaration": "Mathlib.MeasureTheory.Integral.BoundedContinuousFunction.norm_integral_le_mul_norm", "span": "L103-L111", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Integral/BoundedContinuousFunction.lean#L103"}, "environment": {}, "measurements": {"input_tokens": 468, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1315, "lean_code_chars": 0, "natural_language_chars": 1315, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 146, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d38437e44710d635", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}} {"sample_id": "E-Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic.map_\u03a6", "category": "E", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic)."}, {"role": "user", "content": "The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic.map_\u03a6`:\nState 0: \u22a2 lemma map_\u03a6 (n : \u2124) : (W.map f).\u03a6 n = (W.\u03a6 n).map f\nTactic: rw [\u2190 coe_mapRingHom]\nState 1: \u22a2 \nTactic: simp [\u03a6, map_sub, apply_ite <| mapRingHom f]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic.map_\u03a6`:\nState 0: \u22a2 lemma map_\u03a6 (n : \u2124) : (W.map f).\u03a6 n = (W.\u03a6 n).map f\nTactic: rw [\u2190 coe_mapRingHom]\nState 1: \u22a2 \nTactic: simp [\u03a6, map_sub, apply_ite <| mapRingHom f]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/AlgebraicGeometry/EllipticCurve/DivisionPolynomial/Basic.lean", "module": "Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic", "declaration": "Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic.map_\u03a6", "span": "L531-L534", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/EllipticCurve/DivisionPolynomial/Basic.lean#L531"}, "environment": {}, "measurements": {"input_tokens": 260, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 856, "lean_code_chars": 0, "natural_language_chars": 856, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "01d9a7ef670b6067", "near_duplicate_cluster_id": "", "triviality_score": 0.0, "hidden_proof_leakage": "none", "provenance_complete": true}, "admission": {"accepted_for_ptq_calibration": true, "reason_codes": [], "decision_layer": "deterministic"}}