{"sample_id": "A-Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.finrank_add_inf_finrank_orthogonal'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem finrank_add_inf_finrank_orthogonal' {K\u2081 K\u2082 : Submodule \ud835\udd5c E}\n [FiniteDimensional \ud835\udd5c K\u2082] (h : K\u2081 \u2264 K\u2082) {n : \u2115} (h_dim : finrank \ud835\udd5c K\u2081 + n = finrank \ud835\udd5c K\u2082) :\n finrank \ud835\udd5c (K\u2081\u15ee \u2293 K\u2082 : Submodule \ud835\udd5c E) = n\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.Analysis.InnerProductSpace.Projection.FiniteDimensional).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem finrank_add_inf_finrank_orthogonal' {K\u2081 K\u2082 : Submodule \ud835\udd5c E}\n [FiniteDimensional \ud835\udd5c K\u2082] (h : K\u2081 \u2264 K\u2082) {n : \u2115} (h_dim : finrank \ud835\udd5c K\u2081 + n = finrank \ud835\udd5c K\u2082) :\n finrank \ud835\udd5c (K\u2081\u15ee \u2293 K\u2082 : Submodule \ud835\udd5c E) = n\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/Analysis/InnerProductSpace/Projection/FiniteDimensional.lean", "module": "Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional", "declaration": "Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.finrank_add_inf_finrank_orthogonal'", "span": "L104-L111", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/Projection/FiniteDimensional.lean#L104"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 232, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 647, "lean_code_chars": 208, "natural_language_chars": 439, "lean_code_ratio": 0.3215, "line_count": 9, "imports_count": 0, "declarations_count": 70, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "33b381e15fb57ac0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Group.Submonoid.Saturation.saturation_sSup", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Submonoid.Saturation)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem saturation_sSup {f : Set (Submonoid M)} :\n (sSup f).saturation = \u2a06 s \u2208 f, s.saturation\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.Algebra.Group.Submonoid.Saturation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem saturation_sSup {f : Set (Submonoid M)} :\n (sSup f).saturation = \u2a06 s \u2208 f, s.saturation\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/Algebra/Group/Submonoid/Saturation.lean", "module": "Mathlib.Algebra.Group.Submonoid.Saturation", "declaration": "Mathlib.Algebra.Group.Submonoid.Saturation.saturation_sSup", "span": "L335-L337", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Submonoid/Saturation.lean#L335"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 148, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 516, "lean_code_chars": 98, "natural_language_chars": 418, "lean_code_ratio": 0.1899, "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": "55a361e2233895b9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Normed.Group.Basic.mem_sphere_one_iff_norm", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Group.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mem_sphere_one_iff_norm : a \u2208 sphere (1 : E) r \u2194 \u2016a\u2016 = 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.Analysis.Normed.Group.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mem_sphere_one_iff_norm : a \u2208 sphere (1 : E) r \u2194 \u2016a\u2016 = 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/Analysis/Normed/Group/Basic.lean", "module": "Mathlib.Analysis.Normed.Group.Basic", "declaration": "Mathlib.Analysis.Normed.Group.Basic.mem_sphere_one_iff_norm", "span": "L303-L304", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Group/Basic.lean#L303"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 476, "lean_code_chars": 65, "natural_language_chars": 411, "lean_code_ratio": 0.1366, "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": "c55dc1753a65dfb1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Stream.Init.drop_map", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Stream.Init)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem drop_map (n : \u2115) (s : Stream' \u03b1) : drop n (map f s) = map f (drop n 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.Data.Stream.Init).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem drop_map (n : \u2115) (s : Stream' \u03b1) : drop n (map f s) = map f (drop n 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/Data/Stream/Init.lean", "module": "Mathlib.Data.Stream.Init", "declaration": "Mathlib.Data.Stream.Init.drop_map", "span": "L135-L137", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Stream/Init.lean#L135"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 140, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 479, "lean_code_chars": 79, "natural_language_chars": 400, "lean_code_ratio": 0.1649, "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": "824a157668035991", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.GroupWithZero.Units.Basic.mul_div_mul_right", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.GroupWithZero.Units.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma mul_div_mul_right (a b : G\u2080) (hc : c \u2260 0) : a * c / (b * c) = 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.Algebra.GroupWithZero.Units.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma mul_div_mul_right (a b : G\u2080) (hc : c \u2260 0) : a * c / (b * c) = 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/Algebra/GroupWithZero/Units/Basic.lean", "module": "Mathlib.Algebra.GroupWithZero.Units.Basic", "declaration": "Mathlib.Algebra.GroupWithZero.Units.Basic.mul_div_mul_right", "span": "L353-L356", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/GroupWithZero/Units/Basic.lean#L353"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 152, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 491, "lean_code_chars": 74, "natural_language_chars": 417, "lean_code_ratio": 0.1507, "line_count": 7, "imports_count": 0, "declarations_count": 59, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "73c574cf5e159f35", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Combinatorics.SimpleGraph.AdjMatrix.adjMatrix_apply", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.AdjMatrix)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem adjMatrix_apply (v w : V) [Zero \u03b1] [One \u03b1] :\n G.adjMatrix \u03b1 v w = if G.Adj v w then 1 else 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.Combinatorics.SimpleGraph.AdjMatrix).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem adjMatrix_apply (v w : V) [Zero \u03b1] [One \u03b1] :\n G.adjMatrix \u03b1 v w = if G.Adj v w then 1 else 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/Combinatorics/SimpleGraph/AdjMatrix.lean", "module": "Mathlib.Combinatorics.SimpleGraph.AdjMatrix", "declaration": "Mathlib.Combinatorics.SimpleGraph.AdjMatrix.adjMatrix_apply", "span": "L169-L172", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/AdjMatrix.lean#L169"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 156, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 523, "lean_code_chars": 104, "natural_language_chars": 419, "lean_code_ratio": 0.1989, "line_count": 8, "imports_count": 0, "declarations_count": 62, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b8907ad04b98e623", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.PFilter.sInf_gc", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.PFilter)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem sInf_gc :\n GaloisConnection (fun x => toDual (principal x)) fun F => sInf (ofDual F : PFilter P)\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.Order.PFilter).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem sInf_gc :\n GaloisConnection (fun x => toDual (principal x)) fun F => sInf (ofDual F : PFilter P)\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/Order/PFilter.lean", "module": "Mathlib.Order.PFilter", "declaration": "Mathlib.Order.PFilter.sInf_gc", "span": "L154-L158", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/PFilter.lean#L154"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 144, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 505, "lean_code_chars": 108, "natural_language_chars": 397, "lean_code_ratio": 0.2139, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c74d89d3f627f371", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.homologyFunctor_shiftMap", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma homologyFunctor_shiftMap\n {K L : CochainComplex C \u2124} {n : \u2124} (f : K \u27f6 L\u27e6n\u27e7) (a a' : \u2124) (h : n + a = a') :\n (homologyFunctor C (ComplexShape.up \u2124) 0).shiftMap\n (ShiftedHom.map f (quotient _ _)) a a' h =\n (homologyFunctorFactors _ _ a).hom.app K \u226b\n (HomologicalComplex.homologyFunctor C (ComplexShape.up \u2124) 0).shiftMap f a a' h \u226b\n (homologyFunctorFactors _ _ a').inv.app 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.Algebra.Homology.HomotopyCategory.ShiftSequence).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma homologyFunctor_shiftMap\n {K L : CochainComplex C \u2124} {n : \u2124} (f : K \u27f6 L\u27e6n\u27e7) (a a' : \u2124) (h : n + a = a') :\n (homologyFunctor C (ComplexShape.up \u2124) 0).shiftMap\n (ShiftedHom.map f (quotient _ _)) a a' h =\n (homologyFunctorFactors _ _ a).hom.app K \u226b\n (HomologicalComplex.homologyFunctor C (ComplexShape.up \u2124) 0).shiftMap f a a' h \u226b\n (homologyFunctorFactors _ _ a').inv.app 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/Algebra/Homology/HomotopyCategory/ShiftSequence.lean", "module": "Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence", "declaration": "Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.homologyFunctor_shiftMap", "span": "L204-L213", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/HomotopyCategory/ShiftSequence.lean#L204"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 277, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 846, "lean_code_chars": 415, "natural_language_chars": 431, "lean_code_ratio": 0.4905, "line_count": 13, "imports_count": 0, "declarations_count": 95, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d9c46834690feefd", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Set.Subset.image_val_union", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Subset)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma image_val_union : (\u2191(D \u222a E) : Set \u03b1) = \u2191D \u222a \u2191E\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.Data.Set.Subset).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma image_val_union : (\u2191(D \u222a E) : Set \u03b1) = \u2191D \u222a \u2191E\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/Data/Set/Subset.lean", "module": "Mathlib.Data.Set.Subset", "declaration": "Mathlib.Data.Set.Subset.image_val_union", "span": "L82-L83", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Subset.lean#L82"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 136, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 452, "lean_code_chars": 53, "natural_language_chars": 399, "lean_code_ratio": 0.1173, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f1a4b6ae086ebac6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.Group.Unbundled.Basic.div_lt_div_iff'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Group.Unbundled.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem div_lt_div_iff' : a / b < c / d \u2194 a * d < c * 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.Algebra.Order.Group.Unbundled.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem div_lt_div_iff' : a / b < c / d \u2194 a * d < c * 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/Algebra/Order/Group/Unbundled/Basic.lean", "module": "Mathlib.Algebra.Order.Group.Unbundled.Basic", "declaration": "Mathlib.Algebra.Order.Group.Unbundled.Basic.div_lt_div_iff'", "span": "L662-L664", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Group/Unbundled/Basic.lean#L662"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 139, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 475, "lean_code_chars": 56, "natural_language_chars": 419, "lean_code_ratio": 0.1179, "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": "32cda6c20a7bed66", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.AffineSpace.Matrix.isUnit_toMatrix", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Matrix)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem isUnit_toMatrix : IsUnit (b.toMatrix b\u2082)\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.LinearAlgebra.AffineSpace.Matrix).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem isUnit_toMatrix : IsUnit (b.toMatrix b\u2082)\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/LinearAlgebra/AffineSpace/Matrix.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.Matrix", "declaration": "Mathlib.LinearAlgebra.AffineSpace.Matrix.isUnit_toMatrix", "span": "L122-L127", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/Matrix.lean#L122"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 129, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 465, "lean_code_chars": 49, "natural_language_chars": 416, "lean_code_ratio": 0.1054, "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": "2ca4c6dc8da8b52a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.UpperLower.Principal.map_Ioi", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Principal)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem map_Ioi (f : \u03b1 \u2243o \u03b2) (a : \u03b1) : map f (Ioi a) = Ioi (f 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.Order.UpperLower.Principal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem map_Ioi (f : \u03b1 \u2243o \u03b2) (a : \u03b1) : map f (Ioi a) = Ioi (f 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/Order/UpperLower/Principal.lean", "module": "Mathlib.Order.UpperLower.Principal", "declaration": "Mathlib.Order.UpperLower.Principal.map_Ioi", "span": "L72-L75", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/UpperLower/Principal.lean#L72"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 144, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 475, "lean_code_chars": 65, "natural_language_chars": 410, "lean_code_ratio": 0.1368, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4091e5d9df7c4ad7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.coe_GLPos_neg", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem coe_GLPos_neg (g : SpecialLinearGroup n R) : \u2191(-g) = -(\u2191g : GLPos n 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.LinearAlgebra.Matrix.GeneralLinearGroup.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem coe_GLPos_neg (g : SpecialLinearGroup n R) : \u2191(-g) = -(\u2191g : GLPos n 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/LinearAlgebra/Matrix/GeneralLinearGroup/Defs.lean", "module": "Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs", "declaration": "Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.coe_GLPos_neg", "span": "L391-L396", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Defs.lean#L391"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 149, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 507, "lean_code_chars": 79, "natural_language_chars": 428, "lean_code_ratio": 0.1558, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "628df2f38ad7b6aa", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint_erase", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Combination)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem weightedVSubOfPoint_erase [DecidableEq \u03b9] (w : \u03b9 \u2192 k) (p : \u03b9 \u2192 P) (i : \u03b9) :\n (s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w\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.LinearAlgebra.AffineSpace.Combination).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem weightedVSubOfPoint_erase [DecidableEq \u03b9] (w : \u03b9 \u2192 k) (p : \u03b9 \u2192 P) (i : \u03b9) :\n (s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w\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/LinearAlgebra/AffineSpace/Combination.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.Combination", "declaration": "Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint_erase", "span": "L138-L145", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/Combination.lean#L138"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 182, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 585, "lean_code_chars": 164, "natural_language_chars": 421, "lean_code_ratio": 0.2803, "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": "cf7f9d7659e0ffee", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.AdicCompletion.LocalRing.isLocalRing_of_isAdicComplete_maximal", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.AdicCompletion.LocalRing)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem isLocalRing_of_isAdicComplete_maximal [IsAdicComplete m R] : IsLocalRing R where\n exists_pair_ne\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.RingTheory.AdicCompletion.LocalRing).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem isLocalRing_of_isAdicComplete_maximal [IsAdicComplete m R] : IsLocalRing R where\n exists_pair_ne\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/RingTheory/AdicCompletion/LocalRing.lean", "module": "Mathlib.RingTheory.AdicCompletion.LocalRing", "declaration": "Mathlib.RingTheory.AdicCompletion.LocalRing.isLocalRing_of_isAdicComplete_maximal", "span": "L77-L84", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/AdicCompletion/LocalRing.lean#L77"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 146, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 525, "lean_code_chars": 106, "natural_language_chars": 419, "lean_code_ratio": 0.2019, "line_count": 8, "imports_count": 0, "declarations_count": 55, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f29375fee9cc82a6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Regular.Basic.IsLeftRegular", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Regular.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma IsLeftRegular.pow (n : \u2115) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n)\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.Algebra.Regular.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma IsLeftRegular.pow (n : \u2115) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n)\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/Algebra/Regular/Basic.lean", "module": "Mathlib.Algebra.Regular.Basic", "declaration": "Mathlib.Algebra.Regular.Basic.IsLeftRegular", "span": "L187-L190", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Regular/Basic.lean#L187"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 138, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 485, "lean_code_chars": 80, "natural_language_chars": 405, "lean_code_ratio": 0.1649, "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": "86366fa10a710619", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.Ring.Unbundled.Basic.mul_nonneg_iff_left_nonneg_of_pos", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Ring.Unbundled.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mul_nonneg_iff_left_nonneg_of_pos [PosMulStrictMono R] [MulPosStrictMono R]\n (hb : 0 < b) : 0 \u2264 a * b \u2194 0 \u2264 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.Algebra.Order.Ring.Unbundled.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mul_nonneg_iff_left_nonneg_of_pos [PosMulStrictMono R] [MulPosStrictMono R]\n (hb : 0 < b) : 0 \u2264 a * b \u2194 0 \u2264 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/Algebra/Order/Ring/Unbundled/Basic.lean", "module": "Mathlib.Algebra.Order.Ring.Unbundled.Basic", "declaration": "Mathlib.Algebra.Order.Ring.Unbundled.Basic.mul_nonneg_iff_left_nonneg_of_pos", "span": "L493-L496", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Ring/Unbundled/Basic.lean#L493"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 169, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 539, "lean_code_chars": 121, "natural_language_chars": 418, "lean_code_ratio": 0.2245, "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": "a65e1880cd173c1c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.Module.FiniteDimension.constrL_basis", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Module.FiniteDimension)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem constrL_basis (v : Basis \u03b9 \ud835\udd5c E) (f : \u03b9 \u2192 F) (i : \u03b9) : v.constrL f (v i) = f i\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.Topology.Algebra.Module.FiniteDimension).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem constrL_basis (v : Basis \u03b9 \ud835\udd5c E) (f : \u03b9 \u2192 F) (i : \u03b9) : v.constrL f (v i) = f i\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/Topology/Algebra/Module/FiniteDimension.lean", "module": "Mathlib.Topology.Algebra.Module.FiniteDimension", "declaration": "Mathlib.Topology.Algebra.Module.FiniteDimension.constrL_basis", "span": "L467-L477", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Module/FiniteDimension.lean#L467"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 156, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 509, "lean_code_chars": 86, "natural_language_chars": 423, "lean_code_ratio": 0.169, "line_count": 7, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ecb495df656b5086", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.NonUnitalAlgebra.le_of_mem", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.NonUnitalAlgebra)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem le_of_mem {x : A} {s : NonUnitalSubalgebra R A} (hs : IsClosed (s : Set A)) (hx : x \u2208 s) :\n elemental R x \u2264 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.Topology.Algebra.NonUnitalAlgebra).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem le_of_mem {x : A} {s : NonUnitalSubalgebra R A} (hs : IsClosed (s : Set A)) (hx : x \u2208 s) :\n elemental R x \u2264 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/Topology/Algebra/NonUnitalAlgebra.lean", "module": "Mathlib.Topology.Algebra.NonUnitalAlgebra", "declaration": "Mathlib.Topology.Algebra.NonUnitalAlgebra.le_of_mem", "span": "L145-L149", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/NonUnitalAlgebra.lean#L145"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 162, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 538, "lean_code_chars": 121, "natural_language_chars": 417, "lean_code_ratio": 0.2249, "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": "d94b4c17cec86e5b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.CompleteLattice.Basic.fst_iSup", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.CompleteLattice.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem fst_iSup [SupSet \u03b1] [SupSet \u03b2] (f : \u03b9 \u2192 \u03b1 \u00d7 \u03b2) : (iSup f).fst = \u2a06 i, (f i).fst\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.Order.CompleteLattice.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem fst_iSup [SupSet \u03b1] [SupSet \u03b2] (f : \u03b9 \u2192 \u03b1 \u00d7 \u03b2) : (iSup f).fst = \u2a06 i, (f i).fst\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/Order/CompleteLattice/Basic.lean", "module": "Mathlib.Order.CompleteLattice.Basic", "declaration": "Mathlib.Order.CompleteLattice.Basic.fst_iSup", "span": "L952-L954", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/CompleteLattice/Basic.lean#L952"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 157, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 498, "lean_code_chars": 87, "natural_language_chars": 411, "lean_code_ratio": 0.1747, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "852a6fcac2850fa8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Ring.Divisibility.Lemmas.associated_abs_left_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Ring.Divisibility.Lemmas)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem associated_abs_left_iff :\n Associated |x| y \u2194 Associated 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.Algebra.Ring.Divisibility.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem associated_abs_left_iff :\n Associated |x| y \u2194 Associated 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/Algebra/Ring/Divisibility/Lemmas.lean", "module": "Mathlib.Algebra.Ring.Divisibility.Lemmas", "declaration": "Mathlib.Algebra.Ring.Divisibility.Lemmas.associated_abs_left_iff", "span": "L128-L132", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Ring/Divisibility/Lemmas.lean#L128"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 135, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 488, "lean_code_chars": 72, "natural_language_chars": 416, "lean_code_ratio": 0.1475, "line_count": 8, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "73601efe9f208cdc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily_of_orderTop_pos", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.HahnSeries.HEval)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem powerSeriesFamily_of_orderTop_pos {x : V\u27e6\u0393\u27e7} (hx : 0 < x.orderTop)\n (f : PowerSeries R) (n : \u2115) :\n powerSeriesFamily x f n = f.coeff n \u2022 x ^ n\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.RingTheory.HahnSeries.HEval).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem powerSeriesFamily_of_orderTop_pos {x : V\u27e6\u0393\u27e7} (hx : 0 < x.orderTop)\n (f : PowerSeries R) (n : \u2115) :\n powerSeriesFamily x f n = f.coeff n \u2022 x ^ n\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/RingTheory/HahnSeries/HEval.lean", "module": "Mathlib.RingTheory.HahnSeries.HEval", "declaration": "Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily_of_orderTop_pos", "span": "L60-L64", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/HahnSeries/HEval.lean#L60"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 178, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 568, "lean_code_chars": 157, "natural_language_chars": 411, "lean_code_ratio": 0.2764, "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": "73a99f3b75ddf889", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.GroupWithZero.Filter", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.GroupWithZero)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Filter.Tendsto.zpow\u2080 {f : \u03b1 \u2192 G\u2080} {l : Filter \u03b1} {a : G\u2080} (hf : Tendsto f l (\ud835\udcdd a)) (m : \u2124)\n (h : a \u2260 0 \u2228 0 \u2264 m) : Tendsto (fun x => f x ^ m) l (\ud835\udcdd (a ^ m))\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.Topology.Algebra.GroupWithZero).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Filter.Tendsto.zpow\u2080 {f : \u03b1 \u2192 G\u2080} {l : Filter \u03b1} {a : G\u2080} (hf : Tendsto f l (\ud835\udcdd a)) (m : \u2124)\n (h : a \u2260 0 \u2228 0 \u2264 m) : Tendsto (fun x => f x ^ m) l (\ud835\udcdd (a ^ m))\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/Topology/Algebra/GroupWithZero.lean", "module": "Mathlib.Topology.Algebra.GroupWithZero", "declaration": "Mathlib.Topology.Algebra.GroupWithZero.Filter", "span": "L351-L356", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/GroupWithZero.lean#L351"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 203, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 580, "lean_code_chars": 166, "natural_language_chars": 414, "lean_code_ratio": 0.2862, "line_count": 8, "imports_count": 0, "declarations_count": 72, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "426ec2ea59636409", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.homologyMap_neg", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma homologyMap_neg : homologyMap (-\u03c6) i = -homologyMap \u03c6 i\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.Algebra.Homology.ShortComplex.HomologicalComplex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma homologyMap_neg : homologyMap (-\u03c6) i = -homologyMap \u03c6 i\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/Algebra/Homology/ShortComplex/HomologicalComplex.lean", "module": "Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex", "declaration": "Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.homologyMap_neg", "span": "L748-L753", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/ShortComplex/HomologicalComplex.lean#L748"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 136, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 494, "lean_code_chars": 62, "natural_language_chars": 432, "lean_code_ratio": 0.1255, "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": "e52473d94dafefc9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.Ring.Compact.IsDedekindDomain", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Ring.Compact)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma IsDedekindDomain.isOpen_of_ne_bot\n [IsDedekindDomain R] {I : Ideal R} (hI : I \u2260 \u22a5) :\n IsOpen (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.Topology.Algebra.Ring.Compact).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma IsDedekindDomain.isOpen_of_ne_bot\n [IsDedekindDomain R] {I : Ideal R} (hI : I \u2260 \u22a5) :\n IsOpen (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/Topology/Algebra/Ring/Compact.lean", "module": "Mathlib.Topology.Algebra.Ring.Compact", "declaration": "Mathlib.Topology.Algebra.Ring.Compact.IsDedekindDomain", "span": "L119-L130", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Ring/Compact.lean#L119"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 160, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 521, "lean_code_chars": 108, "natural_language_chars": 413, "lean_code_ratio": 0.2073, "line_count": 9, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "06aa9a7b2208d1c1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Lie.Semisimple.Basic.subsingleton_of_hasTrivialRadical_lie_abelian", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Semisimple.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem subsingleton_of_hasTrivialRadical_lie_abelian [HasTrivialRadical R L] [h : IsLieAbelian L] :\n Subsingleton 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.Algebra.Lie.Semisimple.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem subsingleton_of_hasTrivialRadical_lie_abelian [HasTrivialRadical R L] [h : IsLieAbelian L] :\n Subsingleton 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/Algebra/Lie/Semisimple/Basic.lean", "module": "Mathlib.Algebra.Lie.Semisimple.Basic", "declaration": "Mathlib.Algebra.Lie.Semisimple.Basic.subsingleton_of_hasTrivialRadical_lie_abelian", "span": "L313-L317", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Semisimple/Basic.lean#L313"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 153, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 532, "lean_code_chars": 120, "natural_language_chars": 412, "lean_code_ratio": 0.2256, "line_count": 8, "imports_count": 0, "declarations_count": 56, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e5a0227422823969", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Prod.Lex.covBy_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Prod.Lex)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem covBy_iff {a b : \u03b1 \u00d7\u2097 \u03b2} :\n a \u22d6 b \u2194 (ofLex a).1 = (ofLex b).1 \u2227 (ofLex a).2 \u22d6 (ofLex b).2 \u2228\n (ofLex a).1 \u22d6 (ofLex b).1 \u2227 IsMax (ofLex a).2 \u2227 IsMin (ofLex b).2\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.Data.Prod.Lex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem covBy_iff {a b : \u03b1 \u00d7\u2097 \u03b2} :\n a \u22d6 b \u2194 (ofLex a).1 = (ofLex b).1 \u2227 (ofLex a).2 \u22d6 (ofLex b).2 \u2228\n (ofLex a).1 \u22d6 (ofLex b).1 \u2227 IsMax (ofLex a).2 \u2227 IsMin (ofLex b).2\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/Data/Prod/Lex.lean", "module": "Mathlib.Data.Prod.Lex", "declaration": "Mathlib.Data.Prod.Lex.covBy_iff", "span": "L102-L113", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Prod/Lex.lean#L102"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 203, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 572, "lean_code_chars": 175, "natural_language_chars": 397, "lean_code_ratio": 0.3059, "line_count": 9, "imports_count": 0, "declarations_count": 70, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e15b3d68449f7b10", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder.LocallyFiniteOrder", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef LocallyFiniteOrder.addMonoidHom :\n G \u2192+ \u2124 where\n toFun 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.Algebra.Order.Monoid.LocallyFiniteOrder).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef LocallyFiniteOrder.addMonoidHom :\n G \u2192+ \u2124 where\n toFun 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/Algebra/Order/Monoid/LocallyFiniteOrder.lean", "module": "Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder", "declaration": "Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder.LocallyFiniteOrder", "span": "L75-L102", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Monoid/LocallyFiniteOrder.lean#L75"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 488, "lean_code_chars": 65, "natural_language_chars": 423, "lean_code_ratio": 0.1332, "line_count": 9, "imports_count": 0, "declarations_count": 52, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4260632b3de349d9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Set.Accumulate.accumulate_eq_biInter_lt", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Accumulate)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem accumulate_eq_biInter_lt {s : \u2115 \u2192 Set \u03b2} {n : \u2115} : accumulate s n = \u22c3 k < n + 1, s 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.Data.Set.Accumulate).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem accumulate_eq_biInter_lt {s : \u2115 \u2192 Set \u03b2} {n : \u2115} : accumulate s n = \u22c3 k < n + 1, s 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/Data/Set/Accumulate.lean", "module": "Mathlib.Data.Set.Accumulate", "declaration": "Mathlib.Data.Set.Accumulate.accumulate_eq_biInter_lt", "span": "L38-L40", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Accumulate.lean#L38"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 152, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 496, "lean_code_chars": 93, "natural_language_chars": 403, "lean_code_ratio": 0.1875, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8482e534abd01eae", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.MvPolynomial.Basic.restrictScalars_restrictSupportIdeal", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.MvPolynomial.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma restrictScalars_restrictSupportIdeal (s : Set (\u03c3 \u2192\u2080 \u2115)) (hs) :\n (restrictSupportIdeal (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.RingTheory.MvPolynomial.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma restrictScalars_restrictSupportIdeal (s : Set (\u03c3 \u2192\u2080 \u2115)) (hs) :\n (restrictSupportIdeal (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/RingTheory/MvPolynomial/Basic.lean", "module": "Mathlib.RingTheory.MvPolynomial.Basic", "declaration": "Mathlib.RingTheory.MvPolynomial.Basic.restrictScalars_restrictSupportIdeal", "span": "L160-L166", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPolynomial/Basic.lean#L160"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 150, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 511, "lean_code_chars": 98, "natural_language_chars": 413, "lean_code_ratio": 0.1918, "line_count": 8, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "45f9eec4c6913c7a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.UpperLower.Principal.Ioi_eq_top", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Principal)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Ioi_eq_top [OrderTop \u03b1] {a : \u03b1} : Ioi a = \u22a4 \u2194 a = \u22a4\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.Order.UpperLower.Principal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Ioi_eq_top [OrderTop \u03b1] {a : \u03b1} : Ioi a = \u22a4 \u2194 a = \u22a4\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/Order/UpperLower/Principal.lean", "module": "Mathlib.Order.UpperLower.Principal", "declaration": "Mathlib.Order.UpperLower.Principal.Ioi_eq_top", "span": "L122-L126", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/UpperLower/Principal.lean#L122"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 470, "lean_code_chars": 60, "natural_language_chars": 410, "lean_code_ratio": 0.1277, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "fea77cc09c2bb401", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.NumberTheory.Transcendental.Liouville.Measure.Real", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.Transcendental.Liouville.Measure)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Real.disjoint_residual_ae : Disjoint (residual \u211d) (ae volume)\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.NumberTheory.Transcendental.Liouville.Measure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Real.disjoint_residual_ae : Disjoint (residual \u211d) (ae volume)\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/NumberTheory/Transcendental/Liouville/Measure.lean", "module": "Mathlib.NumberTheory.Transcendental.Liouville.Measure", "declaration": "Mathlib.NumberTheory.Transcendental.Liouville.Measure.Real", "span": "L123-L124", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean#L123"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 140, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 499, "lean_code_chars": 70, "natural_language_chars": 429, "lean_code_ratio": 0.1403, "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": "3d6ce63fb93355ec", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.Multilinear.Curry.currySum_uncurrySum", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Multilinear.Curry)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma currySum_uncurrySum\n (g : MultilinearMap R (fun i : \u03b9 \u21a6 N (.inl i))\n (MultilinearMap R (fun i : \u03b9' \u21a6 N (.inr i)) M\u2082)) :\n currySum (uncurrySum g) = g\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.LinearAlgebra.Multilinear.Curry).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma currySum_uncurrySum\n (g : MultilinearMap R (fun i : \u03b9 \u21a6 N (.inl i))\n (MultilinearMap R (fun i : \u03b9' \u21a6 N (.inr i)) M\u2082)) :\n currySum (uncurrySum g) = g\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/LinearAlgebra/Multilinear/Curry.lean", "module": "Mathlib.LinearAlgebra.Multilinear.Curry", "declaration": "Mathlib.LinearAlgebra.Multilinear.Curry.currySum_uncurrySum", "span": "L315-L323", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Multilinear/Curry.lean#L315"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 182, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 581, "lean_code_chars": 166, "natural_language_chars": 415, "lean_code_ratio": 0.2857, "line_count": 10, "imports_count": 0, "declarations_count": 68, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a782f25d918ae2e2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.NhdsWithin.closure_pi_set", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.NhdsWithin)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem closure_pi_set {\u03b9 : Type*} {\u03b1 : \u03b9 \u2192 Type*} [\u2200 i, TopologicalSpace (\u03b1 i)] (I : Set \u03b9)\n (s : \u2200 i, Set (\u03b1 i)) : closure (pi I s) = pi I fun i => closure (s i)\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.Topology.NhdsWithin).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem closure_pi_set {\u03b9 : Type*} {\u03b1 : \u03b9 \u2192 Type*} [\u2200 i, TopologicalSpace (\u03b1 i)] (I : Set \u03b9)\n (s : \u2200 i, Set (\u03b1 i)) : closure (pi I s) = pi I fun i => closure (s i)\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/Topology/NhdsWithin.lean", "module": "Mathlib.Topology.NhdsWithin", "declaration": "Mathlib.Topology.NhdsWithin.closure_pi_set", "span": "L411-L414", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/NhdsWithin.lean#L411"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 177, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 570, "lean_code_chars": 167, "natural_language_chars": 403, "lean_code_ratio": 0.293, "line_count": 8, "imports_count": 0, "declarations_count": 70, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0cc7c1f060382f1a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.FixedSubmodule.mem_fixedSubmodule_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.FixedSubmodule)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mem_fixedSubmodule_iff {f : V \u2192\u2097[R] V} {v : V} :\n v \u2208 f.fixedSubmodule \u2194 f v = v\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.LinearAlgebra.FixedSubmodule).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mem_fixedSubmodule_iff {f : V \u2192\u2097[R] V} {v : V} :\n v \u2208 f.fixedSubmodule \u2194 f v = v\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/LinearAlgebra/FixedSubmodule.lean", "module": "Mathlib.LinearAlgebra.FixedSubmodule", "declaration": "Mathlib.LinearAlgebra.FixedSubmodule.mem_fixedSubmodule_iff", "span": "L42-L45", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/FixedSubmodule.lean#L42"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 152, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 504, "lean_code_chars": 92, "natural_language_chars": 412, "lean_code_ratio": 0.1825, "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": "75c99b6fe63ca61b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_le_div_measure_closedBall_rOut", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.BumpFunction.Normed)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure \u03bc] (K : \u211d) (h : f.rOut \u2264 K * f.rIn)\n (x : E) :\n f.normed \u03bc x \u2264 K ^ finrank \u211d E / \u03bc.real (closedBall c f.rOut)\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.Analysis.Calculus.BumpFunction.Normed).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure \u03bc] (K : \u211d) (h : f.rOut \u2264 K * f.rIn)\n (x : E) :\n f.normed \u03bc x \u2264 K ^ finrank \u211d E / \u03bc.real (closedBall c f.rOut)\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/Analysis/Calculus/BumpFunction/Normed.lean", "module": "Mathlib.Analysis.Calculus.BumpFunction.Normed", "declaration": "Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_le_div_measure_closedBall_rOut", "span": "L137-L152", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/BumpFunction/Normed.lean#L137"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 188, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 601, "lean_code_chars": 180, "natural_language_chars": 421, "lean_code_ratio": 0.2995, "line_count": 9, "imports_count": 0, "declarations_count": 65, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1976515a076f19d4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.SpecialFunctions.Exponential.hasStrictDerivAt_exp_smul_const_of_mem_ball'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Exponential)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem hasStrictDerivAt_exp_smul_const_of_mem_ball' (x : \ud835\udd38) (t : \ud835\udd42)\n (htx : t \u2022 x \u2208 Metric.eball (0 : \ud835\udd38) (expSeries \ud835\udd42 \ud835\udd38).radius) :\n HasStrictDerivAt (fun u : \ud835\udd42 => exp (u \u2022 x)) (x * exp (t \u2022 x)) t\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.Analysis.SpecialFunctions.Exponential).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem hasStrictDerivAt_exp_smul_const_of_mem_ball' (x : \ud835\udd38) (t : \ud835\udd42)\n (htx : t \u2022 x \u2208 Metric.eball (0 : \ud835\udd38) (expSeries \ud835\udd42 \ud835\udd38).radius) :\n HasStrictDerivAt (fun u : \ud835\udd42 => exp (u \u2022 x)) (x * exp (t \u2022 x)) t\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/Analysis/SpecialFunctions/Exponential.lean", "module": "Mathlib.Analysis.SpecialFunctions.Exponential", "declaration": "Mathlib.Analysis.SpecialFunctions.Exponential.hasStrictDerivAt_exp_smul_const_of_mem_ball'", "span": "L324-L328", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Exponential.lean#L324"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 213, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 624, "lean_code_chars": 203, "natural_language_chars": 421, "lean_code_ratio": 0.3253, "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": "1b02f76d7b7f755d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.BigOperators.Field.dens_biUnion_le", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.BigOperators.Field)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma dens_biUnion_le [DecidableEq \u03b2] : (s.biUnion t).dens \u2264 \u2211 a \u2208 s, (t a).dens\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.Algebra.BigOperators.Field).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma dens_biUnion_le [DecidableEq \u03b2] : (s.biUnion t).dens \u2264 \u2211 a \u2208 s, (t a).dens\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/Algebra/BigOperators/Field.lean", "module": "Mathlib.Algebra.BigOperators.Field", "declaration": "Mathlib.Algebra.BigOperators.Field.dens_biUnion_le", "span": "L45-L49", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/BigOperators/Field.lean#L45"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 144, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 491, "lean_code_chars": 81, "natural_language_chars": 410, "lean_code_ratio": 0.165, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5ba37280b53465cc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Compactness.Lindelof.IsLindelof", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Compactness.Lindelof)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem IsLindelof.inter_iInter_nonempty {\u03b9 : Type v} (hs : IsLindelof s) (t : \u03b9 \u2192 Set X)\n (htc : \u2200 i, IsClosed (t i)) (hst : \u2200 u : Set \u03b9, u.Countable \u2227 (s \u2229 \u22c2 i \u2208 u, t i).Nonempty) :\n (s \u2229 \u22c2 i, t i).Nonempty\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.Topology.Compactness.Lindelof).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem IsLindelof.inter_iInter_nonempty {\u03b9 : Type v} (hs : IsLindelof s) (t : \u03b9 \u2192 Set X)\n (htc : \u2200 i, IsClosed (t i)) (hst : \u2200 u : Set \u03b9, u.Countable \u2227 (s \u2229 \u22c2 i \u2208 u, t i).Nonempty) :\n (s \u2229 \u22c2 i, t i).Nonempty\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/Topology/Compactness/Lindelof.lean", "module": "Mathlib.Topology.Compactness.Lindelof", "declaration": "Mathlib.Topology.Compactness.Lindelof.IsLindelof", "span": "L241-L248", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Compactness/Lindelof.lean#L241"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 212, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 628, "lean_code_chars": 215, "natural_language_chars": 413, "lean_code_ratio": 0.3424, "line_count": 9, "imports_count": 0, "declarations_count": 76, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e2c5c9c27743e7cb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.GroupWithZero.Units.Basic.eq_mul_inverse_iff_mul_eq", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.GroupWithZero.Units.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem eq_mul_inverse_iff_mul_eq (x y z : M\u2080) (h : IsUnit z) : x = y * z\u207b\u00b9\u02b3 \u2194 x * z = 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.Algebra.GroupWithZero.Units.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eq_mul_inverse_iff_mul_eq (x y z : M\u2080) (h : IsUnit z) : x = y * z\u207b\u00b9\u02b3 \u2194 x * z = 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/Algebra/GroupWithZero/Units/Basic.lean", "module": "Mathlib.Algebra.GroupWithZero.Units.Basic", "declaration": "Mathlib.Algebra.GroupWithZero.Units.Basic.eq_mul_inverse_iff_mul_eq", "span": "L124-L129", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/GroupWithZero/Units/Basic.lean#L124"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 159, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 506, "lean_code_chars": 89, "natural_language_chars": 417, "lean_code_ratio": 0.1759, "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": "5f2aca64b1400068", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Combinatorics.SimpleGraph.DegreeSum.dart_fst_fiber_card_eq_degree", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.DegreeSum)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem dart_fst_fiber_card_eq_degree [DecidableEq V] (v : V) :\n #{d : G.Dart | d.fst = v} = G.degree v\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.Combinatorics.SimpleGraph.DegreeSum).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem dart_fst_fiber_card_eq_degree [DecidableEq V] (v : V) :\n #{d : G.Dart | d.fst = v} = G.degree v\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/Combinatorics/SimpleGraph/DegreeSum.lean", "module": "Mathlib.Combinatorics.SimpleGraph.DegreeSum", "declaration": "Mathlib.Combinatorics.SimpleGraph.DegreeSum.dart_fst_fiber_card_eq_degree", "span": "L66-L70", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean#L66"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 156, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 526, "lean_code_chars": 107, "natural_language_chars": 419, "lean_code_ratio": 0.2034, "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": "ebf05cc38cbf8d4c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Homology.AlternatingConst.alternatingConstHomologyDataZero", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.AlternatingConst)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef alternatingConstHomologyDataZero (X : C) (n : \u2115) (hn : n = 0) :\n ((alternatingConst.obj X).sc n).HomologyData\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.Algebra.Homology.AlternatingConst).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef alternatingConstHomologyDataZero (X : C) (n : \u2115) (hn : n = 0) :\n ((alternatingConst.obj X).sc n).HomologyData\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/Algebra/Homology/AlternatingConst.lean", "module": "Mathlib.Algebra.Homology.AlternatingConst", "declaration": "Mathlib.Algebra.Homology.AlternatingConst.alternatingConstHomologyDataZero", "span": "L185-L188", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/AlternatingConst.lean#L185"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 155, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 534, "lean_code_chars": 117, "natural_language_chars": 417, "lean_code_ratio": 0.2191, "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": "878c6d9e7a29b8fc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.Ring.IsNonarchimedean.apply_natCast_le_one_of_isNonarchimedean", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Ring.IsNonarchimedean)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma apply_natCast_le_one_of_isNonarchimedean {F \u03b1 : Type*} [AddMonoidWithOne \u03b1] [FunLike F \u03b1 R]\n [ZeroHomClass F \u03b1 R] [NonnegHomClass F \u03b1 R] [OneHomClass F \u03b1 R] {f : F}\n (hna : IsNonarchimedean f) {n : \u2115} : f n \u2264 1\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.Algebra.Order.Ring.IsNonarchimedean).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma apply_natCast_le_one_of_isNonarchimedean {F \u03b1 : Type*} [AddMonoidWithOne \u03b1] [FunLike F \u03b1 R]\n [ZeroHomClass F \u03b1 R] [NonnegHomClass F \u03b1 R] [OneHomClass F \u03b1 R] {f : F}\n (hna : IsNonarchimedean f) {n : \u2115} : f n \u2264 1\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/Algebra/Order/Ring/IsNonarchimedean.lean", "module": "Mathlib.Algebra.Order.Ring.IsNonarchimedean", "declaration": "Mathlib.Algebra.Order.Ring.IsNonarchimedean.apply_natCast_le_one_of_isNonarchimedean", "span": "L53-L60", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Ring/IsNonarchimedean.lean#L53"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 208, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 642, "lean_code_chars": 223, "natural_language_chars": 419, "lean_code_ratio": 0.3474, "line_count": 9, "imports_count": 0, "declarations_count": 71, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1656c816d2487bf9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.GroupTheory.CoprodI.mem_smul_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.CoprodI)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mem_smul_iff {i j : \u03b9} {m\u2081 : M i} {m\u2082 : M j} {w : Word M} :\n \u27e8_, m\u2081\u27e9 \u2208 (of m\u2082 \u2022 w).toList \u2194\n (\u00aci = j \u2227 \u27e8i, m\u2081\u27e9 \u2208 w.toList)\n \u2228 (m\u2081 \u2260 1 \u2227 \u2203 (hij : i = j), (\u27e8i, m\u2081\u27e9 \u2208 w.toList.tail) \u2228\n (\u2203 m', \u27e8j, m'\u27e9 \u2208 w.toList.head? \u2227 m\u2081 = hij \u25b8 (m\u2082 * m')) \u2228\n (w.fstIdx \u2260 some j \u2227 m\u2081 = hij \u25b8 m\u2082))\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.GroupTheory.CoprodI).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mem_smul_iff {i j : \u03b9} {m\u2081 : M i} {m\u2082 : M j} {w : Word M} :\n \u27e8_, m\u2081\u27e9 \u2208 (of m\u2082 \u2022 w).toList \u2194\n (\u00aci = j \u2227 \u27e8i, m\u2081\u27e9 \u2208 w.toList)\n \u2228 (m\u2081 \u2260 1 \u2227 \u2203 (hij : i = j), (\u27e8i, m\u2081\u27e9 \u2208 w.toList.tail) \u2228\n (\u2203 m', \u27e8j, m'\u27e9 \u2208 w.toList.head? \u2227 m\u2081 = hij \u25b8 (m\u2082 * m')) \u2228\n (w.fstIdx \u2260 some j \u2227 m\u2081 = hij \u25b8 m\u2082))\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/GroupTheory/CoprodI.lean", "module": "Mathlib.GroupTheory.CoprodI", "declaration": "Mathlib.GroupTheory.CoprodI.mem_smul_iff", "span": "L508-L542", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/CoprodI.lean#L508"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 295, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 716, "lean_code_chars": 313, "natural_language_chars": 403, "lean_code_ratio": 0.4372, "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": "b692276b59cc7aac", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Normed.Field.UnitBall.Metric", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Field.UnitBall)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ninstance Metric.unitClosedBall.instCommMonoid [SeminormedCommRing \ud835\udd5c] [NormOneClass \ud835\udd5c] :\n CommMonoid (closedBall (0 : \ud835\udd5c) 1)\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.Analysis.Normed.Field.UnitBall).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance Metric.unitClosedBall.instCommMonoid [SeminormedCommRing \ud835\udd5c] [NormOneClass \ud835\udd5c] :\n CommMonoid (closedBall (0 : \ud835\udd5c) 1)\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/Analysis/Normed/Field/UnitBall.lean", "module": "Mathlib.Analysis.Normed.Field.UnitBall", "declaration": "Mathlib.Analysis.Normed.Field.UnitBall.Metric", "span": "L144-L147", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Field/UnitBall.lean#L144"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 166, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 540, "lean_code_chars": 126, "natural_language_chars": 414, "lean_code_ratio": 0.2333, "line_count": 8, "imports_count": 0, "declarations_count": 52, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c2220bdd836236bb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Real.Hyperreal.infinitePos_abs_iff_infinite", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Real.Hyperreal)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem infinitePos_abs_iff_infinite {x : \u211d*} : InfinitePos |x| \u2194 Infinite 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.Analysis.Real.Hyperreal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem infinitePos_abs_iff_infinite {x : \u211d*} : InfinitePos |x| \u2194 Infinite 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/Analysis/Real/Hyperreal.lean", "module": "Mathlib.Analysis.Real.Hyperreal", "declaration": "Mathlib.Analysis.Real.Hyperreal.infinitePos_abs_iff_infinite", "span": "L776-L779", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Real/Hyperreal.lean#L776"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 139, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 484, "lean_code_chars": 77, "natural_language_chars": 407, "lean_code_ratio": 0.1591, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "613ca2ce12403a15", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval_one_cyclotomic_not_prime_pow", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Polynomial.Cyclotomic.Eval)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : \u2115}\n (h : \u2200 {p : \u2115}, p.Prime \u2192 \u2200 k : \u2115, p ^ k \u2260 n) : eval 1 (cyclotomic n R) = 1\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.RingTheory.Polynomial.Cyclotomic.Eval).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : \u2115}\n (h : \u2200 {p : \u2115}, p.Prime \u2192 \u2200 k : \u2115, p ^ k \u2260 n) : eval 1 (cyclotomic n R) = 1\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/RingTheory/Polynomial/Cyclotomic/Eval.lean", "module": "Mathlib.RingTheory.Polynomial.Cyclotomic.Eval", "declaration": "Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval_one_cyclotomic_not_prime_pow", "span": "L135-L169", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean#L135"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 191, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 572, "lean_code_chars": 151, "natural_language_chars": 421, "lean_code_ratio": 0.264, "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": "e69f9f278dceb4ea", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.List.Basic.mem_getLast", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.List.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mem_getLast?_append_of_mem_getLast? {l\u2081 l\u2082 : List \u03b1} {x : \u03b1} (h : x \u2208 l\u2082.getLast?) :\n x \u2208 (l\u2081 ++ l\u2082).getLast?\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.Data.List.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mem_getLast?_append_of_mem_getLast? {l\u2081 l\u2082 : List \u03b1} {x : \u03b1} (h : x \u2208 l\u2082.getLast?) :\n x \u2208 (l\u2081 ++ l\u2082).getLast?\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/Data/List/Basic.lean", "module": "Mathlib.Data.List.Basic", "declaration": "Mathlib.Data.List.Basic.mem_getLast", "span": "L376-L378", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/Basic.lean#L376"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 160, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 520, "lean_code_chars": 121, "natural_language_chars": 399, "lean_code_ratio": 0.2327, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0a8794da708d0c88", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.InnerProductSpace.Spectrum.orthogonalFamily_eigenspaces'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.InnerProductSpace.Spectrum)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem orthogonalFamily_eigenspaces' (hT : T.IsSymmetric) :\n OrthogonalFamily \ud835\udd5c (fun \u03bc : Eigenvalues T => eigenspace T \u03bc) fun \u03bc =>\n (eigenspace T \u03bc).subtype\u2097\u1d62\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.Analysis.InnerProductSpace.Spectrum).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem orthogonalFamily_eigenspaces' (hT : T.IsSymmetric) :\n OrthogonalFamily \ud835\udd5c (fun \u03bc : Eigenvalues T => eigenspace T \u03bc) fun \u03bc =>\n (eigenspace T \u03bc).subtype\u2097\u1d62\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/Analysis/InnerProductSpace/Spectrum.lean", "module": "Mathlib.Analysis.InnerProductSpace.Spectrum", "declaration": "Mathlib.Analysis.InnerProductSpace.Spectrum.orthogonalFamily_eigenspaces'", "span": "L109-L115", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/Spectrum.lean#L109"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 172, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 587, "lean_code_chars": 168, "natural_language_chars": 419, "lean_code_ratio": 0.2862, "line_count": 9, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4bf1c0312bdee76a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.AffineSpace.Independent.affineIndependent_of_ne_of_notMem_of_mem_of_mem", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Independent)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem affineIndependent_of_ne_of_notMem_of_mem_of_mem {s : AffineSubspace k P} {p\u2081 p\u2082 p\u2083 : P}\n (hp\u2082p\u2083 : p\u2082 \u2260 p\u2083) (hp\u2081 : p\u2081 \u2209 s) (hp\u2082 : p\u2082 \u2208 s) (hp\u2083 : p\u2083 \u2208 s) :\n AffineIndependent k ![p\u2081, p\u2082, p\u2083]\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.LinearAlgebra.AffineSpace.Independent).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem affineIndependent_of_ne_of_notMem_of_mem_of_mem {s : AffineSubspace k P} {p\u2081 p\u2082 p\u2083 : P}\n (hp\u2082p\u2083 : p\u2082 \u2260 p\u2083) (hp\u2081 : p\u2081 \u2209 s) (hp\u2082 : p\u2082 \u2208 s) (hp\u2083 : p\u2083 \u2208 s) :\n AffineIndependent k ![p\u2081, p\u2082, p\u2083]\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/LinearAlgebra/AffineSpace/Independent.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.Independent", "declaration": "Mathlib.LinearAlgebra.AffineSpace.Independent.affineIndependent_of_ne_of_notMem_of_mem_of_mem", "span": "L876-L885", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/Independent.lean#L876"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 214, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 624, "lean_code_chars": 203, "natural_language_chars": 421, "lean_code_ratio": 0.3253, "line_count": 9, "imports_count": 0, "declarations_count": 74, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "56540f413b00fa2b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Combinatorics.SimpleGraph.Walks.Operations.drop_add_heq", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.Walks.Operations)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma drop_add_heq (p : G.Walk u v) (n m : \u2115) : p.drop (n + m) \u224d (p.drop n).drop m\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.Combinatorics.SimpleGraph.Walks.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma drop_add_heq (p : G.Walk u v) (n m : \u2115) : p.drop (n + m) \u224d (p.drop n).drop m\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/Combinatorics/SimpleGraph/Walks/Operations.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Walks.Operations", "declaration": "Mathlib.Combinatorics.SimpleGraph.Walks.Operations.drop_add_heq", "span": "L519-L522", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean#L519"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 155, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 509, "lean_code_chars": 83, "natural_language_chars": 426, "lean_code_ratio": 0.1631, "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": "fc38bfcd0a738a46", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Quandle.invAct_act_eq", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Quandle)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem invAct_act_eq (x y : R) : x \u25c3\u207b\u00b9 x \u25c3 y = 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.Algebra.Quandle).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem invAct_act_eq (x y : R) : x \u25c3\u207b\u00b9 x \u25c3 y = 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/Algebra/Quandle.lean", "module": "Mathlib.Algebra.Quandle", "declaration": "Mathlib.Algebra.Quandle.invAct_act_eq", "span": "L201-L203", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Quandle.lean#L201"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 136, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 449, "lean_code_chars": 50, "natural_language_chars": 399, "lean_code_ratio": 0.1114, "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": "9cef0affa9c6169e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.EMetricSpace.Lipschitz.edist_iterate_succ_le_geometric", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.EMetricSpace.Lipschitz)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem edist_iterate_succ_le_geometric {f : \u03b1 \u2192 \u03b1} (hf : LipschitzWith K f) (x n) :\n edist (f^[n] x) (f^[n + 1] x) \u2264 edist x (f x) * (K : \u211d\u22650\u221e) ^ n\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.Topology.EMetricSpace.Lipschitz).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem edist_iterate_succ_le_geometric {f : \u03b1 \u2192 \u03b1} (hf : LipschitzWith K f) (x n) :\n edist (f^[n] x) (f^[n + 1] x) \u2264 edist x (f x) * (K : \u211d\u22650\u221e) ^ n\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/Topology/EMetricSpace/Lipschitz.lean", "module": "Mathlib.Topology.EMetricSpace.Lipschitz", "declaration": "Mathlib.Topology.EMetricSpace.Lipschitz.edist_iterate_succ_le_geometric", "span": "L272-L303", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/EMetricSpace/Lipschitz.lean#L272"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 191, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 567, "lean_code_chars": 152, "natural_language_chars": 415, "lean_code_ratio": 0.2681, "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": "b7bb8b3af3e030a4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Seq.Computation.eq_of_bisim", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Seq.Computation)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem eq_of_bisim (bisim : IsBisimulation R) {s\u2081 s\u2082} (r : s\u2081 ~ s\u2082) : s\u2081 = s\u2082\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.Data.Seq.Computation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eq_of_bisim (bisim : IsBisimulation R) {s\u2081 s\u2082} (r : s\u2081 ~ s\u2082) : s\u2081 = s\u2082\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/Data/Seq/Computation.lean", "module": "Mathlib.Data.Seq.Computation", "declaration": "Mathlib.Data.Seq.Computation.eq_of_bisim", "span": "L254-L284", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Seq/Computation.lean#L254"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 150, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 483, "lean_code_chars": 79, "natural_language_chars": 404, "lean_code_ratio": 0.1636, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8b258d3334b2e276", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Order.Basic.induced_topology_eq_preorder", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Order.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem induced_topology_eq_preorder [Preorder \u03b1] [Preorder \u03b2] [TopologicalSpace \u03b2]\n [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H\u2081 : \u2200 {a b x}, b < f a \u2192 \u00ac(b < f x) \u2192 \u2203 y, y < a \u2227 b \u2264 f y)\n (H\u2082 : \u2200 {a b x}, f a < b \u2192 \u00ac(f x < b) \u2192 \u2203 y, a < y \u2227 f y \u2264 b) :\n induced f \u2039TopologicalSpace \u03b2\u203a = Preorder.topology \u03b1\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.Topology.Order.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem induced_topology_eq_preorder [Preorder \u03b1] [Preorder \u03b2] [TopologicalSpace \u03b2]\n [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H\u2081 : \u2200 {a b x}, b < f a \u2192 \u00ac(b < f x) \u2192 \u2203 y, y < a \u2227 b \u2264 f y)\n (H\u2082 : \u2200 {a b x}, f a < b \u2192 \u00ac(f x < b) \u2192 \u2203 y, a < y \u2227 f y \u2264 b) :\n induced f \u2039TopologicalSpace \u03b2\u203a = Preorder.topology \u03b1\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/Topology/Order/Basic.lean", "module": "Mathlib.Topology.Order.Basic", "declaration": "Mathlib.Topology.Order.Basic.induced_topology_eq_preorder", "span": "L273-L293", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Order/Basic.lean#L273"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 267, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 747, "lean_code_chars": 343, "natural_language_chars": 404, "lean_code_ratio": 0.4592, "line_count": 11, "imports_count": 0, "declarations_count": 98, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a25c5158cce4ea59", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.MonoidAlgebra.Defs.mul_def", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.MonoidAlgebra.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma mul_def (x y : R[M]) :\n x * y = x.sum fun m\u2081 r\u2081 \u21a6 y.sum fun m\u2082 r\u2082 \u21a6 single (m\u2081 * m\u2082) (r\u2081 * r\u2082)\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.Algebra.MonoidAlgebra.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma mul_def (x y : R[M]) :\n x * y = x.sum fun m\u2081 r\u2081 \u21a6 y.sum fun m\u2082 r\u2082 \u21a6 single (m\u2081 * m\u2082) (r\u2081 * r\u2082)\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/Algebra/MonoidAlgebra/Defs.lean", "module": "Mathlib.Algebra.MonoidAlgebra.Defs", "declaration": "Mathlib.Algebra.MonoidAlgebra.Defs.mul_def", "span": "L424-L428", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/MonoidAlgebra/Defs.lean#L424"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 167, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 514, "lean_code_chars": 104, "natural_language_chars": 410, "lean_code_ratio": 0.2023, "line_count": 8, "imports_count": 0, "declarations_count": 67, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "de0a5bc774cbf7ac", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Ideal.Operations.prod_span_singleton", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Ideal.Operations)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem prod_span_singleton {\u03b9 : Type*} (s : Finset \u03b9) (I : \u03b9 \u2192 R) :\n (\u220f i \u2208 s, Ideal.span ({I i} : Set R)) = Ideal.span {\u220f i \u2208 s, I i}\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.RingTheory.Ideal.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem prod_span_singleton {\u03b9 : Type*} (s : Finset \u03b9) (I : \u03b9 \u2192 R) :\n (\u220f i \u2208 s, Ideal.span ({I i} : Set R)) = Ideal.span {\u220f i \u2208 s, I i}\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/RingTheory/Ideal/Operations.lean", "module": "Mathlib.RingTheory.Ideal.Operations", "declaration": "Mathlib.RingTheory.Ideal.Operations.prod_span_singleton", "span": "L634-L637", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Operations.lean#L634"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 173, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 550, "lean_code_chars": 139, "natural_language_chars": 411, "lean_code_ratio": 0.2527, "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": "240f44a6ce24a090", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Interval.Multiset.Icc_self", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Multiset)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Icc_self (a : \u03b1) : Icc a a = {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.Order.Interval.Multiset).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Icc_self (a : \u03b1) : Icc a a = {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/Order/Interval/Multiset.lean", "module": "Mathlib.Order.Interval.Multiset", "declaration": "Mathlib.Order.Interval.Multiset.Icc_self", "span": "L230-L231", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Multiset.lean#L230"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 129, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 448, "lean_code_chars": 41, "natural_language_chars": 407, "lean_code_ratio": 0.0915, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e610a43a3b4a539d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.Matrix.ZPow.Commute", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Matrix.ZPow)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem Commute.zpow_right {A B : M} (h : Commute A B) (m : \u2124) : Commute A (B ^ m)\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.LinearAlgebra.Matrix.ZPow).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Commute.zpow_right {A B : M} (h : Commute A B) (m : \u2124) : Commute A (B ^ m)\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/LinearAlgebra/Matrix/ZPow.lean", "module": "Mathlib.LinearAlgebra.Matrix.ZPow", "declaration": "Mathlib.LinearAlgebra.Matrix.ZPow.Commute", "span": "L194-L200", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/ZPow.lean#L194"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 147, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 492, "lean_code_chars": 83, "natural_language_chars": 409, "lean_code_ratio": 0.1687, "line_count": 7, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "94d6024773655fac", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Ring.Opposite.instRing", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Ring.Opposite)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ninstance instRing [Ring R] : Ring R\u1d43\u1d52\u1d56 where\n __\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.Algebra.Ring.Opposite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance instRing [Ring R] : Ring R\u1d43\u1d52\u1d56 where\n __\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/Algebra/Ring/Opposite.lean", "module": "Mathlib.Algebra.Ring.Opposite", "declaration": "Mathlib.Algebra.Ring.Opposite.instRing", "span": "L198-L201", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Ring/Opposite.lean#L198"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 136, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 455, "lean_code_chars": 50, "natural_language_chars": 405, "lean_code_ratio": 0.1099, "line_count": 8, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "20daed295addbd07", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.GroupTheory.GroupAction.Jordan.MulAction", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.GroupAction.Jordan)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem MulAction.IsPreprimitive.isMultiplyPreprimitive\n (hG : IsPreprimitive G \u03b1) {s : Set \u03b1} {n : \u2115}\n (hsn : s.ncard = n + 1) (hsn' : n + 2 < Nat.card \u03b1)\n (hprim : IsPreprimitive (fixingSubgroup G s) (ofFixingSubgroup G s)) :\n IsMultiplyPreprimitive G \u03b1 (n + 2)\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.GroupTheory.GroupAction.Jordan).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem MulAction.IsPreprimitive.isMultiplyPreprimitive\n (hG : IsPreprimitive G \u03b1) {s : Set \u03b1} {n : \u2115}\n (hsn : s.ncard = n + 1) (hsn' : n + 2 < Nat.card \u03b1)\n (hprim : IsPreprimitive (fixingSubgroup G s) (ofFixingSubgroup G s)) :\n IsMultiplyPreprimitive G \u03b1 (n + 2)\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/GroupTheory/GroupAction/Jordan.lean", "module": "Mathlib.GroupTheory.GroupAction.Jordan", "declaration": "Mathlib.GroupTheory.GroupAction.Jordan.MulAction", "span": "L247-L306", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/GroupAction/Jordan.lean#L247"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 220, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 690, "lean_code_chars": 276, "natural_language_chars": 414, "lean_code_ratio": 0.4, "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": "196c6accd6dd4b1b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Homology.ExactSequenceFour.epi_cokerToKer'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.ExactSequenceFour)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma epi_cokerToKer' (hS' : (S.sc hS (k + 1)).Exact) :\n Epi (hS.cokerToKer' k hk cc kf hcc hkf)\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.Algebra.Homology.ExactSequenceFour).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma epi_cokerToKer' (hS' : (S.sc hS (k + 1)).Exact) :\n Epi (hS.cokerToKer' k hk cc kf hcc hkf)\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/Algebra/Homology/ExactSequenceFour.lean", "module": "Mathlib.Algebra.Homology.ExactSequenceFour", "declaration": "Mathlib.Algebra.Homology.ExactSequenceFour.epi_cokerToKer'", "span": "L112-L123", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/ExactSequenceFour.lean#L112"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 161, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 518, "lean_code_chars": 100, "natural_language_chars": 418, "lean_code_ratio": 0.1931, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7af0bbbd056a5668", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Set.Function.injOn_subtype_val", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Function)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem injOn_subtype_val {p : \u03b1 \u2192 Prop} {s : Set {x // p x}} : Set.InjOn Subtype.val 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.Data.Set.Function).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem injOn_subtype_val {p : \u03b1 \u2192 Prop} {s : Set {x // p x}} : Set.InjOn Subtype.val 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/Data/Set/Function.lean", "module": "Mathlib.Data.Set.Function", "declaration": "Mathlib.Data.Set.Function.injOn_subtype_val", "span": "L301-L303", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Function.lean#L301"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 489, "lean_code_chars": 88, "natural_language_chars": 401, "lean_code_ratio": 0.18, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9d021184fe2c3cc5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.AffineSpace.AffineMap.linear_injective_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.AffineMap)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem linear_injective_iff (f : P1 \u2192\u1d43[k] P2) :\n Function.Injective f.linear \u2194 Function.Injective 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.LinearAlgebra.AffineSpace.AffineMap).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem linear_injective_iff (f : P1 \u2192\u1d43[k] P2) :\n Function.Injective f.linear \u2194 Function.Injective 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/LinearAlgebra/AffineSpace/AffineMap.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.AffineMap", "declaration": "Mathlib.LinearAlgebra.AffineSpace.AffineMap.linear_injective_iff", "span": "L422-L429", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/AffineMap.lean#L422"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 149, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 523, "lean_code_chars": 104, "natural_language_chars": 419, "lean_code_ratio": 0.1989, "line_count": 8, "imports_count": 0, "declarations_count": 56, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a932d89749f7e4c3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Valuation.ValuationSubring.valuationSubring_eq_top_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Valuation.ValuationSubring)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem valuationSubring_eq_top_iff : v.valuationSubring = \u22a4 \u2194 \u00ac v.IsNontrivial\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.RingTheory.Valuation.ValuationSubring).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem valuationSubring_eq_top_iff : v.valuationSubring = \u22a4 \u2194 \u00ac v.IsNontrivial\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/RingTheory/Valuation/ValuationSubring.lean", "module": "Mathlib.RingTheory.Valuation.ValuationSubring", "declaration": "Mathlib.RingTheory.Valuation.ValuationSubring.valuationSubring_eq_top_iff", "span": "L473-L482", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Valuation/ValuationSubring.lean#L473"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 144, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 501, "lean_code_chars": 80, "natural_language_chars": 421, "lean_code_ratio": 0.1597, "line_count": 7, "imports_count": 0, "declarations_count": 50, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "77e529945aab21ab", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Ideal.Maps.annihilator_span_singleton", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Ideal.Maps)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem annihilator_span_singleton (g : M) :\n (Submodule.span R {g}).annihilator = ker (toSpanSingleton R M g)\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.RingTheory.Ideal.Maps).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem annihilator_span_singleton (g : M) :\n (Submodule.span R {g}).annihilator = ker (toSpanSingleton R M g)\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/RingTheory/Ideal/Maps.lean", "module": "Mathlib.RingTheory.Ideal.Maps", "declaration": "Mathlib.RingTheory.Ideal.Maps.annihilator_span_singleton", "span": "L984-L987", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Maps.lean#L984"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 151, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 519, "lean_code_chars": 114, "natural_language_chars": 405, "lean_code_ratio": 0.2197, "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": "2878c9f1b44d62c3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Matrix.Diagonal.diagonal_apply", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Matrix.Diagonal)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem diagonal_apply [Zero \u03b1] (d : n \u2192 \u03b1) (i j) : diagonal d i j = if i = j then d i else 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.Data.Matrix.Diagonal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem diagonal_apply [Zero \u03b1] (d : n \u2192 \u03b1) (i j) : diagonal d i j = if i = j then d i else 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/Data/Matrix/Diagonal.lean", "module": "Mathlib.Data.Matrix.Diagonal", "declaration": "Mathlib.Data.Matrix.Diagonal.diagonal_apply", "span": "L54-L56", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Matrix/Diagonal.lean#L54"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 147, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 498, "lean_code_chars": 94, "natural_language_chars": 404, "lean_code_ratio": 0.1888, "line_count": 7, "imports_count": 0, "declarations_count": 64, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a4cb4af879db81e5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Interval.Finset.Basic.nonempty_Ioi", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Finset.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma nonempty_Ioi : (Ioi a).Nonempty \u2194 \u00ac IsMax 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.Order.Interval.Finset.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma nonempty_Ioi : (Ioi a).Nonempty \u2194 \u00ac IsMax 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/Order/Interval/Finset/Basic.lean", "module": "Mathlib.Order.Interval.Finset.Basic", "declaration": "Mathlib.Order.Interval.Finset.Basic.nonempty_Ioi", "span": "L349-L350", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Finset/Basic.lean#L349"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 132, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 461, "lean_code_chars": 50, "natural_language_chars": 411, "lean_code_ratio": 0.1085, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1b4c84a4a8731f02", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Group.Pointwise.Set.Scalar.image_vsub_prod", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Pointwise.Set.Scalar)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma image_vsub_prod : (fun x : \u03b2 \u00d7 \u03b2 \u21a6 x.fst -\u1d65 x.snd) '' s \u00d7\u02e2 t = s -\u1d65 t\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.Algebra.Group.Pointwise.Set.Scalar).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma image_vsub_prod : (fun x : \u03b2 \u00d7 \u03b2 \u21a6 x.fst -\u1d65 x.snd) '' s \u00d7\u02e2 t = s -\u1d65 t\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/Algebra/Group/Pointwise/Set/Scalar.lean", "module": "Mathlib.Algebra.Group.Pointwise.Set.Scalar", "declaration": "Mathlib.Algebra.Group.Pointwise.Set.Scalar.image_vsub_prod", "span": "L232-L233", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean#L232"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 153, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 494, "lean_code_chars": 76, "natural_language_chars": 418, "lean_code_ratio": 0.1538, "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": "13dc355dd3e64186", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.quasispectrum_realPart'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma quasispectrum_realPart' (a : A) (ha : IsStarNormal 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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma quasispectrum_realPart' (a : A) (ha : IsStarNormal 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/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/RealImaginaryPart.lean", "module": "Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart", "declaration": "Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.quasispectrum_realPart'", "span": "L44-L47", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/RealImaginaryPart.lean#L44"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 144, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 511, "lean_code_chars": 59, "natural_language_chars": 452, "lean_code_ratio": 0.1155, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7d52dcbc13bad296", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.UpperLower.Closure.upperClosure_sUnion", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Closure)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem upperClosure_sUnion (S : Set (Set \u03b1)) : upperClosure (\u22c3\u2080 S) = \u2a05 s \u2208 S, upperClosure 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.Order.UpperLower.Closure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem upperClosure_sUnion (S : Set (Set \u03b1)) : upperClosure (\u22c3\u2080 S) = \u2a05 s \u2208 S, upperClosure 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/Order/UpperLower/Closure.lean", "module": "Mathlib.Order.UpperLower.Closure", "declaration": "Mathlib.Order.UpperLower.Closure.upperClosure_sUnion", "span": "L146-L148", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/UpperLower/Closure.lean#L146"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 151, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 502, "lean_code_chars": 94, "natural_language_chars": 408, "lean_code_ratio": 0.1873, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a15671c40ef5636b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.Module.Determinant.det_smulRight", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Module.Determinant)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem det_smulRight {\ud835\udd5c : Type*} [CommRing \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousMul \ud835\udd5c]\n (f : \ud835\udd5c \u2192L[\ud835\udd5c] \ud835\udd5c) (v : \ud835\udd5c) : (smulRight f v).det = f 1 * v\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.Topology.Algebra.Module.Determinant).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem det_smulRight {\ud835\udd5c : Type*} [CommRing \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousMul \ud835\udd5c]\n (f : \ud835\udd5c \u2192L[\ud835\udd5c] \ud835\udd5c) (v : \ud835\udd5c) : (smulRight f v).det = f 1 * v\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/Topology/Algebra/Module/Determinant.lean", "module": "Mathlib.Topology.Algebra.Module.Determinant", "declaration": "Mathlib.Topology.Algebra.Module.Determinant.det_smulRight", "span": "L33-L35", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Module/Determinant.lean#L33"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 199, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 565, "lean_code_chars": 146, "natural_language_chars": 419, "lean_code_ratio": 0.2584, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5cd70f5d3358cbc2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Order.closure", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Order)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem closure.mono (h : t\u2081 \u2264 t\u2082) : closure[t\u2081] s \u2286 closure[t\u2082] 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.Topology.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem closure.mono (h : t\u2081 \u2264 t\u2082) : closure[t\u2081] s \u2286 closure[t\u2082] 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/Topology/Order.lean", "module": "Mathlib.Topology.Order", "declaration": "Mathlib.Topology.Order.closure", "span": "L227-L229", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Order.lean#L227"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 138, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 465, "lean_code_chars": 67, "natural_language_chars": 398, "lean_code_ratio": 0.1441, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c1d7ae93a8f08b6e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.localInverse_apply_image", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem localInverse_apply_image (hf : HasStrictFDerivAt f (f' : E \u2192L[\ud835\udd5c] F) a) :\n hf.localInverse f f' a (f a) = 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.Analysis.Calculus.InverseFunctionTheorem.FDeriv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem localInverse_apply_image (hf : HasStrictFDerivAt f (f' : E \u2192L[\ud835\udd5c] F) a) :\n hf.localInverse f f' a (f a) = 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/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean", "module": "Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv", "declaration": "Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.localInverse_apply_image", "span": "L160-L163", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean#L160"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 171, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 549, "lean_code_chars": 118, "natural_language_chars": 431, "lean_code_ratio": 0.2149, "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": "6caabc8aacaeea48", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Hom.CompleteLattice.coe_mk", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Hom.CompleteLattice)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma coe_mk (f : \u03b1 \u2192 \u03b2) (hf) : \u21d1(mk f hf) = 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.Order.Hom.CompleteLattice).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma coe_mk (f : \u03b1 \u2192 \u03b2) (hf) : \u21d1(mk f hf) = 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/Order/Hom/CompleteLattice.lean", "module": "Mathlib.Order.Hom.CompleteLattice", "declaration": "Mathlib.Order.Hom.CompleteLattice.coe_mk", "span": "L230-L231", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Hom/CompleteLattice.lean#L230"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 139, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 456, "lean_code_chars": 47, "natural_language_chars": 409, "lean_code_ratio": 0.1031, "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": "c4a684fb7c502fad", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Fintype.EquivFin.card_eq_one_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Fintype.EquivFin)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem card_eq_one_iff : card \u03b1 = 1 \u2194 \u2203 x : \u03b1, \u2200 y, y = 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.Data.Fintype.EquivFin).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem card_eq_one_iff : card \u03b1 = 1 \u2194 \u2203 x : \u03b1, \u2200 y, y = 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/Data/Fintype/EquivFin.lean", "module": "Mathlib.Data.Fintype.EquivFin", "declaration": "Mathlib.Data.Fintype.EquivFin.card_eq_one_iff", "span": "L211-L218", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Fintype/EquivFin.lean#L211"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 140, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 464, "lean_code_chars": 59, "natural_language_chars": 405, "lean_code_ratio": 0.1272, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2230dab97fcbcf0c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Polynomial.Basic.ext", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Polynomial.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem ext {p q : R[X]} : (\u2200 n, coeff p n = coeff q n) \u2192 p = q\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.Algebra.Polynomial.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem ext {p q : R[X]} : (\u2200 n, coeff p n = coeff q n) \u2192 p = q\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/Algebra/Polynomial/Basic.lean", "module": "Mathlib.Algebra.Polynomial.Basic", "declaration": "Mathlib.Algebra.Polynomial.Basic.ext", "span": "L713-L717", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Basic.lean#L713"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 143, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 472, "lean_code_chars": 64, "natural_language_chars": 408, "lean_code_ratio": 0.1356, "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": "66a22377cee5cf00", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Ideal.Height.Ideal", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Ideal.Height)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.FiniteHeight] :\n \u2203 (l : LTSeries (PrimeSpectrum R)),\n RelSeries.last l = \u27e8p, inferInstance\u27e9 \u2227 l.length = p.height\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.RingTheory.Ideal.Height).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.FiniteHeight] :\n \u2203 (l : LTSeries (PrimeSpectrum R)),\n RelSeries.last l = \u27e8p, inferInstance\u27e9 \u2227 l.length = p.height\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/RingTheory/Ideal/Height.lean", "module": "Mathlib.RingTheory.Ideal.Height", "declaration": "Mathlib.RingTheory.Ideal.Height.Ideal", "span": "L79-L87", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Height.lean#L79"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 174, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 603, "lean_code_chars": 196, "natural_language_chars": 407, "lean_code_ratio": 0.325, "line_count": 9, "imports_count": 0, "declarations_count": 63, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2da2ea81a69131cf", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.List.TakeDrop.takeI_left'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.List.TakeDrop)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem takeI_left' {l\u2081 l\u2082 : List \u03b1} {n} (h : length l\u2081 = n) : takeI n (l\u2081 ++ l\u2082) = l\u2081\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.Data.List.TakeDrop).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem takeI_left' {l\u2081 l\u2082 : List \u03b1} {n} (h : length l\u2081 = n) : takeI n (l\u2081 ++ l\u2082) = l\u2081\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/Data/List/TakeDrop.lean", "module": "Mathlib.Data.List.TakeDrop", "declaration": "Mathlib.Data.List.TakeDrop.takeI_left'", "span": "L113-L120", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/TakeDrop.lean#L113"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 155, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 489, "lean_code_chars": 87, "natural_language_chars": 402, "lean_code_ratio": 0.1779, "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": "51116aebd4a09cdb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.InnerProductSpace.LinearPMap.adjointDomainMkCLMExtend_apply", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.InnerProductSpace.LinearPMap)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem adjointDomainMkCLMExtend_apply (hT : Dense (T.domain : Set E)) (y : T.adjointDomain)\n (x : T.domain) : adjointDomainMkCLMExtend T y (x : E) = \u27ea(y : F), T x\u27eb\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.Analysis.InnerProductSpace.LinearPMap).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem adjointDomainMkCLMExtend_apply (hT : Dense (T.domain : Set E)) (y : T.adjointDomain)\n (x : T.domain) : adjointDomainMkCLMExtend T y (x : E) = \u27ea(y : F), T x\u27eb\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/Analysis/InnerProductSpace/LinearPMap.lean", "module": "Mathlib.Analysis.InnerProductSpace.LinearPMap", "declaration": "Mathlib.Analysis.InnerProductSpace.LinearPMap.adjointDomainMkCLMExtend_apply", "span": "L118-L130", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/LinearPMap.lean#L118"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 181, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 589, "lean_code_chars": 168, "natural_language_chars": 421, "lean_code_ratio": 0.2852, "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": "c77b0c9994d9b00a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.NNReal.Defs.mul_lt_of_lt_div", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.NNReal.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mul_lt_of_lt_div {a b r : \u211d\u22650} (h : a < b / r) : a * r < 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.Data.NNReal.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mul_lt_of_lt_div {a b r : \u211d\u22650} (h : a < b / r) : a * r < 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/Data/NNReal/Defs.lean", "module": "Mathlib.Data.NNReal.Defs", "declaration": "Mathlib.Data.NNReal.Defs.mul_lt_of_lt_div", "span": "L758-L760", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/NNReal/Defs.lean#L758"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 145, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 467, "lean_code_chars": 67, "natural_language_chars": 400, "lean_code_ratio": 0.1435, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a684aefa90a2b890", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulLeftReflectLE", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ninstance mulLeftReflectLE [LE \u03b1] [Mul \u03b1] [c : MulLeftReflectLE \u03b1] : MulLeftReflectLE \u03b1\u1d52\u1d48\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.Algebra.Order.Monoid.Unbundled.OrderDual).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance mulLeftReflectLE [LE \u03b1] [Mul \u03b1] [c : MulLeftReflectLE \u03b1] : MulLeftReflectLE \u03b1\u1d52\u1d48\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/Algebra/Order/Monoid/Unbundled/OrderDual.lean", "module": "Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual", "declaration": "Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulLeftReflectLE", "span": "L24-L26", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Monoid/Unbundled/OrderDual.lean#L24"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 155, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 513, "lean_code_chars": 89, "natural_language_chars": 424, "lean_code_ratio": 0.1735, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1938492218b1a0ba", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.UniformSpace.Equiv.changeInv", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.UniformSpace.Equiv)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef changeInv (f : \u03b1 \u2243\u1d64 \u03b2) (g : \u03b2 \u2192 \u03b1) (hg : Function.RightInverse g f) : \u03b1 \u2243\u1d64 \u03b2\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.Topology.UniformSpace.Equiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef changeInv (f : \u03b1 \u2243\u1d64 \u03b2) (g : \u03b2 \u2192 \u03b1) (hg : Function.RightInverse g f) : \u03b1 \u2243\u1d64 \u03b2\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/Topology/UniformSpace/Equiv.lean", "module": "Mathlib.Topology.UniformSpace.Equiv", "declaration": "Mathlib.Topology.UniformSpace.Equiv.changeInv", "span": "L163-L174", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/UniformSpace/Equiv.lean#L163"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 153, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 492, "lean_code_chars": 81, "natural_language_chars": 411, "lean_code_ratio": 0.1646, "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": "67d93125c4237a8e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.NumberTheory.NumberField.Discriminant.Different.discr_dvd_discr", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.NumberField.Discriminant.Different)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem discr_dvd_discr [Algebra K L] :\n discr K \u2223 discr 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.NumberTheory.NumberField.Discriminant.Different).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem discr_dvd_discr [Algebra K L] :\n discr K \u2223 discr 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/NumberTheory/NumberField/Discriminant/Different.lean", "module": "Mathlib.NumberTheory.NumberField.Discriminant.Different", "declaration": "Mathlib.NumberTheory.NumberField.Discriminant.Different.discr_dvd_discr", "span": "L119-L132", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/Discriminant/Different.lean#L119"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 493, "lean_code_chars": 62, "natural_language_chars": 431, "lean_code_ratio": 0.1258, "line_count": 8, "imports_count": 0, "declarations_count": 55, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d5dd0c11262206a3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Finsupp.Order.subset_support_tsub", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Finsupp.Order)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem subset_support_tsub [DecidableEq \u03b9] {f1 f2 : \u03b9 \u2192\u2080 \u03b1} :\n f1.support \\ f2.support \u2286 (f1 - f2).support\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.Data.Finsupp.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem subset_support_tsub [DecidableEq \u03b9] {f1 f2 : \u03b9 \u2192\u2080 \u03b1} :\n f1.support \\ f2.support \u2286 (f1 - f2).support\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/Data/Finsupp/Order.lean", "module": "Mathlib.Data.Finsupp.Order", "declaration": "Mathlib.Data.Finsupp.Order.subset_support_tsub", "span": "L278-L281", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finsupp/Order.lean#L278"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 154, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 513, "lean_code_chars": 111, "natural_language_chars": 402, "lean_code_ratio": 0.2164, "line_count": 8, "imports_count": 0, "declarations_count": 56, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "13d42bc5f1e2bf45", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Filter.AtTopBot.CountablyGenerated.subseq_tendsto_of_neBot", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Filter.AtTopBot.CountablyGenerated)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem subseq_tendsto_of_neBot {f : Filter \u03b1} [IsCountablyGenerated f] {u : \u2115 \u2192 \u03b1}\n (hx : NeBot (f \u2293 map u atTop)) : \u2203 \u03b8 : \u2115 \u2192 \u2115, StrictMono \u03b8 \u2227 Tendsto (u \u2218 \u03b8) atTop 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.Order.Filter.AtTopBot.CountablyGenerated).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem subseq_tendsto_of_neBot {f : Filter \u03b1} [IsCountablyGenerated f] {u : \u2115 \u2192 \u03b1}\n (hx : NeBot (f \u2293 map u atTop)) : \u2203 \u03b8 : \u2115 \u2192 \u2115, StrictMono \u03b8 \u2227 Tendsto (u \u2218 \u03b8) atTop 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/Order/Filter/AtTopBot/CountablyGenerated.lean", "module": "Mathlib.Order.Filter.AtTopBot.CountablyGenerated", "declaration": "Mathlib.Order.Filter.AtTopBot.CountablyGenerated.subseq_tendsto_of_neBot", "span": "L151-L160", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Filter/AtTopBot/CountablyGenerated.lean#L151"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 190, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 597, "lean_code_chars": 173, "natural_language_chars": 424, "lean_code_ratio": 0.2898, "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": "7239b4ed33a6caff", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.expMap_smul", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem expMap_smul (c : \u211d) (x : realSpace K) :\n expMap (c \u2022 x) = (expMap x) ^ c\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.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem expMap_smul (c : \u211d) (x : realSpace K) :\n expMap (c \u2022 x) = (expMap x) ^ c\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/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean", "module": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne", "declaration": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.expMap_smul", "span": "L275-L279", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean#L275"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 155, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 521, "lean_code_chars": 84, "natural_language_chars": 437, "lean_code_ratio": 0.1612, "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": "11d56e969598699d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Asymptotics.Lemmas.isLittleO_one_left_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Asymptotics.Lemmas)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem isLittleO_one_left_iff : (fun _x => 1 : \u03b1 \u2192 F) =o[l] f \u2194 Tendsto (fun x => \u2016f x\u2016) l atTop\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.Analysis.Asymptotics.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem isLittleO_one_left_iff : (fun _x => 1 : \u03b1 \u2192 F) =o[l] f \u2194 Tendsto (fun x => \u2016f x\u2016) l atTop\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/Analysis/Asymptotics/Lemmas.lean", "module": "Mathlib.Analysis.Asymptotics.Lemmas", "declaration": "Mathlib.Analysis.Asymptotics.Lemmas.isLittleO_one_left_iff", "span": "L102-L110", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Asymptotics/Lemmas.lean#L102"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 159, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 509, "lean_code_chars": 98, "natural_language_chars": 411, "lean_code_ratio": 0.1925, "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": "fdefd46dc2a8c159", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Interval.Finset.SuccPred.insert_Ioc_right_eq_Ioc_succ_of_not_isMax", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Finset.SuccPred)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma insert_Ioc_right_eq_Ioc_succ_of_not_isMax (h : a \u2264 b) (hb : \u00ac IsMax b) :\n insert (succ b) (Ioc a b) = Ioc a (succ 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.Order.Interval.Finset.SuccPred).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma insert_Ioc_right_eq_Ioc_succ_of_not_isMax (h : a \u2264 b) (hb : \u00ac IsMax b) :\n insert (succ b) (Ioc a b) = Ioc a (succ 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/Order/Interval/Finset/SuccPred.lean", "module": "Mathlib.Order.Interval.Finset.SuccPred", "declaration": "Mathlib.Order.Interval.Finset.SuccPred.insert_Ioc_right_eq_Ioc_succ_of_not_isMax", "span": "L82-L85", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Finset/SuccPred.lean#L82"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 169, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 540, "lean_code_chars": 126, "natural_language_chars": 414, "lean_code_ratio": 0.2333, "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": "a01aa46c773025d6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Flat.EquationalCriterion.projective_of_finitePresentation", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Flat.EquationalCriterion)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem projective_of_finitePresentation [Flat R M] [FinitePresentation R M] : Projective R M\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.RingTheory.Flat.EquationalCriterion).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem projective_of_finitePresentation [Flat R M] [FinitePresentation R M] : Projective R M\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/RingTheory/Flat/EquationalCriterion.lean", "module": "Mathlib.RingTheory.Flat.EquationalCriterion", "declaration": "Mathlib.RingTheory.Flat.EquationalCriterion.projective_of_finitePresentation", "span": "L286-L290", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Flat/EquationalCriterion.lean#L286"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 139, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 513, "lean_code_chars": 94, "natural_language_chars": 419, "lean_code_ratio": 0.1832, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e9508a55df213ec2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Homology.TotalComplex.d\u2082_eq_zero'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.TotalComplex)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma d\u2082_eq_zero' (i\u2081 : I\u2081) {i\u2082 i\u2082' : I\u2082} (h : c\u2082.Rel i\u2082 i\u2082') (i\u2081\u2082 : I\u2081\u2082)\n (h' : ComplexShape.\u03c0 c\u2081 c\u2082 c\u2081\u2082 \u27e8i\u2081, i\u2082'\u27e9 \u2260 i\u2081\u2082) :\n K.d\u2082 c\u2081\u2082 i\u2081 i\u2082 i\u2081\u2082 = 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.Algebra.Homology.TotalComplex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma d\u2082_eq_zero' (i\u2081 : I\u2081) {i\u2082 i\u2082' : I\u2082} (h : c\u2082.Rel i\u2082 i\u2082') (i\u2081\u2082 : I\u2081\u2082)\n (h' : ComplexShape.\u03c0 c\u2081 c\u2082 c\u2081\u2082 \u27e8i\u2081, i\u2082'\u27e9 \u2260 i\u2081\u2082) :\n K.d\u2082 c\u2081\u2082 i\u2081 i\u2082 i\u2081\u2082 = 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/Algebra/Homology/TotalComplex.lean", "module": "Mathlib.Algebra.Homology.TotalComplex", "declaration": "Mathlib.Algebra.Homology.TotalComplex.d\u2082_eq_zero'", "span": "L125-L146", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/TotalComplex.lean#L125"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 217, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 568, "lean_code_chars": 155, "natural_language_chars": 413, "lean_code_ratio": 0.2729, "line_count": 9, "imports_count": 0, "declarations_count": 74, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e0b7929c05d7dc45", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Holor.slice", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Holor)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef slice (x : Holor \u03b1 (d :: ds)) (i : \u2115) (h : i < d) : Holor \u03b1 ds\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.Data.Holor).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef slice (x : Holor \u03b1 (d :: ds)) (i : \u2115) (h : i < d) : Holor \u03b1 ds\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/Data/Holor.lean", "module": "Mathlib.Data.Holor", "declaration": "Mathlib.Data.Holor.slice", "span": "L181-L184", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Holor.lean#L181"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 140, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 461, "lean_code_chars": 67, "natural_language_chars": 394, "lean_code_ratio": 0.1453, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "26d6d545077edee9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Asymptotics.Defs.isBigOWith_snd_prod", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Asymptotics.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem isBigOWith_snd_prod : IsBigOWith 1 l g' fun x => (f' x, g' 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.Analysis.Asymptotics.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem isBigOWith_snd_prod : IsBigOWith 1 l g' fun x => (f' x, g' 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/Analysis/Asymptotics/Defs.lean", "module": "Mathlib.Analysis.Asymptotics.Defs", "declaration": "Mathlib.Analysis.Asymptotics.Defs.isBigOWith_snd_prod", "span": "L835-L837", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Asymptotics/Defs.lean#L835"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 145, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 479, "lean_code_chars": 70, "natural_language_chars": 409, "lean_code_ratio": 0.1461, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3431136083edac48", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Calculus.BumpFunction.Basic.zero_of_le_dist", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.BumpFunction.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem zero_of_le_dist (hx : f.rOut \u2264 dist x c) : f x = 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.Analysis.Calculus.BumpFunction.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem zero_of_le_dist (hx : f.rOut \u2264 dist x c) : f x = 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/Analysis/Calculus/BumpFunction/Basic.lean", "module": "Mathlib.Analysis.Calculus.BumpFunction.Basic", "declaration": "Mathlib.Analysis.Calculus.BumpFunction.Basic.zero_of_le_dist", "span": "L163-L168", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/BumpFunction/Basic.lean#L163"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 140, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 479, "lean_code_chars": 59, "natural_language_chars": 420, "lean_code_ratio": 0.1232, "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": "5dc854ea932e4429", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.GroupTheory.Nilpotent.nilpotent_iff_finite_ascending_central_series", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.Nilpotent)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem nilpotent_iff_finite_ascending_central_series :\n IsNilpotent G \u2194 \u2203 n : \u2115, \u2203 H : \u2115 \u2192 Subgroup G, IsAscendingCentralSeries H \u2227 H n = \u22a4\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.GroupTheory.Nilpotent).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem nilpotent_iff_finite_ascending_central_series :\n IsNilpotent G \u2194 \u2203 n : \u2115, \u2203 H : \u2115 \u2192 Subgroup G, IsAscendingCentralSeries H \u2227 H n = \u22a4\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/GroupTheory/Nilpotent.lean", "module": "Mathlib.GroupTheory.Nilpotent", "declaration": "Mathlib.GroupTheory.Nilpotent.nilpotent_iff_finite_ascending_central_series", "span": "L244-L253", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Nilpotent.lean#L244"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 167, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 549, "lean_code_chars": 144, "natural_language_chars": 405, "lean_code_ratio": 0.2623, "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": "b4f5072d2fad552c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.CStarAlgebra.Multiplier.algebraMap_fst", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.CStarAlgebra.Multiplier)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem algebraMap_fst (k : \ud835\udd5c) : (algebraMap \ud835\udd5c \ud835\udcdc(\ud835\udd5c, A) k).fst = algebraMap \ud835\udd5c _ 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.Analysis.CStarAlgebra.Multiplier).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem algebraMap_fst (k : \ud835\udd5c) : (algebraMap \ud835\udd5c \ud835\udcdc(\ud835\udd5c, A) k).fst = algebraMap \ud835\udd5c _ 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/Analysis/CStarAlgebra/Multiplier.lean", "module": "Mathlib.Analysis.CStarAlgebra.Multiplier", "declaration": "Mathlib.Analysis.CStarAlgebra.Multiplier.algebraMap_fst", "span": "L369-L371", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/CStarAlgebra/Multiplier.lean#L369"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 163, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 497, "lean_code_chars": 81, "natural_language_chars": 416, "lean_code_ratio": 0.163, "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": "1594af8b2f606816", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Interval.Set.Pi.image_mulSingle_Ioc", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Set.Pi)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem image_mulSingle_Ioc (i : \u03b9) (a b : \u03b1 i) :\n Pi.mulSingle i '' Ioc a b = Ioc (Pi.mulSingle i a) (Pi.mulSingle i 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.Order.Interval.Set.Pi).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem image_mulSingle_Ioc (i : \u03b9) (a b : \u03b1 i) :\n Pi.mulSingle i '' Ioc a b = Ioc (Pi.mulSingle i a) (Pi.mulSingle i 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/Order/Interval/Set/Pi.lean", "module": "Mathlib.Order.Interval.Set.Pi", "declaration": "Mathlib.Order.Interval.Set.Pi.image_mulSingle_Ioc", "span": "L181-L184", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Set/Pi.lean#L181"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 161, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 529, "lean_code_chars": 124, "natural_language_chars": 405, "lean_code_ratio": 0.2344, "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": "b1d1593e77f78b63", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Category.DeltaGenerated.fullyFaithfulDeltaGeneratedToTop", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Category.DeltaGenerated)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef fullyFaithfulDeltaGeneratedToTop : deltaGeneratedToTop.{u}.FullyFaithful\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.Topology.Category.DeltaGenerated).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef fullyFaithfulDeltaGeneratedToTop : deltaGeneratedToTop.{u}.FullyFaithful\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/Topology/Category/DeltaGenerated.lean", "module": "Mathlib.Topology.Category.DeltaGenerated", "declaration": "Mathlib.Topology.Category.DeltaGenerated.fullyFaithfulDeltaGeneratedToTop", "span": "L62-L64", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Category/DeltaGenerated.lean#L62"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 133, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 493, "lean_code_chars": 77, "natural_language_chars": 416, "lean_code_ratio": 0.1562, "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": "f386776a4cbb6d17", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.GroupTheory.Congruence.Hom.hom_ext", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.Congruence.Hom)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma hom_ext {f g : c.Quotient \u2192* P} (h : f.comp c.mk' = g.comp c.mk') : f = g\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.GroupTheory.Congruence.Hom).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma hom_ext {f g : c.Quotient \u2192* P} (h : f.comp c.mk' = g.comp c.mk') : f = g\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/GroupTheory/Congruence/Hom.lean", "module": "Mathlib.GroupTheory.Congruence.Hom", "declaration": "Mathlib.GroupTheory.Congruence.Hom.hom_ext", "span": "L230-L235", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Congruence/Hom.lean#L230"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 150, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 490, "lean_code_chars": 80, "natural_language_chars": 410, "lean_code_ratio": 0.1633, "line_count": 7, "imports_count": 0, "declarations_count": 59, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "147c60655807ce50", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Field.MinimalAxioms.Field", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Field.MinimalAxioms)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nabbrev Field.ofMinimalAxioms (K : Type u)\n [Add K] [Mul K] [Neg K] [Inv K] [Zero K] [One K]\n (add_assoc : \u2200 a b c : K, a + b + c = a + (b + c))\n (zero_add : \u2200 a : K, 0 + a = a)\n (neg_add_cancel : \u2200 a : K, -a + a = 0)\n (mul_assoc : \u2200 a b c : K, a * b * c = a * (b * c))\n (mul_comm : \u2200 a b : K, a * b = b * a)\n (one_mul : \u2200 a : K, 1 * a = a)\n (mul_inv_cancel : \u2200 a : K, a \u2260 0 \u2192 a * a\u207b\u00b9 = 1)\n (inv_zero : (0 : K)\u207b\u00b9 = 0)\n (left_distrib : \u2200 a b c : K, a * (b + c) = a * b + a * c)\n (exists_pair_ne : \u2203 x y : K, x \u2260 y) : Field 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.Algebra.Field.MinimalAxioms).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nabbrev Field.ofMinimalAxioms (K : Type u)\n [Add K] [Mul K] [Neg K] [Inv K] [Zero K] [One K]\n (add_assoc : \u2200 a b c : K, a + b + c = a + (b + c))\n (zero_add : \u2200 a : K, 0 + a = a)\n (neg_add_cancel : \u2200 a : K, -a + a = 0)\n (mul_assoc : \u2200 a b c : K, a * b * c = a * (b * c))\n (mul_comm : \u2200 a b : K, a * b = b * a)\n (one_mul : \u2200 a : K, 1 * a = a)\n (mul_inv_cancel : \u2200 a : K, a \u2260 0 \u2192 a * a\u207b\u00b9 = 1)\n (inv_zero : (0 : K)\u207b\u00b9 = 0)\n (left_distrib : \u2200 a b c : K, a * (b + c) = a * b + a * c)\n (exists_pair_ne : \u2203 x y : K, x \u2260 y) : Field 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/Algebra/Field/MinimalAxioms.lean", "module": "Mathlib.Algebra.Field.MinimalAxioms", "declaration": "Mathlib.Algebra.Field.MinimalAxioms.Field", "span": "L30-L50", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Field/MinimalAxioms.lean#L30"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 383, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 967, "lean_code_chars": 556, "natural_language_chars": 411, "lean_code_ratio": 0.575, "line_count": 18, "imports_count": 0, "declarations_count": 136, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ca8a03ea7a6d4e21", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Hom.Basic.map_inv_le_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Hom.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem map_inv_le_iff (f : F) {a : \u03b1} {b : \u03b2} : EquivLike.inv f b \u2264 a \u2194 b \u2264 f 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.Order.Hom.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem map_inv_le_iff (f : F) {a : \u03b1} {b : \u03b2} : EquivLike.inv f b \u2264 a \u2194 b \u2264 f 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/Order/Hom/Basic.lean", "module": "Mathlib.Order.Hom.Basic", "declaration": "Mathlib.Order.Hom.Basic.map_inv_le_iff", "span": "L191-L194", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Hom/Basic.lean#L191"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 147, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 480, "lean_code_chars": 81, "natural_language_chars": 399, "lean_code_ratio": 0.1688, "line_count": 7, "imports_count": 0, "declarations_count": 59, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "eb65575e9db249b2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.MetricSpace.IsometricSMul.constSMul_symm", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.MetricSpace.IsometricSMul)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem constSMul_symm (c : G) : (constSMul c : X \u2243\u1d62 X).symm = constSMul c\u207b\u00b9\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.Topology.MetricSpace.IsometricSMul).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem constSMul_symm (c : G) : (constSMul c : X \u2243\u1d62 X).symm = constSMul c\u207b\u00b9\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/Topology/MetricSpace/IsometricSMul.lean", "module": "Mathlib.Topology.MetricSpace.IsometricSMul", "declaration": "Mathlib.Topology.MetricSpace.IsometricSMul.constSMul_symm", "span": "L139-L144", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/MetricSpace/IsometricSMul.lean#L139"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 151, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 495, "lean_code_chars": 77, "natural_language_chars": 418, "lean_code_ratio": 0.1556, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6ee0d9a94e30dadc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.GaloisConnection.Defs.monotone_intro", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.GaloisConnection.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem monotone_intro (hu : Monotone u) (hl : Monotone l) (h_u_l : \u2200 a, a \u2264 u (l a))\n (h_l_u : \u2200 a, l (u a) \u2264 a) : GaloisConnection l u\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.Order.GaloisConnection.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem monotone_intro (hu : Monotone u) (hl : Monotone l) (h_u_l : \u2200 a, a \u2264 u (l a))\n (h_l_u : \u2200 a, l (u a) \u2264 a) : GaloisConnection l u\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/Order/GaloisConnection/Defs.lean", "module": "Mathlib.Order.GaloisConnection.Defs", "declaration": "Mathlib.Order.GaloisConnection.Defs.monotone_intro", "span": "L54-L57", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/GaloisConnection/Defs.lean#L54"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 174, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 551, "lean_code_chars": 140, "natural_language_chars": 411, "lean_code_ratio": 0.2541, "line_count": 8, "imports_count": 0, "declarations_count": 69, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "13861011a10baaa6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.changeForm_\u03b9_mul", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.CliffordAlgebra.Contraction)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem changeForm_\u03b9_mul (m : M) (x : CliffordAlgebra Q) :\n changeForm h (\u03b9 Q m * x) = \u03b9 Q' m * changeForm h x - B m\u230bchangeForm h 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.LinearAlgebra.CliffordAlgebra.Contraction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem changeForm_\u03b9_mul (m : M) (x : CliffordAlgebra Q) :\n changeForm h (\u03b9 Q m * x) = \u03b9 Q' m * changeForm h x - B m\u230bchangeForm h 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/LinearAlgebra/CliffordAlgebra/Contraction.lean", "module": "Mathlib.LinearAlgebra.CliffordAlgebra.Contraction", "declaration": "Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.changeForm_\u03b9_mul", "span": "L281-L284", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean#L281"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 170, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 560, "lean_code_chars": 135, "natural_language_chars": 425, "lean_code_ratio": 0.2411, "line_count": 8, "imports_count": 0, "declarations_count": 69, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "cc590fe9e41a2f54", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.Bounds.Basic.isGreatest_pair", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Bounds.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem isGreatest_pair [LinearOrder \u03b3] {a b : \u03b3} : IsGreatest {a, b} (max 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.Order.Bounds.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem isGreatest_pair [LinearOrder \u03b3] {a b : \u03b3} : IsGreatest {a, b} (max 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/Order/Bounds/Basic.lean", "module": "Mathlib.Order.Bounds.Basic", "declaration": "Mathlib.Order.Bounds.Basic.isGreatest_pair", "span": "L615-L622", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Bounds/Basic.lean#L615"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 140, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 482, "lean_code_chars": 80, "natural_language_chars": 402, "lean_code_ratio": 0.166, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2752ad9d79fbfe5f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Group.Pointwise.Set.Basic.coe_singletonMonoidHom", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Pointwise.Set.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem coe_singletonMonoidHom : (singletonMonoidHom : \u03b1 \u2192 Set \u03b1) = singleton\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.Algebra.Group.Pointwise.Set.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem coe_singletonMonoidHom : (singletonMonoidHom : \u03b1 \u2192 Set \u03b1) = singleton\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/Algebra/Group/Pointwise/Set/Basic.lean", "module": "Mathlib.Algebra.Group.Pointwise.Set.Basic", "declaration": "Mathlib.Algebra.Group.Pointwise.Set.Basic.coe_singletonMonoidHom", "span": "L617-L619", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean#L617"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 138, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 495, "lean_code_chars": 78, "natural_language_chars": 417, "lean_code_ratio": 0.1576, "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": "c2fe7adfcd59a0b9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.UniformConvergence.UniformFun", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.UniformConvergence)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma UniformFun.ofFun_smul {M : Type*} [SMul M \u03b2] (c : M) (f : \u03b1 \u2192 \u03b2) :\n ofFun (c \u2022 f) = c \u2022 ofFun 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.Topology.Algebra.UniformConvergence).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma UniformFun.ofFun_smul {M : Type*} [SMul M \u03b2] (c : M) (f : \u03b1 \u2192 \u03b2) :\n ofFun (c \u2022 f) = c \u2022 ofFun 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/Topology/Algebra/UniformConvergence.lean", "module": "Mathlib.Topology.Algebra.UniformConvergence", "declaration": "Mathlib.Topology.Algebra.UniformConvergence.UniformFun", "span": "L152-L155", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/UniformConvergence.lean#L152"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 159, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 524, "lean_code_chars": 105, "natural_language_chars": 419, "lean_code_ratio": 0.2004, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "84372ccc161a0be0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Combinatorics.Additive.AP.Three.Behrend.bound", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.Additive.AP.Three.Behrend)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem bound (hN : 4096 \u2264 N) : (N : \u211d) ^ (nValue N : \u211d)\u207b\u00b9 / exp 1 < dValue N\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.Combinatorics.Additive.AP.Three.Behrend).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem bound (hN : 4096 \u2264 N) : (N : \u211d) ^ (nValue N : \u211d)\u207b\u00b9 / exp 1 < dValue N\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/Combinatorics/Additive/AP/Three/Behrend.lean", "module": "Mathlib.Combinatorics.Additive.AP.Three.Behrend", "declaration": "Mathlib.Combinatorics.Additive.AP.Three.Behrend.bound", "span": "L394-L419", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean#L394"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 161, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 501, "lean_code_chars": 78, "natural_language_chars": 423, "lean_code_ratio": 0.1557, "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": "a992365fa34e76e3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.GroupTheory.FreeGroup.NielsenSchreier.endIsFree", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.FreeGroup.NielsenSchreier)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma endIsFree : IsFreeGroup (End (root' T))\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.GroupTheory.FreeGroup.NielsenSchreier).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma endIsFree : IsFreeGroup (End (root' T))\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/GroupTheory/FreeGroup/NielsenSchreier.lean", "module": "Mathlib.GroupTheory.FreeGroup.NielsenSchreier", "declaration": "Mathlib.GroupTheory.FreeGroup.NielsenSchreier.endIsFree", "span": "L227-L280", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/FreeGroup/NielsenSchreier.lean#L227"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 131, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 467, "lean_code_chars": 46, "natural_language_chars": 421, "lean_code_ratio": 0.0985, "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": "d9b589006bd6212c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Rel.right_subset_comp", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Rel)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma right_subset_comp [R.IsRefl] {S : SetRel \u03b1 \u03b2} : S \u2286 R \u25cb 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.Data.Rel).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma right_subset_comp [R.IsRefl] {S : SetRel \u03b1 \u03b2} : S \u2286 R \u25cb 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/Data/Rel.lean", "module": "Mathlib.Data.Rel", "declaration": "Mathlib.Data.Rel.right_subset_comp", "span": "L390-L392", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Rel.lean#L390"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 134, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 456, "lean_code_chars": 64, "natural_language_chars": 392, "lean_code_ratio": 0.1404, "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": "6c217dac416224ba", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.InnerProductSpace.SingularValues.isLowerSet_support_singularValues", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.InnerProductSpace.SingularValues)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem isLowerSet_support_singularValues : IsLowerSet (T.singularValues.support : Set \u2115)\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.Analysis.InnerProductSpace.SingularValues).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem isLowerSet_support_singularValues : IsLowerSet (T.singularValues.support : Set \u2115)\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/Analysis/InnerProductSpace/SingularValues.lean", "module": "Mathlib.Analysis.InnerProductSpace.SingularValues", "declaration": "Mathlib.Analysis.InnerProductSpace.SingularValues.isLowerSet_support_singularValues", "span": "L183-L187", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/SingularValues.lean#L183"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 141, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 515, "lean_code_chars": 90, "natural_language_chars": 425, "lean_code_ratio": 0.1748, "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": "34f40820a205632d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Ideal.Span.span_insert_zero", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Ideal.Span)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem span_insert_zero {s : Set \u03b1} : span (insert (0 : \u03b1) s) = span 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.RingTheory.Ideal.Span).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem span_insert_zero {s : Set \u03b1} : span (insert (0 : \u03b1) s) = span 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/RingTheory/Ideal/Span.lean", "module": "Mathlib.RingTheory.Ideal.Span", "declaration": "Mathlib.RingTheory.Ideal.Span.span_insert_zero", "span": "L140-L142", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Span.lean#L140"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 138, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 477, "lean_code_chars": 72, "natural_language_chars": 405, "lean_code_ratio": 0.1509, "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": "3424242c0a42c723", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.Flat.EquationalCriterion.sum_smul_eq_zero_of_isTrivialRelation", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Flat.EquationalCriterion)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) :\n \u2211 i, f i \u2022 x i = 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.RingTheory.Flat.EquationalCriterion).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) :\n \u2211 i, f i \u2022 x i = 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/RingTheory/Flat/EquationalCriterion.lean", "module": "Mathlib.RingTheory.Flat.EquationalCriterion", "declaration": "Mathlib.RingTheory.Flat.EquationalCriterion.sum_smul_eq_zero_of_isTrivialRelation", "span": "L93-L115", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Flat/EquationalCriterion.lean#L93"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 151, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 518, "lean_code_chars": 99, "natural_language_chars": 419, "lean_code_ratio": 0.1911, "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": "6b0a5a98f35215d3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left_of_tower", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.BilinearForm.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma smul_left_of_tower (r : S) (x y : M) : B (r \u2022 x) y = r \u2022 B 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.LinearAlgebra.BilinearForm.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma smul_left_of_tower (r : S) (x y : M) : B (r \u2022 x) y = r \u2022 B 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/LinearAlgebra/BilinearForm/Basic.lean", "module": "Mathlib.LinearAlgebra.BilinearForm.Basic", "declaration": "Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left_of_tower", "span": "L85-L87", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/BilinearForm/Basic.lean#L85"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 146, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 485, "lean_code_chars": 69, "natural_language_chars": 416, "lean_code_ratio": 0.1423, "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": "121ec0340ead8f50", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_comp_equiv", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.BigOperators.Group.Finset.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem prod_comp_equiv {f : \u03ba \u2192 M} (e : \u03b9 \u2243 \u03ba) : s.prod (f \u2218 e) = (s.map e).prod 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.Algebra.BigOperators.Group.Finset.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem prod_comp_equiv {f : \u03ba \u2192 M} (e : \u03b9 \u2243 \u03ba) : s.prod (f \u2218 e) = (s.map e).prod 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/Algebra/BigOperators/Group/Finset/Basic.lean", "module": "Mathlib.Algebra.BigOperators.Group.Finset.Basic", "declaration": "Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_comp_equiv", "span": "L860-L866", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean#L860"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 155, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 507, "lean_code_chars": 84, "natural_language_chars": 423, "lean_code_ratio": 0.1657, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3c50521c073b6b7f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Analysis.Calculus.Deriv.MeanValue.image_sub_lt_mul_sub_of_deriv_lt", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.Deriv.MeanValue)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem image_sub_lt_mul_sub_of_deriv_lt {f : \u211d \u2192 \u211d} (hf : Differentiable \u211d f) {C}\n (lt_hf' : \u2200 x, deriv f x < C) \u2983x y\u2984 (hxy : x < y) : f y - f x < C * (y - 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.Analysis.Calculus.Deriv.MeanValue).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem image_sub_lt_mul_sub_of_deriv_lt {f : \u211d \u2192 \u211d} (hf : Differentiable \u211d f) {C}\n (lt_hf' : \u2200 x, deriv f x < C) \u2983x y\u2984 (hxy : x < y) : f y - f x < C * (y - 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/Analysis/Calculus/Deriv/MeanValue.lean", "module": "Mathlib.Analysis.Calculus.Deriv.MeanValue", "declaration": "Mathlib.Analysis.Calculus.Deriv.MeanValue.image_sub_lt_mul_sub_of_deriv_lt", "span": "L344-L352", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/Deriv/MeanValue.lean#L344"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 201, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 580, "lean_code_chars": 163, "natural_language_chars": 417, "lean_code_ratio": 0.281, "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": "923accdde57077c0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.plusPart", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nabbrev plusPart : Set (mixedSpace 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.NumberTheory.NumberField.CanonicalEmbedding.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nabbrev plusPart : Set (mixedSpace 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/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean", "module": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic", "declaration": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.plusPart", "span": "L986-L987", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean#L986"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 129, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 470, "lean_code_chars": 37, "natural_language_chars": 433, "lean_code_ratio": 0.0787, "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": "9d07fd3b7df06ec6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Polynomial.Coeff.coeff_X_add_one_pow", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Polynomial.Coeff)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem coeff_X_add_one_pow (R : Type*) [Semiring R] (n k : \u2115) :\n ((X + 1) ^ n).coeff k = (n.choose k : 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.Algebra.Polynomial.Coeff).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem coeff_X_add_one_pow (R : Type*) [Semiring R] (n k : \u2115) :\n ((X + 1) ^ n).coeff k = (n.choose k : 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/Algebra/Polynomial/Coeff.lean", "module": "Mathlib.Algebra.Polynomial.Coeff", "declaration": "Mathlib.Algebra.Polynomial.Coeff.coeff_X_add_one_pow", "span": "L299-L301", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Coeff.lean#L299"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 162, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 518, "lean_code_chars": 110, "natural_language_chars": 408, "lean_code_ratio": 0.2124, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8f65f53e992de63f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.PosMulReflectLT", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem PosMulReflectLT.toMulPosReflectLT [PosMulReflectLT \u03b1] : MulPosReflectLT \u03b1\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.Algebra.Order.GroupWithZero.Unbundled.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem PosMulReflectLT.toMulPosReflectLT [PosMulReflectLT \u03b1] : MulPosReflectLT \u03b1\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/Algebra/Order/GroupWithZero/Unbundled/Defs.lean", "module": "Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs", "declaration": "Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.PosMulReflectLT", "span": "L411-L420", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/GroupWithZero/Unbundled/Defs.lean#L411"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 147, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 508, "lean_code_chars": 82, "natural_language_chars": 426, "lean_code_ratio": 0.1614, "line_count": 7, "imports_count": 0, "declarations_count": 50, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6df53d52738f0e78", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.SeparationQuotient.Basic.instMulAction", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.SeparationQuotient.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ninstance instMulAction {M X : Type*} [Monoid M] [MulAction M X] [TopologicalSpace X]\n [ContinuousConstSMul M X] : MulAction M (SeparationQuotient 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.Topology.Algebra.SeparationQuotient.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance instMulAction {M X : Type*} [Monoid M] [MulAction M X] [TopologicalSpace X]\n [ContinuousConstSMul M X] : MulAction M (SeparationQuotient 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/Topology/Algebra/SeparationQuotient/Basic.lean", "module": "Mathlib.Topology.Algebra.SeparationQuotient.Basic", "declaration": "Mathlib.Topology.Algebra.SeparationQuotient.Basic.instMulAction", "span": "L84-L91", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/SeparationQuotient/Basic.lean#L84"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 169, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 577, "lean_code_chars": 152, "natural_language_chars": 425, "lean_code_ratio": 0.2634, "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": "74eb991705ff7061", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.GroupTheory.FreeGroup.Reduce.reduce", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.FreeGroup.Reduce)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem reduce.min (H : Red (reduce L\u2081) L\u2082) : reduce L\u2081 = L\u2082\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.GroupTheory.FreeGroup.Reduce).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem reduce.min (H : Red (reduce L\u2081) L\u2082) : reduce L\u2081 = L\u2082\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/GroupTheory/FreeGroup/Reduce.lean", "module": "Mathlib.GroupTheory.FreeGroup.Reduce", "declaration": "Mathlib.GroupTheory.FreeGroup.Reduce.reduce", "span": "L121-L129", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/FreeGroup/Reduce.lean#L121"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 139, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 473, "lean_code_chars": 61, "natural_language_chars": 412, "lean_code_ratio": 0.129, "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": "9d9a2d202c0839e0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.RingTheory.FractionalIdeal.Operations.le_self_mul_one_div", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.FractionalIdeal.Operations)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem le_self_mul_one_div {I : FractionalIdeal R\u2081\u2070 K} (hI : I \u2264 (1 : FractionalIdeal R\u2081\u2070 K)) :\n I \u2264 I * (1 / I)\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.RingTheory.FractionalIdeal.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem le_self_mul_one_div {I : FractionalIdeal R\u2081\u2070 K} (hI : I \u2264 (1 : FractionalIdeal R\u2081\u2070 K)) :\n I \u2264 I * (1 / I)\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/RingTheory/FractionalIdeal/Operations.lean", "module": "Mathlib.RingTheory.FractionalIdeal.Operations", "declaration": "Mathlib.RingTheory.FractionalIdeal.Operations.le_self_mul_one_div", "span": "L424-L431", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/FractionalIdeal/Operations.lean#L424"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 168, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 538, "lean_code_chars": 117, "natural_language_chars": 421, "lean_code_ratio": 0.2175, "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": "6a9464e3b24ec72d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.Prod.graph_eq_ker_coprod", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Prod)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem graph_eq_ker_coprod : g.graph = ker ((-g).coprod LinearMap.id)\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.LinearAlgebra.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem graph_eq_ker_coprod : g.graph = ker ((-g).coprod LinearMap.id)\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/LinearAlgebra/Prod.lean", "module": "Mathlib.LinearAlgebra.Prod", "declaration": "Mathlib.LinearAlgebra.Prod.graph_eq_ker_coprod", "span": "L887-L891", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Prod.lean#L887"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 133, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 473, "lean_code_chars": 71, "natural_language_chars": 402, "lean_code_ratio": 0.1501, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "705bcc0169e85de3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Order.ToIntervalMod.toIocMod_apply_left", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.ToIntervalMod)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem toIocMod_apply_left (a : \u03b1) : toIocMod hp a a = a + p\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.Algebra.Order.ToIntervalMod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem toIocMod_apply_left (a : \u03b1) : toIocMod hp a a = a + p\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/Algebra/Order/ToIntervalMod.lean", "module": "Mathlib.Algebra.Order.ToIntervalMod", "declaration": "Mathlib.Algebra.Order.ToIntervalMod.toIocMod_apply_left", "span": "L184-L187", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/ToIntervalMod.lean#L184"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 137, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 473, "lean_code_chars": 62, "natural_language_chars": 411, "lean_code_ratio": 0.1311, "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": "d9d1e5d238723673", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Lie.CartanExists.lieCharpoly_coeff_natDegree", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.CartanExists)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma lieCharpoly_coeff_natDegree [Nontrivial R] (i j : \u2115) (hij : i + j = finrank R M) :\n ((lieCharpoly R M x y).coeff i).natDegree \u2264 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.Algebra.Lie.CartanExists).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma lieCharpoly_coeff_natDegree [Nontrivial R] (i j : \u2115) (hij : i + j = finrank R M) :\n ((lieCharpoly R M x y).coeff i).natDegree \u2264 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/Algebra/Lie/CartanExists.lean", "module": "Mathlib.Algebra.Lie.CartanExists", "declaration": "Mathlib.Algebra.Lie.CartanExists.lieCharpoly_coeff_natDegree", "span": "L112-L137", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/CartanExists.lean#L112"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 167, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 547, "lean_code_chars": 139, "natural_language_chars": 408, "lean_code_ratio": 0.2541, "line_count": 8, "imports_count": 0, "declarations_count": 67, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d60b33171db2bed0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Set.Lattice.iUnion_inter", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Lattice)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem iUnion_inter (s : Set \u03b2) (t : \u03b9 \u2192 Set \u03b2) : (\u22c3 i, t i) \u2229 s = \u22c3 i, t i \u2229 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.Data.Set.Lattice).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem iUnion_inter (s : Set \u03b2) (t : \u03b9 \u2192 Set \u03b2) : (\u22c3 i, t i) \u2229 s = \u22c3 i, t i \u2229 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/Data/Set/Lattice.lean", "module": "Mathlib.Data.Set.Lattice", "declaration": "Mathlib.Data.Set.Lattice.iUnion_inter", "span": "L337-L339", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Lattice.lean#L337"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 152, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 481, "lean_code_chars": 81, "natural_language_chars": 400, "lean_code_ratio": 0.1684, "line_count": 7, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "173107983f7c471a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Semicontinuity.Basic.lowerSemicontinuousWithinAt_iff_le_liminf", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Semicontinuity.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem lowerSemicontinuousWithinAt_iff_le_liminf {f : \u03b1 \u2192 \u03b3} :\n LowerSemicontinuousWithinAt f s x \u2194 f x \u2264 liminf f (\ud835\udcdd[s] 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.Topology.Semicontinuity.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem lowerSemicontinuousWithinAt_iff_le_liminf {f : \u03b1 \u2192 \u03b3} :\n LowerSemicontinuousWithinAt f s x \u2194 f x \u2264 liminf f (\ud835\udcdd[s] 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/Topology/Semicontinuity/Basic.lean", "module": "Mathlib.Topology.Semicontinuity.Basic", "declaration": "Mathlib.Topology.Semicontinuity.Basic.lowerSemicontinuousWithinAt_iff_le_liminf", "span": "L233-L245", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Semicontinuity/Basic.lean#L233"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 165, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 541, "lean_code_chars": 128, "natural_language_chars": 413, "lean_code_ratio": 0.2366, "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": "3e15b45ec7fd00df", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.TensorPower.Basic.gMul", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.TensorPower.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ninstance gMul : GradedMonoid.GMul fun i => \u2a02[R]^i M where\n mul {i j} 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.LinearAlgebra.TensorPower.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance gMul : GradedMonoid.GMul fun i => \u2a02[R]^i M where\n mul {i j} 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/LinearAlgebra/TensorPower/Basic.lean", "module": "Mathlib.LinearAlgebra.TensorPower.Basic", "declaration": "Mathlib.LinearAlgebra.TensorPower.Basic.gMul", "span": "L79-L84", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/TensorPower/Basic.lean#L79"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 147, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 489, "lean_code_chars": 74, "natural_language_chars": 415, "lean_code_ratio": 0.1513, "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": "0da15f377eaebf95", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.NumberTheory.ArithmeticFunction.Zeta.ppow_succ", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.ArithmeticFunction.Zeta)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem ppow_succ {f : ArithmeticFunction R} {k : \u2115} {kpos : 0 < k} :\n f.ppow (k + 1) = (f.ppow k).pmul 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.NumberTheory.ArithmeticFunction.Zeta).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem ppow_succ {f : ArithmeticFunction R} {k : \u2115} {kpos : 0 < k} :\n f.ppow (k + 1) = (f.ppow k).pmul 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/NumberTheory/ArithmeticFunction/Zeta.lean", "module": "Mathlib.NumberTheory.ArithmeticFunction.Zeta", "declaration": "Mathlib.NumberTheory.ArithmeticFunction.Zeta.ppow_succ", "span": "L164-L174", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ArithmeticFunction/Zeta.lean#L164"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 167, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 529, "lean_code_chars": 109, "natural_language_chars": 420, "lean_code_ratio": 0.206, "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": "eceab20abb1ce879", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Instances.ENNReal.Lemmas.le_of_forall_lt_one_mul_le", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Instances.ENNReal.Lemmas)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem le_of_forall_lt_one_mul_le {x y : \u211d\u22650\u221e} (h : \u2200 a < 1, a * x \u2264 y) : x \u2264 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.Topology.Instances.ENNReal.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem le_of_forall_lt_one_mul_le {x y : \u211d\u22650\u221e} (h : \u2200 a < 1, a * x \u2264 y) : x \u2264 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/Topology/Instances/ENNReal/Lemmas.lean", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas", "declaration": "Mathlib.Topology.Instances.ENNReal.Lemmas.le_of_forall_lt_one_mul_le", "span": "L448-L453", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Instances/ENNReal/Lemmas.lean#L448"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 159, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 498, "lean_code_chars": 81, "natural_language_chars": 417, "lean_code_ratio": 0.1627, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0b77d76deae6d1c0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Topology.Algebra.UniformRing.mapRingHom_coe", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.UniformRing)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mapRingHom_coe (hf : Continuous f) (a : \u03b1) : mapRingHom f hf a = f 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.Topology.Algebra.UniformRing).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mapRingHom_coe (hf : Continuous f) (a : \u03b1) : mapRingHom f hf a = f 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/Topology/Algebra/UniformRing.lean", "module": "Mathlib.Topology.Algebra.UniformRing", "declaration": "Mathlib.Topology.Algebra.UniformRing.mapRingHom_coe", "span": "L162-L164", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/UniformRing.lean#L162"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 142, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 489, "lean_code_chars": 77, "natural_language_chars": 412, "lean_code_ratio": 0.1575, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "317bf32a6fdb54e7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Rat.Lemmas.mkRat_add_mkRat_of_den", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Rat.Lemmas)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mkRat_add_mkRat_of_den (n\u2081 n\u2082 : Int) {d : Nat} (h : d \u2260 0) :\n mkRat n\u2081 d + mkRat n\u2082 d = mkRat (n\u2081 + n\u2082) d\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.Data.Rat.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mkRat_add_mkRat_of_den (n\u2081 n\u2082 : Int) {d : Nat} (h : d \u2260 0) :\n mkRat n\u2081 d + mkRat n\u2082 d = mkRat (n\u2081 + n\u2082) d\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/Data/Rat/Lemmas.lean", "module": "Mathlib.Data.Rat.Lemmas", "declaration": "Mathlib.Data.Rat.Lemmas.mkRat_add_mkRat_of_den", "span": "L187-L192", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Rat/Lemmas.lean#L187"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 171, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 516, "lean_code_chars": 117, "natural_language_chars": 399, "lean_code_ratio": 0.2267, "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": "b092dda8365561e4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Module.SpanRank.Ideal", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Module.SpanRank)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma Ideal.spanRank_map_eq_of_ringEquiv (f : R \u2243+* S) (I : Ideal R) :\n (I.map f).spanRank = I.spanRank\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.Algebra.Module.SpanRank).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Ideal.spanRank_map_eq_of_ringEquiv (f : R \u2243+* S) (I : Ideal R) :\n (I.map f).spanRank = I.spanRank\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/Algebra/Module/SpanRank.lean", "module": "Mathlib.Algebra.Module.SpanRank", "declaration": "Mathlib.Algebra.Module.SpanRank.Ideal", "span": "L385-L388", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Module/SpanRank.lean#L385"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 153, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 514, "lean_code_chars": 107, "natural_language_chars": 407, "lean_code_ratio": 0.2082, "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": "2657c4f244efefa6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Polynomial.PartialFractions.eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Polynomial.PartialFractions)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow [Nontrivial R] {\u03b9 : Type*} [DecidableEq \u03b9]\n {s : Finset \u03b9} (f : R[X]) {g : \u03b9 \u2192 R[X]} (hg : \u2200 i \u2208 s, (g i).Monic)\n (hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) (n : \u03b9 \u2192 \u2115) :\n \u2203 (q : R[X]) (r : (i : \u03b9) \u2192 Fin (n i) \u2192 R[X]),\n (\u2200 i \u2208 s, \u2200 j, (r i j).degree < (g i).degree) \u2227\n f = q * (\u220f i \u2208 s, g i ^ n i) +\n \u2211 i \u2208 s, \u2211 j, r i j * g i ^ j.1 * \u220f k \u2208 s.erase i, g k ^ n 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.Algebra.Polynomial.PartialFractions).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow [Nontrivial R] {\u03b9 : Type*} [DecidableEq \u03b9]\n {s : Finset \u03b9} (f : R[X]) {g : \u03b9 \u2192 R[X]} (hg : \u2200 i \u2208 s, (g i).Monic)\n (hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) (n : \u03b9 \u2192 \u2115) :\n \u2203 (q : R[X]) (r : (i : \u03b9) \u2192 Fin (n i) \u2192 R[X]),\n (\u2200 i \u2208 s, \u2200 j, (r i j).degree < (g i).degree) \u2227\n f = q * (\u220f i \u2208 s, g i ^ n i) +\n \u2211 i \u2208 s, \u2211 j, r i j * g i ^ j.1 * \u220f k \u2208 s.erase i, g k ^ n 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/Algebra/Polynomial/PartialFractions.lean", "module": "Mathlib.Algebra.Polynomial.PartialFractions", "declaration": "Mathlib.Algebra.Polynomial.PartialFractions.eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow", "span": "L265-L294", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/PartialFractions.lean#L265"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 337, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 873, "lean_code_chars": 454, "natural_language_chars": 419, "lean_code_ratio": 0.52, "line_count": 13, "imports_count": 0, "declarations_count": 122, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b410ddb86efaaf45", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Data.Nat.Cast.Basic.ofNat_def", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Nat.Cast.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\nlemma ofNat_def (n : \u2115) [\u2200 i, OfNat (\u03c0 i) n] : (OfNat.ofNat n : \u2200 a, \u03c0 a) = fun _ \u21a6 ofNat(n)\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.Data.Nat.Cast.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma ofNat_def (n : \u2115) [\u2200 i, OfNat (\u03c0 i) n] : (OfNat.ofNat n : \u2200 a, \u03c0 a) = fun _ \u21a6 ofNat(n)\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/Data/Nat/Cast/Basic.lean", "module": "Mathlib.Data.Nat.Cast.Basic", "declaration": "Mathlib.Data.Nat.Cast.Basic.ofNat_def", "span": "L213-L218", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Nat/Cast/Basic.lean#L213"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 158, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 496, "lean_code_chars": 93, "natural_language_chars": 403, "lean_code_ratio": 0.1875, "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": "956530b4963b5914", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.mul_def", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.AffineEquiv)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem mul_def (e e' : P\u2081 \u2243\u1d43[k] P\u2081) : e * e' = e'.trans e\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.LinearAlgebra.AffineSpace.AffineEquiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mul_def (e e' : P\u2081 \u2243\u1d43[k] P\u2081) : e * e' = e'.trans e\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/LinearAlgebra/AffineSpace/AffineEquiv.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.AffineEquiv", "declaration": "Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.mul_def", "span": "L333-L335", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/AffineEquiv.lean#L333"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 150, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 480, "lean_code_chars": 59, "natural_language_chars": 421, "lean_code_ratio": 0.1229, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3dcacfac7d3c0db9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.UpperLower.Closure.giUpperClosureCoe", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Closure)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ndef giUpperClosureCoe :\n GaloisInsertion (toDual \u2218 upperClosure : Set \u03b1 \u2192 (UpperSet \u03b1)\u1d52\u1d48) ((\u2191) \u2218 ofDual) where\n choice s hs\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.Order.UpperLower.Closure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef giUpperClosureCoe :\n GaloisInsertion (toDual \u2218 upperClosure : Set \u03b1 \u2192 (UpperSet \u03b1)\u1d52\u1d48) ((\u2191) \u2218 ofDual) where\n choice s hs\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/Order/UpperLower/Closure.lean", "module": "Mathlib.Order.UpperLower.Closure", "declaration": "Mathlib.Order.UpperLower.Closure.giUpperClosureCoe", "span": "L94-L101", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/UpperLower/Closure.lean#L94"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 167, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 536, "lean_code_chars": 128, "natural_language_chars": 408, "lean_code_ratio": 0.2388, "line_count": 9, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ad5c3e0d816c26b8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Algebra.Group.Pointwise.Finset.Basic.preimage_mul_left_one'", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Pointwise.Finset.Basic)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem preimage_mul_left_one' : preimage 1 (a\u207b\u00b9 * \u00b7) (mul_right_injective _).injOn = {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.Algebra.Group.Pointwise.Finset.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem preimage_mul_left_one' : preimage 1 (a\u207b\u00b9 * \u00b7) (mul_right_injective _).injOn = {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/Algebra/Group/Pointwise/Finset/Basic.lean", "module": "Mathlib.Algebra.Group.Pointwise.Finset.Basic", "declaration": "Mathlib.Algebra.Group.Pointwise.Finset.Basic.preimage_mul_left_one'", "span": "L1115-L1117", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean#L1115"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 149, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 510, "lean_code_chars": 90, "natural_language_chars": 420, "lean_code_ratio": 0.1765, "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": "bdb6a45f381721da", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.LinearAlgebra.Ray.exists_nonneg_right", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Ray)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem exists_nonneg_right (h : SameRay R x y) (hy : y \u2260 0) : \u2203 r : R, 0 \u2264 r \u2227 x = r \u2022 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.LinearAlgebra.Ray).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem exists_nonneg_right (h : SameRay R x y) (hy : y \u2260 0) : \u2203 r : R, 0 \u2264 r \u2227 x = r \u2022 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/LinearAlgebra/Ray.lean", "module": "Mathlib.LinearAlgebra.Ray", "declaration": "Mathlib.LinearAlgebra.Ray.exists_nonneg_right", "span": "L586-L590", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Ray.lean#L586"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 153, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 491, "lean_code_chars": 90, "natural_language_chars": 401, "lean_code_ratio": 0.1833, "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": "411445737990633c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "A-Mathlib.Order.BoundedOrder.Monotone.forall_ge_iff", "category": "A", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.BoundedOrder.Monotone)."}, {"role": "user", "content": "Complete the following proof.\n\n```lean\ntheorem forall_ge_iff {P : \u03b1 \u2192 Prop} {x\u2080 : \u03b1} (hP : Monotone P) :\n (\u2200 x \u2265 x\u2080, P x) \u2194 P 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.Order.BoundedOrder.Monotone).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem forall_ge_iff {P : \u03b1 \u2192 Prop} {x\u2080 : \u03b1} (hP : Monotone P) :\n (\u2200 x \u2265 x\u2080, P x) \u2194 P 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/Order/BoundedOrder/Monotone.lean", "module": "Mathlib.Order.BoundedOrder.Monotone", "declaration": "Mathlib.Order.BoundedOrder.Monotone.forall_ge_iff", "span": "L118-L121", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/BoundedOrder/Monotone.lean#L118"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 163, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 504, "lean_code_chars": 93, "natural_language_chars": 411, "lean_code_ratio": 0.1845, "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": "0b78384b7768b29c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Multiset.Powerset.powersetCard_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.Data.Multiset.Powerset)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem powersetCard_map {\u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) (n : \u2115) (s : Multiset \u03b1) :\n powersetCard n (s.map f) = (powersetCard n s).map (map f)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux (L30-L32)\ndef powersetAux (l : List \u03b1) : List (Multiset \u03b1)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux_eq_map_coe (L33-L35)\ntheorem powersetAux_eq_map_coe {l : List \u03b1} : powersetAux l = (sublists l).map (\u2191)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Multiset.Powerset.mem_powersetAux (L37-L41)\ntheorem mem_powersetAux {l : List \u03b1} {s} : s \u2208 powersetAux l \u2194 s \u2264 \u2191l\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux' (L42-L44)\ndef powersetAux' (l : List \u03b1) : List (Multiset \u03b1)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux_perm_powersetAux' (L45-L47)\ntheorem powersetAux_perm_powersetAux' {l : List \u03b1} : powersetAux l ~ powersetAux' l\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux'_nil (L49-L51)\ntheorem powersetAux'_nil : powersetAux' (@nil \u03b1) = [0]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux'_cons (L53-L56)\ntheorem powersetAux'_cons (a : \u03b1) (l : List \u03b1) :\n powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Multiset.Powerset.powerset_aux'_perm (L57-L70)\ntheorem powerset_aux'_perm {l\u2081 l\u2082 : List \u03b1} (p : l\u2081 ~ l\u2082) : powersetAux' l\u2081 ~ powersetAux' l\u2082\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)\nlemma subset_add_left {s t : Multiset \u03b1} : s \u2286 s + t\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)\nlemma le_add_left (s t : Multiset \u03b1) : s \u2264 t + s\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)\nlemma le_add_right (s t : Multiset \u03b1) : s \u2264 s + t\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)\ntheorem singleton_add (a : \u03b1) (s : Multiset \u03b1) : {a} + s = a ::\u2098 s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)\nlemma subset_add_right {s t : Multiset \u03b1} : s \u2286 t + s\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)\ntheorem coe_add (s t : List \u03b1) : (s + t : Multiset \u03b1) = (s ++ t : List \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.Data.Multiset.Powerset).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem powersetCard_map {\u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) (n : \u2115) (s : Multiset \u03b1) :\n powersetCard n (s.map f) = (powersetCard n s).map (map f)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux (L30-L32)\ndef powersetAux (l : List \u03b1) : List (Multiset \u03b1)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux_eq_map_coe (L33-L35)\ntheorem powersetAux_eq_map_coe {l : List \u03b1} : powersetAux l = (sublists l).map (\u2191)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Multiset.Powerset.mem_powersetAux (L37-L41)\ntheorem mem_powersetAux {l : List \u03b1} {s} : s \u2208 powersetAux l \u2194 s \u2264 \u2191l\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux' (L42-L44)\ndef powersetAux' (l : List \u03b1) : List (Multiset \u03b1)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux_perm_powersetAux' (L45-L47)\ntheorem powersetAux_perm_powersetAux' {l : List \u03b1} : powersetAux l ~ powersetAux' l\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux'_nil (L49-L51)\ntheorem powersetAux'_nil : powersetAux' (@nil \u03b1) = [0]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Multiset.Powerset.powersetAux'_cons (L53-L56)\ntheorem powersetAux'_cons (a : \u03b1) (l : List \u03b1) :\n powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Multiset.Powerset.powerset_aux'_perm (L57-L70)\ntheorem powerset_aux'_perm {l\u2081 l\u2082 : List \u03b1} (p : l\u2081 ~ l\u2082) : powersetAux' l\u2081 ~ powersetAux' l\u2082\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)\nlemma subset_add_left {s t : Multiset \u03b1} : s \u2286 s + t\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)\nlemma le_add_left (s t : Multiset \u03b1) : s \u2264 t + s\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)\nlemma le_add_right (s t : Multiset \u03b1) : s \u2264 s + t\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)\ntheorem singleton_add (a : \u03b1) (s : Multiset \u03b1) : {a} + s = a ::\u2098 s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)\nlemma subset_add_right {s t : Multiset \u03b1} : s \u2286 t + s\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)\ntheorem coe_add (s t : List \u03b1) : (s + t : Multiset \u03b1) = (s ++ t : List \u03b1)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Multiset/Powerset.lean", "module": "Mathlib.Data.Multiset.Powerset", "declaration": "Mathlib.Data.Multiset.Powerset.powersetCard_map", "span": "L297-L302", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Multiset/Powerset.lean#L297"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 993, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2729, "lean_code_chars": 1932, "natural_language_chars": 797, "lean_code_ratio": 0.708, "line_count": 93, "imports_count": 0, "declarations_count": 256, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "8f60b9585d161729", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Lie.Prod.inr_eq_prod", "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.Algebra.Lie.Prod)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem inr_eq_prod : inr R L\u2081 L\u2082 = prod 0 LieHom.id\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Prod.instLieRing (L42-L48)\ninstance instLieRing : LieRing (L\u2081 \u00d7 L\u2082) where\n bracket x y\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Prod.bracket_apply (L50-L51)\ntheorem bracket_apply (x y : L\u2081 \u00d7 L\u2082) : \u2045x, y\u2046 = \u27e8\u2045x.1, y.1\u2046, \u2045x.2, y.2\u2046\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Prod.instLieAlgebra (L52-L58)\ninstance instLieAlgebra : LieAlgebra R (L\u2081 \u00d7 L\u2082) where\n lie_smul _ _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Prod.fst (L63-L67)\ndef fst : L\u2081 \u00d7 L\u2082 \u2192\u2097\u2045R\u2046 L\u2081 where\n toLinearMap\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Prod.snd (L68-L72)\ndef snd : L\u2081 \u00d7 L\u2082 \u2192\u2097\u2045R\u2046 L\u2082 where\n toLinearMap\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Prod.inl (L73-L77)\ndef inl : L\u2081 \u2192\u2097\u2045R\u2046 L\u2081 \u00d7 L\u2082 where\n toLinearMap\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.Prod.inr (L78-L81)\ndef inr : L\u2082 \u2192\u2097\u2045R\u2046 L\u2081 \u00d7 L\u2082 where\n toLinearMap\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.Prod.fst_surjective (L92-L93)\ntheorem fst_surjective : Function.Surjective (fst R L\u2081 L\u2082)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082\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.Algebra.Lie.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem inr_eq_prod : inr R L\u2081 L\u2082 = prod 0 LieHom.id\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Prod.instLieRing (L42-L48)\ninstance instLieRing : LieRing (L\u2081 \u00d7 L\u2082) where\n bracket x y\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Prod.bracket_apply (L50-L51)\ntheorem bracket_apply (x y : L\u2081 \u00d7 L\u2082) : \u2045x, y\u2046 = \u27e8\u2045x.1, y.1\u2046, \u2045x.2, y.2\u2046\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Prod.instLieAlgebra (L52-L58)\ninstance instLieAlgebra : LieAlgebra R (L\u2081 \u00d7 L\u2082) where\n lie_smul _ _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Prod.fst (L63-L67)\ndef fst : L\u2081 \u00d7 L\u2082 \u2192\u2097\u2045R\u2046 L\u2081 where\n toLinearMap\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Prod.snd (L68-L72)\ndef snd : L\u2081 \u00d7 L\u2082 \u2192\u2097\u2045R\u2046 L\u2082 where\n toLinearMap\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Prod.inl (L73-L77)\ndef inl : L\u2081 \u2192\u2097\u2045R\u2046 L\u2081 \u00d7 L\u2082 where\n toLinearMap\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.Prod.inr (L78-L81)\ndef inr : L\u2082 \u2192\u2097\u2045R\u2046 L\u2081 \u00d7 L\u2082 where\n toLinearMap\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.Prod.fst_surjective (L92-L93)\ntheorem fst_surjective : Function.Surjective (fst R L\u2081 L\u2082)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Lie/Prod.lean", "module": "Mathlib.Algebra.Lie.Prod", "declaration": "Mathlib.Algebra.Lie.Prod.inr_eq_prod", "span": "L160-L162", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Prod.lean#L160"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1234, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3035, "lean_code_chars": 2244, "natural_language_chars": 791, "lean_code_ratio": 0.7394, "line_count": 105, "imports_count": 0, "declarations_count": 341, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "d2e151c2ccff4f0d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open", "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.Analysis.LocallyConvex.Separation)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem geometric_hahn_banach_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht : Convex \u211d t)\n (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.separate_convex_open_set (L54-L87)\ntheorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopologicalAddGroup E]\n [Module \u211d E] [ContinuousSMul \u211d E] {s : Set E} (hs\u2080 : (0 : E) \u2208 s) (hs\u2081 : Convex \u211d s)\n (hs\u2082 : IsOpen s) {x\u2080 : E} (hx\u2080 : x\u2080 \u2209 s) :\n \u2203 f : StrongDual \u211d E, f x\u2080 = 1 \u2227 \u2200 x \u2208 s, f x < 1\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_point (L124-L129)\ntheorem geometric_hahn_banach_open_point (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (disj : x \u2209 s) :\n \u2203 f : StrongDual \u211d E, \u2200 a \u2208 s, f a < f x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_point_open (L130-L134)\ntheorem geometric_hahn_banach_point_open (ht\u2081 : Convex \u211d t) (ht\u2082 : IsOpen t) (disj : x \u2209 t) :\n \u2203 f : StrongDual \u211d E, \u2200 b \u2208 t, f x < f b\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open (L135-L153)\ntheorem geometric_hahn_banach_open_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht\u2081 : Convex \u211d t)\n (ht\u2083 : IsOpen t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u < f b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior (L154-L172)\ntheorem geometric_hahn_banach_of_nonempty_interior\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) (htne : t.Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), f \u2260 0 \u2227 (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior' (L173-L184)\ntheorem geometric_hahn_banach_of_nonempty_interior'\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior_point (L185-L196)\ntheorem geometric_hahn_banach_of_nonempty_interior_point\n {A : Set E} (hA : Convex \u211d A) (hxA : x \u2209 interior A) (hAint : (interior A).Nonempty) :\n \u2203 f : StrongDual \u211d E, f \u2260 0 \u2227 \u2200 a \u2208 A, f a \u2264 f x\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_compact_closed (L197-L216)\ntheorem geometric_hahn_banach_compact_closed (hs\u2081 : Convex \u211d s) (hs\u2082 : IsCompact s)\n (ht\u2081 : Convex \u211d t) (ht\u2082 : IsClosed t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u v : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 u < v \u2227 \u2200 b \u2208 t, v < f b\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.balanced_absConvexHull (L90-L92)\ntheorem balanced_absConvexHull : Balanced \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.AbsConvex (L53-L56)\ndef AbsConvex (s : Set E) : Prop\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvex_absConvexHull (L87-L89)\ntheorem absConvex_absConvexHull : AbsConvex \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.subset_absConvexHull (L84-L86)\ntheorem subset_absConvexHull : s \u2286 absConvexHull \ud835\udd5c s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvexHull (L79-L83)\ndef absConvexHull : ClosureOperator (Set E)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.convex_absConvexHull (L93-L96)\ntheorem convex_absConvexHull : Convex \ud835\udd5c (absConvexHull \ud835\udd5c s)\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.Analysis.LocallyConvex.Separation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem geometric_hahn_banach_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht : Convex \u211d t)\n (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.separate_convex_open_set (L54-L87)\ntheorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopologicalAddGroup E]\n [Module \u211d E] [ContinuousSMul \u211d E] {s : Set E} (hs\u2080 : (0 : E) \u2208 s) (hs\u2081 : Convex \u211d s)\n (hs\u2082 : IsOpen s) {x\u2080 : E} (hx\u2080 : x\u2080 \u2209 s) :\n \u2203 f : StrongDual \u211d E, f x\u2080 = 1 \u2227 \u2200 x \u2208 s, f x < 1\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_point (L124-L129)\ntheorem geometric_hahn_banach_open_point (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (disj : x \u2209 s) :\n \u2203 f : StrongDual \u211d E, \u2200 a \u2208 s, f a < f x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_point_open (L130-L134)\ntheorem geometric_hahn_banach_point_open (ht\u2081 : Convex \u211d t) (ht\u2082 : IsOpen t) (disj : x \u2209 t) :\n \u2203 f : StrongDual \u211d E, \u2200 b \u2208 t, f x < f b\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open (L135-L153)\ntheorem geometric_hahn_banach_open_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht\u2081 : Convex \u211d t)\n (ht\u2083 : IsOpen t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u < f b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior (L154-L172)\ntheorem geometric_hahn_banach_of_nonempty_interior\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) (htne : t.Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), f \u2260 0 \u2227 (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior' (L173-L184)\ntheorem geometric_hahn_banach_of_nonempty_interior'\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior_point (L185-L196)\ntheorem geometric_hahn_banach_of_nonempty_interior_point\n {A : Set E} (hA : Convex \u211d A) (hxA : x \u2209 interior A) (hAint : (interior A).Nonempty) :\n \u2203 f : StrongDual \u211d E, f \u2260 0 \u2227 \u2200 a \u2208 A, f a \u2264 f x\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_compact_closed (L197-L216)\ntheorem geometric_hahn_banach_compact_closed (hs\u2081 : Convex \u211d s) (hs\u2082 : IsCompact s)\n (ht\u2081 : Convex \u211d t) (ht\u2082 : IsClosed t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u v : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 u < v \u2227 \u2200 b \u2208 t, v < f b\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.balanced_absConvexHull (L90-L92)\ntheorem balanced_absConvexHull : Balanced \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.AbsConvex (L53-L56)\ndef AbsConvex (s : Set E) : Prop\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvex_absConvexHull (L87-L89)\ntheorem absConvex_absConvexHull : AbsConvex \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.subset_absConvexHull (L84-L86)\ntheorem subset_absConvexHull : s \u2286 absConvexHull \ud835\udd5c s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvexHull (L79-L83)\ndef absConvexHull : ClosureOperator (Set E)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.convex_absConvexHull (L93-L96)\ntheorem convex_absConvexHull : Convex \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/LocallyConvex/Separation.lean", "module": "Mathlib.Analysis.LocallyConvex.Separation", "declaration": "Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open", "span": "L94-L123", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/LocallyConvex/Separation.lean#L94"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1730, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4215, "lean_code_chars": 3407, "natural_language_chars": 808, "lean_code_ratio": 0.8083, "line_count": 110, "imports_count": 0, "declarations_count": 413, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "e6e614824cd70604", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Lie.Graded.ofGrading_apply_apply", "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.Algebra.Lie.Graded)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma ofGrading_apply_apply (\u03c6 : \u03b9 \u2192+ R) {i : \u03b9} {a : L} (ha : a \u2208 \u2112 i) :\n ofGrading \u2112 \u03c6 a = \u03c6 i \u2022 a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Graded.bracket_apply_apply (L64-L68)\nlemma bracket_apply_apply (x y : \u2a01 i, \u2112 i) :\n \u2045x, y\u2046 =\n decomposeLinearEquiv \u2112 \u2045(decomposeLinearEquiv \u2112).symm x, (decomposeLinearEquiv \u2112).symm y\u2046\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Graded.decompose_bracket (L72-L75)\nlemma decompose_bracket (x y : L) : decompose \u2112 \u2045x, y\u2046 = \u2045decompose \u2112 x, decompose \u2112 y\u2046\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Graded.decompose_symm_bracket (L77-L81)\nlemma decompose_symm_bracket (x y : \u2a01 i, \u2112 i) :\n (decompose \u2112).symm \u2045x, y\u2046 = \u2045(decompose \u2112).symm x, (decompose \u2112).symm y\u2046\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Graded.decomposeLieEquiv (L89-L101)\ndef decomposeLieEquiv : L \u2243\u2097\u2045R\u2046 \u2a01 i, \u2112 i\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Graded.ofGradingSum (L102-L134)\ndef ofGradingSum (\u03c6 : \u03b9 \u2192+ R) : LieDerivation R (\u2a01 i, \u2112 i) (\u2a01 i, \u2112 i)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Graded.ofGradingSum_of (L136-L141)\nlemma ofGradingSum_of (\u03c6 : \u03b9 \u2192+ R) (i : \u03b9) (a : \u2112 i) :\n ofGradingSum \u2112 \u03c6 (of (\u2112 \u00b7) i a) = (\u03c6 i) \u2022 (of (\u2112 \u00b7) i a)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.Graded.ofGrading (L142-L148)\ndef ofGrading (\u03c6 : \u03b9 \u2192+ R) :\n LieDerivation R L L where\n toFun x\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082\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.Algebra.Lie.Graded).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma ofGrading_apply_apply (\u03c6 : \u03b9 \u2192+ R) {i : \u03b9} {a : L} (ha : a \u2208 \u2112 i) :\n ofGrading \u2112 \u03c6 a = \u03c6 i \u2022 a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Graded.bracket_apply_apply (L64-L68)\nlemma bracket_apply_apply (x y : \u2a01 i, \u2112 i) :\n \u2045x, y\u2046 =\n decomposeLinearEquiv \u2112 \u2045(decomposeLinearEquiv \u2112).symm x, (decomposeLinearEquiv \u2112).symm y\u2046\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Graded.decompose_bracket (L72-L75)\nlemma decompose_bracket (x y : L) : decompose \u2112 \u2045x, y\u2046 = \u2045decompose \u2112 x, decompose \u2112 y\u2046\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Graded.decompose_symm_bracket (L77-L81)\nlemma decompose_symm_bracket (x y : \u2a01 i, \u2112 i) :\n (decompose \u2112).symm \u2045x, y\u2046 = \u2045(decompose \u2112).symm x, (decompose \u2112).symm y\u2046\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Graded.decomposeLieEquiv (L89-L101)\ndef decomposeLieEquiv : L \u2243\u2097\u2045R\u2046 \u2a01 i, \u2112 i\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Graded.ofGradingSum (L102-L134)\ndef ofGradingSum (\u03c6 : \u03b9 \u2192+ R) : LieDerivation R (\u2a01 i, \u2112 i) (\u2a01 i, \u2112 i)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Graded.ofGradingSum_of (L136-L141)\nlemma ofGradingSum_of (\u03c6 : \u03b9 \u2192+ R) (i : \u03b9) (a : \u2112 i) :\n ofGradingSum \u2112 \u03c6 (of (\u2112 \u00b7) i a) = (\u03c6 i) \u2022 (of (\u2112 \u00b7) i a)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.Graded.ofGrading (L142-L148)\ndef ofGrading (\u03c6 : \u03b9 \u2192+ R) :\n LieDerivation R L L where\n toFun x\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Lie/Graded.lean", "module": "Mathlib.Algebra.Lie.Graded", "declaration": "Mathlib.Algebra.Lie.Graded.ofGrading_apply_apply", "span": "L149-L154", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Graded.lean#L149"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1352, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3300, "lean_code_chars": 2534, "natural_language_chars": 766, "lean_code_ratio": 0.7679, "line_count": 100, "imports_count": 0, "declarations_count": 352, "diagnostics_count": 0, "retrieval_snippets_count": 13, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "5b751b4c01638dbe", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.LocalProperties.Basic.RingHom", "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.RingTheory.LocalProperties.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma RingHom.LocalizationAwayPreserves.and (hP : LocalizationAwayPreserves P)\n (hQ : LocalizationAwayPreserves Q) :\n LocalizationAwayPreserves (fun f \u21a6 P f \u2227 Q f)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.LocalizationPreserves (L65-L70)\ndef LocalizationPreserves : Prop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.OfLocalizationMaximal (L71-L82)\ndef OfLocalizationMaximal : Prop\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L525-L528)\ntheorem Ideal.localized'_eq_map (I : Ideal R) :\n Submodule.localized' S p (Algebra.linearMap R S) I = I.map (algebraMap R S)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L529-L532)\ntheorem Ideal.localized\u2080_eq_restrictScalars_map (I : Ideal R) :\n Submodule.localized\u2080 p (Algebra.linearMap R S) I = (I.map (algebraMap R S)).restrictScalars R\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Algebra (L533-L538)\ntheorem Algebra.idealMap_eq_ofEq_comp_toLocalized\u2080 (I : Ideal R) :\n Algebra.idealMap S I =\n (LinearEquiv.ofEq _ _ <| Ideal.localized\u2080_eq_restrictScalars_map S p I).toLinearMap \u2218\u2097\n Submodule.toLocalized\u2080 p (Algebra.linearMap R S) I\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L539-L547)\ntheorem Ideal.mem_of_localization_maximal {r : R} {J : Ideal R}\n (h : \u2200 (P : Ideal R) (_ : P.IsMaximal),\n algebraMap R _ r \u2208 Ideal.map (algebraMap R (Localization.AtPrime P)) J) :\n r \u2208 J\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L548-L554)\ntheorem Ideal.le_of_localization_maximal {I J : Ideal R}\n (h : \u2200 (P : Ideal R) (_ : P.IsMaximal),\n Ideal.map (algebraMap R (Localization.AtPrime P)) I \u2264\n Ideal.map (algebraMap R (Localization.AtPrime P)) J) :\n I \u2264 J\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L555-L566)\nlemma Ideal.iInf_ker_le (I : Ideal R) :\n \u2a05 (p : Ideal R) (_ : p.IsPrime) (_ : I \u2264 p),\n RingHom.ker (algebraMap R (Localization.AtPrime p)) \u2264 I\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.LinearIndependent (L91-L103)\ntheorem LinearIndependent.of_isLocalized_maximal {\u03b9} (v : \u03b9 \u2192 M)\n (H : \u2200 (P : Ideal R) [P.IsMaximal], LinearIndependent (R\u209a P) (f P \u2218 v)) :\n LinearIndependent R v\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_localized_maximal (L104-L108)\ntheorem injective_of_localized_maximal\n (h : \u2200 (J : Ideal R) [J.IsMaximal], Function.Injective (map J.primeCompl f)) :\n Function.Injective f\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.bijective_of_isLocalized_maximal (L72-L77)\ntheorem bijective_of_isLocalized_maximal\n (H : \u2200 (P : Ideal R) [P.IsMaximal], Function.Bijective (map P.primeCompl (f P) (g P) F)) :\n Function.Bijective F\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_isLocalized_maximal (L60-L64)\ntheorem injective_of_isLocalized_maximal\n (H : \u2200 (P : Ideal R) [P.IsMaximal], Function.Injective (map P.primeCompl (f P) (g P) F)) :\n Function.Injective F\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.surjective_of_isLocalized_maximal (L65-L71)\ntheorem surjective_of_isLocalized_maximal\n (H : \u2200 (P : Ideal R) [P.IsMaximal], Function.Surjective (map P.primeCompl (f P) (g P) F)) :\n Function.Surjective F\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.exact_of_isLocalized_maximal (L78-L90)\ntheorem exact_of_isLocalized_maximal (H : \u2200 (J : Ideal R) [J.IsMaximal],\n Function.Exact (map J.primeCompl (f J) (g J) F) (map J.primeCompl (g J) (h J) G)) :\n Function.Exact F G\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.RingTheory.LocalProperties.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma RingHom.LocalizationAwayPreserves.and (hP : LocalizationAwayPreserves P)\n (hQ : LocalizationAwayPreserves Q) :\n LocalizationAwayPreserves (fun f \u21a6 P f \u2227 Q f)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.LocalizationPreserves (L65-L70)\ndef LocalizationPreserves : Prop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.OfLocalizationMaximal (L71-L82)\ndef OfLocalizationMaximal : Prop\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L525-L528)\ntheorem Ideal.localized'_eq_map (I : Ideal R) :\n Submodule.localized' S p (Algebra.linearMap R S) I = I.map (algebraMap R S)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L529-L532)\ntheorem Ideal.localized\u2080_eq_restrictScalars_map (I : Ideal R) :\n Submodule.localized\u2080 p (Algebra.linearMap R S) I = (I.map (algebraMap R S)).restrictScalars R\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Algebra (L533-L538)\ntheorem Algebra.idealMap_eq_ofEq_comp_toLocalized\u2080 (I : Ideal R) :\n Algebra.idealMap S I =\n (LinearEquiv.ofEq _ _ <| Ideal.localized\u2080_eq_restrictScalars_map S p I).toLinearMap \u2218\u2097\n Submodule.toLocalized\u2080 p (Algebra.linearMap R S) I\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L539-L547)\ntheorem Ideal.mem_of_localization_maximal {r : R} {J : Ideal R}\n (h : \u2200 (P : Ideal R) (_ : P.IsMaximal),\n algebraMap R _ r \u2208 Ideal.map (algebraMap R (Localization.AtPrime P)) J) :\n r \u2208 J\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L548-L554)\ntheorem Ideal.le_of_localization_maximal {I J : Ideal R}\n (h : \u2200 (P : Ideal R) (_ : P.IsMaximal),\n Ideal.map (algebraMap R (Localization.AtPrime P)) I \u2264\n Ideal.map (algebraMap R (Localization.AtPrime P)) J) :\n I \u2264 J\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L555-L566)\nlemma Ideal.iInf_ker_le (I : Ideal R) :\n \u2a05 (p : Ideal R) (_ : p.IsPrime) (_ : I \u2264 p),\n RingHom.ker (algebraMap R (Localization.AtPrime p)) \u2264 I\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.LinearIndependent (L91-L103)\ntheorem LinearIndependent.of_isLocalized_maximal {\u03b9} (v : \u03b9 \u2192 M)\n (H : \u2200 (P : Ideal R) [P.IsMaximal], LinearIndependent (R\u209a P) (f P \u2218 v)) :\n LinearIndependent R v\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_localized_maximal (L104-L108)\ntheorem injective_of_localized_maximal\n (h : \u2200 (J : Ideal R) [J.IsMaximal], Function.Injective (map J.primeCompl f)) :\n Function.Injective f\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.bijective_of_isLocalized_maximal (L72-L77)\ntheorem bijective_of_isLocalized_maximal\n (H : \u2200 (P : Ideal R) [P.IsMaximal], Function.Bijective (map P.primeCompl (f P) (g P) F)) :\n Function.Bijective F\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_isLocalized_maximal (L60-L64)\ntheorem injective_of_isLocalized_maximal\n (H : \u2200 (P : Ideal R) [P.IsMaximal], Function.Injective (map P.primeCompl (f P) (g P) F)) :\n Function.Injective F\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.surjective_of_isLocalized_maximal (L65-L71)\ntheorem surjective_of_isLocalized_maximal\n (H : \u2200 (P : Ideal R) [P.IsMaximal], Function.Surjective (map P.primeCompl (f P) (g P) F)) :\n Function.Surjective F\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.LocalProperties.Exactness.exact_of_isLocalized_maximal (L78-L90)\ntheorem exact_of_isLocalized_maximal (H : \u2200 (J : Ideal R) [J.IsMaximal],\n Function.Exact (map J.primeCompl (f J) (g J) F) (map J.primeCompl (g J) (h J) G)) :\n Function.Exact F G\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/LocalProperties/Basic.lean", "module": "Mathlib.RingTheory.LocalProperties.Basic", "declaration": "Mathlib.RingTheory.LocalProperties.Basic.RingHom", "span": "L455-L460", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/LocalProperties/Basic.lean#L455"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1408, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4201, "lean_code_chars": 3394, "natural_language_chars": 807, "lean_code_ratio": 0.8079, "line_count": 119, "imports_count": 0, "declarations_count": 372, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "96967d128d01e4ee", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Lie.Classical.indefiniteDiagonal_transform", "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.Algebra.Lie.Classical)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem indefiniteDiagonal_transform {i : R} (hi : i * i = -1) :\n (Pso p q R i)\u1d40 * indefiniteDiagonal p q R * Pso p q R i = 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Classical.matrix_trace_commutator_zero (L83-L92)\ntheorem matrix_trace_commutator_zero [Fintype n] (X Y : Matrix n n R) : Matrix.trace \u2045X, Y\u2046 = 0\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Classical.sl (L93-L96)\ndef sl [Fintype n] : LieSubalgebra R (Matrix n n R)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Classical.sl_bracket (L97-L106)\ntheorem sl_bracket [Fintype n] (A B : sl n R) : \u2045A, B\u2046.val = A.val * B.val - B.val * A.val\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Classical.single (L107-L109)\ndef single (h : i \u2260 j) : R \u2192\u2097[R] sl n R\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Classical.val_single (L111-L115)\ntheorem val_single (h : i \u2260 j) (r : R) : (single i j h r).val = Matrix.single i j r\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Classical.singleSubSingle (L116-L119)\ndef singleSubSingle : R \u2192\u2097[R] sl n R\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.Classical.val_singleSubSingle (L121-L124)\ntheorem val_singleSubSingle (r : R) :\n (singleSubSingle i j r).val = Matrix.single i i r - Matrix.single j j r\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.Classical.singleSubSingle_add_singleSubSingle (L126-L129)\ntheorem singleSubSingle_add_singleSubSingle (r : R) :\n singleSubSingle i j r + singleSubSingle j k r = singleSubSingle i k r\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y\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.Algebra.Lie.Classical).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem indefiniteDiagonal_transform {i : R} (hi : i * i = -1) :\n (Pso p q R i)\u1d40 * indefiniteDiagonal p q R * Pso p q R i = 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Classical.matrix_trace_commutator_zero (L83-L92)\ntheorem matrix_trace_commutator_zero [Fintype n] (X Y : Matrix n n R) : Matrix.trace \u2045X, Y\u2046 = 0\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Classical.sl (L93-L96)\ndef sl [Fintype n] : LieSubalgebra R (Matrix n n R)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Classical.sl_bracket (L97-L106)\ntheorem sl_bracket [Fintype n] (A B : sl n R) : \u2045A, B\u2046.val = A.val * B.val - B.val * A.val\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Classical.single (L107-L109)\ndef single (h : i \u2260 j) : R \u2192\u2097[R] sl n R\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Classical.val_single (L111-L115)\ntheorem val_single (h : i \u2260 j) (r : R) : (single i j h r).val = Matrix.single i j r\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Classical.singleSubSingle (L116-L119)\ndef singleSubSingle : R \u2192\u2097[R] sl n R\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.Classical.val_singleSubSingle (L121-L124)\ntheorem val_singleSubSingle (r : R) :\n (singleSubSingle i j r).val = Matrix.single i i r - Matrix.single j j r\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.Classical.singleSubSingle_add_singleSubSingle (L126-L129)\ntheorem singleSubSingle_add_singleSubSingle (r : R) :\n singleSubSingle i j r + singleSubSingle j k r = singleSubSingle i k r\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Lie/Classical.lean", "module": "Mathlib.Algebra.Lie.Classical", "declaration": "Mathlib.Algebra.Lie.Classical.indefiniteDiagonal_transform", "span": "L209-L232", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Classical.lean#L209"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1290, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3416, "lean_code_chars": 2620, "natural_language_chars": 796, "lean_code_ratio": 0.767, "line_count": 102, "imports_count": 0, "declarations_count": 389, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "f2bb6c7f508e89d0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.latticeBasis_repr_apply", "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.NumberTheory.NumberField.CanonicalEmbedding.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem latticeBasis_repr_apply (x : K) (i : ChooseBasisIndex \u2124 (\ud835\udcde K)) :\n (latticeBasis K).repr (mixedEmbedding K x) i = (integralBasis K).repr x i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.apply_at (L59-L65)\ntheorem apply_at (\u03c6 : K \u2192+* \u2102) (x : K) : (NumberField.canonicalEmbedding K x) \u03c6 = \u03c6 x\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.conj_apply (L66-L76)\ntheorem conj_apply {x : ((K \u2192+* \u2102) \u2192 \u2102)} (\u03c6 : K \u2192+* \u2102)\n (hx : x \u2208 Submodule.span \u211d (Set.range (canonicalEmbedding K))) :\n conj (x \u03c6) = x (ComplexEmbedding.conjugate \u03c6)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.nnnorm_eq (L77-L80)\ntheorem nnnorm_eq [NumberField K] (x : K) :\n \u2016canonicalEmbedding K x\u2016\u208a = Finset.univ.sup (fun \u03c6 : K \u2192+* \u2102 => \u2016\u03c6 x\u2016\u208a)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.norm_le_iff (L81-L94)\ntheorem norm_le_iff [NumberField K] (x : K) (r : \u211d) :\n \u2016canonicalEmbedding K x\u2016 \u2264 r \u2194 \u2200 \u03c6 : K \u2192+* \u2102, \u2016\u03c6 x\u2016 \u2264 r\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L95-L97)\ndef integerLattice : Subring ((K \u2192+* \u2102) \u2192 \u2102)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L98-L137)\ntheorem integerLattice.inter_ball_finite [NumberField K] (r : \u211d) :\n ((integerLattice K : Set ((K \u2192+* \u2102) \u2192 \u2102)) \u2229 Metric.closedBall 0 r).Finite\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.latticeBasis_apply (L139-L143)\ntheorem latticeBasis_apply [NumberField K] (i : Free.ChooseBasisIndex \u2124 (\ud835\udcde K)) :\n latticeBasis K i = (canonicalEmbedding K) (integralBasis K i)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.mem_span_latticeBasis (L144-L154)\ntheorem mem_span_latticeBasis [NumberField K] {x : (K \u2192+* \u2102) \u2192 \u2102} :\n x \u2208 Submodule.span \u2124 (Set.range (latticeBasis K)) \u2194\n x \u2208 ((canonicalEmbedding K).comp (algebraMap (\ud835\udcde K) K)).range\n```\n\n-- snippet 9\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_snd_apply (L70-L72)\ntheorem algebraMap_snd_apply (x : K) (v : HeightOneSpectrum R) :\n (algebraMap K (AdeleRing R K) x).2 v = x\n```\n\n-- snippet 10\n```lean\n-- Mathlib.NumberTheory.NumberField.Basic.Int (L51-L59)\ntheorem Int.not_isField : \u00acIsField \u2124\n```\n\n-- snippet 11\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_injective (L73-L76)\ntheorem algebraMap_injective [NumberField K] : Function.Injective (algebraMap K (AdeleRing R K))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_fst_apply (L66-L68)\ntheorem algebraMap_fst_apply (x : K) (v : InfinitePlace K) :\n (algebraMap K (AdeleRing R K) x).1 v = x\n```\n\n-- snippet 13\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.principalSubgroup (L77-L81)\nabbrev principalSubgroup : AddSubgroup (AdeleRing R K)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.AdeleRing (L47-L54)\ndef AdeleRing (R K : Type*) [CommRing R] [IsDedekindDomain R] [Field K]\n [Algebra R K] [IsFractionRing R K]\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.NumberTheory.NumberField.CanonicalEmbedding.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 latticeBasis_repr_apply (x : K) (i : ChooseBasisIndex \u2124 (\ud835\udcde K)) :\n (latticeBasis K).repr (mixedEmbedding K x) i = (integralBasis K).repr x i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.apply_at (L59-L65)\ntheorem apply_at (\u03c6 : K \u2192+* \u2102) (x : K) : (NumberField.canonicalEmbedding K x) \u03c6 = \u03c6 x\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.conj_apply (L66-L76)\ntheorem conj_apply {x : ((K \u2192+* \u2102) \u2192 \u2102)} (\u03c6 : K \u2192+* \u2102)\n (hx : x \u2208 Submodule.span \u211d (Set.range (canonicalEmbedding K))) :\n conj (x \u03c6) = x (ComplexEmbedding.conjugate \u03c6)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.nnnorm_eq (L77-L80)\ntheorem nnnorm_eq [NumberField K] (x : K) :\n \u2016canonicalEmbedding K x\u2016\u208a = Finset.univ.sup (fun \u03c6 : K \u2192+* \u2102 => \u2016\u03c6 x\u2016\u208a)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.norm_le_iff (L81-L94)\ntheorem norm_le_iff [NumberField K] (x : K) (r : \u211d) :\n \u2016canonicalEmbedding K x\u2016 \u2264 r \u2194 \u2200 \u03c6 : K \u2192+* \u2102, \u2016\u03c6 x\u2016 \u2264 r\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L95-L97)\ndef integerLattice : Subring ((K \u2192+* \u2102) \u2192 \u2102)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L98-L137)\ntheorem integerLattice.inter_ball_finite [NumberField K] (r : \u211d) :\n ((integerLattice K : Set ((K \u2192+* \u2102) \u2192 \u2102)) \u2229 Metric.closedBall 0 r).Finite\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.latticeBasis_apply (L139-L143)\ntheorem latticeBasis_apply [NumberField K] (i : Free.ChooseBasisIndex \u2124 (\ud835\udcde K)) :\n latticeBasis K i = (canonicalEmbedding K) (integralBasis K i)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.mem_span_latticeBasis (L144-L154)\ntheorem mem_span_latticeBasis [NumberField K] {x : (K \u2192+* \u2102) \u2192 \u2102} :\n x \u2208 Submodule.span \u2124 (Set.range (latticeBasis K)) \u2194\n x \u2208 ((canonicalEmbedding K).comp (algebraMap (\ud835\udcde K) K)).range\n```\n\n-- snippet 9\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_snd_apply (L70-L72)\ntheorem algebraMap_snd_apply (x : K) (v : HeightOneSpectrum R) :\n (algebraMap K (AdeleRing R K) x).2 v = x\n```\n\n-- snippet 10\n```lean\n-- Mathlib.NumberTheory.NumberField.Basic.Int (L51-L59)\ntheorem Int.not_isField : \u00acIsField \u2124\n```\n\n-- snippet 11\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_injective (L73-L76)\ntheorem algebraMap_injective [NumberField K] : Function.Injective (algebraMap K (AdeleRing R K))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_fst_apply (L66-L68)\ntheorem algebraMap_fst_apply (x : K) (v : InfinitePlace K) :\n (algebraMap K (AdeleRing R K) x).1 v = x\n```\n\n-- snippet 13\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.principalSubgroup (L77-L81)\nabbrev principalSubgroup : AddSubgroup (AdeleRing R K)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.NumberTheory.NumberField.AdeleRing.AdeleRing (L47-L54)\ndef AdeleRing (R K : Type*) [CommRing R] [IsDedekindDomain R] [Field K]\n [Algebra R K] [IsFractionRing R K]\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean", "module": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic", "declaration": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.latticeBasis_repr_apply", "span": "L700-L718", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean#L700"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1282, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3626, "lean_code_chars": 2802, "natural_language_chars": 824, "lean_code_ratio": 0.7728, "line_count": 103, "imports_count": 0, "declarations_count": 303, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ac012c517047014a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.MvPolynomial.Supported.supported_strictMono", "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.Algebra.MvPolynomial.Supported)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem supported_strictMono [Nontrivial R] :\n StrictMono (supported R : Set \u03c3 \u2192 Subalgebra R (MvPolynomial \u03c3 R))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_range_rename (L45-L54)\ntheorem supported_eq_range_rename (s : Set \u03c3) : supported R s = (rename ((\u2191) : s \u2192 \u03c3)).range\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_C (L56-L60)\ntheorem supportedEquivMvPolynomial_symm_C (s : Set \u03c3) (x : R) :\n (supportedEquivMvPolynomial s).symm (C x) = algebraMap R (supported R s) x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_X (L62-L68)\ntheorem supportedEquivMvPolynomial_symm_X (s : Set \u03c3) (i : s) :\n (\u2191((supportedEquivMvPolynomial s).symm (X i : MvPolynomial s R)) : MvPolynomial \u03c3 R) =\n X \u2191i\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported (L69-L78)\ntheorem mem_supported : p \u2208 supported R s \u2194 \u2191p.vars \u2286 s\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_vars_subset (L79-L81)\ntheorem supported_eq_vars_subset : (supported R s : Set (MvPolynomial \u03c3 R)) = { p | \u2191p.vars \u2286 s }\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported_vars (L83-L87)\ntheorem mem_supported_vars (p : MvPolynomial \u03c3 R) : p \u2208 supported R (\u2191p.vars : Set \u03c3)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_adjoin_X (L88-L89)\ntheorem supported_eq_adjoin_X : supported R s = Algebra.adjoin R (X '' s)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_univ (L91-L93)\ntheorem supported_univ : supported R (Set.univ : Set \u03c3) = \u22a4\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.mul_def (L100-L103)\ntheorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C (L104-L108)\ndef C : R \u2192+* MvPolynomial \u03c3 R\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.MvPolynomial (L81-L91)\nabbrev MvPolynomial (\u03c3 : Type*) (R : Type*) [CommSemiring R]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.one_def (L95-L96)\ntheorem one_def : (1 : MvPolynomial \u03c3 R) = monomial 0 1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial (L92-L94)\ndef monomial (s : \u03c3 \u2192\u2080 \u2115) : R \u2192\u2097[R] MvPolynomial \u03c3 R\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.single_eq_monomial (L97-L99)\ntheorem single_eq_monomial (s : \u03c3 \u2192\u2080 \u2115) (a : R) : Finsupp.single s a = monomial s a\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.Algebra.MvPolynomial.Supported).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem supported_strictMono [Nontrivial R] :\n StrictMono (supported R : Set \u03c3 \u2192 Subalgebra R (MvPolynomial \u03c3 R))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_range_rename (L45-L54)\ntheorem supported_eq_range_rename (s : Set \u03c3) : supported R s = (rename ((\u2191) : s \u2192 \u03c3)).range\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_C (L56-L60)\ntheorem supportedEquivMvPolynomial_symm_C (s : Set \u03c3) (x : R) :\n (supportedEquivMvPolynomial s).symm (C x) = algebraMap R (supported R s) x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_X (L62-L68)\ntheorem supportedEquivMvPolynomial_symm_X (s : Set \u03c3) (i : s) :\n (\u2191((supportedEquivMvPolynomial s).symm (X i : MvPolynomial s R)) : MvPolynomial \u03c3 R) =\n X \u2191i\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported (L69-L78)\ntheorem mem_supported : p \u2208 supported R s \u2194 \u2191p.vars \u2286 s\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_vars_subset (L79-L81)\ntheorem supported_eq_vars_subset : (supported R s : Set (MvPolynomial \u03c3 R)) = { p | \u2191p.vars \u2286 s }\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported_vars (L83-L87)\ntheorem mem_supported_vars (p : MvPolynomial \u03c3 R) : p \u2208 supported R (\u2191p.vars : Set \u03c3)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_adjoin_X (L88-L89)\ntheorem supported_eq_adjoin_X : supported R s = Algebra.adjoin R (X '' s)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.MvPolynomial.Supported.supported_univ (L91-L93)\ntheorem supported_univ : supported R (Set.univ : Set \u03c3) = \u22a4\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.mul_def (L100-L103)\ntheorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C (L104-L108)\ndef C : R \u2192+* MvPolynomial \u03c3 R\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.MvPolynomial (L81-L91)\nabbrev MvPolynomial (\u03c3 : Type*) (R : Type*) [CommSemiring R]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.one_def (L95-L96)\ntheorem one_def : (1 : MvPolynomial \u03c3 R) = monomial 0 1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial (L92-L94)\ndef monomial (s : \u03c3 \u2192\u2080 \u2115) : R \u2192\u2097[R] MvPolynomial \u03c3 R\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.single_eq_monomial (L97-L99)\ntheorem single_eq_monomial (s : \u03c3 \u2192\u2080 \u2115) (a : R) : Finsupp.single s a = monomial s a\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/MvPolynomial/Supported.lean", "module": "Mathlib.Algebra.MvPolynomial.Supported", "declaration": "Mathlib.Algebra.MvPolynomial.Supported.supported_strictMono", "span": "L113-L116", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/MvPolynomial/Supported.lean#L113"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1091, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3024, "lean_code_chars": 2219, "natural_language_chars": 805, "lean_code_ratio": 0.7338, "line_count": 95, "imports_count": 0, "declarations_count": 270, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "fcc358e43455eb5f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Order.GroupWithZero.Canonical.le_log_of_exp_le", "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.Algebra.Order.GroupWithZero.Canonical)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma le_log_of_exp_le (hax : exp a \u2264 x) : a \u2264 log x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.zero_lt_iff (L59-L59)\nlemma zero_lt_iff : 0 < a \u2194 a \u2260 0\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.ne_zero_of_lt (L60-L62)\nlemma ne_zero_of_lt (h : b < a) : a \u2260 0\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.bot_eq_zero'' (L63-L65)\nlemma bot_eq_zero'' : (\u22a5 : \u03b1) = 0\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Function (L90-L105)\nabbrev Function.Injective.linearOrderedCommMonoidWithZero {\u03b2 : Type*} [Zero \u03b2] [Bot \u03b2] [One \u03b2]\n [Mul \u03b2] [Pow \u03b2 \u2115] [LE \u03b2] [LT \u03b2] [Max \u03b2] [Min \u03b2] [Ord \u03b2]\n [DecidableEq \u03b2] [DecidableLE \u03b2] [DecidableLT \u03b2]\n (f : \u03b2 \u2192 \u03b1) (hf : Function.Injective f) (zero : f 0 = 0)\n (one : f 1 = 1) (mul : \u2200 x y, f (x * y) = f x * f y) (npow : \u2200 (x) (n : \u2115), f (x ^ n) = f x ^ n)\n (le : \u2200 {x y}, f x \u2264 f y \u2194 x \u2264 y) (lt : \u2200 {x y}, f x < f y \u2194 x < y)\n (hsup : \u2200 x y, f (x \u2294 y) = max (f x) (f y)) (hinf : \u2200 x y, f (x \u2293 y) = min (f x) (f y))\n (bot : f \u22a5 = \u22a5)\n (compare : \u2200 x y, compare (f x) (f y) = compare x y) :\n LinearOrderedCommMonoidWithZero \u03b2 where\n __\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual (L110-L114)\ninstance instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual :\n LinearOrderedAddCommMonoidWithTop (Additive \u03b1\u1d52\u1d48) where\n top_add' a\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopOrderDualAdditive (L115-L121)\ninstance instLinearOrderedAddCommMonoidWithTopOrderDualAdditive :\n LinearOrderedAddCommMonoidWithTop (Additive \u03b1)\u1d52\u1d48 where\n top_add' a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.pow_pos_iff (L122-L128)\nlemma pow_pos_iff (hn : n \u2260 0) : 0 < a ^ n \u2194 0 < a\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Units (L130-L132)\ntheorem Units.zero_lt (u : \u03b1\u02e3) : (0 : \u03b1) < u\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S\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.Algebra.Order.GroupWithZero.Canonical).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma le_log_of_exp_le (hax : exp a \u2264 x) : a \u2264 log x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.zero_lt_iff (L59-L59)\nlemma zero_lt_iff : 0 < a \u2194 a \u2260 0\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.ne_zero_of_lt (L60-L62)\nlemma ne_zero_of_lt (h : b < a) : a \u2260 0\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.bot_eq_zero'' (L63-L65)\nlemma bot_eq_zero'' : (\u22a5 : \u03b1) = 0\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Function (L90-L105)\nabbrev Function.Injective.linearOrderedCommMonoidWithZero {\u03b2 : Type*} [Zero \u03b2] [Bot \u03b2] [One \u03b2]\n [Mul \u03b2] [Pow \u03b2 \u2115] [LE \u03b2] [LT \u03b2] [Max \u03b2] [Min \u03b2] [Ord \u03b2]\n [DecidableEq \u03b2] [DecidableLE \u03b2] [DecidableLT \u03b2]\n (f : \u03b2 \u2192 \u03b1) (hf : Function.Injective f) (zero : f 0 = 0)\n (one : f 1 = 1) (mul : \u2200 x y, f (x * y) = f x * f y) (npow : \u2200 (x) (n : \u2115), f (x ^ n) = f x ^ n)\n (le : \u2200 {x y}, f x \u2264 f y \u2194 x \u2264 y) (lt : \u2200 {x y}, f x < f y \u2194 x < y)\n (hsup : \u2200 x y, f (x \u2294 y) = max (f x) (f y)) (hinf : \u2200 x y, f (x \u2293 y) = min (f x) (f y))\n (bot : f \u22a5 = \u22a5)\n (compare : \u2200 x y, compare (f x) (f y) = compare x y) :\n LinearOrderedCommMonoidWithZero \u03b2 where\n __\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual (L110-L114)\ninstance instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual :\n LinearOrderedAddCommMonoidWithTop (Additive \u03b1\u1d52\u1d48) where\n top_add' a\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopOrderDualAdditive (L115-L121)\ninstance instLinearOrderedAddCommMonoidWithTopOrderDualAdditive :\n LinearOrderedAddCommMonoidWithTop (Additive \u03b1)\u1d52\u1d48 where\n top_add' a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.pow_pos_iff (L122-L128)\nlemma pow_pos_iff (hn : n \u2260 0) : 0 < a ^ n \u2194 0 < a\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Units (L130-L132)\ntheorem Units.zero_lt (u : \u03b1\u02e3) : (0 : \u03b1) < u\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/GroupWithZero/Canonical.lean", "module": "Mathlib.Algebra.Order.GroupWithZero.Canonical", "declaration": "Mathlib.Algebra.Order.GroupWithZero.Canonical.le_log_of_exp_le", "span": "L566-L568", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean#L566"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1288, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3497, "lean_code_chars": 2685, "natural_language_chars": 812, "lean_code_ratio": 0.7678, "line_count": 107, "imports_count": 0, "declarations_count": 324, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "1b069b30a5bdd17f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.Concept.extent_ssubset_extent_iff", "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.Order.Concept)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem extent_ssubset_extent_iff : c.extent \u2282 d.extent \u2194 c < d\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Concept.upperPolar (L48-L52)\ndef upperPolar (s : Set \u03b1) : Set \u03b2\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Concept.lowerPolar (L53-L55)\ndef lowerPolar (t : Set \u03b2) : Set \u03b1\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Concept.mem_upperPolar_iff (L61-L61)\ntheorem mem_upperPolar_iff : b \u2208 upperPolar r s \u2194 \u2200 \u2983a\u2984, a \u2208 s \u2192 r a b\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Concept.mem_lowerPolar_iff (L62-L63)\ntheorem mem_lowerPolar_iff : a \u2208 lowerPolar r t \u2194 \u2200 \u2983b\u2984, b \u2208 t \u2192 r a b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Concept.subset_upperPolar_iff_subset_lowerPolar (L64-L69)\ntheorem subset_upperPolar_iff_subset_lowerPolar :\n t \u2286 upperPolar r s \u2194 s \u2286 lowerPolar r t\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Concept.gc_upperPolar_lowerPolar (L70-L73)\ntheorem gc_upperPolar_lowerPolar :\n GaloisConnection (toDual \u2218 upperPolar r) (lowerPolar r \u2218 ofDual)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Concept.gc_lowerPolar_upperPolar (L74-L77)\ntheorem gc_lowerPolar_upperPolar :\n GaloisConnection (toDual \u2218 lowerPolar r) (upperPolar r \u2218 ofDual)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Concept.upperPolar_swap (L78-L80)\ntheorem upperPolar_swap (t : Set \u03b2) : upperPolar (swap r) t = lowerPolar r t\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.Order.Concept).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem extent_ssubset_extent_iff : c.extent \u2282 d.extent \u2194 c < d\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Concept.upperPolar (L48-L52)\ndef upperPolar (s : Set \u03b1) : Set \u03b2\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Concept.lowerPolar (L53-L55)\ndef lowerPolar (t : Set \u03b2) : Set \u03b1\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Concept.mem_upperPolar_iff (L61-L61)\ntheorem mem_upperPolar_iff : b \u2208 upperPolar r s \u2194 \u2200 \u2983a\u2984, a \u2208 s \u2192 r a b\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Concept.mem_lowerPolar_iff (L62-L63)\ntheorem mem_lowerPolar_iff : a \u2208 lowerPolar r t \u2194 \u2200 \u2983b\u2984, b \u2208 t \u2192 r a b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Concept.subset_upperPolar_iff_subset_lowerPolar (L64-L69)\ntheorem subset_upperPolar_iff_subset_lowerPolar :\n t \u2286 upperPolar r s \u2194 s \u2286 lowerPolar r t\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Concept.gc_upperPolar_lowerPolar (L70-L73)\ntheorem gc_upperPolar_lowerPolar :\n GaloisConnection (toDual \u2218 upperPolar r) (lowerPolar r \u2218 ofDual)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Concept.gc_lowerPolar_upperPolar (L74-L77)\ntheorem gc_lowerPolar_upperPolar :\n GaloisConnection (toDual \u2218 lowerPolar r) (upperPolar r \u2218 ofDual)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Concept.upperPolar_swap (L78-L80)\ntheorem upperPolar_swap (t : Set \u03b2) : upperPolar (swap r) t = lowerPolar r t\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Concept.lean", "module": "Mathlib.Order.Concept", "declaration": "Mathlib.Order.Concept.extent_ssubset_extent_iff", "span": "L440-L442", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Concept.lean#L440"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 613, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1728, "lean_code_chars": 1101, "natural_language_chars": 627, "lean_code_ratio": 0.6372, "line_count": 58, "imports_count": 0, "declarations_count": 166, "diagnostics_count": 0, "retrieval_snippets_count": 8, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6b7c2e8cbf71bd59", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Fin.Basic.factorial", "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.Data.Fin.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef factorial {n : \u2115} : Fin n \u2192 \u2115\n | \u27e80, _\u27e9\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Fin.Basic.Nat (L36-L39)\ntheorem Nat.forall_lt_iff_fin {n : \u2115} {p : \u2200 k, k < n \u2192 Prop} :\n (\u2200 k hk, p k hk) \u2194 \u2200 k : Fin n, p k k.is_lt\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Fin.Basic.Nat (L40-L44)\ntheorem Nat.exists_lt_iff_fin {n : \u2115} {p : \u2200 k, k < n \u2192 Prop} :\n (\u2203 k hk, p k hk) \u2194 \u2203 k : Fin n, p k k.is_lt\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Fin.Basic.finZeroElim (L45-L49)\ndef finZeroElim {\u03b1 : Fin 0 \u2192 Sort*} (x : Fin 0) : \u03b1 x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Fin.Basic.rec0 (L62-L65)\ndef rec0 {\u03b1 : Fin 0 \u2192 Sort*} (i : Fin 0) : \u03b1 i\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Fin.Basic.val_injective (L66-L69)\ntheorem val_injective : Function.Injective (@Fin.val n)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Fin.Basic.size_positive (L70-L71)\nlemma size_positive : Fin n \u2192 0 < n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Fin.Basic.size_positive' (L72-L77)\nlemma size_positive' [Nonempty (Fin n)] : 0 < n\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Fin.Basic.lt_last_iff_ne_last (L78-L80)\nlemma lt_last_iff_ne_last {a : Fin (n + 1)} : a < last n \u2194 a \u2260 last n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Fin.Embedding.equivSubtype_symm_trans_valEmbedding (L52-L64)\ntheorem equivSubtype_symm_trans_valEmbedding :\n equivSubtype.symm.toEmbedding.trans valEmbedding = Embedding.subtype (\u00b7 < n)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Fin.Embedding.coe_succEmb (L70-L72)\ntheorem coe_succEmb : \u21d1(succEmb n) = Fin.succ\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Fin.Embedding.nonempty_embedding_iff (L86-L98)\nlemma nonempty_embedding_iff : Nonempty (Fin n \u21aa Fin m) \u2194 n \u2264 m\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Fin.Embedding.castLEEmb (L77-L80)\ndef castLEEmb (h : n \u2264 m) : Fin n \u21aa Fin m where\n toFun\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Fin.Embedding.succEmb (L65-L68)\ndef succEmb (n : \u2115) : Fin n \u21aa Fin (n + 1) where\n toFun\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Fin.Embedding.valEmbedding (L48-L50)\ndef valEmbedding : Fin n \u21aa \u2115\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.Data.Fin.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef factorial {n : \u2115} : Fin n \u2192 \u2115\n | \u27e80, _\u27e9\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Fin.Basic.Nat (L36-L39)\ntheorem Nat.forall_lt_iff_fin {n : \u2115} {p : \u2200 k, k < n \u2192 Prop} :\n (\u2200 k hk, p k hk) \u2194 \u2200 k : Fin n, p k k.is_lt\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Fin.Basic.Nat (L40-L44)\ntheorem Nat.exists_lt_iff_fin {n : \u2115} {p : \u2200 k, k < n \u2192 Prop} :\n (\u2203 k hk, p k hk) \u2194 \u2203 k : Fin n, p k k.is_lt\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Fin.Basic.finZeroElim (L45-L49)\ndef finZeroElim {\u03b1 : Fin 0 \u2192 Sort*} (x : Fin 0) : \u03b1 x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Fin.Basic.rec0 (L62-L65)\ndef rec0 {\u03b1 : Fin 0 \u2192 Sort*} (i : Fin 0) : \u03b1 i\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Fin.Basic.val_injective (L66-L69)\ntheorem val_injective : Function.Injective (@Fin.val n)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Fin.Basic.size_positive (L70-L71)\nlemma size_positive : Fin n \u2192 0 < n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Fin.Basic.size_positive' (L72-L77)\nlemma size_positive' [Nonempty (Fin n)] : 0 < n\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Fin.Basic.lt_last_iff_ne_last (L78-L80)\nlemma lt_last_iff_ne_last {a : Fin (n + 1)} : a < last n \u2194 a \u2260 last n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Fin.Embedding.equivSubtype_symm_trans_valEmbedding (L52-L64)\ntheorem equivSubtype_symm_trans_valEmbedding :\n equivSubtype.symm.toEmbedding.trans valEmbedding = Embedding.subtype (\u00b7 < n)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Fin.Embedding.coe_succEmb (L70-L72)\ntheorem coe_succEmb : \u21d1(succEmb n) = Fin.succ\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Fin.Embedding.nonempty_embedding_iff (L86-L98)\nlemma nonempty_embedding_iff : Nonempty (Fin n \u21aa Fin m) \u2194 n \u2264 m\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Fin.Embedding.castLEEmb (L77-L80)\ndef castLEEmb (h : n \u2264 m) : Fin n \u21aa Fin m where\n toFun\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Fin.Embedding.succEmb (L65-L68)\ndef succEmb (n : \u2115) : Fin n \u21aa Fin (n + 1) where\n toFun\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Fin.Embedding.valEmbedding (L48-L50)\ndef valEmbedding : Fin n \u21aa \u2115\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Fin/Basic.lean", "module": "Mathlib.Data.Fin.Basic", "declaration": "Mathlib.Data.Fin.Basic.factorial", "span": "L172-L176", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Fin/Basic.lean#L172"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 947, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2467, "lean_code_chars": 1678, "natural_language_chars": 789, "lean_code_ratio": 0.6802, "line_count": 97, "imports_count": 0, "declarations_count": 246, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "97e0adae226c431b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.UniformSpace.Basic.uniformContinuous_iInf_rng", "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.Topology.UniformSpace.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem uniformContinuous_iInf_rng {f : \u03b1 \u2192 \u03b2} {u\u2081 : UniformSpace \u03b1} {u\u2082 : \u03b9 \u2192 UniformSpace \u03b2} :\n UniformContinuous[u\u2081, iInf u\u2082] f \u2194 \u2200 i, UniformContinuous[u\u2081, u\u2082 i] f\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L54-L59)\nlemma IsOpen.relComp [TopologicalSpace \u03b1] [TopologicalSpace \u03b2] [TopologicalSpace \u03b3]\n {s : SetRel \u03b1 \u03b2} {t : SetRel \u03b2 \u03b3} (hs : IsOpen s) (ht : IsOpen t) : IsOpen (s \u25cb t)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L60-L63)\nlemma IsOpen.relInv [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsOpen s) : IsOpen s.inv\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L64-L68)\nlemma IsOpen.relImage [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsOpen s) {t : Set \u03b1} : IsOpen (s.image t)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L69-L72)\nlemma IsOpen.relPreimage [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsOpen s) {t : Set \u03b2} : IsOpen (s.preimage t)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L73-L76)\nlemma IsClosed.relInv [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsClosed s) : IsClosed s.inv\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L77-L81)\nlemma IsClosed.relImage_of_finite [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsClosed s) {t : Set \u03b1} (ht : t.Finite) : IsClosed (s.image t)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L82-L91)\nlemma IsClosed.relPreimage_of_finite [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsClosed s) {t : Set \u03b2} (ht : t.Finite) : IsClosed (s.preimage t)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.eventually_uniformity_iterate_comp_subset (L92-L106)\ntheorem eventually_uniformity_iterate_comp_subset {s : SetRel \u03b1 \u03b1} (hs : s \u2208 \ud835\udce4 \u03b1) (n : \u2115) :\n \u2200\u1da0 t in (\ud835\udce4 \u03b1).smallSets, (t \u25cb \u00b7)^[n] t \u2286 s\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.UniformSpace.AbsoluteValue.hasBasis_uniformity (L45-L49)\ntheorem hasBasis_uniformity :\n \ud835\udce4[abv.uniformSpace].HasBasis ((0 : \ud835\udd5c) < \u00b7) fun \u03b5 => { p : R \u00d7 R | abv (p.2 - p.1) < \u03b5 }\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.uniformContinuous_coe (L97-L99)\ntheorem uniformContinuous_coe : UniformContinuous \u03b9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.closure_range (L91-L93)\ntheorem closure_range : closure (range \u03b9) = univ\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.ofComplete (L88-L90)\ndef ofComplete [T0Space \u03b1] [CompleteSpace \u03b1] : AbstractCompletion \u03b1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.isDenseInducing (L94-L96)\ntheorem isDenseInducing : IsDenseInducing \u03b9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.UniformSpace.AbsoluteValue.uniformSpace (L40-L44)\ndef uniformSpace : UniformSpace R\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.Topology.UniformSpace.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 uniformContinuous_iInf_rng {f : \u03b1 \u2192 \u03b2} {u\u2081 : UniformSpace \u03b1} {u\u2082 : \u03b9 \u2192 UniformSpace \u03b2} :\n UniformContinuous[u\u2081, iInf u\u2082] f \u2194 \u2200 i, UniformContinuous[u\u2081, u\u2082 i] f\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L54-L59)\nlemma IsOpen.relComp [TopologicalSpace \u03b1] [TopologicalSpace \u03b2] [TopologicalSpace \u03b3]\n {s : SetRel \u03b1 \u03b2} {t : SetRel \u03b2 \u03b3} (hs : IsOpen s) (ht : IsOpen t) : IsOpen (s \u25cb t)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L60-L63)\nlemma IsOpen.relInv [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsOpen s) : IsOpen s.inv\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L64-L68)\nlemma IsOpen.relImage [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsOpen s) {t : Set \u03b1} : IsOpen (s.image t)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L69-L72)\nlemma IsOpen.relPreimage [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsOpen s) {t : Set \u03b2} : IsOpen (s.preimage t)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L73-L76)\nlemma IsClosed.relInv [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsClosed s) : IsClosed s.inv\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L77-L81)\nlemma IsClosed.relImage_of_finite [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsClosed s) {t : Set \u03b1} (ht : t.Finite) : IsClosed (s.image t)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L82-L91)\nlemma IsClosed.relPreimage_of_finite [TopologicalSpace \u03b1] [TopologicalSpace \u03b2]\n {s : SetRel \u03b1 \u03b2} (hs : IsClosed s) {t : Set \u03b2} (ht : t.Finite) : IsClosed (s.preimage t)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.UniformSpace.Basic.eventually_uniformity_iterate_comp_subset (L92-L106)\ntheorem eventually_uniformity_iterate_comp_subset {s : SetRel \u03b1 \u03b1} (hs : s \u2208 \ud835\udce4 \u03b1) (n : \u2115) :\n \u2200\u1da0 t in (\ud835\udce4 \u03b1).smallSets, (t \u25cb \u00b7)^[n] t \u2286 s\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.UniformSpace.AbsoluteValue.hasBasis_uniformity (L45-L49)\ntheorem hasBasis_uniformity :\n \ud835\udce4[abv.uniformSpace].HasBasis ((0 : \ud835\udd5c) < \u00b7) fun \u03b5 => { p : R \u00d7 R | abv (p.2 - p.1) < \u03b5 }\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.uniformContinuous_coe (L97-L99)\ntheorem uniformContinuous_coe : UniformContinuous \u03b9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.closure_range (L91-L93)\ntheorem closure_range : closure (range \u03b9) = univ\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.ofComplete (L88-L90)\ndef ofComplete [T0Space \u03b1] [CompleteSpace \u03b1] : AbstractCompletion \u03b1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.UniformSpace.AbstractCompletion.isDenseInducing (L94-L96)\ntheorem isDenseInducing : IsDenseInducing \u03b9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.UniformSpace.AbsoluteValue.uniformSpace (L40-L44)\ndef uniformSpace : UniformSpace R\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/UniformSpace/Basic.lean", "module": "Mathlib.Topology.UniformSpace.Basic", "declaration": "Mathlib.Topology.UniformSpace.Basic.uniformContinuous_iInf_rng", "span": "L596-L603", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/UniformSpace/Basic.lean#L596"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1174, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3446, "lean_code_chars": 2644, "natural_language_chars": 802, "lean_code_ratio": 0.7673, "line_count": 101, "imports_count": 0, "declarations_count": 280, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "85cae7ea6696ee22", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Convex.Slope.StrictConvexOn", "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.Analysis.Convex.Slope)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem StrictConvexOn.secant_strict_mono_aux2 (hf : StrictConvexOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s)\n (hz : z \u2208 s) (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) < (f z - f x) / (z - x)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Convex.Slope.ConvexOn (L28-L41)\ntheorem ConvexOn.slope_mono_adjacent (hf : ConvexOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s) (hz : z \u2208 s)\n (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) \u2264 (f z - f y) / (z - y)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Convex.Slope.ConcaveOn (L42-L50)\ntheorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s) (hz : z \u2208 s)\n (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) \u2264 (f y - f x) / (y - x)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Convex.Slope.StrictConcaveOn (L68-L75)\ntheorem StrictConcaveOn.slope_anti_adjacent (hf : StrictConcaveOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s)\n (hz : z \u2208 s) (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) < (f y - f x) / (y - x)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Convex.Slope.convexOn_of_slope_mono_adjacent (L76-L91)\ntheorem convexOn_of_slope_mono_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f y - f x) / (y - x) \u2264 (f z - f y) / (z - y)) :\n ConvexOn \ud835\udd5c s f\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Convex.Slope.concaveOn_of_slope_anti_adjacent (L92-L103)\ntheorem concaveOn_of_slope_anti_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f z - f y) / (z - y) \u2264 (f y - f x) / (y - x)) :\n ConcaveOn \ud835\udd5c s f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Convex.Slope.strictConvexOn_of_slope_strict_mono_adjacent (L104-L120)\ntheorem strictConvexOn_of_slope_strict_mono_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f y - f x) / (y - x) < (f z - f y) / (z - y)) :\n StrictConvexOn \ud835\udd5c s f\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Convex.Slope.strictConcaveOn_of_slope_strict_anti_adjacent (L121-L132)\ntheorem strictConcaveOn_of_slope_strict_anti_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f z - f y) / (z - y) < (f y - f x) / (y - x)) :\n StrictConcaveOn \ud835\udd5c s f\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Convex.Slope.convexOn_iff_slope_mono_adjacent (L133-L141)\ntheorem convexOn_iff_slope_mono_adjacent :\n ConvexOn \ud835\udd5c s f \u2194\n Convex \ud835\udd5c s \u2227 \u2200 \u2983x y z : \ud835\udd5c\u2984,\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f y - f x) / (y - x) \u2264 (f z - f y) / (z - y)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)\ntheorem image {s : Set E} (h : AmpleSet s) (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)\ntheorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s \u222a t)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)\ntheorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace \u211d F] :\n AmpleSet (univ : Set F)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)\ndef AmpleSet (s : Set F) : Prop\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)\ntheorem ampleSet_empty : AmpleSet (\u2205 : Set F)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)\ntheorem image_iff {s : Set E} (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s) \u2194 AmpleSet s\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.Analysis.Convex.Slope).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem StrictConvexOn.secant_strict_mono_aux2 (hf : StrictConvexOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s)\n (hz : z \u2208 s) (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) < (f z - f x) / (z - x)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Convex.Slope.ConvexOn (L28-L41)\ntheorem ConvexOn.slope_mono_adjacent (hf : ConvexOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s) (hz : z \u2208 s)\n (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) \u2264 (f z - f y) / (z - y)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Convex.Slope.ConcaveOn (L42-L50)\ntheorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s) (hz : z \u2208 s)\n (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) \u2264 (f y - f x) / (y - x)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Convex.Slope.StrictConcaveOn (L68-L75)\ntheorem StrictConcaveOn.slope_anti_adjacent (hf : StrictConcaveOn \ud835\udd5c s f) {x y z : \ud835\udd5c} (hx : x \u2208 s)\n (hz : z \u2208 s) (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) < (f y - f x) / (y - x)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Convex.Slope.convexOn_of_slope_mono_adjacent (L76-L91)\ntheorem convexOn_of_slope_mono_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f y - f x) / (y - x) \u2264 (f z - f y) / (z - y)) :\n ConvexOn \ud835\udd5c s f\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Convex.Slope.concaveOn_of_slope_anti_adjacent (L92-L103)\ntheorem concaveOn_of_slope_anti_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f z - f y) / (z - y) \u2264 (f y - f x) / (y - x)) :\n ConcaveOn \ud835\udd5c s f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Convex.Slope.strictConvexOn_of_slope_strict_mono_adjacent (L104-L120)\ntheorem strictConvexOn_of_slope_strict_mono_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f y - f x) / (y - x) < (f z - f y) / (z - y)) :\n StrictConvexOn \ud835\udd5c s f\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Convex.Slope.strictConcaveOn_of_slope_strict_anti_adjacent (L121-L132)\ntheorem strictConcaveOn_of_slope_strict_anti_adjacent (hs : Convex \ud835\udd5c s)\n (hf :\n \u2200 {x y z : \ud835\udd5c},\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f z - f y) / (z - y) < (f y - f x) / (y - x)) :\n StrictConcaveOn \ud835\udd5c s f\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Convex.Slope.convexOn_iff_slope_mono_adjacent (L133-L141)\ntheorem convexOn_iff_slope_mono_adjacent :\n ConvexOn \ud835\udd5c s f \u2194\n Convex \ud835\udd5c s \u2227 \u2200 \u2983x y z : \ud835\udd5c\u2984,\n x \u2208 s \u2192 z \u2208 s \u2192 x < y \u2192 y < z \u2192 (f y - f x) / (y - x) \u2264 (f z - f y) / (z - y)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)\ntheorem image {s : Set E} (h : AmpleSet s) (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)\ntheorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s \u222a t)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)\ntheorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace \u211d F] :\n AmpleSet (univ : Set F)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)\ndef AmpleSet (s : Set F) : Prop\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)\ntheorem ampleSet_empty : AmpleSet (\u2205 : Set F)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)\ntheorem image_iff {s : Set E} (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s) \u2194 AmpleSet s\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Convex/Slope.lean", "module": "Mathlib.Analysis.Convex.Slope", "declaration": "Mathlib.Analysis.Convex.Slope.StrictConvexOn", "span": "L228-L234", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Slope.lean#L228"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1689, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3895, "lean_code_chars": 3099, "natural_language_chars": 796, "lean_code_ratio": 0.7956, "line_count": 117, "imports_count": 0, "declarations_count": 472, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "81c4e7821c3a8800", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Ordmap.Invariants.Bounded", "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.Data.Ordmap.Invariants)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Bounded.dual :\n \u2200 {t : Ordnode \u03b1} {o\u2081 o\u2082}, Bounded t o\u2081 o\u2082 \u2192 @Bounded \u03b1\u1d52\u1d48 _ (dual t) o\u2082 o\u2081\n | nil, o\u2081, o\u2082, h => by cases o\u2081 <;> cases o\u2082 <;> trivial\n | node _ _ _ _, _, _, \u27e8ol, Or\u27e9 => \u27e8Or.dual, ol.dual\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Ordmap.Invariants.not_le_delta (L59-L61)\ntheorem not_le_delta {s} (H : 1 \u2264 s) : \u00acs \u2264 delta * 0\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Ordmap.Invariants.delta_lt_false (L62-L72)\ntheorem delta_lt_false {a b : \u2115} (h\u2081 : delta * a < b) (h\u2082 : delta * b < a) : False\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Ordmap.Invariants.realSize (L73-L81)\ndef realSize : Ordnode \u03b1 \u2192 \u2115\n | nil => 0\n | node _ l _ r => realSize l + realSize r + 1\n\n/-! ### `Sized` -/\n\n\n/-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the\nrespective subtrees. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L82-L85)\ndef Sized : Ordnode \u03b1 \u2192 Prop\n | nil => True\n | node s l _ r => s = size l + size r + 1 \u2227 Sized l \u2227 Sized r\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L86-L88)\ntheorem Sized.node' {l x r} (hl : @Sized \u03b1 l) (hr : Sized r) : Sized (node' l x r)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L89-L91)\ntheorem Sized.eq_node' {s l x r} (h : @Sized \u03b1 (node s l x r)) : node s l x r = .node' l x r\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L92-L95)\ntheorem Sized.size_eq {s l x r} (H : Sized (@node \u03b1 s l x r)) :\n size (@node \u03b1 s l x r) = size l + size r + 1\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L97-L104)\ntheorem Sized.induction {t} (hl : @Sized \u03b1 t) {C : Ordnode \u03b1 \u2192 Prop} (H0 : C nil)\n (H1 : \u2200 l x r, C l \u2192 C r \u2192 C (.node' l x r)) : C t\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.balanceL (L182-L215)\ndef balanceL (l : Ordnode \u03b1) (x : \u03b1) (r : Ordnode \u03b1) : Ordnode \u03b1\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.node' (L159-L164)\ndef node' (l : Ordnode \u03b1) (x : \u03b1) (r : Ordnode \u03b1) : Ordnode \u03b1\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.ratio (L107-L112)\ndef ratio\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.balanceR (L216-L249)\ndef balanceR (l : Ordnode \u03b1) (x : \u03b1) (r : Ordnode \u03b1) : Ordnode \u03b1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.repr (L165-L173)\ndef repr {\u03b1} [Repr \u03b1] (o : Ordnode \u03b1) (n : \u2115) : Std.Format\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.delta (L96-L105)\ndef delta\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.Data.Ordmap.Invariants).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Bounded.dual :\n \u2200 {t : Ordnode \u03b1} {o\u2081 o\u2082}, Bounded t o\u2081 o\u2082 \u2192 @Bounded \u03b1\u1d52\u1d48 _ (dual t) o\u2082 o\u2081\n | nil, o\u2081, o\u2082, h => by cases o\u2081 <;> cases o\u2082 <;> trivial\n | node _ _ _ _, _, _, \u27e8ol, Or\u27e9 => \u27e8Or.dual, ol.dual\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Ordmap.Invariants.not_le_delta (L59-L61)\ntheorem not_le_delta {s} (H : 1 \u2264 s) : \u00acs \u2264 delta * 0\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Ordmap.Invariants.delta_lt_false (L62-L72)\ntheorem delta_lt_false {a b : \u2115} (h\u2081 : delta * a < b) (h\u2082 : delta * b < a) : False\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Ordmap.Invariants.realSize (L73-L81)\ndef realSize : Ordnode \u03b1 \u2192 \u2115\n | nil => 0\n | node _ l _ r => realSize l + realSize r + 1\n\n/-! ### `Sized` -/\n\n\n/-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the\nrespective subtrees. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L82-L85)\ndef Sized : Ordnode \u03b1 \u2192 Prop\n | nil => True\n | node s l _ r => s = size l + size r + 1 \u2227 Sized l \u2227 Sized r\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L86-L88)\ntheorem Sized.node' {l x r} (hl : @Sized \u03b1 l) (hr : Sized r) : Sized (node' l x r)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L89-L91)\ntheorem Sized.eq_node' {s l x r} (h : @Sized \u03b1 (node s l x r)) : node s l x r = .node' l x r\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L92-L95)\ntheorem Sized.size_eq {s l x r} (H : Sized (@node \u03b1 s l x r)) :\n size (@node \u03b1 s l x r) = size l + size r + 1\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Ordmap.Invariants.Sized (L97-L104)\ntheorem Sized.induction {t} (hl : @Sized \u03b1 t) {C : Ordnode \u03b1 \u2192 Prop} (H0 : C nil)\n (H1 : \u2200 l x r, C l \u2192 C r \u2192 C (.node' l x r)) : C t\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.balanceL (L182-L215)\ndef balanceL (l : Ordnode \u03b1) (x : \u03b1) (r : Ordnode \u03b1) : Ordnode \u03b1\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.node' (L159-L164)\ndef node' (l : Ordnode \u03b1) (x : \u03b1) (r : Ordnode \u03b1) : Ordnode \u03b1\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.ratio (L107-L112)\ndef ratio\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.balanceR (L216-L249)\ndef balanceR (l : Ordnode \u03b1) (x : \u03b1) (r : Ordnode \u03b1) : Ordnode \u03b1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.repr (L165-L173)\ndef repr {\u03b1} [Repr \u03b1] (o : Ordnode \u03b1) (n : \u2115) : Std.Format\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Ordmap.Ordnode.delta (L96-L105)\ndef delta\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Ordmap/Invariants.lean", "module": "Mathlib.Data.Ordmap.Invariants", "declaration": "Mathlib.Data.Ordmap.Invariants.Bounded", "span": "L765-L770", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Ordmap/Invariants.lean#L765"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1159, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2966, "lean_code_chars": 2169, "natural_language_chars": 797, "lean_code_ratio": 0.7313, "line_count": 108, "imports_count": 0, "declarations_count": 354, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "d51dacbfce402376", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Algebra.RestrictScalars.RestrictScalars", "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.Algebra.Algebra.RestrictScalars)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef RestrictScalars.ringEquiv : RestrictScalars R S A \u2243+* A\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Algebra.RestrictScalars.Module (L111-L118)\nabbrev Module.restrictScalars [Module S M] : Module R M\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Algebra.RestrictScalars.IsScalarTower (L123-L129)\ntheorem IsScalarTower.restrictScalars [Module S M] :\n letI\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Algebra.RestrictScalars.Algebra (L220-L223)\nabbrev Algebra.restrictScalars : Algebra R A\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring_apply (L113-L116)\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_pUnit (L54-L60)\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubsemiring (L110-L112)\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S \u2192 R) = Subtype.val\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring (L120-L123)\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Algebra.Basic.ofSubring (L117-L119)\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring (L106-L109)\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype\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.Algebra.Algebra.RestrictScalars).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef RestrictScalars.ringEquiv : RestrictScalars R S A \u2243+* A\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Algebra.RestrictScalars.Module (L111-L118)\nabbrev Module.restrictScalars [Module S M] : Module R M\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Algebra.RestrictScalars.IsScalarTower (L123-L129)\ntheorem IsScalarTower.restrictScalars [Module S M] :\n letI\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Algebra.RestrictScalars.Algebra (L220-L223)\nabbrev Algebra.restrictScalars : Algebra R A\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring_apply (L113-L116)\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_pUnit (L54-L60)\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubsemiring (L110-L112)\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S \u2192 R) = Subtype.val\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring (L120-L123)\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Algebra.Basic.ofSubring (L117-L119)\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring (L106-L109)\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Algebra/RestrictScalars.lean", "module": "Mathlib.Algebra.Algebra.RestrictScalars", "declaration": "Mathlib.Algebra.Algebra.RestrictScalars.RestrictScalars", "span": "L208-L212", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/RestrictScalars.lean#L208"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 693, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2038, "lean_code_chars": 1367, "natural_language_chars": 671, "lean_code_ratio": 0.6708, "line_count": 65, "imports_count": 0, "declarations_count": 192, "diagnostics_count": 0, "retrieval_snippets_count": 9, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "aaad6494a7afb5a9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.MetricSpace.Pseudo.Defs.tendsto_iff_dist_tendsto_zero", "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.Topology.MetricSpace.Pseudo.Defs)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem tendsto_iff_dist_tendsto_zero {f : \u03b2 \u2192 \u03b1} {x : Filter \u03b2} {a : \u03b1} :\n Tendsto f x (\ud835\udcdd a) \u2194 Tendsto (fun b => dist (f b) a) x (\ud835\udcdd 0)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L56-L59)\ntheorem UniformSpace.ofDist_aux (\u03b5 : \u211d) (h\u03b5 : 0 < \u03b5) : \u2203 \u03b4 > (0 : \u211d), \u2200 x < \u03b4, \u2200 y < \u03b4, x + y < \u03b5\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L61-L66)\ndef UniformSpace.ofDist (dist : \u03b1 \u2192 \u03b1 \u2192 \u211d) (dist_self : \u2200 x : \u03b1, dist x x = 0)\n (dist_comm : \u2200 x y : \u03b1, dist x y = dist y x)\n (dist_triangle : \u2200 x y z : \u03b1, dist x z \u2264 dist x y + dist y z) : UniformSpace \u03b1\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.Bornology (L67-L87)\nabbrev Bornology.ofDist {\u03b1 : Type*} (dist : \u03b1 \u2192 \u03b1 \u2192 \u211d) (dist_comm : \u2200 x y, dist x y = dist y x)\n (dist_triangle : \u2200 x y z, dist x z \u2264 dist x y + dist y z) : Bornology \u03b1\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L142-L157)\ntheorem PseudoMetricSpace.ext {\u03b1 : Type*} {m m' : PseudoMetricSpace \u03b1}\n (h : m.toDist = m'.toDist) : m = m'\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L169-L186)\ndef PseudoMetricSpace.ofDistTopology {\u03b1 : Type u} [TopologicalSpace \u03b1] (dist : \u03b1 \u2192 \u03b1 \u2192 \u211d)\n (dist_self : \u2200 x : \u03b1, dist x x = 0) (dist_comm : \u2200 x y : \u03b1, dist x y = dist y x)\n (dist_triangle : \u2200 x y z : \u03b1, dist x z \u2264 dist x y + dist y z)\n (H : \u2200 s : Set \u03b1, IsOpen s \u2194 \u2200 x \u2208 s, \u2203 \u03b5 > 0, \u2200 y, dist x y < \u03b5 \u2192 y \u2208 s) :\n PseudoMetricSpace \u03b1\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_self (L188-L190)\ntheorem dist_self (x : \u03b1) : dist x x = 0\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_comm (L191-L193)\ntheorem dist_comm (x y : \u03b1) : dist x y = dist y x\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.edist_dist (L194-L196)\ntheorem edist_dist (x y : \u03b1) : edist x y = ENNReal.ofReal (dist x y)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.LipschitzMul (L56-L59)\ndef LipschitzMul.C [_i : LipschitzMul \u03b2] : \u211d\u22650\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.MulOpposite (L85-L91)\ninstance MulOpposite.lipschitzMul : LipschitzMul \u03b2\u1d50\u1d52\u1d56 where\n lipschitz_mul\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.Real (L92-L100)\ninstance Real.hasLipschitzAdd : LipschitzAdd \u211d where\n lipschitz_add\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.lipschitz_with_lipschitz_const_mul (L68-L73)\ntheorem lipschitz_with_lipschitz_const_mul :\n \u2200 p q : \u03b2 \u00d7 \u03b2, dist (p.1 * p.2) (q.1 * q.2) \u2264 LipschitzMul.C \u03b2 * dist p q\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.Submonoid (L79-L83)\ninstance Submonoid.lipschitzMul (s : Submonoid \u03b2) : LipschitzMul s where\n lipschitz_mul\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.lipschitzWith_lipschitz_const_mul_edist (L61-L66)\ntheorem lipschitzWith_lipschitz_const_mul_edist [_i : LipschitzMul \u03b2] :\n LipschitzWith (LipschitzMul.C \u03b2) fun p : \u03b2 \u00d7 \u03b2 => p.1 * p.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.Topology.MetricSpace.Pseudo.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 tendsto_iff_dist_tendsto_zero {f : \u03b2 \u2192 \u03b1} {x : Filter \u03b2} {a : \u03b1} :\n Tendsto f x (\ud835\udcdd a) \u2194 Tendsto (fun b => dist (f b) a) x (\ud835\udcdd 0)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L56-L59)\ntheorem UniformSpace.ofDist_aux (\u03b5 : \u211d) (h\u03b5 : 0 < \u03b5) : \u2203 \u03b4 > (0 : \u211d), \u2200 x < \u03b4, \u2200 y < \u03b4, x + y < \u03b5\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L61-L66)\ndef UniformSpace.ofDist (dist : \u03b1 \u2192 \u03b1 \u2192 \u211d) (dist_self : \u2200 x : \u03b1, dist x x = 0)\n (dist_comm : \u2200 x y : \u03b1, dist x y = dist y x)\n (dist_triangle : \u2200 x y z : \u03b1, dist x z \u2264 dist x y + dist y z) : UniformSpace \u03b1\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.Bornology (L67-L87)\nabbrev Bornology.ofDist {\u03b1 : Type*} (dist : \u03b1 \u2192 \u03b1 \u2192 \u211d) (dist_comm : \u2200 x y, dist x y = dist y x)\n (dist_triangle : \u2200 x y z, dist x z \u2264 dist x y + dist y z) : Bornology \u03b1\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L142-L157)\ntheorem PseudoMetricSpace.ext {\u03b1 : Type*} {m m' : PseudoMetricSpace \u03b1}\n (h : m.toDist = m'.toDist) : m = m'\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L169-L186)\ndef PseudoMetricSpace.ofDistTopology {\u03b1 : Type u} [TopologicalSpace \u03b1] (dist : \u03b1 \u2192 \u03b1 \u2192 \u211d)\n (dist_self : \u2200 x : \u03b1, dist x x = 0) (dist_comm : \u2200 x y : \u03b1, dist x y = dist y x)\n (dist_triangle : \u2200 x y z : \u03b1, dist x z \u2264 dist x y + dist y z)\n (H : \u2200 s : Set \u03b1, IsOpen s \u2194 \u2200 x \u2208 s, \u2203 \u03b5 > 0, \u2200 y, dist x y < \u03b5 \u2192 y \u2208 s) :\n PseudoMetricSpace \u03b1\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_self (L188-L190)\ntheorem dist_self (x : \u03b1) : dist x x = 0\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_comm (L191-L193)\ntheorem dist_comm (x y : \u03b1) : dist x y = dist y x\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.MetricSpace.Pseudo.Defs.edist_dist (L194-L196)\ntheorem edist_dist (x y : \u03b1) : edist x y = ENNReal.ofReal (dist x y)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.LipschitzMul (L56-L59)\ndef LipschitzMul.C [_i : LipschitzMul \u03b2] : \u211d\u22650\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.MulOpposite (L85-L91)\ninstance MulOpposite.lipschitzMul : LipschitzMul \u03b2\u1d50\u1d52\u1d56 where\n lipschitz_mul\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.Real (L92-L100)\ninstance Real.hasLipschitzAdd : LipschitzAdd \u211d where\n lipschitz_add\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.lipschitz_with_lipschitz_const_mul (L68-L73)\ntheorem lipschitz_with_lipschitz_const_mul :\n \u2200 p q : \u03b2 \u00d7 \u03b2, dist (p.1 * p.2) (q.1 * q.2) \u2264 LipschitzMul.C \u03b2 * dist p q\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.Submonoid (L79-L83)\ninstance Submonoid.lipschitzMul (s : Submonoid \u03b2) : LipschitzMul s where\n lipschitz_mul\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.MetricSpace.Algebra.lipschitzWith_lipschitz_const_mul_edist (L61-L66)\ntheorem lipschitzWith_lipschitz_const_mul_edist [_i : LipschitzMul \u03b2] :\n LipschitzWith (LipschitzMul.C \u03b2) fun p : \u03b2 \u00d7 \u03b2 => p.1 * p.2\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/MetricSpace/Pseudo/Defs.lean", "module": "Mathlib.Topology.MetricSpace.Pseudo.Defs", "declaration": "Mathlib.Topology.MetricSpace.Pseudo.Defs.tendsto_iff_dist_tendsto_zero", "span": "L1188-L1195", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean#L1188"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1346, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3544, "lean_code_chars": 2737, "natural_language_chars": 807, "lean_code_ratio": 0.7723, "line_count": 105, "imports_count": 0, "declarations_count": 330, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "b09d9c0179b06c12", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Order.Monovary.monovary_iff_forall_smul_nonneg", "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.Algebra.Order.Monovary)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma monovary_iff_forall_smul_nonneg : Monovary f g \u2194 \u2200 i j, 0 \u2264 (f j - f i) \u2022 (g j - g i)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.Monovary.monovaryOn_inv_left (L38-L40)\nlemma monovaryOn_inv_left : MonovaryOn f\u207b\u00b9 g s \u2194 AntivaryOn f g s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.Monovary.antivaryOn_inv_left (L42-L44)\nlemma antivaryOn_inv_left : AntivaryOn f\u207b\u00b9 g s \u2194 MonovaryOn f g s\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.Monovary.Monovary (L70-L72)\nlemma Monovary.mul_left (h\u2081 : Monovary f\u2081 g) (h\u2082 : Monovary f\u2082 g) : Monovary (f\u2081 * f\u2082) g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.Monovary.Antivary (L74-L76)\nlemma Antivary.mul_left (h\u2081 : Antivary f\u2081 g) (h\u2082 : Antivary f\u2082 g) : Antivary (f\u2081 * f\u2082) g\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.Monovary.Monovary (L78-L80)\nlemma Monovary.div_left (h\u2081 : Monovary f\u2081 g) (h\u2082 : Antivary f\u2082 g) : Monovary (f\u2081 / f\u2082) g\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.Monovary.Antivary (L82-L84)\nlemma Antivary.div_left (h\u2081 : Antivary f\u2081 g) (h\u2082 : Monovary f\u2082 g) : Antivary (f\u2081 / f\u2082) g\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.Monovary.monovaryOn_inv_right (L98-L100)\nlemma monovaryOn_inv_right : MonovaryOn f g\u207b\u00b9 s \u2194 AntivaryOn f g s\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.Monovary.antivaryOn_inv_right (L102-L104)\nlemma antivaryOn_inv_right : AntivaryOn f g\u207b\u00b9 s \u2194 MonovaryOn f g s\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero 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.Algebra.Order.Monovary).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma monovary_iff_forall_smul_nonneg : Monovary f g \u2194 \u2200 i j, 0 \u2264 (f j - f i) \u2022 (g j - g i)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.Monovary.monovaryOn_inv_left (L38-L40)\nlemma monovaryOn_inv_left : MonovaryOn f\u207b\u00b9 g s \u2194 AntivaryOn f g s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.Monovary.antivaryOn_inv_left (L42-L44)\nlemma antivaryOn_inv_left : AntivaryOn f\u207b\u00b9 g s \u2194 MonovaryOn f g s\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.Monovary.Monovary (L70-L72)\nlemma Monovary.mul_left (h\u2081 : Monovary f\u2081 g) (h\u2082 : Monovary f\u2082 g) : Monovary (f\u2081 * f\u2082) g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.Monovary.Antivary (L74-L76)\nlemma Antivary.mul_left (h\u2081 : Antivary f\u2081 g) (h\u2082 : Antivary f\u2082 g) : Antivary (f\u2081 * f\u2082) g\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.Monovary.Monovary (L78-L80)\nlemma Monovary.div_left (h\u2081 : Monovary f\u2081 g) (h\u2082 : Antivary f\u2082 g) : Monovary (f\u2081 / f\u2082) g\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.Monovary.Antivary (L82-L84)\nlemma Antivary.div_left (h\u2081 : Antivary f\u2081 g) (h\u2082 : Monovary f\u2082 g) : Antivary (f\u2081 / f\u2082) g\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.Monovary.monovaryOn_inv_right (L98-L100)\nlemma monovaryOn_inv_right : MonovaryOn f g\u207b\u00b9 s \u2194 AntivaryOn f g s\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.Monovary.antivaryOn_inv_right (L102-L104)\nlemma antivaryOn_inv_right : AntivaryOn f g\u207b\u00b9 s \u2194 MonovaryOn f g s\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Monovary.lean", "module": "Mathlib.Algebra.Order.Monovary", "declaration": "Mathlib.Algebra.Order.Monovary.monovary_iff_forall_smul_nonneg", "span": "L378-L381", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Monovary.lean#L378"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1049, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2817, "lean_code_chars": 2020, "natural_language_chars": 797, "lean_code_ratio": 0.7171, "line_count": 93, "imports_count": 0, "declarations_count": 290, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "848c2c64149879eb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Algebra.InfiniteSum.Defs.tprod_eq_one_of_not_multipliable", "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.Topology.Algebra.InfiniteSum.Defs)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem tprod_eq_one_of_not_multipliable (h : \u00acMultipliable f L) : \u220f'[L] b, f b = 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.HasProd (L106-L110)\ndef HasProd (f : \u03b2 \u2192 \u03b1) (a : \u03b1) (L\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.Multipliable (L114-L116)\ndef Multipliable (f : \u03b2 \u2192 \u03b1) (L\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.Multipliable (L118-L131)\nlemma Multipliable.mono_filter {f : \u03b2 \u2192 \u03b1} {L\u2081 L\u2082 : SummationFilter \u03b2}\n (hf : Multipliable f L\u2082) (h : L\u2081.filter \u2264 L\u2082.filter) : Multipliable f L\u2081\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.hasProd_bot (L163-L168)\nlemma hasProd_bot (hL : \u00acL.NeBot) (f : \u03b2 \u2192 \u03b1) (a : \u03b1) :\n HasProd f a L\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.multipliable_bot (L170-L178)\nlemma multipliable_bot (hL : \u00acL.NeBot) (f : \u03b2 \u2192 \u03b1) :\n Multipliable f L\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.tprod_bot (L184-L195)\nlemma tprod_bot (hL : \u00acL.NeBot) (f : \u03b2 \u2192 \u03b1) : \u220f'[L] b, f b = \u220f\u1da0 b, f b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.HasProd (L197-L199)\ntheorem HasProd.multipliable (h : HasProd f a L) : Multipliable f L\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.Function (L205-L208)\ntheorem Function.Injective.hasProd_map_iff {L : SummationFilter \u03b3} {g : \u03b3 \u2192 \u03b2} (hg : Injective g) :\n HasProd f a (L.map \u27e8g, hg\u27e9) \u2194 HasProd (f \u2218 g) a L\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous 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.Topology.Algebra.InfiniteSum.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 tprod_eq_one_of_not_multipliable (h : \u00acMultipliable f L) : \u220f'[L] b, f b = 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.HasProd (L106-L110)\ndef HasProd (f : \u03b2 \u2192 \u03b1) (a : \u03b1) (L\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.Multipliable (L114-L116)\ndef Multipliable (f : \u03b2 \u2192 \u03b1) (L\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.Multipliable (L118-L131)\nlemma Multipliable.mono_filter {f : \u03b2 \u2192 \u03b1} {L\u2081 L\u2082 : SummationFilter \u03b2}\n (hf : Multipliable f L\u2082) (h : L\u2081.filter \u2264 L\u2082.filter) : Multipliable f L\u2081\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.hasProd_bot (L163-L168)\nlemma hasProd_bot (hL : \u00acL.NeBot) (f : \u03b2 \u2192 \u03b1) (a : \u03b1) :\n HasProd f a L\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.multipliable_bot (L170-L178)\nlemma multipliable_bot (hL : \u00acL.NeBot) (f : \u03b2 \u2192 \u03b1) :\n Multipliable f L\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.tprod_bot (L184-L195)\nlemma tprod_bot (hL : \u00acL.NeBot) (f : \u03b2 \u2192 \u03b1) : \u220f'[L] b, f b = \u220f\u1da0 b, f b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.HasProd (L197-L199)\ntheorem HasProd.multipliable (h : HasProd f a L) : Multipliable f L\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.InfiniteSum.Defs.Function (L205-L208)\ntheorem Function.Injective.hasProd_map_iff {L : SummationFilter \u03b3} {g : \u03b3 \u2192 \u03b2} (hg : Injective g) :\n HasProd f a (L.map \u27e8g, hg\u27e9) \u2194 HasProd (f \u2218 g) a L\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/InfiniteSum/Defs.lean", "module": "Mathlib.Topology.Algebra.InfiniteSum.Defs", "declaration": "Mathlib.Topology.Algebra.InfiniteSum.Defs.tprod_eq_one_of_not_multipliable", "span": "L201-L203", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/InfiniteSum/Defs.lean#L201"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1132, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3008, "lean_code_chars": 2200, "natural_language_chars": 808, "lean_code_ratio": 0.7314, "line_count": 97, "imports_count": 0, "declarations_count": 279, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a7942b3e939d7ce4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Asymptotics.TVS.IsBigOTVS", "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.Analysis.Asymptotics.TVS)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsBigOTVS.neg_right (h : f =O[\ud835\udd5c; l] g) : f =O[\ud835\udd5c; l] (-g)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsThetaTVS (L120-L122)\ndef IsThetaTVS (l : Filter \u03b1) (f : \u03b1 \u2192 E) (g : \u03b1 \u2192 F) : Prop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.isLittleOTVS_iff_tendsto_div (L141-L151)\ntheorem isLittleOTVS_iff_tendsto_div :\n f =o[\ud835\udd5c; l] g \u2194 \u2200 U \u2208 \ud835\udcdd 0, \u2203 V \u2208 \ud835\udcdd 0,\n Tendsto (fun x \u21a6 egauge \ud835\udd5c U (f x) / egauge \ud835\udd5c V (g x)) l (\ud835\udcdd 0)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L152-L159)\ntheorem IsLittleOTVS.exists_eventuallyLE_mul_ennreal (h : f =o[\ud835\udd5c; l] g) {U : Set E} (hU : U \u2208 \ud835\udcdd 0) :\n \u2203 V \u2208 \ud835\udcdd (0 : F), \u2200 \u03b5 \u2260 0, (fun x \u21a6 egauge \ud835\udd5c U (f x)) \u2264\u1da0[l] (fun x \u21a6 \u03b5 * egauge \ud835\udd5c V (g x))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.isLittleOTVS_congr (L160-L167)\ntheorem isLittleOTVS_congr (hf : f\u2081 =\u1da0[l] f\u2082) (hg : g\u2081 =\u1da0[l] g\u2082) :\n f\u2081 =o[\ud835\udd5c; l] g\u2081 \u2194 f\u2082 =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L168-L171)\ntheorem IsLittleOTVS.congr' (h : f\u2081 =o[\ud835\udd5c; l] g\u2081) (hf : f\u2081 =\u1da0[l] f\u2082) (hg : g\u2081 =\u1da0[l] g\u2082) :\n f\u2082 =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L172-L175)\ntheorem IsLittleOTVS.congr (h : f\u2081 =o[\ud835\udd5c; l] g\u2081) (hf : \u2200 x, f\u2081 x = f\u2082 x) (hg : \u2200 x, g\u2081 x = g\u2082 x) :\n f\u2082 =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L176-L178)\ntheorem IsLittleOTVS.congr_left (h : f\u2081 =o[\ud835\udd5c; l] g) (hf : \u2200 x, f\u2081 x = f\u2082 x) : f\u2082 =o[\ud835\udd5c; l] g\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L179-L181)\ntheorem IsLittleOTVS.congr_right (h : f =o[\ud835\udd5c; l] g\u2081) (hg : \u2200 x, g\u2081 x = g\u2082 x) : f =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.IsLittleO (L153-L155)\ntheorem IsLittleO.add_isEquivalent (hu : u =o[l] w) (hv : v ~[l] w) : u + v ~[l] w\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_iff_exists_eq_mul (L181-L191)\ntheorem isEquivalent_iff_exists_eq_mul :\n u ~[l] v \u2194 \u2203 (\u03c6 : \u03b1 \u2192 \u03b2) (_ : Tendsto \u03c6 l (\ud835\udcdd 1)), u =\u1da0[l] \u03c6 * v\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_zero_iff_isBigO_zero (L114-L118)\ntheorem isEquivalent_zero_iff_isBigO_zero : u ~[l] 0 \u2194 u =O[l] (0 : \u03b1 \u2192 \u03b2)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.IsEquivalent (L73-L77)\ntheorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_const_iff_tendsto (L119-L128)\ntheorem isEquivalent_const_iff_tendsto {c : \u03b2} (h : c \u2260 0) :\n u ~[l] const _ c \u2194 Tendsto u l (\ud835\udcdd c)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_zero_iff_eventually_zero (L110-L113)\ntheorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 \u2194 u =\u1da0[l] 0\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.Analysis.Asymptotics.TVS).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsBigOTVS.neg_right (h : f =O[\ud835\udd5c; l] g) : f =O[\ud835\udd5c; l] (-g)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsThetaTVS (L120-L122)\ndef IsThetaTVS (l : Filter \u03b1) (f : \u03b1 \u2192 E) (g : \u03b1 \u2192 F) : Prop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.isLittleOTVS_iff_tendsto_div (L141-L151)\ntheorem isLittleOTVS_iff_tendsto_div :\n f =o[\ud835\udd5c; l] g \u2194 \u2200 U \u2208 \ud835\udcdd 0, \u2203 V \u2208 \ud835\udcdd 0,\n Tendsto (fun x \u21a6 egauge \ud835\udd5c U (f x) / egauge \ud835\udd5c V (g x)) l (\ud835\udcdd 0)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L152-L159)\ntheorem IsLittleOTVS.exists_eventuallyLE_mul_ennreal (h : f =o[\ud835\udd5c; l] g) {U : Set E} (hU : U \u2208 \ud835\udcdd 0) :\n \u2203 V \u2208 \ud835\udcdd (0 : F), \u2200 \u03b5 \u2260 0, (fun x \u21a6 egauge \ud835\udd5c U (f x)) \u2264\u1da0[l] (fun x \u21a6 \u03b5 * egauge \ud835\udd5c V (g x))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.isLittleOTVS_congr (L160-L167)\ntheorem isLittleOTVS_congr (hf : f\u2081 =\u1da0[l] f\u2082) (hg : g\u2081 =\u1da0[l] g\u2082) :\n f\u2081 =o[\ud835\udd5c; l] g\u2081 \u2194 f\u2082 =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L168-L171)\ntheorem IsLittleOTVS.congr' (h : f\u2081 =o[\ud835\udd5c; l] g\u2081) (hf : f\u2081 =\u1da0[l] f\u2082) (hg : g\u2081 =\u1da0[l] g\u2082) :\n f\u2082 =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L172-L175)\ntheorem IsLittleOTVS.congr (h : f\u2081 =o[\ud835\udd5c; l] g\u2081) (hf : \u2200 x, f\u2081 x = f\u2082 x) (hg : \u2200 x, g\u2081 x = g\u2082 x) :\n f\u2082 =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L176-L178)\ntheorem IsLittleOTVS.congr_left (h : f\u2081 =o[\ud835\udd5c; l] g) (hf : \u2200 x, f\u2081 x = f\u2082 x) : f\u2082 =o[\ud835\udd5c; l] g\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Asymptotics.TVS.IsLittleOTVS (L179-L181)\ntheorem IsLittleOTVS.congr_right (h : f =o[\ud835\udd5c; l] g\u2081) (hg : \u2200 x, g\u2081 x = g\u2082 x) : f =o[\ud835\udd5c; l] g\u2082\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.IsLittleO (L153-L155)\ntheorem IsLittleO.add_isEquivalent (hu : u =o[l] w) (hv : v ~[l] w) : u + v ~[l] w\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_iff_exists_eq_mul (L181-L191)\ntheorem isEquivalent_iff_exists_eq_mul :\n u ~[l] v \u2194 \u2203 (\u03c6 : \u03b1 \u2192 \u03b2) (_ : Tendsto \u03c6 l (\ud835\udcdd 1)), u =\u1da0[l] \u03c6 * v\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_zero_iff_isBigO_zero (L114-L118)\ntheorem isEquivalent_zero_iff_isBigO_zero : u ~[l] 0 \u2194 u =O[l] (0 : \u03b1 \u2192 \u03b2)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.IsEquivalent (L73-L77)\ntheorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_const_iff_tendsto (L119-L128)\ntheorem isEquivalent_const_iff_tendsto {c : \u03b2} (h : c \u2260 0) :\n u ~[l] const _ c \u2194 Tendsto u l (\ud835\udcdd c)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Asymptotics.AsymptoticEquivalent.isEquivalent_zero_iff_eventually_zero (L110-L113)\ntheorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 \u2194 u =\u1da0[l] 0\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Asymptotics/TVS.lean", "module": "Mathlib.Analysis.Asymptotics.TVS", "declaration": "Mathlib.Analysis.Asymptotics.TVS.IsBigOTVS", "span": "L595-L597", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Asymptotics/TVS.lean#L595"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1505, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3336, "lean_code_chars": 2537, "natural_language_chars": 799, "lean_code_ratio": 0.7605, "line_count": 99, "imports_count": 0, "declarations_count": 342, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "8374a21e449f70b6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Homology.ShortComplex.Limits.hasColimitsOfShape", "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.Algebra.Homology.ShortComplex.Limits)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance hasColimitsOfShape :\n HasColimitsOfShape J (ShortComplex C) where\n\nnoncomputable instance : PreservesColimitsOfShape J (\u03c0\u2081 : _ \u2964 C) where\n\nnoncomputable instance : PreservesColimitsOfShape J (\u03c0\u2082 : _ \u2964 C) where\n\nnoncomputable instance : PreservesColimitsOfShape J (\u03c0\u2083 : _ \u2964 C) where\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.isLimitOfIsLimit\u03c0 (L34-L61)\ndef isLimitOfIsLimit\u03c0 (c : Cone F)\n (h\u2081 : IsLimit (\u03c0\u2081.mapCone c)) (h\u2082 : IsLimit (\u03c0\u2082.mapCone c))\n (h\u2083 : IsLimit (\u03c0\u2083.mapCone c)) : IsLimit c where\n lift s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.hasLimit_of_hasLimit\u03c0 (L98-L108)\ninstance hasLimit_of_hasLimit\u03c0 : HasLimit F\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.hasLimitsOfShape (L115-L123)\ninstance hasLimitsOfShape :\n HasLimitsOfShape J (ShortComplex C) where\n\nnoncomputable instance : PreservesLimitsOfShape J (\u03c0\u2081 : _ \u2964 C) where\n\nnoncomputable instance : PreservesLimitsOfShape J (\u03c0\u2082 : _ \u2964 C) where\n\nnoncomputable instance : PreservesLimitsOfShape J (\u03c0\u2083 : _ \u2964 C) where\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.hasFiniteLimits (L130-L141)\ninstance hasFiniteLimits : HasFiniteLimits (ShortComplex C)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.preservesMonomorphisms_\u03c0\u2081 (L148-L151)\ninstance preservesMonomorphisms_\u03c0\u2081 :\n Functor.PreservesMonomorphisms (\u03c0\u2081 : _ \u2964 C)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.preservesMonomorphisms_\u03c0\u2082 (L152-L155)\ninstance preservesMonomorphisms_\u03c0\u2082 :\n Functor.PreservesMonomorphisms (\u03c0\u2082 : _ \u2964 C)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.preservesMonomorphisms_\u03c0\u2083 (L156-L159)\ninstance preservesMonomorphisms_\u03c0\u2083 :\n Functor.PreservesMonomorphisms (\u03c0\u2083 : _ \u2964 C)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.isColimitOfIsColimit\u03c0 (L164-L195)\ndef isColimitOfIsColimit\u03c0 (c : Cocone F)\n (h\u2081 : IsColimit (\u03c0\u2081.mapCocone c)) (h\u2082 : IsColimit (\u03c0\u2082.mapCocone c))\n (h\u2083 : IsColimit (\u03c0\u2083.mapCocone c)) : IsColimit c where\n desc s\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Homology.Additive.hasIntScalar (L53-L57)\ninstance hasIntScalar : SMul \u2124 (C \u27f6 D)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Homology.Additive.zero_f_apply (L59-L61)\ntheorem zero_f_apply (i : \u03b9) : (0 : C \u27f6 D).f i = 0\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Homology.Additive.sub_f_apply (L71-L73)\ntheorem sub_f_apply (f g : C \u27f6 D) (i : \u03b9) : (f - g).f i = f.f i - g.f i\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Homology.Additive.neg_f_apply (L67-L69)\ntheorem neg_f_apply (f : C \u27f6 D) (i : \u03b9) : (-f).f i = -f.f i\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Homology.Additive.hasNatScalar (L48-L52)\ninstance hasNatScalar : SMul \u2115 (C \u27f6 D)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Homology.Additive.add_f_apply (L63-L65)\ntheorem add_f_apply (f g : C \u27f6 D) (i : \u03b9) : (f + g).f i = f.f i + g.f i\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.Algebra.Homology.ShortComplex.Limits).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance hasColimitsOfShape :\n HasColimitsOfShape J (ShortComplex C) where\n\nnoncomputable instance : PreservesColimitsOfShape J (\u03c0\u2081 : _ \u2964 C) where\n\nnoncomputable instance : PreservesColimitsOfShape J (\u03c0\u2082 : _ \u2964 C) where\n\nnoncomputable instance : PreservesColimitsOfShape J (\u03c0\u2083 : _ \u2964 C) where\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.isLimitOfIsLimit\u03c0 (L34-L61)\ndef isLimitOfIsLimit\u03c0 (c : Cone F)\n (h\u2081 : IsLimit (\u03c0\u2081.mapCone c)) (h\u2082 : IsLimit (\u03c0\u2082.mapCone c))\n (h\u2083 : IsLimit (\u03c0\u2083.mapCone c)) : IsLimit c where\n lift s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.hasLimit_of_hasLimit\u03c0 (L98-L108)\ninstance hasLimit_of_hasLimit\u03c0 : HasLimit F\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.hasLimitsOfShape (L115-L123)\ninstance hasLimitsOfShape :\n HasLimitsOfShape J (ShortComplex C) where\n\nnoncomputable instance : PreservesLimitsOfShape J (\u03c0\u2081 : _ \u2964 C) where\n\nnoncomputable instance : PreservesLimitsOfShape J (\u03c0\u2082 : _ \u2964 C) where\n\nnoncomputable instance : PreservesLimitsOfShape J (\u03c0\u2083 : _ \u2964 C) where\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.hasFiniteLimits (L130-L141)\ninstance hasFiniteLimits : HasFiniteLimits (ShortComplex C)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.preservesMonomorphisms_\u03c0\u2081 (L148-L151)\ninstance preservesMonomorphisms_\u03c0\u2081 :\n Functor.PreservesMonomorphisms (\u03c0\u2081 : _ \u2964 C)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.preservesMonomorphisms_\u03c0\u2082 (L152-L155)\ninstance preservesMonomorphisms_\u03c0\u2082 :\n Functor.PreservesMonomorphisms (\u03c0\u2082 : _ \u2964 C)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.preservesMonomorphisms_\u03c0\u2083 (L156-L159)\ninstance preservesMonomorphisms_\u03c0\u2083 :\n Functor.PreservesMonomorphisms (\u03c0\u2083 : _ \u2964 C)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Homology.ShortComplex.Limits.isColimitOfIsColimit\u03c0 (L164-L195)\ndef isColimitOfIsColimit\u03c0 (c : Cocone F)\n (h\u2081 : IsColimit (\u03c0\u2081.mapCocone c)) (h\u2082 : IsColimit (\u03c0\u2082.mapCocone c))\n (h\u2083 : IsColimit (\u03c0\u2083.mapCocone c)) : IsColimit c where\n desc s\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Homology.Additive.hasIntScalar (L53-L57)\ninstance hasIntScalar : SMul \u2124 (C \u27f6 D)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Homology.Additive.zero_f_apply (L59-L61)\ntheorem zero_f_apply (i : \u03b9) : (0 : C \u27f6 D).f i = 0\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Homology.Additive.sub_f_apply (L71-L73)\ntheorem sub_f_apply (f g : C \u27f6 D) (i : \u03b9) : (f - g).f i = f.f i - g.f i\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Homology.Additive.neg_f_apply (L67-L69)\ntheorem neg_f_apply (f : C \u27f6 D) (i : \u03b9) : (-f).f i = -f.f i\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Homology.Additive.hasNatScalar (L48-L52)\ninstance hasNatScalar : SMul \u2115 (C \u27f6 D)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Homology.Additive.add_f_apply (L63-L65)\ntheorem add_f_apply (f g : C \u27f6 D) (i : \u03b9) : (f + g).f i = f.f i + g.f i\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Homology/ShortComplex/Limits.lean", "module": "Mathlib.Algebra.Homology.ShortComplex.Limits", "declaration": "Mathlib.Algebra.Homology.ShortComplex.Limits.hasColimitsOfShape", "span": "L258-L266", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/ShortComplex/Limits.lean#L258"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1251, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3428, "lean_code_chars": 2617, "natural_language_chars": 811, "lean_code_ratio": 0.7634, "line_count": 114, "imports_count": 0, "declarations_count": 299, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "f41e7ccaba6edb70", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.OpenPartialHomeomorph.Defs.eq_symm_apply", "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.Topology.OpenPartialHomeomorph.Defs)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem eq_symm_apply {x : X} {y : Y} (hx : x \u2208 e.source) (hy : y \u2208 e.target) :\n x = e.symm y \u2194 e x = y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.Simps (L88-L90)\ndef Simps.apply (e : OpenPartialHomeomorph X Y) : X \u2192 Y\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.Simps (L91-L97)\ndef Simps.symm_apply (e : OpenPartialHomeomorph X Y) : Y \u2192 X\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.continuousOn_symm (L98-L100)\ntheorem continuousOn_symm : ContinuousOn e.symm e.target\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.mk_coe (L102-L105)\ntheorem mk_coe (e : PartialEquiv X Y) (a b c d) :\n (OpenPartialHomeomorph.mk e a b c d : X \u2192 Y) = e\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.mk_coe_symm (L107-L110)\ntheorem mk_coe_symm (e : PartialEquiv X Y) (a b c d) :\n ((OpenPartialHomeomorph.mk e a b c d).symm : Y \u2192 X) = e.symm\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.toPartialEquiv_injective (L111-L116)\ntheorem toPartialEquiv_injective :\n Injective (toPartialEquiv : OpenPartialHomeomorph X Y \u2192 PartialEquiv X Y)\n | \u27e8_, _, _, _, _\u27e9, \u27e8_, _, _, _, _\u27e9, rfl => rfl\n\n/- Register a few simp lemmas to make sure that `simp` puts the application of a local\nhomeomorphism in its normal form, i.e., in terms of its coercion to a function. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.toFun_eq_coe (L118-L120)\ntheorem toFun_eq_coe (e : OpenPartialHomeomorph X Y) : e.toFun = e\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.invFun_eq_coe (L122-L124)\ntheorem invFun_eq_coe (e : OpenPartialHomeomorph X Y) : e.invFun = e.symm\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.image_source_inter_eq' (L54-L56)\ntheorem image_source_inter_eq' (s : Set X) : e '' (e.source \u2229 s) = e.target \u2229 e.symm \u207b\u00b9' s\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.image_source_inter_eq (L57-L60)\ntheorem image_source_inter_eq (s : Set X) :\n e '' (e.source \u2229 s) = e.target \u2229 e.symm \u207b\u00b9' (e.source \u2229 s)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.refl_partialEquiv (L38-L40)\ntheorem refl_partialEquiv : (OpenPartialHomeomorph.refl X).toPartialEquiv = PartialEquiv.refl X\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.image_eq_target_inter_inv_preimage (L50-L53)\ntheorem image_eq_target_inter_inv_preimage {s : Set X} (h : s \u2286 e.source) :\n e '' s = e.target \u2229 e.symm \u207b\u00b9' s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.refl_symm (L42-L46)\ntheorem refl_symm : (OpenPartialHomeomorph.refl X).symm = OpenPartialHomeomorph.refl X\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.source_preimage_target (L47-L49)\ntheorem source_preimage_target : e.source \u2286 e \u207b\u00b9' e.target\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.Topology.OpenPartialHomeomorph.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 eq_symm_apply {x : X} {y : Y} (hx : x \u2208 e.source) (hy : y \u2208 e.target) :\n x = e.symm y \u2194 e x = y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.Simps (L88-L90)\ndef Simps.apply (e : OpenPartialHomeomorph X Y) : X \u2192 Y\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.Simps (L91-L97)\ndef Simps.symm_apply (e : OpenPartialHomeomorph X Y) : Y \u2192 X\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.continuousOn_symm (L98-L100)\ntheorem continuousOn_symm : ContinuousOn e.symm e.target\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.mk_coe (L102-L105)\ntheorem mk_coe (e : PartialEquiv X Y) (a b c d) :\n (OpenPartialHomeomorph.mk e a b c d : X \u2192 Y) = e\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.mk_coe_symm (L107-L110)\ntheorem mk_coe_symm (e : PartialEquiv X Y) (a b c d) :\n ((OpenPartialHomeomorph.mk e a b c d).symm : Y \u2192 X) = e.symm\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.toPartialEquiv_injective (L111-L116)\ntheorem toPartialEquiv_injective :\n Injective (toPartialEquiv : OpenPartialHomeomorph X Y \u2192 PartialEquiv X Y)\n | \u27e8_, _, _, _, _\u27e9, \u27e8_, _, _, _, _\u27e9, rfl => rfl\n\n/- Register a few simp lemmas to make sure that `simp` puts the application of a local\nhomeomorphism in its normal form, i.e., in terms of its coercion to a function. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.toFun_eq_coe (L118-L120)\ntheorem toFun_eq_coe (e : OpenPartialHomeomorph X Y) : e.toFun = e\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Defs.invFun_eq_coe (L122-L124)\ntheorem invFun_eq_coe (e : OpenPartialHomeomorph X Y) : e.invFun = e.symm\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.image_source_inter_eq' (L54-L56)\ntheorem image_source_inter_eq' (s : Set X) : e '' (e.source \u2229 s) = e.target \u2229 e.symm \u207b\u00b9' s\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.image_source_inter_eq (L57-L60)\ntheorem image_source_inter_eq (s : Set X) :\n e '' (e.source \u2229 s) = e.target \u2229 e.symm \u207b\u00b9' (e.source \u2229 s)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.refl_partialEquiv (L38-L40)\ntheorem refl_partialEquiv : (OpenPartialHomeomorph.refl X).toPartialEquiv = PartialEquiv.refl X\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.image_eq_target_inter_inv_preimage (L50-L53)\ntheorem image_eq_target_inter_inv_preimage {s : Set X} (h : s \u2286 e.source) :\n e '' s = e.target \u2229 e.symm \u207b\u00b9' s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.refl_symm (L42-L46)\ntheorem refl_symm : (OpenPartialHomeomorph.refl X).symm = OpenPartialHomeomorph.refl X\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.OpenPartialHomeomorph.Basic.source_preimage_target (L47-L49)\ntheorem source_preimage_target : e.source \u2286 e \u207b\u00b9' e.target\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/OpenPartialHomeomorph/Defs.lean", "module": "Mathlib.Topology.OpenPartialHomeomorph.Defs", "declaration": "Mathlib.Topology.OpenPartialHomeomorph.Defs.eq_symm_apply", "span": "L153-L181", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/OpenPartialHomeomorph/Defs.lean#L153"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1146, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3388, "lean_code_chars": 2578, "natural_language_chars": 810, "lean_code_ratio": 0.7609, "line_count": 101, "imports_count": 0, "declarations_count": 318, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "9546e8078c3cc6b0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.GroupTheory.Perm.Cycle.Basic.IsCycle", "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.GroupTheory.Perm.Cycle.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsCycle.isConj_iff (h\u03c3 : IsCycle \u03c3) (h\u03c4 : IsCycle \u03c4) :\n IsConj \u03c3 \u03c4 \u2194 #\u03c3.support = #\u03c4.support where\n mp h\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L53-L55)\ndef SameCycle (f : Perm \u03b1) (x y : \u03b1) : Prop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L57-L59)\ntheorem SameCycle.refl (f : Perm \u03b1) (x : \u03b1) : SameCycle f x x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L60-L64)\ntheorem SameCycle.rfl : SameCycle f x x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L66-L68)\ntheorem SameCycle.symm : SameCycle f x y \u2192 SameCycle f y x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.sameCycle_comm (L69-L71)\ntheorem sameCycle_comm : SameCycle f x y \u2194 SameCycle f y x\n```\n\n-- snippet 6\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L73-L76)\ntheorem SameCycle.trans : SameCycle f x y \u2192 SameCycle f y z \u2192 SameCycle f x z\n```\n\n-- snippet 7\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L77-L80)\ntheorem SameCycle.equivalence : Equivalence (SameCycle f)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L82-L85)\ndef SameCycle.setoid (f : Perm \u03b1) : Setoid \u03b1 where\n r\n```\n\n-- snippet 9\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.SurjOn (L59-L60)\nlemma SurjOn.perm_pow : SurjOn f s s \u2192 \u2200 n : \u2115, SurjOn (f ^ n) s s\n```\n\n-- snippet 10\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.MapsTo (L57-L58)\nlemma MapsTo.perm_pow : MapsTo f s s \u2192 \u2200 n : \u2115, MapsTo (f ^ n) s s\n```\n\n-- snippet 11\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.swap_smul_involutive (L44-L54)\ntheorem swap_smul_involutive [MulAction (Perm \u03b1) \u03b2] (i j : \u03b1) :\n Function.Involutive (swap i j \u2022 \u00b7 : \u03b2 \u2192 \u03b2)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.swap_smul_self_smul (L41-L43)\ntheorem swap_smul_self_smul [MulAction (Perm \u03b1) \u03b2] (i j : \u03b1) (x : \u03b2) :\n swap i j \u2022 swap i j \u2022 x = x\n```\n\n-- snippet 13\n```lean\n-- Mathlib.GroupTheory.Perm.Centralizer.Subgroup (L116-L130)\nlemma Subgroup.Centralizer.toConjAct_smul_mem_cycleFactorsFinset {k c : Perm \u03b1}\n (k_mem : k \u2208 centralizer {g}) (c_mem : c \u2208 g.cycleFactorsFinset) :\n ConjAct.toConjAct k \u2022 c \u2208 g.cycleFactorsFinset\n```\n\n-- snippet 14\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.BijOn (L55-L56)\nlemma BijOn.perm_inv (hf : BijOn f s s) : BijOn \u2191(f\u207b\u00b9) s s\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.GroupTheory.Perm.Cycle.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 IsCycle.isConj_iff (h\u03c3 : IsCycle \u03c3) (h\u03c4 : IsCycle \u03c4) :\n IsConj \u03c3 \u03c4 \u2194 #\u03c3.support = #\u03c4.support where\n mp h\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L53-L55)\ndef SameCycle (f : Perm \u03b1) (x y : \u03b1) : Prop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L57-L59)\ntheorem SameCycle.refl (f : Perm \u03b1) (x : \u03b1) : SameCycle f x x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L60-L64)\ntheorem SameCycle.rfl : SameCycle f x x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L66-L68)\ntheorem SameCycle.symm : SameCycle f x y \u2192 SameCycle f y x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.sameCycle_comm (L69-L71)\ntheorem sameCycle_comm : SameCycle f x y \u2194 SameCycle f y x\n```\n\n-- snippet 6\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L73-L76)\ntheorem SameCycle.trans : SameCycle f x y \u2192 SameCycle f y z \u2192 SameCycle f x z\n```\n\n-- snippet 7\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L77-L80)\ntheorem SameCycle.equivalence : Equivalence (SameCycle f)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.GroupTheory.Perm.Cycle.Basic.SameCycle (L82-L85)\ndef SameCycle.setoid (f : Perm \u03b1) : Setoid \u03b1 where\n r\n```\n\n-- snippet 9\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.SurjOn (L59-L60)\nlemma SurjOn.perm_pow : SurjOn f s s \u2192 \u2200 n : \u2115, SurjOn (f ^ n) s s\n```\n\n-- snippet 10\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.MapsTo (L57-L58)\nlemma MapsTo.perm_pow : MapsTo f s s \u2192 \u2200 n : \u2115, MapsTo (f ^ n) s s\n```\n\n-- snippet 11\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.swap_smul_involutive (L44-L54)\ntheorem swap_smul_involutive [MulAction (Perm \u03b1) \u03b2] (i j : \u03b1) :\n Function.Involutive (swap i j \u2022 \u00b7 : \u03b2 \u2192 \u03b2)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.swap_smul_self_smul (L41-L43)\ntheorem swap_smul_self_smul [MulAction (Perm \u03b1) \u03b2] (i j : \u03b1) (x : \u03b2) :\n swap i j \u2022 swap i j \u2022 x = x\n```\n\n-- snippet 13\n```lean\n-- Mathlib.GroupTheory.Perm.Centralizer.Subgroup (L116-L130)\nlemma Subgroup.Centralizer.toConjAct_smul_mem_cycleFactorsFinset {k c : Perm \u03b1}\n (k_mem : k \u2208 centralizer {g}) (c_mem : c \u2208 g.cycleFactorsFinset) :\n ConjAct.toConjAct k \u2022 c \u2208 g.cycleFactorsFinset\n```\n\n-- snippet 14\n```lean\n-- Mathlib.GroupTheory.Perm.Basic.BijOn (L55-L56)\nlemma BijOn.perm_inv (hf : BijOn f s s) : BijOn \u2191(f\u207b\u00b9) s s\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/Perm/Cycle/Basic.lean", "module": "Mathlib.GroupTheory.Perm.Cycle.Basic", "declaration": "Mathlib.GroupTheory.Perm.Cycle.Basic.IsCycle", "span": "L646-L662", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Perm/Cycle/Basic.lean#L646"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1025, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2811, "lean_code_chars": 2008, "natural_language_chars": 803, "lean_code_ratio": 0.7143, "line_count": 98, "imports_count": 0, "declarations_count": 273, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "5e243e727ccd33ea", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Analytic.ChangeOrigin.changeOriginSeries", "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.Analysis.Analytic.ChangeOrigin)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef changeOriginSeries (k : \u2115) : FormalMultilinearSeries \ud835\udd5c E (E [\u00d7k]\u2192L[\ud835\udd5c] F)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.changeOriginSeriesTerm (L64-L69)\ndef changeOriginSeriesTerm (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l) :\n E [\u00d7l]\u2192L[\ud835\udd5c] E [\u00d7k]\u2192L[\ud835\udd5c] F\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.changeOriginSeriesTerm_apply (L70-L75)\ntheorem changeOriginSeriesTerm_apply (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l)\n (x y : E) :\n (p.changeOriginSeriesTerm k l s hs (fun _ => x) fun _ => y) =\n p (k + l) (s.piecewise (fun _ => x) fun _ => y)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.norm_changeOriginSeriesTerm (L77-L80)\ntheorem norm_changeOriginSeriesTerm (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l) :\n \u2016p.changeOriginSeriesTerm k l s hs\u2016 = \u2016p (k + l)\u2016\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeriesTerm (L82-L85)\ntheorem nnnorm_changeOriginSeriesTerm (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l) :\n \u2016p.changeOriginSeriesTerm k l s hs\u2016\u208a = \u2016p (k + l)\u2016\u208a\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeriesTerm_apply_le (L86-L99)\ntheorem nnnorm_changeOriginSeriesTerm_apply_le (k l : \u2115) (s : Finset (Fin (k + l)))\n (hs : s.card = l) (x y : E) :\n \u2016p.changeOriginSeriesTerm k l s hs (fun _ => x) fun _ => y\u2016\u208a \u2264\n \u2016p (k + l)\u2016\u208a * \u2016x\u2016\u208a ^ l * \u2016y\u2016\u208a ^ k\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeries_le_tsum (L103-L108)\ntheorem nnnorm_changeOriginSeries_le_tsum (k l : \u2115) :\n \u2016p.changeOriginSeries k l\u2016\u208a \u2264\n \u2211' _ : { s : Finset (Fin (k + l)) // s.card = l }, \u2016p (k + l)\u2016\u208a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeries_apply_le_tsum (L109-L117)\ntheorem nnnorm_changeOriginSeries_apply_le_tsum (k l : \u2115) (x : E) :\n \u2016p.changeOriginSeries k l fun _ => x\u2016\u208a \u2264\n \u2211' _ : { s : Finset (Fin (k + l)) // s.card = l }, \u2016p (k + l)\u2016\u208a * \u2016x\u2016\u208a ^ l\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.changeOrigin (L118-L128)\ndef changeOrigin (x : E) : FormalMultilinearSeries \ud835\udd5c E F\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOn (L123-L131)\ndef AnalyticOn (f : E \u2192 F) (s : Set E) : Prop\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.Analysis.Analytic.ChangeOrigin).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef changeOriginSeries (k : \u2115) : FormalMultilinearSeries \ud835\udd5c E (E [\u00d7k]\u2192L[\ud835\udd5c] F)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.changeOriginSeriesTerm (L64-L69)\ndef changeOriginSeriesTerm (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l) :\n E [\u00d7l]\u2192L[\ud835\udd5c] E [\u00d7k]\u2192L[\ud835\udd5c] F\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.changeOriginSeriesTerm_apply (L70-L75)\ntheorem changeOriginSeriesTerm_apply (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l)\n (x y : E) :\n (p.changeOriginSeriesTerm k l s hs (fun _ => x) fun _ => y) =\n p (k + l) (s.piecewise (fun _ => x) fun _ => y)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.norm_changeOriginSeriesTerm (L77-L80)\ntheorem norm_changeOriginSeriesTerm (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l) :\n \u2016p.changeOriginSeriesTerm k l s hs\u2016 = \u2016p (k + l)\u2016\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeriesTerm (L82-L85)\ntheorem nnnorm_changeOriginSeriesTerm (k l : \u2115) (s : Finset (Fin (k + l))) (hs : s.card = l) :\n \u2016p.changeOriginSeriesTerm k l s hs\u2016\u208a = \u2016p (k + l)\u2016\u208a\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeriesTerm_apply_le (L86-L99)\ntheorem nnnorm_changeOriginSeriesTerm_apply_le (k l : \u2115) (s : Finset (Fin (k + l)))\n (hs : s.card = l) (x y : E) :\n \u2016p.changeOriginSeriesTerm k l s hs (fun _ => x) fun _ => y\u2016\u208a \u2264\n \u2016p (k + l)\u2016\u208a * \u2016x\u2016\u208a ^ l * \u2016y\u2016\u208a ^ k\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeries_le_tsum (L103-L108)\ntheorem nnnorm_changeOriginSeries_le_tsum (k l : \u2115) :\n \u2016p.changeOriginSeries k l\u2016\u208a \u2264\n \u2211' _ : { s : Finset (Fin (k + l)) // s.card = l }, \u2016p (k + l)\u2016\u208a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.nnnorm_changeOriginSeries_apply_le_tsum (L109-L117)\ntheorem nnnorm_changeOriginSeries_apply_le_tsum (k l : \u2115) (x : E) :\n \u2016p.changeOriginSeries k l fun _ => x\u2016\u208a \u2264\n \u2211' _ : { s : Finset (Fin (k + l)) // s.card = l }, \u2016p (k + l)\u2016\u208a * \u2016x\u2016\u208a ^ l\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.ChangeOrigin.changeOrigin (L118-L128)\ndef changeOrigin (x : E) : FormalMultilinearSeries \ud835\udd5c E F\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOn (L123-L131)\ndef AnalyticOn (f : E \u2192 F) (s : Set E) : Prop\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Analytic/ChangeOrigin.lean", "module": "Mathlib.Analysis.Analytic.ChangeOrigin", "declaration": "Mathlib.Analysis.Analytic.ChangeOrigin.changeOriginSeries", "span": "L100-L102", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Analytic/ChangeOrigin.lean#L100"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1373, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3546, "lean_code_chars": 2741, "natural_language_chars": 805, "lean_code_ratio": 0.773, "line_count": 104, "imports_count": 0, "declarations_count": 364, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "2494300289327127", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.NumberTheory.Modular.lcRow0_apply", "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.NumberTheory.Modular)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem lcRow0_apply (p : Fin 2 \u2192 \u2124) (g : Matrix (Fin 2) (Fin 2) \u211d) :\n lcRow0 p g = p 0 * g 0 0 + p 1 * g 0 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.Modular.bottom_row_coprime (L86-L91)\ntheorem bottom_row_coprime {R : Type*} [CommRing R] (g : SL(2, R)) :\n IsCoprime ((\u2191g : Matrix (Fin 2) (Fin 2) R) 1 0) ((\u2191g : Matrix (Fin 2) (Fin 2) R) 1 1)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.Modular.bottom_row_surj (L92-L109)\ntheorem bottom_row_surj {R : Type*} [CommRing R] :\n Set.SurjOn (fun g : SL(2, R) => (\u2191g : Matrix (Fin 2) (Fin 2) R) 1) Set.univ\n {cd | IsCoprime (cd 0) (cd 1)}\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.Modular.tendsto_normSq_coprime_pair (L115-L163)\ntheorem tendsto_normSq_coprime_pair :\n Filter.Tendsto (fun p : Fin 2 \u2192 \u2124 => normSq ((p 0 : \u2102) * z + p 1)) cofinite atTop\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.Modular.lcRow0 (L164-L168)\ndef lcRow0 (p : Fin 2 \u2192 \u2124) : Matrix (Fin 2) (Fin 2) \u211d \u2192\u2097[\u211d] \u211d\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.Modular.lcRow0Extend (L177-L189)\ndef lcRow0Extend {cd : Fin 2 \u2192 \u2124} (hcd : IsCoprime (cd 0) (cd 1)) :\n Matrix (Fin 2) (Fin 2) \u211d \u2243\u2097[\u211d] Matrix (Fin 2) (Fin 2) \u211d\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.Modular.tendsto_lcRow0 (L190-L233)\ntheorem tendsto_lcRow0 {cd : Fin 2 \u2192 \u2124} (hcd : IsCoprime (cd 0) (cd 1)) :\n Tendsto (fun g : { g : SL(2, \u2124) // g 1 = cd } => lcRow0 cd \u2191(\u2191g : SL(2, \u211d))) cofinite\n (cocompact \u211d)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.Modular.smul_eq_lcRow0_add (L234-L249)\ntheorem smul_eq_lcRow0_add {p : Fin 2 \u2192 \u2124} (hp : IsCoprime (p 0) (p 1)) (hg : g 1 = p) :\n \u2191(g \u2022 z) =\n (lcRow0 p \u2191(g : SL(2, \u211d)) : \u2102) / ((p 0 : \u2102) ^ 2 + (p 1 : \u2102) ^ 2) +\n ((p 1 : \u2102) * z - p 0) / (((p 0 : \u2102) ^ 2 + (p 1 : \u2102) ^ 2) * (p 0 * z + p 1))\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.Modular.tendsto_abs_re_smul (L250-L274)\ntheorem tendsto_abs_re_smul {p : Fin 2 \u2192 \u2124} (hp : IsCoprime (p 0) (p 1)) :\n Tendsto\n (fun g : { g : SL(2, \u2124) // g 1 = p } => |((g : SL(2, \u2124)) \u2022 z).re|) cofinite atTop\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.NumberTheory.Modular).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem lcRow0_apply (p : Fin 2 \u2192 \u2124) (g : Matrix (Fin 2) (Fin 2) \u211d) :\n lcRow0 p g = p 0 * g 0 0 + p 1 * g 0 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.Modular.bottom_row_coprime (L86-L91)\ntheorem bottom_row_coprime {R : Type*} [CommRing R] (g : SL(2, R)) :\n IsCoprime ((\u2191g : Matrix (Fin 2) (Fin 2) R) 1 0) ((\u2191g : Matrix (Fin 2) (Fin 2) R) 1 1)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.Modular.bottom_row_surj (L92-L109)\ntheorem bottom_row_surj {R : Type*} [CommRing R] :\n Set.SurjOn (fun g : SL(2, R) => (\u2191g : Matrix (Fin 2) (Fin 2) R) 1) Set.univ\n {cd | IsCoprime (cd 0) (cd 1)}\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.Modular.tendsto_normSq_coprime_pair (L115-L163)\ntheorem tendsto_normSq_coprime_pair :\n Filter.Tendsto (fun p : Fin 2 \u2192 \u2124 => normSq ((p 0 : \u2102) * z + p 1)) cofinite atTop\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.Modular.lcRow0 (L164-L168)\ndef lcRow0 (p : Fin 2 \u2192 \u2124) : Matrix (Fin 2) (Fin 2) \u211d \u2192\u2097[\u211d] \u211d\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.Modular.lcRow0Extend (L177-L189)\ndef lcRow0Extend {cd : Fin 2 \u2192 \u2124} (hcd : IsCoprime (cd 0) (cd 1)) :\n Matrix (Fin 2) (Fin 2) \u211d \u2243\u2097[\u211d] Matrix (Fin 2) (Fin 2) \u211d\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.Modular.tendsto_lcRow0 (L190-L233)\ntheorem tendsto_lcRow0 {cd : Fin 2 \u2192 \u2124} (hcd : IsCoprime (cd 0) (cd 1)) :\n Tendsto (fun g : { g : SL(2, \u2124) // g 1 = cd } => lcRow0 cd \u2191(\u2191g : SL(2, \u211d))) cofinite\n (cocompact \u211d)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.Modular.smul_eq_lcRow0_add (L234-L249)\ntheorem smul_eq_lcRow0_add {p : Fin 2 \u2192 \u2124} (hp : IsCoprime (p 0) (p 1)) (hg : g 1 = p) :\n \u2191(g \u2022 z) =\n (lcRow0 p \u2191(g : SL(2, \u211d)) : \u2102) / ((p 0 : \u2102) ^ 2 + (p 1 : \u2102) ^ 2) +\n ((p 1 : \u2102) * z - p 0) / (((p 0 : \u2102) ^ 2 + (p 1 : \u2102) ^ 2) * (p 0 * z + p 1))\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.Modular.tendsto_abs_re_smul (L250-L274)\ntheorem tendsto_abs_re_smul {p : Fin 2 \u2192 \u2124} (hp : IsCoprime (p 0) (p 1)) :\n Tendsto\n (fun g : { g : SL(2, \u2124) // g 1 = p } => |((g : SL(2, \u2124)) \u2022 z).re|) cofinite atTop\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/Modular.lean", "module": "Mathlib.NumberTheory.Modular", "declaration": "Mathlib.NumberTheory.Modular.lcRow0_apply", "span": "L170-L175", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Modular.lean#L170"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1090, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2494, "lean_code_chars": 1860, "natural_language_chars": 634, "lean_code_ratio": 0.7458, "line_count": 68, "imports_count": 0, "declarations_count": 245, "diagnostics_count": 0, "retrieval_snippets_count": 8, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "d843df9bdc044fcc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.derivWeierstrassP_zero", "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.Analysis.SpecialFunctions.Elliptic.Weierstrass)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma derivWeierstrassP_zero : \u2118'[L] 0 = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.lattice (L79-L80)\ndef lattice : Submodule \u2124 \u2102\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.mem_lattice (L81-L84)\nlemma mem_lattice {L : PeriodPair} {x : \u2102} :\n x \u2208 L.lattice \u2194 \u2203 m n : \u2124, m * L.\u03c9\u2081 + n * L.\u03c9\u2082 = x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2081_mem_lattice (L85-L85)\nlemma \u03c9\u2081_mem_lattice : L.\u03c9\u2081 \u2208 L.lattice\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2082_mem_lattice (L86-L88)\nlemma \u03c9\u2082_mem_lattice : L.\u03c9\u2082 \u2208 L.lattice\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.mul_\u03c9\u2081_add_mul_\u03c9\u2082_mem_lattice (L89-L103)\nlemma mul_\u03c9\u2081_add_mul_\u03c9\u2082_mem_lattice {L : PeriodPair} {\u03b1 \u03b2 : \u211a} :\n \u03b1 * L.\u03c9\u2081 + \u03b2 * L.\u03c9\u2082 \u2208 L.lattice \u2194 \u03b1.den = 1 \u2227 \u03b2.den = 1\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2081_div_two_notMem_lattice (L104-L107)\nlemma \u03c9\u2081_div_two_notMem_lattice : L.\u03c9\u2081 / 2 \u2209 L.lattice\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2082_div_two_notMem_lattice (L108-L112)\nlemma \u03c9\u2082_div_two_notMem_lattice : L.\u03c9\u2082 / 2 \u2209 L.lattice\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.lattice_eq_span_range_basis (L113-L118)\nlemma lattice_eq_span_range_basis :\n L.lattice = Submodule.span \u2124 (Set.range L.basis)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d)\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.Analysis.SpecialFunctions.Elliptic.Weierstrass).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma derivWeierstrassP_zero : \u2118'[L] 0 = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.lattice (L79-L80)\ndef lattice : Submodule \u2124 \u2102\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.mem_lattice (L81-L84)\nlemma mem_lattice {L : PeriodPair} {x : \u2102} :\n x \u2208 L.lattice \u2194 \u2203 m n : \u2124, m * L.\u03c9\u2081 + n * L.\u03c9\u2082 = x\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2081_mem_lattice (L85-L85)\nlemma \u03c9\u2081_mem_lattice : L.\u03c9\u2081 \u2208 L.lattice\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2082_mem_lattice (L86-L88)\nlemma \u03c9\u2082_mem_lattice : L.\u03c9\u2082 \u2208 L.lattice\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.mul_\u03c9\u2081_add_mul_\u03c9\u2082_mem_lattice (L89-L103)\nlemma mul_\u03c9\u2081_add_mul_\u03c9\u2082_mem_lattice {L : PeriodPair} {\u03b1 \u03b2 : \u211a} :\n \u03b1 * L.\u03c9\u2081 + \u03b2 * L.\u03c9\u2082 \u2208 L.lattice \u2194 \u03b1.den = 1 \u2227 \u03b2.den = 1\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2081_div_two_notMem_lattice (L104-L107)\nlemma \u03c9\u2081_div_two_notMem_lattice : L.\u03c9\u2081 / 2 \u2209 L.lattice\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.\u03c9\u2082_div_two_notMem_lattice (L108-L112)\nlemma \u03c9\u2082_div_two_notMem_lattice : L.\u03c9\u2082 / 2 \u2209 L.lattice\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.lattice_eq_span_range_basis (L113-L118)\nlemma lattice_eq_span_range_basis :\n L.lattice = Submodule.span \u2124 (Set.range L.basis)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Elliptic/Weierstrass.lean", "module": "Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass", "declaration": "Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.derivWeierstrassP_zero", "span": "L577-L579", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Elliptic/Weierstrass.lean#L577"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1132, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2887, "lean_code_chars": 2066, "natural_language_chars": 821, "lean_code_ratio": 0.7156, "line_count": 95, "imports_count": 0, "declarations_count": 218, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "7c62b4c90175f9d3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Complex.Schwarz.norm_le_norm_of_mapsTo_ball", "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.Analysis.Complex.Schwarz)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem norm_le_norm_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball 0 R))\n (h_maps : MapsTo f (ball 0 R) (closedBall 0 R)) (h\u2080 : f 0 = 0) (hz : \u2016z\u2016 < R) :\n \u2016f z\u2016 \u2264 \u2016z\u2016\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.schwarz_aux (L64-L143)\ntheorem schwarz_aux {f : \u2102 \u2192 \u2102} {c z : \u2102} {R\u2081 R\u2082 : \u211d} {n : \u2115}\n (hd : DifferentiableOn \u2102 f (ball c R\u2081)) (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082))\n (hn : (f \u00b7 - f c) =o[\ud835\udcdd c] (fun w \u21a6 (w - c) ^ n)) (hz : z \u2208 ball c R\u2081) :\n \u2016f z - f c\u2016 \u2264 R\u2082 * (\u2016z - c\u2016 / R\u2081) ^ (n + 1)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO (L144-L187)\ntheorem dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO {f : E \u2192 F} {c z : E} {R\u2081 R\u2082 : \u211d} {n : \u2115}\n (hd : DifferentiableOn \u2102 f (ball c R\u2081)) (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082))\n (hn : (f \u00b7 - f c) =o[\ud835\udcdd c] (fun w \u21a6 \u2016w - c\u2016 ^ n)) (hz : z \u2208 ball c R\u2081) :\n dist (f z) (f c) \u2264 R\u2082 * (dist z c / R\u2081) ^ (n + 1)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.dist_le_div_mul_dist_of_mapsTo_ball (L188-L200)\ntheorem dist_le_div_mul_dist_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R\u2081))\n (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082)) (hz : z \u2208 ball c R\u2081) :\n dist (f z) (f c) \u2264 R\u2082 / R\u2081 * dist z c\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_div_of_mapsTo_ball (L201-L213)\ntheorem norm_fderiv_le_div_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R\u2081))\n (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082)) (h\u2080 : 0 < R\u2081) :\n \u2016fderiv \u2102 f c\u2016 \u2264 R\u2082 / R\u2081\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.dist_le_dist_of_mapsTo_ball (L214-L218)\ntheorem dist_le_dist_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R))\n (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hz : z \u2208 ball c R) :\n dist (f z) (f c) \u2264 dist z c\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_one_of_mapsTo_ball (L227-L235)\ntheorem norm_fderiv_le_one_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R))\n (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hR : 0 < R) :\n \u2016fderiv \u2102 f c\u2016 \u2264 1\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_div_of_mapsTo_ball (L255-L265)\ntheorem norm_deriv_le_div_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R\u2081))\n (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082)) (h\u2080 : 0 < R\u2081) :\n \u2016deriv f c\u2016 \u2264 R\u2082 / R\u2081\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_one_of_mapsTo_ball (L266-L276)\ntheorem norm_deriv_le_one_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R))\n (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (h\u2080 : 0 < R) : \u2016deriv f c\u2016 \u2264 1\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzSet (L48-L50)\ndef stolzSet (M : \u211d) : Set \u2102\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzCone_subset_stolzSet_aux (L99-L112)\nlemma stolzCone_subset_stolzSet_aux {s : \u211d} (hs : 0 < s) :\n \u2203 M \u03b5, 0 < M \u2227 0 < \u03b5 \u2227 {z : \u2102 | 1 - \u03b5 < z.re} \u2229 stolzCone s \u2286 stolzSet M\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzCone (L51-L52)\ndef stolzCone (s : \u211d) : Set \u2102\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzSet_empty (L53-L61)\ntheorem stolzSet_empty {M : \u211d} (hM : M \u2264 1) : stolzSet M = \u2205\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_stolzCone_le_nhdsWithin_stolzSet (L113-L127)\nlemma nhdsWithin_stolzCone_le_nhdsWithin_stolzSet {s : \u211d} (hs : 0 < s) :\n \u2203 M, \ud835\udcdd[stolzCone s] 1 \u2264 \ud835\udcdd[stolzSet M] 1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_lt_le_nhdsWithin_stolzSet (L62-L98)\ntheorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : \u211d} (hM : 1 < M) :\n (\ud835\udcdd[<] 1).map ofReal \u2264 \ud835\udcdd[stolzSet M] 1\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.Analysis.Complex.Schwarz).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem norm_le_norm_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball 0 R))\n (h_maps : MapsTo f (ball 0 R) (closedBall 0 R)) (h\u2080 : f 0 = 0) (hz : \u2016z\u2016 < R) :\n \u2016f z\u2016 \u2264 \u2016z\u2016\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.schwarz_aux (L64-L143)\ntheorem schwarz_aux {f : \u2102 \u2192 \u2102} {c z : \u2102} {R\u2081 R\u2082 : \u211d} {n : \u2115}\n (hd : DifferentiableOn \u2102 f (ball c R\u2081)) (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082))\n (hn : (f \u00b7 - f c) =o[\ud835\udcdd c] (fun w \u21a6 (w - c) ^ n)) (hz : z \u2208 ball c R\u2081) :\n \u2016f z - f c\u2016 \u2264 R\u2082 * (\u2016z - c\u2016 / R\u2081) ^ (n + 1)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO (L144-L187)\ntheorem dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO {f : E \u2192 F} {c z : E} {R\u2081 R\u2082 : \u211d} {n : \u2115}\n (hd : DifferentiableOn \u2102 f (ball c R\u2081)) (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082))\n (hn : (f \u00b7 - f c) =o[\ud835\udcdd c] (fun w \u21a6 \u2016w - c\u2016 ^ n)) (hz : z \u2208 ball c R\u2081) :\n dist (f z) (f c) \u2264 R\u2082 * (dist z c / R\u2081) ^ (n + 1)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.dist_le_div_mul_dist_of_mapsTo_ball (L188-L200)\ntheorem dist_le_div_mul_dist_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R\u2081))\n (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082)) (hz : z \u2208 ball c R\u2081) :\n dist (f z) (f c) \u2264 R\u2082 / R\u2081 * dist z c\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_div_of_mapsTo_ball (L201-L213)\ntheorem norm_fderiv_le_div_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R\u2081))\n (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082)) (h\u2080 : 0 < R\u2081) :\n \u2016fderiv \u2102 f c\u2016 \u2264 R\u2082 / R\u2081\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.dist_le_dist_of_mapsTo_ball (L214-L218)\ntheorem dist_le_dist_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R))\n (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hz : z \u2208 ball c R) :\n dist (f z) (f c) \u2264 dist z c\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_one_of_mapsTo_ball (L227-L235)\ntheorem norm_fderiv_le_one_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R))\n (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hR : 0 < R) :\n \u2016fderiv \u2102 f c\u2016 \u2264 1\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_div_of_mapsTo_ball (L255-L265)\ntheorem norm_deriv_le_div_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R\u2081))\n (h_maps : MapsTo f (ball c R\u2081) (closedBall (f c) R\u2082)) (h\u2080 : 0 < R\u2081) :\n \u2016deriv f c\u2016 \u2264 R\u2082 / R\u2081\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_one_of_mapsTo_ball (L266-L276)\ntheorem norm_deriv_le_one_of_mapsTo_ball (hd : DifferentiableOn \u2102 f (ball c R))\n (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (h\u2080 : 0 < R) : \u2016deriv f c\u2016 \u2264 1\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzSet (L48-L50)\ndef stolzSet (M : \u211d) : Set \u2102\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzCone_subset_stolzSet_aux (L99-L112)\nlemma stolzCone_subset_stolzSet_aux {s : \u211d} (hs : 0 < s) :\n \u2203 M \u03b5, 0 < M \u2227 0 < \u03b5 \u2227 {z : \u2102 | 1 - \u03b5 < z.re} \u2229 stolzCone s \u2286 stolzSet M\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzCone (L51-L52)\ndef stolzCone (s : \u211d) : Set \u2102\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.stolzSet_empty (L53-L61)\ntheorem stolzSet_empty {M : \u211d} (hM : M \u2264 1) : stolzSet M = \u2205\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_stolzCone_le_nhdsWithin_stolzSet (L113-L127)\nlemma nhdsWithin_stolzCone_le_nhdsWithin_stolzSet {s : \u211d} (hs : 0 < s) :\n \u2203 M, \ud835\udcdd[stolzCone s] 1 \u2264 \ud835\udcdd[stolzSet M] 1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_lt_le_nhdsWithin_stolzSet (L62-L98)\ntheorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : \u211d} (hM : 1 < M) :\n (\ud835\udcdd[<] 1).map ofReal \u2264 \ud835\udcdd[stolzSet M] 1\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Complex/Schwarz.lean", "module": "Mathlib.Analysis.Complex.Schwarz", "declaration": "Mathlib.Analysis.Complex.Schwarz.norm_le_norm_of_mapsTo_ball", "span": "L236-L240", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Complex/Schwarz.lean#L236"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1849, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4244, "lean_code_chars": 3445, "natural_language_chars": 799, "lean_code_ratio": 0.8117, "line_count": 113, "imports_count": 0, "declarations_count": 449, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "fbf961a439043c62", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Group.Shrink.equivShrink_mul", "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.Algebra.Group.Shrink)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma equivShrink_mul [Mul \u03b1] (x y : \u03b1) :\n equivShrink \u03b1 (x * y) = equivShrink \u03b1 x * equivShrink \u03b1 y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_one (L31-L33)\nlemma equivShrink_symm_one [One \u03b1] : (equivShrink \u03b1).symm 1 = 1\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_mul (L35-L38)\nlemma equivShrink_symm_mul [Mul \u03b1] (x y : Shrink \u03b1) :\n (equivShrink \u03b1).symm (x * y) = (equivShrink \u03b1).symm x * (equivShrink \u03b1).symm y\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_smul (L45-L48)\nlemma equivShrink_symm_smul {M : Type*} [SMul M \u03b1] (m : M) (x : Shrink \u03b1) :\n (equivShrink \u03b1).symm (m \u2022 x) = m \u2022 (equivShrink \u03b1).symm x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_smul (L50-L52)\nlemma equivShrink_smul {M : Type*} [SMul M \u03b1] (m : M) (x : \u03b1) :\n equivShrink \u03b1 (m \u2022 x) = m \u2022 equivShrink \u03b1 x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_div (L54-L57)\nlemma equivShrink_symm_div [Div \u03b1] (x y : Shrink \u03b1) :\n (equivShrink \u03b1).symm (x / y) = (equivShrink \u03b1).symm x / (equivShrink \u03b1).symm y\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_div (L59-L62)\nlemma equivShrink_div [Div \u03b1] (x y : \u03b1) :\n equivShrink \u03b1 (x / y) = equivShrink \u03b1 x / equivShrink \u03b1 y\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_inv (L64-L67)\nlemma equivShrink_symm_inv [Inv \u03b1] (x : Shrink \u03b1) :\n (equivShrink \u03b1).symm x\u207b\u00b9 = ((equivShrink \u03b1).symm x)\u207b\u00b9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_inv (L69-L74)\nlemma equivShrink_inv [Inv \u03b1] (x : \u03b1) : equivShrink \u03b1 x\u207b\u00b9 = (equivShrink \u03b1 x)\u207b\u00b9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)\nlemma invOf_smul_eq_iff : \u215fc \u2022 x = y \u2194 x = c \u2022 y\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)\nlemma isCancelSMul_iff_eq_one_of_smul_eq :\n IsCancelSMul \u03b1 \u03b2 \u2194 (\u2200 (g : \u03b1) (x : \u03b2), g \u2022 x = x \u2192 g = 1)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)\nlemma smul_left_cancel (g : \u03b1) {x y : \u03b2} (h : g \u2022 x = g \u2022 y) : x = y\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)\nlemma smul_eq_iff_eq_inv_smul (g : \u03b1) {x y : \u03b2} : g \u2022 x = y \u2194 x = g\u207b\u00b9 \u2022 y\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)\nlemma smul_left_cancel_iff (g : \u03b1) {x y : \u03b2} : g \u2022 x = g \u2022 y \u2194 x = y\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)\ndef MulAction.toPerm (a : \u03b1) : Equiv.Perm \u03b2\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.Algebra.Group.Shrink).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma equivShrink_mul [Mul \u03b1] (x y : \u03b1) :\n equivShrink \u03b1 (x * y) = equivShrink \u03b1 x * equivShrink \u03b1 y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_one (L31-L33)\nlemma equivShrink_symm_one [One \u03b1] : (equivShrink \u03b1).symm 1 = 1\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_mul (L35-L38)\nlemma equivShrink_symm_mul [Mul \u03b1] (x y : Shrink \u03b1) :\n (equivShrink \u03b1).symm (x * y) = (equivShrink \u03b1).symm x * (equivShrink \u03b1).symm y\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_smul (L45-L48)\nlemma equivShrink_symm_smul {M : Type*} [SMul M \u03b1] (m : M) (x : Shrink \u03b1) :\n (equivShrink \u03b1).symm (m \u2022 x) = m \u2022 (equivShrink \u03b1).symm x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_smul (L50-L52)\nlemma equivShrink_smul {M : Type*} [SMul M \u03b1] (m : M) (x : \u03b1) :\n equivShrink \u03b1 (m \u2022 x) = m \u2022 equivShrink \u03b1 x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_div (L54-L57)\nlemma equivShrink_symm_div [Div \u03b1] (x y : Shrink \u03b1) :\n (equivShrink \u03b1).symm (x / y) = (equivShrink \u03b1).symm x / (equivShrink \u03b1).symm y\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_div (L59-L62)\nlemma equivShrink_div [Div \u03b1] (x y : \u03b1) :\n equivShrink \u03b1 (x / y) = equivShrink \u03b1 x / equivShrink \u03b1 y\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_inv (L64-L67)\nlemma equivShrink_symm_inv [Inv \u03b1] (x : Shrink \u03b1) :\n (equivShrink \u03b1).symm x\u207b\u00b9 = ((equivShrink \u03b1).symm x)\u207b\u00b9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Group.Shrink.equivShrink_inv (L69-L74)\nlemma equivShrink_inv [Inv \u03b1] (x : \u03b1) : equivShrink \u03b1 x\u207b\u00b9 = (equivShrink \u03b1 x)\u207b\u00b9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)\nlemma invOf_smul_eq_iff : \u215fc \u2022 x = y \u2194 x = c \u2022 y\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)\nlemma isCancelSMul_iff_eq_one_of_smul_eq :\n IsCancelSMul \u03b1 \u03b2 \u2194 (\u2200 (g : \u03b1) (x : \u03b2), g \u2022 x = x \u2192 g = 1)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)\nlemma smul_left_cancel (g : \u03b1) {x y : \u03b2} (h : g \u2022 x = g \u2022 y) : x = y\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)\nlemma smul_eq_iff_eq_inv_smul (g : \u03b1) {x y : \u03b2} : g \u2022 x = y \u2194 x = g\u207b\u00b9 \u2022 y\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)\nlemma smul_left_cancel_iff (g : \u03b1) {x y : \u03b2} : g \u2022 x = g \u2022 y \u2194 x = y\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)\ndef MulAction.toPerm (a : \u03b1) : Equiv.Perm \u03b2\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Group/Shrink.lean", "module": "Mathlib.Algebra.Group.Shrink", "declaration": "Mathlib.Algebra.Group.Shrink.equivShrink_mul", "span": "L40-L43", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Shrink.lean#L40"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1165, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3095, "lean_code_chars": 2300, "natural_language_chars": 795, "lean_code_ratio": 0.7431, "line_count": 99, "imports_count": 0, "declarations_count": 285, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "dcd9b10b9ff7743b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Algebra.Module.Alternating.Basic.alternatization_apply_apply", "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.Topology.Algebra.Module.Alternating.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem alternatization_apply_apply (v : \u03b9 \u2192 M) :\n alternatization f v = \u2211 \u03c3 : Equiv.Perm \u03b9, Equiv.Perm.sign \u03c3 \u2022 f (v \u2218 \u03c3)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.toContinuousMultilinearMap_injective (L62-L66)\ntheorem toContinuousMultilinearMap_injective :\n Injective (ContinuousAlternatingMap.toContinuousMultilinearMap :\n M [\u22c0^\u03b9]\u2192L[R] N \u2192 ContinuousMultilinearMap R (fun _ : \u03b9 => M) N)\n | \u27e8_, _\u27e9, \u27e8_, _\u27e9, rfl => rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.range_toContinuousMultilinearMap (L67-L73)\ntheorem range_toContinuousMultilinearMap :\n Set.range\n (toContinuousMultilinearMap :\n M [\u22c0^\u03b9]\u2192L[R] N \u2192 ContinuousMultilinearMap R (fun _ : \u03b9 => M) N) =\n {f | \u2200 (v : \u03b9 \u2192 M) (i j : \u03b9), v i = v j \u2192 i \u2260 j \u2192 f v = 0}\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.funLike (L74-L77)\ninstance funLike : FunLike (M [\u22c0^\u03b9]\u2192L[R] N) (\u03b9 \u2192 M) N where\n coe f\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.continuousMapClass (L78-L82)\ninstance continuousMapClass : ContinuousMapClass (M [\u22c0^\u03b9]\u2192L[R] N) (\u03b9 \u2192 M) N where\n map_continuous f\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_continuous (L84-L85)\ntheorem coe_continuous : Continuous f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toContinuousMultilinearMap (L87-L89)\ntheorem coe_toContinuousMultilinearMap : \u21d1f.toContinuousMultilinearMap = f\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_mk (L91-L95)\ntheorem coe_mk (f : ContinuousMultilinearMap R (fun _ : \u03b9 => M) N) (h) : \u21d1(mk f h) = f\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toAlternatingMap (L96-L97)\ntheorem coe_toAlternatingMap : \u21d1f.toAlternatingMap = f\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t\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.Topology.Algebra.Module.Alternating.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 alternatization_apply_apply (v : \u03b9 \u2192 M) :\n alternatization f v = \u2211 \u03c3 : Equiv.Perm \u03b9, Equiv.Perm.sign \u03c3 \u2022 f (v \u2218 \u03c3)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.toContinuousMultilinearMap_injective (L62-L66)\ntheorem toContinuousMultilinearMap_injective :\n Injective (ContinuousAlternatingMap.toContinuousMultilinearMap :\n M [\u22c0^\u03b9]\u2192L[R] N \u2192 ContinuousMultilinearMap R (fun _ : \u03b9 => M) N)\n | \u27e8_, _\u27e9, \u27e8_, _\u27e9, rfl => rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.range_toContinuousMultilinearMap (L67-L73)\ntheorem range_toContinuousMultilinearMap :\n Set.range\n (toContinuousMultilinearMap :\n M [\u22c0^\u03b9]\u2192L[R] N \u2192 ContinuousMultilinearMap R (fun _ : \u03b9 => M) N) =\n {f | \u2200 (v : \u03b9 \u2192 M) (i j : \u03b9), v i = v j \u2192 i \u2260 j \u2192 f v = 0}\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.funLike (L74-L77)\ninstance funLike : FunLike (M [\u22c0^\u03b9]\u2192L[R] N) (\u03b9 \u2192 M) N where\n coe f\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.continuousMapClass (L78-L82)\ninstance continuousMapClass : ContinuousMapClass (M [\u22c0^\u03b9]\u2192L[R] N) (\u03b9 \u2192 M) N where\n map_continuous f\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_continuous (L84-L85)\ntheorem coe_continuous : Continuous f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toContinuousMultilinearMap (L87-L89)\ntheorem coe_toContinuousMultilinearMap : \u21d1f.toContinuousMultilinearMap = f\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_mk (L91-L95)\ntheorem coe_mk (f : ContinuousMultilinearMap R (fun _ : \u03b9 => M) N) (h) : \u21d1(mk f h) = f\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toAlternatingMap (L96-L97)\ntheorem coe_toAlternatingMap : \u21d1f.toAlternatingMap = f\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/Module/Alternating/Basic.lean", "module": "Mathlib.Topology.Algebra.Module.Alternating.Basic", "declaration": "Mathlib.Topology.Algebra.Module.Alternating.Basic.alternatization_apply_apply", "span": "L646-L649", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Module/Alternating/Basic.lean#L646"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1205, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3408, "lean_code_chars": 2592, "natural_language_chars": 816, "lean_code_ratio": 0.7606, "line_count": 103, "imports_count": 0, "declarations_count": 291, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "1d426129636f6e00", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.Filter.Prod.mem_prod_principal", "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.Order.Filter.Prod)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem mem_prod_principal {s : Set (\u03b1 \u00d7 \u03b2)} :\n s \u2208 f \u00d7\u02e2 \ud835\udcdf t \u2194 { a | \u2200 b \u2208 t, (a, b) \u2208 s } \u2208 f\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Filter.Prod.prod_mem_prod (L49-L51)\ntheorem prod_mem_prod (hs : s \u2208 f) (ht : t \u2208 g) : s \u00d7\u02e2 t \u2208 f \u00d7\u02e2 g\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Filter.Prod.mem_prod_iff (L52-L59)\ntheorem mem_prod_iff {s : Set (\u03b1 \u00d7 \u03b2)} {f : Filter \u03b1} {g : Filter \u03b2} :\n s \u2208 f \u00d7\u02e2 g \u2194 \u2203 t\u2081 \u2208 f, \u2203 t\u2082 \u2208 g, t\u2081 \u00d7\u02e2 t\u2082 \u2286 s\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Filter.Prod.compl_diagonal_mem_prod (L61-L63)\ntheorem compl_diagonal_mem_prod {l\u2081 l\u2082 : Filter \u03b1} : (diagonal \u03b1)\u1d9c \u2208 l\u2081 \u00d7\u02e2 l\u2082 \u2194 Disjoint l\u2081 l\u2082\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Filter.Prod.prod_mem_prod_iff (L65-L73)\ntheorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s \u00d7\u02e2 t \u2208 f \u00d7\u02e2 g \u2194 s \u2208 f \u2227 t \u2208 g\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Filter.Prod.mem_prod_top (L83-L87)\ntheorem mem_prod_top {s : Set (\u03b1 \u00d7 \u03b2)} :\n s \u2208 f \u00d7\u02e2 (\u22a4 : Filter \u03b2) \u2194 { a | \u2200 b, (a, b) \u2208 s } \u2208 f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Filter.Prod.eventually_prod_principal_iff (L88-L92)\ntheorem eventually_prod_principal_iff {p : \u03b1 \u00d7 \u03b2 \u2192 Prop} {s : Set \u03b2} :\n (\u2200\u1da0 x : \u03b1 \u00d7 \u03b2 in f \u00d7\u02e2 \ud835\udcdf s, p x) \u2194 \u2200\u1da0 x : \u03b1 in f, \u2200 y : \u03b2, y \u2208 s \u2192 p (x, y)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Filter.Prod.comap_prod (L93-L96)\ntheorem comap_prod (f : \u03b1 \u2192 \u03b2 \u00d7 \u03b3) (b : Filter \u03b2) (c : Filter \u03b3) :\n comap f (b \u00d7\u02e2 c) = comap (Prod.fst \u2218 f) b \u2293 comap (Prod.snd \u2218 f) c\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Filter.Prod.comap_prodMap_prod (L97-L100)\ntheorem comap_prodMap_prod (f : \u03b1 \u2192 \u03b2) (g : \u03b3 \u2192 \u03b4) (lb : Filter \u03b2) (ld : Filter \u03b4) :\n comap (Prod.map f g) (lb \u00d7\u02e2 ld) = comap f lb \u00d7\u02e2 comap g ld\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.PNat (L40-L43)\ntheorem PNat.tendsto_comp_val_iff {\u03b2 : Type*} {f : \u2115 \u2192 \u03b2} {l : Filter \u03b2} :\n Tendsto (fun x : \u2115+ => f x) atTop l \u2194 Tendsto f atTop l\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_iff (L35-L39)\ntheorem tendsto_natCast_atTop_iff [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u2115}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_atTop (L44-L48)\ntheorem tendsto_natCast_atTop_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n Tendsto ((\u2191) : \u2115 \u2192 R) atTop atTop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Nat (L31-L34)\ntheorem Nat.comap_cast_atTop [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u2115 \u2192 R) atTop = atTop\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_PNat_val_atTop_atTop (L49-L51)\nlemma tendsto_PNat_val_atTop_atTop : Tendsto PNat.val atTop atTop\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Filter (L52-L56)\ntheorem Filter.Eventually.natCast_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] {p : R \u2192 Prop}\n (h : \u2200\u1da0 (x : R) in atTop, p x) : \u2200\u1da0 (n : \u2115) in atTop, p 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.Order.Filter.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem mem_prod_principal {s : Set (\u03b1 \u00d7 \u03b2)} :\n s \u2208 f \u00d7\u02e2 \ud835\udcdf t \u2194 { a | \u2200 b \u2208 t, (a, b) \u2208 s } \u2208 f\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Filter.Prod.prod_mem_prod (L49-L51)\ntheorem prod_mem_prod (hs : s \u2208 f) (ht : t \u2208 g) : s \u00d7\u02e2 t \u2208 f \u00d7\u02e2 g\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Filter.Prod.mem_prod_iff (L52-L59)\ntheorem mem_prod_iff {s : Set (\u03b1 \u00d7 \u03b2)} {f : Filter \u03b1} {g : Filter \u03b2} :\n s \u2208 f \u00d7\u02e2 g \u2194 \u2203 t\u2081 \u2208 f, \u2203 t\u2082 \u2208 g, t\u2081 \u00d7\u02e2 t\u2082 \u2286 s\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Filter.Prod.compl_diagonal_mem_prod (L61-L63)\ntheorem compl_diagonal_mem_prod {l\u2081 l\u2082 : Filter \u03b1} : (diagonal \u03b1)\u1d9c \u2208 l\u2081 \u00d7\u02e2 l\u2082 \u2194 Disjoint l\u2081 l\u2082\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Filter.Prod.prod_mem_prod_iff (L65-L73)\ntheorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s \u00d7\u02e2 t \u2208 f \u00d7\u02e2 g \u2194 s \u2208 f \u2227 t \u2208 g\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Filter.Prod.mem_prod_top (L83-L87)\ntheorem mem_prod_top {s : Set (\u03b1 \u00d7 \u03b2)} :\n s \u2208 f \u00d7\u02e2 (\u22a4 : Filter \u03b2) \u2194 { a | \u2200 b, (a, b) \u2208 s } \u2208 f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Filter.Prod.eventually_prod_principal_iff (L88-L92)\ntheorem eventually_prod_principal_iff {p : \u03b1 \u00d7 \u03b2 \u2192 Prop} {s : Set \u03b2} :\n (\u2200\u1da0 x : \u03b1 \u00d7 \u03b2 in f \u00d7\u02e2 \ud835\udcdf s, p x) \u2194 \u2200\u1da0 x : \u03b1 in f, \u2200 y : \u03b2, y \u2208 s \u2192 p (x, y)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Filter.Prod.comap_prod (L93-L96)\ntheorem comap_prod (f : \u03b1 \u2192 \u03b2 \u00d7 \u03b3) (b : Filter \u03b2) (c : Filter \u03b3) :\n comap f (b \u00d7\u02e2 c) = comap (Prod.fst \u2218 f) b \u2293 comap (Prod.snd \u2218 f) c\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Filter.Prod.comap_prodMap_prod (L97-L100)\ntheorem comap_prodMap_prod (f : \u03b1 \u2192 \u03b2) (g : \u03b3 \u2192 \u03b4) (lb : Filter \u03b2) (ld : Filter \u03b4) :\n comap (Prod.map f g) (lb \u00d7\u02e2 ld) = comap f lb \u00d7\u02e2 comap g ld\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.PNat (L40-L43)\ntheorem PNat.tendsto_comp_val_iff {\u03b2 : Type*} {f : \u2115 \u2192 \u03b2} {l : Filter \u03b2} :\n Tendsto (fun x : \u2115+ => f x) atTop l \u2194 Tendsto f atTop l\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_iff (L35-L39)\ntheorem tendsto_natCast_atTop_iff [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u2115}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_atTop (L44-L48)\ntheorem tendsto_natCast_atTop_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n Tendsto ((\u2191) : \u2115 \u2192 R) atTop atTop\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Nat (L31-L34)\ntheorem Nat.comap_cast_atTop [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u2115 \u2192 R) atTop = atTop\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_PNat_val_atTop_atTop (L49-L51)\nlemma tendsto_PNat_val_atTop_atTop : Tendsto PNat.val atTop atTop\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Filter (L52-L56)\ntheorem Filter.Eventually.natCast_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] {p : R \u2192 Prop}\n (h : \u2200\u1da0 (x : R) in atTop, p x) : \u2200\u1da0 (n : \u2115) in atTop, p n\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Filter/Prod.lean", "module": "Mathlib.Order.Filter.Prod", "declaration": "Mathlib.Order.Filter.Prod.mem_prod_principal", "span": "L74-L82", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Filter/Prod.lean#L74"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1418, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3538, "lean_code_chars": 2746, "natural_language_chars": 792, "lean_code_ratio": 0.7761, "line_count": 105, "imports_count": 0, "declarations_count": 358, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a56dab5455baf21f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.LocallyConvex.Separation.iInter_countable_halfSpaces_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.Analysis.LocallyConvex.Separation)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem iInter_countable_halfSpaces_eq [HereditarilyLindelofSpace E]\n (hs\u2081 : Convex \u211d s) (hs\u2082 : IsClosed s) :\n \u2203 l : \u2115 \u2192 StrongDual \ud835\udd5c E, \u2203 c : \u2115 \u2192 \u211d, \u22c2 n, { x | re (l n x) \u2264 c n } = s\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.separate_convex_open_set (L54-L87)\ntheorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopologicalAddGroup E]\n [Module \u211d E] [ContinuousSMul \u211d E] {s : Set E} (hs\u2080 : (0 : E) \u2208 s) (hs\u2081 : Convex \u211d s)\n (hs\u2082 : IsOpen s) {x\u2080 : E} (hx\u2080 : x\u2080 \u2209 s) :\n \u2203 f : StrongDual \u211d E, f x\u2080 = 1 \u2227 \u2200 x \u2208 s, f x < 1\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open (L94-L123)\ntheorem geometric_hahn_banach_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht : Convex \u211d t)\n (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_point (L124-L129)\ntheorem geometric_hahn_banach_open_point (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (disj : x \u2209 s) :\n \u2203 f : StrongDual \u211d E, \u2200 a \u2208 s, f a < f x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_point_open (L130-L134)\ntheorem geometric_hahn_banach_point_open (ht\u2081 : Convex \u211d t) (ht\u2082 : IsOpen t) (disj : x \u2209 t) :\n \u2203 f : StrongDual \u211d E, \u2200 b \u2208 t, f x < f b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open (L135-L153)\ntheorem geometric_hahn_banach_open_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht\u2081 : Convex \u211d t)\n (ht\u2083 : IsOpen t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u < f b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior (L154-L172)\ntheorem geometric_hahn_banach_of_nonempty_interior\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) (htne : t.Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), f \u2260 0 \u2227 (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior' (L173-L184)\ntheorem geometric_hahn_banach_of_nonempty_interior'\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior_point (L185-L196)\ntheorem geometric_hahn_banach_of_nonempty_interior_point\n {A : Set E} (hA : Convex \u211d A) (hxA : x \u2209 interior A) (hAint : (interior A).Nonempty) :\n \u2203 f : StrongDual \u211d E, f \u2260 0 \u2227 \u2200 a \u2208 A, f a \u2264 f x\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvexHull (L79-L83)\ndef absConvexHull : ClosureOperator (Set E)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.balanced_absConvexHull (L90-L92)\ntheorem balanced_absConvexHull : Balanced \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvex_absConvexHull (L87-L89)\ntheorem absConvex_absConvexHull : AbsConvex \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.subset_absConvexHull (L84-L86)\ntheorem subset_absConvexHull : s \u2286 absConvexHull \ud835\udd5c s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.AbsConvex (L53-L56)\ndef AbsConvex (s : Set E) : Prop\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.convex_absConvexHull (L93-L96)\ntheorem convex_absConvexHull : Convex \ud835\udd5c (absConvexHull \ud835\udd5c s)\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.Analysis.LocallyConvex.Separation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem iInter_countable_halfSpaces_eq [HereditarilyLindelofSpace E]\n (hs\u2081 : Convex \u211d s) (hs\u2082 : IsClosed s) :\n \u2203 l : \u2115 \u2192 StrongDual \ud835\udd5c E, \u2203 c : \u2115 \u2192 \u211d, \u22c2 n, { x | re (l n x) \u2264 c n } = s\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.separate_convex_open_set (L54-L87)\ntheorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopologicalAddGroup E]\n [Module \u211d E] [ContinuousSMul \u211d E] {s : Set E} (hs\u2080 : (0 : E) \u2208 s) (hs\u2081 : Convex \u211d s)\n (hs\u2082 : IsOpen s) {x\u2080 : E} (hx\u2080 : x\u2080 \u2209 s) :\n \u2203 f : StrongDual \u211d E, f x\u2080 = 1 \u2227 \u2200 x \u2208 s, f x < 1\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open (L94-L123)\ntheorem geometric_hahn_banach_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht : Convex \u211d t)\n (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_point (L124-L129)\ntheorem geometric_hahn_banach_open_point (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (disj : x \u2209 s) :\n \u2203 f : StrongDual \u211d E, \u2200 a \u2208 s, f a < f x\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_point_open (L130-L134)\ntheorem geometric_hahn_banach_point_open (ht\u2081 : Convex \u211d t) (ht\u2082 : IsOpen t) (disj : x \u2209 t) :\n \u2203 f : StrongDual \u211d E, \u2200 b \u2208 t, f x < f b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open (L135-L153)\ntheorem geometric_hahn_banach_open_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht\u2081 : Convex \u211d t)\n (ht\u2083 : IsOpen t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u < f b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior (L154-L172)\ntheorem geometric_hahn_banach_of_nonempty_interior\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) (htne : t.Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), f \u2260 0 \u2227 (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior' (L173-L184)\ntheorem geometric_hahn_banach_of_nonempty_interior'\n (hs : Convex \u211d s) (ht : Convex \u211d t) (hst : Disjoint (interior s) t)\n (hsint : (interior s).Nonempty) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a \u2264 u) \u2227 \u2200 b \u2208 t, u \u2264 f b\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior_point (L185-L196)\ntheorem geometric_hahn_banach_of_nonempty_interior_point\n {A : Set E} (hA : Convex \u211d A) (hxA : x \u2209 interior A) (hAint : (interior A).Nonempty) :\n \u2203 f : StrongDual \u211d E, f \u2260 0 \u2227 \u2200 a \u2208 A, f a \u2264 f x\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvexHull (L79-L83)\ndef absConvexHull : ClosureOperator (Set E)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.balanced_absConvexHull (L90-L92)\ntheorem balanced_absConvexHull : Balanced \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvex_absConvexHull (L87-L89)\ntheorem absConvex_absConvexHull : AbsConvex \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.subset_absConvexHull (L84-L86)\ntheorem subset_absConvexHull : s \u2286 absConvexHull \ud835\udd5c s\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.AbsConvex (L53-L56)\ndef AbsConvex (s : Set E) : Prop\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.LocallyConvex.AbsConvex.convex_absConvexHull (L93-L96)\ntheorem convex_absConvexHull : Convex \ud835\udd5c (absConvexHull \ud835\udd5c s)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/LocallyConvex/Separation.lean", "module": "Mathlib.Analysis.LocallyConvex.Separation", "declaration": "Mathlib.Analysis.LocallyConvex.Separation.iInter_countable_halfSpaces_eq", "span": "L390-L404", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/LocallyConvex/Separation.lean#L390"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1706, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4160, "lean_code_chars": 3352, "natural_language_chars": 808, "lean_code_ratio": 0.8058, "line_count": 110, "imports_count": 0, "declarations_count": 401, "diagnostics_count": 0, "retrieval_snippets_count": 14, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "be7e78b706cc4a8d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.ContinuousOn.ContinuousWithinAt", "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.Topology.ContinuousOn)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ContinuousWithinAt.image_closure\n (hf : \u2200 x \u2208 closure s, ContinuousWithinAt f s x) : f '' closure s \u2286 closure (f '' s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousWithinAt_univ (L43-L46)\ntheorem continuousWithinAt_univ (f : \u03b1 \u2192 \u03b2) (x : \u03b1) :\n ContinuousWithinAt f Set.univ x \u2194 ContinuousAt f x := by\nrw [ContinuousAt, ContinuousWithinAt, nhdsWithin_univ]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_univ (L48-L51)\ntheorem continuousOn_univ {f : \u03b1 \u2192 \u03b2} : ContinuousOn f univ \u2194 Continuous f := by\nsimp [continuous_iff_continuousAt, ContinuousOn, ContinuousAt, ContinuousWithinAt,\n nhdsWithin_univ]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousWithinAt_iff_continuousAt_restrict (L52-L55)\ntheorem continuousWithinAt_iff_continuousAt_restrict (f : \u03b1 \u2192 \u03b2) {x : \u03b1} {s : Set \u03b1} (h : x \u2208 s) :\n ContinuousWithinAt f s x \u2194 ContinuousAt (s.restrict f) \u27e8x, h\u27e9 :=\ntendsto_nhdsWithin_iff_subtype h f _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.ContinuousOn.nhdsWithin_le_comap (L65-L68)\ntheorem nhdsWithin_le_comap (ctsf : ContinuousWithinAt f s x) :\n \ud835\udcdd[s] x \u2264 comap f (\ud835\udcdd[f '' s] f x) :=\nctsf.tendsto_nhdsWithin_image.le_comap\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousWithinAt_of_notMem_closure (L83-L92)\ntheorem continuousWithinAt_of_notMem_closure (hx : x \u2209 closure s) :\n ContinuousWithinAt f s x := by\nrw [mem_closure_iff_nhdsWithin_neBot, not_neBot] at hx\n rw [ContinuousWithinAt, hx]\n exact tendsto_bot\n\n/-!\n## `ContinuousOn`\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff (L93-L97)\ntheorem continuousOn_iff :\n ContinuousOn f s \u2194\n \u2200 x \u2208 s, \u2200 t : Set \u03b2, IsOpen t \u2192 f x \u2208 t \u2192 \u2203 u, IsOpen u \u2227 x \u2208 u \u2227 u \u2229 s \u2286 f \u207b\u00b9' t := by\nsimp only [ContinuousOn, ContinuousWithinAt, tendsto_nhds, mem_nhdsWithin]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L98-L101)\ntheorem ContinuousOn.continuousWithinAt (hf : ContinuousOn f s) (hx : x \u2208 s) :\n ContinuousWithinAt f s x :=\nhf x hx\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff_continuous_restrict (L102-L111)\ntheorem continuousOn_iff_continuous_restrict :\n ContinuousOn f s \u2194 Continuous (s.restrict f) := by\nrw [ContinuousOn, continuous_iff_continuousAt]; constructor\n \u00b7 rintro h \u27e8x, xs\u27e9\n exact (continuousWithinAt_iff_continuousAt_restrict f xs).mp (h x xs)\n intro h x xs\n exact (continuousWithinAt_iff_continuousAt_restrict f xs).mpr (h \u27e8x, xs\u27e9)\n\nalias \u27e8ContinuousOn.restrict, _\u27e9 := continuousOn_iff_continuous_restrict\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L112-L115)\ntheorem ContinuousOn.mapsToRestrict {t : Set \u03b2} (hf : ContinuousOn f s) (ht : MapsTo f s t) :\n Continuous (ht.restrict f s t) :=\nhf.restrict.codRestrict _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff' (L116-L128)\ntheorem continuousOn_iff' :\n ContinuousOn f s \u2194 \u2200 t : Set \u03b2, IsOpen t \u2192 \u2203 u, IsOpen u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\nhave : \u2200 t, IsOpen (s.restrict f \u207b\u00b9' t) \u2194 \u2203 u : Set \u03b1, IsOpen u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\n intro t\n rw [isOpen_induced_iff, Set.restrict_eq, Set.preimage_comp]\n simp only [Subtype.preimage_coe_eq_preimage_coe_iff]\n constructor <;>\n \u00b7 rintro \u27e8u, ou, useq\u27e9\n exact \u27e8u, ou, by simpa only [Set.inter_comm, eq_comm] using useq\u27e9\n rw [continuousOn_iff_continuous_restrict, continuous_def]; simp only [this]\n\n/-- If a function is continuous on a set for some topologies, then it is\ncontinuous on the same set with respect to any finer topology on the source space. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L129-L135)\ntheorem ContinuousOn.mono_dom {\u03b1 \u03b2 : Type*} {t\u2081 t\u2082 : TopologicalSpace \u03b1} {t\u2083 : TopologicalSpace \u03b2}\n (h\u2081 : t\u2082 \u2264 t\u2081) {s : Set \u03b1} {f : \u03b1 \u2192 \u03b2} (h\u2082 : @ContinuousOn \u03b1 \u03b2 t\u2081 t\u2083 f s) :\n @ContinuousOn \u03b1 \u03b2 t\u2082 t\u2083 f s := fun x hx _u hu =>\nmap_mono (inf_le_inf_right _ <| nhds_mono h\u2081) (h\u2082 x hx hu)\n\n/-- If a function is continuous on a set for some topologies, then it is\ncontinuous on the same set with respect to any coarser topology on the target space. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L136-L140)\ntheorem ContinuousOn.mono_rng {\u03b1 \u03b2 : Type*} {t\u2081 : TopologicalSpace \u03b1} {t\u2082 t\u2083 : TopologicalSpace \u03b2}\n (h\u2081 : t\u2082 \u2264 t\u2083) {s : Set \u03b1} {f : \u03b1 \u2192 \u03b2} (h\u2082 : @ContinuousOn \u03b1 \u03b2 t\u2081 t\u2082 f s) :\n @ContinuousOn \u03b1 \u03b2 t\u2081 t\u2083 f s := fun x hx _u hu =>\nh\u2082 x hx <| nhds_mono h\u2081 hu\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff_isClosed (L141-L148)\ntheorem continuousOn_iff_isClosed :\n ContinuousOn f s \u2194 \u2200 t : Set \u03b2, IsClosed t \u2192 \u2203 u, IsClosed u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\nhave : \u2200 t, IsClosed (s.restrict f \u207b\u00b9' t) \u2194 \u2203 u : Set \u03b1, IsClosed u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\n intro t\n rw [isClosed_induced_iff, Set.restrict_eq, Set.preimage_comp]\n simp only [Subtype.preimage_coe_eq_preimage_coe_iff, eq_comm, Set.inter_comm s]\n rw [continuousOn_iff_continuous_restrict, continuous_iff_isClosed]; simp only [this]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.ContinuousOn.continuous_of_cover_nhds (L149-L155)\ntheorem continuous_of_cover_nhds {\u03b9 : Sort*} {s : \u03b9 \u2192 Set \u03b1}\n (hs : \u2200 x : \u03b1, \u2203 i, s i \u2208 \ud835\udcdd x) (hf : \u2200 i, ContinuousOn f (s i)) :\n Continuous f :=\ncontinuous_iff_continuousAt.mpr fun x \u21a6 let \u27e8i, hi\u27e9 := hs x; by\n rw [ContinuousAt, \u2190 nhdsWithin_eq_nhds.2 hi]\n exact hf _ _ (mem_of_mem_nhds hi)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_singleton (L159-L163)\ntheorem continuousOn_singleton (f : \u03b1 \u2192 \u03b2) (a : \u03b1) : ContinuousOn f {a} :=\nforall_eq.2 <| by\n simpa only [ContinuousWithinAt, nhdsWithin_singleton, tendsto_pure_left] using fun s =>\n mem_of_mem_nhds\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.Topology.ContinuousOn).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ContinuousWithinAt.image_closure\n (hf : \u2200 x \u2208 closure s, ContinuousWithinAt f s x) : f '' closure s \u2286 closure (f '' s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousWithinAt_univ (L43-L46)\ntheorem continuousWithinAt_univ (f : \u03b1 \u2192 \u03b2) (x : \u03b1) :\n ContinuousWithinAt f Set.univ x \u2194 ContinuousAt f x := by\nrw [ContinuousAt, ContinuousWithinAt, nhdsWithin_univ]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_univ (L48-L51)\ntheorem continuousOn_univ {f : \u03b1 \u2192 \u03b2} : ContinuousOn f univ \u2194 Continuous f := by\nsimp [continuous_iff_continuousAt, ContinuousOn, ContinuousAt, ContinuousWithinAt,\n nhdsWithin_univ]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousWithinAt_iff_continuousAt_restrict (L52-L55)\ntheorem continuousWithinAt_iff_continuousAt_restrict (f : \u03b1 \u2192 \u03b2) {x : \u03b1} {s : Set \u03b1} (h : x \u2208 s) :\n ContinuousWithinAt f s x \u2194 ContinuousAt (s.restrict f) \u27e8x, h\u27e9 :=\ntendsto_nhdsWithin_iff_subtype h f _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.ContinuousOn.nhdsWithin_le_comap (L65-L68)\ntheorem nhdsWithin_le_comap (ctsf : ContinuousWithinAt f s x) :\n \ud835\udcdd[s] x \u2264 comap f (\ud835\udcdd[f '' s] f x) :=\nctsf.tendsto_nhdsWithin_image.le_comap\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousWithinAt_of_notMem_closure (L83-L92)\ntheorem continuousWithinAt_of_notMem_closure (hx : x \u2209 closure s) :\n ContinuousWithinAt f s x := by\nrw [mem_closure_iff_nhdsWithin_neBot, not_neBot] at hx\n rw [ContinuousWithinAt, hx]\n exact tendsto_bot\n\n/-!\n## `ContinuousOn`\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff (L93-L97)\ntheorem continuousOn_iff :\n ContinuousOn f s \u2194\n \u2200 x \u2208 s, \u2200 t : Set \u03b2, IsOpen t \u2192 f x \u2208 t \u2192 \u2203 u, IsOpen u \u2227 x \u2208 u \u2227 u \u2229 s \u2286 f \u207b\u00b9' t := by\nsimp only [ContinuousOn, ContinuousWithinAt, tendsto_nhds, mem_nhdsWithin]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L98-L101)\ntheorem ContinuousOn.continuousWithinAt (hf : ContinuousOn f s) (hx : x \u2208 s) :\n ContinuousWithinAt f s x :=\nhf x hx\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff_continuous_restrict (L102-L111)\ntheorem continuousOn_iff_continuous_restrict :\n ContinuousOn f s \u2194 Continuous (s.restrict f) := by\nrw [ContinuousOn, continuous_iff_continuousAt]; constructor\n \u00b7 rintro h \u27e8x, xs\u27e9\n exact (continuousWithinAt_iff_continuousAt_restrict f xs).mp (h x xs)\n intro h x xs\n exact (continuousWithinAt_iff_continuousAt_restrict f xs).mpr (h \u27e8x, xs\u27e9)\n\nalias \u27e8ContinuousOn.restrict, _\u27e9 := continuousOn_iff_continuous_restrict\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L112-L115)\ntheorem ContinuousOn.mapsToRestrict {t : Set \u03b2} (hf : ContinuousOn f s) (ht : MapsTo f s t) :\n Continuous (ht.restrict f s t) :=\nhf.restrict.codRestrict _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff' (L116-L128)\ntheorem continuousOn_iff' :\n ContinuousOn f s \u2194 \u2200 t : Set \u03b2, IsOpen t \u2192 \u2203 u, IsOpen u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\nhave : \u2200 t, IsOpen (s.restrict f \u207b\u00b9' t) \u2194 \u2203 u : Set \u03b1, IsOpen u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\n intro t\n rw [isOpen_induced_iff, Set.restrict_eq, Set.preimage_comp]\n simp only [Subtype.preimage_coe_eq_preimage_coe_iff]\n constructor <;>\n \u00b7 rintro \u27e8u, ou, useq\u27e9\n exact \u27e8u, ou, by simpa only [Set.inter_comm, eq_comm] using useq\u27e9\n rw [continuousOn_iff_continuous_restrict, continuous_def]; simp only [this]\n\n/-- If a function is continuous on a set for some topologies, then it is\ncontinuous on the same set with respect to any finer topology on the source space. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L129-L135)\ntheorem ContinuousOn.mono_dom {\u03b1 \u03b2 : Type*} {t\u2081 t\u2082 : TopologicalSpace \u03b1} {t\u2083 : TopologicalSpace \u03b2}\n (h\u2081 : t\u2082 \u2264 t\u2081) {s : Set \u03b1} {f : \u03b1 \u2192 \u03b2} (h\u2082 : @ContinuousOn \u03b1 \u03b2 t\u2081 t\u2083 f s) :\n @ContinuousOn \u03b1 \u03b2 t\u2082 t\u2083 f s := fun x hx _u hu =>\nmap_mono (inf_le_inf_right _ <| nhds_mono h\u2081) (h\u2082 x hx hu)\n\n/-- If a function is continuous on a set for some topologies, then it is\ncontinuous on the same set with respect to any coarser topology on the target space. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.ContinuousOn.ContinuousOn (L136-L140)\ntheorem ContinuousOn.mono_rng {\u03b1 \u03b2 : Type*} {t\u2081 : TopologicalSpace \u03b1} {t\u2082 t\u2083 : TopologicalSpace \u03b2}\n (h\u2081 : t\u2082 \u2264 t\u2083) {s : Set \u03b1} {f : \u03b1 \u2192 \u03b2} (h\u2082 : @ContinuousOn \u03b1 \u03b2 t\u2081 t\u2082 f s) :\n @ContinuousOn \u03b1 \u03b2 t\u2081 t\u2083 f s := fun x hx _u hu =>\nh\u2082 x hx <| nhds_mono h\u2081 hu\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_iff_isClosed (L141-L148)\ntheorem continuousOn_iff_isClosed :\n ContinuousOn f s \u2194 \u2200 t : Set \u03b2, IsClosed t \u2192 \u2203 u, IsClosed u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\nhave : \u2200 t, IsClosed (s.restrict f \u207b\u00b9' t) \u2194 \u2203 u : Set \u03b1, IsClosed u \u2227 f \u207b\u00b9' t \u2229 s = u \u2229 s := by\n intro t\n rw [isClosed_induced_iff, Set.restrict_eq, Set.preimage_comp]\n simp only [Subtype.preimage_coe_eq_preimage_coe_iff, eq_comm, Set.inter_comm s]\n rw [continuousOn_iff_continuous_restrict, continuous_iff_isClosed]; simp only [this]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.ContinuousOn.continuous_of_cover_nhds (L149-L155)\ntheorem continuous_of_cover_nhds {\u03b9 : Sort*} {s : \u03b9 \u2192 Set \u03b1}\n (hs : \u2200 x : \u03b1, \u2203 i, s i \u2208 \ud835\udcdd x) (hf : \u2200 i, ContinuousOn f (s i)) :\n Continuous f :=\ncontinuous_iff_continuousAt.mpr fun x \u21a6 let \u27e8i, hi\u27e9 := hs x; by\n rw [ContinuousAt, \u2190 nhdsWithin_eq_nhds.2 hi]\n exact hf _ _ (mem_of_mem_nhds hi)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.ContinuousOn.continuousOn_singleton (L159-L163)\ntheorem continuousOn_singleton (f : \u03b1 \u2192 \u03b2) (a : \u03b1) : ContinuousOn f {a} :=\nforall_eq.2 <| by\n simpa only [ContinuousWithinAt, nhdsWithin_singleton, tendsto_pure_left] using fun s =>\n mem_of_mem_nhds\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/ContinuousOn.lean", "module": "Mathlib.Topology.ContinuousOn", "declaration": "Mathlib.Topology.ContinuousOn.ContinuousWithinAt", "span": "L566-L569", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/ContinuousOn.lean#L566"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 2239, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 6211, "lean_code_chars": 5388, "natural_language_chars": 823, "lean_code_ratio": 0.8675, "line_count": 164, "imports_count": 0, "declarations_count": 641, "diagnostics_count": 0, "retrieval_snippets_count": 15, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "e40dc3d191fbdb25", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Analytic.Basic.AnalyticOn", "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.Analysis.Analytic.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma AnalyticOn.analyticAt {f : E \u2192 F} {z : E} {s : Set E} (hU : s \u2208 \ud835\udcdd z)\n (h : AnalyticOn \ud835\udd5c f s) : AnalyticAt \ud835\udd5c f z\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E) :=\n\u2203 r, HasFPowerSeriesOnBall f p x r\n\n/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E) :=\n\u2203 r, HasFPowerSeriesWithinOnBall f p s x r\n\n-- Teach the `bound` tactic that power series have positive radius\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E) :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesAt f p x\n\n/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `\ud835\udcdd[s] x` -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesWithinAt f p s x\n\n/-- Given a function `f : E \u2192 F`, we say that `f` is analytic on a set `s` if it is analytic around\nevery point of `s`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E) :=\n\u2200 x, x \u2208 s \u2192 AnalyticAt \ud835\udd5c f x\n\n/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that\nthis is weaker than `AnalyticOnNhd \ud835\udd5c f s`, as `f` is allowed to be arbitrary outside `s`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)\ntheorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :\n HasFPowerSeriesAt f p x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L136-L138)\ntheorem HasFPowerSeriesAt.analyticAt (hf : HasFPowerSeriesAt f p x) : AnalyticAt \ud835\udd5c f x :=\n\u27e8p, hf\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L139-L141)\ntheorem HasFPowerSeriesOnBall.analyticAt (hf : HasFPowerSeriesOnBall f p x r) : AnalyticAt \ud835\udd5c f x :=\nhf.hasFPowerSeriesAt.analyticAt\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)\ntheorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt\n (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L146-L148)\ntheorem HasFPowerSeriesWithinAt.analyticWithinAt (hf : HasFPowerSeriesWithinAt f p s x) :\n AnalyticWithinAt \ud835\udd5c f s x := \u27e8p, hf\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L149-L154)\ntheorem HasFPowerSeriesWithinOnBall.analyticWithinAt (hf : HasFPowerSeriesWithinOnBall f p s x r) :\n AnalyticWithinAt \ud835\udd5c f s x :=\nhf.hasFPowerSeriesWithinAt.analyticWithinAt\n\n/-- If a function `f` has a power series `p` around `x`, then the function `z \u21a6 f (z - y)` has the\nsame power series around `x + y`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L155-L162)\ntheorem HasFPowerSeriesOnBall.comp_sub (hf : HasFPowerSeriesOnBall f p x r) (y : E) :\n HasFPowerSeriesOnBall (fun z => f (z - y)) p (x + y) r :=\n{ r_le := hf.r_le\n r_pos := hf.r_pos\n hasSum := fun {z} hz => by\n convert hf.hasSum hz using 2\n abel }\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L163-L174)\ntheorem HasFPowerSeriesWithinOnBall.comp_sub (hf : HasFPowerSeriesWithinOnBall f p s x r) (y : E) :\n HasFPowerSeriesWithinOnBall (fun z \u21a6 f (z - y)) p (s + {y}) (x + y) r where\n r_le := hf.r_le\nr_pos := hf.r_pos\n hasSum {z} hz1 hz2 := by\n have : x + z \u2208 insert x s := by\n simp only [add_singleton, image_add_right, mem_insert_iff, add_eq_left, mem_preimage] at hz1 \u22a2\n abel_nf at hz1\n assumption\n convert hf.hasSum this hz2 using 2\n abel\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L175-L179)\ntheorem HasFPowerSeriesAt.comp_sub (hf : HasFPowerSeriesAt f p x) (y : E) :\n HasFPowerSeriesAt (fun z \u21a6 f (z - y)) p (x + y) := by\nobtain \u27e8r, hf\u27e9 := hf\n exact \u27e8r, hf.comp_sub _\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L180-L184)\ntheorem HasFPowerSeriesWithinAt.comp_sub (hf : HasFPowerSeriesWithinAt f p s x) (y : E) :\n HasFPowerSeriesWithinAt (fun z \u21a6 f (z - y)) p (s + {y}) (x + y) := by\nobtain \u27e8r, hf\u27e9 := hf\n exact \u27e8r, hf.comp_sub _\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.hasFPowerSeriesOnBall_ofScalars_mul_add_zero (L213-L220)\ntheorem hasFPowerSeriesOnBall_ofScalars_mul_add_zero (a b : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 (b - a) / (1 - x) + a / (1 - x) ^ 2)\n (.ofScalars \u2102 fun n \u21a6 a * n + b) 0 1 := by\nconvert (one_div_one_sub_hasFPowerSeriesOnBall_zero.const_smul (c := b - a)).add\n (one_div_one_sub_sq_hasFPowerSeriesOnBall_zero.const_smul (c := a)) using 2\n \u00b7 simp [div_eq_mul_inv]\n \u00b7 ext; simp; ring\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesOnBall_zero (L240-L249)\ntheorem one_add_rpow_hasFPowerSeriesOnBall_zero {a : \u211d} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u211d a) 0 1 := by\nhave H : binomialSeries \u2102 a = (binomialSeries \u2102 (a : \u2102)).restrictScalars (\ud835\udd5c := \u211d) := by aesop\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (a : \u2102)) (binomialSeries \u2102 a) (.ofRealCLM 0) 1 :=\n Complex.ofRealCLM.map_zero \u25b8 H \u25b8 Complex.one_add_cpow_hasFPowerSeriesOnBall_zero.restrictScalars\n convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_\n \u00b7 ext; simp [Function.comp_def]\n \u00b7 simp\n \u00b7 intro x hx; simp_all; norm_cast\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_sq_hasFPowerSeriesOnBall_zero (L208-L212)\ntheorem one_div_one_sub_sq_hasFPowerSeriesOnBall_zero :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x : \u2102) ^ 2) (.ofScalars \u2102 fun n \u21a6 (n + 1 : \u2102)) 0 1 := by\nsimpa using one_div_sub_sq_hasFPowerSeriesOnBall_zero (z := 1)\n\n/-- `\u2211 (ai + b) z\u2071 = (b - a) / (1 - z) + a / (1 - z)\u00b2` -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (L261-L279)\ntheorem one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (a : \u211d) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u211d fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave := (Complex.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero a).restrictScalars (\ud835\udd5c := \u211d)\n rw [\u2190 Complex.ofRealCLM.map_zero] at this\n convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_ using 1\n \u00b7 ext n\n simp only [ContinuousLinearMap.compFormalMultilinearSeries_apply,\n ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply,\n FormalMultilinearSeries.compContinuousLinearMap_apply]\n simp\n norm_cast\n \u00b7 simp\n \u00b7 intro x hx\n have : |x| < 1 := by simpa [enorm_eq_nnnorm] using hx\n have : 0 \u2264 1 - x := by grind\n simp [-Complex.inv_re, \u2190 Complex.ofReal_one, \u2190 Complex.ofReal_sub, \u2190 Complex.ofReal_cpow this]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)\ntheorem binomialSeries_eq_ordinaryHypergeometricSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42]\n {\ud835\udd38 : Type v} [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] {a b : \ud835\udd42}\n (h : \u2200 (k : \u2115), (k : \ud835\udd42) \u2260 -b) :\n binomialSeries \ud835\udd38 a =\n (ordinaryHypergeometricSeries \ud835\udd38 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by\nsimp only [binomialSeries, ordinaryHypergeometricSeries,\n FormalMultilinearSeries.ofScalars_comp_neg_id]\n congr! with n\n rw [ordinaryHypergeometricCoefficient,\n mul_inv_cancel_right\u2080 (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]\n simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,\n Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,\n ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]\n ring_nf\n simp\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `\u22a4` for natural `a`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)\ntheorem binomialSeries_apply {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) {n} (v : Fin n \u2192 \ud835\udd38) :\n binomialSeries \ud835\udd38 a n v = Ring.choose a n \u2022 (List.ofFn v).prod := by\nsimp [binomialSeries, FormalMultilinearSeries.ofScalars]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialOn_const (L43-L46)\ntheorem CPolynomialOn_const {v : F} {s : Set E} : CPolynomialOn \ud835\udd5c (fun _ => v) s :=\nfun _ _ => CPolynomialAt_const\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesAt_zero (L253-L256)\ntheorem one_add_rpow_hasFPowerSeriesAt_zero {a : \u211d} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u211d a) 0 :=\none_add_rpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesOnBall_const (L31-L35)\ntheorem hasFiniteFPowerSeriesOnBall_const {c : F} {e : E} :\n HasFiniteFPowerSeriesOnBall (fun _ => c) (constFormalMultilinearSeries \ud835\udd5c E c) e 1 \u22a4 :=\n\u27e8hasFPowerSeriesOnBall_const,\n fun _ hn \u21a6 constFormalMultilinearSeries_apply_of_nonzero (Nat.ne_zero_of_lt hn)\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_hasFPowerSeriesOnBall_zero (L199-L203)\ntheorem one_div_sub_sq_hasFPowerSeriesOnBall_zero {z : \u2102} (hz : z \u2260 0) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (z - x) ^ 2)\n (.ofScalars \u2102 fun n \u21a6 (z ^ (n + 2))\u207b\u00b9 * (n + 1)) 0 \u2016z\u2016\u2091 := by\nsimpa [add_comm 1] using one_div_sub_pow_hasFPowerSeriesOnBall_zero 1 hz\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_hasFPowerSeriesOnBall_zero (L195-L198)\ntheorem one_div_sub_hasFPowerSeriesOnBall_zero {z : \u2102} (hz : z \u2260 0) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (z - x)) (.ofScalars \u2102 fun n \u21a6 (z ^ (n + 1))\u207b\u00b9) 0 \u2016z\u2016\u2091 := by\nsimpa using one_div_sub_pow_hasFPowerSeriesOnBall_zero (a := 0) hz\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)\ntheorem binomialSeries_radius_ge_one {\ud835\udd42 : Type*} [RCLike \ud835\udd42] {\ud835\udd38 : Type*} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} :\n 1 \u2264 (binomialSeries \ud835\udd38 a).radius := by\nby_cases ha : \u2200 (k : \u2115), a \u2260 k\n \u00b7 rw [binomialSeries_radius_eq_one ha]\n \u00b7 push Not at ha\n rcases ha with \u27e8k, rfl\u27e9\n simp [binomialSeries_radius_eq_top_of_nat]\n\nnamespace Complex\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (L221-L237)\nlemma one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (w x : \u2102) (hw : w \u2260 x) :\n HasFPowerSeriesOnBall (fun z \u21a6 1 / (z - w) ^ 2 - 1 / w ^ 2) (.ofScalars \u2102\n fun i \u21a6 (i + 1) * (w - x) ^ (-\u2191(i + 2) : \u2124) - i.casesOn (w ^ (-2 : \u2124)) 0) x \u2016w - x\u2016\u2091 := by\nrw [\u2190 Pi.sub_def, \u2190 Pi.sub_def, FormalMultilinearSeries.ofScalars_sub]\n refine .sub ?_ ?_\n \u00b7 simpa only [sub_sub_sub_cancel_right, zero_add, sub_sq_comm w, zpow_neg, zpow_natCast, mul_comm]\n using (one_div_sub_sq_hasFPowerSeriesOnBall_zero\n (z := w - x) (by simp [sub_eq_zero, hw])).comp_sub x\n \u00b7 convert hasFPowerSeriesOnBall_const.mono _ le_top\n \u00b7 ext (_ | _) <;> simp [zpow_ofNat]\n \u00b7 simpa [sub_eq_zero]\n\nend Complex\n\nnamespace Real\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_pow_hasFPowerSeriesOnBall_zero (L179-L194)\ntheorem one_div_sub_pow_hasFPowerSeriesOnBall_zero (a : \u2115) {z : \u2102} (hz : z \u2260 0) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (z - x) ^ (a + 1))\n (.ofScalars \u2102 (\ud835\udd5c := \u2102) fun n \u21a6 (z ^ (n + a + 1))\u207b\u00b9 * \u2191(Nat.choose (a + n) a)) 0 \u2016z\u2016\u2091 := by\nhave := one_div_one_sub_pow_hasFPowerSeriesOnBall_zero a\n rw [\u2190 map_zero (z\u207b\u00b9 \u2022 1 : \u2102 \u2192L[\u2102] \u2102)] at this\n have := this.compContinuousLinearMap\n have H : 1 / \u2016(z\u207b\u00b9 \u2022 1 : \u2102 \u2192L[\u2102] \u2102)\u2016\u2091 = \u2016z\u2016\u2091 := by simp [enorm_smul, enorm_inv, hz]\n simp only [one_div, ContinuousLinearMap.coe_smul', H, Function.comp_def] at this\n convert (this.const_smul (c := (z ^ (a + 1))\u207b\u00b9)).congr ?_ using 2\n \u00b7 ext n\n simp only [FormalMultilinearSeries.smul_apply, ContinuousMultilinearMap.smul_apply,\n FormalMultilinearSeries.compContinuousLinearMap_apply]\n simp [add_assoc, pow_add _ _ (a + 1), mul_assoc]\n \u00b7 intro w hw\n simp [\u2190 mul_inv_rev, \u2190 mul_pow, sub_mul, mul_right_comm _ w, hz]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesAt_const (L36-L39)\ntheorem hasFiniteFPowerSeriesAt_const {c : F} {e : E} :\n HasFiniteFPowerSeriesAt (fun _ => c) (constFormalMultilinearSeries \ud835\udd5c E c) e 1 :=\n\u27e8\u22a4, hasFiniteFPowerSeriesOnBall_const\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)\ntheorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave H : ((binomialSeries \u2102 (-a)).compContinuousLinearMap (-1)) =\n .ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n := by\n ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,\n Units.smul_def, \u2190 pow_add, \u2190 mul_assoc]\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (-a)) (binomialSeries \u2102 (-a : \u2102)) (-0) 1 := by\n simpa using one_add_cpow_hasFPowerSeriesOnBall_zero\n simpa [cpow_neg, Function.comp_def, \u2190 sub_eq_add_neg, H] using\n this.compContinuousLinearMap (u := -1) (x := (0 : \u2102))\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)\nlemma Complex.ofReal_choose (a : \u211d) (n : \u2115) :\n \u2191(Ring.choose a n) = Ring.choose (a : \u2102) n :=\nRing.map_choose (algebraMap \u211d \u2102) _ _\n\n/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given\nby `Ring.choose a`. The sum of this series is `fun x \u21a6 (1 + x) ^ a` within the radius\nof convergence. -/\nnoncomputable def binomialSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) :\n FormalMultilinearSeries \ud835\udd42 \ud835\udd38 \ud835\udd38 :=\n .ofScalars \ud835\udd38 (Ring.choose a \u00b7)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)\ntheorem binomialSeries_radius_eq_one {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} (ha : \u2200 (k : \u2115), a \u2260 k) : (binomialSeries \ud835\udd38 a).radius = 1 := by\nsimp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n FormalMultilinearSeries.radius_compNeg]\n conv at ha => ext; rw [ne_comm]\n exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_hasFPowerSeriesOnBall_zero (L204-L207)\ntheorem one_div_one_sub_hasFPowerSeriesOnBall_zero :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x : \u2102)) (.ofScalars (\ud835\udd5c := \u2102) \u2102 1) 0 1 := by\nsimpa using one_div_sub_hasFPowerSeriesOnBall_zero (z := 1)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)\ntheorem one_add_cpow_hasFPowerSeriesAt_zero {a : \u2102} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 :=\none_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialAt_const (L40-L42)\ntheorem CPolynomialAt_const {v : F} : CPolynomialAt \ud835\udd5c (fun _ => v) x :=\n\u27e8constFormalMultilinearSeries \ud835\udd5c E v, 1, hasFiniteFPowerSeriesAt_const\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)\ntheorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : \u2102} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 1 := by\nsuffices (binomialSeries \u2102 a = FormalMultilinearSeries.ofScalars \u2102\n fun n \u21a6 iteratedDeriv n (fun (x : \u2102) \u21a6 (1 + x) ^ a) 0 / n !) by\n convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _\n \u00b7 norm_num\n \u00b7 -- TODO: use `fun_prop` for this subgoal\n apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const\n intro z hz\n apply Complex.mem_slitPlane_of_norm_lt_one\n rw [\u2190 ENNReal.ofReal_one, Metric.eball_ofReal] at hz\n simpa using hz\n \u00b7 rw [\u2190 this]\n exact binomialSeries_radius_ge_one\n simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]\n ext n\n rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), \u2190 nsmul_eq_mul',\n \u2190 Ring.descPochhammer_eq_factorial_smul_choose]\n let B := Metric.ball (0 : \u2102) 1\n suffices Set.EqOn (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B)\n (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - n)) B by\n specialize this (show 0 \u2208 _ by simp [B])\n rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this\n symm\n simpa using this\n induction n with\n | zero => simp [Set.EqOn]\n | succ n ih =>\n have : iteratedDerivWithin (n + 1) (fun (x : \u2102) \u21a6 (1 + x) ^ a) B =\n derivWithin (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B) B := by\n ext z\n rw [iteratedDerivWithin_succ]\n rw [this]\n have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : \u2102) \u21a6 (1 + x) ^ a) B) B)\n (derivWithin (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - \u2191n)) B) B := by\n intro z hz\n rw [derivWithin_congr (fun _ hz \u21a6 ih hz) (ih hz)]\n apply Set.EqOn.trans this\n intro z hz\n simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,\n deriv_const_mul_field']\n rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,\n show a - (n + 1) = a - n - 1 by ring, \u2190 mul_assoc]\n \u00b7 congr\n simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]\n \u00b7 apply Complex.mem_slitPlane_of_norm_lt_one\n simpa [B] using hz\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.HasFiniteFPowerSeriesOnBall (L47-L53)\ntheorem HasFiniteFPowerSeriesOnBall.add (hf : HasFiniteFPowerSeriesOnBall f pf x n r)\n (hg : HasFiniteFPowerSeriesOnBall g pg x m r) :\n HasFiniteFPowerSeriesOnBall (f + g) (pf + pg) x (max n m) r :=\n\u27e8hf.1.add hg.1, fun N hN \u21a6 by\n rw [Pi.add_apply, hf.finite _ ((le_max_left n m).trans hN),\n hg.finite _ ((le_max_right n m).trans hN), zero_add]\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (L171-L178)\ntheorem one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (a : \u2115) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ (a + 1))\n (.ofScalars \u2102 (\ud835\udd5c := \u2102) fun n \u21a6 \u2191(Nat.choose (a + n) a)) 0 1 := by\nconvert one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a + 1) using 3 with z n\n \u00b7 norm_cast\n \u00b7 rw [eq_comm, add_right_comm, add_sub_cancel_right, \u2190 Nat.cast_add,\n Ring.choose_natCast, Nat.choose_symm_add]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)\ntheorem binomialSeries_radius_eq_top_of_nat {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u}\n [NormedDivisionRing \ud835\udd38] [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \u2115} :\n (binomialSeries \ud835\udd38 (a : \ud835\udd42)).radius = \u22a4 := by\nsimp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n ordinaryHypergeometric_radius_top_of_neg_nat\u2081]\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `1`, when `a` is not natural. -/\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.Analysis.Analytic.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma AnalyticOn.analyticAt {f : E \u2192 F} {z : E} {s : Set E} (hU : s \u2208 \ud835\udcdd z)\n (h : AnalyticOn \ud835\udd5c f s) : AnalyticAt \ud835\udd5c f z\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E) :=\n\u2203 r, HasFPowerSeriesOnBall f p x r\n\n/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E) :=\n\u2203 r, HasFPowerSeriesWithinOnBall f p s x r\n\n-- Teach the `bound` tactic that power series have positive radius\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E) :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesAt f p x\n\n/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `\ud835\udcdd[s] x` -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesWithinAt f p s x\n\n/-- Given a function `f : E \u2192 F`, we say that `f` is analytic on a set `s` if it is analytic around\nevery point of `s`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E) :=\n\u2200 x, x \u2208 s \u2192 AnalyticAt \ud835\udd5c f x\n\n/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that\nthis is weaker than `AnalyticOnNhd \ud835\udd5c f s`, as `f` is allowed to be arbitrary outside `s`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)\ntheorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :\n HasFPowerSeriesAt f p x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L136-L138)\ntheorem HasFPowerSeriesAt.analyticAt (hf : HasFPowerSeriesAt f p x) : AnalyticAt \ud835\udd5c f x :=\n\u27e8p, hf\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L139-L141)\ntheorem HasFPowerSeriesOnBall.analyticAt (hf : HasFPowerSeriesOnBall f p x r) : AnalyticAt \ud835\udd5c f x :=\nhf.hasFPowerSeriesAt.analyticAt\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)\ntheorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt\n (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L146-L148)\ntheorem HasFPowerSeriesWithinAt.analyticWithinAt (hf : HasFPowerSeriesWithinAt f p s x) :\n AnalyticWithinAt \ud835\udd5c f s x := \u27e8p, hf\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L149-L154)\ntheorem HasFPowerSeriesWithinOnBall.analyticWithinAt (hf : HasFPowerSeriesWithinOnBall f p s x r) :\n AnalyticWithinAt \ud835\udd5c f s x :=\nhf.hasFPowerSeriesWithinAt.analyticWithinAt\n\n/-- If a function `f` has a power series `p` around `x`, then the function `z \u21a6 f (z - y)` has the\nsame power series around `x + y`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L155-L162)\ntheorem HasFPowerSeriesOnBall.comp_sub (hf : HasFPowerSeriesOnBall f p x r) (y : E) :\n HasFPowerSeriesOnBall (fun z => f (z - y)) p (x + y) r :=\n{ r_le := hf.r_le\n r_pos := hf.r_pos\n hasSum := fun {z} hz => by\n convert hf.hasSum hz using 2\n abel }\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L163-L174)\ntheorem HasFPowerSeriesWithinOnBall.comp_sub (hf : HasFPowerSeriesWithinOnBall f p s x r) (y : E) :\n HasFPowerSeriesWithinOnBall (fun z \u21a6 f (z - y)) p (s + {y}) (x + y) r where\n r_le := hf.r_le\nr_pos := hf.r_pos\n hasSum {z} hz1 hz2 := by\n have : x + z \u2208 insert x s := by\n simp only [add_singleton, image_add_right, mem_insert_iff, add_eq_left, mem_preimage] at hz1 \u22a2\n abel_nf at hz1\n assumption\n convert hf.hasSum this hz2 using 2\n abel\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L175-L179)\ntheorem HasFPowerSeriesAt.comp_sub (hf : HasFPowerSeriesAt f p x) (y : E) :\n HasFPowerSeriesAt (fun z \u21a6 f (z - y)) p (x + y) := by\nobtain \u27e8r, hf\u27e9 := hf\n exact \u27e8r, hf.comp_sub _\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L180-L184)\ntheorem HasFPowerSeriesWithinAt.comp_sub (hf : HasFPowerSeriesWithinAt f p s x) (y : E) :\n HasFPowerSeriesWithinAt (fun z \u21a6 f (z - y)) p (s + {y}) (x + y) := by\nobtain \u27e8r, hf\u27e9 := hf\n exact \u27e8r, hf.comp_sub _\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.hasFPowerSeriesOnBall_ofScalars_mul_add_zero (L213-L220)\ntheorem hasFPowerSeriesOnBall_ofScalars_mul_add_zero (a b : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 (b - a) / (1 - x) + a / (1 - x) ^ 2)\n (.ofScalars \u2102 fun n \u21a6 a * n + b) 0 1 := by\nconvert (one_div_one_sub_hasFPowerSeriesOnBall_zero.const_smul (c := b - a)).add\n (one_div_one_sub_sq_hasFPowerSeriesOnBall_zero.const_smul (c := a)) using 2\n \u00b7 simp [div_eq_mul_inv]\n \u00b7 ext; simp; ring\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesOnBall_zero (L240-L249)\ntheorem one_add_rpow_hasFPowerSeriesOnBall_zero {a : \u211d} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u211d a) 0 1 := by\nhave H : binomialSeries \u2102 a = (binomialSeries \u2102 (a : \u2102)).restrictScalars (\ud835\udd5c := \u211d) := by aesop\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (a : \u2102)) (binomialSeries \u2102 a) (.ofRealCLM 0) 1 :=\n Complex.ofRealCLM.map_zero \u25b8 H \u25b8 Complex.one_add_cpow_hasFPowerSeriesOnBall_zero.restrictScalars\n convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_\n \u00b7 ext; simp [Function.comp_def]\n \u00b7 simp\n \u00b7 intro x hx; simp_all; norm_cast\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_sq_hasFPowerSeriesOnBall_zero (L208-L212)\ntheorem one_div_one_sub_sq_hasFPowerSeriesOnBall_zero :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x : \u2102) ^ 2) (.ofScalars \u2102 fun n \u21a6 (n + 1 : \u2102)) 0 1 := by\nsimpa using one_div_sub_sq_hasFPowerSeriesOnBall_zero (z := 1)\n\n/-- `\u2211 (ai + b) z\u2071 = (b - a) / (1 - z) + a / (1 - z)\u00b2` -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (L261-L279)\ntheorem one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (a : \u211d) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u211d fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave := (Complex.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero a).restrictScalars (\ud835\udd5c := \u211d)\n rw [\u2190 Complex.ofRealCLM.map_zero] at this\n convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_ using 1\n \u00b7 ext n\n simp only [ContinuousLinearMap.compFormalMultilinearSeries_apply,\n ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply,\n FormalMultilinearSeries.compContinuousLinearMap_apply]\n simp\n norm_cast\n \u00b7 simp\n \u00b7 intro x hx\n have : |x| < 1 := by simpa [enorm_eq_nnnorm] using hx\n have : 0 \u2264 1 - x := by grind\n simp [-Complex.inv_re, \u2190 Complex.ofReal_one, \u2190 Complex.ofReal_sub, \u2190 Complex.ofReal_cpow this]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)\ntheorem binomialSeries_eq_ordinaryHypergeometricSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42]\n {\ud835\udd38 : Type v} [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] {a b : \ud835\udd42}\n (h : \u2200 (k : \u2115), (k : \ud835\udd42) \u2260 -b) :\n binomialSeries \ud835\udd38 a =\n (ordinaryHypergeometricSeries \ud835\udd38 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by\nsimp only [binomialSeries, ordinaryHypergeometricSeries,\n FormalMultilinearSeries.ofScalars_comp_neg_id]\n congr! with n\n rw [ordinaryHypergeometricCoefficient,\n mul_inv_cancel_right\u2080 (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]\n simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,\n Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,\n ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]\n ring_nf\n simp\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `\u22a4` for natural `a`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)\ntheorem binomialSeries_apply {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) {n} (v : Fin n \u2192 \ud835\udd38) :\n binomialSeries \ud835\udd38 a n v = Ring.choose a n \u2022 (List.ofFn v).prod := by\nsimp [binomialSeries, FormalMultilinearSeries.ofScalars]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialOn_const (L43-L46)\ntheorem CPolynomialOn_const {v : F} {s : Set E} : CPolynomialOn \ud835\udd5c (fun _ => v) s :=\nfun _ _ => CPolynomialAt_const\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesAt_zero (L253-L256)\ntheorem one_add_rpow_hasFPowerSeriesAt_zero {a : \u211d} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u211d a) 0 :=\none_add_rpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesOnBall_const (L31-L35)\ntheorem hasFiniteFPowerSeriesOnBall_const {c : F} {e : E} :\n HasFiniteFPowerSeriesOnBall (fun _ => c) (constFormalMultilinearSeries \ud835\udd5c E c) e 1 \u22a4 :=\n\u27e8hasFPowerSeriesOnBall_const,\n fun _ hn \u21a6 constFormalMultilinearSeries_apply_of_nonzero (Nat.ne_zero_of_lt hn)\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_hasFPowerSeriesOnBall_zero (L199-L203)\ntheorem one_div_sub_sq_hasFPowerSeriesOnBall_zero {z : \u2102} (hz : z \u2260 0) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (z - x) ^ 2)\n (.ofScalars \u2102 fun n \u21a6 (z ^ (n + 2))\u207b\u00b9 * (n + 1)) 0 \u2016z\u2016\u2091 := by\nsimpa [add_comm 1] using one_div_sub_pow_hasFPowerSeriesOnBall_zero 1 hz\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_hasFPowerSeriesOnBall_zero (L195-L198)\ntheorem one_div_sub_hasFPowerSeriesOnBall_zero {z : \u2102} (hz : z \u2260 0) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (z - x)) (.ofScalars \u2102 fun n \u21a6 (z ^ (n + 1))\u207b\u00b9) 0 \u2016z\u2016\u2091 := by\nsimpa using one_div_sub_pow_hasFPowerSeriesOnBall_zero (a := 0) hz\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)\ntheorem binomialSeries_radius_ge_one {\ud835\udd42 : Type*} [RCLike \ud835\udd42] {\ud835\udd38 : Type*} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} :\n 1 \u2264 (binomialSeries \ud835\udd38 a).radius := by\nby_cases ha : \u2200 (k : \u2115), a \u2260 k\n \u00b7 rw [binomialSeries_radius_eq_one ha]\n \u00b7 push Not at ha\n rcases ha with \u27e8k, rfl\u27e9\n simp [binomialSeries_radius_eq_top_of_nat]\n\nnamespace Complex\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (L221-L237)\nlemma one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (w x : \u2102) (hw : w \u2260 x) :\n HasFPowerSeriesOnBall (fun z \u21a6 1 / (z - w) ^ 2 - 1 / w ^ 2) (.ofScalars \u2102\n fun i \u21a6 (i + 1) * (w - x) ^ (-\u2191(i + 2) : \u2124) - i.casesOn (w ^ (-2 : \u2124)) 0) x \u2016w - x\u2016\u2091 := by\nrw [\u2190 Pi.sub_def, \u2190 Pi.sub_def, FormalMultilinearSeries.ofScalars_sub]\n refine .sub ?_ ?_\n \u00b7 simpa only [sub_sub_sub_cancel_right, zero_add, sub_sq_comm w, zpow_neg, zpow_natCast, mul_comm]\n using (one_div_sub_sq_hasFPowerSeriesOnBall_zero\n (z := w - x) (by simp [sub_eq_zero, hw])).comp_sub x\n \u00b7 convert hasFPowerSeriesOnBall_const.mono _ le_top\n \u00b7 ext (_ | _) <;> simp [zpow_ofNat]\n \u00b7 simpa [sub_eq_zero]\n\nend Complex\n\nnamespace Real\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_pow_hasFPowerSeriesOnBall_zero (L179-L194)\ntheorem one_div_sub_pow_hasFPowerSeriesOnBall_zero (a : \u2115) {z : \u2102} (hz : z \u2260 0) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (z - x) ^ (a + 1))\n (.ofScalars \u2102 (\ud835\udd5c := \u2102) fun n \u21a6 (z ^ (n + a + 1))\u207b\u00b9 * \u2191(Nat.choose (a + n) a)) 0 \u2016z\u2016\u2091 := by\nhave := one_div_one_sub_pow_hasFPowerSeriesOnBall_zero a\n rw [\u2190 map_zero (z\u207b\u00b9 \u2022 1 : \u2102 \u2192L[\u2102] \u2102)] at this\n have := this.compContinuousLinearMap\n have H : 1 / \u2016(z\u207b\u00b9 \u2022 1 : \u2102 \u2192L[\u2102] \u2102)\u2016\u2091 = \u2016z\u2016\u2091 := by simp [enorm_smul, enorm_inv, hz]\n simp only [one_div, ContinuousLinearMap.coe_smul', H, Function.comp_def] at this\n convert (this.const_smul (c := (z ^ (a + 1))\u207b\u00b9)).congr ?_ using 2\n \u00b7 ext n\n simp only [FormalMultilinearSeries.smul_apply, ContinuousMultilinearMap.smul_apply,\n FormalMultilinearSeries.compContinuousLinearMap_apply]\n simp [add_assoc, pow_add _ _ (a + 1), mul_assoc]\n \u00b7 intro w hw\n simp [\u2190 mul_inv_rev, \u2190 mul_pow, sub_mul, mul_right_comm _ w, hz]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesAt_const (L36-L39)\ntheorem hasFiniteFPowerSeriesAt_const {c : F} {e : E} :\n HasFiniteFPowerSeriesAt (fun _ => c) (constFormalMultilinearSeries \ud835\udd5c E c) e 1 :=\n\u27e8\u22a4, hasFiniteFPowerSeriesOnBall_const\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)\ntheorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave H : ((binomialSeries \u2102 (-a)).compContinuousLinearMap (-1)) =\n .ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n := by\n ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,\n Units.smul_def, \u2190 pow_add, \u2190 mul_assoc]\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (-a)) (binomialSeries \u2102 (-a : \u2102)) (-0) 1 := by\n simpa using one_add_cpow_hasFPowerSeriesOnBall_zero\n simpa [cpow_neg, Function.comp_def, \u2190 sub_eq_add_neg, H] using\n this.compContinuousLinearMap (u := -1) (x := (0 : \u2102))\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)\nlemma Complex.ofReal_choose (a : \u211d) (n : \u2115) :\n \u2191(Ring.choose a n) = Ring.choose (a : \u2102) n :=\nRing.map_choose (algebraMap \u211d \u2102) _ _\n\n/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given\nby `Ring.choose a`. The sum of this series is `fun x \u21a6 (1 + x) ^ a` within the radius\nof convergence. -/\nnoncomputable def binomialSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) :\n FormalMultilinearSeries \ud835\udd42 \ud835\udd38 \ud835\udd38 :=\n .ofScalars \ud835\udd38 (Ring.choose a \u00b7)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)\ntheorem binomialSeries_radius_eq_one {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} (ha : \u2200 (k : \u2115), a \u2260 k) : (binomialSeries \ud835\udd38 a).radius = 1 := by\nsimp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n FormalMultilinearSeries.radius_compNeg]\n conv at ha => ext; rw [ne_comm]\n exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_hasFPowerSeriesOnBall_zero (L204-L207)\ntheorem one_div_one_sub_hasFPowerSeriesOnBall_zero :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x : \u2102)) (.ofScalars (\ud835\udd5c := \u2102) \u2102 1) 0 1 := by\nsimpa using one_div_sub_hasFPowerSeriesOnBall_zero (z := 1)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)\ntheorem one_add_cpow_hasFPowerSeriesAt_zero {a : \u2102} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 :=\none_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialAt_const (L40-L42)\ntheorem CPolynomialAt_const {v : F} : CPolynomialAt \ud835\udd5c (fun _ => v) x :=\n\u27e8constFormalMultilinearSeries \ud835\udd5c E v, 1, hasFiniteFPowerSeriesAt_const\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)\ntheorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : \u2102} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 1 := by\nsuffices (binomialSeries \u2102 a = FormalMultilinearSeries.ofScalars \u2102\n fun n \u21a6 iteratedDeriv n (fun (x : \u2102) \u21a6 (1 + x) ^ a) 0 / n !) by\n convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _\n \u00b7 norm_num\n \u00b7 -- TODO: use `fun_prop` for this subgoal\n apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const\n intro z hz\n apply Complex.mem_slitPlane_of_norm_lt_one\n rw [\u2190 ENNReal.ofReal_one, Metric.eball_ofReal] at hz\n simpa using hz\n \u00b7 rw [\u2190 this]\n exact binomialSeries_radius_ge_one\n simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]\n ext n\n rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), \u2190 nsmul_eq_mul',\n \u2190 Ring.descPochhammer_eq_factorial_smul_choose]\n let B := Metric.ball (0 : \u2102) 1\n suffices Set.EqOn (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B)\n (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - n)) B by\n specialize this (show 0 \u2208 _ by simp [B])\n rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this\n symm\n simpa using this\n induction n with\n | zero => simp [Set.EqOn]\n | succ n ih =>\n have : iteratedDerivWithin (n + 1) (fun (x : \u2102) \u21a6 (1 + x) ^ a) B =\n derivWithin (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B) B := by\n ext z\n rw [iteratedDerivWithin_succ]\n rw [this]\n have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : \u2102) \u21a6 (1 + x) ^ a) B) B)\n (derivWithin (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - \u2191n)) B) B := by\n intro z hz\n rw [derivWithin_congr (fun _ hz \u21a6 ih hz) (ih hz)]\n apply Set.EqOn.trans this\n intro z hz\n simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,\n deriv_const_mul_field']\n rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,\n show a - (n + 1) = a - n - 1 by ring, \u2190 mul_assoc]\n \u00b7 congr\n simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]\n \u00b7 apply Complex.mem_slitPlane_of_norm_lt_one\n simpa [B] using hz\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Analytic.CPolynomial.HasFiniteFPowerSeriesOnBall (L47-L53)\ntheorem HasFiniteFPowerSeriesOnBall.add (hf : HasFiniteFPowerSeriesOnBall f pf x n r)\n (hg : HasFiniteFPowerSeriesOnBall g pg x m r) :\n HasFiniteFPowerSeriesOnBall (f + g) (pf + pg) x (max n m) r :=\n\u27e8hf.1.add hg.1, fun N hN \u21a6 by\n rw [Pi.add_apply, hf.finite _ ((le_max_left n m).trans hN),\n hg.finite _ ((le_max_right n m).trans hN), zero_add]\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (L171-L178)\ntheorem one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (a : \u2115) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ (a + 1))\n (.ofScalars \u2102 (\ud835\udd5c := \u2102) fun n \u21a6 \u2191(Nat.choose (a + n) a)) 0 1 := by\nconvert one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a + 1) using 3 with z n\n \u00b7 norm_cast\n \u00b7 rw [eq_comm, add_right_comm, add_sub_cancel_right, \u2190 Nat.cast_add,\n Ring.choose_natCast, Nat.choose_symm_add]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)\ntheorem binomialSeries_radius_eq_top_of_nat {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u}\n [NormedDivisionRing \ud835\udd38] [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \u2115} :\n (binomialSeries \ud835\udd38 (a : \ud835\udd42)).radius = \u22a4 := by\nsimp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n ordinaryHypergeometric_radius_top_of_neg_nat\u2081]\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `1`, when `a` is not natural. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Analytic/Basic.lean", "module": "Mathlib.Analysis.Analytic.Basic", "declaration": "Mathlib.Analysis.Analytic.Basic.AnalyticOn", "span": "L535-L545", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Analytic/Basic.lean#L535"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 7908, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 20482, "lean_code_chars": 18982, "natural_language_chars": 1500, "lean_code_ratio": 0.9268, "line_count": 501, "imports_count": 0, "declarations_count": 1814, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "72570434f6e272c8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Analytic.Order.analyticOrderAt_deriv_of_pos", "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.Analysis.Analytic.Order)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma analyticOrderAt_deriv_of_pos {\ud835\udd5c : Type*} {E : Type*} [NontriviallyNormedField \ud835\udd5c] [CharZero \ud835\udd5c]\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] [CompleteSpace E] {f : \ud835\udd5c \u2192 E} {z\u2080 : \ud835\udd5c}\n (hf : AnalyticAt \ud835\udd5c f z\u2080) {n : \u2115} (horder : analyticOrderAt f z\u2080 = n + 1) :\n analyticOrderAt (deriv f) z\u2080 = n\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_of_not_analyticAt (L65-L67)\nlemma analyticOrderAt_of_not_analyticAt (hf : \u00ac AnalyticAt \ud835\udd5c f z\u2080) : analyticOrderAt f z\u2080 = 0 :=\ndif_neg hf\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderNatAt_of_not_analyticAt (L69-L71)\nlemma analyticOrderNatAt_of_not_analyticAt (hf : \u00ac AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderNatAt f z\u2080 = 0 := by simp [analyticOrderNatAt, hf]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_eq_top (L76-L79)\nlemma analyticOrderAt_eq_top : analyticOrderAt f z\u2080 = \u22a4 \u2194 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = 0 where\n mp hf := by unfold analyticOrderAt at hf; split_ifs at hf with h <;> simp [*] at *\nmpr hf := by unfold analyticOrderAt; simp [hf, analyticAt_congr hf, analyticAt_const]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.Order.eventuallyConst_iff_analyticOrderAt_sub_eq_top (L80-L86)\nlemma eventuallyConst_iff_analyticOrderAt_sub_eq_top :\n EventuallyConst f (\ud835\udcdd z\u2080) \u2194 analyticOrderAt (f \u00b7 - f z\u2080) z\u2080 = \u22a4 := by\nsimpa [eventuallyConst_iff_exists_eventuallyEq, analyticOrderAt_eq_top, sub_eq_zero]\n using \u27e8fun \u27e8c, hc\u27e9 \u21a6 (show f z\u2080 = c from hc.self_of_nhds) \u25b8 hc, fun h \u21a6 \u27e8_, h\u27e9\u27e9\n\n/-- The order of an analytic function `f` at `z\u2080` equals a natural number `n` iff `f` can locally\nbe written as `f z = (z - z\u2080) ^ n \u2022 g z`, where `g` is analytic and does not vanish at `z\u2080`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.Order.AnalyticAt (L87-L101)\nlemma AnalyticAt.analyticOrderAt_eq_natCast (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 = n \u2194\n \u2203 (g : \ud835\udd5c \u2192 E), AnalyticAt \ud835\udd5c g z\u2080 \u2227 g z\u2080 \u2260 0 \u2227 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = (z - z\u2080) ^ n \u2022 g z := by\nunfold analyticOrderAt\n split_ifs with h\n \u00b7 simp only [ENat.top_ne_coe, false_iff]\n contrapose h\n rw [\u2190 hf.exists_eventuallyEq_pow_smul_nonzero_iff]\n exact \u27e8n, h\u27e9\n \u00b7 rw [\u2190 hf.exists_eventuallyEq_pow_smul_nonzero_iff] at h\n refine \u27e8fun hn \u21a6 (WithTop.coe_inj.mp hn : h.choose = n) \u25b8 h.choose_spec, fun h' \u21a6 ?_\u27e9\n rw [AnalyticAt.unique_eventuallyEq_pow_smul_nonzero h.choose_spec h']\n\n/-- The order of an analytic function `f` at `z\u2080` equals a natural number `n` iff `f` can locally\nbe written as `f z = (z - z\u2080) ^ n \u2022 g z`, where `g` is analytic and does not vanish at `z\u2080`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.Order.AnalyticAt (L102-L113)\nlemma AnalyticAt.analyticOrderNatAt_eq_iff (hf : AnalyticAt \ud835\udd5c f z\u2080) (hf' : analyticOrderAt f z\u2080 \u2260 \u22a4)\n {n : \u2115} :\n analyticOrderNatAt f z\u2080 = n \u2194\n \u2203 (g : \ud835\udd5c \u2192 E), AnalyticAt \ud835\udd5c g z\u2080 \u2227 g z\u2080 \u2260 0 \u2227 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = (z - z\u2080) ^ n \u2022 g z := by\nsimp [\u2190 Nat.cast_inj (R := \u2115\u221e), Nat.cast_analyticOrderNatAt hf', hf.analyticOrderAt_eq_natCast]\n\n/-- The order of an analytic function `f` at `z\u2080` is finite iff `f` can locally be written as `f z =\n (z - z\u2080) ^ analyticOrderNatAt f z\u2080 \u2022 g z`, where `g` is analytic and does not vanish at `z\u2080`.\n\nSee `MeromorphicNFAt.order_eq_zero_iff` for an analogous statement about meromorphic functions in\nnormal form.\n-/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.Order.AnalyticAt (L114-L120)\nlemma AnalyticAt.analyticOrderAt_ne_top (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 \u2260 \u22a4 \u2194\n \u2203 (g : \ud835\udd5c \u2192 E), AnalyticAt \ud835\udd5c g z\u2080 \u2227 g z\u2080 \u2260 0 \u2227\n f =\u1da0[\ud835\udcdd z\u2080] fun z \u21a6 (z - z\u2080) ^ analyticOrderNatAt f z\u2080 \u2022 g z := by\nsimp only [\u2190 ENat.coe_toNat_eq_self, Eq.comm, EventuallyEq, \u2190 hf.analyticOrderAt_eq_natCast,\n analyticOrderNatAt]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_eq_zero (L121-L129)\nlemma analyticOrderAt_eq_zero : analyticOrderAt f z\u2080 = 0 \u2194 \u00ac AnalyticAt \ud835\udd5c f z\u2080 \u2228 f z\u2080 \u2260 0 := by\nby_cases hf : AnalyticAt \ud835\udd5c f z\u2080\n \u00b7 rw [\u2190 ENat.coe_zero, hf.analyticOrderAt_eq_natCast]\n constructor\n \u00b7 intro \u27e8g, _, _, hg\u27e9\n simpa [hf, hg.self_of_nhds]\n \u00b7 exact fun hz \u21a6 \u27e8f, hf, hz.resolve_left <| not_not_intro hf, by simp\u27e9\n \u00b7 simp [hf]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_ne_zero (L130-L141)\nlemma analyticOrderAt_ne_zero : analyticOrderAt f z\u2080 \u2260 0 \u2194 AnalyticAt \ud835\udd5c f z\u2080 \u2227 f z\u2080 = 0 := by\nsimp [analyticOrderAt_eq_zero]\n\n/-- The order of an analytic function `f` at `z\u2080` is zero iff `f` does not vanish at `z\u2080`. -/\nprotected lemma AnalyticAt.analyticOrderAt_eq_zero (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 = 0 \u2194 f z\u2080 \u2260 0 := by simp [hf, analyticOrderAt_eq_zero]\n\n/-- The order of an analytic function `f` at `z\u2080` is zero iff `f` does not vanish at `z\u2080`. -/\nprotected lemma AnalyticAt.analyticOrderAt_ne_zero (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 \u2260 0 \u2194 f z\u2080 = 0 := hf.analyticOrderAt_eq_zero.not_left\n\n/-- A function vanishes at a point if its analytic order is nonzero in `\u2115\u221e`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Order.apply_eq_zero_of_analyticOrderAt_ne_zero (L142-L146)\nlemma apply_eq_zero_of_analyticOrderAt_ne_zero (hf : analyticOrderAt f z\u2080 \u2260 0) :\n f z\u2080 = 0 := by\nby_cases hf' : AnalyticAt \ud835\udd5c f z\u2080 <;> simp_all [analyticOrderAt_eq_zero]\n\n/-- A function vanishes at a point if its analytic order is nonzero when converted to \u2115. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Order.apply_eq_zero_of_analyticOrderNatAt_ne_zero (L147-L152)\nlemma apply_eq_zero_of_analyticOrderNatAt_ne_zero (hf : analyticOrderNatAt f z\u2080 \u2260 0) :\n f z\u2080 = 0 := by\nby_cases hf' : AnalyticAt \ud835\udd5c f z\u2080 <;> simp_all [analyticOrderNatAt, analyticOrderAt_eq_zero]\n\n/-- Characterization of which natural numbers are `\u2264 hf.order`. Useful for avoiding case splits,\nsince it applies whether or not the order is `\u221e`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Analytic.Order.natCast_le_analyticOrderAt (L153-L175)\nlemma natCast_le_analyticOrderAt (hf : AnalyticAt \ud835\udd5c f z\u2080) {n : \u2115} :\n n \u2264 analyticOrderAt f z\u2080 \u2194\n \u2203 g, AnalyticAt \ud835\udd5c g z\u2080 \u2227 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = (z - z\u2080) ^ n \u2022 g z := by\nunfold analyticOrderAt\n split_ifs with h\n \u00b7 simpa using \u27e80, analyticAt_const .., by simpa\u27e9\n \u00b7 let m := (hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose\n obtain \u27e8g, hg, hg_ne, hm\u27e9 := (hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose_spec\n rw [ENat.coe_le_coe]\n refine \u27e8fun hmn \u21a6 \u27e8fun z \u21a6 (z - z\u2080) ^ (m - n) \u2022 g z, by fun_prop, ?_\u27e9, fun \u27e8h, hh, hfh\u27e9 \u21a6 ?_\u27e9\n \u00b7 filter_upwards [hm] with z hz using by rwa [\u2190 mul_smul, \u2190 pow_add, Nat.add_sub_of_le hmn]\n \u00b7 contrapose! hg_ne\n have : ContinuousAt (fun z \u21a6 (z - z\u2080) ^ (n - m) \u2022 h z) z\u2080 := by fun_prop\n rw [tendsto_nhds_unique_of_eventuallyEq (l := \ud835\udcdd[\u2260] z\u2080)\n hg.continuousAt.continuousWithinAt this.continuousWithinAt ?_]\n \u00b7 simp [m, Nat.sub_ne_zero_of_lt hg_ne]\n \u00b7 filter_upwards [self_mem_nhdsWithin, hm.filter_mono nhdsWithin_le_nhds,\n hfh.filter_mono nhdsWithin_le_nhds] with z hz hf' hf''\n rw [\u2190 inv_smul_eq_iff\u2080 (pow_ne_zero _ <| sub_ne_zero_of_ne hz), hf'', smul_comm,\n \u2190 mul_smul] at hf'\n rw [pow_sub\u2080 _ (sub_ne_zero_of_ne hz) (by lia), \u2190 hf']\n\n/-- If two functions agree in a neighborhood of `z\u2080`, then their orders at `z\u2080` agree. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_congr (L176-L185)\nlemma analyticOrderAt_congr (hfg : f =\u1da0[\ud835\udcdd z\u2080] g) :\n analyticOrderAt f z\u2080 = analyticOrderAt g z\u2080 := by\nby_cases hf : AnalyticAt \ud835\udd5c f z\u2080\n \u00b7 refine ENat.eq_of_forall_natCast_le_iff fun n \u21a6 ?_\n simp only [natCast_le_analyticOrderAt, hf, hf.congr hfg]\n congr! 3\n exact hfg.congr_left\n \u00b7 rw [analyticOrderAt_of_not_analyticAt hf,\n analyticOrderAt_of_not_analyticAt fun hg \u21a6 hf <| hg.congr hfg.symm]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Order.le_analyticOrderAt_add (L198-L208)\ntheorem le_analyticOrderAt_add :\n min (analyticOrderAt f z\u2080) (analyticOrderAt g z\u2080) \u2264 analyticOrderAt (f + g) z\u2080 := by\nby_cases hf : AnalyticAt \ud835\udd5c f z\u2080\n \u00b7 by_cases hg : AnalyticAt \ud835\udd5c g z\u2080\n \u00b7 refine ENat.forall_natCast_le_iff_le.mp fun n \u21a6 ?_\n simp only [le_min_iff, natCast_le_analyticOrderAt, hf, hg, hf.add hg]\n refine fun \u27e8\u27e8F, hF, hF'\u27e9, \u27e8G, hG, hG'\u27e9\u27e9 \u21a6 \u27e8F + G, hF.add hG, ?_\u27e9\n filter_upwards [hF', hG'] with z using by simp +contextual\n \u00b7 simp [*]\n \u00b7 simp [*]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Analytic.Order.le_analyticOrderAt_sub (L209-L212)\nlemma le_analyticOrderAt_sub :\n min (analyticOrderAt f z\u2080) (analyticOrderAt g z\u2080) \u2264 analyticOrderAt (f - g) z\u2080 := by\nsimpa [sub_eq_add_neg] using le_analyticOrderAt_add (f := f) (g := -g)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Analytic.Basic.ContinuousLinearMap (L546-L557)\ntheorem ContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall (g : F \u2192L[\ud835\udd5c] G)\n (h : HasFPowerSeriesWithinOnBall f p s x r) :\n HasFPowerSeriesWithinOnBall (g \u2218 f) (g.compFormalMultilinearSeries p) s x r where\n r_le := h.r_le.trans (p.radius_le_radius_continuousLinearMap_comp _)\nr_pos := h.r_pos\n hasSum hy h'y := by\n simpa only [ContinuousLinearMap.compFormalMultilinearSeries_apply,\n ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply] using\n g.hasSum (h.hasSum hy h'y)\n\n/-- If a function `f` has a power series `p` on a ball and `g` is linear, then `g \u2218 f` has the\npower series `g \u2218 p` on the same ball. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesWithinAt f p s x\n\n/-- Given a function `f : E \u2192 F`, we say that `f` is analytic on a set `s` if it is analytic around\nevery point of `s`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOn (L123-L131)\ndef AnalyticOn (f : E \u2192 F) (s : Set E) : Prop :=\n\u2200 x \u2208 s, AnalyticWithinAt \ud835\udd5c f s x\n\n/-!\n### `HasFPowerSeriesOnBall` and `HasFPowerSeriesWithinOnBall`\n-/\n\nvariable {\ud835\udd5c}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E) :=\n\u2203 r, HasFPowerSeriesWithinOnBall f p s x r\n\n-- Teach the `bound` tactic that power series have positive radius\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)\ntheorem binomialSeries_radius_eq_top_of_nat {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u}\n [NormedDivisionRing \ud835\udd38] [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \u2115} :\n (binomialSeries \ud835\udd38 (a : \ud835\udd42)).radius = \u22a4 := by\nsimp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n ordinaryHypergeometric_radius_top_of_neg_nat\u2081]\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `1`, when `a` is not natural. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff (L1106-L1127)\ntheorem hasFPowerSeriesAt_iff :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd 0, HasSum (fun n => z ^ n \u2022 p.coeff n) (f (z\u2080 + z)) := by\nrefine \u27e8fun \u27e8r, _, r_pos, h\u27e9 =>\n eventually_of_mem (Metric.eball_mem_nhds 0 r_pos) fun _ => by simpa using h, ?_\u27e9\n simp only [Metric.eventually_nhds_iff]\n rintro \u27e8r, r_pos, h\u27e9\n refine \u27e8p.radius \u2293 r.toNNReal, by simp, ?_, ?_\u27e9\n \u00b7 simp only [r_pos.lt, lt_inf_iff, ENNReal.coe_pos, Real.toNNReal_pos, and_true]\n obtain \u27e8z, z_pos, le_z\u27e9 := NormedField.exists_norm_lt \ud835\udd5c r_pos.lt\n have : (\u2016z\u2016\u208a : ENNReal) \u2264 p.radius := by\n simp only [dist_zero_right] at h\n apply FormalMultilinearSeries.le_radius_of_tendsto\n convert tendsto_norm.comp (h le_z).summable.tendsto_atTop_zero\n simp [norm_smul, mul_comm]\n refine lt_of_lt_of_le ?_ this\n simp only [ENNReal.coe_pos]\n exact zero_lt_iff.mpr (nnnorm_ne_zero_iff.mpr (norm_pos_iff.mp z_pos))\n \u00b7 simp only [Metric.mem_eball, lt_inf_iff, edist_lt_coe, apply_eq_pow_smul_coeff, and_imp,\n dist_zero_right] at h \u22a2\n refine fun {y} _ hyr => h ?_\n simpa [nndist_eq_nnnorm, Real.lt_toNNReal_iff_coe_lt] using hyr\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)\ntheorem one_add_cpow_hasFPowerSeriesAt_zero {a : \u2102} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 :=\none_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)\ntheorem binomialSeries_apply {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) {n} (v : Fin n \u2192 \ud835\udd38) :\n binomialSeries \ud835\udd38 a n v = Ring.choose a n \u2022 (List.ofFn v).prod := by\nsimp [binomialSeries, FormalMultilinearSeries.ofScalars]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)\nlemma Complex.ofReal_choose (a : \u211d) (n : \u2115) :\n \u2191(Ring.choose a n) = Ring.choose (a : \u2102) n :=\nRing.map_choose (algebraMap \u211d \u2102) _ _\n\n/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given\nby `Ring.choose a`. The sum of this series is `fun x \u21a6 (1 + x) ^ a` within the radius\nof convergence. -/\nnoncomputable def binomialSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) :\n FormalMultilinearSeries \ud835\udd42 \ud835\udd38 \ud835\udd38 :=\n .ofScalars \ud835\udd38 (Ring.choose a \u00b7)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)\ntheorem binomialSeries_radius_ge_one {\ud835\udd42 : Type*} [RCLike \ud835\udd42] {\ud835\udd38 : Type*} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} :\n 1 \u2264 (binomialSeries \ud835\udd38 a).radius := by\nby_cases ha : \u2200 (k : \u2115), a \u2260 k\n \u00b7 rw [binomialSeries_radius_eq_one ha]\n \u00b7 push Not at ha\n rcases ha with \u27e8k, rfl\u27e9\n simp [binomialSeries_radius_eq_top_of_nat]\n\nnamespace Complex\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E) :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesAt f p x\n\n/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `\ud835\udcdd[s] x` -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr' (L506-L508)\ntheorem analyticOnNhd_congr' (h : f =\u1da0[\ud835\udcdd\u02e2 s] g) : AnalyticOnNhd \ud835\udd5c f s \u2194 AnalyticOnNhd \ud835\udd5c g s :=\n\u27e8fun hf => hf.congr' h, fun hg => hg.congr' h.symm\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff' (L1128-L1132)\ntheorem hasFPowerSeriesAt_iff' :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd z\u2080, HasSum (fun n => (z - z\u2080) ^ n \u2022 p.coeff n) (f z) := by\nrw [\u2190 map_add_left_nhds_zero, eventually_map, hasFPowerSeriesAt_iff]\n simp_rw [add_sub_cancel_left]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)\ntheorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave H : ((binomialSeries \u2102 (-a)).compContinuousLinearMap (-1)) =\n .ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n := by\n ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,\n Units.smul_def, \u2190 pow_add, \u2190 mul_assoc]\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (-a)) (binomialSeries \u2102 (-a : \u2102)) (-0) 1 := by\n simpa using one_add_cpow_hasFPowerSeriesOnBall_zero\n simpa [cpow_neg, Function.comp_def, \u2190 sub_eq_add_neg, H] using\n this.compContinuousLinearMap (u := -1) (x := (0 : \u2102))\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)\ntheorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : \u2102} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 1 := by\nsuffices (binomialSeries \u2102 a = FormalMultilinearSeries.ofScalars \u2102\n fun n \u21a6 iteratedDeriv n (fun (x : \u2102) \u21a6 (1 + x) ^ a) 0 / n !) by\n convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _\n \u00b7 norm_num\n \u00b7 -- TODO: use `fun_prop` for this subgoal\n apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const\n intro z hz\n apply Complex.mem_slitPlane_of_norm_lt_one\n rw [\u2190 ENNReal.ofReal_one, Metric.eball_ofReal] at hz\n simpa using hz\n \u00b7 rw [\u2190 this]\n exact binomialSeries_radius_ge_one\n simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]\n ext n\n rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), \u2190 nsmul_eq_mul',\n \u2190 Ring.descPochhammer_eq_factorial_smul_choose]\n let B := Metric.ball (0 : \u2102) 1\n suffices Set.EqOn (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B)\n (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - n)) B by\n specialize this (show 0 \u2208 _ by simp [B])\n rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this\n symm\n simpa using this\n induction n with\n | zero => simp [Set.EqOn]\n | succ n ih =>\n have : iteratedDerivWithin (n + 1) (fun (x : \u2102) \u21a6 (1 + x) ^ a) B =\n derivWithin (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B) B := by\n ext z\n rw [iteratedDerivWithin_succ]\n rw [this]\n have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : \u2102) \u21a6 (1 + x) ^ a) B) B)\n (derivWithin (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - \u2191n)) B) B := by\n intro z hz\n rw [derivWithin_congr (fun _ hz \u21a6 ih hz) (ih hz)]\n apply Set.EqOn.trans this\n intro z hz\n simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,\n deriv_const_mul_field']\n rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,\n show a - (n + 1) = a - n - 1 by ring, \u2190 mul_assoc]\n \u00b7 congr\n simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]\n \u00b7 apply Complex.mem_slitPlane_of_norm_lt_one\n simpa [B] using hz\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticAt_congr (L495-L497)\ntheorem analyticAt_congr (h : f =\u1da0[\ud835\udcdd x] g) : AnalyticAt \ud835\udd5c f x \u2194 AnalyticAt \ud835\udd5c g x :=\n\u27e8fun hf \u21a6 hf.congr h, fun hg \u21a6 hg.congr h.symm\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E) :=\n\u2203 r, HasFPowerSeriesOnBall f p x r\n\n/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOn_congr (L488-L490)\nlemma analyticOn_congr (hs : EqOn f g s) : AnalyticOn \ud835\udd5c f s \u2194 AnalyticOn \ud835\udd5c g s :=\n\u27e8fun h \u21a6 h.congr hs.symm, fun h \u21a6 h.congr hs\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr (L514-L516)\ntheorem analyticOnNhd_congr (hs : IsOpen s) (h : s.EqOn f g) : AnalyticOnNhd \ud835\udd5c f s \u2194\n AnalyticOnNhd \ud835\udd5c g s := \u27e8fun hf => hf.congr hs h, fun hg => hg.congr hs h.symm\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)\ntheorem binomialSeries_radius_eq_one {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} (ha : \u2200 (k : \u2115), a \u2260 k) : (binomialSeries \ud835\udd38 a).radius = 1 := by\nsimp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n FormalMultilinearSeries.radius_compNeg]\n conv at ha => ext; rw [ne_comm]\n exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E) :=\n\u2200 x, x \u2208 s \u2192 AnalyticAt \ud835\udd5c f x\n\n/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that\nthis is weaker than `AnalyticOnNhd \ud835\udd5c f s`, as `f` is allowed to be arbitrary outside `s`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesWithinAt_iff_of_nhds (L391-L397)\nlemma hasFPowerSeriesWithinAt_iff_of_nhds (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F)\n {U : Set E} (hU : U \u2208 \ud835\udcdd x) :\n HasFPowerSeriesWithinAt f p U x \u2194 HasFPowerSeriesAt f p x := by\nrw [\u2190 hasFPowerSeriesWithinAt_univ]\n exact \u27e8fun h \u21a6 h.mono_of_mem_nhdsWithin (mem_nhdsWithin_of_mem_nhds hU),\n fun h \u21a6 h.mono (subset_univ _)\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)\ntheorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :\n HasFPowerSeriesAt f p x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)\ntheorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt\n (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)\ntheorem binomialSeries_eq_ordinaryHypergeometricSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42]\n {\ud835\udd38 : Type v} [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] {a b : \ud835\udd42}\n (h : \u2200 (k : \u2115), (k : \ud835\udd42) \u2260 -b) :\n binomialSeries \ud835\udd38 a =\n (ordinaryHypergeometricSeries \ud835\udd38 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by\nsimp only [binomialSeries, ordinaryHypergeometricSeries,\n FormalMultilinearSeries.ofScalars_comp_neg_id]\n congr! with n\n rw [ordinaryHypergeometricCoefficient,\n mul_inv_cancel_right\u2080 (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]\n simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,\n Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,\n ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]\n ring_nf\n simp\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `\u22a4` for natural `a`. -/\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.Analysis.Analytic.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma analyticOrderAt_deriv_of_pos {\ud835\udd5c : Type*} {E : Type*} [NontriviallyNormedField \ud835\udd5c] [CharZero \ud835\udd5c]\n [NormedAddCommGroup E] [NormedSpace \ud835\udd5c E] [CompleteSpace E] {f : \ud835\udd5c \u2192 E} {z\u2080 : \ud835\udd5c}\n (hf : AnalyticAt \ud835\udd5c f z\u2080) {n : \u2115} (horder : analyticOrderAt f z\u2080 = n + 1) :\n analyticOrderAt (deriv f) z\u2080 = n\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_of_not_analyticAt (L65-L67)\nlemma analyticOrderAt_of_not_analyticAt (hf : \u00ac AnalyticAt \ud835\udd5c f z\u2080) : analyticOrderAt f z\u2080 = 0 :=\ndif_neg hf\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderNatAt_of_not_analyticAt (L69-L71)\nlemma analyticOrderNatAt_of_not_analyticAt (hf : \u00ac AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderNatAt f z\u2080 = 0 := by simp [analyticOrderNatAt, hf]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_eq_top (L76-L79)\nlemma analyticOrderAt_eq_top : analyticOrderAt f z\u2080 = \u22a4 \u2194 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = 0 where\n mp hf := by unfold analyticOrderAt at hf; split_ifs at hf with h <;> simp [*] at *\nmpr hf := by unfold analyticOrderAt; simp [hf, analyticAt_congr hf, analyticAt_const]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.Order.eventuallyConst_iff_analyticOrderAt_sub_eq_top (L80-L86)\nlemma eventuallyConst_iff_analyticOrderAt_sub_eq_top :\n EventuallyConst f (\ud835\udcdd z\u2080) \u2194 analyticOrderAt (f \u00b7 - f z\u2080) z\u2080 = \u22a4 := by\nsimpa [eventuallyConst_iff_exists_eventuallyEq, analyticOrderAt_eq_top, sub_eq_zero]\n using \u27e8fun \u27e8c, hc\u27e9 \u21a6 (show f z\u2080 = c from hc.self_of_nhds) \u25b8 hc, fun h \u21a6 \u27e8_, h\u27e9\u27e9\n\n/-- The order of an analytic function `f` at `z\u2080` equals a natural number `n` iff `f` can locally\nbe written as `f z = (z - z\u2080) ^ n \u2022 g z`, where `g` is analytic and does not vanish at `z\u2080`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.Order.AnalyticAt (L87-L101)\nlemma AnalyticAt.analyticOrderAt_eq_natCast (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 = n \u2194\n \u2203 (g : \ud835\udd5c \u2192 E), AnalyticAt \ud835\udd5c g z\u2080 \u2227 g z\u2080 \u2260 0 \u2227 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = (z - z\u2080) ^ n \u2022 g z := by\nunfold analyticOrderAt\n split_ifs with h\n \u00b7 simp only [ENat.top_ne_coe, false_iff]\n contrapose h\n rw [\u2190 hf.exists_eventuallyEq_pow_smul_nonzero_iff]\n exact \u27e8n, h\u27e9\n \u00b7 rw [\u2190 hf.exists_eventuallyEq_pow_smul_nonzero_iff] at h\n refine \u27e8fun hn \u21a6 (WithTop.coe_inj.mp hn : h.choose = n) \u25b8 h.choose_spec, fun h' \u21a6 ?_\u27e9\n rw [AnalyticAt.unique_eventuallyEq_pow_smul_nonzero h.choose_spec h']\n\n/-- The order of an analytic function `f` at `z\u2080` equals a natural number `n` iff `f` can locally\nbe written as `f z = (z - z\u2080) ^ n \u2022 g z`, where `g` is analytic and does not vanish at `z\u2080`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.Order.AnalyticAt (L102-L113)\nlemma AnalyticAt.analyticOrderNatAt_eq_iff (hf : AnalyticAt \ud835\udd5c f z\u2080) (hf' : analyticOrderAt f z\u2080 \u2260 \u22a4)\n {n : \u2115} :\n analyticOrderNatAt f z\u2080 = n \u2194\n \u2203 (g : \ud835\udd5c \u2192 E), AnalyticAt \ud835\udd5c g z\u2080 \u2227 g z\u2080 \u2260 0 \u2227 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = (z - z\u2080) ^ n \u2022 g z := by\nsimp [\u2190 Nat.cast_inj (R := \u2115\u221e), Nat.cast_analyticOrderNatAt hf', hf.analyticOrderAt_eq_natCast]\n\n/-- The order of an analytic function `f` at `z\u2080` is finite iff `f` can locally be written as `f z =\n (z - z\u2080) ^ analyticOrderNatAt f z\u2080 \u2022 g z`, where `g` is analytic and does not vanish at `z\u2080`.\n\nSee `MeromorphicNFAt.order_eq_zero_iff` for an analogous statement about meromorphic functions in\nnormal form.\n-/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.Order.AnalyticAt (L114-L120)\nlemma AnalyticAt.analyticOrderAt_ne_top (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 \u2260 \u22a4 \u2194\n \u2203 (g : \ud835\udd5c \u2192 E), AnalyticAt \ud835\udd5c g z\u2080 \u2227 g z\u2080 \u2260 0 \u2227\n f =\u1da0[\ud835\udcdd z\u2080] fun z \u21a6 (z - z\u2080) ^ analyticOrderNatAt f z\u2080 \u2022 g z := by\nsimp only [\u2190 ENat.coe_toNat_eq_self, Eq.comm, EventuallyEq, \u2190 hf.analyticOrderAt_eq_natCast,\n analyticOrderNatAt]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_eq_zero (L121-L129)\nlemma analyticOrderAt_eq_zero : analyticOrderAt f z\u2080 = 0 \u2194 \u00ac AnalyticAt \ud835\udd5c f z\u2080 \u2228 f z\u2080 \u2260 0 := by\nby_cases hf : AnalyticAt \ud835\udd5c f z\u2080\n \u00b7 rw [\u2190 ENat.coe_zero, hf.analyticOrderAt_eq_natCast]\n constructor\n \u00b7 intro \u27e8g, _, _, hg\u27e9\n simpa [hf, hg.self_of_nhds]\n \u00b7 exact fun hz \u21a6 \u27e8f, hf, hz.resolve_left <| not_not_intro hf, by simp\u27e9\n \u00b7 simp [hf]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_ne_zero (L130-L141)\nlemma analyticOrderAt_ne_zero : analyticOrderAt f z\u2080 \u2260 0 \u2194 AnalyticAt \ud835\udd5c f z\u2080 \u2227 f z\u2080 = 0 := by\nsimp [analyticOrderAt_eq_zero]\n\n/-- The order of an analytic function `f` at `z\u2080` is zero iff `f` does not vanish at `z\u2080`. -/\nprotected lemma AnalyticAt.analyticOrderAt_eq_zero (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 = 0 \u2194 f z\u2080 \u2260 0 := by simp [hf, analyticOrderAt_eq_zero]\n\n/-- The order of an analytic function `f` at `z\u2080` is zero iff `f` does not vanish at `z\u2080`. -/\nprotected lemma AnalyticAt.analyticOrderAt_ne_zero (hf : AnalyticAt \ud835\udd5c f z\u2080) :\n analyticOrderAt f z\u2080 \u2260 0 \u2194 f z\u2080 = 0 := hf.analyticOrderAt_eq_zero.not_left\n\n/-- A function vanishes at a point if its analytic order is nonzero in `\u2115\u221e`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Order.apply_eq_zero_of_analyticOrderAt_ne_zero (L142-L146)\nlemma apply_eq_zero_of_analyticOrderAt_ne_zero (hf : analyticOrderAt f z\u2080 \u2260 0) :\n f z\u2080 = 0 := by\nby_cases hf' : AnalyticAt \ud835\udd5c f z\u2080 <;> simp_all [analyticOrderAt_eq_zero]\n\n/-- A function vanishes at a point if its analytic order is nonzero when converted to \u2115. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Order.apply_eq_zero_of_analyticOrderNatAt_ne_zero (L147-L152)\nlemma apply_eq_zero_of_analyticOrderNatAt_ne_zero (hf : analyticOrderNatAt f z\u2080 \u2260 0) :\n f z\u2080 = 0 := by\nby_cases hf' : AnalyticAt \ud835\udd5c f z\u2080 <;> simp_all [analyticOrderNatAt, analyticOrderAt_eq_zero]\n\n/-- Characterization of which natural numbers are `\u2264 hf.order`. Useful for avoiding case splits,\nsince it applies whether or not the order is `\u221e`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Analytic.Order.natCast_le_analyticOrderAt (L153-L175)\nlemma natCast_le_analyticOrderAt (hf : AnalyticAt \ud835\udd5c f z\u2080) {n : \u2115} :\n n \u2264 analyticOrderAt f z\u2080 \u2194\n \u2203 g, AnalyticAt \ud835\udd5c g z\u2080 \u2227 \u2200\u1da0 z in \ud835\udcdd z\u2080, f z = (z - z\u2080) ^ n \u2022 g z := by\nunfold analyticOrderAt\n split_ifs with h\n \u00b7 simpa using \u27e80, analyticAt_const .., by simpa\u27e9\n \u00b7 let m := (hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose\n obtain \u27e8g, hg, hg_ne, hm\u27e9 := (hf.exists_eventuallyEq_pow_smul_nonzero_iff.mpr h).choose_spec\n rw [ENat.coe_le_coe]\n refine \u27e8fun hmn \u21a6 \u27e8fun z \u21a6 (z - z\u2080) ^ (m - n) \u2022 g z, by fun_prop, ?_\u27e9, fun \u27e8h, hh, hfh\u27e9 \u21a6 ?_\u27e9\n \u00b7 filter_upwards [hm] with z hz using by rwa [\u2190 mul_smul, \u2190 pow_add, Nat.add_sub_of_le hmn]\n \u00b7 contrapose! hg_ne\n have : ContinuousAt (fun z \u21a6 (z - z\u2080) ^ (n - m) \u2022 h z) z\u2080 := by fun_prop\n rw [tendsto_nhds_unique_of_eventuallyEq (l := \ud835\udcdd[\u2260] z\u2080)\n hg.continuousAt.continuousWithinAt this.continuousWithinAt ?_]\n \u00b7 simp [m, Nat.sub_ne_zero_of_lt hg_ne]\n \u00b7 filter_upwards [self_mem_nhdsWithin, hm.filter_mono nhdsWithin_le_nhds,\n hfh.filter_mono nhdsWithin_le_nhds] with z hz hf' hf''\n rw [\u2190 inv_smul_eq_iff\u2080 (pow_ne_zero _ <| sub_ne_zero_of_ne hz), hf'', smul_comm,\n \u2190 mul_smul] at hf'\n rw [pow_sub\u2080 _ (sub_ne_zero_of_ne hz) (by lia), \u2190 hf']\n\n/-- If two functions agree in a neighborhood of `z\u2080`, then their orders at `z\u2080` agree. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Analytic.Order.analyticOrderAt_congr (L176-L185)\nlemma analyticOrderAt_congr (hfg : f =\u1da0[\ud835\udcdd z\u2080] g) :\n analyticOrderAt f z\u2080 = analyticOrderAt g z\u2080 := by\nby_cases hf : AnalyticAt \ud835\udd5c f z\u2080\n \u00b7 refine ENat.eq_of_forall_natCast_le_iff fun n \u21a6 ?_\n simp only [natCast_le_analyticOrderAt, hf, hf.congr hfg]\n congr! 3\n exact hfg.congr_left\n \u00b7 rw [analyticOrderAt_of_not_analyticAt hf,\n analyticOrderAt_of_not_analyticAt fun hg \u21a6 hf <| hg.congr hfg.symm]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Order.le_analyticOrderAt_add (L198-L208)\ntheorem le_analyticOrderAt_add :\n min (analyticOrderAt f z\u2080) (analyticOrderAt g z\u2080) \u2264 analyticOrderAt (f + g) z\u2080 := by\nby_cases hf : AnalyticAt \ud835\udd5c f z\u2080\n \u00b7 by_cases hg : AnalyticAt \ud835\udd5c g z\u2080\n \u00b7 refine ENat.forall_natCast_le_iff_le.mp fun n \u21a6 ?_\n simp only [le_min_iff, natCast_le_analyticOrderAt, hf, hg, hf.add hg]\n refine fun \u27e8\u27e8F, hF, hF'\u27e9, \u27e8G, hG, hG'\u27e9\u27e9 \u21a6 \u27e8F + G, hF.add hG, ?_\u27e9\n filter_upwards [hF', hG'] with z using by simp +contextual\n \u00b7 simp [*]\n \u00b7 simp [*]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Analytic.Order.le_analyticOrderAt_sub (L209-L212)\nlemma le_analyticOrderAt_sub :\n min (analyticOrderAt f z\u2080) (analyticOrderAt g z\u2080) \u2264 analyticOrderAt (f - g) z\u2080 := by\nsimpa [sub_eq_add_neg] using le_analyticOrderAt_add (f := f) (g := -g)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Analytic.Basic.ContinuousLinearMap (L546-L557)\ntheorem ContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall (g : F \u2192L[\ud835\udd5c] G)\n (h : HasFPowerSeriesWithinOnBall f p s x r) :\n HasFPowerSeriesWithinOnBall (g \u2218 f) (g.compFormalMultilinearSeries p) s x r where\n r_le := h.r_le.trans (p.radius_le_radius_continuousLinearMap_comp _)\nr_pos := h.r_pos\n hasSum hy h'y := by\n simpa only [ContinuousLinearMap.compFormalMultilinearSeries_apply,\n ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply] using\n g.hasSum (h.hasSum hy h'y)\n\n/-- If a function `f` has a power series `p` on a ball and `g` is linear, then `g \u2218 f` has the\npower series `g \u2218 p` on the same ball. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesWithinAt f p s x\n\n/-- Given a function `f : E \u2192 F`, we say that `f` is analytic on a set `s` if it is analytic around\nevery point of `s`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOn (L123-L131)\ndef AnalyticOn (f : E \u2192 F) (s : Set E) : Prop :=\n\u2200 x \u2208 s, AnalyticWithinAt \ud835\udd5c f s x\n\n/-!\n### `HasFPowerSeriesOnBall` and `HasFPowerSeriesWithinOnBall`\n-/\n\nvariable {\ud835\udd5c}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E) :=\n\u2203 r, HasFPowerSeriesWithinOnBall f p s x r\n\n-- Teach the `bound` tactic that power series have positive radius\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)\ntheorem binomialSeries_radius_eq_top_of_nat {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u}\n [NormedDivisionRing \ud835\udd38] [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \u2115} :\n (binomialSeries \ud835\udd38 (a : \ud835\udd42)).radius = \u22a4 := by\nsimp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n ordinaryHypergeometric_radius_top_of_neg_nat\u2081]\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `1`, when `a` is not natural. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff (L1106-L1127)\ntheorem hasFPowerSeriesAt_iff :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd 0, HasSum (fun n => z ^ n \u2022 p.coeff n) (f (z\u2080 + z)) := by\nrefine \u27e8fun \u27e8r, _, r_pos, h\u27e9 =>\n eventually_of_mem (Metric.eball_mem_nhds 0 r_pos) fun _ => by simpa using h, ?_\u27e9\n simp only [Metric.eventually_nhds_iff]\n rintro \u27e8r, r_pos, h\u27e9\n refine \u27e8p.radius \u2293 r.toNNReal, by simp, ?_, ?_\u27e9\n \u00b7 simp only [r_pos.lt, lt_inf_iff, ENNReal.coe_pos, Real.toNNReal_pos, and_true]\n obtain \u27e8z, z_pos, le_z\u27e9 := NormedField.exists_norm_lt \ud835\udd5c r_pos.lt\n have : (\u2016z\u2016\u208a : ENNReal) \u2264 p.radius := by\n simp only [dist_zero_right] at h\n apply FormalMultilinearSeries.le_radius_of_tendsto\n convert tendsto_norm.comp (h le_z).summable.tendsto_atTop_zero\n simp [norm_smul, mul_comm]\n refine lt_of_lt_of_le ?_ this\n simp only [ENNReal.coe_pos]\n exact zero_lt_iff.mpr (nnnorm_ne_zero_iff.mpr (norm_pos_iff.mp z_pos))\n \u00b7 simp only [Metric.mem_eball, lt_inf_iff, edist_lt_coe, apply_eq_pow_smul_coeff, and_imp,\n dist_zero_right] at h \u22a2\n refine fun {y} _ hyr => h ?_\n simpa [nndist_eq_nnnorm, Real.lt_toNNReal_iff_coe_lt] using hyr\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)\ntheorem one_add_cpow_hasFPowerSeriesAt_zero {a : \u2102} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 :=\none_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)\ntheorem binomialSeries_apply {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) {n} (v : Fin n \u2192 \ud835\udd38) :\n binomialSeries \ud835\udd38 a n v = Ring.choose a n \u2022 (List.ofFn v).prod := by\nsimp [binomialSeries, FormalMultilinearSeries.ofScalars]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)\nlemma Complex.ofReal_choose (a : \u211d) (n : \u2115) :\n \u2191(Ring.choose a n) = Ring.choose (a : \u2102) n :=\nRing.map_choose (algebraMap \u211d \u2102) _ _\n\n/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given\nby `Ring.choose a`. The sum of this series is `fun x \u21a6 (1 + x) ^ a` within the radius\nof convergence. -/\nnoncomputable def binomialSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) :\n FormalMultilinearSeries \ud835\udd42 \ud835\udd38 \ud835\udd38 :=\n .ofScalars \ud835\udd38 (Ring.choose a \u00b7)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)\ntheorem binomialSeries_radius_ge_one {\ud835\udd42 : Type*} [RCLike \ud835\udd42] {\ud835\udd38 : Type*} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} :\n 1 \u2264 (binomialSeries \ud835\udd38 a).radius := by\nby_cases ha : \u2200 (k : \u2115), a \u2260 k\n \u00b7 rw [binomialSeries_radius_eq_one ha]\n \u00b7 push Not at ha\n rcases ha with \u27e8k, rfl\u27e9\n simp [binomialSeries_radius_eq_top_of_nat]\n\nnamespace Complex\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E) :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesAt f p x\n\n/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `\ud835\udcdd[s] x` -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr' (L506-L508)\ntheorem analyticOnNhd_congr' (h : f =\u1da0[\ud835\udcdd\u02e2 s] g) : AnalyticOnNhd \ud835\udd5c f s \u2194 AnalyticOnNhd \ud835\udd5c g s :=\n\u27e8fun hf => hf.congr' h, fun hg => hg.congr' h.symm\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff' (L1128-L1132)\ntheorem hasFPowerSeriesAt_iff' :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd z\u2080, HasSum (fun n => (z - z\u2080) ^ n \u2022 p.coeff n) (f z) := by\nrw [\u2190 map_add_left_nhds_zero, eventually_map, hasFPowerSeriesAt_iff]\n simp_rw [add_sub_cancel_left]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)\ntheorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave H : ((binomialSeries \u2102 (-a)).compContinuousLinearMap (-1)) =\n .ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n := by\n ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,\n Units.smul_def, \u2190 pow_add, \u2190 mul_assoc]\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (-a)) (binomialSeries \u2102 (-a : \u2102)) (-0) 1 := by\n simpa using one_add_cpow_hasFPowerSeriesOnBall_zero\n simpa [cpow_neg, Function.comp_def, \u2190 sub_eq_add_neg, H] using\n this.compContinuousLinearMap (u := -1) (x := (0 : \u2102))\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)\ntheorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : \u2102} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 1 := by\nsuffices (binomialSeries \u2102 a = FormalMultilinearSeries.ofScalars \u2102\n fun n \u21a6 iteratedDeriv n (fun (x : \u2102) \u21a6 (1 + x) ^ a) 0 / n !) by\n convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _\n \u00b7 norm_num\n \u00b7 -- TODO: use `fun_prop` for this subgoal\n apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const\n intro z hz\n apply Complex.mem_slitPlane_of_norm_lt_one\n rw [\u2190 ENNReal.ofReal_one, Metric.eball_ofReal] at hz\n simpa using hz\n \u00b7 rw [\u2190 this]\n exact binomialSeries_radius_ge_one\n simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]\n ext n\n rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), \u2190 nsmul_eq_mul',\n \u2190 Ring.descPochhammer_eq_factorial_smul_choose]\n let B := Metric.ball (0 : \u2102) 1\n suffices Set.EqOn (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B)\n (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - n)) B by\n specialize this (show 0 \u2208 _ by simp [B])\n rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this\n symm\n simpa using this\n induction n with\n | zero => simp [Set.EqOn]\n | succ n ih =>\n have : iteratedDerivWithin (n + 1) (fun (x : \u2102) \u21a6 (1 + x) ^ a) B =\n derivWithin (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B) B := by\n ext z\n rw [iteratedDerivWithin_succ]\n rw [this]\n have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : \u2102) \u21a6 (1 + x) ^ a) B) B)\n (derivWithin (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - \u2191n)) B) B := by\n intro z hz\n rw [derivWithin_congr (fun _ hz \u21a6 ih hz) (ih hz)]\n apply Set.EqOn.trans this\n intro z hz\n simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,\n deriv_const_mul_field']\n rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,\n show a - (n + 1) = a - n - 1 by ring, \u2190 mul_assoc]\n \u00b7 congr\n simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]\n \u00b7 apply Complex.mem_slitPlane_of_norm_lt_one\n simpa [B] using hz\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticAt_congr (L495-L497)\ntheorem analyticAt_congr (h : f =\u1da0[\ud835\udcdd x] g) : AnalyticAt \ud835\udd5c f x \u2194 AnalyticAt \ud835\udd5c g x :=\n\u27e8fun hf \u21a6 hf.congr h, fun hg \u21a6 hg.congr h.symm\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E) :=\n\u2203 r, HasFPowerSeriesOnBall f p x r\n\n/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOn_congr (L488-L490)\nlemma analyticOn_congr (hs : EqOn f g s) : AnalyticOn \ud835\udd5c f s \u2194 AnalyticOn \ud835\udd5c g s :=\n\u27e8fun h \u21a6 h.congr hs.symm, fun h \u21a6 h.congr hs\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr (L514-L516)\ntheorem analyticOnNhd_congr (hs : IsOpen s) (h : s.EqOn f g) : AnalyticOnNhd \ud835\udd5c f s \u2194\n AnalyticOnNhd \ud835\udd5c g s := \u27e8fun hf => hf.congr hs h, fun hg => hg.congr hs h.symm\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)\ntheorem binomialSeries_radius_eq_one {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} (ha : \u2200 (k : \u2115), a \u2260 k) : (binomialSeries \ud835\udd38 a).radius = 1 := by\nsimp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n FormalMultilinearSeries.radius_compNeg]\n conv at ha => ext; rw [ne_comm]\n exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E) :=\n\u2200 x, x \u2208 s \u2192 AnalyticAt \ud835\udd5c f x\n\n/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that\nthis is weaker than `AnalyticOnNhd \ud835\udd5c f s`, as `f` is allowed to be arbitrary outside `s`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesWithinAt_iff_of_nhds (L391-L397)\nlemma hasFPowerSeriesWithinAt_iff_of_nhds (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F)\n {U : Set E} (hU : U \u2208 \ud835\udcdd x) :\n HasFPowerSeriesWithinAt f p U x \u2194 HasFPowerSeriesAt f p x := by\nrw [\u2190 hasFPowerSeriesWithinAt_univ]\n exact \u27e8fun h \u21a6 h.mono_of_mem_nhdsWithin (mem_nhdsWithin_of_mem_nhds hU),\n fun h \u21a6 h.mono (subset_univ _)\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)\ntheorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :\n HasFPowerSeriesAt f p x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)\ntheorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt\n (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)\ntheorem binomialSeries_eq_ordinaryHypergeometricSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42]\n {\ud835\udd38 : Type v} [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] {a b : \ud835\udd42}\n (h : \u2200 (k : \u2115), (k : \ud835\udd42) \u2260 -b) :\n binomialSeries \ud835\udd38 a =\n (ordinaryHypergeometricSeries \ud835\udd38 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by\nsimp only [binomialSeries, ordinaryHypergeometricSeries,\n FormalMultilinearSeries.ofScalars_comp_neg_id]\n congr! with n\n rw [ordinaryHypergeometricCoefficient,\n mul_inv_cancel_right\u2080 (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]\n simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,\n Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,\n ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]\n ring_nf\n simp\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `\u22a4` for natural `a`. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Analytic/Order.lean", "module": "Mathlib.Analysis.Analytic.Order", "declaration": "Mathlib.Analysis.Analytic.Order.analyticOrderAt_deriv_of_pos", "span": "L347-L355", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Analytic/Order.lean#L347"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 8820, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 22261, "lean_code_chars": 20761, "natural_language_chars": 1500, "lean_code_ratio": 0.9326, "line_count": 536, "imports_count": 0, "declarations_count": 2237, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "c66f7c5355225c80", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars_top", "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.Algebra.Algebra.Subalgebra.Tower)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem restrictScalars_top : restrictScalars R (\u22a4 : Subalgebra S A) = \u22a4\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.lmul_algebraMap (L46-L57)\ntheorem lmul_algebraMap (x : R) : Algebra.lmul R A (algebraMap R A x) = Algebra.lsmul R R A x :=\nEq.symm <| LinearMap.ext <| smul_def x\n\nend Algebra\n\nnamespace IsScalarTower\n\nsection Semiring\n\nvariable [CommSemiring R] [CommSemiring S] [Semiring A]\nvariable [Algebra R S] [Algebra S A]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.subalgebra (L58-L62)\ninstance subalgebra (S\u2080 : Subalgebra R S) : IsScalarTower S\u2080 S A :=\nof_algebraMap_eq fun _ \u21a6 rfl\n\nvariable [Algebra R A] [IsScalarTower R S A]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.subalgebra' (L63-L82)\ninstance subalgebra' (S\u2080 : Subalgebra R S) : IsScalarTower R S\u2080 A :=\n@IsScalarTower.of_algebraMap_eq R S\u2080 A _ _ _ _ _ _ fun _ \u21a6\n (IsScalarTower.algebraMap_apply R S A _ :)\n\nend Semiring\n\nend IsScalarTower\n\nnamespace Subalgebra\n\nopen IsScalarTower\n\nsection Semiring\n\nvariable {S A B} [CommSemiring R] [CommSemiring S] [Semiring A] [Semiring B]\nvariable [Algebra R S] [Algebra S A] [Algebra R A] [Algebra S B] [Algebra R B]\nvariable [IsScalarTower R S A] [IsScalarTower R S B]\n\n/-- Given a tower `A / \u21a5U / S / R` of algebras, where `U` is an `S`-subalgebra of `A`, reinterpret\n`U` as an `R`-subalgebra of `A`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars (L83-L88)\ndef restrictScalars (U : Subalgebra S A) : Subalgebra R A :=\n{ U with\n algebraMap_mem' := fun x \u21a6 by\n rw [IsScalarTower.algebraMap_apply R S A]\n exact U.algebraMap_mem _ }\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.coe_restrictScalars (L90-L92)\ntheorem coe_restrictScalars {U : Subalgebra S A} : (restrictScalars R U : Set A) = (U : Set A) :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars_toSubmodule (L100-L103)\ntheorem restrictScalars_toSubmodule {U : Subalgebra S A} :\n Subalgebra.toSubmodule (U.restrictScalars R) = U.toSubmodule.restrictScalars R :=\nSetLike.coe_injective rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.mem_restrictScalars (L105-L107)\ntheorem mem_restrictScalars {U : Subalgebra S A} {x : A} : x \u2208 restrictScalars R U \u2194 x \u2208 U :=\nIff.rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars_injective (L108-L114)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : Subalgebra S A \u2192 Subalgebra R A) := fun U V H \u21a6\next fun x \u21a6 by rw [\u2190 mem_restrictScalars R, H, mem_restrictScalars]\n\n/-- Produces an `R`-algebra map from `U.restrictScalars R` given an `S`-algebra map from `U`.\n\nThis is a special case of `AlgHom.restrictScalars` that can be helpful in elaboration. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.ofRestrictScalars (L116-L122)\ndef ofRestrictScalars (U : Subalgebra S A) (f : U \u2192\u2090[S] B) : U.restrictScalars R \u2192\u2090[R] B :=\nf.restrictScalars R\n\nend Semiring\n\nsection CommSemiring\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.range_isScalarTower_toAlgHom (L124-L140)\nlemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]\n [Algebra R A] (S : Subalgebra R A) :\n LinearMap.range (IsScalarTower.toAlgHom R S A : S \u2192\u2097[R] A) = Subalgebra.toSubmodule S := by\next\n simp [algebraMap_eq]\n\nend CommSemiring\n\nend Subalgebra\n\nnamespace IsScalarTower\n\nopen Subalgebra\n\nvariable [CommSemiring R] [CommSemiring S] [CommSemiring A]\nvariable [Algebra R S] [Algebra S A] [Algebra R A] [IsScalarTower R S A]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.adjoin_range_toAlgHom (L141-L148)\ntheorem adjoin_range_toAlgHom (t : Set A) :\n (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =\n (Algebra.adjoin S t).restrictScalars R :=\nSubalgebra.ext fun z \u21a6\n show z \u2208 Subsemiring.closure (Set.range (algebraMap (toAlgHom R S A).range A) \u222a t : Set A) \u2194\n z \u2208 Subsemiring.closure (Set.range (algebraMap S A) \u222a t : Set A) by simp\n\nend IsScalarTower\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Algebra.Basic.map_algebraMap_mul (L263-L266)\ntheorem map_algebraMap_mul (f : A \u2192\u2097[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\nrw [\u2190 Algebra.smul_def, \u2190 Algebra.smul_def, map_smul]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring_apply (L130-L137)\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\nrfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Algebra.Basic.mem_algebraMapSubmonoid_of_mem (L141-L144)\ntheorem mem_algebraMapSubmonoid_of_mem {S : Type*} [Semiring S] [Algebra R S] {M : Submonoid R}\n (x : M) : algebraMap R S x \u2208 algebraMapSubmonoid S M :=\nSet.mem_image_of_mem (algebraMap R S) x.2\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMapSubmonoid (L138-L140)\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\nM.map (algebraMap R S)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Algebra.Basic.map_mul_algebraMap (L267-L280)\ntheorem map_mul_algebraMap (f : A \u2192\u2097[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\nrw [\u2190 Algebra.commutes, \u2190 Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `\u2115`-algebras.\n-- TODO: is this still needed?\n/-- Semiring \u2964 \u2115-Alg -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMapSubmonoid_self (L146-L148)\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\nSubmonoid.map_id M\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Algebra.Basic.mul_sub_algebraMap_pow_commutes (L163-L175)\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : \u2115) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\ninduction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', \u2190 mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, \u2190 mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_end_apply (L222-L224)\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a \u2022 m :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring_apply (L113-L116)\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\nrfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_comp_natCast (L290-L303)\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A \u2218 Nat.cast = Nat.cast := by\next; simp\n\nend Nat\n\nsection Int\n\nvariable (R : Type*) [Ring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `\u2124`-algebras.\n-- TODO: is this still needed?\n/-- Ring \u2964 \u2124-Alg -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_int_eq (L311-L315)\ntheorem algebraMap_int_eq : algebraMap \u2124 R = Int.castRingHom R :=\nrfl\n\nvariable {R}\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Algebra.Basic.End (L212-L215)\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\nAlgebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Algebra.Basic.semiringToRing (L176-L183)\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n{ __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Algebra.Basic.nat_algebra_subsingleton (L286-L288)\ninstance nat_algebra_subsingleton : Subsingleton (Algebra \u2115 R) :=\n\u27e8fun P Q => by ext; simp\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubring (L125-L128)\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S \u2192 R) = Subtype.val :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Algebra.Basic.ofSubring (L117-L119)\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Algebra.Basic.ker_algebraMap_end (L226-L229)\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a \u2260 0) : LinearMap.ker ((algebraMap K (End K V)) a) = \u22a5 :=\nLinearMap.ker_smul _ _ ha\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring (L106-L109)\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_pUnit (L54-L60)\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\nrfl\n\nend PUnit\n\nsection ULift\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMapSubmonoid_powers (L150-L159)\nlemma algebraMapSubmonoid_powers {S : Type*} [Semiring S] [Algebra R S] (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\nsimp [Algebra.algebraMapSubmonoid]\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubsemiring (L110-L112)\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S \u2192 R) = Subtype.val :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Algebra.Basic.int_algebra_subsingleton (L316-L318)\ninstance int_algebra_subsingleton : Subsingleton (Algebra \u2124 R) :=\n\u27e8fun P Q => Algebra.algebra_ext P Q <| RingHom.congr_fun <| Subsingleton.elim _ _\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_end_eq_smul_id (L218-L220)\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a \u2022 LinearMap.id :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Algebra.Basic.mul_sub_algebraMap_commutes (L160-L162)\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, \u2190 commutes, sub_mul]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring (L120-L123)\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype :=\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.Algebra.Algebra.Subalgebra.Tower).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem restrictScalars_top : restrictScalars R (\u22a4 : Subalgebra S A) = \u22a4\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.lmul_algebraMap (L46-L57)\ntheorem lmul_algebraMap (x : R) : Algebra.lmul R A (algebraMap R A x) = Algebra.lsmul R R A x :=\nEq.symm <| LinearMap.ext <| smul_def x\n\nend Algebra\n\nnamespace IsScalarTower\n\nsection Semiring\n\nvariable [CommSemiring R] [CommSemiring S] [Semiring A]\nvariable [Algebra R S] [Algebra S A]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.subalgebra (L58-L62)\ninstance subalgebra (S\u2080 : Subalgebra R S) : IsScalarTower S\u2080 S A :=\nof_algebraMap_eq fun _ \u21a6 rfl\n\nvariable [Algebra R A] [IsScalarTower R S A]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.subalgebra' (L63-L82)\ninstance subalgebra' (S\u2080 : Subalgebra R S) : IsScalarTower R S\u2080 A :=\n@IsScalarTower.of_algebraMap_eq R S\u2080 A _ _ _ _ _ _ fun _ \u21a6\n (IsScalarTower.algebraMap_apply R S A _ :)\n\nend Semiring\n\nend IsScalarTower\n\nnamespace Subalgebra\n\nopen IsScalarTower\n\nsection Semiring\n\nvariable {S A B} [CommSemiring R] [CommSemiring S] [Semiring A] [Semiring B]\nvariable [Algebra R S] [Algebra S A] [Algebra R A] [Algebra S B] [Algebra R B]\nvariable [IsScalarTower R S A] [IsScalarTower R S B]\n\n/-- Given a tower `A / \u21a5U / S / R` of algebras, where `U` is an `S`-subalgebra of `A`, reinterpret\n`U` as an `R`-subalgebra of `A`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars (L83-L88)\ndef restrictScalars (U : Subalgebra S A) : Subalgebra R A :=\n{ U with\n algebraMap_mem' := fun x \u21a6 by\n rw [IsScalarTower.algebraMap_apply R S A]\n exact U.algebraMap_mem _ }\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.coe_restrictScalars (L90-L92)\ntheorem coe_restrictScalars {U : Subalgebra S A} : (restrictScalars R U : Set A) = (U : Set A) :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars_toSubmodule (L100-L103)\ntheorem restrictScalars_toSubmodule {U : Subalgebra S A} :\n Subalgebra.toSubmodule (U.restrictScalars R) = U.toSubmodule.restrictScalars R :=\nSetLike.coe_injective rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.mem_restrictScalars (L105-L107)\ntheorem mem_restrictScalars {U : Subalgebra S A} {x : A} : x \u2208 restrictScalars R U \u2194 x \u2208 U :=\nIff.rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars_injective (L108-L114)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : Subalgebra S A \u2192 Subalgebra R A) := fun U V H \u21a6\next fun x \u21a6 by rw [\u2190 mem_restrictScalars R, H, mem_restrictScalars]\n\n/-- Produces an `R`-algebra map from `U.restrictScalars R` given an `S`-algebra map from `U`.\n\nThis is a special case of `AlgHom.restrictScalars` that can be helpful in elaboration. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.ofRestrictScalars (L116-L122)\ndef ofRestrictScalars (U : Subalgebra S A) (f : U \u2192\u2090[S] B) : U.restrictScalars R \u2192\u2090[R] B :=\nf.restrictScalars R\n\nend Semiring\n\nsection CommSemiring\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.range_isScalarTower_toAlgHom (L124-L140)\nlemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]\n [Algebra R A] (S : Subalgebra R A) :\n LinearMap.range (IsScalarTower.toAlgHom R S A : S \u2192\u2097[R] A) = Subalgebra.toSubmodule S := by\next\n simp [algebraMap_eq]\n\nend CommSemiring\n\nend Subalgebra\n\nnamespace IsScalarTower\n\nopen Subalgebra\n\nvariable [CommSemiring R] [CommSemiring S] [CommSemiring A]\nvariable [Algebra R S] [Algebra S A] [Algebra R A] [IsScalarTower R S A]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Algebra.Subalgebra.Tower.adjoin_range_toAlgHom (L141-L148)\ntheorem adjoin_range_toAlgHom (t : Set A) :\n (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =\n (Algebra.adjoin S t).restrictScalars R :=\nSubalgebra.ext fun z \u21a6\n show z \u2208 Subsemiring.closure (Set.range (algebraMap (toAlgHom R S A).range A) \u222a t : Set A) \u2194\n z \u2208 Subsemiring.closure (Set.range (algebraMap S A) \u222a t : Set A) by simp\n\nend IsScalarTower\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Algebra.Basic.map_algebraMap_mul (L263-L266)\ntheorem map_algebraMap_mul (f : A \u2192\u2097[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\nrw [\u2190 Algebra.smul_def, \u2190 Algebra.smul_def, map_smul]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring_apply (L130-L137)\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\nrfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Algebra.Basic.mem_algebraMapSubmonoid_of_mem (L141-L144)\ntheorem mem_algebraMapSubmonoid_of_mem {S : Type*} [Semiring S] [Algebra R S] {M : Submonoid R}\n (x : M) : algebraMap R S x \u2208 algebraMapSubmonoid S M :=\nSet.mem_image_of_mem (algebraMap R S) x.2\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMapSubmonoid (L138-L140)\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\nM.map (algebraMap R S)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Algebra.Basic.map_mul_algebraMap (L267-L280)\ntheorem map_mul_algebraMap (f : A \u2192\u2097[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\nrw [\u2190 Algebra.commutes, \u2190 Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `\u2115`-algebras.\n-- TODO: is this still needed?\n/-- Semiring \u2964 \u2115-Alg -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMapSubmonoid_self (L146-L148)\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\nSubmonoid.map_id M\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Algebra.Basic.mul_sub_algebraMap_pow_commutes (L163-L175)\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : \u2115) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\ninduction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', \u2190 mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, \u2190 mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_end_apply (L222-L224)\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a \u2022 m :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring_apply (L113-L116)\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\nrfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_comp_natCast (L290-L303)\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A \u2218 Nat.cast = Nat.cast := by\next; simp\n\nend Nat\n\nsection Int\n\nvariable (R : Type*) [Ring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `\u2124`-algebras.\n-- TODO: is this still needed?\n/-- Ring \u2964 \u2124-Alg -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_int_eq (L311-L315)\ntheorem algebraMap_int_eq : algebraMap \u2124 R = Int.castRingHom R :=\nrfl\n\nvariable {R}\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Algebra.Basic.End (L212-L215)\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\nAlgebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Algebra.Basic.semiringToRing (L176-L183)\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n{ __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Algebra.Basic.nat_algebra_subsingleton (L286-L288)\ninstance nat_algebra_subsingleton : Subsingleton (Algebra \u2115 R) :=\n\u27e8fun P Q => by ext; simp\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubring (L125-L128)\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S \u2192 R) = Subtype.val :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Algebra.Basic.ofSubring (L117-L119)\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Algebra.Basic.ker_algebraMap_end (L226-L229)\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a \u2260 0) : LinearMap.ker ((algebraMap K (End K V)) a) = \u22a5 :=\nLinearMap.ker_smul _ _ ha\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring (L106-L109)\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_pUnit (L54-L60)\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\nrfl\n\nend PUnit\n\nsection ULift\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMapSubmonoid_powers (L150-L159)\nlemma algebraMapSubmonoid_powers {S : Type*} [Semiring S] [Algebra R S] (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\nsimp [Algebra.algebraMapSubmonoid]\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubsemiring (L110-L112)\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S \u2192 R) = Subtype.val :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Algebra.Basic.int_algebra_subsingleton (L316-L318)\ninstance int_algebra_subsingleton : Subsingleton (Algebra \u2124 R) :=\n\u27e8fun P Q => Algebra.algebra_ext P Q <| RingHom.congr_fun <| Subsingleton.elim _ _\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_end_eq_smul_id (L218-L220)\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a \u2022 LinearMap.id :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Algebra.Basic.mul_sub_algebraMap_commutes (L160-L162)\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, \u2190 commutes, sub_mul]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring (L120-L123)\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S \u2192+* R) = S.subtype :=\nrfl\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Algebra/Subalgebra/Tower.lean", "module": "Mathlib.Algebra.Algebra.Subalgebra.Tower", "declaration": "Mathlib.Algebra.Algebra.Subalgebra.Tower.restrictScalars_top", "span": "L94-L98", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/Subalgebra/Tower.lean#L94"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4144, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 11632, "lean_code_chars": 10231, "natural_language_chars": 1401, "lean_code_ratio": 0.8796, "line_count": 391, "imports_count": 0, "declarations_count": 1279, "diagnostics_count": 0, "retrieval_snippets_count": 36, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "71caf2cce7a9097c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.UpperLower.Basic.isLowerSet_setOf", "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.Order.UpperLower.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem isLowerSet_setOf : IsLowerSet { a | p a } \u2194 Antitone p\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_empty (L39-L40)\ntheorem isUpperSet_empty : IsUpperSet (\u2205 : Set \u03b1) := fun _ _ _ => id\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_univ (L42-L43)\ntheorem isUpperSet_univ : IsUpperSet (univ : Set \u03b1) := fun _ _ _ => id\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L45-L46)\ntheorem IsUpperSet.compl (hs : IsUpperSet s) : IsLowerSet s\u1d9c := fun _a _b h hb ha => hb <| hs h ha\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_compl (L48-L52)\ntheorem isUpperSet_compl : IsUpperSet s\u1d9c \u2194 IsLowerSet s :=\n\u27e8fun h => by\n convert h.compl\n rw [compl_compl], IsLowerSet.compl\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L54-L56)\ntheorem IsUpperSet.union (hs : IsUpperSet s) (ht : IsUpperSet t) : IsUpperSet (s \u222a t) :=\nfun _ _ h => Or.imp (hs h) (ht h)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L58-L60)\ntheorem IsUpperSet.inter (hs : IsUpperSet s) (ht : IsUpperSet t) : IsUpperSet (s \u2229 t) :=\nfun _ _ h => And.imp (hs h) (ht h)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_sUnion (L62-L64)\ntheorem isUpperSet_sUnion {S : Set (Set \u03b1)} (hf : \u2200 s \u2208 S, IsUpperSet s) : IsUpperSet (\u22c3\u2080 S) :=\nfun _ _ h => Exists.imp fun _ hs => \u27e8hs.1, hf _ hs.1 h hs.2\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iUnion (L66-L68)\ntheorem isUpperSet_iUnion {f : \u03b9 \u2192 Set \u03b1} (hf : \u2200 i, IsUpperSet (f i)) : IsUpperSet (\u22c3 i, f i) :=\nisUpperSet_sUnion <| forall_mem_range.2 hf\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iUnion\u2082 (L70-L73)\ntheorem isUpperSet_iUnion\u2082 {f : \u2200 i, \u03ba i \u2192 Set \u03b1} (hf : \u2200 i j, IsUpperSet (f i j)) :\n IsUpperSet (\u22c3 (i) (j), f i j) :=\nisUpperSet_iUnion fun i => isUpperSet_iUnion <| hf i\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_sInter (L75-L77)\ntheorem isUpperSet_sInter {S : Set (Set \u03b1)} (hf : \u2200 s \u2208 S, IsUpperSet s) : IsUpperSet (\u22c2\u2080 S) :=\nfun _ _ h => forall\u2082_imp fun s hs => hf s hs h\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iInter (L79-L81)\ntheorem isUpperSet_iInter {f : \u03b9 \u2192 Set \u03b1} (hf : \u2200 i, IsUpperSet (f i)) : IsUpperSet (\u22c2 i, f i) :=\nisUpperSet_sInter <| forall_mem_range.2 hf\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iInter\u2082 (L83-L86)\ntheorem isUpperSet_iInter\u2082 {f : \u2200 i, \u03ba i \u2192 Set \u03b1} (hf : \u2200 i j, IsUpperSet (f i j)) :\n IsUpperSet (\u22c2 (i) (j), f i j) :=\nisUpperSet_iInter fun i => isUpperSet_iInter <| hf i\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_preimage_ofDual_iff (L88-L90)\ntheorem isUpperSet_preimage_ofDual_iff : IsUpperSet (ofDual \u207b\u00b9' s) \u2194 IsLowerSet s :=\nIff.rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_preimage_toDual_iff (L92-L94)\ntheorem isUpperSet_preimage_toDual_iff {s : Set \u03b1\u1d52\u1d48} : IsUpperSet (toDual \u207b\u00b9' s) \u2194 IsLowerSet s :=\nIff.rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L99-L101)\nlemma IsUpperSet.isLowerSet_preimage_coe (hs : IsUpperSet s) :\n IsLowerSet ((\u2191) \u207b\u00b9' t : Set s) \u2194 \u2200 b \u2208 s, \u2200 c \u2208 t, b \u2264 c \u2192 b \u2208 t := by aesop\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.UpperLower.Closure.subset_upperClosure (L54-L55)\ntheorem subset_upperClosure : s \u2286 upperClosure s := fun x hx => \u27e8x, hx, le_rfl\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_univ (L128-L130)\ntheorem upperClosure_univ : upperClosure (univ : Set \u03b1) = \u22a5 :=\nbot_unique subset_upperClosure\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_union (L131-L133)\ntheorem upperClosure_union (s t : Set \u03b1) : upperClosure (s \u222a t) = upperClosure s \u2293 upperClosure t :=\n(@gc_upperClosure_coe \u03b1 _).l_sup\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_eq_top_iff (L115-L117)\ntheorem upperClosure_eq_top_iff : upperClosure s = \u22a4 \u2194 s = \u2205 := by\nrw [eq_top_iff, le_upperClosure]; simp\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_sUnion (L146-L148)\ntheorem upperClosure_sUnion (S : Set (Set \u03b1)) : upperClosure (\u22c3\u2080 S) = \u2a05 s \u2208 S, upperClosure s := by\nsimp_rw [sUnion_eq_biUnion, upperClosure_iUnion]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.UpperLower.Closure.mem_upperClosure (L40-L43)\ntheorem mem_upperClosure : x \u2208 upperClosure s \u2194 \u2203 a \u2208 s, a \u2264 x :=\nIff.rfl\n\n-- We do not tag this as `simp` to respect the abstraction.\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_singleton (L123-L126)\ntheorem upperClosure_singleton (a : \u03b1) : upperClosure ({a} : Set \u03b1) = UpperSet.Ici a := by\next\n simp\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_mono (L111-L113)\ntheorem lowerClosure_mono : Monotone (lowerClosure : Set \u03b1 \u2192 LowerSet \u03b1) :=\ngc_lowerClosure_coe.monotone_l\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_anti (L108-L110)\ntheorem upperClosure_anti : Antitone (upperClosure : Set \u03b1 \u2192 UpperSet \u03b1) :=\ngc_upperClosure_coe.monotone_l\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.UpperLower.Closure.instDecidablePredMemUpperClosure (L50-L52)\ninstance instDecidablePredMemUpperClosure [DecidablePred (\u2203 a \u2208 s, a \u2264 \u00b7)] :\n DecidablePred (\u00b7 \u2208 upperClosure s) := \u2039DecidablePred _\u203a\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_empty (L119-L121)\ntheorem upperClosure_empty : upperClosure (\u2205 : Set \u03b1) = \u22a4 :=\nupperClosure_eq_top_iff.mpr rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.UpperLower.Closure.giLowerClosureCoe (L102-L107)\ndef giLowerClosureCoe : GaloisInsertion (lowerClosure : Set \u03b1 \u2192 LowerSet \u03b1) (\u2191) where\n choice s hs := \u27e8s, fun a _b hba ha => hs \u27e8a, ha, hba\u27e9\u27e9\ngc := gc_lowerClosure_coe\n le_l_u _ := subset_lowerClosure\n choice_eq _s hs := SetLike.coe_injective <| subset_lowerClosure.antisymm hs\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.UpperLower.Closure.gc_lowerClosure_coe (L90-L93)\ntheorem gc_lowerClosure_coe :\n GaloisConnection (lowerClosure : Set \u03b1 \u2192 LowerSet \u03b1) (\u2191) := fun _s _t \u21a6 lowerClosure_le\n/-- `upperClosure` forms a reversed Galois insertion with the coercion from upper sets to sets. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure (L36-L38)\ndef upperClosure (s : Set \u03b1) : UpperSet \u03b1 :=\n\u27e8{ x | \u2203 a \u2208 s, a \u2264 x }, fun _ _ hle h => h.imp fun _x hx => \u27e8hx.1, hx.2.trans hle\u27e9\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.UpperLower.Closure.UpperSet (L77-L80)\ntheorem UpperSet.iInf_Ici (s : Set \u03b1) : \u2a05 a \u2208 s, UpperSet.Ici a = upperClosure s := by\next\n simp\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_min (L57-L59)\ntheorem upperClosure_min (h : s \u2286 t) (ht : IsUpperSet t) : \u2191(upperClosure s) \u2286 t :=\nfun _a \u27e8_b, hb, hba\u27e9 => ht hba <| h hb\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.UpperLower.Closure.Set (L149-L153)\ntheorem Set.OrdConnected.upperClosure_inter_lowerClosure (h : s.OrdConnected) :\n \u2191(upperClosure s) \u2229 \u2191(lowerClosure s) = s :=\n(subset_inter subset_upperClosure subset_lowerClosure).antisymm'\n fun _a \u27e8\u27e8_b, hb, hba\u27e9, _c, hc, hac\u27e9 => h.out hb hc \u27e8hba, hac\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.UpperLower.Closure.gc_upperClosure_coe (L86-L89)\ntheorem gc_upperClosure_coe :\n GaloisConnection (toDual \u2218 upperClosure : Set \u03b1 \u2192 (UpperSet \u03b1)\u1d52\u1d48) ((\u2191) \u2218 ofDual) :=\nfun _s _t \u21a6 le_upperClosure\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_iUnion (L138-L140)\ntheorem upperClosure_iUnion (f : \u03b9 \u2192 Set \u03b1) : upperClosure (\u22c3 i, f i) = \u2a05 i, upperClosure (f i) :=\n(@gc_upperClosure_coe \u03b1 _).l_iSup\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_union (L135-L137)\ntheorem lowerClosure_union (s t : Set \u03b1) : lowerClosure (s \u222a t) = lowerClosure s \u2294 lowerClosure t :=\n(@gc_lowerClosure_coe \u03b1 _).l_sup\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.UpperLower.Closure.giUpperClosureCoe (L94-L101)\ndef giUpperClosureCoe :\n GaloisInsertion (toDual \u2218 upperClosure : Set \u03b1 \u2192 (UpperSet \u03b1)\u1d52\u1d48) ((\u2191) \u2218 ofDual) where\n choice s hs := toDual (\u27e8s, fun a _b hab ha => hs \u27e8a, ha, hab\u27e9\u27e9 : UpperSet \u03b1)\ngc := gc_upperClosure_coe\n le_l_u _ := subset_upperClosure\n choice_eq _s hs := ofDual.injective <| SetLike.coe_injective <| subset_upperClosure.antisymm hs\n\n/-- `lowerClosure` forms a Galois insertion with the coercion from lower sets to sets. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_iUnion (L142-L144)\ntheorem lowerClosure_iUnion (f : \u03b9 \u2192 Set \u03b1) : lowerClosure (\u22c3 i, f i) = \u2a06 i, lowerClosure (f i) :=\n(@gc_lowerClosure_coe \u03b1 _).l_iSup\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_le (L82-L85)\nlemma lowerClosure_le {t : LowerSet \u03b1} : lowerClosure s \u2264 t \u2194 s \u2286 t :=\n\u27e8fun h \u21a6 subset_lowerClosure.trans <| LowerSet.coe_subset_coe.2 h,\n fun h \u21a6 lowerClosure_min h t.lower\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_image (L69-L75)\ntheorem upperClosure_image (f : \u03b1 \u2243o \u03b2) :\n upperClosure (f '' s) = UpperSet.map f (upperClosure s) := by\nrw [\u2190 f.symm_symm, \u2190 UpperSet.symm_map, f.symm_symm]\n ext\n simp only [SetLike.mem_coe]\n simp [f.le_symm_apply]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.UpperLower.Closure.coe_upperClosure (L45-L48)\ntheorem coe_upperClosure (s : Set \u03b1) : \u2191(upperClosure s) = \u22c3 a \u2208 s, Ici a := by\next\n 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.Order.UpperLower.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 isLowerSet_setOf : IsLowerSet { a | p a } \u2194 Antitone p\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_empty (L39-L40)\ntheorem isUpperSet_empty : IsUpperSet (\u2205 : Set \u03b1) := fun _ _ _ => id\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_univ (L42-L43)\ntheorem isUpperSet_univ : IsUpperSet (univ : Set \u03b1) := fun _ _ _ => id\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L45-L46)\ntheorem IsUpperSet.compl (hs : IsUpperSet s) : IsLowerSet s\u1d9c := fun _a _b h hb ha => hb <| hs h ha\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_compl (L48-L52)\ntheorem isUpperSet_compl : IsUpperSet s\u1d9c \u2194 IsLowerSet s :=\n\u27e8fun h => by\n convert h.compl\n rw [compl_compl], IsLowerSet.compl\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L54-L56)\ntheorem IsUpperSet.union (hs : IsUpperSet s) (ht : IsUpperSet t) : IsUpperSet (s \u222a t) :=\nfun _ _ h => Or.imp (hs h) (ht h)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L58-L60)\ntheorem IsUpperSet.inter (hs : IsUpperSet s) (ht : IsUpperSet t) : IsUpperSet (s \u2229 t) :=\nfun _ _ h => And.imp (hs h) (ht h)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_sUnion (L62-L64)\ntheorem isUpperSet_sUnion {S : Set (Set \u03b1)} (hf : \u2200 s \u2208 S, IsUpperSet s) : IsUpperSet (\u22c3\u2080 S) :=\nfun _ _ h => Exists.imp fun _ hs => \u27e8hs.1, hf _ hs.1 h hs.2\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iUnion (L66-L68)\ntheorem isUpperSet_iUnion {f : \u03b9 \u2192 Set \u03b1} (hf : \u2200 i, IsUpperSet (f i)) : IsUpperSet (\u22c3 i, f i) :=\nisUpperSet_sUnion <| forall_mem_range.2 hf\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iUnion\u2082 (L70-L73)\ntheorem isUpperSet_iUnion\u2082 {f : \u2200 i, \u03ba i \u2192 Set \u03b1} (hf : \u2200 i j, IsUpperSet (f i j)) :\n IsUpperSet (\u22c3 (i) (j), f i j) :=\nisUpperSet_iUnion fun i => isUpperSet_iUnion <| hf i\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_sInter (L75-L77)\ntheorem isUpperSet_sInter {S : Set (Set \u03b1)} (hf : \u2200 s \u2208 S, IsUpperSet s) : IsUpperSet (\u22c2\u2080 S) :=\nfun _ _ h => forall\u2082_imp fun s hs => hf s hs h\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iInter (L79-L81)\ntheorem isUpperSet_iInter {f : \u03b9 \u2192 Set \u03b1} (hf : \u2200 i, IsUpperSet (f i)) : IsUpperSet (\u22c2 i, f i) :=\nisUpperSet_sInter <| forall_mem_range.2 hf\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_iInter\u2082 (L83-L86)\ntheorem isUpperSet_iInter\u2082 {f : \u2200 i, \u03ba i \u2192 Set \u03b1} (hf : \u2200 i j, IsUpperSet (f i j)) :\n IsUpperSet (\u22c2 (i) (j), f i j) :=\nisUpperSet_iInter fun i => isUpperSet_iInter <| hf i\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_preimage_ofDual_iff (L88-L90)\ntheorem isUpperSet_preimage_ofDual_iff : IsUpperSet (ofDual \u207b\u00b9' s) \u2194 IsLowerSet s :=\nIff.rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.UpperLower.Basic.isUpperSet_preimage_toDual_iff (L92-L94)\ntheorem isUpperSet_preimage_toDual_iff {s : Set \u03b1\u1d52\u1d48} : IsUpperSet (toDual \u207b\u00b9' s) \u2194 IsLowerSet s :=\nIff.rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.UpperLower.Basic.IsUpperSet (L99-L101)\nlemma IsUpperSet.isLowerSet_preimage_coe (hs : IsUpperSet s) :\n IsLowerSet ((\u2191) \u207b\u00b9' t : Set s) \u2194 \u2200 b \u2208 s, \u2200 c \u2208 t, b \u2264 c \u2192 b \u2208 t := by aesop\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.UpperLower.Closure.subset_upperClosure (L54-L55)\ntheorem subset_upperClosure : s \u2286 upperClosure s := fun x hx => \u27e8x, hx, le_rfl\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_univ (L128-L130)\ntheorem upperClosure_univ : upperClosure (univ : Set \u03b1) = \u22a5 :=\nbot_unique subset_upperClosure\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_union (L131-L133)\ntheorem upperClosure_union (s t : Set \u03b1) : upperClosure (s \u222a t) = upperClosure s \u2293 upperClosure t :=\n(@gc_upperClosure_coe \u03b1 _).l_sup\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_eq_top_iff (L115-L117)\ntheorem upperClosure_eq_top_iff : upperClosure s = \u22a4 \u2194 s = \u2205 := by\nrw [eq_top_iff, le_upperClosure]; simp\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_sUnion (L146-L148)\ntheorem upperClosure_sUnion (S : Set (Set \u03b1)) : upperClosure (\u22c3\u2080 S) = \u2a05 s \u2208 S, upperClosure s := by\nsimp_rw [sUnion_eq_biUnion, upperClosure_iUnion]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.UpperLower.Closure.mem_upperClosure (L40-L43)\ntheorem mem_upperClosure : x \u2208 upperClosure s \u2194 \u2203 a \u2208 s, a \u2264 x :=\nIff.rfl\n\n-- We do not tag this as `simp` to respect the abstraction.\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_singleton (L123-L126)\ntheorem upperClosure_singleton (a : \u03b1) : upperClosure ({a} : Set \u03b1) = UpperSet.Ici a := by\next\n simp\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_mono (L111-L113)\ntheorem lowerClosure_mono : Monotone (lowerClosure : Set \u03b1 \u2192 LowerSet \u03b1) :=\ngc_lowerClosure_coe.monotone_l\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_anti (L108-L110)\ntheorem upperClosure_anti : Antitone (upperClosure : Set \u03b1 \u2192 UpperSet \u03b1) :=\ngc_upperClosure_coe.monotone_l\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.UpperLower.Closure.instDecidablePredMemUpperClosure (L50-L52)\ninstance instDecidablePredMemUpperClosure [DecidablePred (\u2203 a \u2208 s, a \u2264 \u00b7)] :\n DecidablePred (\u00b7 \u2208 upperClosure s) := \u2039DecidablePred _\u203a\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_empty (L119-L121)\ntheorem upperClosure_empty : upperClosure (\u2205 : Set \u03b1) = \u22a4 :=\nupperClosure_eq_top_iff.mpr rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.UpperLower.Closure.giLowerClosureCoe (L102-L107)\ndef giLowerClosureCoe : GaloisInsertion (lowerClosure : Set \u03b1 \u2192 LowerSet \u03b1) (\u2191) where\n choice s hs := \u27e8s, fun a _b hba ha => hs \u27e8a, ha, hba\u27e9\u27e9\ngc := gc_lowerClosure_coe\n le_l_u _ := subset_lowerClosure\n choice_eq _s hs := SetLike.coe_injective <| subset_lowerClosure.antisymm hs\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.UpperLower.Closure.gc_lowerClosure_coe (L90-L93)\ntheorem gc_lowerClosure_coe :\n GaloisConnection (lowerClosure : Set \u03b1 \u2192 LowerSet \u03b1) (\u2191) := fun _s _t \u21a6 lowerClosure_le\n/-- `upperClosure` forms a reversed Galois insertion with the coercion from upper sets to sets. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure (L36-L38)\ndef upperClosure (s : Set \u03b1) : UpperSet \u03b1 :=\n\u27e8{ x | \u2203 a \u2208 s, a \u2264 x }, fun _ _ hle h => h.imp fun _x hx => \u27e8hx.1, hx.2.trans hle\u27e9\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.UpperLower.Closure.UpperSet (L77-L80)\ntheorem UpperSet.iInf_Ici (s : Set \u03b1) : \u2a05 a \u2208 s, UpperSet.Ici a = upperClosure s := by\next\n simp\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_min (L57-L59)\ntheorem upperClosure_min (h : s \u2286 t) (ht : IsUpperSet t) : \u2191(upperClosure s) \u2286 t :=\nfun _a \u27e8_b, hb, hba\u27e9 => ht hba <| h hb\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.UpperLower.Closure.Set (L149-L153)\ntheorem Set.OrdConnected.upperClosure_inter_lowerClosure (h : s.OrdConnected) :\n \u2191(upperClosure s) \u2229 \u2191(lowerClosure s) = s :=\n(subset_inter subset_upperClosure subset_lowerClosure).antisymm'\n fun _a \u27e8\u27e8_b, hb, hba\u27e9, _c, hc, hac\u27e9 => h.out hb hc \u27e8hba, hac\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.UpperLower.Closure.gc_upperClosure_coe (L86-L89)\ntheorem gc_upperClosure_coe :\n GaloisConnection (toDual \u2218 upperClosure : Set \u03b1 \u2192 (UpperSet \u03b1)\u1d52\u1d48) ((\u2191) \u2218 ofDual) :=\nfun _s _t \u21a6 le_upperClosure\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_iUnion (L138-L140)\ntheorem upperClosure_iUnion (f : \u03b9 \u2192 Set \u03b1) : upperClosure (\u22c3 i, f i) = \u2a05 i, upperClosure (f i) :=\n(@gc_upperClosure_coe \u03b1 _).l_iSup\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_union (L135-L137)\ntheorem lowerClosure_union (s t : Set \u03b1) : lowerClosure (s \u222a t) = lowerClosure s \u2294 lowerClosure t :=\n(@gc_lowerClosure_coe \u03b1 _).l_sup\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.UpperLower.Closure.giUpperClosureCoe (L94-L101)\ndef giUpperClosureCoe :\n GaloisInsertion (toDual \u2218 upperClosure : Set \u03b1 \u2192 (UpperSet \u03b1)\u1d52\u1d48) ((\u2191) \u2218 ofDual) where\n choice s hs := toDual (\u27e8s, fun a _b hab ha => hs \u27e8a, ha, hab\u27e9\u27e9 : UpperSet \u03b1)\ngc := gc_upperClosure_coe\n le_l_u _ := subset_upperClosure\n choice_eq _s hs := ofDual.injective <| SetLike.coe_injective <| subset_upperClosure.antisymm hs\n\n/-- `lowerClosure` forms a Galois insertion with the coercion from lower sets to sets. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_iUnion (L142-L144)\ntheorem lowerClosure_iUnion (f : \u03b9 \u2192 Set \u03b1) : lowerClosure (\u22c3 i, f i) = \u2a06 i, lowerClosure (f i) :=\n(@gc_lowerClosure_coe \u03b1 _).l_iSup\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.UpperLower.Closure.lowerClosure_le (L82-L85)\nlemma lowerClosure_le {t : LowerSet \u03b1} : lowerClosure s \u2264 t \u2194 s \u2286 t :=\n\u27e8fun h \u21a6 subset_lowerClosure.trans <| LowerSet.coe_subset_coe.2 h,\n fun h \u21a6 lowerClosure_min h t.lower\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.UpperLower.Closure.upperClosure_image (L69-L75)\ntheorem upperClosure_image (f : \u03b1 \u2243o \u03b2) :\n upperClosure (f '' s) = UpperSet.map f (upperClosure s) := by\nrw [\u2190 f.symm_symm, \u2190 UpperSet.symm_map, f.symm_symm]\n ext\n simp only [SetLike.mem_coe]\n simp [f.le_symm_apply]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.UpperLower.Closure.coe_upperClosure (L45-L48)\ntheorem coe_upperClosure (s : Set \u03b1) : \u2191(upperClosure s) = \u22c3 a \u2208 s, Ici a := by\next\n simp\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/UpperLower/Basic.lean", "module": "Mathlib.Order.UpperLower.Basic", "declaration": "Mathlib.Order.UpperLower.Basic.isLowerSet_setOf", "span": "L181-L183", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/UpperLower/Basic.lean#L181"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3808, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 9855, "lean_code_chars": 8356, "natural_language_chars": 1499, "lean_code_ratio": 0.8479, "line_count": 310, "imports_count": 0, "declarations_count": 932, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "3861072e54d222b8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Separation.Basic.IsCompact", "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.Topology.Separation.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsCompact.closure_of_subset {s K : Set X} (hK : IsCompact K) (h : s \u2286 K) :\n IsCompact (closure s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_inseparable (L81-L84)\ntheorem t0Space_iff_inseparable (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 \u2200 x y : X, Inseparable x y \u2192 x = y :=\n\u27e8fun \u27e8h\u27e9 => h, fun h => \u27e8h\u27e9\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_not_inseparable (L85-L88)\ntheorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Pairwise fun x y : X => \u00acInseparable x y := by\nsimp only [t0Space_iff_inseparable, Ne, not_imp_not, Pairwise]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Separation.Basic.Inseparable (L89-L101)\ntheorem Inseparable.eq [T0Space X] {x y : X} (h : Inseparable x y) : x = y :=\nT0Space.t0 h\n\n/-- A topology inducing map from a T\u2080 space is injective. -/\nprotected theorem Topology.IsInducing.injective [TopologicalSpace Y] [T0Space X] {f : X \u2192 Y}\n (hf : IsInducing f) : Injective f := fun _ _ h =>\n (hf.inseparable_iff.1 <| .of_eq h).eq\n\n/-- A topology inducing map from a T\u2080 space is a topological embedding. -/\nprotected theorem Topology.IsInducing.isEmbedding [TopologicalSpace Y] [T0Space X] {f : X \u2192 Y}\n (hf : IsInducing f) : IsEmbedding f :=\n \u27e8hf, hf.injective\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Separation.Basic.isEmbedding_iff_isInducing (L102-L105)\nlemma isEmbedding_iff_isInducing [TopologicalSpace Y] [T0Space X] {f : X \u2192 Y} :\n IsEmbedding f \u2194 IsInducing f :=\n\u27e8IsEmbedding.isInducing, IsInducing.isEmbedding\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_nhds_injective (L106-L109)\ntheorem t0Space_iff_nhds_injective (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Injective (\ud835\udcdd : X \u2192 Filter X) :=\nt0Space_iff_inseparable X\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Separation.Basic.nhds_injective (L110-L112)\ntheorem nhds_injective [T0Space X] : Injective (\ud835\udcdd : X \u2192 Filter X) :=\n(t0Space_iff_nhds_injective X).1 \u2039_\u203a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Separation.Basic.inseparable_iff_eq (L113-L115)\ntheorem inseparable_iff_eq [T0Space X] {x y : X} : Inseparable x y \u2194 x = y :=\nnhds_injective.eq_iff\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Separation.Basic.nhds_eq_nhds_iff (L117-L119)\ntheorem nhds_eq_nhds_iff [T0Space X] {a b : X} : \ud835\udcdd a = \ud835\udcdd b \u2194 a = b :=\nnhds_injective.eq_iff\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Separation.Basic.inseparable_eq_eq (L121-L123)\ntheorem inseparable_eq_eq [T0Space X] : Inseparable = @Eq X :=\nfunext\u2082 fun _ _ => propext inseparable_iff_eq\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Separation.Basic.TopologicalSpace (L124-L130)\ntheorem TopologicalSpace.IsTopologicalBasis.inseparable_iff {b : Set (Set X)}\n (hb : IsTopologicalBasis b) {x y : X} : Inseparable x y \u2194 \u2200 s \u2208 b, (x \u2208 s \u2194 y \u2208 s) :=\n\u27e8fun h _ hs \u21a6 inseparable_iff_forall_isOpen.1 h _ (hb.isOpen hs),\n fun h \u21a6 hb.nhds_hasBasis.eq_of_same_basis <| by\n convert hb.nhds_hasBasis using 2\n exact and_congr_right (h _)\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Separation.Basic.TopologicalSpace (L131-L134)\ntheorem TopologicalSpace.IsTopologicalBasis.eq_iff [T0Space X] {b : Set (Set X)}\n (hb : IsTopologicalBasis b) {x y : X} : x = y \u2194 \u2200 s \u2208 b, (x \u2208 s \u2194 y \u2208 s) :=\ninseparable_iff_eq.symm.trans hb.inseparable_iff\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_exists_isOpen_xor'_mem (L135-L139)\ntheorem t0Space_iff_exists_isOpen_xor'_mem (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Pairwise fun x y => \u2203 U : Set X, IsOpen U \u2227 Xor' (x \u2208 U) (y \u2208 U) := by\nsimp only [t0Space_iff_not_inseparable, xor_iff_not_iff, not_forall, exists_prop,\n inseparable_iff_forall_isOpen, Pairwise]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Separation.Basic.exists_isOpen_xor'_mem (L140-L144)\ntheorem exists_isOpen_xor'_mem [T0Space X] {x y : X} (h : x \u2260 y) :\n \u2203 U : Set X, IsOpen U \u2227 Xor' (x \u2208 U) (y \u2208 U) :=\n(t0Space_iff_exists_isOpen_xor'_mem X).1 \u2039_\u203a h\n\n/-- Specialization forms a partial order on a t0 topological space. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Separation.Basic.specializationOrder (L146-L148)\ndef specializationOrder (X) [TopologicalSpace X] [T0Space X] : PartialOrder X :=\n{ specializationPreorder X, PartialOrder.lift (OrderDual.toDual \u2218 \ud835\udcdd) nhds_injective with }\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Separation.Basic.SeparationQuotient (L149-L152)\ninstance SeparationQuotient.instT0Space : T0Space (SeparationQuotient X) :=\n\u27e8fun x y => Quotient.inductionOn\u2082' x y fun _ _ h =>\n SeparationQuotient.mk_eq_mk.2 <| SeparationQuotient.isInducing_mk.inseparable_iff.1 h\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_inf (L154-L158)\nlemma completelyRegularSpace_inf {X : Type*} {t\u2081 t\u2082 : TopologicalSpace X}\n (ht\u2081 : @CompletelyRegularSpace X t\u2081) (ht\u2082 : @CompletelyRegularSpace X t\u2082) :\n @CompletelyRegularSpace X (t\u2081 \u2293 t\u2082) := by\nrw [inf_eq_iInf]; apply completelyRegularSpace_iInf; simp [*]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_iff_isOpen (L72-L78)\nlemma completelyRegularSpace_iff_isOpen : CompletelyRegularSpace X \u2194\n \u2200 (x : X), \u2200 K : Set X, IsOpen K \u2192 x \u2208 K \u2192\n \u2203 f : X \u2192 I, Continuous f \u2227 f x = 0 \u2227 EqOn f 1 K\u1d9c := by\nconv_lhs => tactic =>\n simp_rw +singlePass [completelyRegularSpace_iff, compl_surjective.forall, isClosed_compl_iff,\n mem_compl_iff, not_not]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.Topology (L109-L120)\nlemma Topology.IsInducing.completelyRegularSpace\n {Y : Type v} [TopologicalSpace Y] [CompletelyRegularSpace Y]\n {f : X \u2192 Y} (hf : IsInducing f) : CompletelyRegularSpace X where\n completely_regular x K hK hxK := by\nrw [hf.isClosed_iff] at hK\n obtain \u27e8K, hK, rfl\u27e9 := hK\n rw [mem_preimage] at hxK\n obtain \u27e8g, hcf, egfx, hgK\u27e9 := CompletelyRegularSpace.completely_regular _ _ hK hxK\n refine \u27e8g \u2218 f, hcf.comp hf.continuous, egfx, ?_\u27e9\n conv => arg 2; equals (1 : Y \u2192 \u21a5I) \u2218 f => rfl\n exact hgK.comp_right <| mapsTo_preimage _ _\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.t35Space_iff_isEmbedding_stoneCechUnit (L270-L273)\nlemma t35Space_iff_isEmbedding_stoneCechUnit :\n T35Space X \u2194 IsEmbedding (stoneCechUnit : X \u2192 StoneCech X) where\n mp _ := isEmbedding_stoneCechUnit\nmpr hs := hs.t35Space\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isDenseInducing_stoneCechUnit (L186-L190)\nlemma isDenseInducing_stoneCechUnit [CompletelyRegularSpace X] :\n IsDenseInducing (stoneCechUnit : X \u2192 StoneCech X) where\n toIsInducing := isInducing_stoneCechUnit\ndense := denseRange_stoneCechUnit\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.separatesPoints_continuous_of_t35Space (L239-L245)\nlemma separatesPoints_continuous_of_t35Space [T35Space X] :\n SeparatesPoints {f : X \u2192 \u211d | Continuous f} := by\nintro x y x_ne_y\n obtain \u27e8f, f_cont, f_zero, f_one\u27e9 :=\n CompletelyRegularSpace.completely_regular x {y} isClosed_singleton x_ne_y\n exact \u27e8fun x \u21a6 f x, continuous_subtype_val.comp f_cont, by simp_all\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Separation.Connected.PreconnectedSpace (L30-L35)\ntheorem PreconnectedSpace.trivial_of_discrete [PreconnectedSpace X] [DiscreteTopology X] :\n Subsingleton X := by\nby_contra! \u27e8x, y, hxy\u27e9\n rw [Ne, \u2190 mem_singleton_iff, (isClopen_discrete _).eq_univ <| singleton_nonempty y] at hxy\n exact hxy (mem_univ x)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isDenseEmbedding_stoneCechUnit (L265-L269)\nlemma isDenseEmbedding_stoneCechUnit [T35Space X] :\n IsDenseEmbedding (stoneCechUnit : X \u2192 StoneCech X) where\n toIsDenseInducing := isDenseInducing_stoneCechUnit\ninjective := injective_stoneCechUnit_of_t35Space\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isInducing_stoneCechUnit (L169-L185)\nlemma isInducing_stoneCechUnit [CompletelyRegularSpace X] :\n IsInducing (stoneCechUnit : X \u2192 StoneCech X) := by\nrw [isInducing_iff_nhds]\n intro x\n apply le_antisymm\n \u00b7 rw [\u2190 map_le_iff_le_comap]; exact continuous_stoneCechUnit.continuousAt\n \u00b7 simp_rw [le_nhds_iff, ((nhds_basis_opens _).comap _).mem_iff, and_assoc]\n intro U hxU hU\n obtain \u27e8f, hf, efx, hfU\u27e9 :=\n CompletelyRegularSpace.completely_regular_isOpen x U hU hxU\n conv at hfU => equals U\u1d9c \u2286 f \u207b\u00b9' {1} => simp [EqOn, subset_def]\n rw [\u2190 compl_subset_comm, \u2190 preimage_compl, \u2190 stoneCechExtend_extends hf, preimage_comp] at hfU\n refine \u27e8stoneCechExtend hf \u207b\u00b9' {1}\u1d9c, ?_,\n isOpen_compl_singleton.preimage (continuous_stoneCechExtend hf), hfU\u27e9\n rw [mem_preimage, stoneCechExtend_stoneCechUnit, efx, mem_compl_iff, mem_singleton_iff]\n simp\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_nonempty_disjoint_clopen_cover (L56-L78)\nlemma exists_finite_nonempty_disjoint_clopen_cover (hU : IsOpenCover U) :\n \u2203 (n : \u2115) (W : Fin n \u2192 Clopens X), (\u2200 j, W j \u2260 \u22a5 \u2227 \u2203 i, (W j : Set X) \u2286 U i)\n \u2227 (univ : Set X) \u2286 \u22c3 j, \u2191(W j) \u2227 Pairwise (Disjoint on W) := by\nclassical\n obtain \u27e8n, V, hVle, hVun\u27e9 := hU.exists_finite_clopen_cover\n obtain \u27e8W, hWle, hWun, hWd\u27e9 := Fintype.exists_disjointed_le V\n simp only [\u2190 SetLike.coe_set_eq, Clopens.coe_finset_sup, Finset.mem_univ, iUnion_true] at hWun\n let t : Finset (Fin n) := {j | W j \u2260 \u22a5}\n refine \u27e8#t, fun k \u21a6 W (t.equivFin.symm k), fun k \u21a6 \u27e8?_, ?_\u27e9, fun x hx \u21a6 ?_, ?_\u27e9\n \u00b7 exact (Finset.mem_filter.mp (t.equivFin.symm k).2).2\n \u00b7 exact match hVle (t.equivFin.symm k) with | \u27e8i, hi\u27e9 => \u27e8i, subset_trans (hWle _) hi\u27e9\n \u00b7 obtain \u27e8j, hj\u27e9 := mem_iUnion.mp <| (hWun \u25b8 hVun) hx\n have : W j \u2260 \u22a5 := by simpa [\u2190 SetLike.coe_ne_coe, \u2190 Set.nonempty_iff_ne_empty] using \u27e8x, hj\u27e9\n exact mem_iUnion.mpr \u27e8t.equivFin \u27e8j, Finset.mem_filter.mpr \u27e8Finset.mem_univ _, this\u27e9\u27e9, by simpa\u27e9\n \u00b7 exact hWd.comp_of_injective <| Subtype.val_injective.comp t.equivFin.symm.injective\n\nend TopologicalSpace.IsOpenCover\n\nnamespace TopologicalSpace\nvariable {X : Type*} [TopologicalSpace X] {S : Set (X \u00d7 X)}\n\n/-- If `S` is any neighbourhood of the diagonal in a topological space `X`, any point of `X` has an\nopen neighbourhood `U` such that `U \u00d7\u02e2 U \u2286 S`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal (L127-L139)\nlemma exists_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal (hS : S \u2208 nhdsSet (diagonal V)) :\n \u2203 (n : \u2115) (D : Fin n \u2192 Clopens X), (\u2200 i, D i \u2260 \u22a5) \u2227 (\u2200 i, \u2200 y \u2208 D i, \u2200 z \u2208 D i, (f y, f z) \u2208 S)\n \u2227 (univ : Set X) \u2286 \u22c3 i, D i \u2227 Pairwise (Disjoint on D) := by\nhave : (f.prodMap f) \u207b\u00b9' S \u2208 nhdsSet (diagonal X) := by\n rw [mem_nhdsSet_iff_forall] at hS \u22a2\n rintro \u27e8x, y\u27e9 (rfl : x = y)\n exact (map_continuous _).continuousAt.preimage_mem_nhds (hS _ rfl)\n exact exists_finite_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal_of_profinite this\n\n/--\nFor any continuous function `f : X \u2192 V`, with `X` profinite, and `S` a neighbourhood of the\ndiagonal in `V \u00d7 V`, the function `f` can be `S`-approximated by a function factoring through\n`Fin n`, for some `n`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.NormalSpace (L93-L108)\ninstance NormalSpace.instCompletelyRegularSpace [NormalSpace X] [R0Space X] :\n CompletelyRegularSpace X := by\nrw [completelyRegularSpace_iff]\n intro x K hK hx\n have cx : IsClosed (closure {x}) := isClosed_closure\n have d : Disjoint (closure {x}) K := by\n rw [Set.disjoint_iff]\n intro a \u27e8hax, haK\u27e9\n exact hx ((specializes_iff_mem_closure.mpr hax).symm.mem_closed hK haK)\n let \u27e8\u27e8f, cf\u27e9, hfx, hfK, hficc\u27e9 := exists_continuous_zero_one_of_isClosed cx hK d\n let g : X \u2192 I := fun x => \u27e8f x, hficc x\u27e9\n have cg : Continuous g := cf.subtype_mk hficc\n have hgx : g x = 0 := Subtype.ext (hfx (subset_closure (mem_singleton x)))\n have hgK : EqOn g 1 K := fun k hk => Subtype.ext (hfK hk)\n exact \u27e8g, cg, hgx, hgK\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_open_cover_prod_subset_of_mem_nhds_diagonal_of_compact (L92-L126)\nlemma exists_finite_open_cover_prod_subset_of_mem_nhds_diagonal_of_compact\n (hS : S \u2208 nhdsSet (diagonal X)) :\n \u2203 (t : Finset X) (U : t \u2192 Opens X), IsOpenCover U \u2227 \u2200 i, (U i : Set X) \u00d7\u02e2 U i \u2286 S := by\nchoose U hUo hUx hUp using exists_open_prod_subset_of_mem_nhds_diagonal hS\n obtain \u27e8t, ht\u27e9 := isCompact_univ.elim_finite_subcover _ hUo (fun x _ \u21a6 mem_iUnion.mpr \u27e8_, hUx x\u27e9)\n refine \u27e8t, fun i \u21a6 \u27e8_, hUo i\u27e9, .of_sets _ ?_, (hUp \u00b7)\u27e9\n simpa [iUnion_subtype, \u2190 univ_subset_iff] using ht\n\nvariable [TotallyDisconnectedSpace X] [T2Space X]\n\n/-- If `S` is any neighbourhood of the diagonal in a profinite topological space `X`, then there\nexists a finite cover of `X` by disjoint nonempty clopens `U i` with `U i \u00d7\u02e2 U i \u2286 S` for all `i`.\n-/\nprivate lemma exists_finite_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal_of_profinite\n (hS : S \u2208 nhdsSet (diagonal X)) :\n \u2203 (n : \u2115) (D : Fin n \u2192 Clopens X), (\u2200 i, D i \u2260 \u22a5) \u2227 (\u2200 i, \u2200 y \u2208 D i, \u2200 z \u2208 D i, (y, z) \u2208 S)\n \u2227 (univ : Set X) \u2286 \u22c3 i, D i \u2227 Pairwise (Disjoint on D) := by\n obtain \u27e8t, U, hUc, hUS\u27e9 := exists_finite_open_cover_prod_subset_of_mem_nhds_diagonal_of_compact hS\n -- Now refine it to a disjoint covering.\n obtain \u27e8n, W, hW\u2081, hW\u2082, hW\u2083\u27e9 := hUc.exists_finite_nonempty_disjoint_clopen_cover\n refine \u27e8n, W, fun j \u21a6 (hW\u2081 j).1, fun j y hy z hz \u21a6 ?_, hW\u2082, hW\u2083\u27e9\n exact match (hW\u2081 j).2 with | \u27e8i, hi\u27e9 => hUS i \u27e8hi hy, hi hz\u27e9\n\nend TopologicalSpace\n\nnamespace ContinuousMap\n\nvariable {X V : Type*} [TopologicalSpace X] [TopologicalSpace V] [TotallyDisconnectedSpace X]\n [T2Space X] [CompactSpace X] {S : Set (V \u00d7 V)} (f : C(X, V))\n\n/--\nFor any continuous function `f : X \u2192 V`, with `X` profinite, and `S` a neighbourhood of the\ndiagonal in `V \u00d7 V`, there exists a finite cover of `X` by pairwise-disjoint nonempty clopens, on\neach of which `f` varies within `S`.\n-/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_clopen_cover (L40-L55)\nlemma exists_finite_clopen_cover (hU : IsOpenCover U) : \u2203 (n : \u2115) (V : Fin n \u2192 Clopens X),\n (\u2200 j, \u2203 i, (V j : Set X) \u2286 U i) \u2227 univ \u2286 \u22c3 j, (V j : Set X) := by\n-- Choose an index `r x` for each point in `X` such that `\u2200 x, x \u2208 U (r x)`.\n choose r hr using hU.exists_mem\n -- Choose a clopen neighbourhood `V x` of each `x` contained in `U (r x)`.\n choose V hV hVx hVU using fun x \u21a6 compact_exists_isClopen_in_isOpen (U _).isOpen (hr x)\n -- Apply compactness to extract a finite subset of the `V`s which covers `X`.\n obtain \u27e8t, ht\u27e9 : \u2203 t, univ \u2286 \u22c3 i \u2208 t, V i :=\n isCompact_univ.elim_finite_subcover V (fun x \u21a6 (hV x).2) (fun x _ \u21a6 mem_iUnion.mpr \u27e8x, hVx x\u27e9)\n -- Biject it noncanonically with `Fin n` for some `n`.\n refine \u27e8_, fun j \u21a6 \u27e8_, hV (t.equivFin.symm j)\u27e9, fun j \u21a6 \u27e8_, hVU _\u27e9, fun x hx \u21a6 ?_\u27e9\n obtain \u27e8m, hm, hm'\u27e9 := mem_iUnion\u2082.mp (ht hx)\n exact Set.mem_iUnion_of_mem (t.equivFin \u27e8m, hm\u27e9) (by simpa)\n\n/-- Any open cover of a profinite space can be refined to a finite cover by pairwise disjoint\nnonempty clopens. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_iInf (L129-L153)\nlemma completelyRegularSpace_iInf {\u03b9 X : Type*} {t : \u03b9 \u2192 TopologicalSpace X}\n (ht : \u2200 i, @CompletelyRegularSpace X (t i)) : @CompletelyRegularSpace X (\u2a05 i, t i) := by\nletI := (\u2a05 i, t i) -- register this as default topological space to reduce `@`s\n rw [completelyRegularSpace_iff_isOpen]\n intro x K hK hxK\n simp_rw [\u2190 hK.mem_nhds_iff, nhds_iInf, mem_iInf, exists_finite_iff_finset,\n Finset.coe_sort_coe] at hxK; clear hK\n obtain \u27e8I', V, hV, rfl\u27e9 := hxK\n simp only [mem_nhds_iff] at hV\n choose U hUV hU hxU using hV\n replace hU := fun (i : \u21a5I') =>\n @CompletelyRegularSpace.completely_regular_isOpen _ (t i) (ht i) x (U i) (hU i) (hxU i)\n clear hxU\n choose fs hfs hxfs hfsU using hU\n use I'.attach.sup fs\n constructorm* _ \u2227 _\n \u00b7 solve_by_elim [Continuous.finset_sup, continuous_iInf_dom]\n \u00b7 simpa [show (0 : \u21a5I) = \u22a5 from rfl] using hxfs\n \u00b7 simp only [EqOn, Pi.one_apply, show (1 : \u21a5I) = \u22a4 from rfl] at hfsU \u22a2\n conv => equals \u2200 x i, x \u2208 (V i)\u1d9c \u2192 \u2203 b, fs b x = \u22a4 => simp [Finset.sup_eq_top_iff]\n intro x i hxi\n specialize hfsU i (by tauto_set)\n exists i\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_iff_isInducing_stoneCechUnit (L191-L196)\nlemma completelyRegularSpace_iff_isInducing_stoneCechUnit :\n CompletelyRegularSpace X \u2194 IsInducing (stoneCechUnit : X \u2192 StoneCech X) where\n mp _ := isInducing_stoneCechUnit\nmpr hs := hs.completelyRegularSpace\n\nopen TopologicalSpace Cardinal in\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_approximation_of_mem_nhds_diagonal (L140-L161)\nlemma exists_finite_approximation_of_mem_nhds_diagonal (hS : S \u2208 nhdsSet (diagonal V)) :\n \u2203 (n : \u2115) (g : X \u2192 Fin n) (h : Fin n \u2192 V), Continuous g \u2227 \u2200 x, (f x, h (g x)) \u2208 S := by\nobtain \u27e8n, E, hEne, hES, hEuniv, hEdis\u27e9 :=\n exists_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal f hS\n have h_uniq (x) : \u2203! i, x \u2208 E i := by\n refine match mem_iUnion.mp (hEuniv <| mem_univ x) with\n | \u27e8i, hi\u27e9 => \u27e8i, hi, fun j hj \u21a6 hEdis.eq ?_\u27e9\n simpa [\u2190 Clopens.coe_disjoint, not_disjoint_iff] using \u27e8x, hj, hi\u27e9\n choose g hg hg' using h_uniq -- for each `x`, `g x` is the unique `i` such that `x \u2208 E i`\n have h_ex (i) : \u2203 x, x \u2208 E i := by\n simpa [\u2190 SetLike.coe_set_eq, \u2190 nonempty_iff_ne_empty] using hEne i\n choose r hr using h_ex -- for each `i`, choose an `r i \u2208 E i`\n refine \u27e8n, g, f \u2218 r, continuous_discrete_rng.mpr fun j \u21a6 ?_, fun x \u21a6 (hES _) _ (hg _) _ (hr _)\u27e9\n convert (E j).isOpen\n exact Set.ext fun x \u21a6 \u27e8fun hj \u21a6 hj \u25b8 hg x, fun hx \u21a6 (hg' _ _ hx).symm\u27e9\n\n/--\nIf `f` is a continuous map from a profinite space to a topological space with a commutative monoid\nstructure, then we can approximate `f` by finite products of indicator functions of clopen sets.\n\n(Note no compatibility is assumed between the monoid structure on `V` and the topology.)\n-/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_open_prod_subset_of_mem_nhds_diagonal (L79-L91)\nlemma exists_open_prod_subset_of_mem_nhds_diagonal (hS : S \u2208 nhdsSet (diagonal X)) (x : X) :\n \u2203 U : Set X, IsOpen U \u2227 x \u2208 U \u2227 U \u00d7\u02e2 U \u2286 S := by\nhave : S \u2208 \ud835\udcdd (x, x) := mem_nhdsSet_iff_forall.mp hS _ rfl\n obtain \u27e8u, v, huo, hux, hvo, hvx, H\u27e9 := by rwa [mem_nhds_prod_iff'] at this\n exact \u27e8_, huo.inter hvo, \u27e8hux, hvx\u27e9, fun p hp \u21a6 H \u27e8hp.1.1, hp.2.2\u27e9\u27e9\n\nvariable [CompactSpace X]\n\n/-- If `S` is any neighbourhood of the diagonal in a compact topological space `X`, then there\nexists a finite cover of `X` by opens `U i` such that `U i \u00d7\u02e2 U i \u2286 S` for all `i`.\n\nThat the indexing set is a finset of `X` is an artifact of the proof; it could be any finite type.\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_induced (L124-L128)\nlemma completelyRegularSpace_induced\n {X Y : Type*} {t : TopologicalSpace Y} (ht : @CompletelyRegularSpace Y t)\n (f : X \u2192 Y) : @CompletelyRegularSpace X (t.induced f) :=\n@IsInducing.completelyRegularSpace _ (t.induced f) _ t _ _ (IsInducing.induced f)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Separation.AlexandrovDiscrete.nhdsKer_eq_of_t1Space (L22-L24)\nlemma nhdsKer_eq_of_t1Space [T1Space X] (s : Set X) : nhdsKer s = s := by\next; simp [mem_nhdsKer_iff_specializes]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isEmbedding_stoneCechUnit (L260-L264)\nlemma isEmbedding_stoneCechUnit [T35Space X] :\n IsEmbedding (stoneCechUnit : X \u2192 StoneCech X) where\n toIsInducing := isInducing_stoneCechUnit\ninjective := injective_stoneCechUnit_of_t35Space\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.CompletelyRegularSpace (L79-L83)\nlemma CompletelyRegularSpace.completely_regular_isOpen [CompletelyRegularSpace X] :\n \u2200 (x : X), \u2200 K : Set X, IsOpen K \u2192 x \u2208 K \u2192\n \u2203 f : X \u2192 I, Continuous f \u2227 f x = 0 \u2227 EqOn f 1 K\u1d9c :=\ncompletelyRegularSpace_iff_isOpen.mp inferInstance\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.injective_stoneCechUnit_of_t35Space (L253-L259)\nlemma injective_stoneCechUnit_of_t35Space [T35Space X] :\n Function.Injective (stoneCechUnit : X \u2192 StoneCech X) := by\nintro a b hab\n contrapose hab\n obtain \u27e8f, fc, fab\u27e9 := separatesPoints_continuous_of_t35Space_Icc hab\n exact fun q \u21a6 fab (eq_if_stoneCechUnit_eq fc q)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Separation.Connected.IsPreconnected (L36-L41)\ntheorem IsPreconnected.infinite_of_nontrivial [T1Space X] {s : Set X} (h : IsPreconnected s)\n (hs : s.Nontrivial) : s.Infinite := by\nrefine mt (fun hf => (subsingleton_coe s).mp ?_) (not_subsingleton_iff.mpr hs)\n haveI := @Finite.instDiscreteTopology s _ _ hf.to_subtype\n exact @PreconnectedSpace.trivial_of_discrete _ _ (Subtype.preconnectedSpace h) _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.separatesPoints_continuous_of_t35Space_Icc (L246-L252)\nlemma separatesPoints_continuous_of_t35Space_Icc [T35Space X] :\n SeparatesPoints {f : X \u2192 I | Continuous f} := by\nintro x y x_ne_y\n obtain \u27e8f, f_cont, f_zero, f_one\u27e9 :=\n CompletelyRegularSpace.completely_regular x {y} isClosed_singleton x_ne_y\n exact \u27e8f, f_cont, by simp_all\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.Topology.Separation.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 IsCompact.closure_of_subset {s K : Set X} (hK : IsCompact K) (h : s \u2286 K) :\n IsCompact (closure s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_inseparable (L81-L84)\ntheorem t0Space_iff_inseparable (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 \u2200 x y : X, Inseparable x y \u2192 x = y :=\n\u27e8fun \u27e8h\u27e9 => h, fun h => \u27e8h\u27e9\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_not_inseparable (L85-L88)\ntheorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Pairwise fun x y : X => \u00acInseparable x y := by\nsimp only [t0Space_iff_inseparable, Ne, not_imp_not, Pairwise]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Separation.Basic.Inseparable (L89-L101)\ntheorem Inseparable.eq [T0Space X] {x y : X} (h : Inseparable x y) : x = y :=\nT0Space.t0 h\n\n/-- A topology inducing map from a T\u2080 space is injective. -/\nprotected theorem Topology.IsInducing.injective [TopologicalSpace Y] [T0Space X] {f : X \u2192 Y}\n (hf : IsInducing f) : Injective f := fun _ _ h =>\n (hf.inseparable_iff.1 <| .of_eq h).eq\n\n/-- A topology inducing map from a T\u2080 space is a topological embedding. -/\nprotected theorem Topology.IsInducing.isEmbedding [TopologicalSpace Y] [T0Space X] {f : X \u2192 Y}\n (hf : IsInducing f) : IsEmbedding f :=\n \u27e8hf, hf.injective\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Separation.Basic.isEmbedding_iff_isInducing (L102-L105)\nlemma isEmbedding_iff_isInducing [TopologicalSpace Y] [T0Space X] {f : X \u2192 Y} :\n IsEmbedding f \u2194 IsInducing f :=\n\u27e8IsEmbedding.isInducing, IsInducing.isEmbedding\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_nhds_injective (L106-L109)\ntheorem t0Space_iff_nhds_injective (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Injective (\ud835\udcdd : X \u2192 Filter X) :=\nt0Space_iff_inseparable X\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Separation.Basic.nhds_injective (L110-L112)\ntheorem nhds_injective [T0Space X] : Injective (\ud835\udcdd : X \u2192 Filter X) :=\n(t0Space_iff_nhds_injective X).1 \u2039_\u203a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Separation.Basic.inseparable_iff_eq (L113-L115)\ntheorem inseparable_iff_eq [T0Space X] {x y : X} : Inseparable x y \u2194 x = y :=\nnhds_injective.eq_iff\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Separation.Basic.nhds_eq_nhds_iff (L117-L119)\ntheorem nhds_eq_nhds_iff [T0Space X] {a b : X} : \ud835\udcdd a = \ud835\udcdd b \u2194 a = b :=\nnhds_injective.eq_iff\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Separation.Basic.inseparable_eq_eq (L121-L123)\ntheorem inseparable_eq_eq [T0Space X] : Inseparable = @Eq X :=\nfunext\u2082 fun _ _ => propext inseparable_iff_eq\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Separation.Basic.TopologicalSpace (L124-L130)\ntheorem TopologicalSpace.IsTopologicalBasis.inseparable_iff {b : Set (Set X)}\n (hb : IsTopologicalBasis b) {x y : X} : Inseparable x y \u2194 \u2200 s \u2208 b, (x \u2208 s \u2194 y \u2208 s) :=\n\u27e8fun h _ hs \u21a6 inseparable_iff_forall_isOpen.1 h _ (hb.isOpen hs),\n fun h \u21a6 hb.nhds_hasBasis.eq_of_same_basis <| by\n convert hb.nhds_hasBasis using 2\n exact and_congr_right (h _)\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Separation.Basic.TopologicalSpace (L131-L134)\ntheorem TopologicalSpace.IsTopologicalBasis.eq_iff [T0Space X] {b : Set (Set X)}\n (hb : IsTopologicalBasis b) {x y : X} : x = y \u2194 \u2200 s \u2208 b, (x \u2208 s \u2194 y \u2208 s) :=\ninseparable_iff_eq.symm.trans hb.inseparable_iff\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Separation.Basic.t0Space_iff_exists_isOpen_xor'_mem (L135-L139)\ntheorem t0Space_iff_exists_isOpen_xor'_mem (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Pairwise fun x y => \u2203 U : Set X, IsOpen U \u2227 Xor' (x \u2208 U) (y \u2208 U) := by\nsimp only [t0Space_iff_not_inseparable, xor_iff_not_iff, not_forall, exists_prop,\n inseparable_iff_forall_isOpen, Pairwise]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Separation.Basic.exists_isOpen_xor'_mem (L140-L144)\ntheorem exists_isOpen_xor'_mem [T0Space X] {x y : X} (h : x \u2260 y) :\n \u2203 U : Set X, IsOpen U \u2227 Xor' (x \u2208 U) (y \u2208 U) :=\n(t0Space_iff_exists_isOpen_xor'_mem X).1 \u2039_\u203a h\n\n/-- Specialization forms a partial order on a t0 topological space. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Separation.Basic.specializationOrder (L146-L148)\ndef specializationOrder (X) [TopologicalSpace X] [T0Space X] : PartialOrder X :=\n{ specializationPreorder X, PartialOrder.lift (OrderDual.toDual \u2218 \ud835\udcdd) nhds_injective with }\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Separation.Basic.SeparationQuotient (L149-L152)\ninstance SeparationQuotient.instT0Space : T0Space (SeparationQuotient X) :=\n\u27e8fun x y => Quotient.inductionOn\u2082' x y fun _ _ h =>\n SeparationQuotient.mk_eq_mk.2 <| SeparationQuotient.isInducing_mk.inseparable_iff.1 h\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_inf (L154-L158)\nlemma completelyRegularSpace_inf {X : Type*} {t\u2081 t\u2082 : TopologicalSpace X}\n (ht\u2081 : @CompletelyRegularSpace X t\u2081) (ht\u2082 : @CompletelyRegularSpace X t\u2082) :\n @CompletelyRegularSpace X (t\u2081 \u2293 t\u2082) := by\nrw [inf_eq_iInf]; apply completelyRegularSpace_iInf; simp [*]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_iff_isOpen (L72-L78)\nlemma completelyRegularSpace_iff_isOpen : CompletelyRegularSpace X \u2194\n \u2200 (x : X), \u2200 K : Set X, IsOpen K \u2192 x \u2208 K \u2192\n \u2203 f : X \u2192 I, Continuous f \u2227 f x = 0 \u2227 EqOn f 1 K\u1d9c := by\nconv_lhs => tactic =>\n simp_rw +singlePass [completelyRegularSpace_iff, compl_surjective.forall, isClosed_compl_iff,\n mem_compl_iff, not_not]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.Topology (L109-L120)\nlemma Topology.IsInducing.completelyRegularSpace\n {Y : Type v} [TopologicalSpace Y] [CompletelyRegularSpace Y]\n {f : X \u2192 Y} (hf : IsInducing f) : CompletelyRegularSpace X where\n completely_regular x K hK hxK := by\nrw [hf.isClosed_iff] at hK\n obtain \u27e8K, hK, rfl\u27e9 := hK\n rw [mem_preimage] at hxK\n obtain \u27e8g, hcf, egfx, hgK\u27e9 := CompletelyRegularSpace.completely_regular _ _ hK hxK\n refine \u27e8g \u2218 f, hcf.comp hf.continuous, egfx, ?_\u27e9\n conv => arg 2; equals (1 : Y \u2192 \u21a5I) \u2218 f => rfl\n exact hgK.comp_right <| mapsTo_preimage _ _\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.t35Space_iff_isEmbedding_stoneCechUnit (L270-L273)\nlemma t35Space_iff_isEmbedding_stoneCechUnit :\n T35Space X \u2194 IsEmbedding (stoneCechUnit : X \u2192 StoneCech X) where\n mp _ := isEmbedding_stoneCechUnit\nmpr hs := hs.t35Space\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isDenseInducing_stoneCechUnit (L186-L190)\nlemma isDenseInducing_stoneCechUnit [CompletelyRegularSpace X] :\n IsDenseInducing (stoneCechUnit : X \u2192 StoneCech X) where\n toIsInducing := isInducing_stoneCechUnit\ndense := denseRange_stoneCechUnit\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.separatesPoints_continuous_of_t35Space (L239-L245)\nlemma separatesPoints_continuous_of_t35Space [T35Space X] :\n SeparatesPoints {f : X \u2192 \u211d | Continuous f} := by\nintro x y x_ne_y\n obtain \u27e8f, f_cont, f_zero, f_one\u27e9 :=\n CompletelyRegularSpace.completely_regular x {y} isClosed_singleton x_ne_y\n exact \u27e8fun x \u21a6 f x, continuous_subtype_val.comp f_cont, by simp_all\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Separation.Connected.PreconnectedSpace (L30-L35)\ntheorem PreconnectedSpace.trivial_of_discrete [PreconnectedSpace X] [DiscreteTopology X] :\n Subsingleton X := by\nby_contra! \u27e8x, y, hxy\u27e9\n rw [Ne, \u2190 mem_singleton_iff, (isClopen_discrete _).eq_univ <| singleton_nonempty y] at hxy\n exact hxy (mem_univ x)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isDenseEmbedding_stoneCechUnit (L265-L269)\nlemma isDenseEmbedding_stoneCechUnit [T35Space X] :\n IsDenseEmbedding (stoneCechUnit : X \u2192 StoneCech X) where\n toIsDenseInducing := isDenseInducing_stoneCechUnit\ninjective := injective_stoneCechUnit_of_t35Space\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isInducing_stoneCechUnit (L169-L185)\nlemma isInducing_stoneCechUnit [CompletelyRegularSpace X] :\n IsInducing (stoneCechUnit : X \u2192 StoneCech X) := by\nrw [isInducing_iff_nhds]\n intro x\n apply le_antisymm\n \u00b7 rw [\u2190 map_le_iff_le_comap]; exact continuous_stoneCechUnit.continuousAt\n \u00b7 simp_rw [le_nhds_iff, ((nhds_basis_opens _).comap _).mem_iff, and_assoc]\n intro U hxU hU\n obtain \u27e8f, hf, efx, hfU\u27e9 :=\n CompletelyRegularSpace.completely_regular_isOpen x U hU hxU\n conv at hfU => equals U\u1d9c \u2286 f \u207b\u00b9' {1} => simp [EqOn, subset_def]\n rw [\u2190 compl_subset_comm, \u2190 preimage_compl, \u2190 stoneCechExtend_extends hf, preimage_comp] at hfU\n refine \u27e8stoneCechExtend hf \u207b\u00b9' {1}\u1d9c, ?_,\n isOpen_compl_singleton.preimage (continuous_stoneCechExtend hf), hfU\u27e9\n rw [mem_preimage, stoneCechExtend_stoneCechUnit, efx, mem_compl_iff, mem_singleton_iff]\n simp\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_nonempty_disjoint_clopen_cover (L56-L78)\nlemma exists_finite_nonempty_disjoint_clopen_cover (hU : IsOpenCover U) :\n \u2203 (n : \u2115) (W : Fin n \u2192 Clopens X), (\u2200 j, W j \u2260 \u22a5 \u2227 \u2203 i, (W j : Set X) \u2286 U i)\n \u2227 (univ : Set X) \u2286 \u22c3 j, \u2191(W j) \u2227 Pairwise (Disjoint on W) := by\nclassical\n obtain \u27e8n, V, hVle, hVun\u27e9 := hU.exists_finite_clopen_cover\n obtain \u27e8W, hWle, hWun, hWd\u27e9 := Fintype.exists_disjointed_le V\n simp only [\u2190 SetLike.coe_set_eq, Clopens.coe_finset_sup, Finset.mem_univ, iUnion_true] at hWun\n let t : Finset (Fin n) := {j | W j \u2260 \u22a5}\n refine \u27e8#t, fun k \u21a6 W (t.equivFin.symm k), fun k \u21a6 \u27e8?_, ?_\u27e9, fun x hx \u21a6 ?_, ?_\u27e9\n \u00b7 exact (Finset.mem_filter.mp (t.equivFin.symm k).2).2\n \u00b7 exact match hVle (t.equivFin.symm k) with | \u27e8i, hi\u27e9 => \u27e8i, subset_trans (hWle _) hi\u27e9\n \u00b7 obtain \u27e8j, hj\u27e9 := mem_iUnion.mp <| (hWun \u25b8 hVun) hx\n have : W j \u2260 \u22a5 := by simpa [\u2190 SetLike.coe_ne_coe, \u2190 Set.nonempty_iff_ne_empty] using \u27e8x, hj\u27e9\n exact mem_iUnion.mpr \u27e8t.equivFin \u27e8j, Finset.mem_filter.mpr \u27e8Finset.mem_univ _, this\u27e9\u27e9, by simpa\u27e9\n \u00b7 exact hWd.comp_of_injective <| Subtype.val_injective.comp t.equivFin.symm.injective\n\nend TopologicalSpace.IsOpenCover\n\nnamespace TopologicalSpace\nvariable {X : Type*} [TopologicalSpace X] {S : Set (X \u00d7 X)}\n\n/-- If `S` is any neighbourhood of the diagonal in a topological space `X`, any point of `X` has an\nopen neighbourhood `U` such that `U \u00d7\u02e2 U \u2286 S`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal (L127-L139)\nlemma exists_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal (hS : S \u2208 nhdsSet (diagonal V)) :\n \u2203 (n : \u2115) (D : Fin n \u2192 Clopens X), (\u2200 i, D i \u2260 \u22a5) \u2227 (\u2200 i, \u2200 y \u2208 D i, \u2200 z \u2208 D i, (f y, f z) \u2208 S)\n \u2227 (univ : Set X) \u2286 \u22c3 i, D i \u2227 Pairwise (Disjoint on D) := by\nhave : (f.prodMap f) \u207b\u00b9' S \u2208 nhdsSet (diagonal X) := by\n rw [mem_nhdsSet_iff_forall] at hS \u22a2\n rintro \u27e8x, y\u27e9 (rfl : x = y)\n exact (map_continuous _).continuousAt.preimage_mem_nhds (hS _ rfl)\n exact exists_finite_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal_of_profinite this\n\n/--\nFor any continuous function `f : X \u2192 V`, with `X` profinite, and `S` a neighbourhood of the\ndiagonal in `V \u00d7 V`, the function `f` can be `S`-approximated by a function factoring through\n`Fin n`, for some `n`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.NormalSpace (L93-L108)\ninstance NormalSpace.instCompletelyRegularSpace [NormalSpace X] [R0Space X] :\n CompletelyRegularSpace X := by\nrw [completelyRegularSpace_iff]\n intro x K hK hx\n have cx : IsClosed (closure {x}) := isClosed_closure\n have d : Disjoint (closure {x}) K := by\n rw [Set.disjoint_iff]\n intro a \u27e8hax, haK\u27e9\n exact hx ((specializes_iff_mem_closure.mpr hax).symm.mem_closed hK haK)\n let \u27e8\u27e8f, cf\u27e9, hfx, hfK, hficc\u27e9 := exists_continuous_zero_one_of_isClosed cx hK d\n let g : X \u2192 I := fun x => \u27e8f x, hficc x\u27e9\n have cg : Continuous g := cf.subtype_mk hficc\n have hgx : g x = 0 := Subtype.ext (hfx (subset_closure (mem_singleton x)))\n have hgK : EqOn g 1 K := fun k hk => Subtype.ext (hfK hk)\n exact \u27e8g, cg, hgx, hgK\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_open_cover_prod_subset_of_mem_nhds_diagonal_of_compact (L92-L126)\nlemma exists_finite_open_cover_prod_subset_of_mem_nhds_diagonal_of_compact\n (hS : S \u2208 nhdsSet (diagonal X)) :\n \u2203 (t : Finset X) (U : t \u2192 Opens X), IsOpenCover U \u2227 \u2200 i, (U i : Set X) \u00d7\u02e2 U i \u2286 S := by\nchoose U hUo hUx hUp using exists_open_prod_subset_of_mem_nhds_diagonal hS\n obtain \u27e8t, ht\u27e9 := isCompact_univ.elim_finite_subcover _ hUo (fun x _ \u21a6 mem_iUnion.mpr \u27e8_, hUx x\u27e9)\n refine \u27e8t, fun i \u21a6 \u27e8_, hUo i\u27e9, .of_sets _ ?_, (hUp \u00b7)\u27e9\n simpa [iUnion_subtype, \u2190 univ_subset_iff] using ht\n\nvariable [TotallyDisconnectedSpace X] [T2Space X]\n\n/-- If `S` is any neighbourhood of the diagonal in a profinite topological space `X`, then there\nexists a finite cover of `X` by disjoint nonempty clopens `U i` with `U i \u00d7\u02e2 U i \u2286 S` for all `i`.\n-/\nprivate lemma exists_finite_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal_of_profinite\n (hS : S \u2208 nhdsSet (diagonal X)) :\n \u2203 (n : \u2115) (D : Fin n \u2192 Clopens X), (\u2200 i, D i \u2260 \u22a5) \u2227 (\u2200 i, \u2200 y \u2208 D i, \u2200 z \u2208 D i, (y, z) \u2208 S)\n \u2227 (univ : Set X) \u2286 \u22c3 i, D i \u2227 Pairwise (Disjoint on D) := by\n obtain \u27e8t, U, hUc, hUS\u27e9 := exists_finite_open_cover_prod_subset_of_mem_nhds_diagonal_of_compact hS\n -- Now refine it to a disjoint covering.\n obtain \u27e8n, W, hW\u2081, hW\u2082, hW\u2083\u27e9 := hUc.exists_finite_nonempty_disjoint_clopen_cover\n refine \u27e8n, W, fun j \u21a6 (hW\u2081 j).1, fun j y hy z hz \u21a6 ?_, hW\u2082, hW\u2083\u27e9\n exact match (hW\u2081 j).2 with | \u27e8i, hi\u27e9 => hUS i \u27e8hi hy, hi hz\u27e9\n\nend TopologicalSpace\n\nnamespace ContinuousMap\n\nvariable {X V : Type*} [TopologicalSpace X] [TopologicalSpace V] [TotallyDisconnectedSpace X]\n [T2Space X] [CompactSpace X] {S : Set (V \u00d7 V)} (f : C(X, V))\n\n/--\nFor any continuous function `f : X \u2192 V`, with `X` profinite, and `S` a neighbourhood of the\ndiagonal in `V \u00d7 V`, there exists a finite cover of `X` by pairwise-disjoint nonempty clopens, on\neach of which `f` varies within `S`.\n-/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_clopen_cover (L40-L55)\nlemma exists_finite_clopen_cover (hU : IsOpenCover U) : \u2203 (n : \u2115) (V : Fin n \u2192 Clopens X),\n (\u2200 j, \u2203 i, (V j : Set X) \u2286 U i) \u2227 univ \u2286 \u22c3 j, (V j : Set X) := by\n-- Choose an index `r x` for each point in `X` such that `\u2200 x, x \u2208 U (r x)`.\n choose r hr using hU.exists_mem\n -- Choose a clopen neighbourhood `V x` of each `x` contained in `U (r x)`.\n choose V hV hVx hVU using fun x \u21a6 compact_exists_isClopen_in_isOpen (U _).isOpen (hr x)\n -- Apply compactness to extract a finite subset of the `V`s which covers `X`.\n obtain \u27e8t, ht\u27e9 : \u2203 t, univ \u2286 \u22c3 i \u2208 t, V i :=\n isCompact_univ.elim_finite_subcover V (fun x \u21a6 (hV x).2) (fun x _ \u21a6 mem_iUnion.mpr \u27e8x, hVx x\u27e9)\n -- Biject it noncanonically with `Fin n` for some `n`.\n refine \u27e8_, fun j \u21a6 \u27e8_, hV (t.equivFin.symm j)\u27e9, fun j \u21a6 \u27e8_, hVU _\u27e9, fun x hx \u21a6 ?_\u27e9\n obtain \u27e8m, hm, hm'\u27e9 := mem_iUnion\u2082.mp (ht hx)\n exact Set.mem_iUnion_of_mem (t.equivFin \u27e8m, hm\u27e9) (by simpa)\n\n/-- Any open cover of a profinite space can be refined to a finite cover by pairwise disjoint\nnonempty clopens. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_iInf (L129-L153)\nlemma completelyRegularSpace_iInf {\u03b9 X : Type*} {t : \u03b9 \u2192 TopologicalSpace X}\n (ht : \u2200 i, @CompletelyRegularSpace X (t i)) : @CompletelyRegularSpace X (\u2a05 i, t i) := by\nletI := (\u2a05 i, t i) -- register this as default topological space to reduce `@`s\n rw [completelyRegularSpace_iff_isOpen]\n intro x K hK hxK\n simp_rw [\u2190 hK.mem_nhds_iff, nhds_iInf, mem_iInf, exists_finite_iff_finset,\n Finset.coe_sort_coe] at hxK; clear hK\n obtain \u27e8I', V, hV, rfl\u27e9 := hxK\n simp only [mem_nhds_iff] at hV\n choose U hUV hU hxU using hV\n replace hU := fun (i : \u21a5I') =>\n @CompletelyRegularSpace.completely_regular_isOpen _ (t i) (ht i) x (U i) (hU i) (hxU i)\n clear hxU\n choose fs hfs hxfs hfsU using hU\n use I'.attach.sup fs\n constructorm* _ \u2227 _\n \u00b7 solve_by_elim [Continuous.finset_sup, continuous_iInf_dom]\n \u00b7 simpa [show (0 : \u21a5I) = \u22a5 from rfl] using hxfs\n \u00b7 simp only [EqOn, Pi.one_apply, show (1 : \u21a5I) = \u22a4 from rfl] at hfsU \u22a2\n conv => equals \u2200 x i, x \u2208 (V i)\u1d9c \u2192 \u2203 b, fs b x = \u22a4 => simp [Finset.sup_eq_top_iff]\n intro x i hxi\n specialize hfsU i (by tauto_set)\n exists i\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_iff_isInducing_stoneCechUnit (L191-L196)\nlemma completelyRegularSpace_iff_isInducing_stoneCechUnit :\n CompletelyRegularSpace X \u2194 IsInducing (stoneCechUnit : X \u2192 StoneCech X) where\n mp _ := isInducing_stoneCechUnit\nmpr hs := hs.completelyRegularSpace\n\nopen TopologicalSpace Cardinal in\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_finite_approximation_of_mem_nhds_diagonal (L140-L161)\nlemma exists_finite_approximation_of_mem_nhds_diagonal (hS : S \u2208 nhdsSet (diagonal V)) :\n \u2203 (n : \u2115) (g : X \u2192 Fin n) (h : Fin n \u2192 V), Continuous g \u2227 \u2200 x, (f x, h (g x)) \u2208 S := by\nobtain \u27e8n, E, hEne, hES, hEuniv, hEdis\u27e9 :=\n exists_disjoint_nonempty_clopen_cover_of_mem_nhds_diagonal f hS\n have h_uniq (x) : \u2203! i, x \u2208 E i := by\n refine match mem_iUnion.mp (hEuniv <| mem_univ x) with\n | \u27e8i, hi\u27e9 => \u27e8i, hi, fun j hj \u21a6 hEdis.eq ?_\u27e9\n simpa [\u2190 Clopens.coe_disjoint, not_disjoint_iff] using \u27e8x, hj, hi\u27e9\n choose g hg hg' using h_uniq -- for each `x`, `g x` is the unique `i` such that `x \u2208 E i`\n have h_ex (i) : \u2203 x, x \u2208 E i := by\n simpa [\u2190 SetLike.coe_set_eq, \u2190 nonempty_iff_ne_empty] using hEne i\n choose r hr using h_ex -- for each `i`, choose an `r i \u2208 E i`\n refine \u27e8n, g, f \u2218 r, continuous_discrete_rng.mpr fun j \u21a6 ?_, fun x \u21a6 (hES _) _ (hg _) _ (hr _)\u27e9\n convert (E j).isOpen\n exact Set.ext fun x \u21a6 \u27e8fun hj \u21a6 hj \u25b8 hg x, fun hx \u21a6 (hg' _ _ hx).symm\u27e9\n\n/--\nIf `f` is a continuous map from a profinite space to a topological space with a commutative monoid\nstructure, then we can approximate `f` by finite products of indicator functions of clopen sets.\n\n(Note no compatibility is assumed between the monoid structure on `V` and the topology.)\n-/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Separation.DisjointCover.exists_open_prod_subset_of_mem_nhds_diagonal (L79-L91)\nlemma exists_open_prod_subset_of_mem_nhds_diagonal (hS : S \u2208 nhdsSet (diagonal X)) (x : X) :\n \u2203 U : Set X, IsOpen U \u2227 x \u2208 U \u2227 U \u00d7\u02e2 U \u2286 S := by\nhave : S \u2208 \ud835\udcdd (x, x) := mem_nhdsSet_iff_forall.mp hS _ rfl\n obtain \u27e8u, v, huo, hux, hvo, hvx, H\u27e9 := by rwa [mem_nhds_prod_iff'] at this\n exact \u27e8_, huo.inter hvo, \u27e8hux, hvx\u27e9, fun p hp \u21a6 H \u27e8hp.1.1, hp.2.2\u27e9\u27e9\n\nvariable [CompactSpace X]\n\n/-- If `S` is any neighbourhood of the diagonal in a compact topological space `X`, then there\nexists a finite cover of `X` by opens `U i` such that `U i \u00d7\u02e2 U i \u2286 S` for all `i`.\n\nThat the indexing set is a finset of `X` is an artifact of the proof; it could be any finite type.\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.completelyRegularSpace_induced (L124-L128)\nlemma completelyRegularSpace_induced\n {X Y : Type*} {t : TopologicalSpace Y} (ht : @CompletelyRegularSpace Y t)\n (f : X \u2192 Y) : @CompletelyRegularSpace X (t.induced f) :=\n@IsInducing.completelyRegularSpace _ (t.induced f) _ t _ _ (IsInducing.induced f)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Separation.AlexandrovDiscrete.nhdsKer_eq_of_t1Space (L22-L24)\nlemma nhdsKer_eq_of_t1Space [T1Space X] (s : Set X) : nhdsKer s = s := by\next; simp [mem_nhdsKer_iff_specializes]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.isEmbedding_stoneCechUnit (L260-L264)\nlemma isEmbedding_stoneCechUnit [T35Space X] :\n IsEmbedding (stoneCechUnit : X \u2192 StoneCech X) where\n toIsInducing := isInducing_stoneCechUnit\ninjective := injective_stoneCechUnit_of_t35Space\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.CompletelyRegularSpace (L79-L83)\nlemma CompletelyRegularSpace.completely_regular_isOpen [CompletelyRegularSpace X] :\n \u2200 (x : X), \u2200 K : Set X, IsOpen K \u2192 x \u2208 K \u2192\n \u2203 f : X \u2192 I, Continuous f \u2227 f x = 0 \u2227 EqOn f 1 K\u1d9c :=\ncompletelyRegularSpace_iff_isOpen.mp inferInstance\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.injective_stoneCechUnit_of_t35Space (L253-L259)\nlemma injective_stoneCechUnit_of_t35Space [T35Space X] :\n Function.Injective (stoneCechUnit : X \u2192 StoneCech X) := by\nintro a b hab\n contrapose hab\n obtain \u27e8f, fc, fab\u27e9 := separatesPoints_continuous_of_t35Space_Icc hab\n exact fun q \u21a6 fab (eq_if_stoneCechUnit_eq fc q)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Separation.Connected.IsPreconnected (L36-L41)\ntheorem IsPreconnected.infinite_of_nontrivial [T1Space X] {s : Set X} (h : IsPreconnected s)\n (hs : s.Nontrivial) : s.Infinite := by\nrefine mt (fun hf => (subsingleton_coe s).mp ?_) (not_subsingleton_iff.mpr hs)\n haveI := @Finite.instDiscreteTopology s _ _ hf.to_subtype\n exact @PreconnectedSpace.trivial_of_discrete _ _ (Subtype.preconnectedSpace h) _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Separation.CompletelyRegular.separatesPoints_continuous_of_t35Space_Icc (L246-L252)\nlemma separatesPoints_continuous_of_t35Space_Icc [T35Space X] :\n SeparatesPoints {f : X \u2192 I | Continuous f} := by\nintro x y x_ne_y\n obtain \u27e8f, f_cont, f_zero, f_one\u27e9 :=\n CompletelyRegularSpace.completely_regular x {y} isClosed_singleton x_ne_y\n exact \u27e8f, f_cont, by simp_all\u27e9\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Separation/Basic.lean", "module": "Mathlib.Topology.Separation.Basic", "declaration": "Mathlib.Topology.Separation.Basic.IsCompact", "span": "L962-L965", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Separation/Basic.lean#L962"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 8318, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 21961, "lean_code_chars": 20459, "natural_language_chars": 1502, "lean_code_ratio": 0.9316, "line_count": 522, "imports_count": 0, "declarations_count": 2385, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "01578e44bd7562be", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioc_iff_right", "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.Algebra.Order.Interval.Set.Group)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem add_mem_Ioc_iff_right : a + b \u2208 Set.Ioc c d \u2194 b \u2208 Set.Ioc (c - a) (d - a)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Icc_iff (L32-L34)\ntheorem inv_mem_Icc_iff : a\u207b\u00b9 \u2208 Set.Icc c d \u2194 a \u2208 Set.Icc d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_le' le_inv'\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Ico_iff (L36-L38)\ntheorem inv_mem_Ico_iff : a\u207b\u00b9 \u2208 Set.Ico c d \u2194 a \u2208 Set.Ioc d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_lt' le_inv'\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Ioc_iff (L40-L42)\ntheorem inv_mem_Ioc_iff : a\u207b\u00b9 \u2208 Set.Ioc c d \u2194 a \u2208 Set.Ico d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_le' lt_inv'\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Ioo_iff (L44-L54)\ntheorem inv_mem_Ioo_iff : a\u207b\u00b9 \u2208 Set.Ioo c d \u2194 a \u2208 Set.Ioo d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_lt' lt_inv'\n\nend OrderedCommGroup\n\nsection OrderedAddCommGroup\n\nvariable [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1] {a b c d : \u03b1}\n\n/-! `add_mem_Ixx_iff_left` -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Icc_iff_left (L55-L57)\ntheorem add_mem_Icc_iff_left : a + b \u2208 Set.Icc c d \u2194 a \u2208 Set.Icc (c - b) (d - b) :=\n(and_congr sub_le_iff_le_add le_sub_iff_add_le).symm\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ico_iff_left (L58-L60)\ntheorem add_mem_Ico_iff_left : a + b \u2208 Set.Ico c d \u2194 a \u2208 Set.Ico (c - b) (d - b) :=\n(and_congr sub_le_iff_le_add lt_sub_iff_add_lt).symm\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioc_iff_left (L61-L63)\ntheorem add_mem_Ioc_iff_left : a + b \u2208 Set.Ioc c d \u2194 a \u2208 Set.Ioc (c - b) (d - b) :=\n(and_congr sub_lt_iff_lt_add le_sub_iff_add_le).symm\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioo_iff_left (L64-L68)\ntheorem add_mem_Ioo_iff_left : a + b \u2208 Set.Ioo c d \u2194 a \u2208 Set.Ioo (c - b) (d - b) :=\n(and_congr sub_lt_iff_lt_add lt_sub_iff_add_lt).symm\n\n/-! `add_mem_Ixx_iff_right` -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Icc_iff_right (L69-L71)\ntheorem add_mem_Icc_iff_right : a + b \u2208 Set.Icc c d \u2194 b \u2208 Set.Icc (c - a) (d - a) :=\n(and_congr sub_le_iff_le_add' le_sub_iff_add_le').symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ico_iff_right (L72-L74)\ntheorem add_mem_Ico_iff_right : a + b \u2208 Set.Ico c d \u2194 b \u2208 Set.Ico (c - a) (d - a) :=\n(and_congr sub_le_iff_le_add' lt_sub_iff_add_lt').symm\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioo_iff_right (L78-L82)\ntheorem add_mem_Ioo_iff_right : a + b \u2208 Set.Ioo c d \u2194 b \u2208 Set.Ioo (c - a) (d - a) :=\n(and_congr sub_lt_iff_lt_add' lt_sub_iff_add_lt').symm\n\n/-! `sub_mem_Ixx_iff_left` -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Icc_iff_left (L83-L85)\ntheorem sub_mem_Icc_iff_left : a - b \u2208 Set.Icc c d \u2194 a \u2208 Set.Icc (c + b) (d + b) :=\nand_congr le_sub_iff_add_le sub_le_iff_le_add\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Ico_iff_left (L86-L88)\ntheorem sub_mem_Ico_iff_left : a - b \u2208 Set.Ico c d \u2194 a \u2208 Set.Ico (c + b) (d + b) :=\nand_congr le_sub_iff_add_le sub_lt_iff_lt_add\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Ioc_iff_left (L89-L91)\ntheorem sub_mem_Ioc_iff_left : a - b \u2208 Set.Ioc c d \u2194 a \u2208 Set.Ioc (c + b) (d + b) :=\nand_congr lt_sub_iff_add_lt sub_le_iff_le_add\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Ioo_iff_left (L92-L96)\ntheorem sub_mem_Ioo_iff_left : a - b \u2208 Set.Ioo c d \u2194 a \u2208 Set.Ioo (c + b) (d + b) :=\nand_congr lt_sub_iff_add_lt sub_lt_iff_lt_add\n\n/-! `sub_mem_Ixx_iff_right` -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.Simps (L80-L84)\ndef Simps.apply (f : AbsoluteValue R S) : R \u2192 S :=\nf\n\ninitialize_simps_projections AbsoluteValue (toFun \u2192 apply)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.sub_le_add (L235-L237)\nlemma sub_le_add (a b : R) : abv (a - b) \u2264 abv a + abv b := by\nsimpa only [\u2190 sub_eq_add_neg, AbsoluteValue.map_neg] using abv.add_le a (-b)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidWithZeroHom (L169-L172)\ntheorem coe_toMonoidWithZeroHom : \u21d1abv.toMonoidWithZeroHom = abv :=\nrfl\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*` and `1`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f := f.toFun\ncoe_injective' f g h := by obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := f; obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := g; congr\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_mul := fun f => f.map_mul' }\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.monoidWithZeroHomClass (L159-L164)\ninstance monoidWithZeroHomClass : MonoidWithZeroHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.mulHomClass with\n map_zero := fun f => f.map_zero\n map_one := fun f => f.map_one }\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*`, `0` and `1`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial_apply (L319-L334)\nlemma trivial_apply {x : R} (hx : x \u2260 0) : AbsoluteValue.trivial (S := S) x = 1 :=\nif_neg hx\n\nend trivial\n\nsection nontrivial\n\nsection OrderedSemiring\n\nvariable {R : Type*} [Semiring R] {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S]\n\n/-- An absolute value on a semiring `R` without zero divisors is *nontrivial* if it takes\na value `\u2260 1` on a nonzero element.\n\nThis has the advantage over `v \u2260 .trivial` that it does not require decidability\nof `\u00b7 = 0` in `R`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidHom (L173-L175)\ndef toMonoidHom : R \u2192* S :=\nabv\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_nat_le_self (L186-L206)\nlemma apply_nat_le_self [IsOrderedRing S] (n : \u2115) : abv n \u2264 n := by\ncases subsingleton_or_nontrivial R\n \u00b7 simp [Subsingleton.eq_zero (n : R)]\n induction n with\n | zero => simp\n | succ n ih =>\n \u00b7 grw [Nat.cast_succ, Nat.cast_succ, abv.add_le, abv.map_one, ih]\n\nend IsDomain\n\nend Semiring\n\nend OrderedSemiring\n\nsection OrderedRing\n\nsection Ring\n\nvariable {R S : Type*} [Ring R] [Ring S] [PartialOrder S] [IsOrderedRing S]\n (abv : AbsoluteValue R S)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.listSum_le (L102-L106)\nlemma listSum_le [AddLeftMono S] (l : List R) : abv l.sum \u2264 (l.map abv).sum := by\ninduction l with\n | nil => simp\n | cons head tail ih => exact (abv.add_le ..).trans <| add_le_add_right ih (abv head)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.ext (L76-L79)\ntheorem ext \u2983f g : AbsoluteValue R S\u2984 : (\u2200 x, f x = g x) \u2192 f = g :=\nDFunLike.ext _ _\n\n/-- See Note [custom simps projection]. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_natAbs_eq (L250-L255)\nlemma apply_natAbs_eq (x : \u2124) : abv (natAbs x) = abv x := by\nobtain \u27e8_, rfl | rfl\u27e9 := Int.eq_nat_or_neg x <;> simp\n\nopen Int in\n/-- Values of an absolute value coincide on the image of `\u2115` in `R`\nif and only if they coincide on the image of `\u2124` in `R`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial (L300-L317)\ndef trivial : AbsoluteValue R S where\n toFun x := if x = 0 then 0 else 1\nmap_mul' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp [hx, hy]\n nonneg' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n eq_zero' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n add_le' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp only [hx, \u2193reduceIte, hy, one_add_one_eq_two]\n rcases eq_or_ne (x + y) 0 with hxy | hxy <;> simp [hxy, one_le_two]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with apply_nonneg := fun f => f.nonneg' }\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.addGroupSeminormClass (L238-L242)\ninstance addGroupSeminormClass : AddGroupSeminormClass (AbsoluteValue R S) R S where\n toSubadditiveHomClass := AbsoluteValue.subadditiveHomClass\nmap_zero := AbsoluteValue.map_zero\n map_neg_eq_map f a := AbsoluteValue.map_neg f a\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.eq_on_nat_iff_eq_on_int (L256-L268)\nlemma eq_on_nat_iff_eq_on_int {f g : AbsoluteValue R S} :\n (\u2200 n : \u2115, f n = g n) \u2194 \u2200 n : \u2124, f n = g n := by\nrefine \u27e8fun h z \u21a6 ?_, fun a n \u21a6 mod_cast a n\u27e9\n obtain \u27e8n, rfl | rfl\u27e9 := Int.eq_nat_or_neg z <;> simp [h n]\n\nend OrderedCommRing\n\nsection LinearOrderedRing\n\nvariable {R S : Type*} [Semiring R] [Ring S] [LinearOrder S] [IsStrictOrderedRing S]\n (abv : AbsoluteValue R S)\n\n/-- `AbsoluteValue.abs` is `abs` as a bundled `AbsoluteValue`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_one_of_isLeftRegular (L124-L126)\ntheorem map_one_of_isLeftRegular (h : IsLeftRegular (abv 1)) : abv 1 = 1 :=\nh <| by simp [\u2190 abv.map_mul]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMulHom (L86-L88)\ntheorem coe_toMulHom : \u21d1abv.toMulHom = abv :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f := (f.eq_zero' _).2 rfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_add_le_add := fun f => f.add_le' }\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abs_abv_sub_le_abv_sub (L288-L299)\ntheorem abs_abv_sub_le_abv_sub (a b : R) : abs (abv a - abv b) \u2264 abv (a - b) :=\nabs_sub_le_iff.2 \u27e8abv.le_sub _ _, by rw [abv.map_sub]; apply abv.le_sub\u27e9\n\nend LinearOrderedCommRing\n\nsection trivial\n\nvariable {R : Type*} [Semiring R] [DecidablePred fun x : R \u21a6 x = 0] [NoZeroDivisors R]\nvariable {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S] [Nontrivial S]\n\n/-- The *trivial* absolute value takes the value `1` on all nonzero elements. -/\nprotected\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidHom (L177-L179)\ntheorem coe_toMonoidHom : \u21d1abv.toMonoidHom = abv :=\nrfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_sub_eq_zero_iff (L141-L154)\ntheorem map_sub_eq_zero_iff (a b : R) : abv (a - b) = 0 \u2194 a = b :=\nabv.eq_zero.trans sub_eq_zero\n\nend Ring\n\nsection Semiring\n\nsection IsDomain\n\n-- all of these are true for `NoZeroDivisors S`; but it doesn't work smoothly with the\n-- `IsDomain`/`IsCancelMulZero` API\nvariable {R S : Type*} [Semiring R] [Semiring S] [PartialOrder S] (abv : AbsoluteValue R S)\nvariable [IsDomain S] [Nontrivial R]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidWithZeroHom (L165-L167)\ndef toMonoidWithZeroHom : R \u2192*\u2080 S :=\nabv\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.Algebra.Order.Interval.Set.Group).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem add_mem_Ioc_iff_right : a + b \u2208 Set.Ioc c d \u2194 b \u2208 Set.Ioc (c - a) (d - a)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Icc_iff (L32-L34)\ntheorem inv_mem_Icc_iff : a\u207b\u00b9 \u2208 Set.Icc c d \u2194 a \u2208 Set.Icc d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_le' le_inv'\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Ico_iff (L36-L38)\ntheorem inv_mem_Ico_iff : a\u207b\u00b9 \u2208 Set.Ico c d \u2194 a \u2208 Set.Ioc d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_lt' le_inv'\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Ioc_iff (L40-L42)\ntheorem inv_mem_Ioc_iff : a\u207b\u00b9 \u2208 Set.Ioc c d \u2194 a \u2208 Set.Ico d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_le' lt_inv'\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.inv_mem_Ioo_iff (L44-L54)\ntheorem inv_mem_Ioo_iff : a\u207b\u00b9 \u2208 Set.Ioo c d \u2194 a \u2208 Set.Ioo d\u207b\u00b9 c\u207b\u00b9 :=\nand_comm.trans <| and_congr inv_lt' lt_inv'\n\nend OrderedCommGroup\n\nsection OrderedAddCommGroup\n\nvariable [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1] {a b c d : \u03b1}\n\n/-! `add_mem_Ixx_iff_left` -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Icc_iff_left (L55-L57)\ntheorem add_mem_Icc_iff_left : a + b \u2208 Set.Icc c d \u2194 a \u2208 Set.Icc (c - b) (d - b) :=\n(and_congr sub_le_iff_le_add le_sub_iff_add_le).symm\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ico_iff_left (L58-L60)\ntheorem add_mem_Ico_iff_left : a + b \u2208 Set.Ico c d \u2194 a \u2208 Set.Ico (c - b) (d - b) :=\n(and_congr sub_le_iff_le_add lt_sub_iff_add_lt).symm\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioc_iff_left (L61-L63)\ntheorem add_mem_Ioc_iff_left : a + b \u2208 Set.Ioc c d \u2194 a \u2208 Set.Ioc (c - b) (d - b) :=\n(and_congr sub_lt_iff_lt_add le_sub_iff_add_le).symm\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioo_iff_left (L64-L68)\ntheorem add_mem_Ioo_iff_left : a + b \u2208 Set.Ioo c d \u2194 a \u2208 Set.Ioo (c - b) (d - b) :=\n(and_congr sub_lt_iff_lt_add lt_sub_iff_add_lt).symm\n\n/-! `add_mem_Ixx_iff_right` -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Icc_iff_right (L69-L71)\ntheorem add_mem_Icc_iff_right : a + b \u2208 Set.Icc c d \u2194 b \u2208 Set.Icc (c - a) (d - a) :=\n(and_congr sub_le_iff_le_add' le_sub_iff_add_le').symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ico_iff_right (L72-L74)\ntheorem add_mem_Ico_iff_right : a + b \u2208 Set.Ico c d \u2194 b \u2208 Set.Ico (c - a) (d - a) :=\n(and_congr sub_le_iff_le_add' lt_sub_iff_add_lt').symm\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioo_iff_right (L78-L82)\ntheorem add_mem_Ioo_iff_right : a + b \u2208 Set.Ioo c d \u2194 b \u2208 Set.Ioo (c - a) (d - a) :=\n(and_congr sub_lt_iff_lt_add' lt_sub_iff_add_lt').symm\n\n/-! `sub_mem_Ixx_iff_left` -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Icc_iff_left (L83-L85)\ntheorem sub_mem_Icc_iff_left : a - b \u2208 Set.Icc c d \u2194 a \u2208 Set.Icc (c + b) (d + b) :=\nand_congr le_sub_iff_add_le sub_le_iff_le_add\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Ico_iff_left (L86-L88)\ntheorem sub_mem_Ico_iff_left : a - b \u2208 Set.Ico c d \u2194 a \u2208 Set.Ico (c + b) (d + b) :=\nand_congr le_sub_iff_add_le sub_lt_iff_lt_add\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Ioc_iff_left (L89-L91)\ntheorem sub_mem_Ioc_iff_left : a - b \u2208 Set.Ioc c d \u2194 a \u2208 Set.Ioc (c + b) (d + b) :=\nand_congr lt_sub_iff_add_lt sub_le_iff_le_add\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Order.Interval.Set.Group.sub_mem_Ioo_iff_left (L92-L96)\ntheorem sub_mem_Ioo_iff_left : a - b \u2208 Set.Ioo c d \u2194 a \u2208 Set.Ioo (c + b) (d + b) :=\nand_congr lt_sub_iff_add_lt sub_lt_iff_lt_add\n\n/-! `sub_mem_Ixx_iff_right` -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.Simps (L80-L84)\ndef Simps.apply (f : AbsoluteValue R S) : R \u2192 S :=\nf\n\ninitialize_simps_projections AbsoluteValue (toFun \u2192 apply)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.sub_le_add (L235-L237)\nlemma sub_le_add (a b : R) : abv (a - b) \u2264 abv a + abv b := by\nsimpa only [\u2190 sub_eq_add_neg, AbsoluteValue.map_neg] using abv.add_le a (-b)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidWithZeroHom (L169-L172)\ntheorem coe_toMonoidWithZeroHom : \u21d1abv.toMonoidWithZeroHom = abv :=\nrfl\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*` and `1`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f := f.toFun\ncoe_injective' f g h := by obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := f; obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := g; congr\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_mul := fun f => f.map_mul' }\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.monoidWithZeroHomClass (L159-L164)\ninstance monoidWithZeroHomClass : MonoidWithZeroHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.mulHomClass with\n map_zero := fun f => f.map_zero\n map_one := fun f => f.map_one }\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*`, `0` and `1`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial_apply (L319-L334)\nlemma trivial_apply {x : R} (hx : x \u2260 0) : AbsoluteValue.trivial (S := S) x = 1 :=\nif_neg hx\n\nend trivial\n\nsection nontrivial\n\nsection OrderedSemiring\n\nvariable {R : Type*} [Semiring R] {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S]\n\n/-- An absolute value on a semiring `R` without zero divisors is *nontrivial* if it takes\na value `\u2260 1` on a nonzero element.\n\nThis has the advantage over `v \u2260 .trivial` that it does not require decidability\nof `\u00b7 = 0` in `R`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidHom (L173-L175)\ndef toMonoidHom : R \u2192* S :=\nabv\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_nat_le_self (L186-L206)\nlemma apply_nat_le_self [IsOrderedRing S] (n : \u2115) : abv n \u2264 n := by\ncases subsingleton_or_nontrivial R\n \u00b7 simp [Subsingleton.eq_zero (n : R)]\n induction n with\n | zero => simp\n | succ n ih =>\n \u00b7 grw [Nat.cast_succ, Nat.cast_succ, abv.add_le, abv.map_one, ih]\n\nend IsDomain\n\nend Semiring\n\nend OrderedSemiring\n\nsection OrderedRing\n\nsection Ring\n\nvariable {R S : Type*} [Ring R] [Ring S] [PartialOrder S] [IsOrderedRing S]\n (abv : AbsoluteValue R S)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.listSum_le (L102-L106)\nlemma listSum_le [AddLeftMono S] (l : List R) : abv l.sum \u2264 (l.map abv).sum := by\ninduction l with\n | nil => simp\n | cons head tail ih => exact (abv.add_le ..).trans <| add_le_add_right ih (abv head)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.ext (L76-L79)\ntheorem ext \u2983f g : AbsoluteValue R S\u2984 : (\u2200 x, f x = g x) \u2192 f = g :=\nDFunLike.ext _ _\n\n/-- See Note [custom simps projection]. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_natAbs_eq (L250-L255)\nlemma apply_natAbs_eq (x : \u2124) : abv (natAbs x) = abv x := by\nobtain \u27e8_, rfl | rfl\u27e9 := Int.eq_nat_or_neg x <;> simp\n\nopen Int in\n/-- Values of an absolute value coincide on the image of `\u2115` in `R`\nif and only if they coincide on the image of `\u2124` in `R`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial (L300-L317)\ndef trivial : AbsoluteValue R S where\n toFun x := if x = 0 then 0 else 1\nmap_mul' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp [hx, hy]\n nonneg' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n eq_zero' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n add_le' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp only [hx, \u2193reduceIte, hy, one_add_one_eq_two]\n rcases eq_or_ne (x + y) 0 with hxy | hxy <;> simp [hxy, one_le_two]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with apply_nonneg := fun f => f.nonneg' }\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.addGroupSeminormClass (L238-L242)\ninstance addGroupSeminormClass : AddGroupSeminormClass (AbsoluteValue R S) R S where\n toSubadditiveHomClass := AbsoluteValue.subadditiveHomClass\nmap_zero := AbsoluteValue.map_zero\n map_neg_eq_map f a := AbsoluteValue.map_neg f a\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.eq_on_nat_iff_eq_on_int (L256-L268)\nlemma eq_on_nat_iff_eq_on_int {f g : AbsoluteValue R S} :\n (\u2200 n : \u2115, f n = g n) \u2194 \u2200 n : \u2124, f n = g n := by\nrefine \u27e8fun h z \u21a6 ?_, fun a n \u21a6 mod_cast a n\u27e9\n obtain \u27e8n, rfl | rfl\u27e9 := Int.eq_nat_or_neg z <;> simp [h n]\n\nend OrderedCommRing\n\nsection LinearOrderedRing\n\nvariable {R S : Type*} [Semiring R] [Ring S] [LinearOrder S] [IsStrictOrderedRing S]\n (abv : AbsoluteValue R S)\n\n/-- `AbsoluteValue.abs` is `abs` as a bundled `AbsoluteValue`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_one_of_isLeftRegular (L124-L126)\ntheorem map_one_of_isLeftRegular (h : IsLeftRegular (abv 1)) : abv 1 = 1 :=\nh <| by simp [\u2190 abv.map_mul]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMulHom (L86-L88)\ntheorem coe_toMulHom : \u21d1abv.toMulHom = abv :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f := (f.eq_zero' _).2 rfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_add_le_add := fun f => f.add_le' }\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abs_abv_sub_le_abv_sub (L288-L299)\ntheorem abs_abv_sub_le_abv_sub (a b : R) : abs (abv a - abv b) \u2264 abv (a - b) :=\nabs_sub_le_iff.2 \u27e8abv.le_sub _ _, by rw [abv.map_sub]; apply abv.le_sub\u27e9\n\nend LinearOrderedCommRing\n\nsection trivial\n\nvariable {R : Type*} [Semiring R] [DecidablePred fun x : R \u21a6 x = 0] [NoZeroDivisors R]\nvariable {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S] [Nontrivial S]\n\n/-- The *trivial* absolute value takes the value `1` on all nonzero elements. -/\nprotected\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidHom (L177-L179)\ntheorem coe_toMonoidHom : \u21d1abv.toMonoidHom = abv :=\nrfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_sub_eq_zero_iff (L141-L154)\ntheorem map_sub_eq_zero_iff (a b : R) : abv (a - b) = 0 \u2194 a = b :=\nabv.eq_zero.trans sub_eq_zero\n\nend Ring\n\nsection Semiring\n\nsection IsDomain\n\n-- all of these are true for `NoZeroDivisors S`; but it doesn't work smoothly with the\n-- `IsDomain`/`IsCancelMulZero` API\nvariable {R S : Type*} [Semiring R] [Semiring S] [PartialOrder S] (abv : AbsoluteValue R S)\nvariable [IsDomain S] [Nontrivial R]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidWithZeroHom (L165-L167)\ndef toMonoidWithZeroHom : R \u2192*\u2080 S :=\nabv\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Interval/Set/Group.lean", "module": "Mathlib.Algebra.Order.Interval.Set.Group", "declaration": "Mathlib.Algebra.Order.Interval.Set.Group.add_mem_Ioc_iff_right", "span": "L75-L77", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Interval/Set/Group.lean#L75"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4471, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 12142, "lean_code_chars": 10633, "natural_language_chars": 1509, "lean_code_ratio": 0.8757, "line_count": 399, "imports_count": 0, "declarations_count": 1248, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "b3d84de6ab942e36", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.BooleanAlgebra.Basic.OrderDual", "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.Order.BooleanAlgebra.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance OrderDual.instBooleanAlgebra : BooleanAlgebra \u03b1\u1d52\u1d48 where\n __\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sup_inf_sdiff (L53-L55)\ntheorem sup_inf_sdiff (x y : \u03b1) : x \u2293 y \u2294 x \\ y = x :=\nGeneralizedBooleanAlgebra.sup_inf_sdiff _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_inf_sdiff (L57-L59)\ntheorem inf_inf_sdiff (x y : \u03b1) : x \u2293 y \u2293 x \\ y = \u22a5 :=\nGeneralizedBooleanAlgebra.inf_inf_sdiff _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sup_sdiff_inf (L61-L62)\ntheorem sup_sdiff_inf (x y : \u03b1) : x \\ y \u2294 x \u2293 y = x := by rw [sup_comm, sup_inf_sdiff]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_sdiff_inf (L64-L66)\ntheorem inf_sdiff_inf (x y : \u03b1) : x \\ y \u2293 (x \u2293 y) = \u22a5 := by rw [inf_comm, inf_inf_sdiff]\n-- see Note [lower instance priority]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_inf_sdiff (L73-L76)\ntheorem disjoint_inf_sdiff : Disjoint (x \u2293 y) (x \\ y) :=\ndisjoint_iff_inf_le.mpr (inf_inf_sdiff x y).le\n\n-- TODO: in distributive lattices, relative complements are unique when they exist\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sdiff_unique (L77-L97)\ntheorem sdiff_unique (s : x \u2293 y \u2294 z = x) (i : x \u2293 y \u2293 z = \u22a5) : x \\ y = z := by\nconv_rhs at s => rw [\u2190 sup_inf_sdiff x y, sup_comm]\n rw [sup_comm] at s\n conv_rhs at i => rw [\u2190 inf_inf_sdiff x y, inf_comm]\n rw [inf_comm] at i\n exact (eq_of_inf_eq_sup_eq i s).symm\n\n-- Use `sdiff_le`\nprivate theorem sdiff_le' : x \\ y \u2264 x :=\n calc\n x \\ y \u2264 x \u2293 y \u2294 x \\ y := le_sup_right\n _ = x := sup_inf_sdiff x y\n\nset_option backward.privateInPublic true in\n-- Use `sdiff_sup_self`\nprivate theorem sdiff_sup_self' : y \\ x \u2294 x = y \u2294 x :=\n calc\n y \\ x \u2294 x = y \\ x \u2294 (x \u2294 x \u2293 y) := by rw [sup_inf_self]\n _ = y \u2293 x \u2294 y \\ x \u2294 x := by ac_rfl\n _ = y \u2294 x := by rw [sup_inf_sdiff]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sdiff_inf_sdiff (L99-L109)\ntheorem sdiff_inf_sdiff : x \\ y \u2293 y \\ x = \u22a5 :=\nEq.symm <|\n calc\n \u22a5 = x \u2293 (y \u2293 x \u2294 y \\ x) \u2293 x \\ y := by rw [\u2190 inf_inf_sdiff, sup_inf_sdiff]\n _ = (x \u2293 (y \u2293 x) \u2294 x \u2293 y \\ x) \u2293 x \\ y := by rw [inf_sup_left]\n _ = (y \u2293 (x \u2293 x) \u2294 x \u2293 y \\ x) \u2293 x \\ y := by ac_rfl\n _ = x \u2293 y \\ x \u2293 x \\ y := by\n rw [inf_idem, inf_sup_right, \u2190 inf_comm x y, inf_inf_sdiff, bot_sup_eq]\n _ = x \u2293 x \\ y \u2293 y \\ x := by ac_rfl\n _ = x \\ y \u2293 y \\ x := by rw [inf_of_le_right sdiff_le']\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_sdiff (L110-L112)\ntheorem disjoint_sdiff_sdiff : Disjoint (x \\ y) (y \\ x) :=\ndisjoint_iff_inf_le.mpr sdiff_inf_sdiff.le\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_sdiff_self_right (L114-L118)\ntheorem inf_sdiff_self_right : x \u2293 y \\ x = \u22a5 :=\ncalc\n x \u2293 y \\ x = (x \u2293 y \u2294 x \\ y) \u2293 y \\ x := by rw [sup_inf_sdiff]\n _ = \u22a5 := by rw [inf_sup_right, inf_comm x y, inf_inf_sdiff, sdiff_inf_sdiff, bot_sup_eq]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_sdiff_self_left (L120-L124)\ntheorem inf_sdiff_self_left : y \\ x \u2293 x = \u22a5 := by rw [inf_comm, inf_sdiff_self_right]\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n-- see Note [lower instance priority]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_self_left (L145-L147)\ntheorem disjoint_sdiff_self_left : Disjoint (y \\ x) x :=\ndisjoint_iff_inf_le.mpr inf_sdiff_self_left.le\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_self_right (L148-L150)\ntheorem disjoint_sdiff_self_right : Disjoint x (y \\ x) :=\ndisjoint_iff_inf_le.mpr inf_sdiff_self_right.le\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.le_sdiff (L151-L154)\nlemma le_sdiff : x \u2264 y \\ z \u2194 x \u2264 y \u2227 Disjoint x z :=\n\u27e8fun h \u21a6 \u27e8h.trans sdiff_le, disjoint_sdiff_self_left.mono_left h\u27e9, fun h \u21a6\n by rw [\u2190 h.2.sdiff_eq_left]; exact sdiff_le_sdiff_right h.1\u27e9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.Disjoint (L160-L173)\ntheorem Disjoint.sdiff_eq_of_sup_eq (hi : Disjoint x z) (hs : x \u2294 z = y) : y \\ x = z :=\nhave h : y \u2293 x = x := inf_eq_right.2 <| le_sup_left.trans hs.le\n sdiff_unique (by rw [h, hs]) (by rw [h, hi.eq_bot])\n\nprotected theorem Disjoint.sdiff_unique (hd : Disjoint x z) (hz : z \u2264 y) (hs : y \u2264 x \u2294 z) :\n y \\ x = z :=\n sdiff_unique\n (by\n rw [\u2190 inf_eq_right] at hs\n rwa [sup_inf_right, inf_sup_right, sup_comm x, inf_sup_self, inf_comm, sup_comm z,\n hs, sup_eq_left])\n (by rw [inf_assoc, hd.eq_bot, inf_bot_eq])\n\n-- cf. `IsCompl.disjoint_left_iff` and `IsCompl.disjoint_right_iff`\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_iff_le (L174-L183)\ntheorem disjoint_sdiff_iff_le (hz : z \u2264 y) (hx : x \u2264 y) : Disjoint z (y \\ x) \u2194 z \u2264 x :=\n\u27e8fun H =>\n le_of_inf_le_sup_le (le_trans H.le_bot bot_le)\n (by\n rw [sup_sdiff_cancel_right hx]\n grw [sdiff_le]\n rw [sup_eq_right.2 hz]),\n fun H => disjoint_sdiff_self_right.mono_left H\u27e9\n\n-- cf. `IsCompl.le_left_iff` and `IsCompl.le_right_iff`\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.sdiff_inter_right_comm (L47-L48)\nlemma sdiff_inter_right_comm (s t u : Set \u03b1) : s \\ t \u2229 u = (s \u2229 u) \\ t := sdiff_inf_right_comm ..\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_univ (L106-L108)\ntheorem compl_univ : (univ : Set \u03b1)\u1d9c = \u2205 :=\ncompl_top\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_diff_eq_sdiff_union (L58-L59)\ntheorem diff_diff_eq_sdiff_union (h : u \u2286 s) : s \\ (t \\ u) = s \\ t \u222a u := sdiff_sdiff_eq_sdiff_sup h\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_diff_distrib_left (L60-L62)\ntheorem inter_diff_distrib_left (s t u : Set \u03b1) : s \u2229 (t \\ u) = (s \u2229 t) \\ (s \u2229 u) :=\ninf_sdiff_distrib_left _ _ _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.notMem_compl_iff (L83-L85)\ntheorem notMem_compl_iff {x : \u03b1} : x \u2209 s\u1d9c \u2194 x \u2208 s :=\nnot_not\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_def (L71-L73)\ntheorem compl_def (s : Set \u03b1) : s\u1d9c = { x | x \u2209 s } :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_inter (L102-L104)\ntheorem compl_inter (s t : Set \u03b1) : (s \u2229 t)\u1d9c = s\u1d9c \u222a t\u1d9c :=\ncompl_inf\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.mem_compl (L74-L76)\ntheorem mem_compl {s : Set \u03b1} {x : \u03b1} (h : x \u2209 s) : x \u2208 s\u1d9c :=\nh\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_diff_assoc (L44-L46)\nlemma inter_diff_assoc (a b c : Set \u03b1) : (a \u2229 b) \\ c = a \u2229 (b \\ c) := inf_sdiff_assoc ..\n/-- See also `Set.inter_diff_assoc`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_setOf (L77-L79)\ntheorem compl_setOf {\u03b1} (p : \u03b1 \u2192 Prop) : { a | p a }\u1d9c = { a | \u00acp a } :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_compl_self (L87-L89)\ntheorem inter_compl_self (s : Set \u03b1) : s \u2229 s\u1d9c = \u2205 :=\ninf_compl_eq_bot\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.PUnit (L148-L163)\ninstance PUnit.instBooleanAlgebra : BooleanAlgebra PUnit where\n __ := PUnit.instBiheytingAlgebra\nle_sup_inf := by simp\n inf_compl_le_bot _ := trivial\n top_le_sup_compl _ := trivial\n\nnamespace DistribLattice\n\nvariable (\u03b1) [DistribLattice \u03b1]\n\n/--\nAn alternative constructor for Boolean algebras:\na distributive lattice that is complemented is a Boolean algebra.\n\nThis is not an instance, because it creates data using choice.\n-/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.instBooleanAlgebra (L40-L43)\ninstance instBooleanAlgebra : BooleanAlgebra (Set \u03b1) :=\nfast_instance% { (inferInstance : BooleanAlgebra (\u03b1 \u2192 Prop)) with }\n\n/-- See also `Set.sdiff_inter_right_comm`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.Prop (L126-L133)\ninstance Prop.instBooleanAlgebra : BooleanAlgebra Prop where\n __ := Prop.instHeytingAlgebra\n__ := GeneralizedHeytingAlgebra.toDistribLattice\n compl := Not\n himp_eq _ _ := propext imp_iff_or_not\n inf_compl_le_bot _ H := H.2 H.1\n top_le_sup_compl p _ := Classical.em p\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_sdiff_left_comm (L49-L50)\nlemma inter_sdiff_left_comm (s t u : Set \u03b1) : s \u2229 (t \\ u) = t \u2229 (s \\ u) := inf_sdiff_left_comm ..\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_union_diff_cancel' (L55-L57)\ntheorem diff_union_diff_cancel' (hi : s \u2229 u \u2286 t) (hu : t \u2286 s \u222a u) : (s \\ t) \u222a (t \\ u) = s \\ u :=\nsdiff_sup_sdiff_cancel' hi hu\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.booleanAlgebraOfComplemented (L166-L172)\ndef booleanAlgebraOfComplemented [BoundedOrder \u03b1] [ComplementedLattice \u03b1] : BooleanAlgebra \u03b1 where\n __ := ((inferInstance : BoundedOrder \u03b1))\ncompl a := Classical.choose <| exists_isCompl a\n inf_compl_le_bot a := (Classical.choose_spec (exists_isCompl a)).disjoint.le_bot\n top_le_sup_compl a := (Classical.choose_spec (exists_isCompl a)).codisjoint.top_le\n\nend DistribLattice\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_union (L99-L101)\ntheorem compl_union (s t : Set \u03b1) : (s \u222a t)\u1d9c = s\u1d9c \u2229 t\u1d9c :=\ncompl_sup\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_union_diff_cancel (L51-L54)\ntheorem diff_union_diff_cancel (hts : t \u2286 s) (hut : u \u2286 t) : s \\ t \u222a t \\ u = s \\ u :=\nsdiff_sup_sdiff_cancel hts hut\n\n/-- A version of `diff_union_diff_cancel` with more general hypotheses. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_inter_self (L91-L93)\ntheorem compl_inter_self (s : Set \u03b1) : s\u1d9c \u2229 s = \u2205 :=\ncompl_inf_eq_bot\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_inter_distrib_right (L66-L70)\ntheorem diff_inter_distrib_right (s t r : Set \u03b1) : (t \u2229 r) \\ s = (t \\ s) \u2229 (r \\ s) :=\ninf_sdiff\n\n/-! ### Lemmas about complement -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.notMem_of_mem_compl (L80-L82)\ntheorem notMem_of_mem_compl {s : Set \u03b1} {x : \u03b1} (h : x \u2208 s\u1d9c) : x \u2209 s :=\nh\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_empty (L95-L97)\ntheorem compl_empty : (\u2205 : Set \u03b1)\u1d9c = univ :=\ncompl_bot\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.Bool (L134-L139)\ninstance Bool.instBooleanAlgebra : BooleanAlgebra Bool where\n __ := instBoundedOrder\ncompl := not\n inf_compl_le_bot a := a.and_not_self.le\n top_le_sup_compl a := a.or_not_self.ge\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_diff_distrib_right (L63-L65)\ntheorem inter_diff_distrib_right (s t u : Set \u03b1) : (s \\ t) \u2229 u = (s \u2229 u) \\ (t \u2229 u) :=\ninf_sdiff_distrib_right _ _ _\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.Order.BooleanAlgebra.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance OrderDual.instBooleanAlgebra : BooleanAlgebra \u03b1\u1d52\u1d48 where\n __\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sup_inf_sdiff (L53-L55)\ntheorem sup_inf_sdiff (x y : \u03b1) : x \u2293 y \u2294 x \\ y = x :=\nGeneralizedBooleanAlgebra.sup_inf_sdiff _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_inf_sdiff (L57-L59)\ntheorem inf_inf_sdiff (x y : \u03b1) : x \u2293 y \u2293 x \\ y = \u22a5 :=\nGeneralizedBooleanAlgebra.inf_inf_sdiff _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sup_sdiff_inf (L61-L62)\ntheorem sup_sdiff_inf (x y : \u03b1) : x \\ y \u2294 x \u2293 y = x := by rw [sup_comm, sup_inf_sdiff]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_sdiff_inf (L64-L66)\ntheorem inf_sdiff_inf (x y : \u03b1) : x \\ y \u2293 (x \u2293 y) = \u22a5 := by rw [inf_comm, inf_inf_sdiff]\n-- see Note [lower instance priority]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_inf_sdiff (L73-L76)\ntheorem disjoint_inf_sdiff : Disjoint (x \u2293 y) (x \\ y) :=\ndisjoint_iff_inf_le.mpr (inf_inf_sdiff x y).le\n\n-- TODO: in distributive lattices, relative complements are unique when they exist\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sdiff_unique (L77-L97)\ntheorem sdiff_unique (s : x \u2293 y \u2294 z = x) (i : x \u2293 y \u2293 z = \u22a5) : x \\ y = z := by\nconv_rhs at s => rw [\u2190 sup_inf_sdiff x y, sup_comm]\n rw [sup_comm] at s\n conv_rhs at i => rw [\u2190 inf_inf_sdiff x y, inf_comm]\n rw [inf_comm] at i\n exact (eq_of_inf_eq_sup_eq i s).symm\n\n-- Use `sdiff_le`\nprivate theorem sdiff_le' : x \\ y \u2264 x :=\n calc\n x \\ y \u2264 x \u2293 y \u2294 x \\ y := le_sup_right\n _ = x := sup_inf_sdiff x y\n\nset_option backward.privateInPublic true in\n-- Use `sdiff_sup_self`\nprivate theorem sdiff_sup_self' : y \\ x \u2294 x = y \u2294 x :=\n calc\n y \\ x \u2294 x = y \\ x \u2294 (x \u2294 x \u2293 y) := by rw [sup_inf_self]\n _ = y \u2293 x \u2294 y \\ x \u2294 x := by ac_rfl\n _ = y \u2294 x := by rw [sup_inf_sdiff]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.sdiff_inf_sdiff (L99-L109)\ntheorem sdiff_inf_sdiff : x \\ y \u2293 y \\ x = \u22a5 :=\nEq.symm <|\n calc\n \u22a5 = x \u2293 (y \u2293 x \u2294 y \\ x) \u2293 x \\ y := by rw [\u2190 inf_inf_sdiff, sup_inf_sdiff]\n _ = (x \u2293 (y \u2293 x) \u2294 x \u2293 y \\ x) \u2293 x \\ y := by rw [inf_sup_left]\n _ = (y \u2293 (x \u2293 x) \u2294 x \u2293 y \\ x) \u2293 x \\ y := by ac_rfl\n _ = x \u2293 y \\ x \u2293 x \\ y := by\n rw [inf_idem, inf_sup_right, \u2190 inf_comm x y, inf_inf_sdiff, bot_sup_eq]\n _ = x \u2293 x \\ y \u2293 y \\ x := by ac_rfl\n _ = x \\ y \u2293 y \\ x := by rw [inf_of_le_right sdiff_le']\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_sdiff (L110-L112)\ntheorem disjoint_sdiff_sdiff : Disjoint (x \\ y) (y \\ x) :=\ndisjoint_iff_inf_le.mpr sdiff_inf_sdiff.le\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_sdiff_self_right (L114-L118)\ntheorem inf_sdiff_self_right : x \u2293 y \\ x = \u22a5 :=\ncalc\n x \u2293 y \\ x = (x \u2293 y \u2294 x \\ y) \u2293 y \\ x := by rw [sup_inf_sdiff]\n _ = \u22a5 := by rw [inf_sup_right, inf_comm x y, inf_inf_sdiff, sdiff_inf_sdiff, bot_sup_eq]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.inf_sdiff_self_left (L120-L124)\ntheorem inf_sdiff_self_left : y \\ x \u2293 x = \u22a5 := by rw [inf_comm, inf_sdiff_self_right]\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n-- see Note [lower instance priority]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_self_left (L145-L147)\ntheorem disjoint_sdiff_self_left : Disjoint (y \\ x) x :=\ndisjoint_iff_inf_le.mpr inf_sdiff_self_left.le\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_self_right (L148-L150)\ntheorem disjoint_sdiff_self_right : Disjoint x (y \\ x) :=\ndisjoint_iff_inf_le.mpr inf_sdiff_self_right.le\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.le_sdiff (L151-L154)\nlemma le_sdiff : x \u2264 y \\ z \u2194 x \u2264 y \u2227 Disjoint x z :=\n\u27e8fun h \u21a6 \u27e8h.trans sdiff_le, disjoint_sdiff_self_left.mono_left h\u27e9, fun h \u21a6\n by rw [\u2190 h.2.sdiff_eq_left]; exact sdiff_le_sdiff_right h.1\u27e9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.Disjoint (L160-L173)\ntheorem Disjoint.sdiff_eq_of_sup_eq (hi : Disjoint x z) (hs : x \u2294 z = y) : y \\ x = z :=\nhave h : y \u2293 x = x := inf_eq_right.2 <| le_sup_left.trans hs.le\n sdiff_unique (by rw [h, hs]) (by rw [h, hi.eq_bot])\n\nprotected theorem Disjoint.sdiff_unique (hd : Disjoint x z) (hz : z \u2264 y) (hs : y \u2264 x \u2294 z) :\n y \\ x = z :=\n sdiff_unique\n (by\n rw [\u2190 inf_eq_right] at hs\n rwa [sup_inf_right, inf_sup_right, sup_comm x, inf_sup_self, inf_comm, sup_comm z,\n hs, sup_eq_left])\n (by rw [inf_assoc, hd.eq_bot, inf_bot_eq])\n\n-- cf. `IsCompl.disjoint_left_iff` and `IsCompl.disjoint_right_iff`\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.BooleanAlgebra.Basic.disjoint_sdiff_iff_le (L174-L183)\ntheorem disjoint_sdiff_iff_le (hz : z \u2264 y) (hx : x \u2264 y) : Disjoint z (y \\ x) \u2194 z \u2264 x :=\n\u27e8fun H =>\n le_of_inf_le_sup_le (le_trans H.le_bot bot_le)\n (by\n rw [sup_sdiff_cancel_right hx]\n grw [sdiff_le]\n rw [sup_eq_right.2 hz]),\n fun H => disjoint_sdiff_self_right.mono_left H\u27e9\n\n-- cf. `IsCompl.le_left_iff` and `IsCompl.le_right_iff`\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.sdiff_inter_right_comm (L47-L48)\nlemma sdiff_inter_right_comm (s t u : Set \u03b1) : s \\ t \u2229 u = (s \u2229 u) \\ t := sdiff_inf_right_comm ..\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_univ (L106-L108)\ntheorem compl_univ : (univ : Set \u03b1)\u1d9c = \u2205 :=\ncompl_top\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_diff_eq_sdiff_union (L58-L59)\ntheorem diff_diff_eq_sdiff_union (h : u \u2286 s) : s \\ (t \\ u) = s \\ t \u222a u := sdiff_sdiff_eq_sdiff_sup h\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_diff_distrib_left (L60-L62)\ntheorem inter_diff_distrib_left (s t u : Set \u03b1) : s \u2229 (t \\ u) = (s \u2229 t) \\ (s \u2229 u) :=\ninf_sdiff_distrib_left _ _ _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.notMem_compl_iff (L83-L85)\ntheorem notMem_compl_iff {x : \u03b1} : x \u2209 s\u1d9c \u2194 x \u2208 s :=\nnot_not\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_def (L71-L73)\ntheorem compl_def (s : Set \u03b1) : s\u1d9c = { x | x \u2209 s } :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_inter (L102-L104)\ntheorem compl_inter (s t : Set \u03b1) : (s \u2229 t)\u1d9c = s\u1d9c \u222a t\u1d9c :=\ncompl_inf\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.mem_compl (L74-L76)\ntheorem mem_compl {s : Set \u03b1} {x : \u03b1} (h : x \u2209 s) : x \u2208 s\u1d9c :=\nh\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_diff_assoc (L44-L46)\nlemma inter_diff_assoc (a b c : Set \u03b1) : (a \u2229 b) \\ c = a \u2229 (b \\ c) := inf_sdiff_assoc ..\n/-- See also `Set.inter_diff_assoc`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_setOf (L77-L79)\ntheorem compl_setOf {\u03b1} (p : \u03b1 \u2192 Prop) : { a | p a }\u1d9c = { a | \u00acp a } :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_compl_self (L87-L89)\ntheorem inter_compl_self (s : Set \u03b1) : s \u2229 s\u1d9c = \u2205 :=\ninf_compl_eq_bot\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.PUnit (L148-L163)\ninstance PUnit.instBooleanAlgebra : BooleanAlgebra PUnit where\n __ := PUnit.instBiheytingAlgebra\nle_sup_inf := by simp\n inf_compl_le_bot _ := trivial\n top_le_sup_compl _ := trivial\n\nnamespace DistribLattice\n\nvariable (\u03b1) [DistribLattice \u03b1]\n\n/--\nAn alternative constructor for Boolean algebras:\na distributive lattice that is complemented is a Boolean algebra.\n\nThis is not an instance, because it creates data using choice.\n-/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.instBooleanAlgebra (L40-L43)\ninstance instBooleanAlgebra : BooleanAlgebra (Set \u03b1) :=\nfast_instance% { (inferInstance : BooleanAlgebra (\u03b1 \u2192 Prop)) with }\n\n/-- See also `Set.sdiff_inter_right_comm`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.Prop (L126-L133)\ninstance Prop.instBooleanAlgebra : BooleanAlgebra Prop where\n __ := Prop.instHeytingAlgebra\n__ := GeneralizedHeytingAlgebra.toDistribLattice\n compl := Not\n himp_eq _ _ := propext imp_iff_or_not\n inf_compl_le_bot _ H := H.2 H.1\n top_le_sup_compl p _ := Classical.em p\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_sdiff_left_comm (L49-L50)\nlemma inter_sdiff_left_comm (s t u : Set \u03b1) : s \u2229 (t \\ u) = t \u2229 (s \\ u) := inf_sdiff_left_comm ..\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_union_diff_cancel' (L55-L57)\ntheorem diff_union_diff_cancel' (hi : s \u2229 u \u2286 t) (hu : t \u2286 s \u222a u) : (s \\ t) \u222a (t \\ u) = s \\ u :=\nsdiff_sup_sdiff_cancel' hi hu\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.booleanAlgebraOfComplemented (L166-L172)\ndef booleanAlgebraOfComplemented [BoundedOrder \u03b1] [ComplementedLattice \u03b1] : BooleanAlgebra \u03b1 where\n __ := ((inferInstance : BoundedOrder \u03b1))\ncompl a := Classical.choose <| exists_isCompl a\n inf_compl_le_bot a := (Classical.choose_spec (exists_isCompl a)).disjoint.le_bot\n top_le_sup_compl a := (Classical.choose_spec (exists_isCompl a)).codisjoint.top_le\n\nend DistribLattice\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_union (L99-L101)\ntheorem compl_union (s t : Set \u03b1) : (s \u222a t)\u1d9c = s\u1d9c \u2229 t\u1d9c :=\ncompl_sup\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_union_diff_cancel (L51-L54)\ntheorem diff_union_diff_cancel (hts : t \u2286 s) (hut : u \u2286 t) : s \\ t \u222a t \\ u = s \\ u :=\nsdiff_sup_sdiff_cancel hts hut\n\n/-- A version of `diff_union_diff_cancel` with more general hypotheses. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_inter_self (L91-L93)\ntheorem compl_inter_self (s : Set \u03b1) : s\u1d9c \u2229 s = \u2205 :=\ncompl_inf_eq_bot\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.diff_inter_distrib_right (L66-L70)\ntheorem diff_inter_distrib_right (s t r : Set \u03b1) : (t \u2229 r) \\ s = (t \\ s) \u2229 (r \\ s) :=\ninf_sdiff\n\n/-! ### Lemmas about complement -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.notMem_of_mem_compl (L80-L82)\ntheorem notMem_of_mem_compl {s : Set \u03b1} {x : \u03b1} (h : x \u2208 s\u1d9c) : x \u2209 s :=\nh\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.compl_empty (L95-L97)\ntheorem compl_empty : (\u2205 : Set \u03b1)\u1d9c = univ :=\ncompl_bot\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.BooleanAlgebra.Defs.Bool (L134-L139)\ninstance Bool.instBooleanAlgebra : BooleanAlgebra Bool where\n __ := instBoundedOrder\ncompl := not\n inf_compl_le_bot a := a.and_not_self.le\n top_le_sup_compl a := a.or_not_self.ge\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.BooleanAlgebra.Set.inter_diff_distrib_right (L63-L65)\ntheorem inter_diff_distrib_right (s t u : Set \u03b1) : (s \\ t) \u2229 u = (s \u2229 u) \\ (t \u2229 u) :=\ninf_sdiff_distrib_right _ _ _\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/BooleanAlgebra/Basic.lean", "module": "Mathlib.Order.BooleanAlgebra.Basic", "declaration": "Mathlib.Order.BooleanAlgebra.Basic.OrderDual", "span": "L538-L545", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/BooleanAlgebra/Basic.lean#L538"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4227, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 11079, "lean_code_chars": 9576, "natural_language_chars": 1503, "lean_code_ratio": 0.8643, "line_count": 370, "imports_count": 0, "declarations_count": 1088, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "0bf96c3425a9fb9c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Algebra.Module.WeakDual.toWeakSpaceCLM", "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.Topology.Algebra.Module.WeakDual)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef toWeakSpaceCLM : E \u2192L[\ud835\udd5c] WeakSpace \ud835\udd5c E where\n __\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.WeakDual (L61-L76)\ndef WeakDual (\ud835\udd5c E : Type*) [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\n [ContinuousConstSMul \ud835\udd5c \ud835\udd5c] [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E] :=\nWeakBilin (topDualPairing \ud835\udd5c E)\nderiving AddCommMonoid, Module \ud835\udd5c, TopologicalSpace, ContinuousAdd, Inhabited,\n FunLike, ContinuousLinearMapClass\n\nnamespace WeakDual\n\nsection Semiring\n\nvariable [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\nvariable [ContinuousConstSMul \ud835\udd5c \ud835\udd5c]\nvariable [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E]\n\n/-- If a monoid `M` distributively continuously acts on `\ud835\udd5c` and this action commutes with\nmultiplication on `\ud835\udd5c`, then it acts on `WeakDual \ud835\udd5c E`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instMulAction (L77-L82)\ninstance instMulAction (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [ContinuousConstSMul M \ud835\udd5c] : MulAction M (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| MulAction M (E \u2192L[\ud835\udd5c] \ud835\udd5c)\n\n/-- If a monoid `M` distributively continuously acts on `\ud835\udd5c` and this action commutes with\nmultiplication on `\ud835\udd5c`, then it acts distributively on `WeakDual \ud835\udd5c E`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instDistribMulAction (L83-L88)\ninstance instDistribMulAction (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [ContinuousConstSMul M \ud835\udd5c] : DistribMulAction M (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| DistribMulAction M (E \u2192L[\ud835\udd5c] \ud835\udd5c)\n\n/-- If `\ud835\udd5c` is a topological module over a semiring `R` and scalar multiplication commutes with the\nmultiplication on `\ud835\udd5c`, then `WeakDual \ud835\udd5c E` is a module over `R`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instModule' (L89-L92)\ninstance instModule' (R) [Semiring R] [Module R \ud835\udd5c] [SMulCommClass \ud835\udd5c R \ud835\udd5c] [ContinuousConstSMul R \ud835\udd5c] :\n Module R (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| Module R (E \u2192L[\ud835\udd5c] \ud835\udd5c)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instContinuousConstSMul (L93-L99)\ninstance instContinuousConstSMul (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [ContinuousConstSMul M \ud835\udd5c] : ContinuousConstSMul M (WeakDual \ud835\udd5c E) :=\n\u27e8fun m =>\n continuous_induced_rng.2 <| (WeakBilin.coeFn_continuous (topDualPairing \ud835\udd5c E)).const_smul m\u27e9\n\n/-- If a monoid `M` distributively continuously acts on `\ud835\udd5c` and this action commutes with\nmultiplication on `\ud835\udd5c`, then it continuously acts on `WeakDual \ud835\udd5c E`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instContinuousSMul (L100-L104)\ninstance instContinuousSMul (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [TopologicalSpace M] [ContinuousSMul M \ud835\udd5c] : ContinuousSMul M (WeakDual \ud835\udd5c E) :=\n\u27e8continuous_induced_rng.2 <|\n continuous_fst.smul ((WeakBilin.coeFn_continuous (topDualPairing \ud835\udd5c E)).comp continuous_snd)\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.coeFn_continuous (L105-L107)\ntheorem coeFn_continuous : Continuous fun (x : WeakDual \ud835\udd5c E) y => x y :=\ncontinuous_induced_dom\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.eval_continuous (L108-L110)\ntheorem eval_continuous (y : E) : Continuous fun x : WeakDual \ud835\udd5c E => x y :=\ncontinuous_pi_iff.mp coeFn_continuous y\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.continuous_of_continuous_eval (L111-L114)\ntheorem continuous_of_continuous_eval [TopologicalSpace \u03b1] {g : \u03b1 \u2192 WeakDual \ud835\udd5c E}\n (h : \u2200 y, Continuous fun a => (g a) y) : Continuous g :=\ncontinuous_induced_rng.2 (continuous_pi_iff.mpr h)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instT2Space (L115-L124)\ninstance instT2Space [T2Space \ud835\udd5c] : T2Space (WeakDual \ud835\udd5c E) :=\n(WeakBilin.isEmbedding ContinuousLinearMap.coe_injective).t2Space\n\nend Semiring\n\nsection Ring\n\nvariable [CommRing \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [IsTopologicalAddGroup \ud835\udd5c] [ContinuousConstSMul \ud835\udd5c \ud835\udd5c]\nvariable [AddCommGroup E] [Module \ud835\udd5c E] [TopologicalSpace E] [IsTopologicalAddGroup E]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instAddCommGroup (L125-L127)\ninstance instAddCommGroup : AddCommGroup (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| AddCommGroup (WeakBilin (topDualPairing \ud835\udd5c E))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instIsTopologicalAddGroup (L128-L136)\ninstance instIsTopologicalAddGroup : IsTopologicalAddGroup (WeakDual \ud835\udd5c E) :=\nWeakBilin.instIsTopologicalAddGroup (topDualPairing \ud835\udd5c E)\n\nend Ring\n\nend WeakDual\n\n/-- The weak topology is the topology coarsest topology on `E` such that all functionals\n`fun x => v x` are continuous. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.WeakSpace (L137-L149)\ndef WeakSpace (\ud835\udd5c E) [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\n [ContinuousConstSMul \ud835\udd5c \ud835\udd5c] [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E] :=\nWeakBilin (topDualPairing \ud835\udd5c E).flip\nderiving AddCommMonoid, Module \ud835\udd5c, TopologicalSpace, ContinuousAdd\n\nsection Semiring\n\nvariable [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\nvariable [ContinuousConstSMul \ud835\udd5c \ud835\udd5c]\nvariable [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E]\n\nnamespace WeakSpace\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instModule' (L150-L152)\ninstance instModule' [CommSemiring \ud835\udd5d] [Module \ud835\udd5d E] : Module \ud835\udd5d (WeakSpace \ud835\udd5c E) :=\ninferInstanceAs <| Module \ud835\udd5d (WeakBilin (topDualPairing \ud835\udd5c E).flip)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instIsScalarTower (L153-L156)\ninstance instIsScalarTower [CommSemiring \ud835\udd5d] [Module \ud835\udd5d \ud835\udd5c] [Module \ud835\udd5d E] [IsScalarTower \ud835\udd5d \ud835\udd5c E] :\n IsScalarTower \ud835\udd5d \ud835\udd5c (WeakSpace \ud835\udd5c E) :=\nWeakBilin.instIsScalarTower (topDualPairing \ud835\udd5c E).flip\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun\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.Topology.Algebra.Module.WeakDual).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef toWeakSpaceCLM : E \u2192L[\ud835\udd5c] WeakSpace \ud835\udd5c E where\n __\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.WeakDual (L61-L76)\ndef WeakDual (\ud835\udd5c E : Type*) [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\n [ContinuousConstSMul \ud835\udd5c \ud835\udd5c] [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E] :=\nWeakBilin (topDualPairing \ud835\udd5c E)\nderiving AddCommMonoid, Module \ud835\udd5c, TopologicalSpace, ContinuousAdd, Inhabited,\n FunLike, ContinuousLinearMapClass\n\nnamespace WeakDual\n\nsection Semiring\n\nvariable [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\nvariable [ContinuousConstSMul \ud835\udd5c \ud835\udd5c]\nvariable [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E]\n\n/-- If a monoid `M` distributively continuously acts on `\ud835\udd5c` and this action commutes with\nmultiplication on `\ud835\udd5c`, then it acts on `WeakDual \ud835\udd5c E`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instMulAction (L77-L82)\ninstance instMulAction (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [ContinuousConstSMul M \ud835\udd5c] : MulAction M (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| MulAction M (E \u2192L[\ud835\udd5c] \ud835\udd5c)\n\n/-- If a monoid `M` distributively continuously acts on `\ud835\udd5c` and this action commutes with\nmultiplication on `\ud835\udd5c`, then it acts distributively on `WeakDual \ud835\udd5c E`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instDistribMulAction (L83-L88)\ninstance instDistribMulAction (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [ContinuousConstSMul M \ud835\udd5c] : DistribMulAction M (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| DistribMulAction M (E \u2192L[\ud835\udd5c] \ud835\udd5c)\n\n/-- If `\ud835\udd5c` is a topological module over a semiring `R` and scalar multiplication commutes with the\nmultiplication on `\ud835\udd5c`, then `WeakDual \ud835\udd5c E` is a module over `R`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instModule' (L89-L92)\ninstance instModule' (R) [Semiring R] [Module R \ud835\udd5c] [SMulCommClass \ud835\udd5c R \ud835\udd5c] [ContinuousConstSMul R \ud835\udd5c] :\n Module R (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| Module R (E \u2192L[\ud835\udd5c] \ud835\udd5c)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instContinuousConstSMul (L93-L99)\ninstance instContinuousConstSMul (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [ContinuousConstSMul M \ud835\udd5c] : ContinuousConstSMul M (WeakDual \ud835\udd5c E) :=\n\u27e8fun m =>\n continuous_induced_rng.2 <| (WeakBilin.coeFn_continuous (topDualPairing \ud835\udd5c E)).const_smul m\u27e9\n\n/-- If a monoid `M` distributively continuously acts on `\ud835\udd5c` and this action commutes with\nmultiplication on `\ud835\udd5c`, then it continuously acts on `WeakDual \ud835\udd5c E`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instContinuousSMul (L100-L104)\ninstance instContinuousSMul (M) [Monoid M] [DistribMulAction M \ud835\udd5c] [SMulCommClass \ud835\udd5c M \ud835\udd5c]\n [TopologicalSpace M] [ContinuousSMul M \ud835\udd5c] : ContinuousSMul M (WeakDual \ud835\udd5c E) :=\n\u27e8continuous_induced_rng.2 <|\n continuous_fst.smul ((WeakBilin.coeFn_continuous (topDualPairing \ud835\udd5c E)).comp continuous_snd)\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.coeFn_continuous (L105-L107)\ntheorem coeFn_continuous : Continuous fun (x : WeakDual \ud835\udd5c E) y => x y :=\ncontinuous_induced_dom\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.eval_continuous (L108-L110)\ntheorem eval_continuous (y : E) : Continuous fun x : WeakDual \ud835\udd5c E => x y :=\ncontinuous_pi_iff.mp coeFn_continuous y\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.continuous_of_continuous_eval (L111-L114)\ntheorem continuous_of_continuous_eval [TopologicalSpace \u03b1] {g : \u03b1 \u2192 WeakDual \ud835\udd5c E}\n (h : \u2200 y, Continuous fun a => (g a) y) : Continuous g :=\ncontinuous_induced_rng.2 (continuous_pi_iff.mpr h)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instT2Space (L115-L124)\ninstance instT2Space [T2Space \ud835\udd5c] : T2Space (WeakDual \ud835\udd5c E) :=\n(WeakBilin.isEmbedding ContinuousLinearMap.coe_injective).t2Space\n\nend Semiring\n\nsection Ring\n\nvariable [CommRing \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [IsTopologicalAddGroup \ud835\udd5c] [ContinuousConstSMul \ud835\udd5c \ud835\udd5c]\nvariable [AddCommGroup E] [Module \ud835\udd5c E] [TopologicalSpace E] [IsTopologicalAddGroup E]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instAddCommGroup (L125-L127)\ninstance instAddCommGroup : AddCommGroup (WeakDual \ud835\udd5c E) :=\ninferInstanceAs <| AddCommGroup (WeakBilin (topDualPairing \ud835\udd5c E))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instIsTopologicalAddGroup (L128-L136)\ninstance instIsTopologicalAddGroup : IsTopologicalAddGroup (WeakDual \ud835\udd5c E) :=\nWeakBilin.instIsTopologicalAddGroup (topDualPairing \ud835\udd5c E)\n\nend Ring\n\nend WeakDual\n\n/-- The weak topology is the topology coarsest topology on `E` such that all functionals\n`fun x => v x` are continuous. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.WeakSpace (L137-L149)\ndef WeakSpace (\ud835\udd5c E) [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\n [ContinuousConstSMul \ud835\udd5c \ud835\udd5c] [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E] :=\nWeakBilin (topDualPairing \ud835\udd5c E).flip\nderiving AddCommMonoid, Module \ud835\udd5c, TopologicalSpace, ContinuousAdd\n\nsection Semiring\n\nvariable [CommSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousAdd \ud835\udd5c]\nvariable [ContinuousConstSMul \ud835\udd5c \ud835\udd5c]\nvariable [AddCommMonoid E] [Module \ud835\udd5c E] [TopologicalSpace E]\n\nnamespace WeakSpace\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instModule' (L150-L152)\ninstance instModule' [CommSemiring \ud835\udd5d] [Module \ud835\udd5d E] : Module \ud835\udd5d (WeakSpace \ud835\udd5c E) :=\ninferInstanceAs <| Module \ud835\udd5d (WeakBilin (topDualPairing \ud835\udd5c E).flip)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Algebra.Module.WeakDual.instIsScalarTower (L153-L156)\ninstance instIsScalarTower [CommSemiring \ud835\udd5d] [Module \ud835\udd5d \ud835\udd5c] [Module \ud835\udd5d E] [IsScalarTower \ud835\udd5d \ud835\udd5c E] :\n IsScalarTower \ud835\udd5d \ud835\udd5c (WeakSpace \ud835\udd5c E) :=\nWeakBilin.instIsScalarTower (topDualPairing \ud835\udd5c E).flip\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/Module/WeakDual.lean", "module": "Mathlib.Topology.Algebra.Module.WeakDual", "declaration": "Mathlib.Topology.Algebra.Module.WeakDual.toWeakSpaceCLM", "span": "L186-L192", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Module/WeakDual.lean#L186"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 5032, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 13020, "lean_code_chars": 11511, "natural_language_chars": 1509, "lean_code_ratio": 0.8841, "line_count": 407, "imports_count": 0, "declarations_count": 1239, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "17ec75b0e785ae8a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.MvPowerSeries.Order.ne_zero_iff_exists_coeff_ne_zero_and_degree", "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.RingTheory.MvPowerSeries.Order)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ne_zero_iff_exists_coeff_ne_zero_and_degree :\n f \u2260 0 \u2194 (\u2203 n : \u2115, \u2203 d : \u03c3 \u2192\u2080 \u2115, coeff d f \u2260 0 \u2227 degree d = n)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.ne_zero_iff_exists_coeff_ne_zero_and_weight (L134-L138)\ntheorem ne_zero_iff_exists_coeff_ne_zero_and_weight :\n f \u2260 0 \u2194 (\u2203 n : \u2115, \u2203 d : \u03c3 \u2192\u2080 \u2115, coeff d f \u2260 0 \u2227 weight w d = n) := by\nsimpa using ne_zero_iff_exists_coeff_ne_zero f\n\n/-- The weighted order of a mv_power_series -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder (L139-L143)\ndef weightedOrder (f : MvPowerSeries \u03c3 R) : \u2115\u221e := by\nclassical\n exact dite (f = 0) (fun _ => \u22a4) fun h =>\n Nat.find ((ne_zero_iff_exists_coeff_ne_zero_and_weight w).mp h)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.ne_zero_iff_weightedOrder_finite (L147-L152)\ntheorem ne_zero_iff_weightedOrder_finite :\n f \u2260 0 \u2194 (f.weightedOrder w).toNat = f.weightedOrder w := by\nsimp only [weightedOrder, ne_eq, coe_toNat_eq_self, dite_eq_left_iff,\n ENat.coe_ne_top, imp_false, not_not]\n\n/-- The `0` power series is the unique power series with infinite order. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_eq_top_iff (L154-L159)\ntheorem weightedOrder_eq_top_iff :\n f.weightedOrder w = \u22a4 \u2194 f = 0 := by\nrw [\u2190 not_iff_not, \u2190 ne_eq, \u2190 ne_eq, ne_zero_iff_weightedOrder_finite w, coe_toNat_eq_self]\n\n/-- If the order of a formal power series `f` is finite,\nthen some coefficient of weight equal to the order of `f` is nonzero. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.exists_coeff_ne_zero_and_weightedOrder (L160-L169)\ntheorem exists_coeff_ne_zero_and_weightedOrder\n (h : (toNat (f.weightedOrder w) : \u2115\u221e) = f.weightedOrder w) :\n \u2203 d, coeff d f \u2260 0 \u2227 weight w d = f.weightedOrder w := by\nclassical\n simp_rw [weightedOrder, dif_neg ((ne_zero_iff_weightedOrder_finite w).mpr h), Nat.cast_inj]\n generalize_proofs h1\n exact Nat.find_spec h1\n\n/-- If the `d`th coefficient of a formal power series is nonzero,\nthen the weighted order of the power series is less than or equal to `weight d w`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_le (L170-L178)\ntheorem weightedOrder_le {d : \u03c3 \u2192\u2080 \u2115} (h : coeff d f \u2260 0) :\n f.weightedOrder w \u2264 weight w d := by\nrw [weightedOrder, dif_neg]\n \u00b7 simp only [ne_eq, Nat.cast_le, Nat.find_le_iff]\n exact \u27e8weight w d, le_rfl, d, h, rfl\u27e9\n \u00b7 exact (f.ne_zero_iff_exists_coeff_ne_zero_and_weight w).mpr \u27e8weight w d, d, h, rfl\u27e9\n\n/-- The `n`th coefficient of a formal power series is `0` if `n` is strictly\nsmaller than the order of the power series. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.coeff_eq_zero_of_lt_weightedOrder (L179-L184)\ntheorem coeff_eq_zero_of_lt_weightedOrder {d : \u03c3 \u2192\u2080 \u2115} (h : (weight w d) < f.weightedOrder w) :\n coeff d f = 0 := by\ncontrapose! h; exact weightedOrder_le w h\n\n/-- The order of a formal power series is at least `n` if\nthe `d`th coefficient is `0` for all `d` such that `weight w d < n`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.nat_le_weightedOrder (L185-L195)\ntheorem nat_le_weightedOrder {n : \u2115} (h : \u2200 d, weight w d < n \u2192 coeff d f = 0) :\n n \u2264 f.weightedOrder w := by\nby_contra! H\n have : (f.weightedOrder w).toNat = f.weightedOrder w := by\n rw [coe_toNat_eq_self]; exact ne_top_of_lt H\n obtain \u27e8d, hfd, hd\u27e9 := exists_coeff_ne_zero_and_weightedOrder w this\n rw [\u2190 hd, Nat.cast_lt] at H\n exact hfd (h d H)\n\n/-- The order of a formal power series is at least `n` if\nthe `d`th coefficient is `0` for all `d` such that `weight w d < n`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.le_weightedOrder (L196-L205)\ntheorem le_weightedOrder {n : \u2115\u221e} (h : \u2200 d : \u03c3 \u2192\u2080 \u2115, weight w d < n \u2192 coeff d f = 0) :\n n \u2264 f.weightedOrder w := by\ncases n\n \u00b7 rw [top_le_iff, weightedOrder_eq_top_iff]\n ext d; exact h d (ENat.coe_lt_top _)\n \u00b7 apply nat_le_weightedOrder;\n simpa only [ENat.some_eq_coe, Nat.cast_lt] using h\n\n/-- The order of a formal power series is exactly `n` if and only if some coefficient of weight `n`\nis nonzero, and the `d`th coefficient is `0` for all `d` such that `weight w d < n`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_eq_nat (L206-L218)\ntheorem weightedOrder_eq_nat {n : \u2115} :\n f.weightedOrder w = n \u2194\n (\u2203 d, coeff d f \u2260 0 \u2227 weight w d = n) \u2227 \u2200 d, weight w d < n \u2192 coeff d f = 0 := by\nconstructor\n \u00b7 intro h\n obtain \u27e8d, hd\u27e9 := f.exists_coeff_ne_zero_and_weightedOrder w (by simp only [h, toNat_coe])\n exact \u27e8\u27e8d, by simpa [h, Nat.cast_inj, ne_eq] using hd\u27e9,\n fun e he \u21a6 f.coeff_eq_zero_of_lt_weightedOrder w (by simp only [h, Nat.cast_lt, he])\u27e9\n \u00b7 rintro \u27e8\u27e8d, hd', hd\u27e9, h\u27e9\n exact le_antisymm (hd.symm \u25b8 f.weightedOrder_le w hd') (nat_le_weightedOrder w h)\n\n/-- The `weightedOrder` of the monomial `a*X^d` is infinite if `a = 0` and `weight w d` otherwise.\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_monomial (L219-L233)\ntheorem weightedOrder_monomial {d : \u03c3 \u2192\u2080 \u2115} {a : R} [Decidable (a = 0)] :\n weightedOrder w (monomial d a) = if a = 0 then (\u22a4 : \u2115\u221e) else weight w d := by\nclassical\n split_ifs with h\n \u00b7 rw [h, weightedOrder_eq_top_iff, map_zero]\n \u00b7 rw [weightedOrder_eq_nat]\n constructor\n \u00b7 use d\n simp only [coeff_monomial_same, ne_eq, h, not_false_eq_true, and_self]\n \u00b7 intro b hb\n rw [coeff_monomial, if_neg]\n rintro rfl\n exact hb.false\n\n/-- The order of the monomial `a*X^n` is `n` if `a \u2260 0`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_monomial_of_ne_zero (L234-L238)\ntheorem weightedOrder_monomial_of_ne_zero {d : \u03c3 \u2192\u2080 \u2115} {a : R} (h : a \u2260 0) :\n weightedOrder w (monomial d a) = weight w d := by\nclassical\n rw [weightedOrder_monomial, if_neg h]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_one (L240-L243)\ntheorem weightedOrder_one [Nontrivial R] : (1 : MvPowerSeries \u03c3 R).weightedOrder w = 0 :=\nweightedOrder_monomial_of_ne_zero w one_ne_zero\n\n/-- The order of the sum of two formal power series is at least the minimum of their orders. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.min_weightedOrder_le_add (L244-L270)\ntheorem min_weightedOrder_le_add :\n min (f.weightedOrder w) (g.weightedOrder w) \u2264 (f + g).weightedOrder w := by\napply le_weightedOrder w\n simp +contextual only\n [coeff_eq_zero_of_lt_weightedOrder w, lt_min_iff, map_add, add_zero,\n imp_true_iff]\n\nprivate theorem weightedOrder_add_of_weightedOrder_lt.aux\n (H : f.weightedOrder w < g.weightedOrder w) :\n (f + g).weightedOrder w = f.weightedOrder w := by\n obtain \u27e8n, hn : (n : \u2115\u221e) = _\u27e9 := ENat.ne_top_iff_exists.mp (ne_top_of_lt H)\n rw [\u2190 hn, weightedOrder_eq_nat]\n obtain \u27e8d, hd', hd\u27e9 := ((weightedOrder_eq_nat w).mp hn.symm).1\n constructor\n \u00b7 refine \u27e8d, ?_, hd\u27e9\n rw [\u2190 hn, \u2190 hd] at H\n rw [(coeff _).map_add, coeff_eq_zero_of_lt_weightedOrder w H, add_zero]\n exact hd'\n \u00b7 intro b hb\n suffices weight w b < weightedOrder w f by\n rw [(coeff _).map_add, coeff_eq_zero_of_lt_weightedOrder w this,\n coeff_eq_zero_of_lt_weightedOrder w (lt_trans this H), add_zero]\n rw [\u2190 hn, Nat.cast_lt]\n exact hb\n\n/-- The `weightedOrder` of the sum of two formal power series\nis the minimum of their orders if their orders differ. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_add_of_weightedOrder_ne (L271-L281)\ntheorem weightedOrder_add_of_weightedOrder_ne (h : f.weightedOrder w \u2260 g.weightedOrder w) :\n weightedOrder w (f + g) = weightedOrder w f \u2293 weightedOrder w g := by\nrefine le_antisymm ?_ (min_weightedOrder_le_add w)\n wlog H\u2081 : f.weightedOrder w < g.weightedOrder w\n \u00b7 rw [add_comm f g, inf_comm]\n exact this _ h.symm ((le_of_not_gt H\u2081).lt_of_ne' h)\n simp only [le_inf_iff, weightedOrder_add_of_weightedOrder_lt.aux w H\u2081]\n exact \u27e8le_rfl, le_of_lt H\u2081\u27e9\n\n/-- The `weightedOrder` of the product of two formal power series\nis at least the sum of their orders. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_zero (L185-L187)\ntheorem coeff_zero (n : \u03c3 \u2192\u2080 \u2115) : coeff n (0 : MvPowerSeries \u03c3 R) = 0 :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_one (L201-L203)\ntheorem coeff_one [DecidableEq \u03c3] : coeff n (1 : MvPowerSeries \u03c3 R) = if n = 0 then 1 else 0 :=\ncoeff_monomial _ _ _\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial_mul (L230-L240)\ntheorem coeff_monomial_mul (a : R) :\n coeff m (monomial n a * \u03c6) = if n \u2264 m then a * coeff (m - n) \u03c6 else 0 := by\nclassical\n have :\n \u2200 p \u2208 antidiagonal m,\n coeff (p : (\u03c3 \u2192\u2080 \u2115) \u00d7 (\u03c3 \u2192\u2080 \u2115)).1 (monomial n a) * coeff p.2 \u03c6 \u2260 0 \u2192 p.1 = n :=\n fun p _ hp => eq_of_coeff_monomial_ne_zero (left_ne_zero_of_mul hp)\n rw [coeff_mul, \u2190 Finset.sum_filter_of_ne this, Finset.filter_fst_eq_antidiagonal _ n,\n Finset.sum_ite_index]\n simp only [Finset.sum_singleton, coeff_monomial_same, Finset.sum_empty]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.eq_zero_iff_forall_coeff_zero (L188-L191)\ntheorem eq_zero_iff_forall_coeff_zero {f : MvPowerSeries \u03c3 R} :\n f = 0 \u2194 (\u2200 d : \u03c3 \u2192\u2080 \u2115, coeff d f = 0) :=\nMvPowerSeries.ext_iff\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.eq_of_coeff_monomial_ne_zero (L176-L179)\ntheorem eq_of_coeff_monomial_ne_zero {m n : \u03c3 \u2192\u2080 \u2115} {a : R} (h : coeff m (monomial n a) \u2260 0) :\n m = n :=\nby_contra fun h' => h <| coeff_monomial_ne h' a\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.commute_monomial (L263-L292)\ntheorem commute_monomial {a : R} {n} :\n Commute \u03c6 (monomial n a) \u2194 \u2200 m, Commute (coeff m \u03c6) a := by\nrw [commute_iff_eq, MvPowerSeries.ext_iff]\n refine \u27e8fun h m => ?_, fun h m => ?_\u27e9\n \u00b7 have := h (m + n)\n rwa [coeff_add_mul_monomial, add_comm, coeff_add_monomial_mul] at this\n \u00b7 rw [coeff_mul_monomial, coeff_monomial_mul]\n split_ifs <;> [apply h; rfl]\n\nprotected theorem one_mul : (1 : MvPowerSeries \u03c3 R) * \u03c6 = \u03c6 :=\n ext fun n => by simpa using coeff_add_monomial_mul 0 n \u03c6 1\n\nprotected theorem mul_one : \u03c6 * 1 = \u03c6 :=\n ext fun n => by simpa using coeff_add_mul_monomial n 0 \u03c6 1\n\nprotected theorem mul_add (\u03c6\u2081 \u03c6\u2082 \u03c6\u2083 : MvPowerSeries \u03c3 R) : \u03c6\u2081 * (\u03c6\u2082 + \u03c6\u2083) = \u03c6\u2081 * \u03c6\u2082 + \u03c6\u2081 * \u03c6\u2083 :=\n ext fun n => by\n classical simp only [coeff_mul, mul_add, Finset.sum_add_distrib, map_add]\n\nprotected theorem add_mul (\u03c6\u2081 \u03c6\u2082 \u03c6\u2083 : MvPowerSeries \u03c3 R) : (\u03c6\u2081 + \u03c6\u2082) * \u03c6\u2083 = \u03c6\u2081 * \u03c6\u2083 + \u03c6\u2082 * \u03c6\u2083 :=\n ext fun n => by\n classical simp only [coeff_mul, add_mul, Finset.sum_add_distrib, map_add]\n\nprotected theorem mul_assoc (\u03c6\u2081 \u03c6\u2082 \u03c6\u2083 : MvPowerSeries \u03c3 R) : \u03c6\u2081 * \u03c6\u2082 * \u03c6\u2083 = \u03c6\u2081 * (\u03c6\u2082 * \u03c6\u2083) := by\n ext1 n\n classical\n simp only [coeff_mul, Finset.sum_mul, Finset.mul_sum, Finset.sum_sigma']\n apply Finset.sum_nbij' (fun \u27e8\u27e8_i, j\u27e9, \u27e8k, l\u27e9\u27e9 \u21a6 \u27e8(k, l + j), (l, j)\u27e9)\n (fun \u27e8\u27e8i, _j\u27e9, \u27e8k, l\u27e9\u27e9 \u21a6 \u27e8(i + k, l), (i, k)\u27e9) <;> aesop (add simp [add_assoc, mul_assoc])\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.ne_zero_iff_exists_coeff_ne_zero (L192-L197)\ntheorem ne_zero_iff_exists_coeff_ne_zero (f : MvPowerSeries \u03c3 R) :\n f \u2260 0 \u2194 (\u2203 d : \u03c3 \u2192\u2080 \u2115, coeff d f \u2260 0) := by\nsimp only [MvPowerSeries.ext_iff, ne_eq, coeff_zero, not_forall]\n\nvariable (m n : \u03c3 \u2192\u2080 \u2115) (\u03c6 \u03c8 : MvPowerSeries \u03c3 R)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial_zero_one (L207-L209)\ntheorem monomial_zero_one : monomial (R := R) (0 : \u03c3 \u2192\u2080 \u2115) 1 = 1 :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_zero_one (L204-L206)\ntheorem coeff_zero_one : coeff (R := R) (0 : \u03c3 \u2192\u2080 \u2115) 1 = 1 :=\ncoeff_monomial_same 0 1\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff (L137-L139)\ndef coeff (n : \u03c3 \u2192\u2080 \u2115) : MvPowerSeries \u03c3 R \u2192\u2097[R] R :=\nLinearMap.proj n\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial_def (L153-L159)\ntheorem monomial_def [DecidableEq \u03c3] (n : \u03c3 \u2192\u2080 \u2115) :\n monomial n = LinearMap.single R (fun _ \u21a6 R) n := by\nrw [monomial]\n -- unify the `Decidable` arguments\n convert rfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial_mul_monomial (L319-L333)\ntheorem monomial_mul_monomial (m n : \u03c3 \u2192\u2080 \u2115) (a b : R) :\n monomial m a * monomial n b = monomial (m + n) (a * b) := by\nclassical\n ext k\n simp only [coeff_mul_monomial, coeff_monomial]\n split_ifs with h\u2081 h\u2082 h\u2083 h\u2083 h\u2082 <;> try rfl\n \u00b7 rw [\u2190 h\u2082, tsub_add_cancel_of_le h\u2081] at h\u2083\n exact (h\u2083 rfl).elim\n \u00b7 rw [h\u2083, add_tsub_cancel_right] at h\u2082\n exact (h\u2082 rfl).elim\n \u00b7 exact zero_mul b\n \u00b7 rw [h\u2082] at h\u2081\n exact (h\u2081 <| le_add_left le_rfl).elim\n\n/-- The constant multivariate formal power series. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_mul_monomial (L241-L251)\ntheorem coeff_mul_monomial (a : R) :\n coeff m (\u03c6 * monomial n a) = if n \u2264 m then coeff (m - n) \u03c6 * a else 0 := by\nclassical\n have :\n \u2200 p \u2208 antidiagonal m,\n coeff (p : (\u03c3 \u2192\u2080 \u2115) \u00d7 (\u03c3 \u2192\u2080 \u2115)).1 \u03c6 * coeff p.2 (monomial n a) \u2260 0 \u2192 p.2 = n :=\n fun p _ hp => eq_of_coeff_monomial_ne_zero (right_ne_zero_of_mul hp)\n rw [coeff_mul, \u2190 Finset.sum_filter_of_ne this, Finset.filter_snd_eq_antidiagonal _ n,\n Finset.sum_ite_index]\n simp only [Finset.sum_singleton, coeff_monomial_same, Finset.sum_empty]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.C (L334-L339)\ndef C : R \u2192+* MvPowerSeries \u03c3 R :=\n{ monomial (0 : \u03c3 \u2192\u2080 \u2115) with\n map_one' := rfl\n map_mul' := fun a b => Eq.trans (by simp) (monomial_mul_monomial _ _ a b).symm\n map_zero' := (monomial 0).map_zero }\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial (L160-L164)\ntheorem coeff_monomial [DecidableEq \u03c3] (m n : \u03c3 \u2192\u2080 \u2115) (a : R) :\n coeff m (monomial n a) = if m = n then a else 0 := by\ndsimp only [coeff, MvPowerSeries]\n rw [monomial_def, LinearMap.proj_apply (i := m), LinearMap.single_apply, Pi.single_apply]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.ext (L145-L152)\ntheorem ext {\u03c6 \u03c8 : MvPowerSeries \u03c3 R} (h : \u2200 n : \u03c3 \u2192\u2080 \u2115, coeff n \u03c6 = coeff n \u03c8) : \u03c6 = \u03c8 :=\nfunext h\n\n/-- Two multivariate formal power series are equal\nif and only if all their coefficients are equal. -/\nadd_decl_doc MvPowerSeries.ext_iff\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial (L132-L136)\ndef monomial (n : \u03c3 \u2192\u2080 \u2115) : R \u2192\u2097[R] MvPowerSeries \u03c3 R :=\nletI := Classical.decEq \u03c3\n LinearMap.single R (fun _ \u21a6 R) n\n\n/-- The `n`th coefficient of a multivariate formal power series. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.MvPowerSeries (L86-L94)\ndef MvPowerSeries (\u03c3 : Type*) (R : Type*) :=\n(\u03c3 \u2192\u2080 \u2115) \u2192 R\n\nnamespace MvPowerSeries\n\nopen Finsupp\n\nvariable {\u03c3 R : Type*}\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_comp_monomial (L181-L183)\ntheorem coeff_comp_monomial (n : \u03c3 \u2192\u2080 \u2115) : (coeff (R := R) n).comp (monomial n) = LinearMap.id :=\nLinearMap.ext <| coeff_monomial_same n\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_add_mul_monomial (L257-L261)\ntheorem coeff_add_mul_monomial (a : R) :\n coeff (m + n) (\u03c6 * monomial n a) = coeff m \u03c6 * a := by\nrw [coeff_mul_monomial, if_pos, add_tsub_cancel_right]\n exact le_add_left le_rfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial_same (L166-L170)\ntheorem coeff_monomial_same (n : \u03c3 \u2192\u2080 \u2115) (a : R) : coeff n (monomial n a) = a := by\nclassical\n rw [monomial_def]\n exact Pi.single_eq_same _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_apply (L140-L143)\ntheorem coeff_apply (f : MvPowerSeries \u03c3 R) (d : \u03c3 \u2192\u2080 \u2115) : coeff d f = f d :=\nrfl\n\n/-- Two multivariate formal power series are equal if all their coefficients are equal. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial_ne (L171-L175)\ntheorem coeff_monomial_ne {m n : \u03c3 \u2192\u2080 \u2115} (h : m \u2260 n) (a : R) : coeff m (monomial n a) = 0 := by\nclassical\n rw [monomial_def]\n exact Pi.single_eq_of_ne h _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_mul (L219-L229)\ntheorem coeff_mul [DecidableEq \u03c3] :\n coeff n (\u03c6 * \u03c8) = \u2211 p \u2208 antidiagonal n, coeff p.1 \u03c6 * coeff p.2 \u03c8 := by\nrefine Finset.sum_congr ?_ fun _ _ => rfl\n rw [Subsingleton.elim (Classical.decEq \u03c3) \u2039DecidableEq \u03c3\u203a]\n\nprotected theorem zero_mul : (0 : MvPowerSeries \u03c3 R) * \u03c6 = 0 :=\n ext fun n => by classical simp [coeff_mul]\n\nprotected theorem mul_zero : \u03c6 * 0 = 0 :=\n ext fun n => by classical simp [coeff_mul]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_add_monomial_mul (L252-L256)\ntheorem coeff_add_monomial_mul (a : R) :\n coeff (m + n) (monomial m a * \u03c6) = a * coeff n \u03c6 := by\nrw [coeff_monomial_mul, if_pos, add_tsub_cancel_left]\n exact le_add_right le_rfl\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.RingTheory.MvPowerSeries.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ne_zero_iff_exists_coeff_ne_zero_and_degree :\n f \u2260 0 \u2194 (\u2203 n : \u2115, \u2203 d : \u03c3 \u2192\u2080 \u2115, coeff d f \u2260 0 \u2227 degree d = n)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.ne_zero_iff_exists_coeff_ne_zero_and_weight (L134-L138)\ntheorem ne_zero_iff_exists_coeff_ne_zero_and_weight :\n f \u2260 0 \u2194 (\u2203 n : \u2115, \u2203 d : \u03c3 \u2192\u2080 \u2115, coeff d f \u2260 0 \u2227 weight w d = n) := by\nsimpa using ne_zero_iff_exists_coeff_ne_zero f\n\n/-- The weighted order of a mv_power_series -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder (L139-L143)\ndef weightedOrder (f : MvPowerSeries \u03c3 R) : \u2115\u221e := by\nclassical\n exact dite (f = 0) (fun _ => \u22a4) fun h =>\n Nat.find ((ne_zero_iff_exists_coeff_ne_zero_and_weight w).mp h)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.ne_zero_iff_weightedOrder_finite (L147-L152)\ntheorem ne_zero_iff_weightedOrder_finite :\n f \u2260 0 \u2194 (f.weightedOrder w).toNat = f.weightedOrder w := by\nsimp only [weightedOrder, ne_eq, coe_toNat_eq_self, dite_eq_left_iff,\n ENat.coe_ne_top, imp_false, not_not]\n\n/-- The `0` power series is the unique power series with infinite order. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_eq_top_iff (L154-L159)\ntheorem weightedOrder_eq_top_iff :\n f.weightedOrder w = \u22a4 \u2194 f = 0 := by\nrw [\u2190 not_iff_not, \u2190 ne_eq, \u2190 ne_eq, ne_zero_iff_weightedOrder_finite w, coe_toNat_eq_self]\n\n/-- If the order of a formal power series `f` is finite,\nthen some coefficient of weight equal to the order of `f` is nonzero. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.exists_coeff_ne_zero_and_weightedOrder (L160-L169)\ntheorem exists_coeff_ne_zero_and_weightedOrder\n (h : (toNat (f.weightedOrder w) : \u2115\u221e) = f.weightedOrder w) :\n \u2203 d, coeff d f \u2260 0 \u2227 weight w d = f.weightedOrder w := by\nclassical\n simp_rw [weightedOrder, dif_neg ((ne_zero_iff_weightedOrder_finite w).mpr h), Nat.cast_inj]\n generalize_proofs h1\n exact Nat.find_spec h1\n\n/-- If the `d`th coefficient of a formal power series is nonzero,\nthen the weighted order of the power series is less than or equal to `weight d w`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_le (L170-L178)\ntheorem weightedOrder_le {d : \u03c3 \u2192\u2080 \u2115} (h : coeff d f \u2260 0) :\n f.weightedOrder w \u2264 weight w d := by\nrw [weightedOrder, dif_neg]\n \u00b7 simp only [ne_eq, Nat.cast_le, Nat.find_le_iff]\n exact \u27e8weight w d, le_rfl, d, h, rfl\u27e9\n \u00b7 exact (f.ne_zero_iff_exists_coeff_ne_zero_and_weight w).mpr \u27e8weight w d, d, h, rfl\u27e9\n\n/-- The `n`th coefficient of a formal power series is `0` if `n` is strictly\nsmaller than the order of the power series. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.coeff_eq_zero_of_lt_weightedOrder (L179-L184)\ntheorem coeff_eq_zero_of_lt_weightedOrder {d : \u03c3 \u2192\u2080 \u2115} (h : (weight w d) < f.weightedOrder w) :\n coeff d f = 0 := by\ncontrapose! h; exact weightedOrder_le w h\n\n/-- The order of a formal power series is at least `n` if\nthe `d`th coefficient is `0` for all `d` such that `weight w d < n`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.nat_le_weightedOrder (L185-L195)\ntheorem nat_le_weightedOrder {n : \u2115} (h : \u2200 d, weight w d < n \u2192 coeff d f = 0) :\n n \u2264 f.weightedOrder w := by\nby_contra! H\n have : (f.weightedOrder w).toNat = f.weightedOrder w := by\n rw [coe_toNat_eq_self]; exact ne_top_of_lt H\n obtain \u27e8d, hfd, hd\u27e9 := exists_coeff_ne_zero_and_weightedOrder w this\n rw [\u2190 hd, Nat.cast_lt] at H\n exact hfd (h d H)\n\n/-- The order of a formal power series is at least `n` if\nthe `d`th coefficient is `0` for all `d` such that `weight w d < n`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.le_weightedOrder (L196-L205)\ntheorem le_weightedOrder {n : \u2115\u221e} (h : \u2200 d : \u03c3 \u2192\u2080 \u2115, weight w d < n \u2192 coeff d f = 0) :\n n \u2264 f.weightedOrder w := by\ncases n\n \u00b7 rw [top_le_iff, weightedOrder_eq_top_iff]\n ext d; exact h d (ENat.coe_lt_top _)\n \u00b7 apply nat_le_weightedOrder;\n simpa only [ENat.some_eq_coe, Nat.cast_lt] using h\n\n/-- The order of a formal power series is exactly `n` if and only if some coefficient of weight `n`\nis nonzero, and the `d`th coefficient is `0` for all `d` such that `weight w d < n`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_eq_nat (L206-L218)\ntheorem weightedOrder_eq_nat {n : \u2115} :\n f.weightedOrder w = n \u2194\n (\u2203 d, coeff d f \u2260 0 \u2227 weight w d = n) \u2227 \u2200 d, weight w d < n \u2192 coeff d f = 0 := by\nconstructor\n \u00b7 intro h\n obtain \u27e8d, hd\u27e9 := f.exists_coeff_ne_zero_and_weightedOrder w (by simp only [h, toNat_coe])\n exact \u27e8\u27e8d, by simpa [h, Nat.cast_inj, ne_eq] using hd\u27e9,\n fun e he \u21a6 f.coeff_eq_zero_of_lt_weightedOrder w (by simp only [h, Nat.cast_lt, he])\u27e9\n \u00b7 rintro \u27e8\u27e8d, hd', hd\u27e9, h\u27e9\n exact le_antisymm (hd.symm \u25b8 f.weightedOrder_le w hd') (nat_le_weightedOrder w h)\n\n/-- The `weightedOrder` of the monomial `a*X^d` is infinite if `a = 0` and `weight w d` otherwise.\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_monomial (L219-L233)\ntheorem weightedOrder_monomial {d : \u03c3 \u2192\u2080 \u2115} {a : R} [Decidable (a = 0)] :\n weightedOrder w (monomial d a) = if a = 0 then (\u22a4 : \u2115\u221e) else weight w d := by\nclassical\n split_ifs with h\n \u00b7 rw [h, weightedOrder_eq_top_iff, map_zero]\n \u00b7 rw [weightedOrder_eq_nat]\n constructor\n \u00b7 use d\n simp only [coeff_monomial_same, ne_eq, h, not_false_eq_true, and_self]\n \u00b7 intro b hb\n rw [coeff_monomial, if_neg]\n rintro rfl\n exact hb.false\n\n/-- The order of the monomial `a*X^n` is `n` if `a \u2260 0`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_monomial_of_ne_zero (L234-L238)\ntheorem weightedOrder_monomial_of_ne_zero {d : \u03c3 \u2192\u2080 \u2115} {a : R} (h : a \u2260 0) :\n weightedOrder w (monomial d a) = weight w d := by\nclassical\n rw [weightedOrder_monomial, if_neg h]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_one (L240-L243)\ntheorem weightedOrder_one [Nontrivial R] : (1 : MvPowerSeries \u03c3 R).weightedOrder w = 0 :=\nweightedOrder_monomial_of_ne_zero w one_ne_zero\n\n/-- The order of the sum of two formal power series is at least the minimum of their orders. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.min_weightedOrder_le_add (L244-L270)\ntheorem min_weightedOrder_le_add :\n min (f.weightedOrder w) (g.weightedOrder w) \u2264 (f + g).weightedOrder w := by\napply le_weightedOrder w\n simp +contextual only\n [coeff_eq_zero_of_lt_weightedOrder w, lt_min_iff, map_add, add_zero,\n imp_true_iff]\n\nprivate theorem weightedOrder_add_of_weightedOrder_lt.aux\n (H : f.weightedOrder w < g.weightedOrder w) :\n (f + g).weightedOrder w = f.weightedOrder w := by\n obtain \u27e8n, hn : (n : \u2115\u221e) = _\u27e9 := ENat.ne_top_iff_exists.mp (ne_top_of_lt H)\n rw [\u2190 hn, weightedOrder_eq_nat]\n obtain \u27e8d, hd', hd\u27e9 := ((weightedOrder_eq_nat w).mp hn.symm).1\n constructor\n \u00b7 refine \u27e8d, ?_, hd\u27e9\n rw [\u2190 hn, \u2190 hd] at H\n rw [(coeff _).map_add, coeff_eq_zero_of_lt_weightedOrder w H, add_zero]\n exact hd'\n \u00b7 intro b hb\n suffices weight w b < weightedOrder w f by\n rw [(coeff _).map_add, coeff_eq_zero_of_lt_weightedOrder w this,\n coeff_eq_zero_of_lt_weightedOrder w (lt_trans this H), add_zero]\n rw [\u2190 hn, Nat.cast_lt]\n exact hb\n\n/-- The `weightedOrder` of the sum of two formal power series\nis the minimum of their orders if their orders differ. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Order.weightedOrder_add_of_weightedOrder_ne (L271-L281)\ntheorem weightedOrder_add_of_weightedOrder_ne (h : f.weightedOrder w \u2260 g.weightedOrder w) :\n weightedOrder w (f + g) = weightedOrder w f \u2293 weightedOrder w g := by\nrefine le_antisymm ?_ (min_weightedOrder_le_add w)\n wlog H\u2081 : f.weightedOrder w < g.weightedOrder w\n \u00b7 rw [add_comm f g, inf_comm]\n exact this _ h.symm ((le_of_not_gt H\u2081).lt_of_ne' h)\n simp only [le_inf_iff, weightedOrder_add_of_weightedOrder_lt.aux w H\u2081]\n exact \u27e8le_rfl, le_of_lt H\u2081\u27e9\n\n/-- The `weightedOrder` of the product of two formal power series\nis at least the sum of their orders. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_zero (L185-L187)\ntheorem coeff_zero (n : \u03c3 \u2192\u2080 \u2115) : coeff n (0 : MvPowerSeries \u03c3 R) = 0 :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_one (L201-L203)\ntheorem coeff_one [DecidableEq \u03c3] : coeff n (1 : MvPowerSeries \u03c3 R) = if n = 0 then 1 else 0 :=\ncoeff_monomial _ _ _\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial_mul (L230-L240)\ntheorem coeff_monomial_mul (a : R) :\n coeff m (monomial n a * \u03c6) = if n \u2264 m then a * coeff (m - n) \u03c6 else 0 := by\nclassical\n have :\n \u2200 p \u2208 antidiagonal m,\n coeff (p : (\u03c3 \u2192\u2080 \u2115) \u00d7 (\u03c3 \u2192\u2080 \u2115)).1 (monomial n a) * coeff p.2 \u03c6 \u2260 0 \u2192 p.1 = n :=\n fun p _ hp => eq_of_coeff_monomial_ne_zero (left_ne_zero_of_mul hp)\n rw [coeff_mul, \u2190 Finset.sum_filter_of_ne this, Finset.filter_fst_eq_antidiagonal _ n,\n Finset.sum_ite_index]\n simp only [Finset.sum_singleton, coeff_monomial_same, Finset.sum_empty]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.eq_zero_iff_forall_coeff_zero (L188-L191)\ntheorem eq_zero_iff_forall_coeff_zero {f : MvPowerSeries \u03c3 R} :\n f = 0 \u2194 (\u2200 d : \u03c3 \u2192\u2080 \u2115, coeff d f = 0) :=\nMvPowerSeries.ext_iff\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.eq_of_coeff_monomial_ne_zero (L176-L179)\ntheorem eq_of_coeff_monomial_ne_zero {m n : \u03c3 \u2192\u2080 \u2115} {a : R} (h : coeff m (monomial n a) \u2260 0) :\n m = n :=\nby_contra fun h' => h <| coeff_monomial_ne h' a\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.commute_monomial (L263-L292)\ntheorem commute_monomial {a : R} {n} :\n Commute \u03c6 (monomial n a) \u2194 \u2200 m, Commute (coeff m \u03c6) a := by\nrw [commute_iff_eq, MvPowerSeries.ext_iff]\n refine \u27e8fun h m => ?_, fun h m => ?_\u27e9\n \u00b7 have := h (m + n)\n rwa [coeff_add_mul_monomial, add_comm, coeff_add_monomial_mul] at this\n \u00b7 rw [coeff_mul_monomial, coeff_monomial_mul]\n split_ifs <;> [apply h; rfl]\n\nprotected theorem one_mul : (1 : MvPowerSeries \u03c3 R) * \u03c6 = \u03c6 :=\n ext fun n => by simpa using coeff_add_monomial_mul 0 n \u03c6 1\n\nprotected theorem mul_one : \u03c6 * 1 = \u03c6 :=\n ext fun n => by simpa using coeff_add_mul_monomial n 0 \u03c6 1\n\nprotected theorem mul_add (\u03c6\u2081 \u03c6\u2082 \u03c6\u2083 : MvPowerSeries \u03c3 R) : \u03c6\u2081 * (\u03c6\u2082 + \u03c6\u2083) = \u03c6\u2081 * \u03c6\u2082 + \u03c6\u2081 * \u03c6\u2083 :=\n ext fun n => by\n classical simp only [coeff_mul, mul_add, Finset.sum_add_distrib, map_add]\n\nprotected theorem add_mul (\u03c6\u2081 \u03c6\u2082 \u03c6\u2083 : MvPowerSeries \u03c3 R) : (\u03c6\u2081 + \u03c6\u2082) * \u03c6\u2083 = \u03c6\u2081 * \u03c6\u2083 + \u03c6\u2082 * \u03c6\u2083 :=\n ext fun n => by\n classical simp only [coeff_mul, add_mul, Finset.sum_add_distrib, map_add]\n\nprotected theorem mul_assoc (\u03c6\u2081 \u03c6\u2082 \u03c6\u2083 : MvPowerSeries \u03c3 R) : \u03c6\u2081 * \u03c6\u2082 * \u03c6\u2083 = \u03c6\u2081 * (\u03c6\u2082 * \u03c6\u2083) := by\n ext1 n\n classical\n simp only [coeff_mul, Finset.sum_mul, Finset.mul_sum, Finset.sum_sigma']\n apply Finset.sum_nbij' (fun \u27e8\u27e8_i, j\u27e9, \u27e8k, l\u27e9\u27e9 \u21a6 \u27e8(k, l + j), (l, j)\u27e9)\n (fun \u27e8\u27e8i, _j\u27e9, \u27e8k, l\u27e9\u27e9 \u21a6 \u27e8(i + k, l), (i, k)\u27e9) <;> aesop (add simp [add_assoc, mul_assoc])\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.ne_zero_iff_exists_coeff_ne_zero (L192-L197)\ntheorem ne_zero_iff_exists_coeff_ne_zero (f : MvPowerSeries \u03c3 R) :\n f \u2260 0 \u2194 (\u2203 d : \u03c3 \u2192\u2080 \u2115, coeff d f \u2260 0) := by\nsimp only [MvPowerSeries.ext_iff, ne_eq, coeff_zero, not_forall]\n\nvariable (m n : \u03c3 \u2192\u2080 \u2115) (\u03c6 \u03c8 : MvPowerSeries \u03c3 R)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial_zero_one (L207-L209)\ntheorem monomial_zero_one : monomial (R := R) (0 : \u03c3 \u2192\u2080 \u2115) 1 = 1 :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_zero_one (L204-L206)\ntheorem coeff_zero_one : coeff (R := R) (0 : \u03c3 \u2192\u2080 \u2115) 1 = 1 :=\ncoeff_monomial_same 0 1\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff (L137-L139)\ndef coeff (n : \u03c3 \u2192\u2080 \u2115) : MvPowerSeries \u03c3 R \u2192\u2097[R] R :=\nLinearMap.proj n\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial_def (L153-L159)\ntheorem monomial_def [DecidableEq \u03c3] (n : \u03c3 \u2192\u2080 \u2115) :\n monomial n = LinearMap.single R (fun _ \u21a6 R) n := by\nrw [monomial]\n -- unify the `Decidable` arguments\n convert rfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial_mul_monomial (L319-L333)\ntheorem monomial_mul_monomial (m n : \u03c3 \u2192\u2080 \u2115) (a b : R) :\n monomial m a * monomial n b = monomial (m + n) (a * b) := by\nclassical\n ext k\n simp only [coeff_mul_monomial, coeff_monomial]\n split_ifs with h\u2081 h\u2082 h\u2083 h\u2083 h\u2082 <;> try rfl\n \u00b7 rw [\u2190 h\u2082, tsub_add_cancel_of_le h\u2081] at h\u2083\n exact (h\u2083 rfl).elim\n \u00b7 rw [h\u2083, add_tsub_cancel_right] at h\u2082\n exact (h\u2082 rfl).elim\n \u00b7 exact zero_mul b\n \u00b7 rw [h\u2082] at h\u2081\n exact (h\u2081 <| le_add_left le_rfl).elim\n\n/-- The constant multivariate formal power series. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_mul_monomial (L241-L251)\ntheorem coeff_mul_monomial (a : R) :\n coeff m (\u03c6 * monomial n a) = if n \u2264 m then coeff (m - n) \u03c6 * a else 0 := by\nclassical\n have :\n \u2200 p \u2208 antidiagonal m,\n coeff (p : (\u03c3 \u2192\u2080 \u2115) \u00d7 (\u03c3 \u2192\u2080 \u2115)).1 \u03c6 * coeff p.2 (monomial n a) \u2260 0 \u2192 p.2 = n :=\n fun p _ hp => eq_of_coeff_monomial_ne_zero (right_ne_zero_of_mul hp)\n rw [coeff_mul, \u2190 Finset.sum_filter_of_ne this, Finset.filter_snd_eq_antidiagonal _ n,\n Finset.sum_ite_index]\n simp only [Finset.sum_singleton, coeff_monomial_same, Finset.sum_empty]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.C (L334-L339)\ndef C : R \u2192+* MvPowerSeries \u03c3 R :=\n{ monomial (0 : \u03c3 \u2192\u2080 \u2115) with\n map_one' := rfl\n map_mul' := fun a b => Eq.trans (by simp) (monomial_mul_monomial _ _ a b).symm\n map_zero' := (monomial 0).map_zero }\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial (L160-L164)\ntheorem coeff_monomial [DecidableEq \u03c3] (m n : \u03c3 \u2192\u2080 \u2115) (a : R) :\n coeff m (monomial n a) = if m = n then a else 0 := by\ndsimp only [coeff, MvPowerSeries]\n rw [monomial_def, LinearMap.proj_apply (i := m), LinearMap.single_apply, Pi.single_apply]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.ext (L145-L152)\ntheorem ext {\u03c6 \u03c8 : MvPowerSeries \u03c3 R} (h : \u2200 n : \u03c3 \u2192\u2080 \u2115, coeff n \u03c6 = coeff n \u03c8) : \u03c6 = \u03c8 :=\nfunext h\n\n/-- Two multivariate formal power series are equal\nif and only if all their coefficients are equal. -/\nadd_decl_doc MvPowerSeries.ext_iff\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.monomial (L132-L136)\ndef monomial (n : \u03c3 \u2192\u2080 \u2115) : R \u2192\u2097[R] MvPowerSeries \u03c3 R :=\nletI := Classical.decEq \u03c3\n LinearMap.single R (fun _ \u21a6 R) n\n\n/-- The `n`th coefficient of a multivariate formal power series. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.MvPowerSeries (L86-L94)\ndef MvPowerSeries (\u03c3 : Type*) (R : Type*) :=\n(\u03c3 \u2192\u2080 \u2115) \u2192 R\n\nnamespace MvPowerSeries\n\nopen Finsupp\n\nvariable {\u03c3 R : Type*}\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_comp_monomial (L181-L183)\ntheorem coeff_comp_monomial (n : \u03c3 \u2192\u2080 \u2115) : (coeff (R := R) n).comp (monomial n) = LinearMap.id :=\nLinearMap.ext <| coeff_monomial_same n\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_add_mul_monomial (L257-L261)\ntheorem coeff_add_mul_monomial (a : R) :\n coeff (m + n) (\u03c6 * monomial n a) = coeff m \u03c6 * a := by\nrw [coeff_mul_monomial, if_pos, add_tsub_cancel_right]\n exact le_add_left le_rfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial_same (L166-L170)\ntheorem coeff_monomial_same (n : \u03c3 \u2192\u2080 \u2115) (a : R) : coeff n (monomial n a) = a := by\nclassical\n rw [monomial_def]\n exact Pi.single_eq_same _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_apply (L140-L143)\ntheorem coeff_apply (f : MvPowerSeries \u03c3 R) (d : \u03c3 \u2192\u2080 \u2115) : coeff d f = f d :=\nrfl\n\n/-- Two multivariate formal power series are equal if all their coefficients are equal. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_monomial_ne (L171-L175)\ntheorem coeff_monomial_ne {m n : \u03c3 \u2192\u2080 \u2115} (h : m \u2260 n) (a : R) : coeff m (monomial n a) = 0 := by\nclassical\n rw [monomial_def]\n exact Pi.single_eq_of_ne h _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_mul (L219-L229)\ntheorem coeff_mul [DecidableEq \u03c3] :\n coeff n (\u03c6 * \u03c8) = \u2211 p \u2208 antidiagonal n, coeff p.1 \u03c6 * coeff p.2 \u03c8 := by\nrefine Finset.sum_congr ?_ fun _ _ => rfl\n rw [Subsingleton.elim (Classical.decEq \u03c3) \u2039DecidableEq \u03c3\u203a]\n\nprotected theorem zero_mul : (0 : MvPowerSeries \u03c3 R) * \u03c6 = 0 :=\n ext fun n => by classical simp [coeff_mul]\n\nprotected theorem mul_zero : \u03c6 * 0 = 0 :=\n ext fun n => by classical simp [coeff_mul]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.MvPowerSeries.Basic.coeff_add_monomial_mul (L252-L256)\ntheorem coeff_add_monomial_mul (a : R) :\n coeff (m + n) (monomial m a * \u03c6) = a * coeff n \u03c6 := by\nrw [coeff_monomial_mul, if_pos, add_tsub_cancel_left]\n exact le_add_right le_rfl\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/MvPowerSeries/Order.lean", "module": "Mathlib.RingTheory.MvPowerSeries.Order", "declaration": "Mathlib.RingTheory.MvPowerSeries.Order.ne_zero_iff_exists_coeff_ne_zero_and_degree", "span": "L382-L387", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPowerSeries/Order.lean#L382"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6716, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 17518, "lean_code_chars": 16011, "natural_language_chars": 1507, "lean_code_ratio": 0.914, "line_count": 503, "imports_count": 0, "declarations_count": 1812, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "d1610e969f3929f7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioo", "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.Data.Rat.Cast.Order)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem preimage_cast_Ioo (p q : \u211a) : (\u2191) \u207b\u00b9' Ioo (p : K) q = Ioo p q\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castHom_rat (L24-L30)\ntheorem castHom_rat : castHom \u211a = RingHom.id \u211a :=\nRingHom.ext cast_id\n\nsection LinearOrderedField\n\nvariable {K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_pos_of_pos (L31-L34)\ntheorem cast_pos_of_pos (hq : 0 < q) : (0 : K) < q := by\nrw [Rat.cast_def]\n exact div_pos (Int.cast_pos.2 <| num_pos.2 hq) (Nat.cast_pos.2 q.pos)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_strictMono (L36-L38)\ntheorem cast_strictMono : StrictMono ((\u2191) : \u211a \u2192 K) := fun p q => by\nsimpa only [sub_pos, cast_sub] using cast_pos_of_pos (K := K) (q := q - p)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_mono (L40-L43)\ntheorem cast_mono : Monotone ((\u2191) : \u211a \u2192 K) :=\ncast_strictMono.monotone\n\n/-- Coercion from `\u211a` as an order embedding. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castOrderEmbedding (L45-L47)\ndef castOrderEmbedding : \u211a \u21aao K :=\nOrderEmbedding.ofStrictMono (\u2191) cast_strictMono\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_natCast (L61-L63)\ntheorem cast_le_natCast {m : \u211a} {n : \u2115} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_le_cast (L65-L67)\ntheorem natCast_le_cast {m : \u2115} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_intCast (L69-L71)\ntheorem cast_le_intCast {m : \u211a} {n : \u2124} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_le_cast (L73-L75)\ntheorem intCast_le_cast {m : \u2124} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_natCast (L77-L79)\ntheorem cast_lt_natCast {m : \u211a} {n : \u2115} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_lt_cast (L81-L83)\ntheorem natCast_lt_cast {m : \u2115} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_intCast (L85-L87)\ntheorem cast_lt_intCast {m : \u211a} {n : \u2124} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_lt_cast (L89-L91)\ntheorem intCast_lt_cast {m : \u2124} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_min (L93-L94)\nlemma cast_min (p q : \u211a) : (\u2191(min p q) : K) = min (p : K) (q : K) := (@cast_mono K _).map_min\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_max (L96-L97)\nlemma cast_max (p q : \u211a) : (\u2191(max p q) : K) = max (p : K) (q : K) := (@cast_mono K _).map_max\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_commute (L46-L48)\nlemma cast_commute (q : \u211a\u22650) (a : \u03b1) : Commute (\u2191q) a := by\nsimpa only [cast_def] using (q.num.cast_commute a).div_left (q.den.cast_commute a)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_one (L130-L132)\ntheorem cast_one : ((1 : \u211a) : \u03b1) = 1 :=\n(cast_intCast _).trans Int.cast_one\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_intCast (L113-L115)\ntheorem cast_intCast (n : \u2124) : ((n : \u211a) : \u03b1) = n :=\n(cast_def _).trans <| show (n / (1 : \u2115) : \u03b1) = n by rw [Nat.cast_one, div_one]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_sum (L25-L27)\ntheorem cast_list_sum (s : List \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_list_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_prod (L47-L49)\ntheorem cast_multiset_prod (s : Multiset \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_multiset_prod (Rat.castHom \u03b1) _\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_prod (L51-L56)\ntheorem cast_prod (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u220f i \u2208 s, f i = \u220f i \u2208 s, (f i : \u03b1) :=\nmap_prod (Rat.castHom \u03b1) _ _\n\nend Field\n\nend Rat\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_divInt_of_ne_zero (L143-L161)\nlemma cast_divInt_of_ne_zero (a : \u2124) {b : \u2124} (b0 : (b : \u03b1) \u2260 0) : (a /. b : \u03b1) = a / b := by\nhave b0' : b \u2260 0 := by\n refine mt ?_ b0\n simp +contextual\n rcases e : a /. b with \u27e8n, d, h, c\u27e9\n have d0 : (d : \u03b1) \u2260 0 := by\n intro d0\n have dd := den_dvd a b\n rcases show (d : \u2124) \u2223 b by rwa [e] at dd with \u27e8k, ke\u27e9\n have : (b : \u03b1) = (d : \u03b1) * (k : \u03b1) := by rw [ke, Int.cast_mul, Int.cast_natCast]\n rw [d0, zero_mul] at this\n contradiction\n rw [mk_eq_divInt] at e\n have := congr_arg ((\u2191) : \u2124 \u2192 \u03b1)\n ((divInt_eq_divInt_iff b0' <| ne_of_gt <| Int.natCast_pos.2 h.bot_lt).1 e)\n rw [Int.cast_mul, Int.cast_mul, Int.cast_natCast] at this\n rw [eq_comm, cast_def, div_eq_mul_inv, eq_div_iff_mul_eq d0, mul_assoc, (d.commute_cast _).eq,\n \u2190 mul_assoc, this, mul_assoc, mul_inv_cancel\u2080 b0, mul_one]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_mul_of_ne_zero (L83-L91)\nlemma cast_mul_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q * r) = (q * r : \u03b1) := by\nrw [mul_def, cast_divNat_of_ne_zero, cast_def, cast_def,\n (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_natCast (L117-L120)\ntheorem cast_natCast (n : \u2115) : ((n : \u211a) : \u03b1) = n := by\nrw [\u2190 Int.cast_natCast, cast_intCast, Int.cast_natCast]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_zpow (L66-L67)\nlemma cast_zpow (p : \u211a) (n : \u2124) : \u2191(p ^ n) = (p ^ n : \u03b1) := map_zpow\u2080 (castHom \u03b1) ..\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_div_of_ne_zero (L97-L111)\nlemma cast_div_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.num : \u03b1) \u2260 0) :\n \u2191(q / r) = (q / r : \u03b1) := by\nrw [div_def, cast_divNat_of_ne_zero, cast_def, cast_def, div_eq_mul_inv (_ / _),\n inv_div, (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n\nend NNRat\n\nnamespace Rat\n\nvariable [DivisionRing \u03b1] {p q : \u211a}\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.castHom (L53-L59)\ndef castHom : \u211a \u2192+* \u03b1 where\n toFun := (\u2191)\nmap_one' := cast_one\n map_mul' := cast_mul\n map_zero' := cast_zero\n map_add' := cast_add\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.commute_cast (L49-L50)\nlemma commute_cast (a : \u03b1) (q : \u211a\u22650) : Commute a q := (cast_commute ..).symm\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_prod (L37-L45)\ntheorem cast_list_prod (s : List \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_list_prod (Rat.castHom \u03b1) _\n\nend WithDivRing\n\nsection Field\n\nvariable [Field \u03b1] [CharZero \u03b1]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_ne_zero (L40-L41)\nlemma cast_ne_zero : (p : \u03b1) \u2260 0 \u2194 p \u2260 0 := cast_eq_zero.ne\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divNat (L115-L121)\nlemma cast_divNat (a b : \u2115) : (divNat a b : \u03b1) = a / b := by\nrw [\u2190 cast_natCast, \u2190 cast_natCast b, \u2190 cast_div]\n congr\n ext\n apply Rat.mkRat_eq_div\n\nend NNRat\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Rat.Cardinal.Cardinal (L25-L25)\ntheorem Cardinal.mkRat : #\u211a = \u2135\u2080 := mk_eq_aleph0 \u211a\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_inv_of_ne_zero (L93-L95)\nlemma cast_inv_of_ne_zero (hq : (q.num : \u03b1) \u2260 0) : (q\u207b\u00b9 : \u211a\u22650) = (q\u207b\u00b9 : \u03b1) := by\nrw [inv_def, cast_divNat_of_ne_zero _ hq, cast_def, inv_div]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_add_of_ne_zero (L73-L81)\nlemma cast_add_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q + r) = (q + r : \u03b1) := by\nrw [add_def, cast_divNat_of_ne_zero, cast_def, cast_def, mul_comm _ q.den,\n (Nat.commute_cast _ _).div_add_div (Nat.commute_cast _ _) hq hr]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_zero (L126-L128)\ntheorem cast_zero : ((0 : \u211a) : \u03b1) = 0 :=\n(cast_intCast _).trans Int.cast_zero\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_comm (L51-L52)\nlemma cast_comm (q : \u211a\u22650) (a : \u03b1) : q * a = a * q := cast_commute _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divInt (L69-L76)\ntheorem cast_divInt (a b : \u2124) : (a /. b : \u03b1) = a / b := by\nsimp only [divInt_eq_div, cast_div, cast_intCast]\n\nend Rat\n\nnamespace NNRat\nvariable [DivisionSemiring \u03b1] [CharZero \u03b1] {p q : \u211a\u22650}\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_sum (L33-L35)\ntheorem cast_sum (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u2211 i \u2208 s, f i = \u2211 i \u2208 s, (f i : \u03b1) :=\nmap_sum (Rat.castHom \u03b1) _ s\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_sum (L29-L31)\ntheorem cast_multiset_sum (s : Multiset \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_multiset_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_injective (L25-L36)\nlemma cast_injective : Injective ((\u2191) : \u211a \u2192 \u03b1)\n | \u27e8n\u2081, d\u2081, d\u20810, c\u2081\u27e9, \u27e8n\u2082, d\u2082, d\u20820, c\u2082\u27e9, h => by\n have d\u2081a : (d\u2081 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20810\nhave d\u2082a : (d\u2082 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20820\n rw [mk_eq_divInt, mk_eq_divInt] at h \u22a2\n rw [cast_divInt_of_ne_zero _ (by simpa), cast_divInt_of_ne_zero _ (by simpa)] at h\n norm_cast at h\n rwa [eq_div_iff_mul_eq d\u2082a, division_def, mul_assoc, (d\u2081.cast_commute (d\u2082 : \u03b1)).inv_left\u2080.eq,\n \u2190 mul_assoc, \u2190 division_def, eq_comm, eq_div_iff_mul_eq d\u2081a, eq_comm, \u2190 Int.cast_natCast d\u2081,\n \u2190 Int.cast_mul, \u2190 Int.cast_natCast d\u2082, \u2190 Int.cast_mul, Int.cast_inj, \u2190 mkRat_eq_iff d\u20810 d\u20820]\n at h\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.Data.Rat.Cast.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem preimage_cast_Ioo (p q : \u211a) : (\u2191) \u207b\u00b9' Ioo (p : K) q = Ioo p q\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castHom_rat (L24-L30)\ntheorem castHom_rat : castHom \u211a = RingHom.id \u211a :=\nRingHom.ext cast_id\n\nsection LinearOrderedField\n\nvariable {K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_pos_of_pos (L31-L34)\ntheorem cast_pos_of_pos (hq : 0 < q) : (0 : K) < q := by\nrw [Rat.cast_def]\n exact div_pos (Int.cast_pos.2 <| num_pos.2 hq) (Nat.cast_pos.2 q.pos)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_strictMono (L36-L38)\ntheorem cast_strictMono : StrictMono ((\u2191) : \u211a \u2192 K) := fun p q => by\nsimpa only [sub_pos, cast_sub] using cast_pos_of_pos (K := K) (q := q - p)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_mono (L40-L43)\ntheorem cast_mono : Monotone ((\u2191) : \u211a \u2192 K) :=\ncast_strictMono.monotone\n\n/-- Coercion from `\u211a` as an order embedding. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castOrderEmbedding (L45-L47)\ndef castOrderEmbedding : \u211a \u21aao K :=\nOrderEmbedding.ofStrictMono (\u2191) cast_strictMono\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_natCast (L61-L63)\ntheorem cast_le_natCast {m : \u211a} {n : \u2115} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_le_cast (L65-L67)\ntheorem natCast_le_cast {m : \u2115} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_intCast (L69-L71)\ntheorem cast_le_intCast {m : \u211a} {n : \u2124} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_le_cast (L73-L75)\ntheorem intCast_le_cast {m : \u2124} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_natCast (L77-L79)\ntheorem cast_lt_natCast {m : \u211a} {n : \u2115} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_lt_cast (L81-L83)\ntheorem natCast_lt_cast {m : \u2115} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_intCast (L85-L87)\ntheorem cast_lt_intCast {m : \u211a} {n : \u2124} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_lt_cast (L89-L91)\ntheorem intCast_lt_cast {m : \u2124} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_min (L93-L94)\nlemma cast_min (p q : \u211a) : (\u2191(min p q) : K) = min (p : K) (q : K) := (@cast_mono K _).map_min\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_max (L96-L97)\nlemma cast_max (p q : \u211a) : (\u2191(max p q) : K) = max (p : K) (q : K) := (@cast_mono K _).map_max\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_commute (L46-L48)\nlemma cast_commute (q : \u211a\u22650) (a : \u03b1) : Commute (\u2191q) a := by\nsimpa only [cast_def] using (q.num.cast_commute a).div_left (q.den.cast_commute a)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_one (L130-L132)\ntheorem cast_one : ((1 : \u211a) : \u03b1) = 1 :=\n(cast_intCast _).trans Int.cast_one\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_intCast (L113-L115)\ntheorem cast_intCast (n : \u2124) : ((n : \u211a) : \u03b1) = n :=\n(cast_def _).trans <| show (n / (1 : \u2115) : \u03b1) = n by rw [Nat.cast_one, div_one]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_sum (L25-L27)\ntheorem cast_list_sum (s : List \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_list_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_prod (L47-L49)\ntheorem cast_multiset_prod (s : Multiset \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_multiset_prod (Rat.castHom \u03b1) _\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_prod (L51-L56)\ntheorem cast_prod (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u220f i \u2208 s, f i = \u220f i \u2208 s, (f i : \u03b1) :=\nmap_prod (Rat.castHom \u03b1) _ _\n\nend Field\n\nend Rat\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_divInt_of_ne_zero (L143-L161)\nlemma cast_divInt_of_ne_zero (a : \u2124) {b : \u2124} (b0 : (b : \u03b1) \u2260 0) : (a /. b : \u03b1) = a / b := by\nhave b0' : b \u2260 0 := by\n refine mt ?_ b0\n simp +contextual\n rcases e : a /. b with \u27e8n, d, h, c\u27e9\n have d0 : (d : \u03b1) \u2260 0 := by\n intro d0\n have dd := den_dvd a b\n rcases show (d : \u2124) \u2223 b by rwa [e] at dd with \u27e8k, ke\u27e9\n have : (b : \u03b1) = (d : \u03b1) * (k : \u03b1) := by rw [ke, Int.cast_mul, Int.cast_natCast]\n rw [d0, zero_mul] at this\n contradiction\n rw [mk_eq_divInt] at e\n have := congr_arg ((\u2191) : \u2124 \u2192 \u03b1)\n ((divInt_eq_divInt_iff b0' <| ne_of_gt <| Int.natCast_pos.2 h.bot_lt).1 e)\n rw [Int.cast_mul, Int.cast_mul, Int.cast_natCast] at this\n rw [eq_comm, cast_def, div_eq_mul_inv, eq_div_iff_mul_eq d0, mul_assoc, (d.commute_cast _).eq,\n \u2190 mul_assoc, this, mul_assoc, mul_inv_cancel\u2080 b0, mul_one]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_mul_of_ne_zero (L83-L91)\nlemma cast_mul_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q * r) = (q * r : \u03b1) := by\nrw [mul_def, cast_divNat_of_ne_zero, cast_def, cast_def,\n (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_natCast (L117-L120)\ntheorem cast_natCast (n : \u2115) : ((n : \u211a) : \u03b1) = n := by\nrw [\u2190 Int.cast_natCast, cast_intCast, Int.cast_natCast]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_zpow (L66-L67)\nlemma cast_zpow (p : \u211a) (n : \u2124) : \u2191(p ^ n) = (p ^ n : \u03b1) := map_zpow\u2080 (castHom \u03b1) ..\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_div_of_ne_zero (L97-L111)\nlemma cast_div_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.num : \u03b1) \u2260 0) :\n \u2191(q / r) = (q / r : \u03b1) := by\nrw [div_def, cast_divNat_of_ne_zero, cast_def, cast_def, div_eq_mul_inv (_ / _),\n inv_div, (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n\nend NNRat\n\nnamespace Rat\n\nvariable [DivisionRing \u03b1] {p q : \u211a}\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.castHom (L53-L59)\ndef castHom : \u211a \u2192+* \u03b1 where\n toFun := (\u2191)\nmap_one' := cast_one\n map_mul' := cast_mul\n map_zero' := cast_zero\n map_add' := cast_add\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.commute_cast (L49-L50)\nlemma commute_cast (a : \u03b1) (q : \u211a\u22650) : Commute a q := (cast_commute ..).symm\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_prod (L37-L45)\ntheorem cast_list_prod (s : List \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_list_prod (Rat.castHom \u03b1) _\n\nend WithDivRing\n\nsection Field\n\nvariable [Field \u03b1] [CharZero \u03b1]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_ne_zero (L40-L41)\nlemma cast_ne_zero : (p : \u03b1) \u2260 0 \u2194 p \u2260 0 := cast_eq_zero.ne\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divNat (L115-L121)\nlemma cast_divNat (a b : \u2115) : (divNat a b : \u03b1) = a / b := by\nrw [\u2190 cast_natCast, \u2190 cast_natCast b, \u2190 cast_div]\n congr\n ext\n apply Rat.mkRat_eq_div\n\nend NNRat\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Rat.Cardinal.Cardinal (L25-L25)\ntheorem Cardinal.mkRat : #\u211a = \u2135\u2080 := mk_eq_aleph0 \u211a\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_inv_of_ne_zero (L93-L95)\nlemma cast_inv_of_ne_zero (hq : (q.num : \u03b1) \u2260 0) : (q\u207b\u00b9 : \u211a\u22650) = (q\u207b\u00b9 : \u03b1) := by\nrw [inv_def, cast_divNat_of_ne_zero _ hq, cast_def, inv_div]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_add_of_ne_zero (L73-L81)\nlemma cast_add_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q + r) = (q + r : \u03b1) := by\nrw [add_def, cast_divNat_of_ne_zero, cast_def, cast_def, mul_comm _ q.den,\n (Nat.commute_cast _ _).div_add_div (Nat.commute_cast _ _) hq hr]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_zero (L126-L128)\ntheorem cast_zero : ((0 : \u211a) : \u03b1) = 0 :=\n(cast_intCast _).trans Int.cast_zero\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_comm (L51-L52)\nlemma cast_comm (q : \u211a\u22650) (a : \u03b1) : q * a = a * q := cast_commute _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divInt (L69-L76)\ntheorem cast_divInt (a b : \u2124) : (a /. b : \u03b1) = a / b := by\nsimp only [divInt_eq_div, cast_div, cast_intCast]\n\nend Rat\n\nnamespace NNRat\nvariable [DivisionSemiring \u03b1] [CharZero \u03b1] {p q : \u211a\u22650}\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_sum (L33-L35)\ntheorem cast_sum (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u2211 i \u2208 s, f i = \u2211 i \u2208 s, (f i : \u03b1) :=\nmap_sum (Rat.castHom \u03b1) _ s\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_sum (L29-L31)\ntheorem cast_multiset_sum (s : Multiset \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_multiset_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_injective (L25-L36)\nlemma cast_injective : Injective ((\u2191) : \u211a \u2192 \u03b1)\n | \u27e8n\u2081, d\u2081, d\u20810, c\u2081\u27e9, \u27e8n\u2082, d\u2082, d\u20820, c\u2082\u27e9, h => by\n have d\u2081a : (d\u2081 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20810\nhave d\u2082a : (d\u2082 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20820\n rw [mk_eq_divInt, mk_eq_divInt] at h \u22a2\n rw [cast_divInt_of_ne_zero _ (by simpa), cast_divInt_of_ne_zero _ (by simpa)] at h\n norm_cast at h\n rwa [eq_div_iff_mul_eq d\u2082a, division_def, mul_assoc, (d\u2081.cast_commute (d\u2082 : \u03b1)).inv_left\u2080.eq,\n \u2190 mul_assoc, \u2190 division_def, eq_comm, eq_div_iff_mul_eq d\u2081a, eq_comm, \u2190 Int.cast_natCast d\u2081,\n \u2190 Int.cast_mul, \u2190 Int.cast_natCast d\u2082, \u2190 Int.cast_mul, Int.cast_inj, \u2190 mkRat_eq_iff d\u20810 d\u20820]\n at h\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Rat/Cast/Order.lean", "module": "Mathlib.Data.Rat.Cast.Order", "declaration": "Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioo", "span": "L115-L117", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Rat/Cast/Order.lean#L115"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4285, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 10282, "lean_code_chars": 8786, "natural_language_chars": 1496, "lean_code_ratio": 0.8545, "line_count": 360, "imports_count": 0, "declarations_count": 1011, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "1c941d02c43d845b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.LinearAlgebra.BilinearForm.Properties.restrict", "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.LinearAlgebra.BilinearForm.Properties)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem restrict {B : BilinForm R M} (b : B.IsSymm) (W : Submodule R M) :\n (B.restrict W).IsSymm\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.IsRefl (L59-L62)\ndef IsRefl (B : BilinForm R M) : Prop := LinearMap.IsRefl B\nnamespace IsRefl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.eq_zero (L63-L79)\ntheorem eq_zero (H : B.IsRefl) : \u2200 {x y : M}, B x y = 0 \u2192 B y x = 0 := fun {x y} => H x y\nprotected theorem neg {B : BilinForm R\u2081 M\u2081} (hB : B.IsRefl) : (-B).IsRefl := fun x y =>\n neg_eq_zero.mpr \u2218 hB x y \u2218 neg_eq_zero.mp\n\nprotected theorem smul {\u03b1 : Type*} [Semiring \u03b1] [IsDomain \u03b1] [Module \u03b1 R] [SMulCommClass R \u03b1 R]\n [IsTorsionFree \u03b1 R] (a : \u03b1) {B : BilinForm R M} (hB : B.IsRefl) :\n (a \u2022 B).IsRefl := fun _ _ h =>\n (smul_eq_zero.mp h).elim (fun ha => smul_eq_zero_of_left ha _) fun hBz =>\n smul_eq_zero_of_right _ (hB _ _ hBz)\n\nprotected theorem groupSMul {\u03b1} [Group \u03b1] [DistribMulAction \u03b1 R] [SMulCommClass R \u03b1 R] (a : \u03b1)\n {B : BilinForm R M} (hB : B.IsRefl) : (a \u2022 B).IsRefl := fun x y =>\n (smul_eq_zero_iff_eq _).mpr \u2218 hB x y \u2218 (smul_eq_zero_iff_eq _).mp\n\nend IsRefl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isRefl_zero (L81-L82)\ntheorem isRefl_zero : (0 : BilinForm R M).IsRefl := fun _ _ _ => rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isRefl_neg (L84-L90)\ntheorem isRefl_neg {B : BilinForm R\u2081 M\u2081} : (-B).IsRefl \u2194 B.IsRefl :=\n\u27e8fun h => neg_neg B \u25b8 h.neg, IsRefl.neg\u27e9\n\n/-- The proposition that a bilinear form is symmetric -/\nstructure IsSymm (B : BilinForm R M) : Prop where\n protected eq : \u2200 x y, B x y = B y x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_def (L91-L94)\ntheorem isSymm_def : IsSymm B \u2194 \u2200 x y, B x y = B y x where\n mp := fun \u27e8h\u27e9 \u21a6 h\nmpr h := \u27e8h\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_iff (L95-L99)\ntheorem isSymm_iff : IsSymm B \u2194 LinearMap.IsSymm B := by\nsimp [isSymm_def, LinearMap.isSymm_def]\n\nnamespace IsSymm\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isRefl (L100-L115)\ntheorem isRefl (H : B.IsSymm) : B.IsRefl := fun x y H1 => H.eq x y \u25b8 H1\nprotected theorem add {B\u2081 B\u2082 : BilinForm R M} (hB\u2081 : B\u2081.IsSymm) (hB\u2082 : B\u2082.IsSymm) :\n (B\u2081 + B\u2082).IsSymm := \u27e8fun x y => (congr_arg\u2082 (\u00b7 + \u00b7) (hB\u2081.eq x y) (hB\u2082.eq x y) :)\u27e9\n\nprotected theorem sub {B\u2081 B\u2082 : BilinForm R\u2081 M\u2081} (hB\u2081 : B\u2081.IsSymm) (hB\u2082 : B\u2082.IsSymm) :\n (B\u2081 - B\u2082).IsSymm := \u27e8fun x y => (congr_arg\u2082 Sub.sub (hB\u2081.eq x y) (hB\u2082.eq x y) :)\u27e9\n\nprotected theorem neg {B : BilinForm R\u2081 M\u2081} (hB : B.IsSymm) : (-B).IsSymm := \u27e8fun x y =>\n congr_arg Neg.neg (hB.eq x y)\u27e9\n\nprotected theorem smul {\u03b1} [Monoid \u03b1] [DistribMulAction \u03b1 R] [SMulCommClass R \u03b1 R] (a : \u03b1)\n {B : BilinForm R M} (hB : B.IsSymm) : (a \u2022 B).IsSymm := \u27e8fun x y =>\n congr_arg (a \u2022 \u00b7) (hB.eq x y)\u27e9\n\n/-- The restriction of a symmetric bilinear form on a submodule is also symmetric. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_zero (L122-L123)\ntheorem isSymm_zero : (0 : BilinForm R M).IsSymm := \u27e8fun _ _ => rfl\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_neg (L125-L127)\ntheorem isSymm_neg {B : BilinForm R\u2081 M\u2081} : (-B).IsSymm \u2194 B.IsSymm :=\n\u27e8fun h => neg_neg B \u25b8 h.neg, IsSymm.neg\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_iff_flip (L128-L137)\ntheorem isSymm_iff_flip : B.IsSymm \u2194 flipHom B = B where\n mp := fun \u27e8h\u27e9 \u21a6 by ext; simp [h]\nmpr h := \u27e8fun x y \u21a6 by rw [\u2190 flip_apply, h]\u27e9\n\nsection polarization\n\nvariable {R : Type*} [Field R] [NeZero (2 : R)] [Module R M] {B C : BilinForm R M}\n\n/-- Polarization identity: a symmetric bilinear form can be expressed through the values\nit takes on the diagonal. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.IsSymm (L138-L145)\nlemma IsSymm.polarization (x y : M) (hB : B.IsSymm) :\n B x y = (B (x + y) (x + y) - B x x - B y y) / 2 := by\nsimp only [map_add, LinearMap.add_apply]\n rw [hB.eq y x]\n ring_nf\n rw [mul_assoc, inv_mul_cancel\u2080 two_ne_zero, mul_one]\n\n/-- A symmetric bilinear form is characterized by the values it takes on the diagonal. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.ext_of_isSymm (L146-L152)\nlemma ext_of_isSymm (hB : IsSymm B) (hC : IsSymm C)\n (h : \u2200 x, B x x = C x x) : B = C := by\next x y\n rw [hB.polarization, hC.polarization]\n simp_rw [h]\n\n/-- A symmetric bilinear form is characterized by the values it takes on the diagonal. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.ext_iff_of_isSymm (L153-L159)\nlemma ext_iff_of_isSymm (hB : IsSymm B) (hC : IsSymm C) :\n B = C \u2194 \u2200 x, B x x = C x x where\n mp h := by simp [h]\nmpr := ext_of_isSymm hB hC\n\nend polarization\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_iff_basis (L160-L186)\nlemma isSymm_iff_basis {\u03b9 : Type*} (b : Basis \u03b9 R M) :\n IsSymm B \u2194 \u2200 i j, B (b i) (b j) = B (b j) (b i) where\n mp := fun \u27e8h\u27e9 i j \u21a6 h _ _\nmpr := by\n refine fun h \u21a6 \u27e8fun x y \u21a6 ?_\u27e9\n obtain \u27e8fx, tx, ix, -, hx\u27e9 := Submodule.mem_span_iff_exists_finset_subset.1\n (by simp : x \u2208 Submodule.span R (Set.range b))\n obtain \u27e8fy, ty, iy, -, hy\u27e9 := Submodule.mem_span_iff_exists_finset_subset.1\n (by simp : y \u2208 Submodule.span R (Set.range b))\n rw [\u2190 hx, \u2190 hy]\n simp only [map_sum, map_smul, coe_sum, Finset.sum_apply, smul_apply, smul_eq_mul,\n Finset.mul_sum]\n rw [Finset.sum_comm]\n refine Finset.sum_congr rfl (fun b\u2081 h\u2081 \u21a6 Finset.sum_congr rfl fun b\u2082 h\u2082 \u21a6 ?_)\n rw [mul_left_comm]\n obtain \u27e8i, rfl\u27e9 := ix h\u2081\n obtain \u27e8j, rfl\u27e9 := iy h\u2082\n rw [h]\n\n/-! ### Positive semidefinite bilinear forms -/\n\nsection PositiveSemidefinite\n\n/-- A bilinear form `B` is **nonnegative** if for any `x` we have `0 \u2264 B x x`. -/\nstructure IsNonneg [LE R] (B : BilinForm R M) where\n nonneg : \u2200 x, 0 \u2264 B x x\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isNonneg_def (L187-L190)\nlemma isNonneg_def [LE R] {B : BilinForm R M} : B.IsNonneg \u2194 \u2200 x, 0 \u2264 B x x :=\n\u27e8fun \u27e8h\u27e9 \u21a6 h, fun h \u21a6 \u27e8h\u27e9\u27e9\n\n/-- A bilinear form is nonnegative if and only if it is nonnegative as a sesquilinear form. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_left (L65-L66)\ntheorem add_left (x y z : M) : B (x + y) z = B x z + B y z := map_add\u2082 _ _ _ _\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_apply (L111-L113)\ntheorem add_apply (x y : M) : (B + D) x y = B x y + D x y :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.coeFnAddMonoidHom (L124-L131)\ndef coeFnAddMonoidHom : BilinForm R M \u2192+ M \u2192 M \u2192 R where\n toFun := fun B x y => B x y\nmap_zero' := rfl\n map_add' _ _ := rfl\n\nsection flip\n\n/-- The flip of a bilinear form, obtained by exchanging the left and right arguments. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_right (L75-L76)\ntheorem zero_right (x : M) : B x 0 = 0 := map_zero _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.lsmul_flip_apply (L158-L160)\ntheorem lsmul_flip_apply (m : M) : (lsmul R M).flip m = toSpanSingleton R M m := rfl\nend LinearMap\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.coe_injective (L94-L98)\ntheorem coe_injective : Function.Injective ((fun B x y => B x y) : BilinForm R M \u2192 M \u2192 M \u2192 R) :=\nfun B D h => by\n ext x y\n apply congrFun\u2082 h\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_left (L77-L78)\ntheorem neg_left (x y : M\u2081) : B\u2081 (-x) y = -B\u2081 x y := map_neg\u2082 _ _ _\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left_of_tower (L85-L87)\nlemma smul_left_of_tower (r : S) (x y : M) : B (r \u2022 x) y = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_left, Algebra.smul_def]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flip_apply (L135-L137)\ntheorem flip_apply (A : BilinForm R M) (x y : M) : flipHom A x y = A y x :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left (L67-L68)\ntheorem smul_left (a : R) (x y : M) : B (a \u2022 x) y = a * B x y := map_smul\u2082 _ _ _ _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_right (L69-L70)\ntheorem add_right (x y z : M) : B x (y + z) = B x y + B x z := map_add _ _ _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flipHom (L132-L133)\ndef flipHom : BilinForm R M \u2243\u2097[R] BilinForm R M := LinearMap.lflip\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_apply (L105-L109)\ntheorem zero_apply (x y : M) : (0 : BilinForm R M) x y = 0 :=\nrfl\n\nvariable (B D B\u2081 D\u2081)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_apply (L119-L122)\ntheorem sub_apply (x y : M\u2081) : (B\u2081 - D\u2081) x y = B\u2081 x y - D\u2081 x y :=\nrfl\n\n/-- `coeFn` as an `AddMonoidHom` -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_right (L79-L80)\ntheorem neg_right (x y : M\u2081) : B\u2081 x (-y) = -B\u2081 x y := map_neg _ _\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_left (L81-L82)\ntheorem sub_left (x y z : M\u2081) : B\u2081 (x - y) z = B\u2081 x z - B\u2081 y z := map_sub\u2082 _ _ _ _\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flip_flip (L138-L144)\ntheorem flip_flip :\n flipHom.trans flipHom = LinearEquiv.refl R (BilinForm R M) := by\next A\n simp\n\n/-- The `flip` of a bilinear form over a commutative ring, obtained by exchanging the left and\nright arguments. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_left (L73-L74)\ntheorem zero_left (x : M) : B 0 x = 0 := map_zero\u2082 _ _\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_apply (L115-L117)\ntheorem neg_apply (x y : M\u2081) : (-B\u2081) x y = -B\u2081 x y :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right (L71-L72)\ntheorem smul_right (a : R) (x y : M) : B x (a \u2022 y) = a * B x y := map_smul _ _ _\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.congr_fun (L102-L103)\ntheorem congr_fun (h : B = D) (x y : M) : B x y = D x y := congr_fun\u2082 h _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.ext (L100-L101)\ntheorem ext (H : \u2200 x y : M, B x y = D x y) : B = D := ext\u2082 H\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right_of_tower (L88-L93)\nlemma smul_right_of_tower (r : S) (x y : M) : B x (r \u2022 y) = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_right, Algebra.smul_def]\n\nvariable {D : BilinForm R M} {D\u2081 : BilinForm R\u2081 M\u2081}\n\n-- TODO: instantiate `FunLike`\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_right (L83-L84)\ntheorem sub_right (x y z : M\u2081) : B\u2081 x (y - z) = B\u2081 x y - B\u2081 x z := map_sub _ _ _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flip (L145-L150)\nabbrev flip (B : BilinForm R M) :=\nflipHom B\n\nend flip\n\n/-- The restriction of a bilinear form on a submodule. -/\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.LinearAlgebra.BilinearForm.Properties).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem restrict {B : BilinForm R M} (b : B.IsSymm) (W : Submodule R M) :\n (B.restrict W).IsSymm\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.IsRefl (L59-L62)\ndef IsRefl (B : BilinForm R M) : Prop := LinearMap.IsRefl B\nnamespace IsRefl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.eq_zero (L63-L79)\ntheorem eq_zero (H : B.IsRefl) : \u2200 {x y : M}, B x y = 0 \u2192 B y x = 0 := fun {x y} => H x y\nprotected theorem neg {B : BilinForm R\u2081 M\u2081} (hB : B.IsRefl) : (-B).IsRefl := fun x y =>\n neg_eq_zero.mpr \u2218 hB x y \u2218 neg_eq_zero.mp\n\nprotected theorem smul {\u03b1 : Type*} [Semiring \u03b1] [IsDomain \u03b1] [Module \u03b1 R] [SMulCommClass R \u03b1 R]\n [IsTorsionFree \u03b1 R] (a : \u03b1) {B : BilinForm R M} (hB : B.IsRefl) :\n (a \u2022 B).IsRefl := fun _ _ h =>\n (smul_eq_zero.mp h).elim (fun ha => smul_eq_zero_of_left ha _) fun hBz =>\n smul_eq_zero_of_right _ (hB _ _ hBz)\n\nprotected theorem groupSMul {\u03b1} [Group \u03b1] [DistribMulAction \u03b1 R] [SMulCommClass R \u03b1 R] (a : \u03b1)\n {B : BilinForm R M} (hB : B.IsRefl) : (a \u2022 B).IsRefl := fun x y =>\n (smul_eq_zero_iff_eq _).mpr \u2218 hB x y \u2218 (smul_eq_zero_iff_eq _).mp\n\nend IsRefl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isRefl_zero (L81-L82)\ntheorem isRefl_zero : (0 : BilinForm R M).IsRefl := fun _ _ _ => rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isRefl_neg (L84-L90)\ntheorem isRefl_neg {B : BilinForm R\u2081 M\u2081} : (-B).IsRefl \u2194 B.IsRefl :=\n\u27e8fun h => neg_neg B \u25b8 h.neg, IsRefl.neg\u27e9\n\n/-- The proposition that a bilinear form is symmetric -/\nstructure IsSymm (B : BilinForm R M) : Prop where\n protected eq : \u2200 x y, B x y = B y x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_def (L91-L94)\ntheorem isSymm_def : IsSymm B \u2194 \u2200 x y, B x y = B y x where\n mp := fun \u27e8h\u27e9 \u21a6 h\nmpr h := \u27e8h\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_iff (L95-L99)\ntheorem isSymm_iff : IsSymm B \u2194 LinearMap.IsSymm B := by\nsimp [isSymm_def, LinearMap.isSymm_def]\n\nnamespace IsSymm\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isRefl (L100-L115)\ntheorem isRefl (H : B.IsSymm) : B.IsRefl := fun x y H1 => H.eq x y \u25b8 H1\nprotected theorem add {B\u2081 B\u2082 : BilinForm R M} (hB\u2081 : B\u2081.IsSymm) (hB\u2082 : B\u2082.IsSymm) :\n (B\u2081 + B\u2082).IsSymm := \u27e8fun x y => (congr_arg\u2082 (\u00b7 + \u00b7) (hB\u2081.eq x y) (hB\u2082.eq x y) :)\u27e9\n\nprotected theorem sub {B\u2081 B\u2082 : BilinForm R\u2081 M\u2081} (hB\u2081 : B\u2081.IsSymm) (hB\u2082 : B\u2082.IsSymm) :\n (B\u2081 - B\u2082).IsSymm := \u27e8fun x y => (congr_arg\u2082 Sub.sub (hB\u2081.eq x y) (hB\u2082.eq x y) :)\u27e9\n\nprotected theorem neg {B : BilinForm R\u2081 M\u2081} (hB : B.IsSymm) : (-B).IsSymm := \u27e8fun x y =>\n congr_arg Neg.neg (hB.eq x y)\u27e9\n\nprotected theorem smul {\u03b1} [Monoid \u03b1] [DistribMulAction \u03b1 R] [SMulCommClass R \u03b1 R] (a : \u03b1)\n {B : BilinForm R M} (hB : B.IsSymm) : (a \u2022 B).IsSymm := \u27e8fun x y =>\n congr_arg (a \u2022 \u00b7) (hB.eq x y)\u27e9\n\n/-- The restriction of a symmetric bilinear form on a submodule is also symmetric. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_zero (L122-L123)\ntheorem isSymm_zero : (0 : BilinForm R M).IsSymm := \u27e8fun _ _ => rfl\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_neg (L125-L127)\ntheorem isSymm_neg {B : BilinForm R\u2081 M\u2081} : (-B).IsSymm \u2194 B.IsSymm :=\n\u27e8fun h => neg_neg B \u25b8 h.neg, IsSymm.neg\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_iff_flip (L128-L137)\ntheorem isSymm_iff_flip : B.IsSymm \u2194 flipHom B = B where\n mp := fun \u27e8h\u27e9 \u21a6 by ext; simp [h]\nmpr h := \u27e8fun x y \u21a6 by rw [\u2190 flip_apply, h]\u27e9\n\nsection polarization\n\nvariable {R : Type*} [Field R] [NeZero (2 : R)] [Module R M] {B C : BilinForm R M}\n\n/-- Polarization identity: a symmetric bilinear form can be expressed through the values\nit takes on the diagonal. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.IsSymm (L138-L145)\nlemma IsSymm.polarization (x y : M) (hB : B.IsSymm) :\n B x y = (B (x + y) (x + y) - B x x - B y y) / 2 := by\nsimp only [map_add, LinearMap.add_apply]\n rw [hB.eq y x]\n ring_nf\n rw [mul_assoc, inv_mul_cancel\u2080 two_ne_zero, mul_one]\n\n/-- A symmetric bilinear form is characterized by the values it takes on the diagonal. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.ext_of_isSymm (L146-L152)\nlemma ext_of_isSymm (hB : IsSymm B) (hC : IsSymm C)\n (h : \u2200 x, B x x = C x x) : B = C := by\next x y\n rw [hB.polarization, hC.polarization]\n simp_rw [h]\n\n/-- A symmetric bilinear form is characterized by the values it takes on the diagonal. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.ext_iff_of_isSymm (L153-L159)\nlemma ext_iff_of_isSymm (hB : IsSymm B) (hC : IsSymm C) :\n B = C \u2194 \u2200 x, B x x = C x x where\n mp h := by simp [h]\nmpr := ext_of_isSymm hB hC\n\nend polarization\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isSymm_iff_basis (L160-L186)\nlemma isSymm_iff_basis {\u03b9 : Type*} (b : Basis \u03b9 R M) :\n IsSymm B \u2194 \u2200 i j, B (b i) (b j) = B (b j) (b i) where\n mp := fun \u27e8h\u27e9 i j \u21a6 h _ _\nmpr := by\n refine fun h \u21a6 \u27e8fun x y \u21a6 ?_\u27e9\n obtain \u27e8fx, tx, ix, -, hx\u27e9 := Submodule.mem_span_iff_exists_finset_subset.1\n (by simp : x \u2208 Submodule.span R (Set.range b))\n obtain \u27e8fy, ty, iy, -, hy\u27e9 := Submodule.mem_span_iff_exists_finset_subset.1\n (by simp : y \u2208 Submodule.span R (Set.range b))\n rw [\u2190 hx, \u2190 hy]\n simp only [map_sum, map_smul, coe_sum, Finset.sum_apply, smul_apply, smul_eq_mul,\n Finset.mul_sum]\n rw [Finset.sum_comm]\n refine Finset.sum_congr rfl (fun b\u2081 h\u2081 \u21a6 Finset.sum_congr rfl fun b\u2082 h\u2082 \u21a6 ?_)\n rw [mul_left_comm]\n obtain \u27e8i, rfl\u27e9 := ix h\u2081\n obtain \u27e8j, rfl\u27e9 := iy h\u2082\n rw [h]\n\n/-! ### Positive semidefinite bilinear forms -/\n\nsection PositiveSemidefinite\n\n/-- A bilinear form `B` is **nonnegative** if for any `x` we have `0 \u2264 B x x`. -/\nstructure IsNonneg [LE R] (B : BilinForm R M) where\n nonneg : \u2200 x, 0 \u2264 B x x\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Properties.isNonneg_def (L187-L190)\nlemma isNonneg_def [LE R] {B : BilinForm R M} : B.IsNonneg \u2194 \u2200 x, 0 \u2264 B x x :=\n\u27e8fun \u27e8h\u27e9 \u21a6 h, fun h \u21a6 \u27e8h\u27e9\u27e9\n\n/-- A bilinear form is nonnegative if and only if it is nonnegative as a sesquilinear form. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_left (L65-L66)\ntheorem add_left (x y z : M) : B (x + y) z = B x z + B y z := map_add\u2082 _ _ _ _\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_apply (L111-L113)\ntheorem add_apply (x y : M) : (B + D) x y = B x y + D x y :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.coeFnAddMonoidHom (L124-L131)\ndef coeFnAddMonoidHom : BilinForm R M \u2192+ M \u2192 M \u2192 R where\n toFun := fun B x y => B x y\nmap_zero' := rfl\n map_add' _ _ := rfl\n\nsection flip\n\n/-- The flip of a bilinear form, obtained by exchanging the left and right arguments. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_right (L75-L76)\ntheorem zero_right (x : M) : B x 0 = 0 := map_zero _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.lsmul_flip_apply (L158-L160)\ntheorem lsmul_flip_apply (m : M) : (lsmul R M).flip m = toSpanSingleton R M m := rfl\nend LinearMap\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.coe_injective (L94-L98)\ntheorem coe_injective : Function.Injective ((fun B x y => B x y) : BilinForm R M \u2192 M \u2192 M \u2192 R) :=\nfun B D h => by\n ext x y\n apply congrFun\u2082 h\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_left (L77-L78)\ntheorem neg_left (x y : M\u2081) : B\u2081 (-x) y = -B\u2081 x y := map_neg\u2082 _ _ _\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left_of_tower (L85-L87)\nlemma smul_left_of_tower (r : S) (x y : M) : B (r \u2022 x) y = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_left, Algebra.smul_def]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flip_apply (L135-L137)\ntheorem flip_apply (A : BilinForm R M) (x y : M) : flipHom A x y = A y x :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left (L67-L68)\ntheorem smul_left (a : R) (x y : M) : B (a \u2022 x) y = a * B x y := map_smul\u2082 _ _ _ _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_right (L69-L70)\ntheorem add_right (x y z : M) : B x (y + z) = B x y + B x z := map_add _ _ _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flipHom (L132-L133)\ndef flipHom : BilinForm R M \u2243\u2097[R] BilinForm R M := LinearMap.lflip\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_apply (L105-L109)\ntheorem zero_apply (x y : M) : (0 : BilinForm R M) x y = 0 :=\nrfl\n\nvariable (B D B\u2081 D\u2081)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_apply (L119-L122)\ntheorem sub_apply (x y : M\u2081) : (B\u2081 - D\u2081) x y = B\u2081 x y - D\u2081 x y :=\nrfl\n\n/-- `coeFn` as an `AddMonoidHom` -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_right (L79-L80)\ntheorem neg_right (x y : M\u2081) : B\u2081 x (-y) = -B\u2081 x y := map_neg _ _\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_left (L81-L82)\ntheorem sub_left (x y z : M\u2081) : B\u2081 (x - y) z = B\u2081 x z - B\u2081 y z := map_sub\u2082 _ _ _ _\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flip_flip (L138-L144)\ntheorem flip_flip :\n flipHom.trans flipHom = LinearEquiv.refl R (BilinForm R M) := by\next A\n simp\n\n/-- The `flip` of a bilinear form over a commutative ring, obtained by exchanging the left and\nright arguments. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_left (L73-L74)\ntheorem zero_left (x : M) : B 0 x = 0 := map_zero\u2082 _ _\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_apply (L115-L117)\ntheorem neg_apply (x y : M\u2081) : (-B\u2081) x y = -B\u2081 x y :=\nrfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right (L71-L72)\ntheorem smul_right (a : R) (x y : M) : B x (a \u2022 y) = a * B x y := map_smul _ _ _\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.congr_fun (L102-L103)\ntheorem congr_fun (h : B = D) (x y : M) : B x y = D x y := congr_fun\u2082 h _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.ext (L100-L101)\ntheorem ext (H : \u2200 x y : M, B x y = D x y) : B = D := ext\u2082 H\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right_of_tower (L88-L93)\nlemma smul_right_of_tower (r : S) (x y : M) : B x (r \u2022 y) = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_right, Algebra.smul_def]\n\nvariable {D : BilinForm R M} {D\u2081 : BilinForm R\u2081 M\u2081}\n\n-- TODO: instantiate `FunLike`\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_right (L83-L84)\ntheorem sub_right (x y z : M\u2081) : B\u2081 x (y - z) = B\u2081 x y - B\u2081 x z := map_sub _ _ _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.flip (L145-L150)\nabbrev flip (B : BilinForm R M) :=\nflipHom B\n\nend flip\n\n/-- The restriction of a bilinear form on a submodule. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/BilinearForm/Properties.lean", "module": "Mathlib.LinearAlgebra.BilinearForm.Properties", "declaration": "Mathlib.LinearAlgebra.BilinearForm.Properties.restrict", "span": "L116-L120", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/BilinearForm/Properties.lean#L116"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4566, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 11571, "lean_code_chars": 10057, "natural_language_chars": 1514, "lean_code_ratio": 0.8692, "line_count": 380, "imports_count": 0, "declarations_count": 1459, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "d7a2ebd9f8362864", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.MeanInequalitiesPow.arith_mean_le_rpow_mean", "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.Analysis.MeanInequalitiesPow)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem arith_mean_le_rpow_mean (w z : \u03b9 \u2192 \u211d\u22650) (hw' : \u2211 i \u2208 s, w i = 1) {p : \u211d} (hp : 1 \u2264 p) :\n \u2211 i \u2208 s, w i * z i \u2264 (\u2211 i \u2208 s, w i * z i ^ p) ^ (1 / p)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.pow_arith_mean_le_arith_mean_pow (L58-L62)\ntheorem pow_arith_mean_le_arith_mean_pow (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) (hz : \u2200 i \u2208 s, 0 \u2264 z i) (n : \u2115) :\n (\u2211 i \u2208 s, w i * z i) ^ n \u2264 \u2211 i \u2208 s, w i * z i ^ n :=\n(convexOn_pow n).map_sum_le hw hw' hz\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.pow_arith_mean_le_arith_mean_pow_of_even (L63-L67)\ntheorem pow_arith_mean_le_arith_mean_pow_of_even (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) {n : \u2115} (hn : Even n) :\n (\u2211 i \u2208 s, w i * z i) ^ n \u2264 \u2211 i \u2208 s, w i * z i ^ n :=\nhn.convexOn_pow.map_sum_le hw hw' fun _ _ => Set.mem_univ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.zpow_arith_mean_le_arith_mean_zpow (L68-L72)\ntheorem zpow_arith_mean_le_arith_mean_zpow (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) (hz : \u2200 i \u2208 s, 0 < z i) (m : \u2124) :\n (\u2211 i \u2208 s, w i * z i) ^ m \u2264 \u2211 i \u2208 s, w i * z i ^ m :=\n(convexOn_zpow m).map_sum_le hw hw' hz\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_arith_mean_le_arith_mean_rpow (L73-L77)\ntheorem rpow_arith_mean_le_arith_mean_rpow (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) (hz : \u2200 i \u2208 s, 0 \u2264 z i) {p : \u211d} (hp : 1 \u2264 p) :\n (\u2211 i \u2208 s, w i * z i) ^ p \u2264 \u2211 i \u2208 s, w i * z i ^ p :=\n(convexOn_rpow hp).map_sum_le hw hw' hz\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.pow_arith_mean_le_arith_mean_pow (L95-L102)\ntheorem pow_arith_mean_le_arith_mean_pow (w z : \u03b9 \u2192 \u211d\u22650) (hw' : \u2211 i \u2208 s, w i = 1) (n : \u2115) :\n (\u2211 i \u2208 s, w i * z i) ^ n \u2264 \u2211 i \u2208 s, w i * z i ^ n :=\nmod_cast\n Real.pow_arith_mean_le_arith_mean_pow s _ _ (fun i _ => (w i).coe_nonneg)\n (mod_cast hw') (fun i _ => (z i).coe_nonneg) n\n\n/-- Weighted generalized mean inequality, version for sums over finite sets, with `\u211d\u22650`-valued\nfunctions and real exponents. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_arith_mean_le_arith_mean_rpow (L103-L109)\ntheorem rpow_arith_mean_le_arith_mean_rpow (w z : \u03b9 \u2192 \u211d\u22650) (hw' : \u2211 i \u2208 s, w i = 1) {p : \u211d}\n (hp : 1 \u2264 p) : (\u2211 i \u2208 s, w i * z i) ^ p \u2264 \u2211 i \u2208 s, w i * z i ^ p :=\nmod_cast\n Real.rpow_arith_mean_le_arith_mean_rpow s _ _ (fun i _ => (w i).coe_nonneg)\n (mod_cast hw') (fun i _ => (z i).coe_nonneg) hp\n\n/-- Weighted generalized mean inequality, version for two elements of `\u211d\u22650` and real exponents. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_arith_mean_le_arith_mean2_rpow (L110-L116)\ntheorem rpow_arith_mean_le_arith_mean2_rpow (w\u2081 w\u2082 z\u2081 z\u2082 : \u211d\u22650) (hw' : w\u2081 + w\u2082 = 1) {p : \u211d}\n (hp : 1 \u2264 p) : (w\u2081 * z\u2081 + w\u2082 * z\u2082) ^ p \u2264 w\u2081 * z\u2081 ^ p + w\u2082 * z\u2082 ^ p := by\nhave h := rpow_arith_mean_le_arith_mean_rpow univ ![w\u2081, w\u2082] ![z\u2081, z\u2082] ?_ hp\n \u00b7 simpa [Fin.sum_univ_succ] using h\n \u00b7 simp [hw', Fin.sum_univ_succ]\n\n/-- Unweighted mean inequality, version for two elements of `\u211d\u22650` and real exponents. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_le_mul_rpow_add_rpow (L117-L130)\ntheorem rpow_add_le_mul_rpow_add_rpow (z\u2081 z\u2082 : \u211d\u22650) {p : \u211d} (hp : 1 \u2264 p) :\n (z\u2081 + z\u2082) ^ p \u2264 (2 : \u211d\u22650) ^ (p - 1) * (z\u2081 ^ p + z\u2082 ^ p) := by\nrcases eq_or_lt_of_le hp with (rfl | h'p)\n \u00b7 simp only [rpow_one, sub_self, rpow_zero, one_mul]; rfl\n convert rpow_arith_mean_le_arith_mean2_rpow (1 / 2) (1 / 2) (2 * z\u2081) (2 * z\u2082) (add_halves 1) hp\n using 1\n \u00b7 simp only [one_div, inv_mul_cancel_left\u2080, Ne, two_ne_zero,\n not_false_iff]\n \u00b7 have A : p - 1 \u2260 0 := ne_of_gt (sub_pos.2 h'p)\n simp only [mul_rpow, rpow_sub' A, rpow_one]\n ring\n\n/-- Weighted generalized mean inequality, version for sums over finite sets, with `\u211d\u22650`-valued\nfunctions and real exponents. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.add_rpow_le_rpow_add (L144-L157)\ntheorem add_rpow_le_rpow_add {p : \u211d} (a b : \u211d\u22650) (hp1 : 1 \u2264 p) : a ^ p + b ^ p \u2264 (a + b) ^ p := by\nhave hp_pos : 0 < p := by positivity\n by_cases h_zero : a + b = 0\n \u00b7 simp [add_eq_zero.mp h_zero, hp_pos.ne']\n have h_nonzero : \u00ac(a = 0 \u2227 b = 0) := by rwa [add_eq_zero] at h_zero\n have h_add : a / (a + b) + b / (a + b) = 1 := by rw [\u2190 add_div, div_self h_zero]\n have h := add_rpow_le_one_of_add_le_one (a / (a + b)) (b / (a + b)) h_add.le hp1\n rw [div_rpow a (a + b), div_rpow b (a + b)] at h\n have hab_0 : (a + b) ^ p \u2260 0 := by simp [h_nonzero]\n have h_mul : (a + b) ^ p * (a ^ p / (a + b) ^ p + b ^ p / (a + b) ^ p) \u2264 (a + b) ^ p := by\n nth_rw 4 [\u2190 mul_one ((a + b) ^ p)]; gcongr\n rwa [div_eq_mul_inv, div_eq_mul_inv, mul_add, mul_comm (a ^ p), mul_comm (b ^ p), \u2190 mul_assoc, \u2190\n mul_assoc, mul_inv_cancel\u2080 hab_0, one_mul, one_mul] at h_mul\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le_add (L158-L164)\ntheorem rpow_add_rpow_le_add {p : \u211d} (a b : \u211d\u22650) (hp1 : 1 \u2264 p) :\n (a ^ p + b ^ p) ^ (1 / p) \u2264 a + b := by\nrw [one_div]\n rw [\u2190 @NNReal.le_rpow_inv_iff _ _ p\u207b\u00b9 (by simp [lt_of_lt_of_le zero_lt_one hp1])]\n rw [inv_inv]\n exact add_rpow_le_rpow_add _ _ hp1\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le (L165-L177)\ntheorem rpow_add_rpow_le {p q : \u211d} (a b : \u211d\u22650) (hp_pos : 0 < p) (hpq : p \u2264 q) :\n (a ^ q + b ^ q) ^ (1 / q) \u2264 (a ^ p + b ^ p) ^ (1 / p) := by\nhave h_rpow : \u2200 a : \u211d\u22650, a ^ q = (a ^ p) ^ (q / p) := fun a => by\n rw [\u2190 NNReal.rpow_mul, div_eq_inv_mul, \u2190 mul_assoc, mul_inv_cancel\u2080 hp_pos.ne.symm,\n one_mul]\n have h_rpow_add_rpow_le_add :\n ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) \u2264 a ^ p + b ^ p := by\n refine rpow_add_rpow_le_add (a ^ p) (b ^ p) ?_\n rwa [one_le_div hp_pos]\n rw [h_rpow a, h_rpow b, one_div p, NNReal.le_rpow_inv_iff hp_pos, \u2190 NNReal.rpow_mul, mul_comm,\n mul_one_div]\n rwa [one_div_div] at h_rpow_add_rpow_le_add\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_le_add_rpow (L178-L190)\ntheorem rpow_add_le_add_rpow {p : \u211d} (a b : \u211d\u22650) (hp : 0 \u2264 p) (hp1 : p \u2264 1) :\n (a + b) ^ p \u2264 a ^ p + b ^ p := by\nrcases hp.eq_or_lt with (rfl | hp_pos)\n \u00b7 simp\n have h := rpow_add_rpow_le a b hp_pos hp1\n rw [one_div_one, one_div] at h\n repeat' rw [NNReal.rpow_one] at h\n exact (NNReal.le_rpow_inv_iff hp_pos).mp h\n\nend NNReal\n\nnamespace Real\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.add_rpow_le_rpow_add (L191-L196)\nlemma add_rpow_le_rpow_add {p : \u211d} {a b : \u211d} (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hp1 : 1 \u2264 p) :\n a ^ p + b ^ p \u2264 (a + b) ^ p := by\nlift a to NNReal using ha\n lift b to NNReal using hb\n exact_mod_cast NNReal.add_rpow_le_rpow_add a b hp1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le_add (L197-L202)\nlemma rpow_add_rpow_le_add {p : \u211d} {a b : \u211d} (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hp1 : 1 \u2264 p) :\n (a ^ p + b ^ p) ^ (1 / p) \u2264 a + b := by\nlift a to NNReal using ha\n lift b to NNReal using hb\n exact_mod_cast NNReal.rpow_add_rpow_le_add a b hp1\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le (L203-L209)\nlemma rpow_add_rpow_le {p q : \u211d} {a b : \u211d} (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hp_pos : 0 < p)\n (hpq : p \u2264 q) :\n (a ^ q + b ^ q) ^ (1 / q) \u2264 (a ^ p + b ^ p) ^ (1 / p) := by\nlift a to NNReal using ha\n lift b to NNReal using hb\n exact_mod_cast NNReal.rpow_add_rpow_le a b hp_pos hpq\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.Analysis.MeanInequalitiesPow).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem arith_mean_le_rpow_mean (w z : \u03b9 \u2192 \u211d\u22650) (hw' : \u2211 i \u2208 s, w i = 1) {p : \u211d} (hp : 1 \u2264 p) :\n \u2211 i \u2208 s, w i * z i \u2264 (\u2211 i \u2208 s, w i * z i ^ p) ^ (1 / p)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.pow_arith_mean_le_arith_mean_pow (L58-L62)\ntheorem pow_arith_mean_le_arith_mean_pow (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) (hz : \u2200 i \u2208 s, 0 \u2264 z i) (n : \u2115) :\n (\u2211 i \u2208 s, w i * z i) ^ n \u2264 \u2211 i \u2208 s, w i * z i ^ n :=\n(convexOn_pow n).map_sum_le hw hw' hz\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.pow_arith_mean_le_arith_mean_pow_of_even (L63-L67)\ntheorem pow_arith_mean_le_arith_mean_pow_of_even (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) {n : \u2115} (hn : Even n) :\n (\u2211 i \u2208 s, w i * z i) ^ n \u2264 \u2211 i \u2208 s, w i * z i ^ n :=\nhn.convexOn_pow.map_sum_le hw hw' fun _ _ => Set.mem_univ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.zpow_arith_mean_le_arith_mean_zpow (L68-L72)\ntheorem zpow_arith_mean_le_arith_mean_zpow (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) (hz : \u2200 i \u2208 s, 0 < z i) (m : \u2124) :\n (\u2211 i \u2208 s, w i * z i) ^ m \u2264 \u2211 i \u2208 s, w i * z i ^ m :=\n(convexOn_zpow m).map_sum_le hw hw' hz\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_arith_mean_le_arith_mean_rpow (L73-L77)\ntheorem rpow_arith_mean_le_arith_mean_rpow (w z : \u03b9 \u2192 \u211d) (hw : \u2200 i \u2208 s, 0 \u2264 w i)\n (hw' : \u2211 i \u2208 s, w i = 1) (hz : \u2200 i \u2208 s, 0 \u2264 z i) {p : \u211d} (hp : 1 \u2264 p) :\n (\u2211 i \u2208 s, w i * z i) ^ p \u2264 \u2211 i \u2208 s, w i * z i ^ p :=\n(convexOn_rpow hp).map_sum_le hw hw' hz\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.pow_arith_mean_le_arith_mean_pow (L95-L102)\ntheorem pow_arith_mean_le_arith_mean_pow (w z : \u03b9 \u2192 \u211d\u22650) (hw' : \u2211 i \u2208 s, w i = 1) (n : \u2115) :\n (\u2211 i \u2208 s, w i * z i) ^ n \u2264 \u2211 i \u2208 s, w i * z i ^ n :=\nmod_cast\n Real.pow_arith_mean_le_arith_mean_pow s _ _ (fun i _ => (w i).coe_nonneg)\n (mod_cast hw') (fun i _ => (z i).coe_nonneg) n\n\n/-- Weighted generalized mean inequality, version for sums over finite sets, with `\u211d\u22650`-valued\nfunctions and real exponents. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_arith_mean_le_arith_mean_rpow (L103-L109)\ntheorem rpow_arith_mean_le_arith_mean_rpow (w z : \u03b9 \u2192 \u211d\u22650) (hw' : \u2211 i \u2208 s, w i = 1) {p : \u211d}\n (hp : 1 \u2264 p) : (\u2211 i \u2208 s, w i * z i) ^ p \u2264 \u2211 i \u2208 s, w i * z i ^ p :=\nmod_cast\n Real.rpow_arith_mean_le_arith_mean_rpow s _ _ (fun i _ => (w i).coe_nonneg)\n (mod_cast hw') (fun i _ => (z i).coe_nonneg) hp\n\n/-- Weighted generalized mean inequality, version for two elements of `\u211d\u22650` and real exponents. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_arith_mean_le_arith_mean2_rpow (L110-L116)\ntheorem rpow_arith_mean_le_arith_mean2_rpow (w\u2081 w\u2082 z\u2081 z\u2082 : \u211d\u22650) (hw' : w\u2081 + w\u2082 = 1) {p : \u211d}\n (hp : 1 \u2264 p) : (w\u2081 * z\u2081 + w\u2082 * z\u2082) ^ p \u2264 w\u2081 * z\u2081 ^ p + w\u2082 * z\u2082 ^ p := by\nhave h := rpow_arith_mean_le_arith_mean_rpow univ ![w\u2081, w\u2082] ![z\u2081, z\u2082] ?_ hp\n \u00b7 simpa [Fin.sum_univ_succ] using h\n \u00b7 simp [hw', Fin.sum_univ_succ]\n\n/-- Unweighted mean inequality, version for two elements of `\u211d\u22650` and real exponents. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_le_mul_rpow_add_rpow (L117-L130)\ntheorem rpow_add_le_mul_rpow_add_rpow (z\u2081 z\u2082 : \u211d\u22650) {p : \u211d} (hp : 1 \u2264 p) :\n (z\u2081 + z\u2082) ^ p \u2264 (2 : \u211d\u22650) ^ (p - 1) * (z\u2081 ^ p + z\u2082 ^ p) := by\nrcases eq_or_lt_of_le hp with (rfl | h'p)\n \u00b7 simp only [rpow_one, sub_self, rpow_zero, one_mul]; rfl\n convert rpow_arith_mean_le_arith_mean2_rpow (1 / 2) (1 / 2) (2 * z\u2081) (2 * z\u2082) (add_halves 1) hp\n using 1\n \u00b7 simp only [one_div, inv_mul_cancel_left\u2080, Ne, two_ne_zero,\n not_false_iff]\n \u00b7 have A : p - 1 \u2260 0 := ne_of_gt (sub_pos.2 h'p)\n simp only [mul_rpow, rpow_sub' A, rpow_one]\n ring\n\n/-- Weighted generalized mean inequality, version for sums over finite sets, with `\u211d\u22650`-valued\nfunctions and real exponents. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.add_rpow_le_rpow_add (L144-L157)\ntheorem add_rpow_le_rpow_add {p : \u211d} (a b : \u211d\u22650) (hp1 : 1 \u2264 p) : a ^ p + b ^ p \u2264 (a + b) ^ p := by\nhave hp_pos : 0 < p := by positivity\n by_cases h_zero : a + b = 0\n \u00b7 simp [add_eq_zero.mp h_zero, hp_pos.ne']\n have h_nonzero : \u00ac(a = 0 \u2227 b = 0) := by rwa [add_eq_zero] at h_zero\n have h_add : a / (a + b) + b / (a + b) = 1 := by rw [\u2190 add_div, div_self h_zero]\n have h := add_rpow_le_one_of_add_le_one (a / (a + b)) (b / (a + b)) h_add.le hp1\n rw [div_rpow a (a + b), div_rpow b (a + b)] at h\n have hab_0 : (a + b) ^ p \u2260 0 := by simp [h_nonzero]\n have h_mul : (a + b) ^ p * (a ^ p / (a + b) ^ p + b ^ p / (a + b) ^ p) \u2264 (a + b) ^ p := by\n nth_rw 4 [\u2190 mul_one ((a + b) ^ p)]; gcongr\n rwa [div_eq_mul_inv, div_eq_mul_inv, mul_add, mul_comm (a ^ p), mul_comm (b ^ p), \u2190 mul_assoc, \u2190\n mul_assoc, mul_inv_cancel\u2080 hab_0, one_mul, one_mul] at h_mul\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le_add (L158-L164)\ntheorem rpow_add_rpow_le_add {p : \u211d} (a b : \u211d\u22650) (hp1 : 1 \u2264 p) :\n (a ^ p + b ^ p) ^ (1 / p) \u2264 a + b := by\nrw [one_div]\n rw [\u2190 @NNReal.le_rpow_inv_iff _ _ p\u207b\u00b9 (by simp [lt_of_lt_of_le zero_lt_one hp1])]\n rw [inv_inv]\n exact add_rpow_le_rpow_add _ _ hp1\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le (L165-L177)\ntheorem rpow_add_rpow_le {p q : \u211d} (a b : \u211d\u22650) (hp_pos : 0 < p) (hpq : p \u2264 q) :\n (a ^ q + b ^ q) ^ (1 / q) \u2264 (a ^ p + b ^ p) ^ (1 / p) := by\nhave h_rpow : \u2200 a : \u211d\u22650, a ^ q = (a ^ p) ^ (q / p) := fun a => by\n rw [\u2190 NNReal.rpow_mul, div_eq_inv_mul, \u2190 mul_assoc, mul_inv_cancel\u2080 hp_pos.ne.symm,\n one_mul]\n have h_rpow_add_rpow_le_add :\n ((a ^ p) ^ (q / p) + (b ^ p) ^ (q / p)) ^ (1 / (q / p)) \u2264 a ^ p + b ^ p := by\n refine rpow_add_rpow_le_add (a ^ p) (b ^ p) ?_\n rwa [one_le_div hp_pos]\n rw [h_rpow a, h_rpow b, one_div p, NNReal.le_rpow_inv_iff hp_pos, \u2190 NNReal.rpow_mul, mul_comm,\n mul_one_div]\n rwa [one_div_div] at h_rpow_add_rpow_le_add\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_le_add_rpow (L178-L190)\ntheorem rpow_add_le_add_rpow {p : \u211d} (a b : \u211d\u22650) (hp : 0 \u2264 p) (hp1 : p \u2264 1) :\n (a + b) ^ p \u2264 a ^ p + b ^ p := by\nrcases hp.eq_or_lt with (rfl | hp_pos)\n \u00b7 simp\n have h := rpow_add_rpow_le a b hp_pos hp1\n rw [one_div_one, one_div] at h\n repeat' rw [NNReal.rpow_one] at h\n exact (NNReal.le_rpow_inv_iff hp_pos).mp h\n\nend NNReal\n\nnamespace Real\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.add_rpow_le_rpow_add (L191-L196)\nlemma add_rpow_le_rpow_add {p : \u211d} {a b : \u211d} (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hp1 : 1 \u2264 p) :\n a ^ p + b ^ p \u2264 (a + b) ^ p := by\nlift a to NNReal using ha\n lift b to NNReal using hb\n exact_mod_cast NNReal.add_rpow_le_rpow_add a b hp1\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le_add (L197-L202)\nlemma rpow_add_rpow_le_add {p : \u211d} {a b : \u211d} (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hp1 : 1 \u2264 p) :\n (a ^ p + b ^ p) ^ (1 / p) \u2264 a + b := by\nlift a to NNReal using ha\n lift b to NNReal using hb\n exact_mod_cast NNReal.rpow_add_rpow_le_add a b hp1\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.MeanInequalitiesPow.rpow_add_rpow_le (L203-L209)\nlemma rpow_add_rpow_le {p q : \u211d} {a b : \u211d} (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hp_pos : 0 < p)\n (hpq : p \u2264 q) :\n (a ^ q + b ^ q) ^ (1 / q) \u2264 (a ^ p + b ^ p) ^ (1 / p) := by\nlift a to NNReal using ha\n lift b to NNReal using hb\n exact_mod_cast NNReal.rpow_add_rpow_le a b hp_pos hpq\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/MeanInequalitiesPow.lean", "module": "Mathlib.Analysis.MeanInequalitiesPow", "declaration": "Mathlib.Analysis.MeanInequalitiesPow.arith_mean_le_rpow_mean", "span": "L131-L143", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/MeanInequalitiesPow.lean#L131"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3490, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 7949, "lean_code_chars": 7119, "natural_language_chars": 830, "lean_code_ratio": 0.8956, "line_count": 194, "imports_count": 0, "declarations_count": 958, "diagnostics_count": 0, "retrieval_snippets_count": 15, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "63504c55178919c1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.CompleteLattice.Lemmas.iSup_bool_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.Order.CompleteLattice.Lemmas)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem iSup_bool_eq {f : Bool \u2192 \u03b1} : \u2a06 b : Bool, f b = f true \u2294 f false\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_bool_eq (L56-L58)\ntheorem iInf_bool_eq {f : Bool \u2192 \u03b1} : \u2a05 b : Bool, f b = f true \u2293 f false :=\n@iSup_bool_eq \u03b1\u1d52\u1d48 _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.sup_eq_iSup (L59-L61)\ntheorem sup_eq_iSup (x y : \u03b1) : x \u2294 y = \u2a06 b : Bool, cond b x y := by\nrw [iSup_bool_eq, Bool.cond_true, Bool.cond_false]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.inf_eq_iInf (L62-L69)\ntheorem inf_eq_iInf (x y : \u03b1) : x \u2293 y = \u2a05 b : Bool, cond b x y :=\n@sup_eq_iSup \u03b1\u1d52\u1d48 _ _ _\n\n/-!\n### `iSup` and `iInf` under `\u2115`\n-/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_ge_eq_iSup_nat_add (L70-L76)\ntheorem iSup_ge_eq_iSup_nat_add (u : \u2115 \u2192 \u03b1) (n : \u2115) : \u2a06 i \u2265 n, u i = \u2a06 i, u (i + n) := by\napply le_antisymm <;> simp only [iSup_le_iff]\n \u00b7 refine fun i hi => le_sSup \u27e8i - n, ?_\u27e9\n dsimp only\n rw [Nat.sub_add_cancel hi]\n \u00b7 exact fun i => le_sSup \u27e8i + n, iSup_pos (Nat.le_add_left _ _)\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_ge_eq_iInf_nat_add (L77-L79)\ntheorem iInf_ge_eq_iInf_nat_add (u : \u2115 \u2192 \u03b1) (n : \u2115) : \u2a05 i \u2265 n, u i = \u2a05 i, u (i + n) :=\n@iSup_ge_eq_iSup_nat_add \u03b1\u1d52\u1d48 _ _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.Monotone (L80-L82)\ntheorem Monotone.iSup_nat_add {f : \u2115 \u2192 \u03b1} (hf : Monotone f) (k : \u2115) : \u2a06 n, f (n + k) = \u2a06 n, f n :=\nle_antisymm (iSup_le fun i => le_iSup _ (i + k)) <| iSup_mono fun i => hf <| Nat.le_add_right i k\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.Antitone (L83-L88)\ntheorem Antitone.iInf_nat_add {f : \u2115 \u2192 \u03b1} (hf : Antitone f) (k : \u2115) : \u2a05 n, f (n + k) = \u2a05 n, f n :=\nhf.dual_right.iSup_nat_add k\n\n-- Not `@[simp]` since the subterm `?f (i + ?k)` produces an ugly higher-order unification problem.\n-- (Although the `simpNF` linter does not complain.)\n-- See: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/complete_lattice.20and.20has_sup/near/316497982\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_iInf_ge_nat_add (L89-L97)\ntheorem iSup_iInf_ge_nat_add (f : \u2115 \u2192 \u03b1) (k : \u2115) :\n \u2a06 n, \u2a05 i \u2265 n, f (i + k) = \u2a06 n, \u2a05 i \u2265 n, f i := by\nhave hf : Monotone fun n => \u2a05 i \u2265 n, f i := fun n m h => biInf_mono fun i => h.trans\n rw [\u2190 Monotone.iSup_nat_add hf k]\n \u00b7 simp_rw [iInf_ge_eq_iInf_nat_add, \u2190 Nat.add_assoc]\n\n-- Not `@[simp]` since the subterm `?f (i + ?k)` produces an ugly higher-order unification problem.\n-- (Although the `simpNF` linter does not complain.)\n-- See: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/complete_lattice.20and.20has_sup/near/316497982\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_iSup_ge_nat_add (L98-L101)\ntheorem iInf_iSup_ge_nat_add :\n \u2200 (f : \u2115 \u2192 \u03b1) (k : \u2115), \u2a05 n, \u2a06 i \u2265 n, f (i + k) = \u2a05 n, \u2a06 i \u2265 n, f i :=\n@iSup_iInf_ge_nat_add \u03b1\u1d52\u1d48 _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.sup_iSup_nat_succ (L102-L107)\ntheorem sup_iSup_nat_succ (u : \u2115 \u2192 \u03b1) : (u 0 \u2294 \u2a06 i, u (i + 1)) = \u2a06 i, u i :=\ncalc\n (u 0 \u2294 \u2a06 i, u (i + 1)) = \u2a06 x \u2208 {0} \u222a range Nat.succ, u x := by\n { rw [iSup_union, iSup_singleton, iSup_range] }\n _ = \u2a06 i, u i := by rw [Nat.zero_union_range_succ, iSup_univ]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.inf_iInf_nat_succ (L108-L110)\ntheorem inf_iInf_nat_succ (u : \u2115 \u2192 \u03b1) : (u 0 \u2293 \u2a05 i, u (i + 1)) = \u2a05 i, u i :=\n@sup_iSup_nat_succ \u03b1\u1d52\u1d48 _ u\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_nat_gt_zero_eq (L111-L114)\ntheorem iInf_nat_gt_zero_eq (f : \u2115 \u2192 \u03b1) : \u2a05 i > 0, f i = \u2a05 i, f (i + 1) := by\nrw [\u2190 iInf_range, Nat.range_succ]\n simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_nat_gt_zero_eq (L115-L117)\ntheorem iSup_nat_gt_zero_eq (f : \u2115 \u2192 \u03b1) : \u2a06 i > 0, f i = \u2a06 i, f (i + 1) :=\n@iInf_nat_gt_zero_eq \u03b1\u1d52\u1d48 _ f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.sup_sInf_le_iInf_sup (L129-L132)\ntheorem sup_sInf_le_iInf_sup : a \u2294 sInf s \u2264 \u2a05 b \u2208 s, a \u2294 b :=\nle_iInf\u2082 fun _ h => sup_le_sup_left (sInf_le h) _\n\n/-- This is a weaker version of `inf_sSup_eq` -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_inf_le_inf_sSup (L133-L136)\ntheorem iSup_inf_le_inf_sSup : \u2a06 b \u2208 s, a \u2293 b \u2264 a \u2293 sSup s :=\n@sup_sInf_le_iInf_sup \u03b1\u1d52\u1d48 _ _ _\n\n/-- This is a weaker version of `sInf_sup_eq` -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.biSup_congr (L161-L164)\ntheorem biSup_congr {p : \u03b9 \u2192 Prop} (h : \u2200 i, p i \u2192 f i = g i) :\n \u2a06 (i) (_ : p i), f i = \u2a06 (i) (_ : p i), g i :=\niSup_congr fun i \u21a6 iSup_congr (h i)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.iSup_congr (L157-L159)\ntheorem iSup_congr (h : \u2200 i, f i = g i) : \u2a06 i, f i = \u2a06 i, g i :=\ncongr_arg _ <| funext h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_le_sSup_of_subset_insert_bot (L97-L99)\ntheorem sSup_le_sSup_of_subset_insert_bot (h : s \u2286 insert \u22a5 t) : sSup s \u2264 sSup t :=\n(sSup_le_sSup h).trans_eq (sSup_insert.trans (bot_sup_eq _))\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.eq_singleton_bot_of_sSup_eq_bot_of_nonempty (L119-L128)\ntheorem eq_singleton_bot_of_sSup_eq_bot_of_nonempty {s : Set \u03b1} (h_sup : sSup s = \u22a5)\n (hne : s.Nonempty) : s = {\u22a5} := by\nrw [Set.eq_singleton_iff_nonempty_unique_mem]\n rw [sSup_eq_bot] at h_sup\n exact \u27e8hne, h_sup\u27e9\n\n/-- Introduction rule to prove that `b` is the supremum of `s`: it suffices to check that `b`\nis larger than all elements of `s`, and that this is not the case of any `w < b`.\nSee `csSup_eq_of_forall_le_of_forall_lt_exists_gt` for a version in conditionally complete\nlattices. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.Function (L172-L177)\ntheorem Function.Surjective.iSup_comp {f : \u03b9 \u2192 \u03b9'} (hf : Surjective f) (g : \u03b9' \u2192 \u03b1) :\n \u2a06 x, g (f x) = \u2a06 y, g y := by\nsimp only [iSup.eq_1]\n congr\n exact hf.range_comp g\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_insert (L93-L95)\ntheorem sSup_insert {a : \u03b1} {s : Set \u03b1} : sSup (insert a s) = a \u2294 sSup s :=\n((isLUB_sSup s).insert a).sSup_eq\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_diff_singleton_bot (L101-L104)\ntheorem sSup_diff_singleton_bot (s : Set \u03b1) : sSup (s \\ {\u22a5}) = sSup s :=\n(sSup_le_sSup diff_subset).antisymm <|\n sSup_le_sSup_of_subset_insert_bot <| subset_insert_diff_singleton _ _\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_of_forall_le_of_forall_lt_exists_gt (L134-L139)\ntheorem sSup_eq_of_forall_le_of_forall_lt_exists_gt (h\u2081 : \u2200 a \u2208 s, a \u2264 b)\n (h\u2082 : \u2200 w, w < b \u2192 \u2203 a \u2208 s, w < a) : sSup s = b :=\n(sSup_le h\u2081).eq_of_not_lt fun h =>\n let \u27e8_, ha, ha'\u27e9 := h\u2082 _ h\n ((le_sSup ha).trans_lt ha').false\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_univ (L88-L91)\ntheorem sSup_univ : sSup univ = (\u22a4 : \u03b1) :=\n(@isLUB_univ \u03b1 _ _).sSup_eq\n\n-- TODO(Jeremy): get this automatically\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_le_sSup_of_isCofinalFor (L53-L56)\ntheorem sSup_le_sSup_of_isCofinalFor (h : IsCofinalFor s t) : sSup s \u2264 sSup t :=\nIsLeast.mono (isLUB_sSup t) (isLUB_sSup s) <| upperBounds_mono_of_isCofinalFor h\n\n-- We will generalize this to conditionally complete lattices in `csSup_singleton`.\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_empty (L84-L86)\ntheorem sSup_empty : sSup \u2205 = (\u22a5 : \u03b1) :=\n(@isLUB_empty \u03b1 _ _).sSup_eq\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_iSup' (L154-L155)\ntheorem sSup_eq_iSup' (s : Set \u03b1) : sSup s = \u2a06 a : s, (a : \u03b1) := by rw [iSup, Subtype.range_coe]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_range (L150-L152)\ntheorem sSup_range : sSup (range f) = iSup f :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sInf_le_sSup_of_nonempty_inter (L72-L74)\ntheorem sInf_le_sSup_of_nonempty_inter (h : (s \u2229 t).Nonempty) : sInf s \u2264 sSup t :=\nisGLB_le_isLUB_of_nonempty_inter h (isGLB_sInf s) (isLUB_sSup t)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.iSup_congr_Prop (L194-L199)\ntheorem iSup_congr_Prop {p q : Prop} {f\u2081 : p \u2192 \u03b1} {f\u2082 : q \u2192 \u03b1} (pq : p \u2194 q)\n (f : \u2200 x, f\u2081 (pq.mpr x) = f\u2082 x) : iSup f\u2081 = iSup f\u2082 := by\nobtain rfl := propext pq\n congr with x\n apply f\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_bot' (L115-L117)\nlemma sSup_eq_bot' {s : Set \u03b1} : sSup s = \u22a5 \u2194 s = \u2205 \u2228 s = {\u22a5} := by\nrw [sSup_eq_bot, \u2190 subset_singleton_iff_eq, subset_singleton_iff]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sInf_le_sSup (L69-L71)\ntheorem sInf_le_sSup (hs : s.Nonempty) : sInf s \u2264 sSup s :=\nisGLB_le_isLUB (isGLB_sInf s) (isLUB_sSup s) hs\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.iSup_plift_up (L201-L203)\ntheorem iSup_plift_up (f : PLift \u03b9 \u2192 \u03b1) : \u2a06 i, f (PLift.up i) = \u2a06 i, f i :=\n(PLift.up_surjective.iSup_congr _) fun _ => rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.Equiv (L179-L181)\ntheorem Equiv.iSup_comp {g : \u03b9' \u2192 \u03b1} (e : \u03b9 \u2243 \u03b9') : \u2a06 x, g (e x) = \u2a06 y, g y :=\ne.surjective.iSup_comp _\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.biSup_congr' (L166-L170)\ntheorem biSup_congr' {p : \u03b9 \u2192 Prop} {f g : (i : \u03b9) \u2192 p i \u2192 \u03b1}\n (h : \u2200 i (hi : p i), f i hi = g i hi) :\n \u2a06 i, \u2a06 (hi : p i), f i hi = \u2a06 i, \u2a06 (hi : p i), g i hi := by\ngrind\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_bot (L110-L113)\ntheorem sSup_eq_bot : sSup s = \u22a5 \u2194 \u2200 a \u2208 s, a = \u22a5 :=\n\u27e8fun h _ ha => bot_unique <| h \u25b8 le_sSup ha, fun h =>\n bot_unique <| sSup_le fun a ha => le_bot_iff.2 <| h a ha\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_inter_le (L80-L82)\ntheorem sSup_inter_le {s t : Set \u03b1} : sSup (s \u2229 t) \u2264 sSup s \u2293 sSup t :=\nsSup_le fun _ hb => le_inf (le_sSup hb.1) (le_sSup hb.2)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_union (L76-L78)\ntheorem sSup_union {s t : Set \u03b1} : sSup (s \u222a t) = sSup s \u2294 sSup t :=\n((isLUB_sSup s).union (isLUB_sSup t)).sSup_eq\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_singleton (L58-L60)\ntheorem sSup_singleton {a : \u03b1} : sSup {a} = a :=\nisLUB_singleton.sSup_eq\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_pair (L106-L108)\ntheorem sSup_pair {a b : \u03b1} : sSup {a, b} = a \u2294 b :=\n(@isLUB_pair \u03b1 _ a b).sSup_eq\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.Order.CompleteLattice.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem iSup_bool_eq {f : Bool \u2192 \u03b1} : \u2a06 b : Bool, f b = f true \u2294 f false\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_bool_eq (L56-L58)\ntheorem iInf_bool_eq {f : Bool \u2192 \u03b1} : \u2a05 b : Bool, f b = f true \u2293 f false :=\n@iSup_bool_eq \u03b1\u1d52\u1d48 _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.sup_eq_iSup (L59-L61)\ntheorem sup_eq_iSup (x y : \u03b1) : x \u2294 y = \u2a06 b : Bool, cond b x y := by\nrw [iSup_bool_eq, Bool.cond_true, Bool.cond_false]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.inf_eq_iInf (L62-L69)\ntheorem inf_eq_iInf (x y : \u03b1) : x \u2293 y = \u2a05 b : Bool, cond b x y :=\n@sup_eq_iSup \u03b1\u1d52\u1d48 _ _ _\n\n/-!\n### `iSup` and `iInf` under `\u2115`\n-/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_ge_eq_iSup_nat_add (L70-L76)\ntheorem iSup_ge_eq_iSup_nat_add (u : \u2115 \u2192 \u03b1) (n : \u2115) : \u2a06 i \u2265 n, u i = \u2a06 i, u (i + n) := by\napply le_antisymm <;> simp only [iSup_le_iff]\n \u00b7 refine fun i hi => le_sSup \u27e8i - n, ?_\u27e9\n dsimp only\n rw [Nat.sub_add_cancel hi]\n \u00b7 exact fun i => le_sSup \u27e8i + n, iSup_pos (Nat.le_add_left _ _)\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_ge_eq_iInf_nat_add (L77-L79)\ntheorem iInf_ge_eq_iInf_nat_add (u : \u2115 \u2192 \u03b1) (n : \u2115) : \u2a05 i \u2265 n, u i = \u2a05 i, u (i + n) :=\n@iSup_ge_eq_iSup_nat_add \u03b1\u1d52\u1d48 _ _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.Monotone (L80-L82)\ntheorem Monotone.iSup_nat_add {f : \u2115 \u2192 \u03b1} (hf : Monotone f) (k : \u2115) : \u2a06 n, f (n + k) = \u2a06 n, f n :=\nle_antisymm (iSup_le fun i => le_iSup _ (i + k)) <| iSup_mono fun i => hf <| Nat.le_add_right i k\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.Antitone (L83-L88)\ntheorem Antitone.iInf_nat_add {f : \u2115 \u2192 \u03b1} (hf : Antitone f) (k : \u2115) : \u2a05 n, f (n + k) = \u2a05 n, f n :=\nhf.dual_right.iSup_nat_add k\n\n-- Not `@[simp]` since the subterm `?f (i + ?k)` produces an ugly higher-order unification problem.\n-- (Although the `simpNF` linter does not complain.)\n-- See: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/complete_lattice.20and.20has_sup/near/316497982\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_iInf_ge_nat_add (L89-L97)\ntheorem iSup_iInf_ge_nat_add (f : \u2115 \u2192 \u03b1) (k : \u2115) :\n \u2a06 n, \u2a05 i \u2265 n, f (i + k) = \u2a06 n, \u2a05 i \u2265 n, f i := by\nhave hf : Monotone fun n => \u2a05 i \u2265 n, f i := fun n m h => biInf_mono fun i => h.trans\n rw [\u2190 Monotone.iSup_nat_add hf k]\n \u00b7 simp_rw [iInf_ge_eq_iInf_nat_add, \u2190 Nat.add_assoc]\n\n-- Not `@[simp]` since the subterm `?f (i + ?k)` produces an ugly higher-order unification problem.\n-- (Although the `simpNF` linter does not complain.)\n-- See: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/complete_lattice.20and.20has_sup/near/316497982\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_iSup_ge_nat_add (L98-L101)\ntheorem iInf_iSup_ge_nat_add :\n \u2200 (f : \u2115 \u2192 \u03b1) (k : \u2115), \u2a05 n, \u2a06 i \u2265 n, f (i + k) = \u2a05 n, \u2a06 i \u2265 n, f i :=\n@iSup_iInf_ge_nat_add \u03b1\u1d52\u1d48 _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.sup_iSup_nat_succ (L102-L107)\ntheorem sup_iSup_nat_succ (u : \u2115 \u2192 \u03b1) : (u 0 \u2294 \u2a06 i, u (i + 1)) = \u2a06 i, u i :=\ncalc\n (u 0 \u2294 \u2a06 i, u (i + 1)) = \u2a06 x \u2208 {0} \u222a range Nat.succ, u x := by\n { rw [iSup_union, iSup_singleton, iSup_range] }\n _ = \u2a06 i, u i := by rw [Nat.zero_union_range_succ, iSup_univ]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.inf_iInf_nat_succ (L108-L110)\ntheorem inf_iInf_nat_succ (u : \u2115 \u2192 \u03b1) : (u 0 \u2293 \u2a05 i, u (i + 1)) = \u2a05 i, u i :=\n@sup_iSup_nat_succ \u03b1\u1d52\u1d48 _ u\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iInf_nat_gt_zero_eq (L111-L114)\ntheorem iInf_nat_gt_zero_eq (f : \u2115 \u2192 \u03b1) : \u2a05 i > 0, f i = \u2a05 i, f (i + 1) := by\nrw [\u2190 iInf_range, Nat.range_succ]\n simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_nat_gt_zero_eq (L115-L117)\ntheorem iSup_nat_gt_zero_eq (f : \u2115 \u2192 \u03b1) : \u2a06 i > 0, f i = \u2a06 i, f (i + 1) :=\n@iInf_nat_gt_zero_eq \u03b1\u1d52\u1d48 _ f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.sup_sInf_le_iInf_sup (L129-L132)\ntheorem sup_sInf_le_iInf_sup : a \u2294 sInf s \u2264 \u2a05 b \u2208 s, a \u2294 b :=\nle_iInf\u2082 fun _ h => sup_le_sup_left (sInf_le h) _\n\n/-- This is a weaker version of `inf_sSup_eq` -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.CompleteLattice.Lemmas.iSup_inf_le_inf_sSup (L133-L136)\ntheorem iSup_inf_le_inf_sSup : \u2a06 b \u2208 s, a \u2293 b \u2264 a \u2293 sSup s :=\n@sup_sInf_le_iInf_sup \u03b1\u1d52\u1d48 _ _ _\n\n/-- This is a weaker version of `sInf_sup_eq` -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.biSup_congr (L161-L164)\ntheorem biSup_congr {p : \u03b9 \u2192 Prop} (h : \u2200 i, p i \u2192 f i = g i) :\n \u2a06 (i) (_ : p i), f i = \u2a06 (i) (_ : p i), g i :=\niSup_congr fun i \u21a6 iSup_congr (h i)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.iSup_congr (L157-L159)\ntheorem iSup_congr (h : \u2200 i, f i = g i) : \u2a06 i, f i = \u2a06 i, g i :=\ncongr_arg _ <| funext h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_le_sSup_of_subset_insert_bot (L97-L99)\ntheorem sSup_le_sSup_of_subset_insert_bot (h : s \u2286 insert \u22a5 t) : sSup s \u2264 sSup t :=\n(sSup_le_sSup h).trans_eq (sSup_insert.trans (bot_sup_eq _))\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.eq_singleton_bot_of_sSup_eq_bot_of_nonempty (L119-L128)\ntheorem eq_singleton_bot_of_sSup_eq_bot_of_nonempty {s : Set \u03b1} (h_sup : sSup s = \u22a5)\n (hne : s.Nonempty) : s = {\u22a5} := by\nrw [Set.eq_singleton_iff_nonempty_unique_mem]\n rw [sSup_eq_bot] at h_sup\n exact \u27e8hne, h_sup\u27e9\n\n/-- Introduction rule to prove that `b` is the supremum of `s`: it suffices to check that `b`\nis larger than all elements of `s`, and that this is not the case of any `w < b`.\nSee `csSup_eq_of_forall_le_of_forall_lt_exists_gt` for a version in conditionally complete\nlattices. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.Function (L172-L177)\ntheorem Function.Surjective.iSup_comp {f : \u03b9 \u2192 \u03b9'} (hf : Surjective f) (g : \u03b9' \u2192 \u03b1) :\n \u2a06 x, g (f x) = \u2a06 y, g y := by\nsimp only [iSup.eq_1]\n congr\n exact hf.range_comp g\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_insert (L93-L95)\ntheorem sSup_insert {a : \u03b1} {s : Set \u03b1} : sSup (insert a s) = a \u2294 sSup s :=\n((isLUB_sSup s).insert a).sSup_eq\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_diff_singleton_bot (L101-L104)\ntheorem sSup_diff_singleton_bot (s : Set \u03b1) : sSup (s \\ {\u22a5}) = sSup s :=\n(sSup_le_sSup diff_subset).antisymm <|\n sSup_le_sSup_of_subset_insert_bot <| subset_insert_diff_singleton _ _\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_of_forall_le_of_forall_lt_exists_gt (L134-L139)\ntheorem sSup_eq_of_forall_le_of_forall_lt_exists_gt (h\u2081 : \u2200 a \u2208 s, a \u2264 b)\n (h\u2082 : \u2200 w, w < b \u2192 \u2203 a \u2208 s, w < a) : sSup s = b :=\n(sSup_le h\u2081).eq_of_not_lt fun h =>\n let \u27e8_, ha, ha'\u27e9 := h\u2082 _ h\n ((le_sSup ha).trans_lt ha').false\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_univ (L88-L91)\ntheorem sSup_univ : sSup univ = (\u22a4 : \u03b1) :=\n(@isLUB_univ \u03b1 _ _).sSup_eq\n\n-- TODO(Jeremy): get this automatically\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_le_sSup_of_isCofinalFor (L53-L56)\ntheorem sSup_le_sSup_of_isCofinalFor (h : IsCofinalFor s t) : sSup s \u2264 sSup t :=\nIsLeast.mono (isLUB_sSup t) (isLUB_sSup s) <| upperBounds_mono_of_isCofinalFor h\n\n-- We will generalize this to conditionally complete lattices in `csSup_singleton`.\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_empty (L84-L86)\ntheorem sSup_empty : sSup \u2205 = (\u22a5 : \u03b1) :=\n(@isLUB_empty \u03b1 _ _).sSup_eq\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_iSup' (L154-L155)\ntheorem sSup_eq_iSup' (s : Set \u03b1) : sSup s = \u2a06 a : s, (a : \u03b1) := by rw [iSup, Subtype.range_coe]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_range (L150-L152)\ntheorem sSup_range : sSup (range f) = iSup f :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sInf_le_sSup_of_nonempty_inter (L72-L74)\ntheorem sInf_le_sSup_of_nonempty_inter (h : (s \u2229 t).Nonempty) : sInf s \u2264 sSup t :=\nisGLB_le_isLUB_of_nonempty_inter h (isGLB_sInf s) (isLUB_sSup t)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.iSup_congr_Prop (L194-L199)\ntheorem iSup_congr_Prop {p q : Prop} {f\u2081 : p \u2192 \u03b1} {f\u2082 : q \u2192 \u03b1} (pq : p \u2194 q)\n (f : \u2200 x, f\u2081 (pq.mpr x) = f\u2082 x) : iSup f\u2081 = iSup f\u2082 := by\nobtain rfl := propext pq\n congr with x\n apply f\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_bot' (L115-L117)\nlemma sSup_eq_bot' {s : Set \u03b1} : sSup s = \u22a5 \u2194 s = \u2205 \u2228 s = {\u22a5} := by\nrw [sSup_eq_bot, \u2190 subset_singleton_iff_eq, subset_singleton_iff]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sInf_le_sSup (L69-L71)\ntheorem sInf_le_sSup (hs : s.Nonempty) : sInf s \u2264 sSup s :=\nisGLB_le_isLUB (isGLB_sInf s) (isLUB_sSup s) hs\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.iSup_plift_up (L201-L203)\ntheorem iSup_plift_up (f : PLift \u03b9 \u2192 \u03b1) : \u2a06 i, f (PLift.up i) = \u2a06 i, f i :=\n(PLift.up_surjective.iSup_congr _) fun _ => rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.Equiv (L179-L181)\ntheorem Equiv.iSup_comp {g : \u03b9' \u2192 \u03b1} (e : \u03b9 \u2243 \u03b9') : \u2a06 x, g (e x) = \u2a06 y, g y :=\ne.surjective.iSup_comp _\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.biSup_congr' (L166-L170)\ntheorem biSup_congr' {p : \u03b9 \u2192 Prop} {f g : (i : \u03b9) \u2192 p i \u2192 \u03b1}\n (h : \u2200 i (hi : p i), f i hi = g i hi) :\n \u2a06 i, \u2a06 (hi : p i), f i hi = \u2a06 i, \u2a06 (hi : p i), g i hi := by\ngrind\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_eq_bot (L110-L113)\ntheorem sSup_eq_bot : sSup s = \u22a5 \u2194 \u2200 a \u2208 s, a = \u22a5 :=\n\u27e8fun h _ ha => bot_unique <| h \u25b8 le_sSup ha, fun h =>\n bot_unique <| sSup_le fun a ha => le_bot_iff.2 <| h a ha\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_inter_le (L80-L82)\ntheorem sSup_inter_le {s t : Set \u03b1} : sSup (s \u2229 t) \u2264 sSup s \u2293 sSup t :=\nsSup_le fun _ hb => le_inf (le_sSup hb.1) (le_sSup hb.2)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_union (L76-L78)\ntheorem sSup_union {s t : Set \u03b1} : sSup (s \u222a t) = sSup s \u2294 sSup t :=\n((isLUB_sSup s).union (isLUB_sSup t)).sSup_eq\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_singleton (L58-L60)\ntheorem sSup_singleton {a : \u03b1} : sSup {a} = a :=\nisLUB_singleton.sSup_eq\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.CompleteLattice.Basic.sSup_pair (L106-L108)\ntheorem sSup_pair {a b : \u03b1} : sSup {a, b} = a \u2294 b :=\n(@isLUB_pair \u03b1 _ a b).sSup_eq\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/CompleteLattice/Lemmas.lean", "module": "Mathlib.Order.CompleteLattice.Lemmas", "declaration": "Mathlib.Order.CompleteLattice.Lemmas.iSup_bool_eq", "span": "L53-L55", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/CompleteLattice/Lemmas.lean#L53"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4635, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 10970, "lean_code_chars": 9465, "natural_language_chars": 1505, "lean_code_ratio": 0.8628, "line_count": 340, "imports_count": 0, "declarations_count": 1160, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "b6864e726fd20f3e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.Derivation.Basic.leibniz_inv", "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.RingTheory.Derivation.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem leibniz_inv (a : K) : D a\u207b\u00b9 = -a\u207b\u00b9 ^ 2 \u2022 D a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.toFun_eq_coe (L75-L78)\ntheorem toFun_eq_coe : D.toFun = \u21d1D :=\nrfl\n\n/-- See Note [custom simps projection] -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.Simps (L79-L82)\ndef Simps.apply (D : Derivation R A M) : A \u2192 M := D\ninitialize_simps_projections Derivation (toFun \u2192 apply)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.hasCoeToLinearMap (L85-L87)\ninstance hasCoeToLinearMap : Coe (Derivation R A M) (A \u2192\u2097[R] M) :=\n\u27e8fun D => D.toLinearMap\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.mk_coe (L89-L91)\ntheorem mk_coe (f : A \u2192\u2097[R] M) (h\u2081 h\u2082) : ((\u27e8f, h\u2081, h\u2082\u27e9 : Derivation R A M) : A \u2192 M) = f :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.coeFn_coe (L93-L95)\ntheorem coeFn_coe (f : Derivation R A M) : \u21d1(f : A \u2192\u2097[R] M) = f :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.coe_injective (L96-L98)\ntheorem coe_injective : @Function.Injective (Derivation R A M) (A \u2192 M) DFunLike.coe :=\nDFunLike.coe_injective\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.ext (L100-L102)\ntheorem ext (H : \u2200 a, D1 a = D2 a) : D1 = D2 :=\nDFunLike.ext _ _ H\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.congr_fun (L103-L111)\ntheorem congr_fun (h : D1 = D2) (a : A) : D1 a = D2 a :=\nDFunLike.congr_fun h a\n\nprotected theorem map_add : D (a + b) = D a + D b :=\n map_add D a b\n\nprotected theorem map_zero : D 0 = 0 :=\n map_zero D\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_smul (L113-L115)\ntheorem map_smul : D (r \u2022 a) = r \u2022 D a :=\nD.toLinearMap.map_smul r a\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.leibniz (L117-L119)\ntheorem leibniz : D (a * b) = a \u2022 D b + b \u2022 D a :=\nD.leibniz' _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_smul_of_tower (L121-L124)\ntheorem map_smul_of_tower {S : Type*} [SMul S A] [SMul S M] [LinearMap.CompatibleSMul A M S R]\n (D : Derivation R A M) (r : S) (a : A) : D (r \u2022 a) = r \u2022 D a :=\nD.toLinearMap.map_smul_of_tower r a\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_one_eq_zero (L126-L128)\ntheorem map_one_eq_zero : D 1 = 0 :=\nD.map_one_eq_zero'\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_algebraMap (L130-L132)\ntheorem map_algebraMap : D (algebraMap R A r) = 0 := by\nrw [\u2190 mul_one r, map_mul, map_one, \u2190 smul_def, map_smul, map_one_eq_zero, smul_zero]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_natCast (L134-L136)\ntheorem map_natCast (n : \u2115) : D (n : A) = 0 := by\nrw [\u2190 nsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.leibniz_pow (L138-L148)\ntheorem leibniz_pow (n : \u2115) : D (a ^ n) = n \u2022 a ^ (n - 1) \u2022 D a := by\ninduction n with\n | zero => rw [pow_zero, map_one_eq_zero, zero_smul]\n | succ n ihn =>\n rcases (zero_le n).eq_or_lt with (rfl | hpos)\n \u00b7 simp\n \u00b7 have : a * a ^ (n - 1) = a ^ n := by rw [\u2190 pow_succ', Nat.sub_add_cancel hpos]\n simp only [pow_succ', leibniz, ihn, smul_comm a n (_ : M), smul_smul a, add_smul, this,\n Nat.add_succ_sub_one, add_zero, one_nsmul]\n\nopen Polynomial in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mk (L102-L105)\ndef mk (x : Derivation R A' A') (y : Derivation R A A)\n (h : x \u2218 (Algebra.ofId A A') = (Algebra.ofId A A') \u2218 y) : couple R A A' :=\n\u27e8(x, y), (Compatible.mem _).mpr h\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_monomial (L70-L73)\nlemma mapCoeffs_monomial (n : \u2115) (x : A) :\n d.mapCoeffs (monomial n x) = .single A n (d x) := Finsupp.ext fun _ \u21a6 by\nsimp [coeff_monomial, apply_ite d, PolynomialModule.single_apply]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.Differential (L80-L87)\ndef Differential.equiv {R R\u2082 : Type*} [CommRing R] [CommRing R\u2082] [Differential R\u2082]\n (h : R \u2243+* R\u2082) : Differential R :=\n\u27e8Derivation.mk' (h.symm.toAddMonoidHom.toIntLinearMap \u2218\u2097\n Differential.deriv.toLinearMap \u2218\u2097 h.toAddMonoidHom.toIntLinearMap) (by simp)\u27e9\n\n/--\nTransfer a `DifferentialAlgebra` instance across a `AlgEquiv`.\n-/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.coeff_mapCoeffs (L127-L129)\nlemma coeff_mapCoeffs (p : A[X]) (i) :\n coeff (mapCoeffs p) i = (coeff p i)\u2032 := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mk_right (L109-L111)\nlemma mk_right (x : Derivation R A' A') (y : Derivation R A A)\n (h : x \u2218 (Algebra.ofId A A') = (Algebra.ofId A A') \u2218 y) : (mk x y h).1.2 = y := rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_C (L79-L84)\nlemma mapCoeffs_C (x : A) :\n d.mapCoeffs (C x) = .single A 0 (d x) := by simp [\u2190 monomial_zero_left]\nvariable {B M' : Type*} [CommRing B] [Algebra R B] [Algebra A B]\n [AddCommGroup M'] [Module B M'] [Module R M'] [Module A M']\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.bracket_eq_fun (L73-L81)\nlemma bracket_eq_fun (X : Derivation R A A) (a : A) : \u2045X, a\u2046 = X a := rfl\nsection CompatibleDerivations\nvariable {A' : Type*} [CommRing A'] [Algebra R A'] [Algebra A A'] [IsScalarTower R A A']\n\nvariable (R A A') in\n/-- Let `\u03c3 : A \u2192 A'` be a an homomorphism. A derivation `d : A \u2192 A` and a derivation\n`d' : A' \u2192 A'` are called compatible if `d' \u2218 \u03c3 = \u03c3 \u2218 d`. Couples of derivations\nwith this property form a Lie subalgebra of all couples of derivations. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mem (L95-L101)\nlemma mem (x : (Derivation R A' A') \u00d7 (Derivation R A A)) :\n x \u2208 couple R A A' \u2194 x.1 \u2218 Algebra.ofId A A' = Algebra.ofId A A' \u2218 x.2 := by\nconstructor\n \u00b7 intro hx; ext a; exact congrArg (\u00b7 a) hx\n \u00b7 intro hx; ext a; exact congrArg (\u00b7 a) hx\n\n/-- Generate an element of `couple` from `x y` satisfying the compatibility equation. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.commutator_apply (L48-L50)\ntheorem commutator_apply : \u2045D1, D2\u2046 a = D1 (D2 a) - D2 (D1 a) :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_X (L75-L77)\nlemma mapCoeffs_X :\n d.mapCoeffs (X : A[X]) = 0 := by simp [\u2190 monomial_one_one_eq_X]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_apply (L66-L68)\nlemma mapCoeffs_apply (p : A[X]) (i) :\n d.mapCoeffs p i = d (coeff p i) := rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.mem_range_of_deriv_eq_zero (L67-L71)\nlemma mem_range_of_deriv_eq_zero (A : Type*) {B : Type*} [CommRing A] [CommRing B] [Algebra A B]\n [Differential B] [Differential.ContainConstants A B] {x : B} (h : x\u2032 = 0) :\n x \u2208 (algebraMap A B).range :=\nDifferential.ContainConstants.mem_range_of_deriv_eq_zero h\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.algebraMap (L53-L66)\nlemma algebraMap.coe_deriv {A : Type*} {B : Type*} [CommRing A] [CommRing B] [Algebra A B]\n [Differential A] [Differential B] [DifferentialAlgebra A B] (a : A) :\n (a\u2032 : A) = (a : B)\u2032 :=\n(DifferentialAlgebra.deriv_algebraMap _).symm\n\n/--\nA differential ring `A` and an algebra over it `B` share constants if all\nconstants in B are in the range of `algebraMap A B`.\n-/\nclass Differential.ContainConstants (A B : Type*) [CommRing A] [CommRing B]\n [Algebra A B] [Differential B] : Prop where\n /-- If the derivative of x is 0, then it's in the range of `algebraMap A B`. -/\n protected mem_range_of_deriv_eq_zero {x : B} (h : x\u2032 = 0) : x \u2208 (algebraMap A B).range\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.DifferentialAlgebra (L88-L100)\nlemma DifferentialAlgebra.equiv {A : Type*} [CommRing A] [Differential A]\n {R R\u2082 : Type*} [CommRing R] [CommRing R\u2082] [Differential R\u2082] [Algebra A R]\n [Algebra A R\u2082] [DifferentialAlgebra A R\u2082] (h : R \u2243\u2090[A] R\u2082) :\n letI := Differential.equiv h.toRingEquiv\nDifferentialAlgebra A R :=\n letI := Differential.equiv h.toRingEquiv\n \u27e8fun a \u21a6 by\n change (LinearMap.comp ..) _ = _\n simp only [AlgEquiv.toRingEquiv_eq_coe, RingHom.toAddMonoidHom_eq_coe,\n RingEquiv.toRingHom_eq_coe, AlgEquiv.toRingEquiv_toRingHom, LinearMap.coe_comp,\n AddMonoidHom.coe_toIntLinearMap, AddMonoidHom.coe_coe, RingHom.coe_coe, Derivation.coeFn_coe,\n Function.comp_apply, AlgEquiv.commutes, deriv_algebraMap]\n apply h.symm.commutes\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.deriv_aeval_eq (L145-L154)\ntheorem deriv_aeval_eq (x : R) (p : A[X]) :\n (aeval x p)\u2032 = aeval x (mapCoeffs p) + aeval x (derivative p) * x\u2032 := by\nconvert Derivation.apply_aeval_eq' Differential.deriv _ (Algebra.linearMap A R) ..\n \u00b7 simp [mapCoeffs]\n \u00b7 simp [deriv_algebraMap]\n\n/--\nThe unique derivation which can be made to a `DifferentialAlgebra` on `A[X]` with\n`X\u2032 = v`.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mk_left (L106-L108)\nlemma mk_left (x : Derivation R A' A') (y : Derivation R A A)\n (h : x \u2218 (Algebra.ofId A A') = (Algebra.ofId A A') \u2218 y) : (mk x y h).1.1 = x := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.apply (L112-L122)\nlemma apply (x : couple R A A') (a : A) :\n x.1.1 (Algebra.ofId A A' a) = (Algebra.ofId A A') (x.1.2 a) := by\nexact congrArg (\u00b7 a) x.2\n\nend Compatible\n\nend CompatibleDerivations\n\nend LieStructures\n\nend Derivation\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.apply_eval_eq (L109-L122)\ntheorem apply_eval_eq (x : A) (p : A[X]) :\n d (eval x p) = PolynomialModule.eval x (d.mapCoeffs p) + eval x (derivative p) \u2022 d x :=\napply_aeval_eq d x p\n\nend Derivation\n\nnamespace Differential\n\nvariable {A : Type*} [CommRing A] [Differential A]\n\nset_option backward.isDefEq.respectTransparency false in\n/--\nA specialization of `Derivation.mapCoeffs` for the case of a differential ring.\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.apply_aeval_eq' (L85-L97)\ntheorem apply_aeval_eq' (d' : Derivation R B M') (f : M \u2192\u2097[A] M')\n (h : \u2200 a, f (d a) = d' (algebraMap A B a)) (x : B) (p : A[X]) :\n d' (aeval x p) = PolynomialModule.eval x (PolynomialModule.map B f (d.mapCoeffs p)) +\n aeval x (derivative p) \u2022 d' x := by\ninduction p using Polynomial.induction_on' with\n | add => simp_all only [map_add, add_smul]; abel\n | monomial =>\n simp only [aeval_monomial, leibniz, leibniz_pow, mapCoeffs_monomial,\n PolynomialModule.map_single, PolynomialModule.eval_single, derivative_monomial, map_mul,\n _root_.map_natCast, h]\n rw [add_comm, \u2190 smul_smul, \u2190 smul_smul, Nat.cast_smul_eq_nsmul]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.commutator_coe_linear_map (L45-L47)\ntheorem commutator_coe_linear_map : \u2191\u2045D1, D2\u2046 = \u2045(D1 : Module.End R A), (D2 : Module.End R A)\u2046 :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.apply_aeval_eq (L98-L108)\ntheorem apply_aeval_eq [IsScalarTower R A B] [IsScalarTower A B M'] (d : Derivation R B M')\n (x : B) (p : A[X]) :\n d (aeval x p) = PolynomialModule.eval x ((d.compAlgebraMap A).mapCoeffs p) +\n aeval x (derivative p) \u2022 d x := by\nconvert apply_aeval_eq' (d.compAlgebraMap A) d LinearMap.id _ x p\n \u00b7 apply Finsupp.ext\n intro x\n rfl\n \u00b7 intro a\n rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.instLieAlgebra (L57-L61)\ninstance instLieAlgebra : LieAlgebra R (Derivation R A A) :=\n{ Derivation.instModule with\n lie_smul := fun r d e => by\n ext a; simp only [commutator_apply, map_smul, smul_sub, smul_apply] }\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.couple (L82-L94)\ndef couple : LieSubalgebra R (Derivation R A' A' \u00d7 Derivation R A A) where\n carrier := { x | x.fst.compAlgebraMapL R A A' A' = (Algebra.ofId A A').toLinearMap.compDer x.snd }\nadd_mem' := by simp_all\n zero_mem' := by simp\n smul_mem' := by simp_all\n lie_mem' {x y} hx hy := by\n have hxx (a : A) := congrArg (fun f => f a) hx\n have hyy (a : A) := congrArg (fun f => f a) hy\n ext z\n simp at hxx hyy\n simp [Derivation.commutator_apply, hxx, hyy]\n\nnamespace Compatible\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs (L38-L64)\ndef mapCoeffs : Derivation R A[X] (PolynomialModule A M) where\n __ := (PolynomialModule.map A d.toLinearMap).comp\nPolynomialModule.equivPolynomial.symm.toLinearMap\n map_one_eq_zero' := show (Finsupp.single 0 1).mapRange (d : A \u2192 M) d.map_zero = 0 by simp\n leibniz' p q := by\n dsimp\n induction p using Polynomial.induction_on' with\n | add => simp only [add_mul, map_add, add_smul, smul_add, add_add_add_comm, *]\n | monomial n a =>\n induction q using Polynomial.induction_on' with\n | add => simp only [mul_add, map_add, add_smul, smul_add, add_add_add_comm, *]\n | monomial m b =>\n refine Finsupp.ext fun i \u21a6 ?_\n dsimp [PolynomialModule.equivPolynomial, PolynomialModule.map]\n simp only [toFinsupp_mul, toFinsupp_monomial, AddMonoidAlgebra.single_mul_single]\n change d _ = _ + _\n -- TODO: copy more `Finsupp` API to `PolynomialModule`.\n -- We have to do a bit of work to go through the identification\n -- `PolynomialModule A M = \u2115 \u2192\u2080 M`...\n dsimp only [PolynomialModule, Finsupp.mapRange.linearMap_apply, coeFn_coe]\n rw [Finsupp.mapRange_single, Finsupp.mapRange_single]\n -- ... and here we go back through the identification.\n change _ = (_ \u2022 PolynomialModule.single A _ _) _ + (_ \u2022 PolynomialModule.single A _ _) i\n simp only [PolynomialModule.monomial_smul_single, AddMonoidAlgebra.single_apply,\n apply_ite d, leibniz, map_zero, PolynomialModule.single_apply, ite_add_zero,\n add_comm m n]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.implicitDeriv (L155-L158)\ndef implicitDeriv (v : A[X]) :\n Derivation \u2124 A[X] A[X] :=\nmapCoeffs + v \u2022 derivative'.restrictScalars \u2124\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.RingTheory.Derivation.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 leibniz_inv (a : K) : D a\u207b\u00b9 = -a\u207b\u00b9 ^ 2 \u2022 D a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.toFun_eq_coe (L75-L78)\ntheorem toFun_eq_coe : D.toFun = \u21d1D :=\nrfl\n\n/-- See Note [custom simps projection] -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.Simps (L79-L82)\ndef Simps.apply (D : Derivation R A M) : A \u2192 M := D\ninitialize_simps_projections Derivation (toFun \u2192 apply)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.hasCoeToLinearMap (L85-L87)\ninstance hasCoeToLinearMap : Coe (Derivation R A M) (A \u2192\u2097[R] M) :=\n\u27e8fun D => D.toLinearMap\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.mk_coe (L89-L91)\ntheorem mk_coe (f : A \u2192\u2097[R] M) (h\u2081 h\u2082) : ((\u27e8f, h\u2081, h\u2082\u27e9 : Derivation R A M) : A \u2192 M) = f :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.coeFn_coe (L93-L95)\ntheorem coeFn_coe (f : Derivation R A M) : \u21d1(f : A \u2192\u2097[R] M) = f :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.coe_injective (L96-L98)\ntheorem coe_injective : @Function.Injective (Derivation R A M) (A \u2192 M) DFunLike.coe :=\nDFunLike.coe_injective\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.ext (L100-L102)\ntheorem ext (H : \u2200 a, D1 a = D2 a) : D1 = D2 :=\nDFunLike.ext _ _ H\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.congr_fun (L103-L111)\ntheorem congr_fun (h : D1 = D2) (a : A) : D1 a = D2 a :=\nDFunLike.congr_fun h a\n\nprotected theorem map_add : D (a + b) = D a + D b :=\n map_add D a b\n\nprotected theorem map_zero : D 0 = 0 :=\n map_zero D\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_smul (L113-L115)\ntheorem map_smul : D (r \u2022 a) = r \u2022 D a :=\nD.toLinearMap.map_smul r a\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.leibniz (L117-L119)\ntheorem leibniz : D (a * b) = a \u2022 D b + b \u2022 D a :=\nD.leibniz' _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_smul_of_tower (L121-L124)\ntheorem map_smul_of_tower {S : Type*} [SMul S A] [SMul S M] [LinearMap.CompatibleSMul A M S R]\n (D : Derivation R A M) (r : S) (a : A) : D (r \u2022 a) = r \u2022 D a :=\nD.toLinearMap.map_smul_of_tower r a\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_one_eq_zero (L126-L128)\ntheorem map_one_eq_zero : D 1 = 0 :=\nD.map_one_eq_zero'\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_algebraMap (L130-L132)\ntheorem map_algebraMap : D (algebraMap R A r) = 0 := by\nrw [\u2190 mul_one r, map_mul, map_one, \u2190 smul_def, map_smul, map_one_eq_zero, smul_zero]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.map_natCast (L134-L136)\ntheorem map_natCast (n : \u2115) : D (n : A) = 0 := by\nrw [\u2190 nsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Derivation.Basic.leibniz_pow (L138-L148)\ntheorem leibniz_pow (n : \u2115) : D (a ^ n) = n \u2022 a ^ (n - 1) \u2022 D a := by\ninduction n with\n | zero => rw [pow_zero, map_one_eq_zero, zero_smul]\n | succ n ihn =>\n rcases (zero_le n).eq_or_lt with (rfl | hpos)\n \u00b7 simp\n \u00b7 have : a * a ^ (n - 1) = a ^ n := by rw [\u2190 pow_succ', Nat.sub_add_cancel hpos]\n simp only [pow_succ', leibniz, ihn, smul_comm a n (_ : M), smul_smul a, add_smul, this,\n Nat.add_succ_sub_one, add_zero, one_nsmul]\n\nopen Polynomial in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mk (L102-L105)\ndef mk (x : Derivation R A' A') (y : Derivation R A A)\n (h : x \u2218 (Algebra.ofId A A') = (Algebra.ofId A A') \u2218 y) : couple R A A' :=\n\u27e8(x, y), (Compatible.mem _).mpr h\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_monomial (L70-L73)\nlemma mapCoeffs_monomial (n : \u2115) (x : A) :\n d.mapCoeffs (monomial n x) = .single A n (d x) := Finsupp.ext fun _ \u21a6 by\nsimp [coeff_monomial, apply_ite d, PolynomialModule.single_apply]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.Differential (L80-L87)\ndef Differential.equiv {R R\u2082 : Type*} [CommRing R] [CommRing R\u2082] [Differential R\u2082]\n (h : R \u2243+* R\u2082) : Differential R :=\n\u27e8Derivation.mk' (h.symm.toAddMonoidHom.toIntLinearMap \u2218\u2097\n Differential.deriv.toLinearMap \u2218\u2097 h.toAddMonoidHom.toIntLinearMap) (by simp)\u27e9\n\n/--\nTransfer a `DifferentialAlgebra` instance across a `AlgEquiv`.\n-/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.coeff_mapCoeffs (L127-L129)\nlemma coeff_mapCoeffs (p : A[X]) (i) :\n coeff (mapCoeffs p) i = (coeff p i)\u2032 := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mk_right (L109-L111)\nlemma mk_right (x : Derivation R A' A') (y : Derivation R A A)\n (h : x \u2218 (Algebra.ofId A A') = (Algebra.ofId A A') \u2218 y) : (mk x y h).1.2 = y := rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_C (L79-L84)\nlemma mapCoeffs_C (x : A) :\n d.mapCoeffs (C x) = .single A 0 (d x) := by simp [\u2190 monomial_zero_left]\nvariable {B M' : Type*} [CommRing B] [Algebra R B] [Algebra A B]\n [AddCommGroup M'] [Module B M'] [Module R M'] [Module A M']\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.bracket_eq_fun (L73-L81)\nlemma bracket_eq_fun (X : Derivation R A A) (a : A) : \u2045X, a\u2046 = X a := rfl\nsection CompatibleDerivations\nvariable {A' : Type*} [CommRing A'] [Algebra R A'] [Algebra A A'] [IsScalarTower R A A']\n\nvariable (R A A') in\n/-- Let `\u03c3 : A \u2192 A'` be a an homomorphism. A derivation `d : A \u2192 A` and a derivation\n`d' : A' \u2192 A'` are called compatible if `d' \u2218 \u03c3 = \u03c3 \u2218 d`. Couples of derivations\nwith this property form a Lie subalgebra of all couples of derivations. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mem (L95-L101)\nlemma mem (x : (Derivation R A' A') \u00d7 (Derivation R A A)) :\n x \u2208 couple R A A' \u2194 x.1 \u2218 Algebra.ofId A A' = Algebra.ofId A A' \u2218 x.2 := by\nconstructor\n \u00b7 intro hx; ext a; exact congrArg (\u00b7 a) hx\n \u00b7 intro hx; ext a; exact congrArg (\u00b7 a) hx\n\n/-- Generate an element of `couple` from `x y` satisfying the compatibility equation. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.commutator_apply (L48-L50)\ntheorem commutator_apply : \u2045D1, D2\u2046 a = D1 (D2 a) - D2 (D1 a) :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_X (L75-L77)\nlemma mapCoeffs_X :\n d.mapCoeffs (X : A[X]) = 0 := by simp [\u2190 monomial_one_one_eq_X]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs_apply (L66-L68)\nlemma mapCoeffs_apply (p : A[X]) (i) :\n d.mapCoeffs p i = d (coeff p i) := rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.mem_range_of_deriv_eq_zero (L67-L71)\nlemma mem_range_of_deriv_eq_zero (A : Type*) {B : Type*} [CommRing A] [CommRing B] [Algebra A B]\n [Differential B] [Differential.ContainConstants A B] {x : B} (h : x\u2032 = 0) :\n x \u2208 (algebraMap A B).range :=\nDifferential.ContainConstants.mem_range_of_deriv_eq_zero h\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.algebraMap (L53-L66)\nlemma algebraMap.coe_deriv {A : Type*} {B : Type*} [CommRing A] [CommRing B] [Algebra A B]\n [Differential A] [Differential B] [DifferentialAlgebra A B] (a : A) :\n (a\u2032 : A) = (a : B)\u2032 :=\n(DifferentialAlgebra.deriv_algebraMap _).symm\n\n/--\nA differential ring `A` and an algebra over it `B` share constants if all\nconstants in B are in the range of `algebraMap A B`.\n-/\nclass Differential.ContainConstants (A B : Type*) [CommRing A] [CommRing B]\n [Algebra A B] [Differential B] : Prop where\n /-- If the derivative of x is 0, then it's in the range of `algebraMap A B`. -/\n protected mem_range_of_deriv_eq_zero {x : B} (h : x\u2032 = 0) : x \u2208 (algebraMap A B).range\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Derivation.DifferentialRing.DifferentialAlgebra (L88-L100)\nlemma DifferentialAlgebra.equiv {A : Type*} [CommRing A] [Differential A]\n {R R\u2082 : Type*} [CommRing R] [CommRing R\u2082] [Differential R\u2082] [Algebra A R]\n [Algebra A R\u2082] [DifferentialAlgebra A R\u2082] (h : R \u2243\u2090[A] R\u2082) :\n letI := Differential.equiv h.toRingEquiv\nDifferentialAlgebra A R :=\n letI := Differential.equiv h.toRingEquiv\n \u27e8fun a \u21a6 by\n change (LinearMap.comp ..) _ = _\n simp only [AlgEquiv.toRingEquiv_eq_coe, RingHom.toAddMonoidHom_eq_coe,\n RingEquiv.toRingHom_eq_coe, AlgEquiv.toRingEquiv_toRingHom, LinearMap.coe_comp,\n AddMonoidHom.coe_toIntLinearMap, AddMonoidHom.coe_coe, RingHom.coe_coe, Derivation.coeFn_coe,\n Function.comp_apply, AlgEquiv.commutes, deriv_algebraMap]\n apply h.symm.commutes\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.deriv_aeval_eq (L145-L154)\ntheorem deriv_aeval_eq (x : R) (p : A[X]) :\n (aeval x p)\u2032 = aeval x (mapCoeffs p) + aeval x (derivative p) * x\u2032 := by\nconvert Derivation.apply_aeval_eq' Differential.deriv _ (Algebra.linearMap A R) ..\n \u00b7 simp [mapCoeffs]\n \u00b7 simp [deriv_algebraMap]\n\n/--\nThe unique derivation which can be made to a `DifferentialAlgebra` on `A[X]` with\n`X\u2032 = v`.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.mk_left (L106-L108)\nlemma mk_left (x : Derivation R A' A') (y : Derivation R A A)\n (h : x \u2218 (Algebra.ofId A A') = (Algebra.ofId A A') \u2218 y) : (mk x y h).1.1 = x := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.apply (L112-L122)\nlemma apply (x : couple R A A') (a : A) :\n x.1.1 (Algebra.ofId A A' a) = (Algebra.ofId A A') (x.1.2 a) := by\nexact congrArg (\u00b7 a) x.2\n\nend Compatible\n\nend CompatibleDerivations\n\nend LieStructures\n\nend Derivation\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.apply_eval_eq (L109-L122)\ntheorem apply_eval_eq (x : A) (p : A[X]) :\n d (eval x p) = PolynomialModule.eval x (d.mapCoeffs p) + eval x (derivative p) \u2022 d x :=\napply_aeval_eq d x p\n\nend Derivation\n\nnamespace Differential\n\nvariable {A : Type*} [CommRing A] [Differential A]\n\nset_option backward.isDefEq.respectTransparency false in\n/--\nA specialization of `Derivation.mapCoeffs` for the case of a differential ring.\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.apply_aeval_eq' (L85-L97)\ntheorem apply_aeval_eq' (d' : Derivation R B M') (f : M \u2192\u2097[A] M')\n (h : \u2200 a, f (d a) = d' (algebraMap A B a)) (x : B) (p : A[X]) :\n d' (aeval x p) = PolynomialModule.eval x (PolynomialModule.map B f (d.mapCoeffs p)) +\n aeval x (derivative p) \u2022 d' x := by\ninduction p using Polynomial.induction_on' with\n | add => simp_all only [map_add, add_smul]; abel\n | monomial =>\n simp only [aeval_monomial, leibniz, leibniz_pow, mapCoeffs_monomial,\n PolynomialModule.map_single, PolynomialModule.eval_single, derivative_monomial, map_mul,\n _root_.map_natCast, h]\n rw [add_comm, \u2190 smul_smul, \u2190 smul_smul, Nat.cast_smul_eq_nsmul]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.commutator_coe_linear_map (L45-L47)\ntheorem commutator_coe_linear_map : \u2191\u2045D1, D2\u2046 = \u2045(D1 : Module.End R A), (D2 : Module.End R A)\u2046 :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.apply_aeval_eq (L98-L108)\ntheorem apply_aeval_eq [IsScalarTower R A B] [IsScalarTower A B M'] (d : Derivation R B M')\n (x : B) (p : A[X]) :\n d (aeval x p) = PolynomialModule.eval x ((d.compAlgebraMap A).mapCoeffs p) +\n aeval x (derivative p) \u2022 d x := by\nconvert apply_aeval_eq' (d.compAlgebraMap A) d LinearMap.id _ x p\n \u00b7 apply Finsupp.ext\n intro x\n rfl\n \u00b7 intro a\n rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.instLieAlgebra (L57-L61)\ninstance instLieAlgebra : LieAlgebra R (Derivation R A A) :=\n{ Derivation.instModule with\n lie_smul := fun r d e => by\n ext a; simp only [commutator_apply, map_smul, smul_sub, smul_apply] }\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Derivation.Lie.couple (L82-L94)\ndef couple : LieSubalgebra R (Derivation R A' A' \u00d7 Derivation R A A) where\n carrier := { x | x.fst.compAlgebraMapL R A A' A' = (Algebra.ofId A A').toLinearMap.compDer x.snd }\nadd_mem' := by simp_all\n zero_mem' := by simp\n smul_mem' := by simp_all\n lie_mem' {x y} hx hy := by\n have hxx (a : A) := congrArg (fun f => f a) hx\n have hyy (a : A) := congrArg (fun f => f a) hy\n ext z\n simp at hxx hyy\n simp [Derivation.commutator_apply, hxx, hyy]\n\nnamespace Compatible\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.mapCoeffs (L38-L64)\ndef mapCoeffs : Derivation R A[X] (PolynomialModule A M) where\n __ := (PolynomialModule.map A d.toLinearMap).comp\nPolynomialModule.equivPolynomial.symm.toLinearMap\n map_one_eq_zero' := show (Finsupp.single 0 1).mapRange (d : A \u2192 M) d.map_zero = 0 by simp\n leibniz' p q := by\n dsimp\n induction p using Polynomial.induction_on' with\n | add => simp only [add_mul, map_add, add_smul, smul_add, add_add_add_comm, *]\n | monomial n a =>\n induction q using Polynomial.induction_on' with\n | add => simp only [mul_add, map_add, add_smul, smul_add, add_add_add_comm, *]\n | monomial m b =>\n refine Finsupp.ext fun i \u21a6 ?_\n dsimp [PolynomialModule.equivPolynomial, PolynomialModule.map]\n simp only [toFinsupp_mul, toFinsupp_monomial, AddMonoidAlgebra.single_mul_single]\n change d _ = _ + _\n -- TODO: copy more `Finsupp` API to `PolynomialModule`.\n -- We have to do a bit of work to go through the identification\n -- `PolynomialModule A M = \u2115 \u2192\u2080 M`...\n dsimp only [PolynomialModule, Finsupp.mapRange.linearMap_apply, coeFn_coe]\n rw [Finsupp.mapRange_single, Finsupp.mapRange_single]\n -- ... and here we go back through the identification.\n change _ = (_ \u2022 PolynomialModule.single A _ _) _ + (_ \u2022 PolynomialModule.single A _ _) i\n simp only [PolynomialModule.monomial_smul_single, AddMonoidAlgebra.single_apply,\n apply_ite d, leibniz, map_zero, PolynomialModule.single_apply, ite_add_zero,\n add_comm m n]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Derivation.MapCoeffs.implicitDeriv (L155-L158)\ndef implicitDeriv (v : A[X]) :\n Derivation \u2124 A[X] A[X] :=\nmapCoeffs + v \u2022 derivative'.restrictScalars \u2124\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Derivation/Basic.lean", "module": "Mathlib.RingTheory.Derivation.Basic", "declaration": "Mathlib.RingTheory.Derivation.Basic.leibniz_inv", "span": "L474-L478", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Derivation/Basic.lean#L474"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 5465, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 14478, "lean_code_chars": 12974, "natural_language_chars": 1504, "lean_code_ratio": 0.8961, "line_count": 434, "imports_count": 0, "declarations_count": 1604, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "68dadf8a25c73af0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.MvPolynomial.CommRing.totalDegree_neg", "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.Algebra.MvPolynomial.CommRing)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem totalDegree_neg (a : MvPolynomial \u03c3 R) : (-a).totalDegree = a.totalDegree\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.C_sub (L60-L62)\ntheorem C_sub : (C (a - a') : MvPolynomial \u03c3 R) = C a - C a' :=\nmap_sub _ _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.C_neg (L64-L66)\ntheorem C_neg : (C (-a) : MvPolynomial \u03c3 R) = -C a :=\nmap_neg _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.coeff_neg (L68-L70)\ntheorem coeff_neg (m : \u03c3 \u2192\u2080 \u2115) (p : MvPolynomial \u03c3 R) : coeff m (-p) = -coeff m p :=\nFinsupp.neg_apply _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.coeff_sub (L72-L74)\ntheorem coeff_sub (m : \u03c3 \u2192\u2080 \u2115) (p q : MvPolynomial \u03c3 R) : coeff m (p - q) = coeff m p - coeff m q :=\nFinsupp.sub_apply _ _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.support_neg (L76-L78)\ntheorem support_neg : (-p).support = p.support :=\nFinsupp.support_neg p\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.support_sub (L79-L86)\ntheorem support_sub [DecidableEq \u03c3] (p q : MvPolynomial \u03c3 R) :\n (p - q).support \u2286 p.support \u222a q.support :=\nFinsupp.support_sub\n\nvariable {\u03c3} (p)\n\nsection Degrees\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degrees_neg (L88-L90)\ntheorem degrees_neg (p : MvPolynomial \u03c3 R) : (-p).degrees = p.degrees := by\nrw [degrees, support_neg]; rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degrees_sub_le (L91-L98)\ntheorem degrees_sub_le [DecidableEq \u03c3] {p q : MvPolynomial \u03c3 R} :\n (p - q).degrees \u2264 p.degrees \u222a q.degrees := by\nsimpa [degrees_def] using AddMonoidAlgebra.supDegree_sub_le\n\nend Degrees\n\nsection Degrees\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degreeOf_neg (L100-L102)\ntheorem degreeOf_neg (i : \u03c3) (p : MvPolynomial \u03c3 R) : degreeOf i (-p) = degreeOf i p := by\nrw [degreeOf, degreeOf, degrees_neg]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degreeOf_sub_le (L103-L110)\ntheorem degreeOf_sub_le (i : \u03c3) (p q : MvPolynomial \u03c3 R) :\n degreeOf i (p - q) \u2264 max (degreeOf i p) (degreeOf i q) := by\nsimpa only [sub_eq_add_neg, degreeOf_neg] using degreeOf_add_le i p (-q)\n\nend Degrees\n\nsection Vars\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.vars_neg (L112-L113)\ntheorem vars_neg : (-p).vars = p.vars := by simp [vars, degrees_neg]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.vars_sub_subset (L114-L116)\ntheorem vars_sub_subset [DecidableEq \u03c3] : (p - q).vars \u2286 p.vars \u222a q.vars := by\nconvert vars_add_subset p (-q) using 2 <;> simp [sub_eq_add_neg]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.vars_sub_of_disjoint (L118-L129)\ntheorem vars_sub_of_disjoint [DecidableEq \u03c3] (hpq : Disjoint p.vars q.vars) :\n (p - q).vars = p.vars \u222a q.vars := by\nrw [\u2190 vars_neg q] at hpq\n convert vars_add_of_disjoint hpq using 2 <;> simp [sub_eq_add_neg]\n\nend Vars\n\nsection Eval\n\nvariable [CommRing S]\nvariable (f : R \u2192+* S) (g : \u03c3 \u2192 S)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.eval\u2082_sub (L131-L133)\ntheorem eval\u2082_sub : (p - q).eval\u2082 f g = p.eval\u2082 f g - q.eval\u2082 f g :=\n(eval\u2082Hom f g).map_sub _ _\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.eval_sub (L134-L136)\ntheorem eval_sub (f : \u03c3 \u2192 R) : eval f (p - q) = eval f p - eval f q :=\neval\u2082_sub _ _ _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_inj (L172-L175)\ntheorem C_inj {\u03c3 : Type*} (R : Type*) [CommSemiring R] (r s : R) :\n (C r : MvPolynomial \u03c3 R) = C s \u2194 r = s :=\n(C_injective \u03c3 R).eq_iff\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_add (L149-L151)\ntheorem C_add : (C (a + a') : MvPolynomial \u03c3 R) = C a + C a' :=\nFinsupp.single_add _ _ _\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial_left_injective (L124-L127)\ntheorem monomial_left_injective {r : R} (hr : r \u2260 0) :\n Function.Injective fun s : \u03c3 \u2192\u2080 \u2115 => monomial s r :=\nFinsupp.single_left_injective hr\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.one_def (L95-L96)\ntheorem one_def : (1 : MvPolynomial \u03c3 R) = monomial 0 1 := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.single_eq_monomial (L97-L99)\ntheorem single_eq_monomial (s : \u03c3 \u2192\u2080 \u2115) (a : R) : Finsupp.single s a = monomial s a :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.X (L121-L123)\ndef X (n : \u03c3) : MvPolynomial \u03c3 R :=\nmonomial (Finsupp.single n 1) 1\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.infinite_of_infinite (L185-L188)\ninstance infinite_of_infinite (\u03c3 : Type*) (R : Type*) [CommSemiring R] [Infinite R] :\n Infinite (MvPolynomial \u03c3 R) :=\nInfinite.of_injective C (C_injective _ _)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial_left_inj (L129-L132)\ntheorem monomial_left_inj {s t : \u03c3 \u2192\u2080 \u2115} {r : R} (hr : r \u2260 0) :\n monomial s r = monomial t r \u2194 s = t :=\nFinsupp.single_left_inj hr\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.MvPolynomial (L81-L91)\nabbrev MvPolynomial (\u03c3 : Type*) (R : Type*) [CommSemiring R] :=\nAddMonoidAlgebra R (\u03c3 \u2192\u2080 \u2115)\n\nnamespace MvPolynomial\n\nvariable {\u03c3 : Type*} {a a' a\u2081 a\u2082 : R} {e : \u2115} {n m : \u03c3} {s : \u03c3 \u2192\u2080 \u2115}\n\nsection CommSemiring\nvariable [CommSemiring R] [CommSemiring S\u2081] {p q : MvPolynomial \u03c3 R}\n\n/-- `monomial s a` is the monomial with coefficient `a` and exponents given by `s` -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_apply (L133-L135)\ntheorem C_apply : (C a : MvPolynomial \u03c3 R) = monomial 0 a :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.algebraMap_apply (L116-L120)\ntheorem algebraMap_apply [Algebra R S\u2081] (r : R) :\n algebraMap R (MvPolynomial \u03c3 S\u2081) r = C (algebraMap R S\u2081 r) :=\nrfl\n\n/-- `X n` is the degree `1` monomial $X_n$. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_1 (L140-L142)\ntheorem C_1 : C 1 = (1 : MvPolynomial \u03c3 R) :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_surjective (L164-L170)\ntheorem C_surjective {R : Type*} [CommSemiring R] (\u03c3 : Type*) [IsEmpty \u03c3] :\n Function.Surjective (C : R \u2192 MvPolynomial \u03c3 R) := by\nrefine fun p => \u27e8p.toFun 0, Finsupp.ext fun a => ?_\u27e9\n simp only [C_apply, \u2190 single_eq_monomial, (Finsupp.ext isEmptyElim (\u03b1 := \u03c3) : a = 0),\n single_eq_same]\n rfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_pow (L157-L159)\ntheorem C_pow (a : R) (n : \u2115) : (C (a ^ n) : MvPolynomial \u03c3 R) = C a ^ n :=\nmap_pow _ _ _\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.mul_def (L100-L103)\ntheorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b) :=\nAddMonoidAlgebra.mul_def ..\n\n/-- `C a` is the constant polynomial with value `a` -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_ne_zero (L178-L180)\nlemma C_ne_zero : (C a : MvPolynomial \u03c3 R) \u2260 0 \u2194 a \u2260 0 :=\nC_eq_zero.ne\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.nontrivial_of_nontrivial (L181-L184)\ninstance nontrivial_of_nontrivial (\u03c3 : Type*) (R : Type*) [CommSemiring R] [Nontrivial R] :\n Nontrivial (MvPolynomial \u03c3 R) :=\ninferInstanceAs (Nontrivial <| AddMonoidAlgebra R (\u03c3 \u2192\u2080 \u2115))\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C (L104-L108)\ndef C : R \u2192+* MvPolynomial \u03c3 R :=\n{ singleZeroRingHom with toFun := monomial 0 }\n\nvariable (R \u03c3)\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_mul (L153-L155)\ntheorem C_mul : (C (a * a') : MvPolynomial \u03c3 R) = C a * C a' :=\nC_mul_monomial.symm\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.algebraMap_eq (L110-L114)\ntheorem algebraMap_eq : algebraMap R (MvPolynomial \u03c3 R) = C :=\nrfl\n\nvariable {R \u03c3}\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_injective (L160-L163)\ntheorem C_injective (\u03c3 : Type*) (R : Type*) [CommSemiring R] :\n Function.Injective (C : R \u2192 MvPolynomial \u03c3 R) :=\nFinsupp.single_injective _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial (L92-L94)\ndef monomial (s : \u03c3 \u2192\u2080 \u2115) : R \u2192\u2097[R] MvPolynomial \u03c3 R :=\nAddMonoidAlgebra.lsingle s\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_mul_monomial (L143-L147)\ntheorem C_mul_monomial : C a * monomial s a' = monomial s (a * a') := by\nhave := single_mul_single 0 s a a'\n rw [zero_add] at this\n exact this\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_0 (L137-L138)\ntheorem C_0 : C 0 = (0 : MvPolynomial \u03c3 R) := map_zero _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.infinite_of_nonempty (L189-L193)\ninstance infinite_of_nonempty (\u03c3 : Type*) (R : Type*) [Nonempty \u03c3] [CommSemiring R]\n [Nontrivial R] : Infinite (MvPolynomial \u03c3 R) :=\nInfinite.of_injective ((fun s : \u03c3 \u2192\u2080 \u2115 => monomial s 1) \u2218 Finsupp.single (Classical.arbitrary \u03c3))\n <| (monomial_left_injective one_ne_zero).comp (Finsupp.single_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.Algebra.MvPolynomial.CommRing).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem totalDegree_neg (a : MvPolynomial \u03c3 R) : (-a).totalDegree = a.totalDegree\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.C_sub (L60-L62)\ntheorem C_sub : (C (a - a') : MvPolynomial \u03c3 R) = C a - C a' :=\nmap_sub _ _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.C_neg (L64-L66)\ntheorem C_neg : (C (-a) : MvPolynomial \u03c3 R) = -C a :=\nmap_neg _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.coeff_neg (L68-L70)\ntheorem coeff_neg (m : \u03c3 \u2192\u2080 \u2115) (p : MvPolynomial \u03c3 R) : coeff m (-p) = -coeff m p :=\nFinsupp.neg_apply _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.coeff_sub (L72-L74)\ntheorem coeff_sub (m : \u03c3 \u2192\u2080 \u2115) (p q : MvPolynomial \u03c3 R) : coeff m (p - q) = coeff m p - coeff m q :=\nFinsupp.sub_apply _ _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.support_neg (L76-L78)\ntheorem support_neg : (-p).support = p.support :=\nFinsupp.support_neg p\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.support_sub (L79-L86)\ntheorem support_sub [DecidableEq \u03c3] (p q : MvPolynomial \u03c3 R) :\n (p - q).support \u2286 p.support \u222a q.support :=\nFinsupp.support_sub\n\nvariable {\u03c3} (p)\n\nsection Degrees\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degrees_neg (L88-L90)\ntheorem degrees_neg (p : MvPolynomial \u03c3 R) : (-p).degrees = p.degrees := by\nrw [degrees, support_neg]; rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degrees_sub_le (L91-L98)\ntheorem degrees_sub_le [DecidableEq \u03c3] {p q : MvPolynomial \u03c3 R} :\n (p - q).degrees \u2264 p.degrees \u222a q.degrees := by\nsimpa [degrees_def] using AddMonoidAlgebra.supDegree_sub_le\n\nend Degrees\n\nsection Degrees\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degreeOf_neg (L100-L102)\ntheorem degreeOf_neg (i : \u03c3) (p : MvPolynomial \u03c3 R) : degreeOf i (-p) = degreeOf i p := by\nrw [degreeOf, degreeOf, degrees_neg]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.degreeOf_sub_le (L103-L110)\ntheorem degreeOf_sub_le (i : \u03c3) (p q : MvPolynomial \u03c3 R) :\n degreeOf i (p - q) \u2264 max (degreeOf i p) (degreeOf i q) := by\nsimpa only [sub_eq_add_neg, degreeOf_neg] using degreeOf_add_le i p (-q)\n\nend Degrees\n\nsection Vars\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.vars_neg (L112-L113)\ntheorem vars_neg : (-p).vars = p.vars := by simp [vars, degrees_neg]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.vars_sub_subset (L114-L116)\ntheorem vars_sub_subset [DecidableEq \u03c3] : (p - q).vars \u2286 p.vars \u222a q.vars := by\nconvert vars_add_subset p (-q) using 2 <;> simp [sub_eq_add_neg]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.vars_sub_of_disjoint (L118-L129)\ntheorem vars_sub_of_disjoint [DecidableEq \u03c3] (hpq : Disjoint p.vars q.vars) :\n (p - q).vars = p.vars \u222a q.vars := by\nrw [\u2190 vars_neg q] at hpq\n convert vars_add_of_disjoint hpq using 2 <;> simp [sub_eq_add_neg]\n\nend Vars\n\nsection Eval\n\nvariable [CommRing S]\nvariable (f : R \u2192+* S) (g : \u03c3 \u2192 S)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.eval\u2082_sub (L131-L133)\ntheorem eval\u2082_sub : (p - q).eval\u2082 f g = p.eval\u2082 f g - q.eval\u2082 f g :=\n(eval\u2082Hom f g).map_sub _ _\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.MvPolynomial.CommRing.eval_sub (L134-L136)\ntheorem eval_sub (f : \u03c3 \u2192 R) : eval f (p - q) = eval f p - eval f q :=\neval\u2082_sub _ _ _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_inj (L172-L175)\ntheorem C_inj {\u03c3 : Type*} (R : Type*) [CommSemiring R] (r s : R) :\n (C r : MvPolynomial \u03c3 R) = C s \u2194 r = s :=\n(C_injective \u03c3 R).eq_iff\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_add (L149-L151)\ntheorem C_add : (C (a + a') : MvPolynomial \u03c3 R) = C a + C a' :=\nFinsupp.single_add _ _ _\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial_left_injective (L124-L127)\ntheorem monomial_left_injective {r : R} (hr : r \u2260 0) :\n Function.Injective fun s : \u03c3 \u2192\u2080 \u2115 => monomial s r :=\nFinsupp.single_left_injective hr\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.one_def (L95-L96)\ntheorem one_def : (1 : MvPolynomial \u03c3 R) = monomial 0 1 := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.single_eq_monomial (L97-L99)\ntheorem single_eq_monomial (s : \u03c3 \u2192\u2080 \u2115) (a : R) : Finsupp.single s a = monomial s a :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.X (L121-L123)\ndef X (n : \u03c3) : MvPolynomial \u03c3 R :=\nmonomial (Finsupp.single n 1) 1\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.infinite_of_infinite (L185-L188)\ninstance infinite_of_infinite (\u03c3 : Type*) (R : Type*) [CommSemiring R] [Infinite R] :\n Infinite (MvPolynomial \u03c3 R) :=\nInfinite.of_injective C (C_injective _ _)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial_left_inj (L129-L132)\ntheorem monomial_left_inj {s t : \u03c3 \u2192\u2080 \u2115} {r : R} (hr : r \u2260 0) :\n monomial s r = monomial t r \u2194 s = t :=\nFinsupp.single_left_inj hr\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.MvPolynomial (L81-L91)\nabbrev MvPolynomial (\u03c3 : Type*) (R : Type*) [CommSemiring R] :=\nAddMonoidAlgebra R (\u03c3 \u2192\u2080 \u2115)\n\nnamespace MvPolynomial\n\nvariable {\u03c3 : Type*} {a a' a\u2081 a\u2082 : R} {e : \u2115} {n m : \u03c3} {s : \u03c3 \u2192\u2080 \u2115}\n\nsection CommSemiring\nvariable [CommSemiring R] [CommSemiring S\u2081] {p q : MvPolynomial \u03c3 R}\n\n/-- `monomial s a` is the monomial with coefficient `a` and exponents given by `s` -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_apply (L133-L135)\ntheorem C_apply : (C a : MvPolynomial \u03c3 R) = monomial 0 a :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.algebraMap_apply (L116-L120)\ntheorem algebraMap_apply [Algebra R S\u2081] (r : R) :\n algebraMap R (MvPolynomial \u03c3 S\u2081) r = C (algebraMap R S\u2081 r) :=\nrfl\n\n/-- `X n` is the degree `1` monomial $X_n$. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_1 (L140-L142)\ntheorem C_1 : C 1 = (1 : MvPolynomial \u03c3 R) :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_surjective (L164-L170)\ntheorem C_surjective {R : Type*} [CommSemiring R] (\u03c3 : Type*) [IsEmpty \u03c3] :\n Function.Surjective (C : R \u2192 MvPolynomial \u03c3 R) := by\nrefine fun p => \u27e8p.toFun 0, Finsupp.ext fun a => ?_\u27e9\n simp only [C_apply, \u2190 single_eq_monomial, (Finsupp.ext isEmptyElim (\u03b1 := \u03c3) : a = 0),\n single_eq_same]\n rfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_pow (L157-L159)\ntheorem C_pow (a : R) (n : \u2115) : (C (a ^ n) : MvPolynomial \u03c3 R) = C a ^ n :=\nmap_pow _ _ _\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.mul_def (L100-L103)\ntheorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b) :=\nAddMonoidAlgebra.mul_def ..\n\n/-- `C a` is the constant polynomial with value `a` -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_ne_zero (L178-L180)\nlemma C_ne_zero : (C a : MvPolynomial \u03c3 R) \u2260 0 \u2194 a \u2260 0 :=\nC_eq_zero.ne\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.nontrivial_of_nontrivial (L181-L184)\ninstance nontrivial_of_nontrivial (\u03c3 : Type*) (R : Type*) [CommSemiring R] [Nontrivial R] :\n Nontrivial (MvPolynomial \u03c3 R) :=\ninferInstanceAs (Nontrivial <| AddMonoidAlgebra R (\u03c3 \u2192\u2080 \u2115))\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C (L104-L108)\ndef C : R \u2192+* MvPolynomial \u03c3 R :=\n{ singleZeroRingHom with toFun := monomial 0 }\n\nvariable (R \u03c3)\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_mul (L153-L155)\ntheorem C_mul : (C (a * a') : MvPolynomial \u03c3 R) = C a * C a' :=\nC_mul_monomial.symm\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.algebraMap_eq (L110-L114)\ntheorem algebraMap_eq : algebraMap R (MvPolynomial \u03c3 R) = C :=\nrfl\n\nvariable {R \u03c3}\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_injective (L160-L163)\ntheorem C_injective (\u03c3 : Type*) (R : Type*) [CommSemiring R] :\n Function.Injective (C : R \u2192 MvPolynomial \u03c3 R) :=\nFinsupp.single_injective _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.monomial (L92-L94)\ndef monomial (s : \u03c3 \u2192\u2080 \u2115) : R \u2192\u2097[R] MvPolynomial \u03c3 R :=\nAddMonoidAlgebra.lsingle s\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_mul_monomial (L143-L147)\ntheorem C_mul_monomial : C a * monomial s a' = monomial s (a * a') := by\nhave := single_mul_single 0 s a a'\n rw [zero_add] at this\n exact this\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.C_0 (L137-L138)\ntheorem C_0 : C 0 = (0 : MvPolynomial \u03c3 R) := map_zero _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.MvPolynomial.Basic.infinite_of_nonempty (L189-L193)\ninstance infinite_of_nonempty (\u03c3 : Type*) (R : Type*) [Nonempty \u03c3] [CommSemiring R]\n [Nontrivial R] : Infinite (MvPolynomial \u03c3 R) :=\nInfinite.of_injective ((fun s : \u03c3 \u2192\u2080 \u2115 => monomial s 1) \u2218 Finsupp.single (Classical.arbitrary \u03c3))\n <| (monomial_left_injective one_ne_zero).comp (Finsupp.single_injective _)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/MvPolynomial/CommRing.lean", "module": "Mathlib.Algebra.MvPolynomial.CommRing", "declaration": "Mathlib.Algebra.MvPolynomial.CommRing.totalDegree_neg", "span": "L187-L189", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/MvPolynomial/CommRing.lean#L187"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3682, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 9411, "lean_code_chars": 7905, "natural_language_chars": 1506, "lean_code_ratio": 0.84, "line_count": 340, "imports_count": 0, "declarations_count": 935, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "c3695a7c92c84256", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Normed.Group.Int.norm_zpow_le_mul_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.Analysis.Normed.Group.Int)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem norm_zpow_le_mul_norm (n : \u2124) (a : \u03b1) : \u2016a ^ n\u2016 \u2264 \u2016n\u2016 * \u2016a\u2016\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.instNormedAddCommGroup (L20-L25)\ninstance instNormedAddCommGroup : NormedAddCommGroup \u2124 where\n norm n := \u2016(n : \u211d)\u2016\ndist_eq m n := by\n simp only [dist_eq, norm, cast_add, cast_neg]\n rw [abs_sub_comm, neg_add_eq_sub]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.norm_cast_real (L27-L29)\ntheorem norm_cast_real (m : \u2124) : \u2016(m : \u211d)\u2016 = \u2016m\u2016 :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.norm_eq_abs (L30-L32)\ntheorem norm_eq_abs (n : \u2124) : \u2016n\u2016 = |(n : \u211d)| :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.norm_natCast (L33-L34)\ntheorem norm_natCast (n : \u2115) : \u2016(n : \u2124)\u2016 = n := by simp [Int.norm_eq_abs]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.abs_le_floor_nnreal_iff (L42-L48)\ntheorem abs_le_floor_nnreal_iff (z : \u2124) (c : \u211d\u22650) : |z| \u2264 \u230ac\u230b\u208a \u2194 \u2016z\u2016\u208a \u2264 c := by\nrw [Int.abs_eq_natAbs, Int.ofNat_le, Nat.le_floor_iff (zero_le c), NNReal.natCast_natAbs z]\n\nend Int\n\n-- Now that we've installed the norm on `\u2124`,\n-- we can state some lemmas about `zsmul`.\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.nnnorm_zpow_le_mul_norm (L58-L60)\ntheorem nnnorm_zpow_le_mul_norm (n : \u2124) (a : \u03b1) : \u2016a ^ n\u2016\u208a \u2264 \u2016n\u2016\u208a * \u2016a\u2016\u208a := by\nsimpa only [\u2190 NNReal.coe_le_coe, NNReal.coe_mul] using norm_zpow_le_mul_norm n a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_lineMap (L67-L70)\ntheorem nndist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = nndist c\u2081 c\u2082 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_lineMap _ _ _ _\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_right (L159-L162)\ntheorem nndist_midpoint_right (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_right _ _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_right_lineMap (L104-L106)\ntheorem dist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_right _ _ _)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_center_homothety (L41-L44)\ntheorem dist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimp [homothety_def, norm_smul, \u2190 dist_eq_norm_vsub, dist_comm]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_lineMap (L60-L65)\ntheorem dist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = dist c\u2081 c\u2082 * dist p\u2081 p\u2082 := by\nrw [dist_comm p\u2081 p\u2082]\n simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right,\n \u2190 sub_smul, norm_smul, vsub_eq_sub]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_right (L99-L102)\ntheorem nndist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_right _ _ _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_center (L55-L58)\ntheorem nndist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_center _ _ _\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_self (L113-L116)\ntheorem dist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nrw [homothety_eq_lineMap, dist_lineMap_right]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_left (L80-L83)\ntheorem nndist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_left _ _ _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_self_homothety (L123-L125)\ntheorem dist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_homothety_self]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_left (L76-L78)\ntheorem dist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p\u2081 p\u2082 c 0\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_right (L94-L97)\ntheorem dist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_one, dist_eq_norm'] using dist_lineMap_lineMap p\u2081 p\u2082 c 1\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_right (L154-L157)\ntheorem dist_midpoint_right (p\u2081 p\u2082 : P) :\n dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint_comm, dist_midpoint_left, dist_comm]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_lineMap (L89-L92)\ntheorem nndist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_lineMap _ _ _\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_lineMap (L85-L87)\ntheorem dist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_left _ _ _)\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_midpoint (L140-L143)\ntheorem nndist_left_midpoint (p\u2081 p\u2082 : P) :\n nndist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_midpoint _ _\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_center_homothety (L46-L49)\ntheorem nndist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_center_homothety _ _ _\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_left (L149-L152)\ntheorem nndist_midpoint_left (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_left _ _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_self_homothety (L127-L134)\ntheorem nndist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_self_homothety _ _ _\n\nsection invertibleTwo\n\nvariable [Invertible (2 : \ud835\udd5c)]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_right_lineMap (L108-L111)\ntheorem nndist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_right_lineMap _ _ _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.lipschitzWith_lineMap (L71-L74)\ntheorem lipschitzWith_lineMap (p\u2081 p\u2082 : P) : LipschitzWith (nndist p\u2081 p\u2082) (lineMap p\u2081 p\u2082 : \ud835\udd5c \u2192 P) :=\nLipschitzWith.of_dist_le_mul fun c\u2081 c\u2082 =>\n ((dist_lineMap_lineMap p\u2081 p\u2082 c\u2081 c\u2082).trans (mul_comm _ _)).le\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_center (L51-L53)\ntheorem dist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_center_homothety]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_left (L145-L147)\ntheorem dist_midpoint_left (p\u2081 p\u2082 : P) : dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [dist_comm, dist_left_midpoint]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_midpoint (L136-L138)\ntheorem dist_left_midpoint (p\u2081 p\u2082 : P) : dist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint, dist_comm, dist_lineMap_left, invOf_eq_inv, \u2190 norm_inv]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_self (L118-L121)\ntheorem nndist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_self _ _ _\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.Analysis.Normed.Group.Int).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem norm_zpow_le_mul_norm (n : \u2124) (a : \u03b1) : \u2016a ^ n\u2016 \u2264 \u2016n\u2016 * \u2016a\u2016\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.instNormedAddCommGroup (L20-L25)\ninstance instNormedAddCommGroup : NormedAddCommGroup \u2124 where\n norm n := \u2016(n : \u211d)\u2016\ndist_eq m n := by\n simp only [dist_eq, norm, cast_add, cast_neg]\n rw [abs_sub_comm, neg_add_eq_sub]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.norm_cast_real (L27-L29)\ntheorem norm_cast_real (m : \u2124) : \u2016(m : \u211d)\u2016 = \u2016m\u2016 :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.norm_eq_abs (L30-L32)\ntheorem norm_eq_abs (n : \u2124) : \u2016n\u2016 = |(n : \u211d)| :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.norm_natCast (L33-L34)\ntheorem norm_natCast (n : \u2115) : \u2016(n : \u2124)\u2016 = n := by simp [Int.norm_eq_abs]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.abs_le_floor_nnreal_iff (L42-L48)\ntheorem abs_le_floor_nnreal_iff (z : \u2124) (c : \u211d\u22650) : |z| \u2264 \u230ac\u230b\u208a \u2194 \u2016z\u2016\u208a \u2264 c := by\nrw [Int.abs_eq_natAbs, Int.ofNat_le, Nat.le_floor_iff (zero_le c), NNReal.natCast_natAbs z]\n\nend Int\n\n-- Now that we've installed the norm on `\u2124`,\n-- we can state some lemmas about `zsmul`.\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Normed.Group.Int.nnnorm_zpow_le_mul_norm (L58-L60)\ntheorem nnnorm_zpow_le_mul_norm (n : \u2124) (a : \u03b1) : \u2016a ^ n\u2016\u208a \u2264 \u2016n\u2016\u208a * \u2016a\u2016\u208a := by\nsimpa only [\u2190 NNReal.coe_le_coe, NNReal.coe_mul] using norm_zpow_le_mul_norm n a\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_lineMap (L67-L70)\ntheorem nndist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = nndist c\u2081 c\u2082 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_lineMap _ _ _ _\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_right (L159-L162)\ntheorem nndist_midpoint_right (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_right _ _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_right_lineMap (L104-L106)\ntheorem dist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_right _ _ _)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_center_homothety (L41-L44)\ntheorem dist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimp [homothety_def, norm_smul, \u2190 dist_eq_norm_vsub, dist_comm]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_lineMap (L60-L65)\ntheorem dist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = dist c\u2081 c\u2082 * dist p\u2081 p\u2082 := by\nrw [dist_comm p\u2081 p\u2082]\n simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right,\n \u2190 sub_smul, norm_smul, vsub_eq_sub]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_right (L99-L102)\ntheorem nndist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_right _ _ _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_center (L55-L58)\ntheorem nndist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_center _ _ _\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_self (L113-L116)\ntheorem dist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nrw [homothety_eq_lineMap, dist_lineMap_right]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_left (L80-L83)\ntheorem nndist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_left _ _ _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_self_homothety (L123-L125)\ntheorem dist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_homothety_self]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_left (L76-L78)\ntheorem dist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p\u2081 p\u2082 c 0\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_right (L94-L97)\ntheorem dist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_one, dist_eq_norm'] using dist_lineMap_lineMap p\u2081 p\u2082 c 1\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_right (L154-L157)\ntheorem dist_midpoint_right (p\u2081 p\u2082 : P) :\n dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint_comm, dist_midpoint_left, dist_comm]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_lineMap (L89-L92)\ntheorem nndist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_lineMap _ _ _\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_lineMap (L85-L87)\ntheorem dist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_left _ _ _)\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_midpoint (L140-L143)\ntheorem nndist_left_midpoint (p\u2081 p\u2082 : P) :\n nndist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_midpoint _ _\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_center_homothety (L46-L49)\ntheorem nndist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_center_homothety _ _ _\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_left (L149-L152)\ntheorem nndist_midpoint_left (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_left _ _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_self_homothety (L127-L134)\ntheorem nndist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_self_homothety _ _ _\n\nsection invertibleTwo\n\nvariable [Invertible (2 : \ud835\udd5c)]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_right_lineMap (L108-L111)\ntheorem nndist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_right_lineMap _ _ _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.lipschitzWith_lineMap (L71-L74)\ntheorem lipschitzWith_lineMap (p\u2081 p\u2082 : P) : LipschitzWith (nndist p\u2081 p\u2082) (lineMap p\u2081 p\u2082 : \ud835\udd5c \u2192 P) :=\nLipschitzWith.of_dist_le_mul fun c\u2081 c\u2082 =>\n ((dist_lineMap_lineMap p\u2081 p\u2082 c\u2081 c\u2082).trans (mul_comm _ _)).le\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_center (L51-L53)\ntheorem dist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_center_homothety]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_left (L145-L147)\ntheorem dist_midpoint_left (p\u2081 p\u2082 : P) : dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [dist_comm, dist_left_midpoint]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_midpoint (L136-L138)\ntheorem dist_left_midpoint (p\u2081 p\u2082 : P) : dist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint, dist_comm, dist_lineMap_left, invOf_eq_inv, \u2190 norm_inv]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_self (L118-L121)\ntheorem nndist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_self _ _ _\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Normed/Group/Int.lean", "module": "Mathlib.Analysis.Normed.Group.Int", "declaration": "Mathlib.Analysis.Normed.Group.Int.norm_zpow_le_mul_norm", "span": "L54-L56", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Group/Int.lean#L54"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3780, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 8528, "lean_code_chars": 7269, "natural_language_chars": 1259, "lean_code_ratio": 0.8524, "line_count": 255, "imports_count": 0, "declarations_count": 850, "diagnostics_count": 0, "retrieval_snippets_count": 31, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "68cd79c5d6b254f8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.Filter.Map.map_biInf_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.Order.Filter.Map)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem map_biInf_eq {\u03b9 : Type w} {f : \u03b9 \u2192 Filter \u03b1} {m : \u03b1 \u2192 \u03b2} {p : \u03b9 \u2192 Prop}\n (h : DirectedOn (f \u207b\u00b9'o (\u00b7 \u2265 \u00b7)) { x | p x }) (ne : \u2203 i, p i) :\n map m (\u2a05 (i) (_ : p i), f i) = \u2a05 (i) (_ : p i), map m (f i)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Filter.Map.map_principal (L34-L38)\ntheorem map_principal {s : Set \u03b1} {f : \u03b1 \u2192 \u03b2} : map f (\ud835\udcdf s) = \ud835\udcdf (Set.image f s) :=\nFilter.ext fun _ => image_subset_iff.symm\n\nvariable {f : Filter \u03b1} {m : \u03b1 \u2192 \u03b2} {m' : \u03b2 \u2192 \u03b3} {s : Set \u03b1} {t : Set \u03b2}\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Filter.Map.eventually_map (L40-L42)\ntheorem eventually_map {P : \u03b2 \u2192 Prop} : (\u2200\u1da0 b in map m f, P b) \u2194 \u2200\u1da0 a in f, P (m a) :=\nIff.rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Filter.Map.frequently_map (L44-L46)\ntheorem frequently_map {P : \u03b2 \u2192 Prop} : (\u2203\u1da0 b in map m f, P b) \u2194 \u2203\u1da0 a in f, P (m a) :=\nIff.rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Filter.Map.eventuallyEq_map (L48-L49)\ntheorem eventuallyEq_map {f\u2081 f\u2082 : \u03b2 \u2192 \u03b3} : f\u2081 =\u1da0[map m f] f\u2082 \u2194 f\u2081 \u2218 m =\u1da0[f] f\u2082 \u2218 m := .rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Filter.Map.eventuallyLE_map (L51-L52)\ntheorem eventuallyLE_map [LE \u03b3] {f\u2081 f\u2082 : \u03b2 \u2192 \u03b3} : f\u2081 \u2264\u1da0[map m f] f\u2082 \u2194 f\u2081 \u2218 m \u2264\u1da0[f] f\u2082 \u2218 m := .rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Filter.Map.mem_map (L54-L56)\ntheorem mem_map : t \u2208 map m f \u2194 m \u207b\u00b9' t \u2208 f :=\nIff.rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Filter.Map.mem_map' (L57-L59)\ntheorem mem_map' : t \u2208 map m f \u2194 { x | m x \u2208 t } \u2208 f :=\nIff.rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Filter.Map.image_mem_map (L60-L66)\ntheorem image_mem_map (hs : s \u2208 f) : m '' s \u2208 map m f :=\nf.sets_of_superset hs <| subset_preimage_image m s\n\n-- The simpNF linter says that the LHS can be simplified via `Filter.mem_map`.\n-- However this is a higher priority lemma.\n-- It seems the side condition `hf` is not applied by `simpNF`.\n-- https://github.com/leanprover/std4/issues/207\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Filter.Map.image_mem_map_iff (L68-L70)\ntheorem image_mem_map_iff (hf : Injective m) : m '' s \u2208 map m f \u2194 s \u2208 f :=\n\u27e8fun h => by rwa [\u2190 preimage_image_eq s hf], image_mem_map\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Filter.Map.range_mem_map (L71-L74)\ntheorem range_mem_map : range m \u2208 map m f := by\nrw [\u2190 image_univ]\n exact image_mem_map univ_mem\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Filter.Map.mem_map_iff_exists_image (L75-L78)\ntheorem mem_map_iff_exists_image : t \u2208 map m f \u2194 \u2203 s \u2208 f, m '' s \u2286 t :=\n\u27e8fun ht => \u27e8m \u207b\u00b9' t, ht, image_preimage_subset _ _\u27e9, fun \u27e8_, hs, ht\u27e9 =>\n mem_of_superset (image_mem_map hs) ht\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Filter.Map.map_id (L80-L82)\ntheorem map_id : Filter.map id f = f :=\nfilter_eq <| rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Filter.Map.map_id' (L84-L86)\ntheorem map_id' : Filter.map (fun x => x) f = f :=\nmap_id\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Filter.Map.map_compose (L88-L90)\ntheorem map_compose : Filter.map m' \u2218 Filter.map m = Filter.map (m' \u2218 m) :=\nfunext fun _ => filter_eq <| rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.Filter.Map.map_map (L92-L96)\ntheorem map_map : Filter.map m' (Filter.map m f) = Filter.map (m' \u2218 m) f :=\ncongr_fun Filter.map_compose f\n\n/-- If functions `m\u2081` and `m\u2082` are eventually equal at a filter `f`, then\nthey map this filter to the same filter. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_ratCast_atBot_iff (L113-L117)\ntheorem tendsto_ratCast_atBot_iff [Field R] [LinearOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u211a}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atBot \u2194 Tendsto f l atBot := by\nrw [\u2190 @Rat.comap_cast_atBot R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.map_add_atTop_eq (L161-L164)\ntheorem map_add_atTop_eq [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n [IsDirectedOrder \u03b1] (k : \u03b1) : map (fun a => a + k) atTop = atTop :=\nmap_atTop_eq_of_gc (fun a => a - k) 0 add_left_mono (by simp [le_sub_iff_add_le]) (by simp)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_intCast_atTop_iff (L70-L74)\ntheorem tendsto_intCast_atTop_iff [Ring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R]\n {f : \u03b1 \u2192 \u2124}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop := by\nrw [\u2190 @Int.comap_cast_atTop R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.atTop_hasAntitoneBasis_of_archimedean (L128-L132)\ntheorem atTop_hasAntitoneBasis_of_archimedean [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n (atTop : Filter R).HasAntitoneBasis fun n : \u2115 => Ici n :=\nhasAntitoneBasis_atTop.comp_mono Nat.mono_cast tendsto_natCast_atTop_atTop\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.hasAntitoneBasis_atTop (L32-L34)\ntheorem hasAntitoneBasis_atTop [Nonempty \u03b1] : (@atTop \u03b1 _).HasAntitoneBasis Ici :=\n.iInf_principal fun _ _ \u21a6 Ici_subset_Ici.2\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_neBot (L58-L59)\nlemma atTop_neBot : NeBot (atTop : Filter \u03b1) := atTop_basis.neBot_iff.2 fun _ => nonempty_Ici\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Filter (L52-L56)\ntheorem Filter.Eventually.natCast_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] {p : R \u2192 Prop}\n (h : \u2200\u1da0 (x : R) in atTop, p x) : \u2200\u1da0 (n : \u2115) in atTop, p n :=\ntendsto_natCast_atTop_atTop.eventually h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_intCast_atBot_iff (L75-L79)\ntheorem tendsto_intCast_atBot_iff [Ring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u2124}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atBot \u2194 Tendsto f l atBot := by\nrw [\u2190 @Int.comap_cast_atBot R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis_Ioi' (L42-L48)\nlemma atTop_basis_Ioi' [NoMaxOrder \u03b1] (a : \u03b1) : atTop.HasBasis (a < \u00b7) Ioi := by\nhave : Nonempty \u03b1 := \u27e8a\u27e9\n refine atTop_basis_Ioi.to_hasBasis (fun b _ \u21a6 ?_) fun b _ \u21a6 \u27e8b, trivial, Subset.rfl\u27e9\n obtain \u27e8c, hac, hbc\u27e9 := exists_ge_ge a b\n obtain \u27e8d, hcd\u27e9 := exists_gt c\n exact \u27e8d, hac.trans_lt hcd, Ioi_subset_Ioi (hbc.trans hcd.le)\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis_Ioi (L38-L41)\nlemma atTop_basis_Ioi [Nonempty \u03b1] [NoMaxOrder \u03b1] : (@atTop \u03b1 _).HasBasis (fun _ => True) Ioi :=\natTop_basis.to_hasBasis (fun a ha => \u27e8a, ha, Ioi_subset_Ici_self\u27e9) fun a ha =>\n (exists_gt a).imp fun _b hb => \u27e8ha, Ici_subset_Ioi.2 hb\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_ratCast_atTop_iff (L108-L112)\ntheorem tendsto_ratCast_atTop_iff [Field R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R]\n {f : \u03b1 \u2192 \u211a}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop := by\nrw [\u2190 @Rat.comap_cast_atTop R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.PNat (L40-L43)\ntheorem PNat.tendsto_comp_val_iff {\u03b2 : Type*} {f : \u2115 \u2192 \u03b2} {l : Filter \u03b2} :\n Tendsto (fun x : \u2115+ => f x) atTop l \u2194 Tendsto f atTop l := by\nexact tendsto_comp_val_Ioi_atTop\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.atBot_hasCountableBasis_of_archimedean (L138-L146)\ntheorem atBot_hasCountableBasis_of_archimedean [Ring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n (atBot : Filter R).HasCountableBasis (fun _ : \u2124 => True) fun m => Iic m where\n countable := to_countable _\ntoHasBasis :=\n atBot_basis.to_hasBasis\n (fun x _ => let \u27e8m, hm\u27e9 := exists_int_le x; \u27e8m, trivial, Iic_subset_Iic.2 hm\u27e9)\n fun m _ => \u27e8m, trivial, Subset.rfl\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_iff (L35-L39)\ntheorem tendsto_natCast_atTop_iff [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u2115}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop :=\ntendsto_atTop_embedding (fun _ _ => Nat.cast_le) exists_nat_ge\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.atTop_hasCountableBasis_of_archimedean (L133-L137)\ntheorem atTop_hasCountableBasis_of_archimedean [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n (atTop : Filter R).HasCountableBasis (fun _ : \u2115 => True) fun n => Ici n :=\n\u27e8atTop_hasAntitoneBasis_of_archimedean.1, to_countable _\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_atTop (L44-L48)\ntheorem tendsto_natCast_atTop_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n Tendsto ((\u2191) : \u2115 \u2192 R) atTop atTop :=\nNat.mono_cast.tendsto_atTop_atTop exists_nat_ge\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Nat (L31-L34)\ntheorem Nat.comap_cast_atTop [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u2115 \u2192 R) atTop = atTop :=\ncomap_embedding_atTop (fun _ _ => Nat.cast_le) exists_nat_ge\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_PNat_val_atTop_atTop (L49-L51)\nlemma tendsto_PNat_val_atTop_atTop : Tendsto PNat.val atTop atTop :=\ntendsto_atTop_atTop_of_monotone (fun _ _ h \u21a6 h) fun a \u21a6 \u27e8Nat.succPNat a, Nat.le_succ a\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Int (L64-L69)\ntheorem Int.comap_cast_atBot [Ring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u2124 \u2192 R) atBot = atBot :=\ncomap_embedding_atBot (fun _ _ => Int.cast_le) fun r =>\n let \u27e8n, hn\u27e9 := exists_nat_ge (-r)\n \u27e8-n, by simpa [neg_le] using hn\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_intCast_atTop_atTop (L80-L84)\ntheorem tendsto_intCast_atTop_atTop [Ring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] :\n Tendsto ((\u2191) : \u2124 \u2192 R) atTop atTop :=\ntendsto_intCast_atTop_iff.2 tendsto_id\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.map_sub_atTop_eq (L165-L177)\ntheorem map_sub_atTop_eq [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n [IsDirectedOrder \u03b1] (k : \u03b1) : map (fun a => a - k) atTop = atTop := by\nsimp_rw [sub_eq_add_neg]\n apply map_add_atTop_eq\n\nsection LinearOrderedSemiring\n\nvariable [Semiring R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R]\n\n/-- If a function tends to infinity along a filter, then this function multiplied by a positive\nconstant (on the left) also tends to infinity. The archimedean assumption is convenient to get a\nstatement that works on `\u2115`, `\u2124` and `\u211d`, although not necessary (a version in ordered fields is\ngiven in `Filter.Tendsto.const_mul_atTop`). -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis (L35-L37)\ntheorem atTop_basis [Nonempty \u03b1] : (@atTop \u03b1 _).HasBasis (fun _ => True) Ici :=\nhasAntitoneBasis_atTop.1\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Rat (L96-L100)\ntheorem Rat.comap_cast_atTop [Field R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u211a \u2192 R) atTop = atTop :=\ncomap_embedding_atTop (fun _ _ => Rat.cast_le) fun r =>\n let \u27e8n, hn\u27e9 := exists_nat_ge r; \u27e8n, by simpa\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Tendsto (L178-L195)\ntheorem Tendsto.const_mul_atTop' (hr : 0 < r) (hf : Tendsto f l atTop) :\n Tendsto (fun x => r * f x) l atTop := by\nrefine tendsto_atTop.2 fun b => ?_\n obtain \u27e8n : \u2115, hn : 1 \u2264 n \u2022 r\u27e9 := Archimedean.arch 1 hr\n rw [nsmul_eq_mul'] at hn\n filter_upwards [tendsto_atTop.1 hf (n * max b 0)] with x hx\n calc\n b \u2264 1 * max b 0 := by\n { rw [one_mul]\n exact le_max_left _ _ }\n _ \u2264 r * n * max b 0 := by gcongr\n _ = r * (n * max b 0) := by rw [mul_assoc]\n _ \u2264 r * f x := by gcongr\n\n/-- If a function tends to infinity along a filter, then this function multiplied by a positive\nconstant (on the right) also tends to infinity. The archimedean assumption is convenient to get a\nstatement that works on `\u2115`, `\u2124` and `\u211d`, although not necessary (a version in ordered fields is\ngiven in `Filter.Tendsto.atTop_mul_const`). -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis' (L49-L56)\ntheorem atTop_basis' (a : \u03b1) : atTop.HasBasis (a \u2264 \u00b7) Ici := by\nhave : Nonempty \u03b1 := \u27e8a\u27e9\n refine atTop_basis.to_hasBasis (fun b _ \u21a6 ?_) fun b _ \u21a6 \u27e8b, trivial, Subset.rfl\u27e9\n obtain \u27e8c, hac, hbc\u27e9 := exists_ge_ge a b\n exact \u27e8c, hac, Ici_subset_Ici.2 hbc\u27e9\n\nvariable [Nonempty \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.Order.Filter.Map).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem map_biInf_eq {\u03b9 : Type w} {f : \u03b9 \u2192 Filter \u03b1} {m : \u03b1 \u2192 \u03b2} {p : \u03b9 \u2192 Prop}\n (h : DirectedOn (f \u207b\u00b9'o (\u00b7 \u2265 \u00b7)) { x | p x }) (ne : \u2203 i, p i) :\n map m (\u2a05 (i) (_ : p i), f i) = \u2a05 (i) (_ : p i), map m (f i)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Filter.Map.map_principal (L34-L38)\ntheorem map_principal {s : Set \u03b1} {f : \u03b1 \u2192 \u03b2} : map f (\ud835\udcdf s) = \ud835\udcdf (Set.image f s) :=\nFilter.ext fun _ => image_subset_iff.symm\n\nvariable {f : Filter \u03b1} {m : \u03b1 \u2192 \u03b2} {m' : \u03b2 \u2192 \u03b3} {s : Set \u03b1} {t : Set \u03b2}\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Filter.Map.eventually_map (L40-L42)\ntheorem eventually_map {P : \u03b2 \u2192 Prop} : (\u2200\u1da0 b in map m f, P b) \u2194 \u2200\u1da0 a in f, P (m a) :=\nIff.rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Filter.Map.frequently_map (L44-L46)\ntheorem frequently_map {P : \u03b2 \u2192 Prop} : (\u2203\u1da0 b in map m f, P b) \u2194 \u2203\u1da0 a in f, P (m a) :=\nIff.rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Filter.Map.eventuallyEq_map (L48-L49)\ntheorem eventuallyEq_map {f\u2081 f\u2082 : \u03b2 \u2192 \u03b3} : f\u2081 =\u1da0[map m f] f\u2082 \u2194 f\u2081 \u2218 m =\u1da0[f] f\u2082 \u2218 m := .rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Filter.Map.eventuallyLE_map (L51-L52)\ntheorem eventuallyLE_map [LE \u03b3] {f\u2081 f\u2082 : \u03b2 \u2192 \u03b3} : f\u2081 \u2264\u1da0[map m f] f\u2082 \u2194 f\u2081 \u2218 m \u2264\u1da0[f] f\u2082 \u2218 m := .rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Filter.Map.mem_map (L54-L56)\ntheorem mem_map : t \u2208 map m f \u2194 m \u207b\u00b9' t \u2208 f :=\nIff.rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Filter.Map.mem_map' (L57-L59)\ntheorem mem_map' : t \u2208 map m f \u2194 { x | m x \u2208 t } \u2208 f :=\nIff.rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Filter.Map.image_mem_map (L60-L66)\ntheorem image_mem_map (hs : s \u2208 f) : m '' s \u2208 map m f :=\nf.sets_of_superset hs <| subset_preimage_image m s\n\n-- The simpNF linter says that the LHS can be simplified via `Filter.mem_map`.\n-- However this is a higher priority lemma.\n-- It seems the side condition `hf` is not applied by `simpNF`.\n-- https://github.com/leanprover/std4/issues/207\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Filter.Map.image_mem_map_iff (L68-L70)\ntheorem image_mem_map_iff (hf : Injective m) : m '' s \u2208 map m f \u2194 s \u2208 f :=\n\u27e8fun h => by rwa [\u2190 preimage_image_eq s hf], image_mem_map\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Filter.Map.range_mem_map (L71-L74)\ntheorem range_mem_map : range m \u2208 map m f := by\nrw [\u2190 image_univ]\n exact image_mem_map univ_mem\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Filter.Map.mem_map_iff_exists_image (L75-L78)\ntheorem mem_map_iff_exists_image : t \u2208 map m f \u2194 \u2203 s \u2208 f, m '' s \u2286 t :=\n\u27e8fun ht => \u27e8m \u207b\u00b9' t, ht, image_preimage_subset _ _\u27e9, fun \u27e8_, hs, ht\u27e9 =>\n mem_of_superset (image_mem_map hs) ht\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Filter.Map.map_id (L80-L82)\ntheorem map_id : Filter.map id f = f :=\nfilter_eq <| rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Filter.Map.map_id' (L84-L86)\ntheorem map_id' : Filter.map (fun x => x) f = f :=\nmap_id\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Filter.Map.map_compose (L88-L90)\ntheorem map_compose : Filter.map m' \u2218 Filter.map m = Filter.map (m' \u2218 m) :=\nfunext fun _ => filter_eq <| rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.Filter.Map.map_map (L92-L96)\ntheorem map_map : Filter.map m' (Filter.map m f) = Filter.map (m' \u2218 m) f :=\ncongr_fun Filter.map_compose f\n\n/-- If functions `m\u2081` and `m\u2082` are eventually equal at a filter `f`, then\nthey map this filter to the same filter. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_ratCast_atBot_iff (L113-L117)\ntheorem tendsto_ratCast_atBot_iff [Field R] [LinearOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u211a}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atBot \u2194 Tendsto f l atBot := by\nrw [\u2190 @Rat.comap_cast_atBot R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.map_add_atTop_eq (L161-L164)\ntheorem map_add_atTop_eq [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n [IsDirectedOrder \u03b1] (k : \u03b1) : map (fun a => a + k) atTop = atTop :=\nmap_atTop_eq_of_gc (fun a => a - k) 0 add_left_mono (by simp [le_sub_iff_add_le]) (by simp)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_intCast_atTop_iff (L70-L74)\ntheorem tendsto_intCast_atTop_iff [Ring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R]\n {f : \u03b1 \u2192 \u2124}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop := by\nrw [\u2190 @Int.comap_cast_atTop R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.atTop_hasAntitoneBasis_of_archimedean (L128-L132)\ntheorem atTop_hasAntitoneBasis_of_archimedean [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n (atTop : Filter R).HasAntitoneBasis fun n : \u2115 => Ici n :=\nhasAntitoneBasis_atTop.comp_mono Nat.mono_cast tendsto_natCast_atTop_atTop\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.hasAntitoneBasis_atTop (L32-L34)\ntheorem hasAntitoneBasis_atTop [Nonempty \u03b1] : (@atTop \u03b1 _).HasAntitoneBasis Ici :=\n.iInf_principal fun _ _ \u21a6 Ici_subset_Ici.2\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_neBot (L58-L59)\nlemma atTop_neBot : NeBot (atTop : Filter \u03b1) := atTop_basis.neBot_iff.2 fun _ => nonempty_Ici\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Filter (L52-L56)\ntheorem Filter.Eventually.natCast_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] {p : R \u2192 Prop}\n (h : \u2200\u1da0 (x : R) in atTop, p x) : \u2200\u1da0 (n : \u2115) in atTop, p n :=\ntendsto_natCast_atTop_atTop.eventually h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_intCast_atBot_iff (L75-L79)\ntheorem tendsto_intCast_atBot_iff [Ring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u2124}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atBot \u2194 Tendsto f l atBot := by\nrw [\u2190 @Int.comap_cast_atBot R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis_Ioi' (L42-L48)\nlemma atTop_basis_Ioi' [NoMaxOrder \u03b1] (a : \u03b1) : atTop.HasBasis (a < \u00b7) Ioi := by\nhave : Nonempty \u03b1 := \u27e8a\u27e9\n refine atTop_basis_Ioi.to_hasBasis (fun b _ \u21a6 ?_) fun b _ \u21a6 \u27e8b, trivial, Subset.rfl\u27e9\n obtain \u27e8c, hac, hbc\u27e9 := exists_ge_ge a b\n obtain \u27e8d, hcd\u27e9 := exists_gt c\n exact \u27e8d, hac.trans_lt hcd, Ioi_subset_Ioi (hbc.trans hcd.le)\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis_Ioi (L38-L41)\nlemma atTop_basis_Ioi [Nonempty \u03b1] [NoMaxOrder \u03b1] : (@atTop \u03b1 _).HasBasis (fun _ => True) Ioi :=\natTop_basis.to_hasBasis (fun a ha => \u27e8a, ha, Ioi_subset_Ici_self\u27e9) fun a ha =>\n (exists_gt a).imp fun _b hb => \u27e8ha, Ici_subset_Ioi.2 hb\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_ratCast_atTop_iff (L108-L112)\ntheorem tendsto_ratCast_atTop_iff [Field R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R]\n {f : \u03b1 \u2192 \u211a}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop := by\nrw [\u2190 @Rat.comap_cast_atTop R, tendsto_comap_iff]; rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.PNat (L40-L43)\ntheorem PNat.tendsto_comp_val_iff {\u03b2 : Type*} {f : \u2115 \u2192 \u03b2} {l : Filter \u03b2} :\n Tendsto (fun x : \u2115+ => f x) atTop l \u2194 Tendsto f atTop l := by\nexact tendsto_comp_val_Ioi_atTop\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.atBot_hasCountableBasis_of_archimedean (L138-L146)\ntheorem atBot_hasCountableBasis_of_archimedean [Ring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n (atBot : Filter R).HasCountableBasis (fun _ : \u2124 => True) fun m => Iic m where\n countable := to_countable _\ntoHasBasis :=\n atBot_basis.to_hasBasis\n (fun x _ => let \u27e8m, hm\u27e9 := exists_int_le x; \u27e8m, trivial, Iic_subset_Iic.2 hm\u27e9)\n fun m _ => \u27e8m, trivial, Subset.rfl\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_iff (L35-L39)\ntheorem tendsto_natCast_atTop_iff [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] {f : \u03b1 \u2192 \u2115}\n {l : Filter \u03b1} : Tendsto (fun n => (f n : R)) l atTop \u2194 Tendsto f l atTop :=\ntendsto_atTop_embedding (fun _ _ => Nat.cast_le) exists_nat_ge\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.atTop_hasCountableBasis_of_archimedean (L133-L137)\ntheorem atTop_hasCountableBasis_of_archimedean [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n (atTop : Filter R).HasCountableBasis (fun _ : \u2115 => True) fun n => Ici n :=\n\u27e8atTop_hasAntitoneBasis_of_archimedean.1, to_countable _\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_atTop (L44-L48)\ntheorem tendsto_natCast_atTop_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]\n [Archimedean R] :\n Tendsto ((\u2191) : \u2115 \u2192 R) atTop atTop :=\nNat.mono_cast.tendsto_atTop_atTop exists_nat_ge\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Nat (L31-L34)\ntheorem Nat.comap_cast_atTop [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u2115 \u2192 R) atTop = atTop :=\ncomap_embedding_atTop (fun _ _ => Nat.cast_le) exists_nat_ge\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_PNat_val_atTop_atTop (L49-L51)\nlemma tendsto_PNat_val_atTop_atTop : Tendsto PNat.val atTop atTop :=\ntendsto_atTop_atTop_of_monotone (fun _ _ h \u21a6 h) fun a \u21a6 \u27e8Nat.succPNat a, Nat.le_succ a\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Int (L64-L69)\ntheorem Int.comap_cast_atBot [Ring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u2124 \u2192 R) atBot = atBot :=\ncomap_embedding_atBot (fun _ _ => Int.cast_le) fun r =>\n let \u27e8n, hn\u27e9 := exists_nat_ge (-r)\n \u27e8-n, by simpa [neg_le] using hn\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_intCast_atTop_atTop (L80-L84)\ntheorem tendsto_intCast_atTop_atTop [Ring R] [PartialOrder R] [IsStrictOrderedRing R]\n [Archimedean R] :\n Tendsto ((\u2191) : \u2124 \u2192 R) atTop atTop :=\ntendsto_intCast_atTop_iff.2 tendsto_id\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.map_sub_atTop_eq (L165-L177)\ntheorem map_sub_atTop_eq [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n [IsDirectedOrder \u03b1] (k : \u03b1) : map (fun a => a - k) atTop = atTop := by\nsimp_rw [sub_eq_add_neg]\n apply map_add_atTop_eq\n\nsection LinearOrderedSemiring\n\nvariable [Semiring R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R]\n\n/-- If a function tends to infinity along a filter, then this function multiplied by a positive\nconstant (on the left) also tends to infinity. The archimedean assumption is convenient to get a\nstatement that works on `\u2115`, `\u2124` and `\u211d`, although not necessary (a version in ordered fields is\ngiven in `Filter.Tendsto.const_mul_atTop`). -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis (L35-L37)\ntheorem atTop_basis [Nonempty \u03b1] : (@atTop \u03b1 _).HasBasis (fun _ => True) Ici :=\nhasAntitoneBasis_atTop.1\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Rat (L96-L100)\ntheorem Rat.comap_cast_atTop [Field R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R] :\n comap ((\u2191) : \u211a \u2192 R) atTop = atTop :=\ncomap_embedding_atTop (fun _ _ => Rat.cast_le) fun r =>\n let \u27e8n, hn\u27e9 := exists_nat_ge r; \u27e8n, by simpa\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Archimedean.Tendsto (L178-L195)\ntheorem Tendsto.const_mul_atTop' (hr : 0 < r) (hf : Tendsto f l atTop) :\n Tendsto (fun x => r * f x) l atTop := by\nrefine tendsto_atTop.2 fun b => ?_\n obtain \u27e8n : \u2115, hn : 1 \u2264 n \u2022 r\u27e9 := Archimedean.arch 1 hr\n rw [nsmul_eq_mul'] at hn\n filter_upwards [tendsto_atTop.1 hf (n * max b 0)] with x hx\n calc\n b \u2264 1 * max b 0 := by\n { rw [one_mul]\n exact le_max_left _ _ }\n _ \u2264 r * n * max b 0 := by gcongr\n _ = r * (n * max b 0) := by rw [mul_assoc]\n _ \u2264 r * f x := by gcongr\n\n/-- If a function tends to infinity along a filter, then this function multiplied by a positive\nconstant (on the right) also tends to infinity. The archimedean assumption is convenient to get a\nstatement that works on `\u2115`, `\u2124` and `\u211d`, although not necessary (a version in ordered fields is\ngiven in `Filter.Tendsto.atTop_mul_const`). -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.Filter.AtTopBot.Basic.atTop_basis' (L49-L56)\ntheorem atTop_basis' (a : \u03b1) : atTop.HasBasis (a \u2264 \u00b7) Ici := by\nhave : Nonempty \u03b1 := \u27e8a\u27e9\n refine atTop_basis.to_hasBasis (fun b _ \u21a6 ?_) fun b _ \u21a6 \u27e8b, trivial, Subset.rfl\u27e9\n obtain \u27e8c, hac, hbc\u27e9 := exists_ge_ge a b\n exact \u27e8c, hac, Ici_subset_Ici.2 hbc\u27e9\n\nvariable [Nonempty \u03b1]\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Filter/Map.lean", "module": "Mathlib.Order.Filter.Map", "declaration": "Mathlib.Order.Filter.Map.map_biInf_eq", "span": "L714-L720", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Filter/Map.lean#L714"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4939, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 12985, "lean_code_chars": 11492, "natural_language_chars": 1493, "lean_code_ratio": 0.885, "line_count": 369, "imports_count": 0, "declarations_count": 1363, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "a26ef5cc31e7e889", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Combinatorics.SimpleGraph.Walks.Operations.drop_add_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.Combinatorics.SimpleGraph.Walks.Operations)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma drop_add_eq (p : G.Walk u v) (n m : \u2115) :\n p.drop (n + m) = ((p.drop n).drop m).copy (drop_getVert ..) rfl\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_rfl_rfl (L52-L53)\ntheorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_copy (L55-L60)\ntheorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)\n (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :\n (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by\nsubst_vars\n rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_nil (L62-L65)\ntheorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = nil := by\nsubst_vars\n rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_cons (L66-L70)\ntheorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') :\n (Walk.cons h p).copy hu hw = Walk.cons (hu \u25b8 h) (p.copy rfl hw) := by\nsubst_vars\n rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_copy (L72-L77)\ntheorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) :\n cons h (p.copy hv hw) = (Walk.cons (hv \u25b8 h) p).copy rfl hw := by\nsubst_vars\n rfl\n\n/-- The concatenation of two compatible walks. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append (L79-L84)\ndef append {u v w : V} : G.Walk u v \u2192 G.Walk v w \u2192 G.Walk u w\n | nil, q => q\n | cons h p, q => cons h (p.append q)\n\n/-- The reversed version of `SimpleGraph.Walk.cons`, concatenating an edge to\nthe end of a walk. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat (L85-L86)\ndef concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat_eq_append (L87-L95)\ntheorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) :\n p.concat h = p.append (cons h nil) := rfl\n/-- The concatenation of the reverse of the first walk with the second walk. -/\nprotected def reverseAux {u v w : V} : G.Walk u v \u2192 G.Walk u w \u2192 G.Walk v w\n | nil, q => q\n | cons h p, q => Walk.reverseAux p (cons (G.symm h) q)\n\n/-- The walk in reverse. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.reverse (L97-L98)\ndef reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_append (L100-L102)\ntheorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) :\n (cons h p).append q = cons h (p.append q) := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_nil_append (L104-L106)\ntheorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) :\n (cons h nil).append p = cons h p := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.nil_append (L108-L110)\ntheorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_nil (L112-L114)\ntheorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by\ninduction p <;> simp [*]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_assoc (L115-L118)\ntheorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) :\n p.append (q.append r) = (p.append q).append r := by\ninduction p <;> simp [*]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_copy_copy (L120-L125)\ntheorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w)\n (hu : u = u') (hv : v = v') (hw : w = w') :\n (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by\nsubst_vars\n rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_minimal_connected (L360-L368)\nlemma isTree_iff_minimal_connected : IsTree G \u2194 Minimal Connected G := by\nrefine \u27e8fun htree \u21a6 \u27e8htree.connected, fun G' h' hle u v hadj \u21a6 ?_\u27e9, isTree_of_minimal_connected\u27e9\n have \u27e8p, hp\u27e9 := h'.exists_isPath u v\n have := congrArg Walk.edges <| congrArg Subtype.val <|\n htree.isAcyclic.path_unique \u27e8p.mapLe hle, hp.mapLe hle\u27e9 <| Path.singleton hadj\n simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this\n simp [this, p.adj_of_mem_edges]\n\n/-- Connecting two unreachable vertices by an edge preserves acyclicity. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_adj_isBridge (L167-L180)\ntheorem isAcyclic_iff_forall_adj_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984, G.Adj v w \u2192 G.IsBridge s(v, w) := by\nsimp_rw [isBridge_iff_adj_and_forall_cycle_notMem]\n constructor\n \u00b7 intro ha v w hvw\n apply And.intro hvw\n intro u p hp\n cases ha p hp\n \u00b7 rintro hb v (_ | \u27e8ha, p\u27e9) hp\n \u00b7 exact hp.not_of_nil\n \u00b7 apply (hb ha).2 _ hp\n rw [Walk.edges_cons]\n apply List.mem_cons_self\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsAcyclic (L55-L57)\ndef IsAcyclic : Prop := \u2200 \u2983v : V\u2984 (c : G.Walk v v), \u00acc.IsCycle\n/-- A *tree* is a connected acyclic graph. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_pairwise_not_isEdgeReachable_two (L650-L658)\nlemma isAcyclic_iff_pairwise_not_isEdgeReachable_two :\n G.IsAcyclic \u2194 Pairwise (\u00acG.IsEdgeReachable 2 \u00b7 \u00b7) := by\nrefine \u27e8fun h _ _ hne he \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_isCycle_of_two_le_isEdgeReachable hne le_rfl he\n exact h w hw\n \u00b7 refine isAcyclic_iff_forall_adj_isBridge.mpr fun _ _ hadj \u21a6 ?_\n exact isBridge_iff_adj_and_not_isEdgeConnected_two.mpr \u27e8hadj, h hadj.ne\u27e9\n\nend SimpleGraph\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_connected_and_card (L486-L499)\nlemma isTree_iff_connected_and_card [Finite V] :\n G.IsTree \u2194 G.Connected \u2227 Nat.card G.edgeSet + 1 = Nat.card V := by\nhave := Fintype.ofFinite V\n classical\n refine \u27e8fun h \u21a6 \u27e8h.connected, by simpa [edgeFinset] using h.card_edgeFinset\u27e9,\n fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 \u27e8h\u2081, ?_\u27e9\u27e9\n simp_rw [isAcyclic_iff_forall_adj_isBridge]\n refine fun x y h \u21a6 by_contra fun hbr \u21a6\n (h\u2081.connected_delete_edge_of_not_isBridge hbr).card_vert_le_card_edgeSet_add_one.not_gt ?_\n rw [Nat.card_eq_fintype_card, \u2190 edgeFinset_card, \u2190 h\u2082, Nat.card_eq_fintype_card,\n \u2190 edgeFinset_card, add_lt_add_iff_right]\n exact Finset.card_lt_card <| by simpa [deleteEdges, edgeFinset]\n\n/-- The minimum degree of all vertices in a nontrivial tree is one. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sSup_of_isAcyclic_directedOn (L118-L126)\nlemma isAcyclic_sSup_of_isAcyclic_directedOn (Hs : Set <| SimpleGraph V)\n (h_acyc : \u2200 H \u2208 Hs, H.IsAcyclic) (h_dir : DirectedOn (\u00b7 \u2264 \u00b7) Hs) : IsAcyclic (sSup Hs) := by\nrcases Hs.eq_empty_or_nonempty with rfl | hnemp\n \u00b7 simp\n \u00b7 intro u p hp\n obtain \u27e8H, hH, hpH\u27e9 := p.exists_mem_contains_edges_of_directed Hs hnemp h_dir\n exact h_acyc H hH (p.transfer H hpH) <| Walk.IsCycle.transfer hp hpH\n\n/-- Every acyclic subgraph `H \u2264 G` is contained in a maximal such subgraph. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.reachable_eq_of_maximal_isAcyclic (L397-L412)\nlemma reachable_eq_of_maximal_isAcyclic (F : SimpleGraph V)\n (h : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) F) : F.Reachable = G.Reachable := by\next u v\n refine \u27e8.mono h.prop.left, fun \u27e8p\u27e9 \u21a6 ?_\u27e9\n by_contra\n let s : F.ConnectedComponent := .mk _ u\n have : v \u2209 s := this \u2218 s.reachable_of_mem_supp rfl\n have : \u2203 d \u2208 p.darts, d.fst \u2208 s \u2227 d.snd \u2209 s := p.exists_boundary_dart s rfl this\n rcases this with \u27e8\u27e8\u27e8u', v'\u27e9, huv\u27e9, _, hu, hv\u27e9\n have : \u00acF.Reachable v' u' := mt ConnectedComponent.sound <| s.mem_supp_iff u' |>.mp hu \u25b8 hv\n suffices F \u2294 fromEdgeSet {s(v', u')} \u2264 F by\n grind [Adj.reachable, sup_le_iff, le_iff_adj, fromEdgeSet_adj]\n refine h.le_of_ge \u27e8?_, h.prop.right.isAcyclic_sup_fromEdgeSet_of_not_reachable this\u27e9 le_sup_left\n grind [Maximal, sup_le, le_iff_adj, fromEdgeSet_adj, huv.symm]\n\n/-- A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Iso (L80-L83)\nlemma Iso.isAcyclic_iff (f : G \u2243g G') : G.IsAcyclic \u2194 G'.IsAcyclic :=\n\u27e8fun h \u21a6 h.embedding f.symm, fun h \u21a6 h.embedding f\u27e9\n\n/-- Isomorphic graphs are trees together. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_edge_isBridge (L181-L184)\ntheorem isAcyclic_iff_forall_edge_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983e\u2984, e \u2208 (G.edgeSet) \u2192 G.IsBridge e := by\nsimp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsTree (L154-L156)\nlemma IsTree.of_subsingleton [Nonempty V] [Subsingleton V] {G : SimpleGraph V} : G.IsTree :=\n\u27e8.of_subsingleton, .of_subsingleton\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic (L450-L456)\ntheorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H \u2264 G)\n (hH_isAcyclic : H.IsAcyclic) :\n \u2203 F : SimpleGraph V, H \u2264 F \u2227 F \u2264 G \u2227 F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic\n grind [maximal_isAcyclic_iff_reachable_eq, Maximal]\n\n/-- Every graph has a spanning forest. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_reachable_eq (L413-L427)\ntheorem maximal_isAcyclic_iff_reachable_eq {F : SimpleGraph V} (hle : F \u2264 G) (hF : F.IsAcyclic) :\n Maximal (fun F \u21a6 F \u2264 G \u2227 F.IsAcyclic) F \u2194 F.Reachable = G.Reachable := by\nrefine \u27e8reachable_eq_of_maximal_isAcyclic F, fun h \u21a6 ?_\u27e9\n by_contra\n have \u27e8H, hFH, hHG, hH\u27e9 := exists_gt_of_not_maximal \u27e8hle, hF\u27e9 this\n have \u27e8e, heH, heF\u27e9 := Set.exists_of_ssubset <| edgeSet_strict_mono hFH\n have h_bridge : (F \u2294 fromEdgeSet {e}).IsBridge e := by\n refine isAcyclic_iff_forall_edge_isBridge.mp ?_ <| by simp [H.not_isDiag_of_mem_edgeSet heH]\n exact hH.anti <| sup_le_iff.mpr \u27e8hFH.le, H.fromEdgeSet_le.mpr <| by grind\u27e9\n have : (F \u2294 fromEdgeSet {e}) \\ fromEdgeSet {e} = F := by simpa using heF\n cases e\n rw [isBridge_iff, this, h] at h_bridge\n exact h_bridge.right <| hHG heH |>.reachable\n\n/-- A subgraph of a connected graph is maximal acyclic iff it is a tree. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_of_minimal_connected (L353-L359)\nlemma isTree_of_minimal_connected (h : Minimal Connected G) : IsTree G := by\nrw [isTree_iff, and_iff_right h.prop, isAcyclic_iff_forall_adj_isBridge]\n exact fun _ _ _ \u21a6 by_contra fun hbr \u21a6 h.not_prop_of_lt\n (by simpa [deleteEdges, \u2190 edgeSet_ssubset_edgeSet])\n <| h.prop.connected_delete_edge_of_not_isBridge hbr\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_existsUnique_path (L248-L269)\ntheorem isTree_iff_existsUnique_path :\n G.IsTree \u2194 Nonempty V \u2227 \u2200 v w : V, \u2203! p : G.Walk v w, p.IsPath := by\nclassical\n rw [isTree_iff, isAcyclic_iff_path_unique]\n constructor\n \u00b7 rintro \u27e8hc, hu\u27e9\n refine \u27e8hc.nonempty, ?_\u27e9\n intro v w\n let q := (hc v w).some.toPath\n use q\n simp only [true_and, Path.isPath]\n intro p hp\n specialize hu \u27e8p, hp\u27e9 q\n exact Subtype.ext_iff.mp hu\n \u00b7 rintro \u27e8hV, h\u27e9\n refine \u27e8Connected.mk ?_, ?_\u27e9\n \u00b7 intro v w\n obtain \u27e8p, _\u27e9 := h v w\n exact p.reachable\n \u00b7 rintro v w \u27e8p, hp\u27e9 \u27e8q, hq\u27e9\n simp only [ExistsUnique.unique (h v w) hp hq]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sup_fromEdgeSet_iff (L380-L396)\ntheorem isAcyclic_sup_fromEdgeSet_iff {u v : V} :\n (G \u2294 fromEdgeSet {s(u, v)}).IsAcyclic \u2194\n G.IsAcyclic \u2227 (G.Reachable u v \u2192 u = v \u2228 G.Adj u v) := by\nby_cases huv : u = v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, Sym2.mem_diagSet, Sym2.mk_isDiag_iff]\n by_cases hadj : G.Adj u v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, mem_edgeSet]\n refine \u27e8?_, fun \u27e8hacyc, hreach\u27e9 \u21a6 hacyc.isAcyclic_sup_fromEdgeSet_of_not_reachable <| by grind\u27e9\n refine fun hacyc \u21a6 \u27e8hacyc.anti le_sup_left, fun hreach \u21a6 False.elim ?_\u27e9\n have := isAcyclic_iff_forall_edge_isBridge.mp (e := s(u, v)) hacyc <| by simp [huv]\n refine isBridge_iff.mp this |>.right <| hreach.mono <| Eq.le <| Eq.symm ?_\n rw [sup_sdiff_right_self]\n exact deleteEdges_eq_self.mpr <| Set.disjoint_singleton_right.mpr hadj\n\n/--\nThe reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Subgraph (L151-L153)\nlemma Subgraph.isAcyclic_coe_bot (G : SimpleGraph V) : (\u22a5 : G.Subgraph).coe.IsAcyclic :=\n@IsAcyclic.of_subsingleton _ (Set.isEmpty_coe_sort.mpr rfl).instSubsingleton _\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le (L457-L462)\ntheorem exists_isAcyclic_reachable_eq_le :\n \u2203 F \u2264 G, F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot\n grind\n\n/-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Connected (L428-L436)\ntheorem Connected.maximal_le_isAcyclic_iff_isTree {T : SimpleGraph V} (hG : G.Connected)\n (hT : T \u2264 G) : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) T \u2194 T.IsTree := by\nhave := hG.nonempty\n refine \u27e8fun h \u21a6 \u27e8\u27e8fun u v \u21a6 ?_\u27e9, h.1.2\u27e9, fun hT' \u21a6 ?_\u27e9\n \u00b7 exact G.reachable_eq_of_maximal_isAcyclic T h \u25b8 hG.preconnected u v\n \u00b7 rw [maximal_isAcyclic_iff_reachable_eq hT hT'.isAcyclic,\n T.preconnected_iff_reachable_eq_top.mp hT'.preconnected,\n G.preconnected_iff_reachable_eq_top.mp hG.preconnected]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_maximal_isAcyclic (L444-L449)\ntheorem isTree_iff_maximal_isAcyclic : G.IsTree \u2194 Nonempty V \u2227 Maximal IsAcyclic G := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8_, h\u27e9 \u21a6 G.maximal_isAcyclic_iff_isTree.mp h\u27e9\n have := h.nonempty\n exact \u27e8this, G.maximal_isAcyclic_iff_isTree.mpr h\u27e9\n\n/-- Every acyclic subgraph can be extended to a spanning forest. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isCycle_of_two_le_isEdgeReachable (L642-L649)\nlemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u \u2260 v) {n : \u2115} (hn : 2 \u2264 n)\n (h : G.IsEdgeReachable n u v) : \u2203 w : G.Walk u u, w.IsCycle := by\nclassical\n obtain \u27e8w, hw, h\u27e9 := exists_adj_isEdgeReachable_two huv (h.anti hn)\n have := @h {s(u, w)} (by simp)\n obtain \u27e8w, p, hp\u2081, hp\u2082\u27e9 := adj_and_reachable_delete_edges_iff_exists_cycle.mp \u27e8hw, this\u27e9\n exact \u27e8p.rotate _ (p.fst_mem_support_of_mem_edges hp\u2082), IsCycle.rotate hp\u2081 _\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_maximal_isAcyclic_of_le_isAcyclic (L127-L135)\ntheorem exists_maximal_isAcyclic_of_le_isAcyclic\n {H : SimpleGraph V} (hHG : H \u2264 G) (hH : H.IsAcyclic) :\n \u2203 H' : SimpleGraph V, H \u2264 H' \u2227 Maximal (fun H => H \u2264 G \u2227 H.IsAcyclic) H' := by\nrefine zorn_le_nonempty\u2080 {H | H \u2264 G \u2227 H.IsAcyclic} (fun c hcs hc y hy \u21a6 ?_) _ \u27e8hHG, hH\u27e9\n refine \u27e8sSup c, \u27e8?_, ?_\u27e9, fun _ \u21a6 le_sSup\u27e9\n \u00b7 grind [sSup_le_iff]\n \u00b7 exact isAcyclic_sSup_of_isAcyclic_directedOn c (by grind) hc.directedOn\n\n/-- A connected component of an acyclic graph is a tree. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_add_edge_iff_of_not_reachable (L374-L379)\ntheorem isAcyclic_add_edge_iff_of_not_reachable (x y : V) (hxy : \u00ac G.Reachable x y) :\n (G \u2294 fromEdgeSet {s(x, y)}).IsAcyclic \u2194 IsAcyclic G :=\n\u27e8.anti le_sup_left, .isAcyclic_sup_fromEdgeSet_of_not_reachable hxy\u27e9\n\n/-- Adding an edge results in an acyclic graph iff the original graph was acyclic and\nthe edge connects vertices that previously had no path between them. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_of_path_unique (L214-L224)\ntheorem isAcyclic_of_path_unique (h : \u2200 (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by\nintro v c hc\n simp only [Walk.isCycle_def, Ne] at hc\n cases c with\n | nil => cases hc.2.1 rfl\n | cons ha c' =>\n simp only [Walk.isTrail_cons, Walk.support_cons, List.tail_cons] at hc\n specialize h _ _ \u27e8c', by simp only [Walk.isPath_def, hc.2]\u27e9 (Path.singleton ha.symm)\n rw [Path.singleton, Subtype.mk.injEq] at h\n simp [h] at hc\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_path_unique (L225-L227)\ntheorem isAcyclic_iff_path_unique : G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984 (p q : G.Path v w), p = q :=\n\u27e8IsAcyclic.path_unique, isAcyclic_of_path_unique\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_isTree (L438-L443)\ntheorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :\n Maximal IsAcyclic T \u2194 T.IsTree := by\nsimp [\u2190 connected_top.maximal_le_isAcyclic_iff_isTree le_top]\n\n/-- A maximally acyclic graph is a tree. This is similar to `maximal_isAcyclic_iff_isTree` except\nwith `Nonempty V` as part of the iff rather than an assumption. -/\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.Combinatorics.SimpleGraph.Walks.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma drop_add_eq (p : G.Walk u v) (n m : \u2115) :\n p.drop (n + m) = ((p.drop n).drop m).copy (drop_getVert ..) rfl\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_rfl_rfl (L52-L53)\ntheorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_copy (L55-L60)\ntheorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)\n (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :\n (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by\nsubst_vars\n rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_nil (L62-L65)\ntheorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = nil := by\nsubst_vars\n rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_cons (L66-L70)\ntheorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') :\n (Walk.cons h p).copy hu hw = Walk.cons (hu \u25b8 h) (p.copy rfl hw) := by\nsubst_vars\n rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_copy (L72-L77)\ntheorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) :\n cons h (p.copy hv hw) = (Walk.cons (hv \u25b8 h) p).copy rfl hw := by\nsubst_vars\n rfl\n\n/-- The concatenation of two compatible walks. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append (L79-L84)\ndef append {u v w : V} : G.Walk u v \u2192 G.Walk v w \u2192 G.Walk u w\n | nil, q => q\n | cons h p, q => cons h (p.append q)\n\n/-- The reversed version of `SimpleGraph.Walk.cons`, concatenating an edge to\nthe end of a walk. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat (L85-L86)\ndef concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat_eq_append (L87-L95)\ntheorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) :\n p.concat h = p.append (cons h nil) := rfl\n/-- The concatenation of the reverse of the first walk with the second walk. -/\nprotected def reverseAux {u v w : V} : G.Walk u v \u2192 G.Walk u w \u2192 G.Walk v w\n | nil, q => q\n | cons h p, q => Walk.reverseAux p (cons (G.symm h) q)\n\n/-- The walk in reverse. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.reverse (L97-L98)\ndef reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_append (L100-L102)\ntheorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) :\n (cons h p).append q = cons h (p.append q) := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_nil_append (L104-L106)\ntheorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) :\n (cons h nil).append p = cons h p := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.nil_append (L108-L110)\ntheorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_nil (L112-L114)\ntheorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by\ninduction p <;> simp [*]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_assoc (L115-L118)\ntheorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) :\n p.append (q.append r) = (p.append q).append r := by\ninduction p <;> simp [*]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_copy_copy (L120-L125)\ntheorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w)\n (hu : u = u') (hv : v = v') (hw : w = w') :\n (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by\nsubst_vars\n rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_minimal_connected (L360-L368)\nlemma isTree_iff_minimal_connected : IsTree G \u2194 Minimal Connected G := by\nrefine \u27e8fun htree \u21a6 \u27e8htree.connected, fun G' h' hle u v hadj \u21a6 ?_\u27e9, isTree_of_minimal_connected\u27e9\n have \u27e8p, hp\u27e9 := h'.exists_isPath u v\n have := congrArg Walk.edges <| congrArg Subtype.val <|\n htree.isAcyclic.path_unique \u27e8p.mapLe hle, hp.mapLe hle\u27e9 <| Path.singleton hadj\n simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this\n simp [this, p.adj_of_mem_edges]\n\n/-- Connecting two unreachable vertices by an edge preserves acyclicity. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_adj_isBridge (L167-L180)\ntheorem isAcyclic_iff_forall_adj_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984, G.Adj v w \u2192 G.IsBridge s(v, w) := by\nsimp_rw [isBridge_iff_adj_and_forall_cycle_notMem]\n constructor\n \u00b7 intro ha v w hvw\n apply And.intro hvw\n intro u p hp\n cases ha p hp\n \u00b7 rintro hb v (_ | \u27e8ha, p\u27e9) hp\n \u00b7 exact hp.not_of_nil\n \u00b7 apply (hb ha).2 _ hp\n rw [Walk.edges_cons]\n apply List.mem_cons_self\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsAcyclic (L55-L57)\ndef IsAcyclic : Prop := \u2200 \u2983v : V\u2984 (c : G.Walk v v), \u00acc.IsCycle\n/-- A *tree* is a connected acyclic graph. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_pairwise_not_isEdgeReachable_two (L650-L658)\nlemma isAcyclic_iff_pairwise_not_isEdgeReachable_two :\n G.IsAcyclic \u2194 Pairwise (\u00acG.IsEdgeReachable 2 \u00b7 \u00b7) := by\nrefine \u27e8fun h _ _ hne he \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_isCycle_of_two_le_isEdgeReachable hne le_rfl he\n exact h w hw\n \u00b7 refine isAcyclic_iff_forall_adj_isBridge.mpr fun _ _ hadj \u21a6 ?_\n exact isBridge_iff_adj_and_not_isEdgeConnected_two.mpr \u27e8hadj, h hadj.ne\u27e9\n\nend SimpleGraph\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_connected_and_card (L486-L499)\nlemma isTree_iff_connected_and_card [Finite V] :\n G.IsTree \u2194 G.Connected \u2227 Nat.card G.edgeSet + 1 = Nat.card V := by\nhave := Fintype.ofFinite V\n classical\n refine \u27e8fun h \u21a6 \u27e8h.connected, by simpa [edgeFinset] using h.card_edgeFinset\u27e9,\n fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 \u27e8h\u2081, ?_\u27e9\u27e9\n simp_rw [isAcyclic_iff_forall_adj_isBridge]\n refine fun x y h \u21a6 by_contra fun hbr \u21a6\n (h\u2081.connected_delete_edge_of_not_isBridge hbr).card_vert_le_card_edgeSet_add_one.not_gt ?_\n rw [Nat.card_eq_fintype_card, \u2190 edgeFinset_card, \u2190 h\u2082, Nat.card_eq_fintype_card,\n \u2190 edgeFinset_card, add_lt_add_iff_right]\n exact Finset.card_lt_card <| by simpa [deleteEdges, edgeFinset]\n\n/-- The minimum degree of all vertices in a nontrivial tree is one. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sSup_of_isAcyclic_directedOn (L118-L126)\nlemma isAcyclic_sSup_of_isAcyclic_directedOn (Hs : Set <| SimpleGraph V)\n (h_acyc : \u2200 H \u2208 Hs, H.IsAcyclic) (h_dir : DirectedOn (\u00b7 \u2264 \u00b7) Hs) : IsAcyclic (sSup Hs) := by\nrcases Hs.eq_empty_or_nonempty with rfl | hnemp\n \u00b7 simp\n \u00b7 intro u p hp\n obtain \u27e8H, hH, hpH\u27e9 := p.exists_mem_contains_edges_of_directed Hs hnemp h_dir\n exact h_acyc H hH (p.transfer H hpH) <| Walk.IsCycle.transfer hp hpH\n\n/-- Every acyclic subgraph `H \u2264 G` is contained in a maximal such subgraph. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.reachable_eq_of_maximal_isAcyclic (L397-L412)\nlemma reachable_eq_of_maximal_isAcyclic (F : SimpleGraph V)\n (h : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) F) : F.Reachable = G.Reachable := by\next u v\n refine \u27e8.mono h.prop.left, fun \u27e8p\u27e9 \u21a6 ?_\u27e9\n by_contra\n let s : F.ConnectedComponent := .mk _ u\n have : v \u2209 s := this \u2218 s.reachable_of_mem_supp rfl\n have : \u2203 d \u2208 p.darts, d.fst \u2208 s \u2227 d.snd \u2209 s := p.exists_boundary_dart s rfl this\n rcases this with \u27e8\u27e8\u27e8u', v'\u27e9, huv\u27e9, _, hu, hv\u27e9\n have : \u00acF.Reachable v' u' := mt ConnectedComponent.sound <| s.mem_supp_iff u' |>.mp hu \u25b8 hv\n suffices F \u2294 fromEdgeSet {s(v', u')} \u2264 F by\n grind [Adj.reachable, sup_le_iff, le_iff_adj, fromEdgeSet_adj]\n refine h.le_of_ge \u27e8?_, h.prop.right.isAcyclic_sup_fromEdgeSet_of_not_reachable this\u27e9 le_sup_left\n grind [Maximal, sup_le, le_iff_adj, fromEdgeSet_adj, huv.symm]\n\n/-- A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Iso (L80-L83)\nlemma Iso.isAcyclic_iff (f : G \u2243g G') : G.IsAcyclic \u2194 G'.IsAcyclic :=\n\u27e8fun h \u21a6 h.embedding f.symm, fun h \u21a6 h.embedding f\u27e9\n\n/-- Isomorphic graphs are trees together. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_edge_isBridge (L181-L184)\ntheorem isAcyclic_iff_forall_edge_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983e\u2984, e \u2208 (G.edgeSet) \u2192 G.IsBridge e := by\nsimp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsTree (L154-L156)\nlemma IsTree.of_subsingleton [Nonempty V] [Subsingleton V] {G : SimpleGraph V} : G.IsTree :=\n\u27e8.of_subsingleton, .of_subsingleton\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic (L450-L456)\ntheorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H \u2264 G)\n (hH_isAcyclic : H.IsAcyclic) :\n \u2203 F : SimpleGraph V, H \u2264 F \u2227 F \u2264 G \u2227 F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic\n grind [maximal_isAcyclic_iff_reachable_eq, Maximal]\n\n/-- Every graph has a spanning forest. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_reachable_eq (L413-L427)\ntheorem maximal_isAcyclic_iff_reachable_eq {F : SimpleGraph V} (hle : F \u2264 G) (hF : F.IsAcyclic) :\n Maximal (fun F \u21a6 F \u2264 G \u2227 F.IsAcyclic) F \u2194 F.Reachable = G.Reachable := by\nrefine \u27e8reachable_eq_of_maximal_isAcyclic F, fun h \u21a6 ?_\u27e9\n by_contra\n have \u27e8H, hFH, hHG, hH\u27e9 := exists_gt_of_not_maximal \u27e8hle, hF\u27e9 this\n have \u27e8e, heH, heF\u27e9 := Set.exists_of_ssubset <| edgeSet_strict_mono hFH\n have h_bridge : (F \u2294 fromEdgeSet {e}).IsBridge e := by\n refine isAcyclic_iff_forall_edge_isBridge.mp ?_ <| by simp [H.not_isDiag_of_mem_edgeSet heH]\n exact hH.anti <| sup_le_iff.mpr \u27e8hFH.le, H.fromEdgeSet_le.mpr <| by grind\u27e9\n have : (F \u2294 fromEdgeSet {e}) \\ fromEdgeSet {e} = F := by simpa using heF\n cases e\n rw [isBridge_iff, this, h] at h_bridge\n exact h_bridge.right <| hHG heH |>.reachable\n\n/-- A subgraph of a connected graph is maximal acyclic iff it is a tree. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_of_minimal_connected (L353-L359)\nlemma isTree_of_minimal_connected (h : Minimal Connected G) : IsTree G := by\nrw [isTree_iff, and_iff_right h.prop, isAcyclic_iff_forall_adj_isBridge]\n exact fun _ _ _ \u21a6 by_contra fun hbr \u21a6 h.not_prop_of_lt\n (by simpa [deleteEdges, \u2190 edgeSet_ssubset_edgeSet])\n <| h.prop.connected_delete_edge_of_not_isBridge hbr\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_existsUnique_path (L248-L269)\ntheorem isTree_iff_existsUnique_path :\n G.IsTree \u2194 Nonempty V \u2227 \u2200 v w : V, \u2203! p : G.Walk v w, p.IsPath := by\nclassical\n rw [isTree_iff, isAcyclic_iff_path_unique]\n constructor\n \u00b7 rintro \u27e8hc, hu\u27e9\n refine \u27e8hc.nonempty, ?_\u27e9\n intro v w\n let q := (hc v w).some.toPath\n use q\n simp only [true_and, Path.isPath]\n intro p hp\n specialize hu \u27e8p, hp\u27e9 q\n exact Subtype.ext_iff.mp hu\n \u00b7 rintro \u27e8hV, h\u27e9\n refine \u27e8Connected.mk ?_, ?_\u27e9\n \u00b7 intro v w\n obtain \u27e8p, _\u27e9 := h v w\n exact p.reachable\n \u00b7 rintro v w \u27e8p, hp\u27e9 \u27e8q, hq\u27e9\n simp only [ExistsUnique.unique (h v w) hp hq]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sup_fromEdgeSet_iff (L380-L396)\ntheorem isAcyclic_sup_fromEdgeSet_iff {u v : V} :\n (G \u2294 fromEdgeSet {s(u, v)}).IsAcyclic \u2194\n G.IsAcyclic \u2227 (G.Reachable u v \u2192 u = v \u2228 G.Adj u v) := by\nby_cases huv : u = v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, Sym2.mem_diagSet, Sym2.mk_isDiag_iff]\n by_cases hadj : G.Adj u v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, mem_edgeSet]\n refine \u27e8?_, fun \u27e8hacyc, hreach\u27e9 \u21a6 hacyc.isAcyclic_sup_fromEdgeSet_of_not_reachable <| by grind\u27e9\n refine fun hacyc \u21a6 \u27e8hacyc.anti le_sup_left, fun hreach \u21a6 False.elim ?_\u27e9\n have := isAcyclic_iff_forall_edge_isBridge.mp (e := s(u, v)) hacyc <| by simp [huv]\n refine isBridge_iff.mp this |>.right <| hreach.mono <| Eq.le <| Eq.symm ?_\n rw [sup_sdiff_right_self]\n exact deleteEdges_eq_self.mpr <| Set.disjoint_singleton_right.mpr hadj\n\n/--\nThe reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Subgraph (L151-L153)\nlemma Subgraph.isAcyclic_coe_bot (G : SimpleGraph V) : (\u22a5 : G.Subgraph).coe.IsAcyclic :=\n@IsAcyclic.of_subsingleton _ (Set.isEmpty_coe_sort.mpr rfl).instSubsingleton _\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le (L457-L462)\ntheorem exists_isAcyclic_reachable_eq_le :\n \u2203 F \u2264 G, F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot\n grind\n\n/-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Connected (L428-L436)\ntheorem Connected.maximal_le_isAcyclic_iff_isTree {T : SimpleGraph V} (hG : G.Connected)\n (hT : T \u2264 G) : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) T \u2194 T.IsTree := by\nhave := hG.nonempty\n refine \u27e8fun h \u21a6 \u27e8\u27e8fun u v \u21a6 ?_\u27e9, h.1.2\u27e9, fun hT' \u21a6 ?_\u27e9\n \u00b7 exact G.reachable_eq_of_maximal_isAcyclic T h \u25b8 hG.preconnected u v\n \u00b7 rw [maximal_isAcyclic_iff_reachable_eq hT hT'.isAcyclic,\n T.preconnected_iff_reachable_eq_top.mp hT'.preconnected,\n G.preconnected_iff_reachable_eq_top.mp hG.preconnected]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_maximal_isAcyclic (L444-L449)\ntheorem isTree_iff_maximal_isAcyclic : G.IsTree \u2194 Nonempty V \u2227 Maximal IsAcyclic G := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8_, h\u27e9 \u21a6 G.maximal_isAcyclic_iff_isTree.mp h\u27e9\n have := h.nonempty\n exact \u27e8this, G.maximal_isAcyclic_iff_isTree.mpr h\u27e9\n\n/-- Every acyclic subgraph can be extended to a spanning forest. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isCycle_of_two_le_isEdgeReachable (L642-L649)\nlemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u \u2260 v) {n : \u2115} (hn : 2 \u2264 n)\n (h : G.IsEdgeReachable n u v) : \u2203 w : G.Walk u u, w.IsCycle := by\nclassical\n obtain \u27e8w, hw, h\u27e9 := exists_adj_isEdgeReachable_two huv (h.anti hn)\n have := @h {s(u, w)} (by simp)\n obtain \u27e8w, p, hp\u2081, hp\u2082\u27e9 := adj_and_reachable_delete_edges_iff_exists_cycle.mp \u27e8hw, this\u27e9\n exact \u27e8p.rotate _ (p.fst_mem_support_of_mem_edges hp\u2082), IsCycle.rotate hp\u2081 _\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_maximal_isAcyclic_of_le_isAcyclic (L127-L135)\ntheorem exists_maximal_isAcyclic_of_le_isAcyclic\n {H : SimpleGraph V} (hHG : H \u2264 G) (hH : H.IsAcyclic) :\n \u2203 H' : SimpleGraph V, H \u2264 H' \u2227 Maximal (fun H => H \u2264 G \u2227 H.IsAcyclic) H' := by\nrefine zorn_le_nonempty\u2080 {H | H \u2264 G \u2227 H.IsAcyclic} (fun c hcs hc y hy \u21a6 ?_) _ \u27e8hHG, hH\u27e9\n refine \u27e8sSup c, \u27e8?_, ?_\u27e9, fun _ \u21a6 le_sSup\u27e9\n \u00b7 grind [sSup_le_iff]\n \u00b7 exact isAcyclic_sSup_of_isAcyclic_directedOn c (by grind) hc.directedOn\n\n/-- A connected component of an acyclic graph is a tree. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_add_edge_iff_of_not_reachable (L374-L379)\ntheorem isAcyclic_add_edge_iff_of_not_reachable (x y : V) (hxy : \u00ac G.Reachable x y) :\n (G \u2294 fromEdgeSet {s(x, y)}).IsAcyclic \u2194 IsAcyclic G :=\n\u27e8.anti le_sup_left, .isAcyclic_sup_fromEdgeSet_of_not_reachable hxy\u27e9\n\n/-- Adding an edge results in an acyclic graph iff the original graph was acyclic and\nthe edge connects vertices that previously had no path between them. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_of_path_unique (L214-L224)\ntheorem isAcyclic_of_path_unique (h : \u2200 (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by\nintro v c hc\n simp only [Walk.isCycle_def, Ne] at hc\n cases c with\n | nil => cases hc.2.1 rfl\n | cons ha c' =>\n simp only [Walk.isTrail_cons, Walk.support_cons, List.tail_cons] at hc\n specialize h _ _ \u27e8c', by simp only [Walk.isPath_def, hc.2]\u27e9 (Path.singleton ha.symm)\n rw [Path.singleton, Subtype.mk.injEq] at h\n simp [h] at hc\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_path_unique (L225-L227)\ntheorem isAcyclic_iff_path_unique : G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984 (p q : G.Path v w), p = q :=\n\u27e8IsAcyclic.path_unique, isAcyclic_of_path_unique\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_isTree (L438-L443)\ntheorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :\n Maximal IsAcyclic T \u2194 T.IsTree := by\nsimp [\u2190 connected_top.maximal_le_isAcyclic_iff_isTree le_top]\n\n/-- A maximally acyclic graph is a tree. This is similar to `maximal_isAcyclic_iff_isTree` except\nwith `Nonempty V` as part of the iff rather than an assumption. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Walks.Operations", "declaration": "Mathlib.Combinatorics.SimpleGraph.Walks.Operations.drop_add_eq", "span": "L523-L527", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean#L523"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6812, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 17938, "lean_code_chars": 16419, "natural_language_chars": 1519, "lean_code_ratio": 0.9153, "line_count": 469, "imports_count": 0, "declarations_count": 1912, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "ecc317eac6026757", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.Interval.Set.Basic.Icc_ofDual", "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.Order.Interval.Set.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Icc_ofDual {x y : \u03b1\u1d52\u1d48} : Icc (ofDual y) (ofDual x) = toDual \u207b\u00b9' Icc x y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Interval.Set.Basic.Ico_subset_Ici (L34-L39)\ntheorem Ico_subset_Ici (h : a\u2082 \u2264 a\u2081) : Ico a\u2081 b\u2081 \u2286 Ici a\u2082 :=\n(Ico_subset_Ico_left h).trans Ico_subset_Ici_self\n```\nLogical equivalences, such as `Icc_subset_Ici_iff`, are however stated.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIio (L57-L58)\ninstance decidableMemIio [Decidable (x < b)] : Decidable (x \u2208 Iio b) := by assumption\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIic (L60-L61)\ninstance decidableMemIic [Decidable (x \u2264 b)] : Decidable (x \u2208 Iic b) := by assumption\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIoo (L63-L65)\ninstance decidableMemIoo [Decidable (a < x)] [Decidable (x < b)] : Decidable (x \u2208 Ioo a b) :=\ninstDecidableAnd\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIco (L66-L68)\ninstance decidableMemIco [Decidable (a \u2264 x)] [Decidable (x < b)] : Decidable (x \u2208 Ico a b) :=\ninstDecidableAnd\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIcc (L70-L72)\ninstance decidableMemIcc [Decidable (a \u2264 x)] [Decidable (x \u2264 b)] : Decidable (x \u2208 Icc a b) :=\ninstDecidableAnd\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIoc (L74-L76)\ninstance decidableMemIoc [Decidable (a < x)] [Decidable (x \u2264 b)] : Decidable (x \u2208 Ioc a b) :=\ninstDecidableAnd\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_notMem_Ioo (L81-L82)\ntheorem left_notMem_Ioo : a \u2209 Ioo a b := by simp\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_notMem_Ioc (L84-L85)\ntheorem left_notMem_Ioc : a \u2209 Ioc a b := by simp\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_mem_Ioo (L87-L88)\ntheorem left_mem_Ioo : a \u2208 Ioo a b \u2194 False := by simp\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_mem_Ioc (L90-L91)\ntheorem left_mem_Ioc : a \u2208 Ioc a b \u2194 False := by simp\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Interval.Set.Basic.right_mem_Ioo (L99-L100)\ntheorem right_mem_Ioo : b \u2208 Ioo a b \u2194 False := by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Interval.Set.Basic.right_mem_Ico (L102-L103)\ntheorem right_mem_Ico : b \u2208 Ico a b \u2194 False := by simp\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Interval.Set.Basic.Iio_toDual (L108-L110)\ntheorem Iio_toDual : Iio (toDual a) = ofDual \u207b\u00b9' Ioi a :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.Interval.Set.Basic.Iic_toDual (L112-L114)\ntheorem Iic_toDual : Iic (toDual a) = ofDual \u207b\u00b9' Ici a :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.Interval.Basic.mem_def (L127-L129)\ntheorem mem_def : a \u2208 s \u2194 s.fst \u2264 a \u2227 a \u2264 s.snd :=\nIff.rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.Interval.Basic.dual (L92-L95)\ndef dual : NonemptyInterval \u03b1 \u2243 NonemptyInterval \u03b1\u1d52\u1d48 where\n toFun s := \u27e8s.toProd.swap, s.fst_le_snd\u27e9\ninvFun s := \u27e8s.toProd.swap, s.fst_le_snd\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.Interval.Basic.map_map (L167-L170)\ntheorem map_map (g : \u03b2 \u2192o \u03b3) (f : \u03b1 \u2192o \u03b2) (a : NonemptyInterval \u03b1) :\n (a.map f).map g = a.map (g.comp f) :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.Interval.Basic.le_def (L78-L80)\ntheorem le_def : s \u2264 t \u2194 t.fst \u2264 s.fst \u2227 s.snd \u2264 t.snd :=\nIff.rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.Interval.Basic.mem_pure_self (L138-L140)\ntheorem mem_pure_self (a : \u03b1) : a \u2208 pure a :=\n\u27e8le_rfl, le_rfl\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.Interval.Basic.dual_pure (L145-L147)\ntheorem dual_pure (a : \u03b1) : dual (pure a) = pure (toDual a) :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.Interval.Basic.mem_mk (L124-L126)\ntheorem mem_mk {hx : x.1 \u2264 x.2} : a \u2208 mk x hx \u2194 x.1 \u2264 a \u2227 a \u2264 x.2 :=\nIff.rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_strictMono (L115-L116)\ntheorem toDualProd_strictMono : StrictMono (toDualProd : _ \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1) := fun _ _ => id\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.Interval.Basic.pure (L135-L137)\ndef pure (a : \u03b1) : NonemptyInterval \u03b1 :=\n\u27e8\u27e8a, a\u27e9, le_rfl\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_injective (L63-L65)\ntheorem toDualProd_injective : Injective (toDualProd : NonemptyInterval \u03b1 \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1) :=\ntoProd_injective\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.Interval.Basic.map\u2082 (L178-L181)\ndef map\u2082 (f : \u03b1 \u2192 \u03b2 \u2192 \u03b3) (h\u2080 : \u2200 b, Monotone fun a => f a b) (h\u2081 : \u2200 a, Monotone (f a)) :\n NonemptyInterval \u03b1 \u2192 NonemptyInterval \u03b2 \u2192 NonemptyInterval \u03b3 := fun s t =>\n\u27e8(f s.fst t.fst, f s.snd t.snd), (h\u2080 _ s.fst_le_snd).trans <| h\u2081 _ t.fst_le_snd\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd (L56-L58)\ndef toDualProd : NonemptyInterval \u03b1 \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1 :=\ntoProd\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.Interval.Basic.fst_dual (L97-L99)\ntheorem fst_dual (s : NonemptyInterval \u03b1) : s.dual.fst = toDual s.snd :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProdHom (L86-L91)\ndef toDualProdHom : NonemptyInterval \u03b1 \u21aao \u03b1\u1d52\u1d48 \u00d7 \u03b1 where\n toFun := toDualProd\ninj' := toDualProd_injective\n map_rel_iff' := Iff.rfl\n\n/-- Turn an interval into an interval in the dual order. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.Interval.Basic.instCanLift (L51-L55)\ninstance instCanLift :\n CanLift (\u03b1 \u00d7 \u03b1) (NonemptyInterval \u03b1) NonemptyInterval.toProd (fun x \u21a6 x.1 \u2264 x.2) where\n prf x hx := \u27e8\u27e8x, hx\u27e9, rfl\u27e9\n/-- The injection that induces the order on intervals. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_apply (L60-L62)\ntheorem toDualProd_apply (s : NonemptyInterval \u03b1) : s.toDualProd = (toDual s.fst, s.snd) :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.Interval.Basic.map (L159-L161)\ndef map (f : \u03b1 \u2192o \u03b2) (a : NonemptyInterval \u03b1) : NonemptyInterval \u03b2 :=\n\u27e8a.toProd.map f f, f.mono a.fst_le_snd\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.Interval.Basic.coe_nonempty (L130-L133)\ntheorem coe_nonempty (s : NonemptyInterval \u03b1) : (s : Set \u03b1).Nonempty :=\nnonempty_Icc.2 s.fst_le_snd\n\n/-- `{a}` as an interval. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.Interval.Basic.snd_dual (L101-L109)\ntheorem snd_dual (s : NonemptyInterval \u03b1) : s.dual.snd = toDual s.fst :=\nrfl\n\nend LE\n\nsection Preorder\n\nvariable [Preorder \u03b1] [Preorder \u03b2] [Preorder \u03b3] {s : NonemptyInterval \u03b1} {x : \u03b1 \u00d7 \u03b1} {a : \u03b1}\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.Interval.Basic.le (L75-L77)\ninstance le : LE (NonemptyInterval \u03b1) :=\n\u27e8fun s t => t.fst \u2264 s.fst \u2227 s.snd \u2264 t.snd\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.Interval.Basic.map_pure (L163-L165)\ntheorem map_pure (f : \u03b1 \u2192o \u03b2) (a : \u03b1) : (pure a).map f = pure (f a) :=\nrfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.Interval.Basic.dual_map (L172-L176)\ntheorem dual_map (f : \u03b1 \u2192o \u03b2) (a : NonemptyInterval \u03b1) :\n dual (a.map f) = a.dual.map f.dual :=\nrfl\n\n/-- Binary pushforward of nonempty intervals. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.Interval.Basic.toProd_injective (L46-L50)\ntheorem toProd_injective : Injective (toProd : NonemptyInterval \u03b1 \u2192 \u03b1 \u00d7 \u03b1) :=\nfun s t h => by cases s; cases t; congr\n\n/-- Allow lifting a pair `(a, b)` with `a \u2264 b` to `NonemptyInterval`\nin the `lift` tactic. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.Interval.Basic.pure_injective (L141-L143)\ntheorem pure_injective : Injective (pure : \u03b1 \u2192 NonemptyInterval \u03b1) := fun _ _ =>\ncongr_arg <| Prod.fst \u2218 toProd\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_mono (L113-L114)\ntheorem toDualProd_mono : Monotone (toDualProd : _ \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1) := fun _ _ => id\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.Order.Interval.Set.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 Icc_ofDual {x y : \u03b1\u1d52\u1d48} : Icc (ofDual y) (ofDual x) = toDual \u207b\u00b9' Icc x y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Interval.Set.Basic.Ico_subset_Ici (L34-L39)\ntheorem Ico_subset_Ici (h : a\u2082 \u2264 a\u2081) : Ico a\u2081 b\u2081 \u2286 Ici a\u2082 :=\n(Ico_subset_Ico_left h).trans Ico_subset_Ici_self\n```\nLogical equivalences, such as `Icc_subset_Ici_iff`, are however stated.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIio (L57-L58)\ninstance decidableMemIio [Decidable (x < b)] : Decidable (x \u2208 Iio b) := by assumption\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIic (L60-L61)\ninstance decidableMemIic [Decidable (x \u2264 b)] : Decidable (x \u2208 Iic b) := by assumption\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIoo (L63-L65)\ninstance decidableMemIoo [Decidable (a < x)] [Decidable (x < b)] : Decidable (x \u2208 Ioo a b) :=\ninstDecidableAnd\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIco (L66-L68)\ninstance decidableMemIco [Decidable (a \u2264 x)] [Decidable (x < b)] : Decidable (x \u2208 Ico a b) :=\ninstDecidableAnd\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIcc (L70-L72)\ninstance decidableMemIcc [Decidable (a \u2264 x)] [Decidable (x \u2264 b)] : Decidable (x \u2208 Icc a b) :=\ninstDecidableAnd\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Interval.Set.Basic.decidableMemIoc (L74-L76)\ninstance decidableMemIoc [Decidable (a < x)] [Decidable (x \u2264 b)] : Decidable (x \u2208 Ioc a b) :=\ninstDecidableAnd\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_notMem_Ioo (L81-L82)\ntheorem left_notMem_Ioo : a \u2209 Ioo a b := by simp\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_notMem_Ioc (L84-L85)\ntheorem left_notMem_Ioc : a \u2209 Ioc a b := by simp\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_mem_Ioo (L87-L88)\ntheorem left_mem_Ioo : a \u2208 Ioo a b \u2194 False := by simp\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Interval.Set.Basic.left_mem_Ioc (L90-L91)\ntheorem left_mem_Ioc : a \u2208 Ioc a b \u2194 False := by simp\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Interval.Set.Basic.right_mem_Ioo (L99-L100)\ntheorem right_mem_Ioo : b \u2208 Ioo a b \u2194 False := by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Interval.Set.Basic.right_mem_Ico (L102-L103)\ntheorem right_mem_Ico : b \u2208 Ico a b \u2194 False := by simp\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Interval.Set.Basic.Iio_toDual (L108-L110)\ntheorem Iio_toDual : Iio (toDual a) = ofDual \u207b\u00b9' Ioi a :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.Interval.Set.Basic.Iic_toDual (L112-L114)\ntheorem Iic_toDual : Iic (toDual a) = ofDual \u207b\u00b9' Ici a :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.Interval.Basic.mem_def (L127-L129)\ntheorem mem_def : a \u2208 s \u2194 s.fst \u2264 a \u2227 a \u2264 s.snd :=\nIff.rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.Interval.Basic.dual (L92-L95)\ndef dual : NonemptyInterval \u03b1 \u2243 NonemptyInterval \u03b1\u1d52\u1d48 where\n toFun s := \u27e8s.toProd.swap, s.fst_le_snd\u27e9\ninvFun s := \u27e8s.toProd.swap, s.fst_le_snd\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.Interval.Basic.map_map (L167-L170)\ntheorem map_map (g : \u03b2 \u2192o \u03b3) (f : \u03b1 \u2192o \u03b2) (a : NonemptyInterval \u03b1) :\n (a.map f).map g = a.map (g.comp f) :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.Interval.Basic.le_def (L78-L80)\ntheorem le_def : s \u2264 t \u2194 t.fst \u2264 s.fst \u2227 s.snd \u2264 t.snd :=\nIff.rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.Interval.Basic.mem_pure_self (L138-L140)\ntheorem mem_pure_self (a : \u03b1) : a \u2208 pure a :=\n\u27e8le_rfl, le_rfl\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.Interval.Basic.dual_pure (L145-L147)\ntheorem dual_pure (a : \u03b1) : dual (pure a) = pure (toDual a) :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.Interval.Basic.mem_mk (L124-L126)\ntheorem mem_mk {hx : x.1 \u2264 x.2} : a \u2208 mk x hx \u2194 x.1 \u2264 a \u2227 a \u2264 x.2 :=\nIff.rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_strictMono (L115-L116)\ntheorem toDualProd_strictMono : StrictMono (toDualProd : _ \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1) := fun _ _ => id\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.Interval.Basic.pure (L135-L137)\ndef pure (a : \u03b1) : NonemptyInterval \u03b1 :=\n\u27e8\u27e8a, a\u27e9, le_rfl\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_injective (L63-L65)\ntheorem toDualProd_injective : Injective (toDualProd : NonemptyInterval \u03b1 \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1) :=\ntoProd_injective\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Order.Interval.Basic.map\u2082 (L178-L181)\ndef map\u2082 (f : \u03b1 \u2192 \u03b2 \u2192 \u03b3) (h\u2080 : \u2200 b, Monotone fun a => f a b) (h\u2081 : \u2200 a, Monotone (f a)) :\n NonemptyInterval \u03b1 \u2192 NonemptyInterval \u03b2 \u2192 NonemptyInterval \u03b3 := fun s t =>\n\u27e8(f s.fst t.fst, f s.snd t.snd), (h\u2080 _ s.fst_le_snd).trans <| h\u2081 _ t.fst_le_snd\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd (L56-L58)\ndef toDualProd : NonemptyInterval \u03b1 \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1 :=\ntoProd\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Order.Interval.Basic.fst_dual (L97-L99)\ntheorem fst_dual (s : NonemptyInterval \u03b1) : s.dual.fst = toDual s.snd :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProdHom (L86-L91)\ndef toDualProdHom : NonemptyInterval \u03b1 \u21aao \u03b1\u1d52\u1d48 \u00d7 \u03b1 where\n toFun := toDualProd\ninj' := toDualProd_injective\n map_rel_iff' := Iff.rfl\n\n/-- Turn an interval into an interval in the dual order. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Order.Interval.Basic.instCanLift (L51-L55)\ninstance instCanLift :\n CanLift (\u03b1 \u00d7 \u03b1) (NonemptyInterval \u03b1) NonemptyInterval.toProd (fun x \u21a6 x.1 \u2264 x.2) where\n prf x hx := \u27e8\u27e8x, hx\u27e9, rfl\u27e9\n/-- The injection that induces the order on intervals. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_apply (L60-L62)\ntheorem toDualProd_apply (s : NonemptyInterval \u03b1) : s.toDualProd = (toDual s.fst, s.snd) :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Order.Interval.Basic.map (L159-L161)\ndef map (f : \u03b1 \u2192o \u03b2) (a : NonemptyInterval \u03b1) : NonemptyInterval \u03b2 :=\n\u27e8a.toProd.map f f, f.mono a.fst_le_snd\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Order.Interval.Basic.coe_nonempty (L130-L133)\ntheorem coe_nonempty (s : NonemptyInterval \u03b1) : (s : Set \u03b1).Nonempty :=\nnonempty_Icc.2 s.fst_le_snd\n\n/-- `{a}` as an interval. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Order.Interval.Basic.snd_dual (L101-L109)\ntheorem snd_dual (s : NonemptyInterval \u03b1) : s.dual.snd = toDual s.fst :=\nrfl\n\nend LE\n\nsection Preorder\n\nvariable [Preorder \u03b1] [Preorder \u03b2] [Preorder \u03b3] {s : NonemptyInterval \u03b1} {x : \u03b1 \u00d7 \u03b1} {a : \u03b1}\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Order.Interval.Basic.le (L75-L77)\ninstance le : LE (NonemptyInterval \u03b1) :=\n\u27e8fun s t => t.fst \u2264 s.fst \u2227 s.snd \u2264 t.snd\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Order.Interval.Basic.map_pure (L163-L165)\ntheorem map_pure (f : \u03b1 \u2192o \u03b2) (a : \u03b1) : (pure a).map f = pure (f a) :=\nrfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Order.Interval.Basic.dual_map (L172-L176)\ntheorem dual_map (f : \u03b1 \u2192o \u03b2) (a : NonemptyInterval \u03b1) :\n dual (a.map f) = a.dual.map f.dual :=\nrfl\n\n/-- Binary pushforward of nonempty intervals. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Order.Interval.Basic.toProd_injective (L46-L50)\ntheorem toProd_injective : Injective (toProd : NonemptyInterval \u03b1 \u2192 \u03b1 \u00d7 \u03b1) :=\nfun s t h => by cases s; cases t; congr\n\n/-- Allow lifting a pair `(a, b)` with `a \u2264 b` to `NonemptyInterval`\nin the `lift` tactic. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Order.Interval.Basic.pure_injective (L141-L143)\ntheorem pure_injective : Injective (pure : \u03b1 \u2192 NonemptyInterval \u03b1) := fun _ _ =>\ncongr_arg <| Prod.fst \u2218 toProd\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Order.Interval.Basic.toDualProd_mono (L113-L114)\ntheorem toDualProd_mono : Monotone (toDualProd : _ \u2192 \u03b1\u1d52\u1d48 \u00d7 \u03b1) := fun _ _ => id\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Interval/Set/Basic.lean", "module": "Mathlib.Order.Interval.Set.Basic", "declaration": "Mathlib.Order.Interval.Set.Basic.Icc_ofDual", "span": "L136-L138", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Set/Basic.lean#L136"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3093, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 7961, "lean_code_chars": 6381, "natural_language_chars": 1580, "lean_code_ratio": 0.8015, "line_count": 303, "imports_count": 0, "declarations_count": 768, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "49376b0b6dc79e6e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Combinatorics.SimpleGraph.Walks.Operations.nodup_tail_support_reverse", "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.Combinatorics.SimpleGraph.Walks.Operations)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem nodup_tail_support_reverse {u : V} {p : G.Walk u u} :\n p.reverse.support.tail.Nodup \u2194 p.support.tail.Nodup\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_rfl_rfl (L52-L53)\ntheorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_copy (L55-L60)\ntheorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)\n (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :\n (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by\nsubst_vars\n rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_nil (L62-L65)\ntheorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = nil := by\nsubst_vars\n rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_cons (L66-L70)\ntheorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') :\n (Walk.cons h p).copy hu hw = Walk.cons (hu \u25b8 h) (p.copy rfl hw) := by\nsubst_vars\n rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_copy (L72-L77)\ntheorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) :\n cons h (p.copy hv hw) = (Walk.cons (hv \u25b8 h) p).copy rfl hw := by\nsubst_vars\n rfl\n\n/-- The concatenation of two compatible walks. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append (L79-L84)\ndef append {u v w : V} : G.Walk u v \u2192 G.Walk v w \u2192 G.Walk u w\n | nil, q => q\n | cons h p, q => cons h (p.append q)\n\n/-- The reversed version of `SimpleGraph.Walk.cons`, concatenating an edge to\nthe end of a walk. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat (L85-L86)\ndef concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat_eq_append (L87-L95)\ntheorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) :\n p.concat h = p.append (cons h nil) := rfl\n/-- The concatenation of the reverse of the first walk with the second walk. -/\nprotected def reverseAux {u v w : V} : G.Walk u v \u2192 G.Walk u w \u2192 G.Walk v w\n | nil, q => q\n | cons h p, q => Walk.reverseAux p (cons (G.symm h) q)\n\n/-- The walk in reverse. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.reverse (L97-L98)\ndef reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_append (L100-L102)\ntheorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) :\n (cons h p).append q = cons h (p.append q) := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_nil_append (L104-L106)\ntheorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) :\n (cons h nil).append p = cons h p := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.nil_append (L108-L110)\ntheorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_nil (L112-L114)\ntheorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by\ninduction p <;> simp [*]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_assoc (L115-L118)\ntheorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) :\n p.append (q.append r) = (p.append q).append r := by\ninduction p <;> simp [*]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_copy_copy (L120-L125)\ntheorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w)\n (hu : u = u') (hv : v = v') (hw : w = w') :\n (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by\nsubst_vars\n rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_add_edge_iff_of_not_reachable (L374-L379)\ntheorem isAcyclic_add_edge_iff_of_not_reachable (x y : V) (hxy : \u00ac G.Reachable x y) :\n (G \u2294 fromEdgeSet {s(x, y)}).IsAcyclic \u2194 IsAcyclic G :=\n\u27e8.anti le_sup_left, .isAcyclic_sup_fromEdgeSet_of_not_reachable hxy\u27e9\n\n/-- Adding an edge results in an acyclic graph iff the original graph was acyclic and\nthe edge connects vertices that previously had no path between them. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_reachable_eq (L413-L427)\ntheorem maximal_isAcyclic_iff_reachable_eq {F : SimpleGraph V} (hle : F \u2264 G) (hF : F.IsAcyclic) :\n Maximal (fun F \u21a6 F \u2264 G \u2227 F.IsAcyclic) F \u2194 F.Reachable = G.Reachable := by\nrefine \u27e8reachable_eq_of_maximal_isAcyclic F, fun h \u21a6 ?_\u27e9\n by_contra\n have \u27e8H, hFH, hHG, hH\u27e9 := exists_gt_of_not_maximal \u27e8hle, hF\u27e9 this\n have \u27e8e, heH, heF\u27e9 := Set.exists_of_ssubset <| edgeSet_strict_mono hFH\n have h_bridge : (F \u2294 fromEdgeSet {e}).IsBridge e := by\n refine isAcyclic_iff_forall_edge_isBridge.mp ?_ <| by simp [H.not_isDiag_of_mem_edgeSet heH]\n exact hH.anti <| sup_le_iff.mpr \u27e8hFH.le, H.fromEdgeSet_le.mpr <| by grind\u27e9\n have : (F \u2294 fromEdgeSet {e}) \\ fromEdgeSet {e} = F := by simpa using heF\n cases e\n rw [isBridge_iff, this, h] at h_bridge\n exact h_bridge.right <| hHG heH |>.reachable\n\n/-- A subgraph of a connected graph is maximal acyclic iff it is a tree. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Subgraph (L151-L153)\nlemma Subgraph.isAcyclic_coe_bot (G : SimpleGraph V) : (\u22a5 : G.Subgraph).coe.IsAcyclic :=\n@IsAcyclic.of_subsingleton _ (Set.isEmpty_coe_sort.mpr rfl).instSubsingleton _\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Connected (L428-L436)\ntheorem Connected.maximal_le_isAcyclic_iff_isTree {T : SimpleGraph V} (hG : G.Connected)\n (hT : T \u2264 G) : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) T \u2194 T.IsTree := by\nhave := hG.nonempty\n refine \u27e8fun h \u21a6 \u27e8\u27e8fun u v \u21a6 ?_\u27e9, h.1.2\u27e9, fun hT' \u21a6 ?_\u27e9\n \u00b7 exact G.reachable_eq_of_maximal_isAcyclic T h \u25b8 hG.preconnected u v\n \u00b7 rw [maximal_isAcyclic_iff_reachable_eq hT hT'.isAcyclic,\n T.preconnected_iff_reachable_eq_top.mp hT'.preconnected,\n G.preconnected_iff_reachable_eq_top.mp hG.preconnected]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_connected_and_card (L486-L499)\nlemma isTree_iff_connected_and_card [Finite V] :\n G.IsTree \u2194 G.Connected \u2227 Nat.card G.edgeSet + 1 = Nat.card V := by\nhave := Fintype.ofFinite V\n classical\n refine \u27e8fun h \u21a6 \u27e8h.connected, by simpa [edgeFinset] using h.card_edgeFinset\u27e9,\n fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 \u27e8h\u2081, ?_\u27e9\u27e9\n simp_rw [isAcyclic_iff_forall_adj_isBridge]\n refine fun x y h \u21a6 by_contra fun hbr \u21a6\n (h\u2081.connected_delete_edge_of_not_isBridge hbr).card_vert_le_card_edgeSet_add_one.not_gt ?_\n rw [Nat.card_eq_fintype_card, \u2190 edgeFinset_card, \u2190 h\u2082, Nat.card_eq_fintype_card,\n \u2190 edgeFinset_card, add_lt_add_iff_right]\n exact Finset.card_lt_card <| by simpa [deleteEdges, edgeFinset]\n\n/-- The minimum degree of all vertices in a nontrivial tree is one. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sSup_of_isAcyclic_directedOn (L118-L126)\nlemma isAcyclic_sSup_of_isAcyclic_directedOn (Hs : Set <| SimpleGraph V)\n (h_acyc : \u2200 H \u2208 Hs, H.IsAcyclic) (h_dir : DirectedOn (\u00b7 \u2264 \u00b7) Hs) : IsAcyclic (sSup Hs) := by\nrcases Hs.eq_empty_or_nonempty with rfl | hnemp\n \u00b7 simp\n \u00b7 intro u p hp\n obtain \u27e8H, hH, hpH\u27e9 := p.exists_mem_contains_edges_of_directed Hs hnemp h_dir\n exact h_acyc H hH (p.transfer H hpH) <| Walk.IsCycle.transfer hp hpH\n\n/-- Every acyclic subgraph `H \u2264 G` is contained in a maximal such subgraph. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_existsUnique_path (L248-L269)\ntheorem isTree_iff_existsUnique_path :\n G.IsTree \u2194 Nonempty V \u2227 \u2200 v w : V, \u2203! p : G.Walk v w, p.IsPath := by\nclassical\n rw [isTree_iff, isAcyclic_iff_path_unique]\n constructor\n \u00b7 rintro \u27e8hc, hu\u27e9\n refine \u27e8hc.nonempty, ?_\u27e9\n intro v w\n let q := (hc v w).some.toPath\n use q\n simp only [true_and, Path.isPath]\n intro p hp\n specialize hu \u27e8p, hp\u27e9 q\n exact Subtype.ext_iff.mp hu\n \u00b7 rintro \u27e8hV, h\u27e9\n refine \u27e8Connected.mk ?_, ?_\u27e9\n \u00b7 intro v w\n obtain \u27e8p, _\u27e9 := h v w\n exact p.reachable\n \u00b7 rintro v w \u27e8p, hp\u27e9 \u27e8q, hq\u27e9\n simp only [ExistsUnique.unique (h v w) hp hq]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_path_unique (L225-L227)\ntheorem isAcyclic_iff_path_unique : G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984 (p q : G.Path v w), p = q :=\n\u27e8IsAcyclic.path_unique, isAcyclic_of_path_unique\u27e9\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_of_path_unique (L214-L224)\ntheorem isAcyclic_of_path_unique (h : \u2200 (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by\nintro v c hc\n simp only [Walk.isCycle_def, Ne] at hc\n cases c with\n | nil => cases hc.2.1 rfl\n | cons ha c' =>\n simp only [Walk.isTrail_cons, Walk.support_cons, List.tail_cons] at hc\n specialize h _ _ \u27e8c', by simp only [Walk.isPath_def, hc.2]\u27e9 (Path.singleton ha.symm)\n rw [Path.singleton, Subtype.mk.injEq] at h\n simp [h] at hc\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic (L450-L456)\ntheorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H \u2264 G)\n (hH_isAcyclic : H.IsAcyclic) :\n \u2203 F : SimpleGraph V, H \u2264 F \u2227 F \u2264 G \u2227 F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic\n grind [maximal_isAcyclic_iff_reachable_eq, Maximal]\n\n/-- Every graph has a spanning forest. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_maximal_isAcyclic_of_le_isAcyclic (L127-L135)\ntheorem exists_maximal_isAcyclic_of_le_isAcyclic\n {H : SimpleGraph V} (hHG : H \u2264 G) (hH : H.IsAcyclic) :\n \u2203 H' : SimpleGraph V, H \u2264 H' \u2227 Maximal (fun H => H \u2264 G \u2227 H.IsAcyclic) H' := by\nrefine zorn_le_nonempty\u2080 {H | H \u2264 G \u2227 H.IsAcyclic} (fun c hcs hc y hy \u21a6 ?_) _ \u27e8hHG, hH\u27e9\n refine \u27e8sSup c, \u27e8?_, ?_\u27e9, fun _ \u21a6 le_sSup\u27e9\n \u00b7 grind [sSup_le_iff]\n \u00b7 exact isAcyclic_sSup_of_isAcyclic_directedOn c (by grind) hc.directedOn\n\n/-- A connected component of an acyclic graph is a tree. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_isTree (L438-L443)\ntheorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :\n Maximal IsAcyclic T \u2194 T.IsTree := by\nsimp [\u2190 connected_top.maximal_le_isAcyclic_iff_isTree le_top]\n\n/-- A maximally acyclic graph is a tree. This is similar to `maximal_isAcyclic_iff_isTree` except\nwith `Nonempty V` as part of the iff rather than an assumption. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Iso (L80-L83)\nlemma Iso.isAcyclic_iff (f : G \u2243g G') : G.IsAcyclic \u2194 G'.IsAcyclic :=\n\u27e8fun h \u21a6 h.embedding f.symm, fun h \u21a6 h.embedding f\u27e9\n\n/-- Isomorphic graphs are trees together. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_pairwise_not_isEdgeReachable_two (L650-L658)\nlemma isAcyclic_iff_pairwise_not_isEdgeReachable_two :\n G.IsAcyclic \u2194 Pairwise (\u00acG.IsEdgeReachable 2 \u00b7 \u00b7) := by\nrefine \u27e8fun h _ _ hne he \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_isCycle_of_two_le_isEdgeReachable hne le_rfl he\n exact h w hw\n \u00b7 refine isAcyclic_iff_forall_adj_isBridge.mpr fun _ _ hadj \u21a6 ?_\n exact isBridge_iff_adj_and_not_isEdgeConnected_two.mpr \u27e8hadj, h hadj.ne\u27e9\n\nend SimpleGraph\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.reachable_eq_of_maximal_isAcyclic (L397-L412)\nlemma reachable_eq_of_maximal_isAcyclic (F : SimpleGraph V)\n (h : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) F) : F.Reachable = G.Reachable := by\next u v\n refine \u27e8.mono h.prop.left, fun \u27e8p\u27e9 \u21a6 ?_\u27e9\n by_contra\n let s : F.ConnectedComponent := .mk _ u\n have : v \u2209 s := this \u2218 s.reachable_of_mem_supp rfl\n have : \u2203 d \u2208 p.darts, d.fst \u2208 s \u2227 d.snd \u2209 s := p.exists_boundary_dart s rfl this\n rcases this with \u27e8\u27e8\u27e8u', v'\u27e9, huv\u27e9, _, hu, hv\u27e9\n have : \u00acF.Reachable v' u' := mt ConnectedComponent.sound <| s.mem_supp_iff u' |>.mp hu \u25b8 hv\n suffices F \u2294 fromEdgeSet {s(v', u')} \u2264 F by\n grind [Adj.reachable, sup_le_iff, le_iff_adj, fromEdgeSet_adj]\n refine h.le_of_ge \u27e8?_, h.prop.right.isAcyclic_sup_fromEdgeSet_of_not_reachable this\u27e9 le_sup_left\n grind [Maximal, sup_le, le_iff_adj, fromEdgeSet_adj, huv.symm]\n\n/-- A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsAcyclic (L55-L57)\ndef IsAcyclic : Prop := \u2200 \u2983v : V\u2984 (c : G.Walk v v), \u00acc.IsCycle\n/-- A *tree* is a connected acyclic graph. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_maximal_isAcyclic (L444-L449)\ntheorem isTree_iff_maximal_isAcyclic : G.IsTree \u2194 Nonempty V \u2227 Maximal IsAcyclic G := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8_, h\u27e9 \u21a6 G.maximal_isAcyclic_iff_isTree.mp h\u27e9\n have := h.nonempty\n exact \u27e8this, G.maximal_isAcyclic_iff_isTree.mpr h\u27e9\n\n/-- Every acyclic subgraph can be extended to a spanning forest. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_edge_isBridge (L181-L184)\ntheorem isAcyclic_iff_forall_edge_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983e\u2984, e \u2208 (G.edgeSet) \u2192 G.IsBridge e := by\nsimp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sup_fromEdgeSet_iff (L380-L396)\ntheorem isAcyclic_sup_fromEdgeSet_iff {u v : V} :\n (G \u2294 fromEdgeSet {s(u, v)}).IsAcyclic \u2194\n G.IsAcyclic \u2227 (G.Reachable u v \u2192 u = v \u2228 G.Adj u v) := by\nby_cases huv : u = v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, Sym2.mem_diagSet, Sym2.mk_isDiag_iff]\n by_cases hadj : G.Adj u v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, mem_edgeSet]\n refine \u27e8?_, fun \u27e8hacyc, hreach\u27e9 \u21a6 hacyc.isAcyclic_sup_fromEdgeSet_of_not_reachable <| by grind\u27e9\n refine fun hacyc \u21a6 \u27e8hacyc.anti le_sup_left, fun hreach \u21a6 False.elim ?_\u27e9\n have := isAcyclic_iff_forall_edge_isBridge.mp (e := s(u, v)) hacyc <| by simp [huv]\n refine isBridge_iff.mp this |>.right <| hreach.mono <| Eq.le <| Eq.symm ?_\n rw [sup_sdiff_right_self]\n exact deleteEdges_eq_self.mpr <| Set.disjoint_singleton_right.mpr hadj\n\n/--\nThe reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.\n-/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_of_minimal_connected (L353-L359)\nlemma isTree_of_minimal_connected (h : Minimal Connected G) : IsTree G := by\nrw [isTree_iff, and_iff_right h.prop, isAcyclic_iff_forall_adj_isBridge]\n exact fun _ _ _ \u21a6 by_contra fun hbr \u21a6 h.not_prop_of_lt\n (by simpa [deleteEdges, \u2190 edgeSet_ssubset_edgeSet])\n <| h.prop.connected_delete_edge_of_not_isBridge hbr\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_minimal_connected (L360-L368)\nlemma isTree_iff_minimal_connected : IsTree G \u2194 Minimal Connected G := by\nrefine \u27e8fun htree \u21a6 \u27e8htree.connected, fun G' h' hle u v hadj \u21a6 ?_\u27e9, isTree_of_minimal_connected\u27e9\n have \u27e8p, hp\u27e9 := h'.exists_isPath u v\n have := congrArg Walk.edges <| congrArg Subtype.val <|\n htree.isAcyclic.path_unique \u27e8p.mapLe hle, hp.mapLe hle\u27e9 <| Path.singleton hadj\n simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this\n simp [this, p.adj_of_mem_edges]\n\n/-- Connecting two unreachable vertices by an edge preserves acyclicity. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsTree (L154-L156)\nlemma IsTree.of_subsingleton [Nonempty V] [Subsingleton V] {G : SimpleGraph V} : G.IsTree :=\n\u27e8.of_subsingleton, .of_subsingleton\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isCycle_of_two_le_isEdgeReachable (L642-L649)\nlemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u \u2260 v) {n : \u2115} (hn : 2 \u2264 n)\n (h : G.IsEdgeReachable n u v) : \u2203 w : G.Walk u u, w.IsCycle := by\nclassical\n obtain \u27e8w, hw, h\u27e9 := exists_adj_isEdgeReachable_two huv (h.anti hn)\n have := @h {s(u, w)} (by simp)\n obtain \u27e8w, p, hp\u2081, hp\u2082\u27e9 := adj_and_reachable_delete_edges_iff_exists_cycle.mp \u27e8hw, this\u27e9\n exact \u27e8p.rotate _ (p.fst_mem_support_of_mem_edges hp\u2082), IsCycle.rotate hp\u2081 _\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le (L457-L462)\ntheorem exists_isAcyclic_reachable_eq_le :\n \u2203 F \u2264 G, F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot\n grind\n\n/-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_adj_isBridge (L167-L180)\ntheorem isAcyclic_iff_forall_adj_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984, G.Adj v w \u2192 G.IsBridge s(v, w) := by\nsimp_rw [isBridge_iff_adj_and_forall_cycle_notMem]\n constructor\n \u00b7 intro ha v w hvw\n apply And.intro hvw\n intro u p hp\n cases ha p hp\n \u00b7 rintro hb v (_ | \u27e8ha, p\u27e9) hp\n \u00b7 exact hp.not_of_nil\n \u00b7 apply (hb ha).2 _ hp\n rw [Walk.edges_cons]\n apply List.mem_cons_self\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.Combinatorics.SimpleGraph.Walks.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem nodup_tail_support_reverse {u : V} {p : G.Walk u u} :\n p.reverse.support.tail.Nodup \u2194 p.support.tail.Nodup\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_rfl_rfl (L52-L53)\ntheorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_copy (L55-L60)\ntheorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)\n (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :\n (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by\nsubst_vars\n rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_nil (L62-L65)\ntheorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = nil := by\nsubst_vars\n rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_cons (L66-L70)\ntheorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') :\n (Walk.cons h p).copy hu hw = Walk.cons (hu \u25b8 h) (p.copy rfl hw) := by\nsubst_vars\n rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_copy (L72-L77)\ntheorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) :\n cons h (p.copy hv hw) = (Walk.cons (hv \u25b8 h) p).copy rfl hw := by\nsubst_vars\n rfl\n\n/-- The concatenation of two compatible walks. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append (L79-L84)\ndef append {u v w : V} : G.Walk u v \u2192 G.Walk v w \u2192 G.Walk u w\n | nil, q => q\n | cons h p, q => cons h (p.append q)\n\n/-- The reversed version of `SimpleGraph.Walk.cons`, concatenating an edge to\nthe end of a walk. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat (L85-L86)\ndef concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.concat_eq_append (L87-L95)\ntheorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) :\n p.concat h = p.append (cons h nil) := rfl\n/-- The concatenation of the reverse of the first walk with the second walk. -/\nprotected def reverseAux {u v w : V} : G.Walk u v \u2192 G.Walk u w \u2192 G.Walk v w\n | nil, q => q\n | cons h p, q => Walk.reverseAux p (cons (G.symm h) q)\n\n/-- The walk in reverse. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.reverse (L97-L98)\ndef reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_append (L100-L102)\ntheorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) :\n (cons h p).append q = cons h (p.append q) := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.cons_nil_append (L104-L106)\ntheorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) :\n (cons h nil).append p = cons h p := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.nil_append (L108-L110)\ntheorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_nil (L112-L114)\ntheorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by\ninduction p <;> simp [*]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_assoc (L115-L118)\ntheorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) :\n p.append (q.append r) = (p.append q).append r := by\ninduction p <;> simp [*]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.append_copy_copy (L120-L125)\ntheorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w)\n (hu : u = u') (hv : v = v') (hw : w = w') :\n (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by\nsubst_vars\n rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_add_edge_iff_of_not_reachable (L374-L379)\ntheorem isAcyclic_add_edge_iff_of_not_reachable (x y : V) (hxy : \u00ac G.Reachable x y) :\n (G \u2294 fromEdgeSet {s(x, y)}).IsAcyclic \u2194 IsAcyclic G :=\n\u27e8.anti le_sup_left, .isAcyclic_sup_fromEdgeSet_of_not_reachable hxy\u27e9\n\n/-- Adding an edge results in an acyclic graph iff the original graph was acyclic and\nthe edge connects vertices that previously had no path between them. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_reachable_eq (L413-L427)\ntheorem maximal_isAcyclic_iff_reachable_eq {F : SimpleGraph V} (hle : F \u2264 G) (hF : F.IsAcyclic) :\n Maximal (fun F \u21a6 F \u2264 G \u2227 F.IsAcyclic) F \u2194 F.Reachable = G.Reachable := by\nrefine \u27e8reachable_eq_of_maximal_isAcyclic F, fun h \u21a6 ?_\u27e9\n by_contra\n have \u27e8H, hFH, hHG, hH\u27e9 := exists_gt_of_not_maximal \u27e8hle, hF\u27e9 this\n have \u27e8e, heH, heF\u27e9 := Set.exists_of_ssubset <| edgeSet_strict_mono hFH\n have h_bridge : (F \u2294 fromEdgeSet {e}).IsBridge e := by\n refine isAcyclic_iff_forall_edge_isBridge.mp ?_ <| by simp [H.not_isDiag_of_mem_edgeSet heH]\n exact hH.anti <| sup_le_iff.mpr \u27e8hFH.le, H.fromEdgeSet_le.mpr <| by grind\u27e9\n have : (F \u2294 fromEdgeSet {e}) \\ fromEdgeSet {e} = F := by simpa using heF\n cases e\n rw [isBridge_iff, this, h] at h_bridge\n exact h_bridge.right <| hHG heH |>.reachable\n\n/-- A subgraph of a connected graph is maximal acyclic iff it is a tree. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Subgraph (L151-L153)\nlemma Subgraph.isAcyclic_coe_bot (G : SimpleGraph V) : (\u22a5 : G.Subgraph).coe.IsAcyclic :=\n@IsAcyclic.of_subsingleton _ (Set.isEmpty_coe_sort.mpr rfl).instSubsingleton _\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Connected (L428-L436)\ntheorem Connected.maximal_le_isAcyclic_iff_isTree {T : SimpleGraph V} (hG : G.Connected)\n (hT : T \u2264 G) : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) T \u2194 T.IsTree := by\nhave := hG.nonempty\n refine \u27e8fun h \u21a6 \u27e8\u27e8fun u v \u21a6 ?_\u27e9, h.1.2\u27e9, fun hT' \u21a6 ?_\u27e9\n \u00b7 exact G.reachable_eq_of_maximal_isAcyclic T h \u25b8 hG.preconnected u v\n \u00b7 rw [maximal_isAcyclic_iff_reachable_eq hT hT'.isAcyclic,\n T.preconnected_iff_reachable_eq_top.mp hT'.preconnected,\n G.preconnected_iff_reachable_eq_top.mp hG.preconnected]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_connected_and_card (L486-L499)\nlemma isTree_iff_connected_and_card [Finite V] :\n G.IsTree \u2194 G.Connected \u2227 Nat.card G.edgeSet + 1 = Nat.card V := by\nhave := Fintype.ofFinite V\n classical\n refine \u27e8fun h \u21a6 \u27e8h.connected, by simpa [edgeFinset] using h.card_edgeFinset\u27e9,\n fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 \u27e8h\u2081, ?_\u27e9\u27e9\n simp_rw [isAcyclic_iff_forall_adj_isBridge]\n refine fun x y h \u21a6 by_contra fun hbr \u21a6\n (h\u2081.connected_delete_edge_of_not_isBridge hbr).card_vert_le_card_edgeSet_add_one.not_gt ?_\n rw [Nat.card_eq_fintype_card, \u2190 edgeFinset_card, \u2190 h\u2082, Nat.card_eq_fintype_card,\n \u2190 edgeFinset_card, add_lt_add_iff_right]\n exact Finset.card_lt_card <| by simpa [deleteEdges, edgeFinset]\n\n/-- The minimum degree of all vertices in a nontrivial tree is one. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sSup_of_isAcyclic_directedOn (L118-L126)\nlemma isAcyclic_sSup_of_isAcyclic_directedOn (Hs : Set <| SimpleGraph V)\n (h_acyc : \u2200 H \u2208 Hs, H.IsAcyclic) (h_dir : DirectedOn (\u00b7 \u2264 \u00b7) Hs) : IsAcyclic (sSup Hs) := by\nrcases Hs.eq_empty_or_nonempty with rfl | hnemp\n \u00b7 simp\n \u00b7 intro u p hp\n obtain \u27e8H, hH, hpH\u27e9 := p.exists_mem_contains_edges_of_directed Hs hnemp h_dir\n exact h_acyc H hH (p.transfer H hpH) <| Walk.IsCycle.transfer hp hpH\n\n/-- Every acyclic subgraph `H \u2264 G` is contained in a maximal such subgraph. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_existsUnique_path (L248-L269)\ntheorem isTree_iff_existsUnique_path :\n G.IsTree \u2194 Nonempty V \u2227 \u2200 v w : V, \u2203! p : G.Walk v w, p.IsPath := by\nclassical\n rw [isTree_iff, isAcyclic_iff_path_unique]\n constructor\n \u00b7 rintro \u27e8hc, hu\u27e9\n refine \u27e8hc.nonempty, ?_\u27e9\n intro v w\n let q := (hc v w).some.toPath\n use q\n simp only [true_and, Path.isPath]\n intro p hp\n specialize hu \u27e8p, hp\u27e9 q\n exact Subtype.ext_iff.mp hu\n \u00b7 rintro \u27e8hV, h\u27e9\n refine \u27e8Connected.mk ?_, ?_\u27e9\n \u00b7 intro v w\n obtain \u27e8p, _\u27e9 := h v w\n exact p.reachable\n \u00b7 rintro v w \u27e8p, hp\u27e9 \u27e8q, hq\u27e9\n simp only [ExistsUnique.unique (h v w) hp hq]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_path_unique (L225-L227)\ntheorem isAcyclic_iff_path_unique : G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984 (p q : G.Path v w), p = q :=\n\u27e8IsAcyclic.path_unique, isAcyclic_of_path_unique\u27e9\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_of_path_unique (L214-L224)\ntheorem isAcyclic_of_path_unique (h : \u2200 (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by\nintro v c hc\n simp only [Walk.isCycle_def, Ne] at hc\n cases c with\n | nil => cases hc.2.1 rfl\n | cons ha c' =>\n simp only [Walk.isTrail_cons, Walk.support_cons, List.tail_cons] at hc\n specialize h _ _ \u27e8c', by simp only [Walk.isPath_def, hc.2]\u27e9 (Path.singleton ha.symm)\n rw [Path.singleton, Subtype.mk.injEq] at h\n simp [h] at hc\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic (L450-L456)\ntheorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H \u2264 G)\n (hH_isAcyclic : H.IsAcyclic) :\n \u2203 F : SimpleGraph V, H \u2264 F \u2227 F \u2264 G \u2227 F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic\n grind [maximal_isAcyclic_iff_reachable_eq, Maximal]\n\n/-- Every graph has a spanning forest. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_maximal_isAcyclic_of_le_isAcyclic (L127-L135)\ntheorem exists_maximal_isAcyclic_of_le_isAcyclic\n {H : SimpleGraph V} (hHG : H \u2264 G) (hH : H.IsAcyclic) :\n \u2203 H' : SimpleGraph V, H \u2264 H' \u2227 Maximal (fun H => H \u2264 G \u2227 H.IsAcyclic) H' := by\nrefine zorn_le_nonempty\u2080 {H | H \u2264 G \u2227 H.IsAcyclic} (fun c hcs hc y hy \u21a6 ?_) _ \u27e8hHG, hH\u27e9\n refine \u27e8sSup c, \u27e8?_, ?_\u27e9, fun _ \u21a6 le_sSup\u27e9\n \u00b7 grind [sSup_le_iff]\n \u00b7 exact isAcyclic_sSup_of_isAcyclic_directedOn c (by grind) hc.directedOn\n\n/-- A connected component of an acyclic graph is a tree. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_isTree (L438-L443)\ntheorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :\n Maximal IsAcyclic T \u2194 T.IsTree := by\nsimp [\u2190 connected_top.maximal_le_isAcyclic_iff_isTree le_top]\n\n/-- A maximally acyclic graph is a tree. This is similar to `maximal_isAcyclic_iff_isTree` except\nwith `Nonempty V` as part of the iff rather than an assumption. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Iso (L80-L83)\nlemma Iso.isAcyclic_iff (f : G \u2243g G') : G.IsAcyclic \u2194 G'.IsAcyclic :=\n\u27e8fun h \u21a6 h.embedding f.symm, fun h \u21a6 h.embedding f\u27e9\n\n/-- Isomorphic graphs are trees together. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_pairwise_not_isEdgeReachable_two (L650-L658)\nlemma isAcyclic_iff_pairwise_not_isEdgeReachable_two :\n G.IsAcyclic \u2194 Pairwise (\u00acG.IsEdgeReachable 2 \u00b7 \u00b7) := by\nrefine \u27e8fun h _ _ hne he \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_isCycle_of_two_le_isEdgeReachable hne le_rfl he\n exact h w hw\n \u00b7 refine isAcyclic_iff_forall_adj_isBridge.mpr fun _ _ hadj \u21a6 ?_\n exact isBridge_iff_adj_and_not_isEdgeConnected_two.mpr \u27e8hadj, h hadj.ne\u27e9\n\nend SimpleGraph\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.reachable_eq_of_maximal_isAcyclic (L397-L412)\nlemma reachable_eq_of_maximal_isAcyclic (F : SimpleGraph V)\n (h : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) F) : F.Reachable = G.Reachable := by\next u v\n refine \u27e8.mono h.prop.left, fun \u27e8p\u27e9 \u21a6 ?_\u27e9\n by_contra\n let s : F.ConnectedComponent := .mk _ u\n have : v \u2209 s := this \u2218 s.reachable_of_mem_supp rfl\n have : \u2203 d \u2208 p.darts, d.fst \u2208 s \u2227 d.snd \u2209 s := p.exists_boundary_dart s rfl this\n rcases this with \u27e8\u27e8\u27e8u', v'\u27e9, huv\u27e9, _, hu, hv\u27e9\n have : \u00acF.Reachable v' u' := mt ConnectedComponent.sound <| s.mem_supp_iff u' |>.mp hu \u25b8 hv\n suffices F \u2294 fromEdgeSet {s(v', u')} \u2264 F by\n grind [Adj.reachable, sup_le_iff, le_iff_adj, fromEdgeSet_adj]\n refine h.le_of_ge \u27e8?_, h.prop.right.isAcyclic_sup_fromEdgeSet_of_not_reachable this\u27e9 le_sup_left\n grind [Maximal, sup_le, le_iff_adj, fromEdgeSet_adj, huv.symm]\n\n/-- A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsAcyclic (L55-L57)\ndef IsAcyclic : Prop := \u2200 \u2983v : V\u2984 (c : G.Walk v v), \u00acc.IsCycle\n/-- A *tree* is a connected acyclic graph. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_maximal_isAcyclic (L444-L449)\ntheorem isTree_iff_maximal_isAcyclic : G.IsTree \u2194 Nonempty V \u2227 Maximal IsAcyclic G := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8_, h\u27e9 \u21a6 G.maximal_isAcyclic_iff_isTree.mp h\u27e9\n have := h.nonempty\n exact \u27e8this, G.maximal_isAcyclic_iff_isTree.mpr h\u27e9\n\n/-- Every acyclic subgraph can be extended to a spanning forest. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_edge_isBridge (L181-L184)\ntheorem isAcyclic_iff_forall_edge_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983e\u2984, e \u2208 (G.edgeSet) \u2192 G.IsBridge e := by\nsimp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sup_fromEdgeSet_iff (L380-L396)\ntheorem isAcyclic_sup_fromEdgeSet_iff {u v : V} :\n (G \u2294 fromEdgeSet {s(u, v)}).IsAcyclic \u2194\n G.IsAcyclic \u2227 (G.Reachable u v \u2192 u = v \u2228 G.Adj u v) := by\nby_cases huv : u = v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, Sym2.mem_diagSet, Sym2.mk_isDiag_iff]\n by_cases hadj : G.Adj u v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, mem_edgeSet]\n refine \u27e8?_, fun \u27e8hacyc, hreach\u27e9 \u21a6 hacyc.isAcyclic_sup_fromEdgeSet_of_not_reachable <| by grind\u27e9\n refine fun hacyc \u21a6 \u27e8hacyc.anti le_sup_left, fun hreach \u21a6 False.elim ?_\u27e9\n have := isAcyclic_iff_forall_edge_isBridge.mp (e := s(u, v)) hacyc <| by simp [huv]\n refine isBridge_iff.mp this |>.right <| hreach.mono <| Eq.le <| Eq.symm ?_\n rw [sup_sdiff_right_self]\n exact deleteEdges_eq_self.mpr <| Set.disjoint_singleton_right.mpr hadj\n\n/--\nThe reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.\n-/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_of_minimal_connected (L353-L359)\nlemma isTree_of_minimal_connected (h : Minimal Connected G) : IsTree G := by\nrw [isTree_iff, and_iff_right h.prop, isAcyclic_iff_forall_adj_isBridge]\n exact fun _ _ _ \u21a6 by_contra fun hbr \u21a6 h.not_prop_of_lt\n (by simpa [deleteEdges, \u2190 edgeSet_ssubset_edgeSet])\n <| h.prop.connected_delete_edge_of_not_isBridge hbr\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_minimal_connected (L360-L368)\nlemma isTree_iff_minimal_connected : IsTree G \u2194 Minimal Connected G := by\nrefine \u27e8fun htree \u21a6 \u27e8htree.connected, fun G' h' hle u v hadj \u21a6 ?_\u27e9, isTree_of_minimal_connected\u27e9\n have \u27e8p, hp\u27e9 := h'.exists_isPath u v\n have := congrArg Walk.edges <| congrArg Subtype.val <|\n htree.isAcyclic.path_unique \u27e8p.mapLe hle, hp.mapLe hle\u27e9 <| Path.singleton hadj\n simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this\n simp [this, p.adj_of_mem_edges]\n\n/-- Connecting two unreachable vertices by an edge preserves acyclicity. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsTree (L154-L156)\nlemma IsTree.of_subsingleton [Nonempty V] [Subsingleton V] {G : SimpleGraph V} : G.IsTree :=\n\u27e8.of_subsingleton, .of_subsingleton\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isCycle_of_two_le_isEdgeReachable (L642-L649)\nlemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u \u2260 v) {n : \u2115} (hn : 2 \u2264 n)\n (h : G.IsEdgeReachable n u v) : \u2203 w : G.Walk u u, w.IsCycle := by\nclassical\n obtain \u27e8w, hw, h\u27e9 := exists_adj_isEdgeReachable_two huv (h.anti hn)\n have := @h {s(u, w)} (by simp)\n obtain \u27e8w, p, hp\u2081, hp\u2082\u27e9 := adj_and_reachable_delete_edges_iff_exists_cycle.mp \u27e8hw, this\u27e9\n exact \u27e8p.rotate _ (p.fst_mem_support_of_mem_edges hp\u2082), IsCycle.rotate hp\u2081 _\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le (L457-L462)\ntheorem exists_isAcyclic_reachable_eq_le :\n \u2203 F \u2264 G, F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot\n grind\n\n/-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_adj_isBridge (L167-L180)\ntheorem isAcyclic_iff_forall_adj_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984, G.Adj v w \u2192 G.IsBridge s(v, w) := by\nsimp_rw [isBridge_iff_adj_and_forall_cycle_notMem]\n constructor\n \u00b7 intro ha v w hvw\n apply And.intro hvw\n intro u p hp\n cases ha p hp\n \u00b7 rintro hb v (_ | \u27e8ha, p\u27e9) hp\n \u00b7 exact hp.not_of_nil\n \u00b7 apply (hb ha).2 _ hp\n rw [Walk.edges_cons]\n apply List.mem_cons_self\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Walks.Operations", "declaration": "Mathlib.Combinatorics.SimpleGraph.Walks.Operations.nodup_tail_support_reverse", "span": "L469-L475", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean#L469"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6806, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 17941, "lean_code_chars": 16422, "natural_language_chars": 1519, "lean_code_ratio": 0.9153, "line_count": 469, "imports_count": 0, "declarations_count": 1904, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "143001e2fbcc10f1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Fintype.Card.card_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.Data.Fintype.Card)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem card_range {\u03b1 \u03b2 F : Type*} [FunLike F \u03b1 \u03b2] [EmbeddingLike F \u03b1 \u03b2] (f : F) [Fintype \u03b1]\n [Fintype (Set.range f)] : Fintype.card (Set.range f) = Fintype.card \u03b1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Fintype.Card.card (L40-L42)\ndef card (\u03b1) [Fintype \u03b1] : \u2115 :=\n(@univ \u03b1 _).card\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Fintype.Card.subtype_card (L43-L46)\ntheorem subtype_card {p : \u03b1 \u2192 Prop} (s : Finset \u03b1) (H : \u2200 x : \u03b1, x \u2208 s \u2194 p x) :\n @card { x // p x } (Fintype.subtype s H) = #s :=\nMultiset.card_pmap _ _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Fintype.Card.card_of_subtype (L47-L51)\ntheorem card_of_subtype {p : \u03b1 \u2192 Prop} (s : Finset \u03b1) (H : \u2200 x : \u03b1, x \u2208 s \u2194 p x)\n [Fintype { x // p x }] : card { x // p x } = #s := by\nrw [\u2190 subtype_card s H]\n congr!\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Fintype.Card.card_ofFinset (L53-L56)\ntheorem card_ofFinset {p : Set \u03b1} (s : Finset \u03b1) (H : \u2200 x, x \u2208 s \u2194 x \u2208 p) :\n @Fintype.card p (ofFinset s H) = #s :=\nFintype.subtype_card s H\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Fintype.Card.card_of_finset' (L57-L63)\ntheorem card_of_finset' {p : Set \u03b1} (s : Finset \u03b1) (H : \u2200 x, x \u2208 s \u2194 x \u2208 p) [Fintype p] :\n Fintype.card p = #s := by rw [\u2190 card_ofFinset s H]; congr!\nend Fintype\n\nnamespace Fintype\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Fintype.Card.ofEquiv_card (L64-L66)\ntheorem ofEquiv_card [Fintype \u03b1] (f : \u03b1 \u2243 \u03b2) : @card \u03b2 (ofEquiv \u03b1 f) = card \u03b1 :=\nMultiset.card_map _ _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Fintype.Card.card_congr (L67-L69)\ntheorem card_congr {\u03b1 \u03b2} [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2243 \u03b2) : card \u03b1 = card \u03b2 := by\nrw [\u2190 ofEquiv_card f]; congr!\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Fintype.Card.card_congr' (L71-L76)\ntheorem card_congr' {\u03b1 \u03b2} [Fintype \u03b1] [Fintype \u03b2] (h : \u03b1 = \u03b2) : card \u03b1 = card \u03b2 :=\ncard_congr (by rw [h])\n\n/-- Note: this lemma is specifically about `Fintype.ofSubsingleton`. For a statement about\narbitrary `Fintype` instances, use either `Fintype.card_le_one_iff_subsingleton` or\n`Fintype.card_unique`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Fintype.Card.card_ofSubsingleton (L77-L79)\ntheorem card_ofSubsingleton (a : \u03b1) [Subsingleton \u03b1] : @Fintype.card _ (ofSubsingleton a) = 1 :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Fintype.Card.card_unique (L81-L85)\ntheorem card_unique [Unique \u03b1] [h : Fintype \u03b1] : Fintype.card \u03b1 = 1 :=\nSubsingleton.elim (ofSubsingleton default) h \u25b8 card_ofSubsingleton _\n\n/-- Note: this lemma is specifically about `Fintype.ofIsEmpty`. For a statement about\narbitrary `Fintype` instances, use `Fintype.card_eq_zero`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Fintype.Card.card_ofIsEmpty (L86-L96)\ntheorem card_ofIsEmpty [IsEmpty \u03b1] : @Fintype.card \u03b1 Fintype.ofIsEmpty = 0 :=\nrfl\n\nend Fintype\n\nnamespace Set\n\nvariable {s t : Set \u03b1}\n\n-- We use an arbitrary `[Fintype s]` instance here,\n-- not necessarily coming from a `[Fintype \u03b1]`.\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Fintype.Card.toFinset_card (L98-L102)\ntheorem toFinset_card {\u03b1 : Type*} (s : Set \u03b1) [Fintype s] : s.toFinset.card = Fintype.card s :=\nMultiset.card_map Subtype.val Finset.univ.val\n\nend Set\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Fintype.Card.Finset (L104-L105)\ntheorem Finset.card_univ [Fintype \u03b1] : #(univ : Finset \u03b1) = Fintype.card \u03b1 := rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Fintype.Card.Finset (L106-L109)\ntheorem Finset.eq_univ_of_card [Fintype \u03b1] (s : Finset \u03b1) (hs : #s = Fintype.card \u03b1) :\n s = univ :=\neq_of_subset_of_card_le (subset_univ _) <| by rw [hs, Finset.card_univ]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Fintype.Card.Finset (L110-L114)\ntheorem Finset.card_eq_iff_eq_univ [Fintype \u03b1] (s : Finset \u03b1) : #s = Fintype.card \u03b1 \u2194 s = univ :=\n\u27e8s.eq_univ_of_card, by\n rintro rfl\n exact Finset.card_univ\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_extend_by_one (L55-L58)\ntheorem prod_extend_by_one [CommMonoid \u03b1] (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) :\n \u220f i, (if i \u2208 s then f i else 1) = \u220f i \u2208 s, f i := by\nrw [\u2190 prod_filter, filter_mem_eq_inter, univ_inter]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Fintype.Basic.count_univ (L223-L225)\ntheorem count_univ [DecidableEq \u03b1] (a : \u03b1) : count a Finset.univ.val = 1 :=\ncount_eq_one_of_mem Finset.univ.nodup (Finset.mem_univ _)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Fintype.Basic.map_univ_val_equiv (L227-L231)\ntheorem map_univ_val_equiv (e : \u03b1 \u2243 \u03b2) :\n map e univ.val = univ.val := by\nrw [\u2190 congr_arg Finset.val (Finset.map_univ_equiv e), Finset.map_val, Equiv.coe_toEmbedding]\n\n/-- For functions on finite sets, they are bijections iff they map universes into universes. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Fintype.Basic.exists_seq_of_forall_finset_exists (L258-L291)\ntheorem exists_seq_of_forall_finset_exists {\u03b1 : Type*} (P : \u03b1 \u2192 Prop) (r : \u03b1 \u2192 \u03b1 \u2192 Prop)\n (h : \u2200 s : Finset \u03b1, (\u2200 x \u2208 s, P x) \u2192 \u2203 y, P y \u2227 \u2200 x \u2208 s, r x y) :\n \u2203 f : \u2115 \u2192 \u03b1, (\u2200 n, P (f n)) \u2227 \u2200 m n, m < n \u2192 r (f m) (f n) := by\nclassical\n have : Nonempty \u03b1 := by\n rcases h \u2205 (by simp) with \u27e8y, _\u27e9\n exact \u27e8y\u27e9\n choose! F hF using h\n have h' : \u2200 s : Finset \u03b1, \u2203 y, (\u2200 x \u2208 s, P x) \u2192 P y \u2227 \u2200 x \u2208 s, r x y := fun s => \u27e8F s, hF s\u27e9\n set f := seqOfForallFinsetExistsAux P r h' with hf\n have A : \u2200 n : \u2115, P (f n) := by\n intro n\n induction n using Nat.strong_induction_on with | _ n IH\n have IH' : \u2200 x : Fin n, P (f x) := fun n => IH n.1 n.2\n rw [hf, seqOfForallFinsetExistsAux]\n exact\n (Classical.choose_spec\n (h' (Finset.image (fun i : Fin n => f i) (Finset.univ : Finset (Fin n))))\n (by simp [IH'])).1\n refine \u27e8f, A, fun m n hmn => ?_\u27e9\n conv_rhs => rw [hf]\n rw [seqOfForallFinsetExistsAux]\n apply\n (Classical.choose_spec\n (h' (Finset.image (fun i : Fin n => f i) (Finset.univ : Finset (Fin n)))) (by simp [A])).2\n exact Finset.mem_image.2 \u27e8\u27e8m, hmn\u27e9, Finset.mem_univ _, rfl\u27e9\n\n/-- Induction principle to build a sequence, by adding one point at a time satisfying a given\nsymmetric relation with respect to all the previously chosen points.\n\nMore precisely, Assume that, for any finite set `s`, one can find another point satisfying\nsome relation `r` with respect to all the points in `s`. Then one may construct a\nfunction `f : \u2115 \u2192 \u03b1` such that `r (f m) (f n)` holds whenever `m \u2260 n`.\nWe also ensure that all constructed points satisfy a given predicate `P`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Fintype.Basic.PUnit (L140-L142)\ninstance PUnit.fintype : Fintype PUnit :=\nFintype.ofSubsingleton PUnit.unit\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_bool (L43-L44)\ntheorem prod_bool [CommMonoid \u03b1] (f : Bool \u2192 \u03b1) : \u220f b, f b = f true * f false := by simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Fintype.Basic.nonempty_fintype (L47-L50)\ntheorem nonempty_fintype (\u03b1 : Type*) [Finite \u03b1] : Nonempty (Fintype \u03b1) := by\nrcases Finite.exists_equiv_fin \u03b1 with \u27e8n, \u27e8e\u27e9\u27e9\n exact \u27e8.ofEquiv _ e.symm\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Fintype.Basic.truncOfNonemptyFintype (L206-L211)\ndef truncOfNonemptyFintype (\u03b1) [Nonempty \u03b1] [Fintype \u03b1] : Trunc \u03b1 :=\ntruncOfMultisetExistsMem Finset.univ.val (by simp)\n\n/-- By iterating over the elements of a fintype, we can lift an existential statement `\u2203 a, P a`\nto `Trunc (\u03a3' a, P a)`, containing data.\n-/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Fintype.Basic.Fintype (L120-L124)\ninstance Fintype.subtypeEq (y : \u03b1) : Fintype { x // x = y } :=\nFintype.subtype {y} (by simp)\n\n/-- Short-circuit instance to decrease search for `Unique.fintype`,\nsince that relies on a subsingleton elimination for `Unique`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Fintype.Basic.truncOfMultisetExistsMem (L198-L205)\ndef truncOfMultisetExistsMem {\u03b1} (s : Multiset \u03b1) : (\u2203 x, x \u2208 s) \u2192 Trunc \u03b1 :=\nQuotient.recOnSubsingleton s fun l h =>\n match l, h with\n | [], _ => False.elim (by tauto)\n | a :: _, _ => Trunc.mk a\n\n/-- A `Nonempty` `Fintype` constructively contains an element.\n-/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Fintype.Basic.Unit (L134-L136)\ninstance Unit.fintype : Fintype Unit :=\nFintype.ofSubsingleton ()\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Fintype.Basic.PLift (L163-L165)\ninstance PLift.fintype (\u03b1 : Type*) [Fintype \u03b1] : Fintype (PLift \u03b1) :=\nFintype.ofEquiv _ Equiv.plift.symm\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Fintype.Basic.pfunFintype (L188-L197)\ninstance pfunFintype (p : Prop) [Decidable p] (\u03b1 : p \u2192 Type*) [\u2200 hp, Fintype (\u03b1 hp)] :\n Fintype (\u2200 hp : p, \u03b1 hp) :=\nif hp : p then Fintype.ofEquiv (\u03b1 hp) \u27e8fun a _ => a, fun f => f hp, fun _ => rfl, fun _ => rfl\u27e9\n else \u27e8singleton fun h => (hp h).elim, fun h => mem_singleton.2\n (funext fun x => by contradiction)\u27e9\n\nsection Trunc\n\n/-- For `s : Multiset \u03b1`, we can lift the existential statement that `\u2203 x, x \u2208 s` to a `Trunc \u03b1`.\n-/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Fintype.Basic.Fin (L36-L38)\ninstance Fin.fintype (n : \u2115) : Fintype (Fin n) :=\n\u27e8\u27e8List.finRange n, List.nodup_finRange n\u27e9, List.mem_finRange\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Fintype.Basic.Quotient (L169-L172)\ninstance Quotient.fintype [Fintype \u03b1] (s : Setoid \u03b1) [DecidableRel ((\u00b7 \u2248 \u00b7) : \u03b1 \u2192 \u03b1 \u2192 Prop)] :\n Fintype (Quotient s) :=\nFintype.ofSurjective Quotient.mk'' Quotient.mk''_surjective\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Fintype.Basic.exists_seq_of_forall_finset_exists' (L292-L297)\ntheorem exists_seq_of_forall_finset_exists' {\u03b1 : Type*} (P : \u03b1 \u2192 Prop) (r : \u03b1 \u2192 \u03b1 \u2192 Prop)\n [Std.Symm r] (h : \u2200 s : Finset \u03b1, (\u2200 x \u2208 s, P x) \u2192 \u2203 y, P y \u2227 \u2200 x \u2208 s, r x y) :\n \u2203 f : \u2115 \u2192 \u03b1, (\u2200 n, P (f n)) \u2227 Pairwise (r on f) := by\nrcases exists_seq_of_forall_finset_exists P r h with \u27e8f, hf, hf'\u27e9\n refine \u27e8f, hf, fun m n hmn => ?_\u27e9\n grind +splitIndPred\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Fintype.BigOperators.card_eq_sum_ones (L45-L47)\ntheorem card_eq_sum_ones {\u03b1} [Fintype \u03b1] : Fintype.card \u03b1 = \u2211 _a : \u03b1, 1 :=\nFinset.card_eq_sum_ones _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Fintype.Basic.Finset (L42-L43)\ntheorem Finset.univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Fintype.Basic.bijective_iff_map_univ_eq_univ (L233-L257)\ntheorem bijective_iff_map_univ_eq_univ (f : \u03b1 \u2192 \u03b2) :\n f.Bijective \u2194 map f (Finset.univ : Finset \u03b1).val = univ.val :=\n\u27e8fun bij \u21a6 congr_arg (\u00b7.val) (map_univ_equiv <| Equiv.ofBijective f bij),\n fun eq \u21a6 \u27e8\n fun a\u2081 a\u2082 \u21a6 inj_on_of_nodup_map (eq.symm \u25b8 univ.nodup) _ (mem_univ a\u2081) _ (mem_univ a\u2082),\n fun b \u21a6 have \u27e8a, _, h\u27e9 := mem_map.mp (eq.symm \u25b8 mem_univ_val b); \u27e8a, h\u27e9\u27e9\u27e9\n\nend Multiset\n\n/-- Auxiliary definition to show `exists_seq_of_forall_finset_exists`. -/\nnoncomputable def seqOfForallFinsetExistsAux {\u03b1 : Type*} [DecidableEq \u03b1] (P : \u03b1 \u2192 Prop)\n (r : \u03b1 \u2192 \u03b1 \u2192 Prop) (h : \u2200 s : Finset \u03b1, \u2203 y, (\u2200 x \u2208 s, P x) \u2192 P y \u2227 \u2200 x \u2208 s, r x y) : \u2115 \u2192 \u03b1\n | n =>\n Classical.choose\n (h\n (Finset.image (fun i : Fin n => seqOfForallFinsetExistsAux P r h i)\n (Finset.univ : Finset (Fin n))))\n\n/-- Induction principle to build a sequence, by adding one point at a time satisfying a given\nrelation with respect to all the previously chosen points.\n\nMore precisely, Assume that, for any finite set `s`, one can find another point satisfying\nsome relation `r` with respect to all the points in `s`. Then one may construct a\nfunction `f : \u2115 \u2192 \u03b1` such that `r (f m) (f n)` holds whenever `m < n`.\nWe also ensure that all constructed points satisfy a given predicate `P`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Fintype.Basic.truncSigmaOfExists (L212-L221)\ndef truncSigmaOfExists {\u03b1} [Fintype \u03b1] {P : \u03b1 \u2192 Prop} [DecidablePred P] (h : \u2203 a, P a) :\n Trunc (\u03a3' a, P a) :=\n@truncOfNonemptyFintype (\u03a3' a, P a) ((Exists.elim h) fun a ha => \u27e8\u27e8a, ha\u27e9\u27e9) _\n\nend Trunc\n\nnamespace Multiset\n\nvariable [Fintype \u03b1] [Fintype \u03b2]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_congr (L70-L72)\ntheorem prod_congr (f g : \u03b1 \u2192 M) (h : \u2200 a, f a = g a) : \u220f a, f a = \u220f a, g a :=\nFinset.prod_congr rfl fun a _ha => h a\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Fintype.Basic.Unique (L115-L119)\ninstance Unique.fintype {\u03b1 : Type*} [Unique \u03b1] : Fintype \u03b1 :=\nFintype.ofSubsingleton default\n\n/-- Short-circuit instance to decrease search for `Unique.fintype`,\nsince that relies on a subsingleton elimination for `Unique`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_eq_one (L66-L68)\ntheorem prod_eq_one (f : \u03b1 \u2192 M) (h : \u2200 a, f a = 1) : \u220f a, f a = 1 :=\nFinset.prod_eq_one fun a _ha => h a\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Fintype.Basic.PSigma (L173-L177)\ninstance PSigma.fintypePropLeft {\u03b1 : Prop} {\u03b2 : \u03b1 \u2192 Type*} [Decidable \u03b1] [\u2200 a, Fintype (\u03b2 a)] :\n Fintype (\u03a3' a, \u03b2 a) :=\nif h : \u03b1 then Fintype.ofEquiv (\u03b2 h) \u27e8fun x => \u27e8h, x\u27e9, PSigma.snd, fun _ => rfl, fun \u27e8_, _\u27e9 => rfl\u27e9\n else \u27e8\u2205, fun x => (h x.1).elim\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Fintype.Basic.ULift (L160-L162)\ninstance ULift.fintype (\u03b1 : Type*) [Fintype \u03b1] : Fintype (ULift \u03b1) :=\nFintype.ofEquiv _ Equiv.ulift.symm\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.Data.Fintype.Card).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem card_range {\u03b1 \u03b2 F : Type*} [FunLike F \u03b1 \u03b2] [EmbeddingLike F \u03b1 \u03b2] (f : F) [Fintype \u03b1]\n [Fintype (Set.range f)] : Fintype.card (Set.range f) = Fintype.card \u03b1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Fintype.Card.card (L40-L42)\ndef card (\u03b1) [Fintype \u03b1] : \u2115 :=\n(@univ \u03b1 _).card\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Fintype.Card.subtype_card (L43-L46)\ntheorem subtype_card {p : \u03b1 \u2192 Prop} (s : Finset \u03b1) (H : \u2200 x : \u03b1, x \u2208 s \u2194 p x) :\n @card { x // p x } (Fintype.subtype s H) = #s :=\nMultiset.card_pmap _ _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Fintype.Card.card_of_subtype (L47-L51)\ntheorem card_of_subtype {p : \u03b1 \u2192 Prop} (s : Finset \u03b1) (H : \u2200 x : \u03b1, x \u2208 s \u2194 p x)\n [Fintype { x // p x }] : card { x // p x } = #s := by\nrw [\u2190 subtype_card s H]\n congr!\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Fintype.Card.card_ofFinset (L53-L56)\ntheorem card_ofFinset {p : Set \u03b1} (s : Finset \u03b1) (H : \u2200 x, x \u2208 s \u2194 x \u2208 p) :\n @Fintype.card p (ofFinset s H) = #s :=\nFintype.subtype_card s H\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Fintype.Card.card_of_finset' (L57-L63)\ntheorem card_of_finset' {p : Set \u03b1} (s : Finset \u03b1) (H : \u2200 x, x \u2208 s \u2194 x \u2208 p) [Fintype p] :\n Fintype.card p = #s := by rw [\u2190 card_ofFinset s H]; congr!\nend Fintype\n\nnamespace Fintype\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Fintype.Card.ofEquiv_card (L64-L66)\ntheorem ofEquiv_card [Fintype \u03b1] (f : \u03b1 \u2243 \u03b2) : @card \u03b2 (ofEquiv \u03b1 f) = card \u03b1 :=\nMultiset.card_map _ _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Fintype.Card.card_congr (L67-L69)\ntheorem card_congr {\u03b1 \u03b2} [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2243 \u03b2) : card \u03b1 = card \u03b2 := by\nrw [\u2190 ofEquiv_card f]; congr!\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Fintype.Card.card_congr' (L71-L76)\ntheorem card_congr' {\u03b1 \u03b2} [Fintype \u03b1] [Fintype \u03b2] (h : \u03b1 = \u03b2) : card \u03b1 = card \u03b2 :=\ncard_congr (by rw [h])\n\n/-- Note: this lemma is specifically about `Fintype.ofSubsingleton`. For a statement about\narbitrary `Fintype` instances, use either `Fintype.card_le_one_iff_subsingleton` or\n`Fintype.card_unique`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Fintype.Card.card_ofSubsingleton (L77-L79)\ntheorem card_ofSubsingleton (a : \u03b1) [Subsingleton \u03b1] : @Fintype.card _ (ofSubsingleton a) = 1 :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Fintype.Card.card_unique (L81-L85)\ntheorem card_unique [Unique \u03b1] [h : Fintype \u03b1] : Fintype.card \u03b1 = 1 :=\nSubsingleton.elim (ofSubsingleton default) h \u25b8 card_ofSubsingleton _\n\n/-- Note: this lemma is specifically about `Fintype.ofIsEmpty`. For a statement about\narbitrary `Fintype` instances, use `Fintype.card_eq_zero`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Fintype.Card.card_ofIsEmpty (L86-L96)\ntheorem card_ofIsEmpty [IsEmpty \u03b1] : @Fintype.card \u03b1 Fintype.ofIsEmpty = 0 :=\nrfl\n\nend Fintype\n\nnamespace Set\n\nvariable {s t : Set \u03b1}\n\n-- We use an arbitrary `[Fintype s]` instance here,\n-- not necessarily coming from a `[Fintype \u03b1]`.\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Fintype.Card.toFinset_card (L98-L102)\ntheorem toFinset_card {\u03b1 : Type*} (s : Set \u03b1) [Fintype s] : s.toFinset.card = Fintype.card s :=\nMultiset.card_map Subtype.val Finset.univ.val\n\nend Set\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Fintype.Card.Finset (L104-L105)\ntheorem Finset.card_univ [Fintype \u03b1] : #(univ : Finset \u03b1) = Fintype.card \u03b1 := rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Fintype.Card.Finset (L106-L109)\ntheorem Finset.eq_univ_of_card [Fintype \u03b1] (s : Finset \u03b1) (hs : #s = Fintype.card \u03b1) :\n s = univ :=\neq_of_subset_of_card_le (subset_univ _) <| by rw [hs, Finset.card_univ]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Fintype.Card.Finset (L110-L114)\ntheorem Finset.card_eq_iff_eq_univ [Fintype \u03b1] (s : Finset \u03b1) : #s = Fintype.card \u03b1 \u2194 s = univ :=\n\u27e8s.eq_univ_of_card, by\n rintro rfl\n exact Finset.card_univ\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_extend_by_one (L55-L58)\ntheorem prod_extend_by_one [CommMonoid \u03b1] (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) :\n \u220f i, (if i \u2208 s then f i else 1) = \u220f i \u2208 s, f i := by\nrw [\u2190 prod_filter, filter_mem_eq_inter, univ_inter]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Fintype.Basic.count_univ (L223-L225)\ntheorem count_univ [DecidableEq \u03b1] (a : \u03b1) : count a Finset.univ.val = 1 :=\ncount_eq_one_of_mem Finset.univ.nodup (Finset.mem_univ _)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Fintype.Basic.map_univ_val_equiv (L227-L231)\ntheorem map_univ_val_equiv (e : \u03b1 \u2243 \u03b2) :\n map e univ.val = univ.val := by\nrw [\u2190 congr_arg Finset.val (Finset.map_univ_equiv e), Finset.map_val, Equiv.coe_toEmbedding]\n\n/-- For functions on finite sets, they are bijections iff they map universes into universes. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Fintype.Basic.exists_seq_of_forall_finset_exists (L258-L291)\ntheorem exists_seq_of_forall_finset_exists {\u03b1 : Type*} (P : \u03b1 \u2192 Prop) (r : \u03b1 \u2192 \u03b1 \u2192 Prop)\n (h : \u2200 s : Finset \u03b1, (\u2200 x \u2208 s, P x) \u2192 \u2203 y, P y \u2227 \u2200 x \u2208 s, r x y) :\n \u2203 f : \u2115 \u2192 \u03b1, (\u2200 n, P (f n)) \u2227 \u2200 m n, m < n \u2192 r (f m) (f n) := by\nclassical\n have : Nonempty \u03b1 := by\n rcases h \u2205 (by simp) with \u27e8y, _\u27e9\n exact \u27e8y\u27e9\n choose! F hF using h\n have h' : \u2200 s : Finset \u03b1, \u2203 y, (\u2200 x \u2208 s, P x) \u2192 P y \u2227 \u2200 x \u2208 s, r x y := fun s => \u27e8F s, hF s\u27e9\n set f := seqOfForallFinsetExistsAux P r h' with hf\n have A : \u2200 n : \u2115, P (f n) := by\n intro n\n induction n using Nat.strong_induction_on with | _ n IH\n have IH' : \u2200 x : Fin n, P (f x) := fun n => IH n.1 n.2\n rw [hf, seqOfForallFinsetExistsAux]\n exact\n (Classical.choose_spec\n (h' (Finset.image (fun i : Fin n => f i) (Finset.univ : Finset (Fin n))))\n (by simp [IH'])).1\n refine \u27e8f, A, fun m n hmn => ?_\u27e9\n conv_rhs => rw [hf]\n rw [seqOfForallFinsetExistsAux]\n apply\n (Classical.choose_spec\n (h' (Finset.image (fun i : Fin n => f i) (Finset.univ : Finset (Fin n)))) (by simp [A])).2\n exact Finset.mem_image.2 \u27e8\u27e8m, hmn\u27e9, Finset.mem_univ _, rfl\u27e9\n\n/-- Induction principle to build a sequence, by adding one point at a time satisfying a given\nsymmetric relation with respect to all the previously chosen points.\n\nMore precisely, Assume that, for any finite set `s`, one can find another point satisfying\nsome relation `r` with respect to all the points in `s`. Then one may construct a\nfunction `f : \u2115 \u2192 \u03b1` such that `r (f m) (f n)` holds whenever `m \u2260 n`.\nWe also ensure that all constructed points satisfy a given predicate `P`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Fintype.Basic.PUnit (L140-L142)\ninstance PUnit.fintype : Fintype PUnit :=\nFintype.ofSubsingleton PUnit.unit\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_bool (L43-L44)\ntheorem prod_bool [CommMonoid \u03b1] (f : Bool \u2192 \u03b1) : \u220f b, f b = f true * f false := by simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Fintype.Basic.nonempty_fintype (L47-L50)\ntheorem nonempty_fintype (\u03b1 : Type*) [Finite \u03b1] : Nonempty (Fintype \u03b1) := by\nrcases Finite.exists_equiv_fin \u03b1 with \u27e8n, \u27e8e\u27e9\u27e9\n exact \u27e8.ofEquiv _ e.symm\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Fintype.Basic.truncOfNonemptyFintype (L206-L211)\ndef truncOfNonemptyFintype (\u03b1) [Nonempty \u03b1] [Fintype \u03b1] : Trunc \u03b1 :=\ntruncOfMultisetExistsMem Finset.univ.val (by simp)\n\n/-- By iterating over the elements of a fintype, we can lift an existential statement `\u2203 a, P a`\nto `Trunc (\u03a3' a, P a)`, containing data.\n-/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Fintype.Basic.Fintype (L120-L124)\ninstance Fintype.subtypeEq (y : \u03b1) : Fintype { x // x = y } :=\nFintype.subtype {y} (by simp)\n\n/-- Short-circuit instance to decrease search for `Unique.fintype`,\nsince that relies on a subsingleton elimination for `Unique`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Fintype.Basic.truncOfMultisetExistsMem (L198-L205)\ndef truncOfMultisetExistsMem {\u03b1} (s : Multiset \u03b1) : (\u2203 x, x \u2208 s) \u2192 Trunc \u03b1 :=\nQuotient.recOnSubsingleton s fun l h =>\n match l, h with\n | [], _ => False.elim (by tauto)\n | a :: _, _ => Trunc.mk a\n\n/-- A `Nonempty` `Fintype` constructively contains an element.\n-/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Fintype.Basic.Unit (L134-L136)\ninstance Unit.fintype : Fintype Unit :=\nFintype.ofSubsingleton ()\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Fintype.Basic.PLift (L163-L165)\ninstance PLift.fintype (\u03b1 : Type*) [Fintype \u03b1] : Fintype (PLift \u03b1) :=\nFintype.ofEquiv _ Equiv.plift.symm\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Fintype.Basic.pfunFintype (L188-L197)\ninstance pfunFintype (p : Prop) [Decidable p] (\u03b1 : p \u2192 Type*) [\u2200 hp, Fintype (\u03b1 hp)] :\n Fintype (\u2200 hp : p, \u03b1 hp) :=\nif hp : p then Fintype.ofEquiv (\u03b1 hp) \u27e8fun a _ => a, fun f => f hp, fun _ => rfl, fun _ => rfl\u27e9\n else \u27e8singleton fun h => (hp h).elim, fun h => mem_singleton.2\n (funext fun x => by contradiction)\u27e9\n\nsection Trunc\n\n/-- For `s : Multiset \u03b1`, we can lift the existential statement that `\u2203 x, x \u2208 s` to a `Trunc \u03b1`.\n-/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Fintype.Basic.Fin (L36-L38)\ninstance Fin.fintype (n : \u2115) : Fintype (Fin n) :=\n\u27e8\u27e8List.finRange n, List.nodup_finRange n\u27e9, List.mem_finRange\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Fintype.Basic.Quotient (L169-L172)\ninstance Quotient.fintype [Fintype \u03b1] (s : Setoid \u03b1) [DecidableRel ((\u00b7 \u2248 \u00b7) : \u03b1 \u2192 \u03b1 \u2192 Prop)] :\n Fintype (Quotient s) :=\nFintype.ofSurjective Quotient.mk'' Quotient.mk''_surjective\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Fintype.Basic.exists_seq_of_forall_finset_exists' (L292-L297)\ntheorem exists_seq_of_forall_finset_exists' {\u03b1 : Type*} (P : \u03b1 \u2192 Prop) (r : \u03b1 \u2192 \u03b1 \u2192 Prop)\n [Std.Symm r] (h : \u2200 s : Finset \u03b1, (\u2200 x \u2208 s, P x) \u2192 \u2203 y, P y \u2227 \u2200 x \u2208 s, r x y) :\n \u2203 f : \u2115 \u2192 \u03b1, (\u2200 n, P (f n)) \u2227 Pairwise (r on f) := by\nrcases exists_seq_of_forall_finset_exists P r h with \u27e8f, hf, hf'\u27e9\n refine \u27e8f, hf, fun m n hmn => ?_\u27e9\n grind +splitIndPred\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Fintype.BigOperators.card_eq_sum_ones (L45-L47)\ntheorem card_eq_sum_ones {\u03b1} [Fintype \u03b1] : Fintype.card \u03b1 = \u2211 _a : \u03b1, 1 :=\nFinset.card_eq_sum_ones _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Fintype.Basic.Finset (L42-L43)\ntheorem Finset.univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Fintype.Basic.bijective_iff_map_univ_eq_univ (L233-L257)\ntheorem bijective_iff_map_univ_eq_univ (f : \u03b1 \u2192 \u03b2) :\n f.Bijective \u2194 map f (Finset.univ : Finset \u03b1).val = univ.val :=\n\u27e8fun bij \u21a6 congr_arg (\u00b7.val) (map_univ_equiv <| Equiv.ofBijective f bij),\n fun eq \u21a6 \u27e8\n fun a\u2081 a\u2082 \u21a6 inj_on_of_nodup_map (eq.symm \u25b8 univ.nodup) _ (mem_univ a\u2081) _ (mem_univ a\u2082),\n fun b \u21a6 have \u27e8a, _, h\u27e9 := mem_map.mp (eq.symm \u25b8 mem_univ_val b); \u27e8a, h\u27e9\u27e9\u27e9\n\nend Multiset\n\n/-- Auxiliary definition to show `exists_seq_of_forall_finset_exists`. -/\nnoncomputable def seqOfForallFinsetExistsAux {\u03b1 : Type*} [DecidableEq \u03b1] (P : \u03b1 \u2192 Prop)\n (r : \u03b1 \u2192 \u03b1 \u2192 Prop) (h : \u2200 s : Finset \u03b1, \u2203 y, (\u2200 x \u2208 s, P x) \u2192 P y \u2227 \u2200 x \u2208 s, r x y) : \u2115 \u2192 \u03b1\n | n =>\n Classical.choose\n (h\n (Finset.image (fun i : Fin n => seqOfForallFinsetExistsAux P r h i)\n (Finset.univ : Finset (Fin n))))\n\n/-- Induction principle to build a sequence, by adding one point at a time satisfying a given\nrelation with respect to all the previously chosen points.\n\nMore precisely, Assume that, for any finite set `s`, one can find another point satisfying\nsome relation `r` with respect to all the points in `s`. Then one may construct a\nfunction `f : \u2115 \u2192 \u03b1` such that `r (f m) (f n)` holds whenever `m < n`.\nWe also ensure that all constructed points satisfy a given predicate `P`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Fintype.Basic.truncSigmaOfExists (L212-L221)\ndef truncSigmaOfExists {\u03b1} [Fintype \u03b1] {P : \u03b1 \u2192 Prop} [DecidablePred P] (h : \u2203 a, P a) :\n Trunc (\u03a3' a, P a) :=\n@truncOfNonemptyFintype (\u03a3' a, P a) ((Exists.elim h) fun a ha => \u27e8\u27e8a, ha\u27e9\u27e9) _\n\nend Trunc\n\nnamespace Multiset\n\nvariable [Fintype \u03b1] [Fintype \u03b2]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_congr (L70-L72)\ntheorem prod_congr (f g : \u03b1 \u2192 M) (h : \u2200 a, f a = g a) : \u220f a, f a = \u220f a, g a :=\nFinset.prod_congr rfl fun a _ha => h a\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Fintype.Basic.Unique (L115-L119)\ninstance Unique.fintype {\u03b1 : Type*} [Unique \u03b1] : Fintype \u03b1 :=\nFintype.ofSubsingleton default\n\n/-- Short-circuit instance to decrease search for `Unique.fintype`,\nsince that relies on a subsingleton elimination for `Unique`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Fintype.BigOperators.prod_eq_one (L66-L68)\ntheorem prod_eq_one (f : \u03b1 \u2192 M) (h : \u2200 a, f a = 1) : \u220f a, f a = 1 :=\nFinset.prod_eq_one fun a _ha => h a\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Fintype.Basic.PSigma (L173-L177)\ninstance PSigma.fintypePropLeft {\u03b1 : Prop} {\u03b2 : \u03b1 \u2192 Type*} [Decidable \u03b1] [\u2200 a, Fintype (\u03b2 a)] :\n Fintype (\u03a3' a, \u03b2 a) :=\nif h : \u03b1 then Fintype.ofEquiv (\u03b2 h) \u27e8fun x => \u27e8h, x\u27e9, PSigma.snd, fun _ => rfl, fun \u27e8_, _\u27e9 => rfl\u27e9\n else \u27e8\u2205, fun x => (h x.1).elim\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Fintype.Basic.ULift (L160-L162)\ninstance ULift.fintype (\u03b1 : Type*) [Fintype \u03b1] : Fintype (ULift \u03b1) :=\nFintype.ofEquiv _ Equiv.ulift.symm\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Fintype/Card.lean", "module": "Mathlib.Data.Fintype.Card", "declaration": "Mathlib.Data.Fintype.Card.card_range", "span": "L269-L272", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Fintype/Card.lean#L269"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 5179, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 13401, "lean_code_chars": 11907, "natural_language_chars": 1494, "lean_code_ratio": 0.8885, "line_count": 411, "imports_count": 0, "declarations_count": 1476, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "186bc3563b9c0eef", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Part.ne_none_iff", "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.Data.Part)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ne_none_iff {o : Part \u03b1} : o \u2260 none \u2194 \u2203 x, o = some x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Part.toOption (L65-L67)\ndef toOption (o : Part \u03b1) [Decidable o.Dom] : Option \u03b1 :=\nif h : Dom o then some (o.get h) else none\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Part.ext' (L75-L80)\ntheorem ext' : \u2200 {o p : Part \u03b1}, (o.Dom \u2194 p.Dom) \u2192 (\u2200 h\u2081 h\u2082, o.get h\u2081 = p.get h\u2082) \u2192 o = p\n | \u27e8od, o\u27e9, \u27e8pd, p\u27e9, H1, H2 => by\n have t : od = pd := propext H1\ncases t; rw [show o = p from funext fun p => H2 p p]\n\n/-- `Part` eta expansion -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Part.eta (L82-L88)\ntheorem eta : \u2200 o : Part \u03b1, (\u27e8o.Dom, fun h => o.get h\u27e9 : Part \u03b1) = o\n | \u27e8_, _\u27e9 => rfl\n\n/-- `a \u2208 o` means that `o` is defined and equal to `a` -/\nprotected def Mem (o : Part \u03b1) (a : \u03b1) : Prop :=\n\u2203 h, o.get h = a\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Part.mem_eq (L92-L94)\ntheorem mem_eq (a : \u03b1) (o : Part \u03b1) : (a \u2208 o) = \u2203 h, o.get h = a :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Part.dom_iff_mem (L95-L97)\ntheorem dom_iff_mem : \u2200 {o : Part \u03b1}, o.Dom \u2194 \u2203 y, y \u2208 o\n | \u27e8_, f\u27e9 => \u27e8fun h => \u27e8f h, h, rfl\u27e9, fun \u27e8_, h, rfl\u27e9 => h\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Part.get_mem (L98-L100)\ntheorem get_mem {o : Part \u03b1} (h) : get o h \u2208 o :=\n\u27e8_, rfl\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Part.mem_mk_iff (L102-L105)\ntheorem mem_mk_iff {p : Prop} {o : p \u2192 \u03b1} {a : \u03b1} : a \u2208 Part.mk p o \u2194 \u2203 h, o h = a :=\nIff.rfl\n\n/-- `Part` extensionality -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Part.ext (L107-L111)\ntheorem ext {o p : Part \u03b1} (H : \u2200 a, a \u2208 o \u2194 a \u2208 p) : o = p :=\n(ext' \u27e8fun h => ((H _).1 \u27e8h, rfl\u27e9).fst, fun h => ((H _).2 \u27e8h, rfl\u27e9).fst\u27e9) fun _ _ =>\n ((H _).2 \u27e8_, rfl\u27e9).snd\n\n/-- The `none` value in `Part` has a `False` domain and an empty function. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Part.none (L112-L114)\ndef none : Part \u03b1 :=\n\u27e8False, False.rec\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Part.notMem_none (L119-L122)\ntheorem notMem_none (a : \u03b1) : a \u2209 @none \u03b1 := fun h => h.fst\n/-- The `some a` value in `Part` has a `True` domain and the\n function returns `a`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Part.some (L123-L125)\ndef some (a : \u03b1) : Part \u03b1 :=\n\u27e8True, fun _ => a\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Part.some_dom (L127-L129)\ntheorem some_dom (a : \u03b1) : (some a).Dom :=\ntrivial\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Part.mem_unique (L130-L132)\ntheorem mem_unique : \u2200 {a b : \u03b1} {o : Part \u03b1}, a \u2208 o \u2192 b \u2208 o \u2192 a = b\n | _, _, \u27e8_, _\u27e9, \u27e8_, rfl\u27e9, \u27e8_, rfl\u27e9 => rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Part.mem_right_unique (L133-L135)\ntheorem mem_right_unique : \u2200 {a : \u03b1} {o p : Part \u03b1}, a \u2208 o \u2192 a \u2208 p \u2192 o = p\n | _, _, _, \u27e8ho, _\u27e9, \u27e8hp, _\u27e9 => ext' (iff_of_true ho hp) (by simp [*])\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Part.Mem (L136-L138)\ntheorem Mem.left_unique : Relator.LeftUnique ((\u00b7 \u2208 \u00b7) : \u03b1 \u2192 Part \u03b1 \u2192 Prop) := fun _ _ _ =>\nmem_unique\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.Data.Part).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ne_none_iff {o : Part \u03b1} : o \u2260 none \u2194 \u2203 x, o = some x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Part.toOption (L65-L67)\ndef toOption (o : Part \u03b1) [Decidable o.Dom] : Option \u03b1 :=\nif h : Dom o then some (o.get h) else none\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Part.ext' (L75-L80)\ntheorem ext' : \u2200 {o p : Part \u03b1}, (o.Dom \u2194 p.Dom) \u2192 (\u2200 h\u2081 h\u2082, o.get h\u2081 = p.get h\u2082) \u2192 o = p\n | \u27e8od, o\u27e9, \u27e8pd, p\u27e9, H1, H2 => by\n have t : od = pd := propext H1\ncases t; rw [show o = p from funext fun p => H2 p p]\n\n/-- `Part` eta expansion -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Part.eta (L82-L88)\ntheorem eta : \u2200 o : Part \u03b1, (\u27e8o.Dom, fun h => o.get h\u27e9 : Part \u03b1) = o\n | \u27e8_, _\u27e9 => rfl\n\n/-- `a \u2208 o` means that `o` is defined and equal to `a` -/\nprotected def Mem (o : Part \u03b1) (a : \u03b1) : Prop :=\n\u2203 h, o.get h = a\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Part.mem_eq (L92-L94)\ntheorem mem_eq (a : \u03b1) (o : Part \u03b1) : (a \u2208 o) = \u2203 h, o.get h = a :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Part.dom_iff_mem (L95-L97)\ntheorem dom_iff_mem : \u2200 {o : Part \u03b1}, o.Dom \u2194 \u2203 y, y \u2208 o\n | \u27e8_, f\u27e9 => \u27e8fun h => \u27e8f h, h, rfl\u27e9, fun \u27e8_, h, rfl\u27e9 => h\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Part.get_mem (L98-L100)\ntheorem get_mem {o : Part \u03b1} (h) : get o h \u2208 o :=\n\u27e8_, rfl\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Part.mem_mk_iff (L102-L105)\ntheorem mem_mk_iff {p : Prop} {o : p \u2192 \u03b1} {a : \u03b1} : a \u2208 Part.mk p o \u2194 \u2203 h, o h = a :=\nIff.rfl\n\n/-- `Part` extensionality -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Part.ext (L107-L111)\ntheorem ext {o p : Part \u03b1} (H : \u2200 a, a \u2208 o \u2194 a \u2208 p) : o = p :=\n(ext' \u27e8fun h => ((H _).1 \u27e8h, rfl\u27e9).fst, fun h => ((H _).2 \u27e8h, rfl\u27e9).fst\u27e9) fun _ _ =>\n ((H _).2 \u27e8_, rfl\u27e9).snd\n\n/-- The `none` value in `Part` has a `False` domain and an empty function. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Part.none (L112-L114)\ndef none : Part \u03b1 :=\n\u27e8False, False.rec\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Part.notMem_none (L119-L122)\ntheorem notMem_none (a : \u03b1) : a \u2209 @none \u03b1 := fun h => h.fst\n/-- The `some a` value in `Part` has a `True` domain and the\n function returns `a`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Part.some (L123-L125)\ndef some (a : \u03b1) : Part \u03b1 :=\n\u27e8True, fun _ => a\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Part.some_dom (L127-L129)\ntheorem some_dom (a : \u03b1) : (some a).Dom :=\ntrivial\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Part.mem_unique (L130-L132)\ntheorem mem_unique : \u2200 {a b : \u03b1} {o : Part \u03b1}, a \u2208 o \u2192 b \u2208 o \u2192 a = b\n | _, _, \u27e8_, _\u27e9, \u27e8_, rfl\u27e9, \u27e8_, rfl\u27e9 => rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Part.mem_right_unique (L133-L135)\ntheorem mem_right_unique : \u2200 {a : \u03b1} {o p : Part \u03b1}, a \u2208 o \u2192 a \u2208 p \u2192 o = p\n | _, _, _, \u27e8ho, _\u27e9, \u27e8hp, _\u27e9 => ext' (iff_of_true ho hp) (by simp [*])\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Part.Mem (L136-L138)\ntheorem Mem.left_unique : Relator.LeftUnique ((\u00b7 \u2208 \u00b7) : \u03b1 \u2192 Part \u03b1 \u2192 Prop) := fun _ _ _ =>\nmem_unique\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Part.lean", "module": "Mathlib.Data.Part", "declaration": "Mathlib.Data.Part.ne_none_iff", "span": "L181-L187", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Part.lean#L181"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1395, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3311, "lean_code_chars": 2500, "natural_language_chars": 811, "lean_code_ratio": 0.7551, "line_count": 126, "imports_count": 0, "declarations_count": 439, "diagnostics_count": 0, "retrieval_snippets_count": 15, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "4294355762521284", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Group.Finsupp.eraseAddHom", "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.Algebra.Group.Finsupp)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef eraseAddHom (a : \u03b9) : (\u03b9 \u2192\u2080 M) \u2192+ \u03b9 \u2192\u2080 M where\n toFun\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Group.Finsupp.apply_single (L31-L35)\nlemma apply_single [FunLike F M N] [ZeroHomClass F M N] (e : F) (i : \u03b9) (m : M) (b : \u03b9) :\n e (single i m b) = single i (e m) b := apply_single' e (map_zero e) i m b\n/-- Composition with a fixed zero-preserving homomorphism is itself a zero-preserving homomorphism\non functions. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange (L37-L40)\ndef mapRange.zeroHom (f : ZeroHom M N) : ZeroHom (\u03b9 \u2192\u2080 M) (\u03b9 \u2192\u2080 N) where\n toFun := Finsupp.mapRange f f.map_zero\nmap_zero' := mapRange_zero\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange (L43-L51)\nlemma mapRange.zeroHom_comp (f : ZeroHom N O) (f\u2082 : ZeroHom M N) :\n mapRange.zeroHom (\u03b9 := \u03b9) (f.comp f\u2082) = (mapRange.zeroHom f).comp (mapRange.zeroHom f\u2082) := by\next; simp\n\nend Zero\n\nsection AddZeroClass\nvariable [AddZeroClass M] [AddZeroClass N] {f : M \u2192 N} {g\u2081 g\u2082 : \u03b9 \u2192\u2080 M}\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instAdd (L52-L53)\ninstance instAdd : Add (\u03b9 \u2192\u2080 M) where add := zipWith (\u00b7 + \u00b7) (add_zero 0)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Group.Finsupp.add_apply (L56-L57)\nlemma add_apply (g\u2081 g\u2082 : \u03b9 \u2192\u2080 M) (a : \u03b9) : (g\u2081 + g\u2082) a = g\u2081 a + g\u2082 a := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Group.Finsupp.support_add (L58-L59)\nlemma support_add [DecidableEq \u03b9] : (g\u2081 + g\u2082).support \u2286 g\u2081.support \u222a g\u2082.support := support_zipWith\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Group.Finsupp.support_add_eq (L60-L64)\nlemma support_add_eq [DecidableEq \u03b9] (h : Disjoint g\u2081.support g\u2082.support) :\n (g\u2081 + g\u2082).support = g\u2081.support \u222a g\u2082.support :=\nle_antisymm support_zipWith fun a ha => by\n cases (Finset.mem_union_of_disjoint h).mp ha <;> simp_all\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instAddZeroClass (L65-L67)\ninstance instAddZeroClass : AddZeroClass (\u03b9 \u2192\u2080 M) :=\nfast_instance% DFunLike.coe_injective.addZeroClass _ coe_zero coe_add\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instIsLeftCancelAdd (L68-L79)\ninstance instIsLeftCancelAdd [IsLeftCancelAdd M] : IsLeftCancelAdd (\u03b9 \u2192\u2080 M) where\n add_left_cancel _ _ _ h := ext fun x => add_left_cancel <| DFunLike.congr_fun h x\n/-- When \u03b9 is finite and M is an AddMonoid,\n then Finsupp.equivFunOnFinite gives an AddEquiv -/\nnoncomputable def addEquivFunOnFinite {\u03b9 : Type*} [Finite \u03b9] :\n (\u03b9 \u2192\u2080 M) \u2243+ (\u03b9 \u2192 M) where\n __ := Finsupp.equivFunOnFinite\n map_add' _ _ := rfl\n\n/-- If `M` is the trivial monoid, then the monoid of finitely supported functions `\u03b9 \u2192\u2080 M` is\nis isomorphic to `M`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instIsRightCancelAdd (L85-L87)\ninstance instIsRightCancelAdd [IsRightCancelAdd M] : IsRightCancelAdd (\u03b9 \u2192\u2080 M) where\n add_right_cancel _ _ _ h := ext fun x => add_right_cancel <| DFunLike.congr_fun h x\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instIsCancelAdd (L88-L93)\ninstance instIsCancelAdd [IsCancelAdd M] : IsCancelAdd (\u03b9 \u2192\u2080 M) where\n\n/-- Evaluation of a function `f : \u03b9 \u2192\u2080 M` at a point as an additive monoid homomorphism.\n\nSee `Finsupp.lapply` in `Mathlib/LinearAlgebra/Finsupp/Defs.lean` for the stronger version as a\nlinear map. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Group.Finsupp.applyAddHom (L95-L100)\ndef applyAddHom (a : \u03b9) : (\u03b9 \u2192\u2080 M) \u2192+ M where\n toFun g := g a\nmap_zero' := zero_apply\n map_add' _ _ := add_apply _ _ _\n\n/-- Coercion from a `Finsupp` to a function type is an `AddMonoidHom`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange_add (L107-L110)\nlemma mapRange_add {hf : f 0 = 0} (hf' : \u2200 x y, f (x + y) = f x + f y) (v\u2081 v\u2082 : \u03b9 \u2192\u2080 M) :\n mapRange f hf (v\u2081 + v\u2082) = mapRange f hf v\u2081 + mapRange f hf v\u2082 :=\next fun _ => by simp only [hf', add_apply, mapRange_apply]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange_add' (L111-L115)\nlemma mapRange_add' [FunLike F M N] [AddMonoidHomClass F M N] {f : F} (g\u2081 g\u2082 : \u03b9 \u2192\u2080 M) :\n mapRange f (map_zero f) (g\u2081 + g\u2082) = mapRange f (map_zero f) g\u2081 + mapRange f (map_zero f) g\u2082 :=\nmapRange_add (map_add f) g\u2081 g\u2082\n\n/-- Bundle `Finsupp.embDomain f` as an additive map from `\u03b9 \u2192\u2080 M` to `F \u2192\u2080 M`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Group.Finsupp.embDomain (L117-L126)\ndef embDomain.addMonoidHom (f : \u03b9 \u21aa F) : (\u03b9 \u2192\u2080 M) \u2192+ F \u2192\u2080 M where\n toFun v := embDomain f v\nmap_zero' := by simp\n map_add' v w := by\n ext b\n by_cases h : b \u2208 Set.range f\n \u00b7 rcases h with \u27e8a, rfl\u27e9\n simp\n \u00b7 simp only [coe_add, Pi.add_apply, embDomain_notin_range _ _ _ h, add_zero]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_invOf_smul (L88-L97)\nlemma smul_eq_iff_eq_invOf_smul : c \u2022 x = y \u2194 x = \u215fc \u2022 y :=\nsmul_eq_iff_eq_inv_smul (g := unitOfInvertible c)\n\nend Monoid\nend MulAction\n\nsection Arrow\nvariable {G A B : Type*} [DivisionMonoid G] [MulAction G A]\n\n/-- If `G` acts on `A`, then it acts also on `A \u2192 B`, by `(g \u2022 F) a = F (g\u207b\u00b9 \u2022 a)`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_assoc (L214-L216)\nlemma smul_assoc {M N} [SMul M N] [SMul N \u03b1] [SMul M \u03b1] [IsScalarTower M N \u03b1] (x : M) (y : N)\n (z : \u03b1) : (x \u2022 y) \u2022 z = x \u2022 y \u2022 z := IsScalarTower.smul_assoc x y z\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)\ndef MulAction.toPerm (a : \u03b1) : Equiv.Perm \u03b2 :=\n\u27e8fun x => a \u2022 x, fun x => a\u207b\u00b9 \u2022 x, inv_smul_smul a, smul_inv_smul a\u27e9\n\n/-- Given an action of an additive group `\u03b1` on `\u03b2`, each `g : \u03b1` defines a permutation of `\u03b2`. -/\nadd_decl_doc AddAction.toPerm\n\n/-- `MulAction.toPerm` is injective on faithful actions. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.IsCentralScalar (L249-L255)\nlemma IsCentralScalar.unop_smul_eq_smul {M \u03b1 : Type*} [SMul M \u03b1] [SMul M\u1d50\u1d52\u1d56 \u03b1]\n [IsCentralScalar M \u03b1] (m : M\u1d50\u1d52\u1d56) (a : \u03b1) : MulOpposite.unop m \u2022 a = m \u2022 a := by\ninduction m; exact (IsCentralScalar.op_smul_eq_smul _ a).symm\n\nexport IsCentralVAdd (op_vadd_eq_vadd unop_vadd_eq_vadd)\nexport IsCentralScalar (op_smul_eq_smul unop_smul_eq_smul)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun (L152-L154)\ndef toFun : \u03b1 \u21aa M \u2192 \u03b1 :=\n\u27e8fun y x \u21a6 x \u2022 y, fun y\u2081 y\u2082 H \u21a6 one_smul M y\u2081 \u25b8 one_smul M y\u2082 \u25b8 by convert congr_fun H 1\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)\nlemma isCancelSMul_iff_eq_one_of_smul_eq :\n IsCancelSMul \u03b1 \u03b2 \u2194 (\u2200 (g : \u03b1) (x : \u03b2), g \u2022 x = x \u2192 g = 1) := by\nrefine \u27e8fun H _ _ \u21a6 IsCancelSMul.eq_one_of_smul, fun H \u21a6 \u27e8fun g h x \u21a6 ?_\u27e9\u27e9\n rw [smul_eq_iff_eq_inv_smul, eq_comm, \u2190 mul_smul, \u2190 inv_mul_eq_one (G := \u03b1)]\n exact H (g\u207b\u00b9 * h) x\n\nend Group\n\nsection Monoid\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2] (c : \u03b1) (x y : \u03b2) [Invertible c]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)\nlemma smul_eq_iff_eq_inv_smul (g : \u03b1) {x y : \u03b2} : g \u2022 x = y \u2194 x = g\u207b\u00b9 \u2022 y :=\n(MulAction.toPerm g).apply_eq_iff_eq_symm_apply\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun_apply (L156-L182)\nlemma toFun_apply (x : M) (y : \u03b1) : MulAction.toFun M \u03b1 y x = x \u2022 y := rfl\nend MulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Monoid A] [MulDistribMulAction M A]\n\n/-- Pullback a multiplicative distributive multiplicative action along an injective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Injective.mulDistribMulAction [Monoid B] [SMul M B] (f : B \u2192* A)\n (hf : Injective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c x y := hf <| by simp only [smul, f.map_mul, smul_mul']\n smul_one c := hf <| by simp only [smul, f.map_one, smul_one]\n\n/-- Pushforward a multiplicative distributive multiplicative action along a surjective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Surjective.mulDistribMulAction [Monoid B] [SMul M B] (f : A \u2192* B)\n (hf : Surjective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c := by simp only [hf.forall, smul_mul', \u2190 smul, \u2190 f.map_mul, implies_true]\n smul_one c := by rw [\u2190 f.map_one, \u2190 smul, smul_one]\n\nvariable (A) in\n/-- Scalar multiplication by `r` as a `MonoidHom`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Mul (L61-L65)\ndef Mul.toSMul (\u03b1 : Type*) [Mul \u03b1] : SMul \u03b1 \u03b1 := \u27e8(\u00b7 * \u00b7)\u27e9\n/-- Like `Mul.toSMul`, but multiplies on the right.\n\nSee also `Monoid.toOppositeMulAction` and `MonoidWithZero.toOppositeMulActionWithZero`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_eq_mul (L73-L74)\nlemma smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : a \u2022 b = a * b := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.MulOpposite (L79-L101)\nlemma MulOpposite.smul_eq_mul_unop [Mul \u03b1] (a : \u03b1\u1d50\u1d52\u1d56) (b : \u03b1) : a \u2022 b = b * a.unop := rfl\n/-- Type class for actions by additive semigroups, with notation `g +\u1d65 p`.\n\nThe `AddSemigroupAction G P` typeclass says that the additive semigroup `G` acts additively on a\ntype `P`. More precisely this means that the action satisfies the axiom\n`(g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 (g\u2082 +\u1d65 p)`. A mathematician might simply say that the additive semigroup\n`G` acts on `P`.\n\nFor example, if `A` is an additive semigroup and `X` is a type, if a mathematician says\nsay \"let `A` act on the set `X`\" they will usually mean `[AddSemigroupAction A X]`. -/\nclass AddSemigroupAction (G P : Type*) [AddSemigroup G] extends VAdd G P where\n /-- Associativity of `+\u1d65` and `+` -/\n add_vadd : \u2200 (g\u2081 g\u2082 : G) (p : P), (g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 g\u2082 +\u1d65 p\n\n/-- Type class for actions by semigroups, with notation `g \u2022 p`.\n\nThe `SemigroupAction G P` typeclass says that the semigroup `G` acts multiplicatively on a type `P`.\nMore precisely this means that the action satisfies the axiom `(g\u2081 * g\u2082) \u2022 p = g\u2081 \u2022 (g\u2082 \u2022 p)`.\nA mathematician might simply say that the semigroup `G` acts on `P`.\n\nFor example, if `G` is a semigroup and `X` is a type, if a mathematician says\nsay \"let `G` act on the set `X`\" they will probably mean `[SemigroupAction G X]`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)\nlemma smul_left_cancel_iff (g : \u03b1) {x y : \u03b2} : g \u2022 x = g \u2022 y \u2194 x = y :=\n(MulAction.injective g).eq_iff\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulDistribMulAction (L194-L203)\ndef MulDistribMulAction.toMonoidEnd : M \u2192* Monoid.End A where\n toFun := MulDistribMulAction.toMonoidHom A\nmap_one' := MonoidHom.ext <| one_smul M\n map_mul' x y := MonoidHom.ext <| mul_smul x y\n\nend MulDistribMulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Group A] [MulDistribMulAction M A]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)\nlemma smul_left_cancel (g : \u03b1) {x y : \u03b2} (h : g \u2022 x = g \u2022 y) : x = y := MulAction.injective g h\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.SMulCommClass (L176-L182)\nlemma SMulCommClass.symm (M N \u03b1 : Type*) [SMul M \u03b1] [SMul N \u03b1] [SMulCommClass M N \u03b1] :\n SMulCommClass N M \u03b1 where smul_comm a' a b := (smul_comm a a' b).symm\n/-- Commutativity of additive actions is a symmetric relation. This lemma can't be an instance\nbecause this would cause a loop in the instance search graph. -/\nadd_decl_doc VAddCommClass.symm\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)\nlemma invOf_smul_eq_iff : \u215fc \u2022 x = y \u2194 x = c \u2022 y := inv_smul_eq_iff (g := unitOfInvertible c)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Semigroup (L218-L242)\ninstance Semigroup.isScalarTower [Semigroup \u03b1] : IsScalarTower \u03b1 \u03b1 \u03b1 := \u27e8mul_assoc\u27e9\n/-- An instance of `SMulDistribClass G R S` states that the multiplicative\naction of `G` on `S` is determined by the multiplicative actions of `G` on `R`\nand `R` on `S`.\n\nThis is similar to `IsScalarTower` except that the action of `G` distributes\nover the action of `R` on `S`.\n\nE.g. if `M/L/K` is a tower of galois extensions then `SMulDistribClass Gal(M/K) L M`. -/\nclass SMulDistribClass (G R S : Type*) [SMul G R] [SMul G S] [SMul R S] : Prop where\n smul_distrib_smul (g : G) (r : R) (s : S) : g \u2022 r \u2022 s = (g \u2022 r) \u2022 (g \u2022 s)\n\nexport SMulDistribClass (smul_distrib_smul)\n\n/-- A typeclass indicating that the right (aka `AddOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `+\u1d65`. -/\nclass IsCentralVAdd (M \u03b1 : Type*) [VAdd M \u03b1] [VAdd M\u1d43\u1d52\u1d56 \u03b1] : Prop where\n /-- The right and left actions of `M` on `\u03b1` are equal. -/\n op_vadd_eq_vadd : \u2200 (m : M) (a : \u03b1), AddOpposite.op m +\u1d65 a = m +\u1d65 a\n\n/-- A typeclass indicating that the right (aka `MulOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `\u2022`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowAction (L100-L108)\ndef arrowAction : MulAction G (A \u2192 B) where\n smul g F a := F (g\u207b\u00b9 \u2022 a)\none_smul f := by\n change (fun x => f ((1 : G)\u207b\u00b9 \u2022 x)) = f\n simp only [inv_one, one_smul]\n mul_smul x y f := by\n change (fun a => f ((x * y)\u207b\u00b9 \u2022 a)) = (fun a => f (y\u207b\u00b9 \u2022 x\u207b\u00b9 \u2022 a))\n simp only [mul_smul, mul_inv_rev]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_bijective (L125-L129)\ntheorem smul_bijective {m : \u03b1} (hm : IsUnit m) :\n Function.Bijective (fun (a : \u03b2) \u21a6 m \u2022 a) := by\nlift m to \u03b1\u02e3 using hm\n exact MulAction.bijective m\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_div' (L207-L209)\nlemma smul_div' (r : M) (x y : A) : r \u2022 (x / y) = r \u2022 x / r \u2022 y :=\nmap_div (MulDistribMulAction.toMonoidHom A r) x y\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smulCommClass_self (L196-L207)\ninstance smulCommClass_self (M \u03b1 : Type*) [CommMonoid M] [MulAction M \u03b1] : SMulCommClass M M \u03b1 where\n smul_comm a a' b := by rw [\u2190 mul_smul, mul_comm, mul_smul]\n/-- An instance of `VAddAssocClass M N \u03b1` states that the additive action of `M` on `\u03b1` is\ndetermined by the additive actions of `M` on `N` and `N` on `\u03b1`. -/\nclass VAddAssocClass (M N \u03b1 : Type*) [VAdd M N] [VAdd N \u03b1] [VAdd M \u03b1] : Prop where\n /-- Associativity of `+\u1d65` -/\n vadd_assoc : \u2200 (x : M) (y : N) (z : \u03b1), (x +\u1d65 y) +\u1d65 z = x +\u1d65 y +\u1d65 z\n\n/-- An instance of `IsScalarTower M N \u03b1` states that the multiplicative\naction of `M` on `\u03b1` is determined by the multiplicative actions of `M` on `N`\nand `N` on `\u03b1`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.op_smul_eq_mul (L76-L77)\nlemma op_smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : MulOpposite.op a \u2022 b = b * a := rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowMulDistribMulAction (L115-L123)\ndef arrowMulDistribMulAction : MulDistribMulAction G (A \u2192 M) where\n smul_one _ := rfl\nsmul_mul _ _ _ := rfl\n\nend Arrow\n\nnamespace IsUnit\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Function (L184-L188)\nlemma Function.Injective.smulCommClass [SMul M \u03b1] [SMul N \u03b1] [SMul M \u03b2] [SMul N \u03b2]\n [SMulCommClass M N \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : Injective f) (h\u2081 : \u2200 (c : M) x, f (c \u2022 x) = c \u2022 f x)\n (h\u2082 : \u2200 (c : N) x, f (c \u2022 x) = c \u2022 f x) : SMulCommClass M N \u03b1 where\n smul_comm c\u2081 c\u2082 x := hf <| by simp only [h\u2081, h\u2082, smul_comm c\u2081 c\u2082 (f x)]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_zpow' (L210-L213)\nlemma smul_zpow' (r : M) (x : A) (z : \u2124) : r \u2022 (x ^ z) = (r \u2022 x) ^ z :=\nmap_zpow (MulDistribMulAction.toMonoidHom A r) x z\n\nend MulDistribMulAction\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.Algebra.Group.Finsupp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef eraseAddHom (a : \u03b9) : (\u03b9 \u2192\u2080 M) \u2192+ \u03b9 \u2192\u2080 M where\n toFun\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Group.Finsupp.apply_single (L31-L35)\nlemma apply_single [FunLike F M N] [ZeroHomClass F M N] (e : F) (i : \u03b9) (m : M) (b : \u03b9) :\n e (single i m b) = single i (e m) b := apply_single' e (map_zero e) i m b\n/-- Composition with a fixed zero-preserving homomorphism is itself a zero-preserving homomorphism\non functions. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange (L37-L40)\ndef mapRange.zeroHom (f : ZeroHom M N) : ZeroHom (\u03b9 \u2192\u2080 M) (\u03b9 \u2192\u2080 N) where\n toFun := Finsupp.mapRange f f.map_zero\nmap_zero' := mapRange_zero\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange (L43-L51)\nlemma mapRange.zeroHom_comp (f : ZeroHom N O) (f\u2082 : ZeroHom M N) :\n mapRange.zeroHom (\u03b9 := \u03b9) (f.comp f\u2082) = (mapRange.zeroHom f).comp (mapRange.zeroHom f\u2082) := by\next; simp\n\nend Zero\n\nsection AddZeroClass\nvariable [AddZeroClass M] [AddZeroClass N] {f : M \u2192 N} {g\u2081 g\u2082 : \u03b9 \u2192\u2080 M}\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instAdd (L52-L53)\ninstance instAdd : Add (\u03b9 \u2192\u2080 M) where add := zipWith (\u00b7 + \u00b7) (add_zero 0)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Group.Finsupp.add_apply (L56-L57)\nlemma add_apply (g\u2081 g\u2082 : \u03b9 \u2192\u2080 M) (a : \u03b9) : (g\u2081 + g\u2082) a = g\u2081 a + g\u2082 a := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Group.Finsupp.support_add (L58-L59)\nlemma support_add [DecidableEq \u03b9] : (g\u2081 + g\u2082).support \u2286 g\u2081.support \u222a g\u2082.support := support_zipWith\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Group.Finsupp.support_add_eq (L60-L64)\nlemma support_add_eq [DecidableEq \u03b9] (h : Disjoint g\u2081.support g\u2082.support) :\n (g\u2081 + g\u2082).support = g\u2081.support \u222a g\u2082.support :=\nle_antisymm support_zipWith fun a ha => by\n cases (Finset.mem_union_of_disjoint h).mp ha <;> simp_all\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instAddZeroClass (L65-L67)\ninstance instAddZeroClass : AddZeroClass (\u03b9 \u2192\u2080 M) :=\nfast_instance% DFunLike.coe_injective.addZeroClass _ coe_zero coe_add\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instIsLeftCancelAdd (L68-L79)\ninstance instIsLeftCancelAdd [IsLeftCancelAdd M] : IsLeftCancelAdd (\u03b9 \u2192\u2080 M) where\n add_left_cancel _ _ _ h := ext fun x => add_left_cancel <| DFunLike.congr_fun h x\n/-- When \u03b9 is finite and M is an AddMonoid,\n then Finsupp.equivFunOnFinite gives an AddEquiv -/\nnoncomputable def addEquivFunOnFinite {\u03b9 : Type*} [Finite \u03b9] :\n (\u03b9 \u2192\u2080 M) \u2243+ (\u03b9 \u2192 M) where\n __ := Finsupp.equivFunOnFinite\n map_add' _ _ := rfl\n\n/-- If `M` is the trivial monoid, then the monoid of finitely supported functions `\u03b9 \u2192\u2080 M` is\nis isomorphic to `M`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instIsRightCancelAdd (L85-L87)\ninstance instIsRightCancelAdd [IsRightCancelAdd M] : IsRightCancelAdd (\u03b9 \u2192\u2080 M) where\n add_right_cancel _ _ _ h := ext fun x => add_right_cancel <| DFunLike.congr_fun h x\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Group.Finsupp.instIsCancelAdd (L88-L93)\ninstance instIsCancelAdd [IsCancelAdd M] : IsCancelAdd (\u03b9 \u2192\u2080 M) where\n\n/-- Evaluation of a function `f : \u03b9 \u2192\u2080 M` at a point as an additive monoid homomorphism.\n\nSee `Finsupp.lapply` in `Mathlib/LinearAlgebra/Finsupp/Defs.lean` for the stronger version as a\nlinear map. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Group.Finsupp.applyAddHom (L95-L100)\ndef applyAddHom (a : \u03b9) : (\u03b9 \u2192\u2080 M) \u2192+ M where\n toFun g := g a\nmap_zero' := zero_apply\n map_add' _ _ := add_apply _ _ _\n\n/-- Coercion from a `Finsupp` to a function type is an `AddMonoidHom`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange_add (L107-L110)\nlemma mapRange_add {hf : f 0 = 0} (hf' : \u2200 x y, f (x + y) = f x + f y) (v\u2081 v\u2082 : \u03b9 \u2192\u2080 M) :\n mapRange f hf (v\u2081 + v\u2082) = mapRange f hf v\u2081 + mapRange f hf v\u2082 :=\next fun _ => by simp only [hf', add_apply, mapRange_apply]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Group.Finsupp.mapRange_add' (L111-L115)\nlemma mapRange_add' [FunLike F M N] [AddMonoidHomClass F M N] {f : F} (g\u2081 g\u2082 : \u03b9 \u2192\u2080 M) :\n mapRange f (map_zero f) (g\u2081 + g\u2082) = mapRange f (map_zero f) g\u2081 + mapRange f (map_zero f) g\u2082 :=\nmapRange_add (map_add f) g\u2081 g\u2082\n\n/-- Bundle `Finsupp.embDomain f` as an additive map from `\u03b9 \u2192\u2080 M` to `F \u2192\u2080 M`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Group.Finsupp.embDomain (L117-L126)\ndef embDomain.addMonoidHom (f : \u03b9 \u21aa F) : (\u03b9 \u2192\u2080 M) \u2192+ F \u2192\u2080 M where\n toFun v := embDomain f v\nmap_zero' := by simp\n map_add' v w := by\n ext b\n by_cases h : b \u2208 Set.range f\n \u00b7 rcases h with \u27e8a, rfl\u27e9\n simp\n \u00b7 simp only [coe_add, Pi.add_apply, embDomain_notin_range _ _ _ h, add_zero]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_invOf_smul (L88-L97)\nlemma smul_eq_iff_eq_invOf_smul : c \u2022 x = y \u2194 x = \u215fc \u2022 y :=\nsmul_eq_iff_eq_inv_smul (g := unitOfInvertible c)\n\nend Monoid\nend MulAction\n\nsection Arrow\nvariable {G A B : Type*} [DivisionMonoid G] [MulAction G A]\n\n/-- If `G` acts on `A`, then it acts also on `A \u2192 B`, by `(g \u2022 F) a = F (g\u207b\u00b9 \u2022 a)`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_assoc (L214-L216)\nlemma smul_assoc {M N} [SMul M N] [SMul N \u03b1] [SMul M \u03b1] [IsScalarTower M N \u03b1] (x : M) (y : N)\n (z : \u03b1) : (x \u2022 y) \u2022 z = x \u2022 y \u2022 z := IsScalarTower.smul_assoc x y z\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)\ndef MulAction.toPerm (a : \u03b1) : Equiv.Perm \u03b2 :=\n\u27e8fun x => a \u2022 x, fun x => a\u207b\u00b9 \u2022 x, inv_smul_smul a, smul_inv_smul a\u27e9\n\n/-- Given an action of an additive group `\u03b1` on `\u03b2`, each `g : \u03b1` defines a permutation of `\u03b2`. -/\nadd_decl_doc AddAction.toPerm\n\n/-- `MulAction.toPerm` is injective on faithful actions. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.IsCentralScalar (L249-L255)\nlemma IsCentralScalar.unop_smul_eq_smul {M \u03b1 : Type*} [SMul M \u03b1] [SMul M\u1d50\u1d52\u1d56 \u03b1]\n [IsCentralScalar M \u03b1] (m : M\u1d50\u1d52\u1d56) (a : \u03b1) : MulOpposite.unop m \u2022 a = m \u2022 a := by\ninduction m; exact (IsCentralScalar.op_smul_eq_smul _ a).symm\n\nexport IsCentralVAdd (op_vadd_eq_vadd unop_vadd_eq_vadd)\nexport IsCentralScalar (op_smul_eq_smul unop_smul_eq_smul)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun (L152-L154)\ndef toFun : \u03b1 \u21aa M \u2192 \u03b1 :=\n\u27e8fun y x \u21a6 x \u2022 y, fun y\u2081 y\u2082 H \u21a6 one_smul M y\u2081 \u25b8 one_smul M y\u2082 \u25b8 by convert congr_fun H 1\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)\nlemma isCancelSMul_iff_eq_one_of_smul_eq :\n IsCancelSMul \u03b1 \u03b2 \u2194 (\u2200 (g : \u03b1) (x : \u03b2), g \u2022 x = x \u2192 g = 1) := by\nrefine \u27e8fun H _ _ \u21a6 IsCancelSMul.eq_one_of_smul, fun H \u21a6 \u27e8fun g h x \u21a6 ?_\u27e9\u27e9\n rw [smul_eq_iff_eq_inv_smul, eq_comm, \u2190 mul_smul, \u2190 inv_mul_eq_one (G := \u03b1)]\n exact H (g\u207b\u00b9 * h) x\n\nend Group\n\nsection Monoid\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2] (c : \u03b1) (x y : \u03b2) [Invertible c]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)\nlemma smul_eq_iff_eq_inv_smul (g : \u03b1) {x y : \u03b2} : g \u2022 x = y \u2194 x = g\u207b\u00b9 \u2022 y :=\n(MulAction.toPerm g).apply_eq_iff_eq_symm_apply\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun_apply (L156-L182)\nlemma toFun_apply (x : M) (y : \u03b1) : MulAction.toFun M \u03b1 y x = x \u2022 y := rfl\nend MulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Monoid A] [MulDistribMulAction M A]\n\n/-- Pullback a multiplicative distributive multiplicative action along an injective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Injective.mulDistribMulAction [Monoid B] [SMul M B] (f : B \u2192* A)\n (hf : Injective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c x y := hf <| by simp only [smul, f.map_mul, smul_mul']\n smul_one c := hf <| by simp only [smul, f.map_one, smul_one]\n\n/-- Pushforward a multiplicative distributive multiplicative action along a surjective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Surjective.mulDistribMulAction [Monoid B] [SMul M B] (f : A \u2192* B)\n (hf : Surjective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c := by simp only [hf.forall, smul_mul', \u2190 smul, \u2190 f.map_mul, implies_true]\n smul_one c := by rw [\u2190 f.map_one, \u2190 smul, smul_one]\n\nvariable (A) in\n/-- Scalar multiplication by `r` as a `MonoidHom`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Mul (L61-L65)\ndef Mul.toSMul (\u03b1 : Type*) [Mul \u03b1] : SMul \u03b1 \u03b1 := \u27e8(\u00b7 * \u00b7)\u27e9\n/-- Like `Mul.toSMul`, but multiplies on the right.\n\nSee also `Monoid.toOppositeMulAction` and `MonoidWithZero.toOppositeMulActionWithZero`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_eq_mul (L73-L74)\nlemma smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : a \u2022 b = a * b := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.MulOpposite (L79-L101)\nlemma MulOpposite.smul_eq_mul_unop [Mul \u03b1] (a : \u03b1\u1d50\u1d52\u1d56) (b : \u03b1) : a \u2022 b = b * a.unop := rfl\n/-- Type class for actions by additive semigroups, with notation `g +\u1d65 p`.\n\nThe `AddSemigroupAction G P` typeclass says that the additive semigroup `G` acts additively on a\ntype `P`. More precisely this means that the action satisfies the axiom\n`(g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 (g\u2082 +\u1d65 p)`. A mathematician might simply say that the additive semigroup\n`G` acts on `P`.\n\nFor example, if `A` is an additive semigroup and `X` is a type, if a mathematician says\nsay \"let `A` act on the set `X`\" they will usually mean `[AddSemigroupAction A X]`. -/\nclass AddSemigroupAction (G P : Type*) [AddSemigroup G] extends VAdd G P where\n /-- Associativity of `+\u1d65` and `+` -/\n add_vadd : \u2200 (g\u2081 g\u2082 : G) (p : P), (g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 g\u2082 +\u1d65 p\n\n/-- Type class for actions by semigroups, with notation `g \u2022 p`.\n\nThe `SemigroupAction G P` typeclass says that the semigroup `G` acts multiplicatively on a type `P`.\nMore precisely this means that the action satisfies the axiom `(g\u2081 * g\u2082) \u2022 p = g\u2081 \u2022 (g\u2082 \u2022 p)`.\nA mathematician might simply say that the semigroup `G` acts on `P`.\n\nFor example, if `G` is a semigroup and `X` is a type, if a mathematician says\nsay \"let `G` act on the set `X`\" they will probably mean `[SemigroupAction G X]`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)\nlemma smul_left_cancel_iff (g : \u03b1) {x y : \u03b2} : g \u2022 x = g \u2022 y \u2194 x = y :=\n(MulAction.injective g).eq_iff\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulDistribMulAction (L194-L203)\ndef MulDistribMulAction.toMonoidEnd : M \u2192* Monoid.End A where\n toFun := MulDistribMulAction.toMonoidHom A\nmap_one' := MonoidHom.ext <| one_smul M\n map_mul' x y := MonoidHom.ext <| mul_smul x y\n\nend MulDistribMulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Group A] [MulDistribMulAction M A]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)\nlemma smul_left_cancel (g : \u03b1) {x y : \u03b2} (h : g \u2022 x = g \u2022 y) : x = y := MulAction.injective g h\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.SMulCommClass (L176-L182)\nlemma SMulCommClass.symm (M N \u03b1 : Type*) [SMul M \u03b1] [SMul N \u03b1] [SMulCommClass M N \u03b1] :\n SMulCommClass N M \u03b1 where smul_comm a' a b := (smul_comm a a' b).symm\n/-- Commutativity of additive actions is a symmetric relation. This lemma can't be an instance\nbecause this would cause a loop in the instance search graph. -/\nadd_decl_doc VAddCommClass.symm\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)\nlemma invOf_smul_eq_iff : \u215fc \u2022 x = y \u2194 x = c \u2022 y := inv_smul_eq_iff (g := unitOfInvertible c)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Semigroup (L218-L242)\ninstance Semigroup.isScalarTower [Semigroup \u03b1] : IsScalarTower \u03b1 \u03b1 \u03b1 := \u27e8mul_assoc\u27e9\n/-- An instance of `SMulDistribClass G R S` states that the multiplicative\naction of `G` on `S` is determined by the multiplicative actions of `G` on `R`\nand `R` on `S`.\n\nThis is similar to `IsScalarTower` except that the action of `G` distributes\nover the action of `R` on `S`.\n\nE.g. if `M/L/K` is a tower of galois extensions then `SMulDistribClass Gal(M/K) L M`. -/\nclass SMulDistribClass (G R S : Type*) [SMul G R] [SMul G S] [SMul R S] : Prop where\n smul_distrib_smul (g : G) (r : R) (s : S) : g \u2022 r \u2022 s = (g \u2022 r) \u2022 (g \u2022 s)\n\nexport SMulDistribClass (smul_distrib_smul)\n\n/-- A typeclass indicating that the right (aka `AddOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `+\u1d65`. -/\nclass IsCentralVAdd (M \u03b1 : Type*) [VAdd M \u03b1] [VAdd M\u1d43\u1d52\u1d56 \u03b1] : Prop where\n /-- The right and left actions of `M` on `\u03b1` are equal. -/\n op_vadd_eq_vadd : \u2200 (m : M) (a : \u03b1), AddOpposite.op m +\u1d65 a = m +\u1d65 a\n\n/-- A typeclass indicating that the right (aka `MulOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `\u2022`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowAction (L100-L108)\ndef arrowAction : MulAction G (A \u2192 B) where\n smul g F a := F (g\u207b\u00b9 \u2022 a)\none_smul f := by\n change (fun x => f ((1 : G)\u207b\u00b9 \u2022 x)) = f\n simp only [inv_one, one_smul]\n mul_smul x y f := by\n change (fun a => f ((x * y)\u207b\u00b9 \u2022 a)) = (fun a => f (y\u207b\u00b9 \u2022 x\u207b\u00b9 \u2022 a))\n simp only [mul_smul, mul_inv_rev]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_bijective (L125-L129)\ntheorem smul_bijective {m : \u03b1} (hm : IsUnit m) :\n Function.Bijective (fun (a : \u03b2) \u21a6 m \u2022 a) := by\nlift m to \u03b1\u02e3 using hm\n exact MulAction.bijective m\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_div' (L207-L209)\nlemma smul_div' (r : M) (x y : A) : r \u2022 (x / y) = r \u2022 x / r \u2022 y :=\nmap_div (MulDistribMulAction.toMonoidHom A r) x y\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smulCommClass_self (L196-L207)\ninstance smulCommClass_self (M \u03b1 : Type*) [CommMonoid M] [MulAction M \u03b1] : SMulCommClass M M \u03b1 where\n smul_comm a a' b := by rw [\u2190 mul_smul, mul_comm, mul_smul]\n/-- An instance of `VAddAssocClass M N \u03b1` states that the additive action of `M` on `\u03b1` is\ndetermined by the additive actions of `M` on `N` and `N` on `\u03b1`. -/\nclass VAddAssocClass (M N \u03b1 : Type*) [VAdd M N] [VAdd N \u03b1] [VAdd M \u03b1] : Prop where\n /-- Associativity of `+\u1d65` -/\n vadd_assoc : \u2200 (x : M) (y : N) (z : \u03b1), (x +\u1d65 y) +\u1d65 z = x +\u1d65 y +\u1d65 z\n\n/-- An instance of `IsScalarTower M N \u03b1` states that the multiplicative\naction of `M` on `\u03b1` is determined by the multiplicative actions of `M` on `N`\nand `N` on `\u03b1`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.op_smul_eq_mul (L76-L77)\nlemma op_smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : MulOpposite.op a \u2022 b = b * a := rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowMulDistribMulAction (L115-L123)\ndef arrowMulDistribMulAction : MulDistribMulAction G (A \u2192 M) where\n smul_one _ := rfl\nsmul_mul _ _ _ := rfl\n\nend Arrow\n\nnamespace IsUnit\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Function (L184-L188)\nlemma Function.Injective.smulCommClass [SMul M \u03b1] [SMul N \u03b1] [SMul M \u03b2] [SMul N \u03b2]\n [SMulCommClass M N \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : Injective f) (h\u2081 : \u2200 (c : M) x, f (c \u2022 x) = c \u2022 f x)\n (h\u2082 : \u2200 (c : N) x, f (c \u2022 x) = c \u2022 f x) : SMulCommClass M N \u03b1 where\n smul_comm c\u2081 c\u2082 x := hf <| by simp only [h\u2081, h\u2082, smul_comm c\u2081 c\u2082 (f x)]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_zpow' (L210-L213)\nlemma smul_zpow' (r : M) (x : A) (z : \u2124) : r \u2022 (x ^ z) = (r \u2022 x) ^ z :=\nmap_zpow (MulDistribMulAction.toMonoidHom A r) x z\n\nend MulDistribMulAction\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Group/Finsupp.lean", "module": "Mathlib.Algebra.Group.Finsupp", "declaration": "Mathlib.Algebra.Group.Finsupp.eraseAddHom", "span": "L230-L234", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Finsupp.lean#L230"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6152, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 16096, "lean_code_chars": 14598, "natural_language_chars": 1498, "lean_code_ratio": 0.9069, "line_count": 450, "imports_count": 0, "declarations_count": 1972, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "c8d7f12085f86190", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.DirectSum.Ring.GradeZero", "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.Algebra.DirectSum.Ring)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance GradeZero.module {i} : Module (A 0) (A i)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.of_eq_of_gradedMonoid_eq (L144-L157)\ntheorem of_eq_of_gradedMonoid_eq {A : \u03b9 \u2192 Type*} [\u2200 i : \u03b9, AddCommMonoid (A i)] {i j : \u03b9} {a : A i}\n {b : A j} (h : GradedMonoid.mk i a = GradedMonoid.mk j b) :\n DirectSum.of A i a = DirectSum.of A j b :=\nDFinsupp.single_eq_of_sigma_eq h\n\nvariable (A : \u03b9 \u2192 Type*)\n\n/-! ### Instances for `\u2a01 i, A i` -/\n\n\nsection One\n\nvariable [Zero \u03b9] [GradedMonoid.GOne A] [\u2200 i, AddCommMonoid (A i)]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.one_def (L160-L170)\ntheorem one_def : 1 = DirectSum.of A 0 GradedMonoid.GOne.one := rfl\nend One\n\nsection Mul\n\nvariable [Add \u03b9] [\u2200 i, AddCommMonoid (A i)] [GNonUnitalNonAssocSemiring A]\n\nopen AddMonoidHom (flip_apply coe_comp compHom)\n\n/-- The piecewise multiplication from the `Mul` instance, as a bundled homomorphism. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.gMulHom (L172-L181)\ndef gMulHom {i j} : A i \u2192+ A j \u2192+ A (i + j) where\n toFun a :=\n{ toFun := fun b => GradedMonoid.GMul.mul a b\n map_zero' := GNonUnitalNonAssocSemiring.mul_zero _\n map_add' := GNonUnitalNonAssocSemiring.mul_add _ }\n map_zero' := AddMonoidHom.ext fun a => GNonUnitalNonAssocSemiring.zero_mul a\n map_add' _ _ := AddMonoidHom.ext fun _ => GNonUnitalNonAssocSemiring.add_mul _ _ _\n\n/-- The multiplication from the `Mul` instance, as a bundled homomorphism. -/\n-- See note [non-reducible instance]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mulHom (L183-L188)\ndef mulHom : (\u2a01 i, A i) \u2192+ (\u2a01 i, A i) \u2192+ \u2a01 i, A i :=\nDirectSum.toAddMonoid fun _ =>\n AddMonoidHom.flip <|\n DirectSum.toAddMonoid fun _ =>\n AddMonoidHom.flip <| (DirectSum.of A _).compHom.comp <| gMulHom A\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.instMul (L189-L191)\ninstance instMul : Mul (\u2a01 i, A i) where\n mul := fun a b => mulHom A a b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mulHom_apply (L201-L202)\ntheorem mulHom_apply (a b : \u2a01 i, A i) : mulHom A a b = a * b := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mulHom_of_of (L203-L206)\ntheorem mulHom_of_of {i j} (a : A i) (b : A j) :\n mulHom A (of A i a) (of A j b) = of A (i + j) (GradedMonoid.GMul.mul a b) := by\nsimp\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.of_mul_of (L207-L243)\ntheorem of_mul_of {i j} (a : A i) (b : A j) :\n of A i a * of A j b = of _ (i + j) (GradedMonoid.GMul.mul a b) :=\nmulHom_of_of a b\n\nend Mul\n\nsection Semiring\n\nvariable [\u2200 i, AddCommMonoid (A i)] [AddMonoid \u03b9] [GSemiring A]\n\nopen AddMonoidHom (flipHom coe_comp compHom flip_apply)\n\nprivate nonrec theorem one_mul (x : \u2a01 i, A i) : 1 * x = x := by\n suffices mulHom A One.one = AddMonoidHom.id (\u2a01 i, A i) from DFunLike.congr_fun this x\n apply addHom_ext; intro i xi\n simp only [One.one]\n rw [mulHom_of_of]\n exact of_eq_of_gradedMonoid_eq (one_mul <| GradedMonoid.mk i xi)\n\nprivate nonrec theorem mul_one (x : \u2a01 i, A i) : x * 1 = x := by\n suffices (mulHom A).flip One.one = AddMonoidHom.id (\u2a01 i, A i) from DFunLike.congr_fun this x\n apply addHom_ext; intro i xi\n simp only [One.one]\n rw [flip_apply, mulHom_of_of]\n exact of_eq_of_gradedMonoid_eq (mul_one <| GradedMonoid.mk i xi)\n\nprivate theorem mul_assoc (a b c : \u2a01 i, A i) : a * b * c = a * (b * c) := by\n -- (`fun a b c => a * b * c` as a bundled hom) = (`fun a b c => a * (b * c)` as a bundled hom)\n suffices AddMonoidHom.mulLeft\u2083 = AddMonoidHom.mulRight\u2083 by\n simpa only [AddMonoidHom.mulLeft\u2083_apply, AddMonoidHom.mulRight\u2083_apply] using\n DFunLike.congr_fun (DFunLike.congr_fun (DFunLike.congr_fun this a) b) c\n ext ai ax bi bx ci cx : 6\n dsimp only [coe_comp, Function.comp_apply, AddMonoidHom.mulLeft\u2083_apply,\n AddMonoidHom.mulRight\u2083_apply]\n simp_rw [of_mul_of]\n exact of_eq_of_gradedMonoid_eq (_root_.mul_assoc (GradedMonoid.mk ai ax) \u27e8bi, bx\u27e9 \u27e8ci, cx\u27e9)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.instNatCast (L244-L247)\ninstance instNatCast : NatCast (\u2a01 i, A i) where\n natCast := fun n => of _ _ (GSemiring.natCast n)\n/-- The `Semiring` structure derived from `GSemiring A`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.semiring (L248-L258)\ninstance semiring : Semiring (\u2a01 i, A i) where\n one_mul := private one_mul A\nmul_one := private mul_one A\n mul_assoc := private mul_assoc A\n toNatCast := instNatCast _\n natCast_zero := by simp only [NatCast.natCast, GSemiring.natCast_zero, map_zero]\n natCast_succ := fun n => by\n simp_rw [NatCast.natCast, GSemiring.natCast_succ]\n rw [map_add]\n rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.ofPow (L259-L266)\ntheorem ofPow {i} (a : A i) (n : \u2115) :\n of _ i a ^ n = of _ (n \u2022 i) (GradedMonoid.GMonoid.gnpow _ a) := by\ninduction n with\n | zero => exact of_eq_of_gradedMonoid_eq (pow_zero <| GradedMonoid.mk _ a).symm\n | succ n n_ih =>\n rw [pow_succ, n_ih, of_mul_of]\n exact of_eq_of_gradedMonoid_eq (pow_succ (GradedMonoid.mk _ a) n).symm\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.ofList_dProd (L267-L276)\ntheorem ofList_dProd {\u03b1} (l : List \u03b1) (f\u03b9 : \u03b1 \u2192 \u03b9) (fA : \u2200 a, A (f\u03b9 a)) :\n of A _ (l.dProd f\u03b9 fA) = (l.map fun a => of A (f\u03b9 a) (fA a)).prod := by\ninduction l with\n | nil => simp only [List.map_nil, List.prod_nil, List.dProd_nil]; rfl\n | cons head tail =>\n rename_i ih\n simp only [List.map_cons, List.prod_cons, List.dProd_cons, \u2190 ih]\n rw [DirectSum.of_mul_of (fA head)]\n rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.list_prod_ofFn_of_eq_dProd (L277-L281)\ntheorem list_prod_ofFn_of_eq_dProd (n : \u2115) (f\u03b9 : Fin n \u2192 \u03b9) (fA : \u2200 a, A (f\u03b9 a)) :\n (List.ofFn fun a => of A (f\u03b9 a) (fA a)).prod = of A _ ((List.finRange n).dProd f\u03b9 fA) := by\nrw [List.ofFn_eq_map, ofList_dProd]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mul_eq_dfinsuppSum (L282-L296)\ntheorem mul_eq_dfinsuppSum [\u2200 (i : \u03b9) (x : A i), Decidable (x \u2260 0)] (a a' : \u2a01 i, A i) :\n a * a'\n = a.sum fun _ ai => a'.sum fun _ aj => DirectSum.of _ _ <| GradedMonoid.GMul.mul ai aj := by\nchange mulHom _ a a' = _\n -- Porting note: I have no idea how the proof from ml3 worked it used to be\n -- simpa only [mul_hom, to_add_monoid, dfinsupp.lift_add_hom_apply, dfinsupp.sum_add_hom_apply,\n -- add_monoid_hom.dfinsupp_sum_apply, flip_apply, add_monoid_hom.dfinsupp_sum_add_hom_apply],\n rw [mulHom, toAddMonoid, DFinsupp.liftAddHom_apply]\n dsimp only [DirectSum]\n rw [DFinsupp.sumAddHom_apply, AddMonoidHom.dfinsuppSum_apply]\n apply congrArg _\n funext x\n simp [AddMonoidHom.dfinsuppSum_apply, DFinsupp.sumAddHom_apply, DirectSum.toAddMonoid]\n\n/-- A heavily unfolded version of the definition of multiplication -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mul_eq_sum_support_ghas_mul (L297-L316)\ntheorem mul_eq_sum_support_ghas_mul [\u2200 (i : \u03b9) (x : A i), Decidable (x \u2260 0)] (a a' : \u2a01 i, A i) :\n a * a' =\n \u2211 ij \u2208 DFinsupp.support a \u00d7\u02e2 DFinsupp.support a',\n DirectSum.of _ _ (GradedMonoid.GMul.mul (a ij.fst) (a' ij.snd)) := by\nsimp only [mul_eq_dfinsuppSum, DFinsupp.sum, Finset.sum_product]\n\nend Semiring\n\nsection CommSemiring\n\nvariable [\u2200 i, AddCommMonoid (A i)] [AddCommMonoid \u03b9] [GCommSemiring A]\n\nprivate theorem mul_comm (a b : \u2a01 i, A i) : a * b = b * a := by\n suffices mulHom A = (mulHom A).flip by\n rw [\u2190 mulHom_apply, this, AddMonoidHom.flip_apply, mulHom_apply]\n apply addHom_ext; intro ai ax; apply addHom_ext; intro bi bx\n rw [AddMonoidHom.flip_apply, mulHom_of_of, mulHom_of_of]\n exact of_eq_of_gradedMonoid_eq (GCommSemiring.mul_comm \u27e8ai, ax\u27e9 \u27e8bi, bx\u27e9)\n\n/-- The `CommSemiring` structure derived from `GCommSemiring A`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of_eq_of_ne (L136-L138)\ntheorem of_eq_of_ne (i j : \u03b9) (x : \u03b2 i) (h : j \u2260 i) : (of _ i x) j = 0 :=\nDFinsupp.single_eq_of_ne h\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.coeFnAddMonoidHom (L69-L72)\ndef coeFnAddMonoidHom [\u2200 i, AddCommMonoid (\u03b2 i)] : (\u2a01 i, \u03b2 i) \u2192+ (\u03a0 i, \u03b2 i) where\n toFun x := x\n__ := DFinsupp.coeFnAddMonoidHom\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.toAlgebra (L116-L128)\ndef toAlgebra (f : \u2200 i, A i \u2192\u2097[R] B) (hone : f _ GradedMonoid.GOne.one = 1)\n (hmul : \u2200 {i j} (ai : A i) (aj : A j), f _ (GradedMonoid.GMul.mul ai aj) = f _ ai * f _ aj) :\n (\u2a01 i, A i) \u2192\u2090[R] B :=\n{ toSemiring (fun i => (f i).toAddMonoidHom) hone @hmul with\n toFun := toSemiring (fun i => (f i).toAddMonoidHom) hone @hmul\n commutes' := fun r => by\n change toModule R _ _ f (algebraMap R _ r) = _\n rw [Algebra.algebraMap_eq_smul_one, Algebra.algebraMap_eq_smul_one, map_smul, one_def,\n \u2190 lof_eq_of R, toModule_lof, hone] }\n\n/-- Two `AlgHom`s out of a direct sum are equal if they agree on the generators.\n\nSee note [partially-applied ext lemmas]. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of_eq_same (L133-L135)\ntheorem of_eq_same (i : \u03b9) (x : \u03b2 i) : (of _ i x) i = x :=\nDFinsupp.single_eq_same\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algebraMap_apply (L100-L103)\ntheorem algebraMap_apply (r : R) :\n algebraMap R (\u2a01 i, A i) r = DirectSum.of A 0 (GAlgebra.toFun r) :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.gMulLHom (L141-L156)\ndef gMulLHom {i j} : A i \u2192\u2097[R] A j \u2192\u2097[R] A (i + j) where\n toFun a :=\n{ toFun := fun b => GradedMonoid.GMul.mul a b\n map_smul' := fun r x => by\n injection (smul_comm r (GradedMonoid.mk _ a) (GradedMonoid.mk _ x)).symm\n map_add' := GNonUnitalNonAssocSemiring.mul_add _ }\n map_smul' r x := LinearMap.ext fun y => by\n injection smul_assoc r (GradedMonoid.mk _ x) (GradedMonoid.mk _ y)\n map_add' _ _ := LinearMap.ext fun _ => GNonUnitalNonAssocSemiring.add_mul _ _ _\n\nend DirectSum\n\n/-! ### Concrete instances -/\n\n\n/-- A direct sum of copies of an `Algebra` inherits the algebra structure. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.support_of (L155-L158)\ntheorem support_of [\u2200 (i : \u03b9) (x : \u03b2 i), Decidable (x \u2260 0)] (i : \u03b9) (x : \u03b2 i) (h : x \u2260 0) :\n (of _ i x).support = {i} :=\nDFinsupp.support_single_ne_zero h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.mk_apply_of_notMem (L146-L149)\ntheorem mk_apply_of_notMem {s : Finset \u03b9} {f : \u2200 i : (\u2191s : Set \u03b9), \u03b2 i.val} {n : \u03b9} (hn : n \u2209 s) :\n mk \u03b2 s f n = 0 :=\nDFinsupp.mk_of_notMem hn\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algHom_ext' (L130-L133)\ntheorem algHom_ext' \u2983f g : (\u2a01 i, A i) \u2192\u2090[R] B\u2984\n (h : \u2200 i, f.toLinearMap.comp (lof _ _ A i) = g.toLinearMap.comp (lof _ _ A i)) : f = g :=\nAlgHom.toLinearMap_injective <| DirectSum.linearMap_ext _ h\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.coeFnAddMonoidHom_apply (L74-L81)\nlemma coeFnAddMonoidHom_apply [\u2200 i, AddCommMonoid (\u03b2 i)] (v : \u2a01 i, \u03b2 i) :\n coeFnAddMonoidHom \u03b2 v = v :=\nrfl\n\nsection AddCommGroup\n\nvariable [\u2200 i, AddCommGroup (\u03b2 i)]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.sub_apply (L88-L94)\ntheorem sub_apply (g\u2081 g\u2082 : \u2a01 i, \u03b2 i) (i : \u03b9) : (g\u2081 - g\u2082) i = g\u2081 i - g\u2082 i :=\nrfl\n\nend AddCommGroup\n\nvariable [\u2200 i, AddCommMonoid (\u03b2 i)]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.DirectSum.AddChar.directSum_injective (L32-L39)\nlemma directSum_injective :\n Injective (directSum : (\u2200 i, AddChar (G i) R) \u2192 AddChar (\u2a01 i, G i) R) := by\nrefine toAddMonoidHomEquiv.symm.injective.comp <| DirectSum.toAddMonoid_injective.comp ?_\n rintro \u03c8 \u03c7 h\n simpa [funext_iff] using h\n\nend DirectSum\nend AddChar\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of_apply (L139-L141)\nlemma of_apply {i : \u03b9} (j : \u03b9) (x : \u03b2 i) : of \u03b2 i x j = if h : i = j then Eq.recOn h x else 0 :=\nDFinsupp.single_apply\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.mk (L121-L126)\ndef mk (s : Finset \u03b9) : (\u2200 i : (\u2191s : Set \u03b9), \u03b2 i.1) \u2192+ \u2a01 i, \u03b2 i where\n toFun := DFinsupp.mk s\nmap_add' _ _ := DFinsupp.mk_add\n map_zero' := DFinsupp.mk_zero\n\n/-- `of i` is the natural inclusion map from `\u03b2 i` to `\u2a01 i, \u03b2 i`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.mk_apply_of_mem (L142-L145)\ntheorem mk_apply_of_mem {s : Finset \u03b9} {f : \u2200 i : (\u2191s : Set \u03b9), \u03b2 i.val} {n : \u03b9} (hn : n \u2208 s) :\n mk \u03b2 s f n = f \u27e8n, hn\u27e9 :=\nDFinsupp.mk_of_mem hn\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.DirectSum.AddChar.directSum (L29-L31)\ndef directSum (\u03c8 : \u2200 i, AddChar (G i) R) : AddChar (\u2a01 i, G i) R :=\ntoAddMonoidHomEquiv.symm <| DirectSum.toAddMonoid fun i \u21a6 toAddMonoidHomEquiv (\u03c8 i)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algebraMap_toAddMonoid_hom (L104-L114)\ntheorem algebraMap_toAddMonoid_hom :\n \u2191(algebraMap R (\u2a01 i, A i)) = (DirectSum.of A 0).comp (GAlgebra.toFun : R \u2192+ A 0) :=\nrfl\n\n/-- A family of `LinearMap`s preserving `DirectSum.GOne.one` and `DirectSum.GMul.mul`\ndescribes an `AlgHom` on `\u2a01 i, A i`. This is a stronger version of `DirectSum.toSemiring`.\n\nOf particular interest is the case when `A i` are bundled subobjects, `f` is the family of\ncoercions such as `Submodule.subtype (A i)`, and the `[GMonoid A]` structure originates from\n`DirectSum.GMonoid.ofAddSubmodules`, in which case the proofs about `GOne` and `GMul`\ncan be discharged by `rfl`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.zero_apply (L99-L103)\ntheorem zero_apply (i : \u03b9) : (0 : \u2a01 i, \u03b2 i) i = 0 :=\nrfl\n\nvariable {\u03b2}\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algHom_ext (L134-L139)\ntheorem algHom_ext \u2983f g : (\u2a01 i, A i) \u2192\u2090[R] B\u2984 (h : \u2200 i x, f (of A i x) = g (of A i x)) : f = g :=\nalgHom_ext' R A fun i => LinearMap.ext <| h i\n\n/-- The piecewise multiplication from the `Mul` instance, as a bundled linear map.\n\nThis is the graded version of `LinearMap.mul`, and the linear version of `DirectSum.gMulHom` -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.support_zero (L151-L153)\ntheorem support_zero [\u2200 (i : \u03b9) (x : \u03b2 i), Decidable (x \u2260 0)] : (0 : \u2a01 i, \u03b2 i).support = \u2205 :=\nDFinsupp.support_zero\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.add_apply (L105-L107)\ntheorem add_apply (g\u2081 g\u2082 : \u2a01 i, \u03b2 i) (i : \u03b9) : (g\u2081 + g\u2082) i = g\u2081 i + g\u2082 i :=\nrfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of (L127-L131)\ndef of (i : \u03b9) : \u03b2 i \u2192+ \u2a01 i, \u03b2 i :=\nDFinsupp.singleAddHom \u03b2 i\n\nvariable {\u03b2}\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.sum_apply (L109-L120)\ntheorem sum_apply {\u03b1} (s : Finset \u03b1) (g : \u03b1 \u2192 \u2a01 i, \u03b2 i) (i : \u03b9) :\n (\u2211 a \u2208 s, g a) i = \u2211 a \u2208 s, g a i :=\nDFinsupp.finset_sum_apply s g i\n\nsection DecidableEq\n\nvariable [DecidableEq \u03b9]\n\nvariable (\u03b2)\n\n/-- `mk \u03b2 s x` is the element of `\u2a01 i, \u03b2 i` that is zero outside `s`\nand has coefficient `x i` for `i` in `s`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.DirectSum (L38-L59)\ndef DirectSum [\u2200 i, AddCommMonoid (\u03b2 i)] : Type _ :=\n\u03a0\u2080 i, \u03b2 i\nderiving AddCommMonoid, Inhabited, DFunLike\n\nset_option backward.inferInstanceAs.wrap.data false in\nderiving instance CoeFun for DirectSum\n\n/-- `\u2a01 i, f i` is notation for `DirectSum _ f` and equals the direct sum of `fun i \u21a6 f i`.\nTaking the direct sum over multiple arguments is possible, e.g. `\u2a01 (i) (j), f i j`. -/\nscoped[DirectSum] notation3 \"\u2a01 \"(...)\", \"r:(scoped f => DirectSum _ f) => r\n\n-- Porting note: The below recreates some of the lean3 notation, not fully yet\n-- section\n-- open Batteries.ExtendedBinder\n-- syntax (name := bigdirectsum) \"\u2a01 \" extBinders \", \" term : term\n-- macro_rules (kind := bigdirectsum)\n-- | `(\u2a01 $_:ident, $y:ident \u2192 $z:ident) => `(DirectSum _ (fun $y \u21a6 $z))\n-- | `(\u2a01 $x:ident, $p) => `(DirectSum _ (fun $x \u21a6 $p))\n-- | `(\u2a01 $_:ident : $t:ident, $p) => `(DirectSum _ (fun $t \u21a6 $p))\n-- | `(\u2a01 ($x:ident) ($y:ident), $p) => `(DirectSum _ (fun $x \u21a6 fun $y \u21a6 $p))\n-- end\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.Algebra (L158-L165)\ninstance Algebra.directSumGAlgebra {R A : Type*} [AddMonoid \u03b9] [CommSemiring R]\n [Semiring A] [Algebra R A] : DirectSum.GAlgebra R fun _ : \u03b9 => A where\n toFun := (algebraMap R A).toAddMonoidHom\nmap_one := (algebraMap R A).map_one\n map_mul a b := Sigma.ext (zero_add _).symm (heq_of_eq <| (algebraMap R A).map_mul a b)\n commutes := fun _ \u27e8_, _\u27e9 =>\n Sigma.ext ((zero_add _).trans (add_zero _).symm) (heq_of_eq <| Algebra.commutes _ _)\n smul_def := fun _ \u27e8_, _\u27e9 => Sigma.ext (zero_add _).symm (heq_of_eq <| Algebra.smul_def _ _)\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.Algebra.DirectSum.Ring).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance GradeZero.module {i} : Module (A 0) (A i)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.of_eq_of_gradedMonoid_eq (L144-L157)\ntheorem of_eq_of_gradedMonoid_eq {A : \u03b9 \u2192 Type*} [\u2200 i : \u03b9, AddCommMonoid (A i)] {i j : \u03b9} {a : A i}\n {b : A j} (h : GradedMonoid.mk i a = GradedMonoid.mk j b) :\n DirectSum.of A i a = DirectSum.of A j b :=\nDFinsupp.single_eq_of_sigma_eq h\n\nvariable (A : \u03b9 \u2192 Type*)\n\n/-! ### Instances for `\u2a01 i, A i` -/\n\n\nsection One\n\nvariable [Zero \u03b9] [GradedMonoid.GOne A] [\u2200 i, AddCommMonoid (A i)]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.one_def (L160-L170)\ntheorem one_def : 1 = DirectSum.of A 0 GradedMonoid.GOne.one := rfl\nend One\n\nsection Mul\n\nvariable [Add \u03b9] [\u2200 i, AddCommMonoid (A i)] [GNonUnitalNonAssocSemiring A]\n\nopen AddMonoidHom (flip_apply coe_comp compHom)\n\n/-- The piecewise multiplication from the `Mul` instance, as a bundled homomorphism. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.gMulHom (L172-L181)\ndef gMulHom {i j} : A i \u2192+ A j \u2192+ A (i + j) where\n toFun a :=\n{ toFun := fun b => GradedMonoid.GMul.mul a b\n map_zero' := GNonUnitalNonAssocSemiring.mul_zero _\n map_add' := GNonUnitalNonAssocSemiring.mul_add _ }\n map_zero' := AddMonoidHom.ext fun a => GNonUnitalNonAssocSemiring.zero_mul a\n map_add' _ _ := AddMonoidHom.ext fun _ => GNonUnitalNonAssocSemiring.add_mul _ _ _\n\n/-- The multiplication from the `Mul` instance, as a bundled homomorphism. -/\n-- See note [non-reducible instance]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mulHom (L183-L188)\ndef mulHom : (\u2a01 i, A i) \u2192+ (\u2a01 i, A i) \u2192+ \u2a01 i, A i :=\nDirectSum.toAddMonoid fun _ =>\n AddMonoidHom.flip <|\n DirectSum.toAddMonoid fun _ =>\n AddMonoidHom.flip <| (DirectSum.of A _).compHom.comp <| gMulHom A\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.instMul (L189-L191)\ninstance instMul : Mul (\u2a01 i, A i) where\n mul := fun a b => mulHom A a b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mulHom_apply (L201-L202)\ntheorem mulHom_apply (a b : \u2a01 i, A i) : mulHom A a b = a * b := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mulHom_of_of (L203-L206)\ntheorem mulHom_of_of {i j} (a : A i) (b : A j) :\n mulHom A (of A i a) (of A j b) = of A (i + j) (GradedMonoid.GMul.mul a b) := by\nsimp\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.of_mul_of (L207-L243)\ntheorem of_mul_of {i j} (a : A i) (b : A j) :\n of A i a * of A j b = of _ (i + j) (GradedMonoid.GMul.mul a b) :=\nmulHom_of_of a b\n\nend Mul\n\nsection Semiring\n\nvariable [\u2200 i, AddCommMonoid (A i)] [AddMonoid \u03b9] [GSemiring A]\n\nopen AddMonoidHom (flipHom coe_comp compHom flip_apply)\n\nprivate nonrec theorem one_mul (x : \u2a01 i, A i) : 1 * x = x := by\n suffices mulHom A One.one = AddMonoidHom.id (\u2a01 i, A i) from DFunLike.congr_fun this x\n apply addHom_ext; intro i xi\n simp only [One.one]\n rw [mulHom_of_of]\n exact of_eq_of_gradedMonoid_eq (one_mul <| GradedMonoid.mk i xi)\n\nprivate nonrec theorem mul_one (x : \u2a01 i, A i) : x * 1 = x := by\n suffices (mulHom A).flip One.one = AddMonoidHom.id (\u2a01 i, A i) from DFunLike.congr_fun this x\n apply addHom_ext; intro i xi\n simp only [One.one]\n rw [flip_apply, mulHom_of_of]\n exact of_eq_of_gradedMonoid_eq (mul_one <| GradedMonoid.mk i xi)\n\nprivate theorem mul_assoc (a b c : \u2a01 i, A i) : a * b * c = a * (b * c) := by\n -- (`fun a b c => a * b * c` as a bundled hom) = (`fun a b c => a * (b * c)` as a bundled hom)\n suffices AddMonoidHom.mulLeft\u2083 = AddMonoidHom.mulRight\u2083 by\n simpa only [AddMonoidHom.mulLeft\u2083_apply, AddMonoidHom.mulRight\u2083_apply] using\n DFunLike.congr_fun (DFunLike.congr_fun (DFunLike.congr_fun this a) b) c\n ext ai ax bi bx ci cx : 6\n dsimp only [coe_comp, Function.comp_apply, AddMonoidHom.mulLeft\u2083_apply,\n AddMonoidHom.mulRight\u2083_apply]\n simp_rw [of_mul_of]\n exact of_eq_of_gradedMonoid_eq (_root_.mul_assoc (GradedMonoid.mk ai ax) \u27e8bi, bx\u27e9 \u27e8ci, cx\u27e9)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.instNatCast (L244-L247)\ninstance instNatCast : NatCast (\u2a01 i, A i) where\n natCast := fun n => of _ _ (GSemiring.natCast n)\n/-- The `Semiring` structure derived from `GSemiring A`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.semiring (L248-L258)\ninstance semiring : Semiring (\u2a01 i, A i) where\n one_mul := private one_mul A\nmul_one := private mul_one A\n mul_assoc := private mul_assoc A\n toNatCast := instNatCast _\n natCast_zero := by simp only [NatCast.natCast, GSemiring.natCast_zero, map_zero]\n natCast_succ := fun n => by\n simp_rw [NatCast.natCast, GSemiring.natCast_succ]\n rw [map_add]\n rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.ofPow (L259-L266)\ntheorem ofPow {i} (a : A i) (n : \u2115) :\n of _ i a ^ n = of _ (n \u2022 i) (GradedMonoid.GMonoid.gnpow _ a) := by\ninduction n with\n | zero => exact of_eq_of_gradedMonoid_eq (pow_zero <| GradedMonoid.mk _ a).symm\n | succ n n_ih =>\n rw [pow_succ, n_ih, of_mul_of]\n exact of_eq_of_gradedMonoid_eq (pow_succ (GradedMonoid.mk _ a) n).symm\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.ofList_dProd (L267-L276)\ntheorem ofList_dProd {\u03b1} (l : List \u03b1) (f\u03b9 : \u03b1 \u2192 \u03b9) (fA : \u2200 a, A (f\u03b9 a)) :\n of A _ (l.dProd f\u03b9 fA) = (l.map fun a => of A (f\u03b9 a) (fA a)).prod := by\ninduction l with\n | nil => simp only [List.map_nil, List.prod_nil, List.dProd_nil]; rfl\n | cons head tail =>\n rename_i ih\n simp only [List.map_cons, List.prod_cons, List.dProd_cons, \u2190 ih]\n rw [DirectSum.of_mul_of (fA head)]\n rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.list_prod_ofFn_of_eq_dProd (L277-L281)\ntheorem list_prod_ofFn_of_eq_dProd (n : \u2115) (f\u03b9 : Fin n \u2192 \u03b9) (fA : \u2200 a, A (f\u03b9 a)) :\n (List.ofFn fun a => of A (f\u03b9 a) (fA a)).prod = of A _ ((List.finRange n).dProd f\u03b9 fA) := by\nrw [List.ofFn_eq_map, ofList_dProd]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mul_eq_dfinsuppSum (L282-L296)\ntheorem mul_eq_dfinsuppSum [\u2200 (i : \u03b9) (x : A i), Decidable (x \u2260 0)] (a a' : \u2a01 i, A i) :\n a * a'\n = a.sum fun _ ai => a'.sum fun _ aj => DirectSum.of _ _ <| GradedMonoid.GMul.mul ai aj := by\nchange mulHom _ a a' = _\n -- Porting note: I have no idea how the proof from ml3 worked it used to be\n -- simpa only [mul_hom, to_add_monoid, dfinsupp.lift_add_hom_apply, dfinsupp.sum_add_hom_apply,\n -- add_monoid_hom.dfinsupp_sum_apply, flip_apply, add_monoid_hom.dfinsupp_sum_add_hom_apply],\n rw [mulHom, toAddMonoid, DFinsupp.liftAddHom_apply]\n dsimp only [DirectSum]\n rw [DFinsupp.sumAddHom_apply, AddMonoidHom.dfinsuppSum_apply]\n apply congrArg _\n funext x\n simp [AddMonoidHom.dfinsuppSum_apply, DFinsupp.sumAddHom_apply, DirectSum.toAddMonoid]\n\n/-- A heavily unfolded version of the definition of multiplication -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.DirectSum.Ring.mul_eq_sum_support_ghas_mul (L297-L316)\ntheorem mul_eq_sum_support_ghas_mul [\u2200 (i : \u03b9) (x : A i), Decidable (x \u2260 0)] (a a' : \u2a01 i, A i) :\n a * a' =\n \u2211 ij \u2208 DFinsupp.support a \u00d7\u02e2 DFinsupp.support a',\n DirectSum.of _ _ (GradedMonoid.GMul.mul (a ij.fst) (a' ij.snd)) := by\nsimp only [mul_eq_dfinsuppSum, DFinsupp.sum, Finset.sum_product]\n\nend Semiring\n\nsection CommSemiring\n\nvariable [\u2200 i, AddCommMonoid (A i)] [AddCommMonoid \u03b9] [GCommSemiring A]\n\nprivate theorem mul_comm (a b : \u2a01 i, A i) : a * b = b * a := by\n suffices mulHom A = (mulHom A).flip by\n rw [\u2190 mulHom_apply, this, AddMonoidHom.flip_apply, mulHom_apply]\n apply addHom_ext; intro ai ax; apply addHom_ext; intro bi bx\n rw [AddMonoidHom.flip_apply, mulHom_of_of, mulHom_of_of]\n exact of_eq_of_gradedMonoid_eq (GCommSemiring.mul_comm \u27e8ai, ax\u27e9 \u27e8bi, bx\u27e9)\n\n/-- The `CommSemiring` structure derived from `GCommSemiring A`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of_eq_of_ne (L136-L138)\ntheorem of_eq_of_ne (i j : \u03b9) (x : \u03b2 i) (h : j \u2260 i) : (of _ i x) j = 0 :=\nDFinsupp.single_eq_of_ne h\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.coeFnAddMonoidHom (L69-L72)\ndef coeFnAddMonoidHom [\u2200 i, AddCommMonoid (\u03b2 i)] : (\u2a01 i, \u03b2 i) \u2192+ (\u03a0 i, \u03b2 i) where\n toFun x := x\n__ := DFinsupp.coeFnAddMonoidHom\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.toAlgebra (L116-L128)\ndef toAlgebra (f : \u2200 i, A i \u2192\u2097[R] B) (hone : f _ GradedMonoid.GOne.one = 1)\n (hmul : \u2200 {i j} (ai : A i) (aj : A j), f _ (GradedMonoid.GMul.mul ai aj) = f _ ai * f _ aj) :\n (\u2a01 i, A i) \u2192\u2090[R] B :=\n{ toSemiring (fun i => (f i).toAddMonoidHom) hone @hmul with\n toFun := toSemiring (fun i => (f i).toAddMonoidHom) hone @hmul\n commutes' := fun r => by\n change toModule R _ _ f (algebraMap R _ r) = _\n rw [Algebra.algebraMap_eq_smul_one, Algebra.algebraMap_eq_smul_one, map_smul, one_def,\n \u2190 lof_eq_of R, toModule_lof, hone] }\n\n/-- Two `AlgHom`s out of a direct sum are equal if they agree on the generators.\n\nSee note [partially-applied ext lemmas]. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of_eq_same (L133-L135)\ntheorem of_eq_same (i : \u03b9) (x : \u03b2 i) : (of _ i x) i = x :=\nDFinsupp.single_eq_same\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algebraMap_apply (L100-L103)\ntheorem algebraMap_apply (r : R) :\n algebraMap R (\u2a01 i, A i) r = DirectSum.of A 0 (GAlgebra.toFun r) :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.gMulLHom (L141-L156)\ndef gMulLHom {i j} : A i \u2192\u2097[R] A j \u2192\u2097[R] A (i + j) where\n toFun a :=\n{ toFun := fun b => GradedMonoid.GMul.mul a b\n map_smul' := fun r x => by\n injection (smul_comm r (GradedMonoid.mk _ a) (GradedMonoid.mk _ x)).symm\n map_add' := GNonUnitalNonAssocSemiring.mul_add _ }\n map_smul' r x := LinearMap.ext fun y => by\n injection smul_assoc r (GradedMonoid.mk _ x) (GradedMonoid.mk _ y)\n map_add' _ _ := LinearMap.ext fun _ => GNonUnitalNonAssocSemiring.add_mul _ _ _\n\nend DirectSum\n\n/-! ### Concrete instances -/\n\n\n/-- A direct sum of copies of an `Algebra` inherits the algebra structure. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.support_of (L155-L158)\ntheorem support_of [\u2200 (i : \u03b9) (x : \u03b2 i), Decidable (x \u2260 0)] (i : \u03b9) (x : \u03b2 i) (h : x \u2260 0) :\n (of _ i x).support = {i} :=\nDFinsupp.support_single_ne_zero h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.mk_apply_of_notMem (L146-L149)\ntheorem mk_apply_of_notMem {s : Finset \u03b9} {f : \u2200 i : (\u2191s : Set \u03b9), \u03b2 i.val} {n : \u03b9} (hn : n \u2209 s) :\n mk \u03b2 s f n = 0 :=\nDFinsupp.mk_of_notMem hn\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algHom_ext' (L130-L133)\ntheorem algHom_ext' \u2983f g : (\u2a01 i, A i) \u2192\u2090[R] B\u2984\n (h : \u2200 i, f.toLinearMap.comp (lof _ _ A i) = g.toLinearMap.comp (lof _ _ A i)) : f = g :=\nAlgHom.toLinearMap_injective <| DirectSum.linearMap_ext _ h\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.coeFnAddMonoidHom_apply (L74-L81)\nlemma coeFnAddMonoidHom_apply [\u2200 i, AddCommMonoid (\u03b2 i)] (v : \u2a01 i, \u03b2 i) :\n coeFnAddMonoidHom \u03b2 v = v :=\nrfl\n\nsection AddCommGroup\n\nvariable [\u2200 i, AddCommGroup (\u03b2 i)]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.sub_apply (L88-L94)\ntheorem sub_apply (g\u2081 g\u2082 : \u2a01 i, \u03b2 i) (i : \u03b9) : (g\u2081 - g\u2082) i = g\u2081 i - g\u2082 i :=\nrfl\n\nend AddCommGroup\n\nvariable [\u2200 i, AddCommMonoid (\u03b2 i)]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.DirectSum.AddChar.directSum_injective (L32-L39)\nlemma directSum_injective :\n Injective (directSum : (\u2200 i, AddChar (G i) R) \u2192 AddChar (\u2a01 i, G i) R) := by\nrefine toAddMonoidHomEquiv.symm.injective.comp <| DirectSum.toAddMonoid_injective.comp ?_\n rintro \u03c8 \u03c7 h\n simpa [funext_iff] using h\n\nend DirectSum\nend AddChar\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of_apply (L139-L141)\nlemma of_apply {i : \u03b9} (j : \u03b9) (x : \u03b2 i) : of \u03b2 i x j = if h : i = j then Eq.recOn h x else 0 :=\nDFinsupp.single_apply\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.mk (L121-L126)\ndef mk (s : Finset \u03b9) : (\u2200 i : (\u2191s : Set \u03b9), \u03b2 i.1) \u2192+ \u2a01 i, \u03b2 i where\n toFun := DFinsupp.mk s\nmap_add' _ _ := DFinsupp.mk_add\n map_zero' := DFinsupp.mk_zero\n\n/-- `of i` is the natural inclusion map from `\u03b2 i` to `\u2a01 i, \u03b2 i`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.mk_apply_of_mem (L142-L145)\ntheorem mk_apply_of_mem {s : Finset \u03b9} {f : \u2200 i : (\u2191s : Set \u03b9), \u03b2 i.val} {n : \u03b9} (hn : n \u2208 s) :\n mk \u03b2 s f n = f \u27e8n, hn\u27e9 :=\nDFinsupp.mk_of_mem hn\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.DirectSum.AddChar.directSum (L29-L31)\ndef directSum (\u03c8 : \u2200 i, AddChar (G i) R) : AddChar (\u2a01 i, G i) R :=\ntoAddMonoidHomEquiv.symm <| DirectSum.toAddMonoid fun i \u21a6 toAddMonoidHomEquiv (\u03c8 i)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algebraMap_toAddMonoid_hom (L104-L114)\ntheorem algebraMap_toAddMonoid_hom :\n \u2191(algebraMap R (\u2a01 i, A i)) = (DirectSum.of A 0).comp (GAlgebra.toFun : R \u2192+ A 0) :=\nrfl\n\n/-- A family of `LinearMap`s preserving `DirectSum.GOne.one` and `DirectSum.GMul.mul`\ndescribes an `AlgHom` on `\u2a01 i, A i`. This is a stronger version of `DirectSum.toSemiring`.\n\nOf particular interest is the case when `A i` are bundled subobjects, `f` is the family of\ncoercions such as `Submodule.subtype (A i)`, and the `[GMonoid A]` structure originates from\n`DirectSum.GMonoid.ofAddSubmodules`, in which case the proofs about `GOne` and `GMul`\ncan be discharged by `rfl`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.zero_apply (L99-L103)\ntheorem zero_apply (i : \u03b9) : (0 : \u2a01 i, \u03b2 i) i = 0 :=\nrfl\n\nvariable {\u03b2}\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.algHom_ext (L134-L139)\ntheorem algHom_ext \u2983f g : (\u2a01 i, A i) \u2192\u2090[R] B\u2984 (h : \u2200 i x, f (of A i x) = g (of A i x)) : f = g :=\nalgHom_ext' R A fun i => LinearMap.ext <| h i\n\n/-- The piecewise multiplication from the `Mul` instance, as a bundled linear map.\n\nThis is the graded version of `LinearMap.mul`, and the linear version of `DirectSum.gMulHom` -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.support_zero (L151-L153)\ntheorem support_zero [\u2200 (i : \u03b9) (x : \u03b2 i), Decidable (x \u2260 0)] : (0 : \u2a01 i, \u03b2 i).support = \u2205 :=\nDFinsupp.support_zero\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.add_apply (L105-L107)\ntheorem add_apply (g\u2081 g\u2082 : \u2a01 i, \u03b2 i) (i : \u03b9) : (g\u2081 + g\u2082) i = g\u2081 i + g\u2082 i :=\nrfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.of (L127-L131)\ndef of (i : \u03b9) : \u03b2 i \u2192+ \u2a01 i, \u03b2 i :=\nDFinsupp.singleAddHom \u03b2 i\n\nvariable {\u03b2}\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.sum_apply (L109-L120)\ntheorem sum_apply {\u03b1} (s : Finset \u03b1) (g : \u03b1 \u2192 \u2a01 i, \u03b2 i) (i : \u03b9) :\n (\u2211 a \u2208 s, g a) i = \u2211 a \u2208 s, g a i :=\nDFinsupp.finset_sum_apply s g i\n\nsection DecidableEq\n\nvariable [DecidableEq \u03b9]\n\nvariable (\u03b2)\n\n/-- `mk \u03b2 s x` is the element of `\u2a01 i, \u03b2 i` that is zero outside `s`\nand has coefficient `x i` for `i` in `s`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.DirectSum.Basic.DirectSum (L38-L59)\ndef DirectSum [\u2200 i, AddCommMonoid (\u03b2 i)] : Type _ :=\n\u03a0\u2080 i, \u03b2 i\nderiving AddCommMonoid, Inhabited, DFunLike\n\nset_option backward.inferInstanceAs.wrap.data false in\nderiving instance CoeFun for DirectSum\n\n/-- `\u2a01 i, f i` is notation for `DirectSum _ f` and equals the direct sum of `fun i \u21a6 f i`.\nTaking the direct sum over multiple arguments is possible, e.g. `\u2a01 (i) (j), f i j`. -/\nscoped[DirectSum] notation3 \"\u2a01 \"(...)\", \"r:(scoped f => DirectSum _ f) => r\n\n-- Porting note: The below recreates some of the lean3 notation, not fully yet\n-- section\n-- open Batteries.ExtendedBinder\n-- syntax (name := bigdirectsum) \"\u2a01 \" extBinders \", \" term : term\n-- macro_rules (kind := bigdirectsum)\n-- | `(\u2a01 $_:ident, $y:ident \u2192 $z:ident) => `(DirectSum _ (fun $y \u21a6 $z))\n-- | `(\u2a01 $x:ident, $p) => `(DirectSum _ (fun $x \u21a6 $p))\n-- | `(\u2a01 $_:ident : $t:ident, $p) => `(DirectSum _ (fun $t \u21a6 $p))\n-- | `(\u2a01 ($x:ident) ($y:ident), $p) => `(DirectSum _ (fun $x \u21a6 fun $y \u21a6 $p))\n-- end\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.DirectSum.Algebra.Algebra (L158-L165)\ninstance Algebra.directSumGAlgebra {R A : Type*} [AddMonoid \u03b9] [CommSemiring R]\n [Semiring A] [Algebra R A] : DirectSum.GAlgebra R fun _ : \u03b9 => A where\n toFun := (algebraMap R A).toAddMonoidHom\nmap_one := (algebraMap R A).map_one\n map_mul a b := Sigma.ext (zero_add _).symm (heq_of_eq <| (algebraMap R A).map_mul a b)\n commutes := fun _ \u27e8_, _\u27e9 =>\n Sigma.ext ((zero_add _).trans (add_zero _).symm) (heq_of_eq <| Algebra.commutes _ _)\n smul_def := fun _ \u27e8_, _\u27e9 => Sigma.ext (zero_add _).symm (heq_of_eq <| Algebra.smul_def _ _)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/DirectSum/Ring.lean", "module": "Mathlib.Algebra.DirectSum.Ring", "declaration": "Mathlib.Algebra.DirectSum.Ring.GradeZero", "span": "L435-L445", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/DirectSum/Ring.lean#L435"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6686, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 16917, "lean_code_chars": 15418, "natural_language_chars": 1499, "lean_code_ratio": 0.9114, "line_count": 508, "imports_count": 0, "declarations_count": 1979, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "9973a3fb980d3d14", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.Jacobson.Radical.jacobson_smul_lt_top", "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.RingTheory.Jacobson.Radical)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem jacobson_smul_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] (N : Submodule R M) :\n Ring.jacobson R \u2022 N < \u22a4\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson (L43-L47)\ndef jacobson : Submodule R M :=\nsInf { m : Submodule R M | IsCoatom m }\n\nvariable {R R\u2082 M M\u2082}\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.le_comap_jacobson (L48-L54)\ntheorem le_comap_jacobson : jacobson R M \u2264 comap f (jacobson R\u2082 M\u2082) := by\nconv_rhs => rw [jacobson, sInf_eq_iInf', comap_iInf]\n refine le_iInf_iff.mpr fun S m hm \u21a6 ?_\n obtain h | h := isCoatom_comap_or_eq_top f S.2\n \u00b7 exact mem_sInf.mp hm _ h\n \u00b7 simpa only [h] using mem_top\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_le (L55-L57)\ntheorem map_jacobson_le : map f (jacobson R M) \u2264 jacobson R\u2082 M\u2082 :=\nmap_le_iff_le_comap.mpr (le_comap_jacobson f)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_eq_bot_of_injective (L58-L64)\ntheorem jacobson_eq_bot_of_injective (inj : Function.Injective f) (h : jacobson R\u2082 M\u2082 = \u22a5) :\n jacobson R M = \u22a5 :=\nle_bot_iff.mp <| (le_comap_jacobson f).trans <| by\n simp_rw [h, comap_bot, (LinearMap.ker_eq_bot.mpr inj).le]\n\nvariable {f}\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_ker_le (L65-L72)\ntheorem map_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nle_antisymm (map_jacobson_le f) <| by\n rw [jacobson, sInf_eq_iInf'] at le\n conv_rhs => rw [jacobson, sInf_eq_iInf', map_iInf_of_ker_le surj le]\n exact le_iInf fun m \u21a6 sInf_le (isCoatom_map_of_ker_le surj (le_iInf_iff.mp le m) m.2)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_ker_le (L73-L77)\ntheorem comap_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M := by\nrw [\u2190 map_jacobson_of_ker_le surj le, comap_map_eq_self le]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_bijective (L78-L81)\ntheorem map_jacobson_of_bijective (hf : Function.Bijective f) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nmap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_bijective (L82-L85)\ntheorem comap_jacobson_of_bijective (hf : Function.Bijective f) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M :=\ncomap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_of_le (L86-L89)\ntheorem jacobson_quotient_of_le {N : Submodule R M} (le : N \u2264 jacobson R M) :\n jacobson R (M \u29f8 N) = map N.mkQ (jacobson R M) :=\n(map_jacobson_of_ker_le N.mkQ_surjective <| by rwa [ker_mkQ]).symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_le_of_eq_bot (L90-L95)\ntheorem jacobson_le_of_eq_bot {N : Submodule R M} (h : jacobson R (M \u29f8 N) = \u22a5) :\n jacobson R M \u2264 N := by\nsimp_rw [\u2190 N.ker_mkQ, \u2190 comap_bot, \u2190 h, le_comap_jacobson]\n\nvariable (R M)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_jacobson (L97-L99)\ntheorem jacobson_quotient_jacobson : jacobson R (M \u29f8 jacobson R M) = \u22a5 := by\nrw [jacobson_quotient_of_le le_rfl, mkQ_map_self]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_lt_top (L100-L103)\ntheorem jacobson_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] : jacobson R M < \u22a4 := by\nobtain \u27e8m, hm, -\u27e9 := (eq_top_or_exists_le_coatom (\u22a5 : Submodule R M)).resolve_left bot_ne_top\n exact (sInf_le <| Set.mem_setOf.mpr hm).trans_lt hm.1.lt_top\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_le (L108-L114)\ntheorem jacobson_pi_le : jacobson R (\u03a0 i, M i) \u2264 Submodule.pi Set.univ (jacobson R <| M \u00b7) := by\nsimp_rw [\u2190 iInf_comap_proj, jacobson, sInf_eq_iInf', comap_iInf, le_iInf_iff]\n intro i m\n exact iInf_le_of_le \u27e8_, (isCoatom_comap_iff <| LinearMap.proj_surjective i).mpr m.2\u27e9 le_rfl\n\n/-- A product of modules with trivial Jacobson radical (e.g. simple modules) also has trivial\nJacobson radical. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_eq_bot (L115-L119)\ntheorem jacobson_pi_eq_bot (h : \u2200 i, jacobson R (M i) = \u22a5) : jacobson R (\u03a0 i, M i) = \u22a5 :=\nle_bot_iff.mp <| (jacobson_pi_le R M).trans <| by simp_rw [h, pi_univ_bot, le_rfl]\n\nend Module\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson (L129-L130)\nabbrev jacobson : Ideal R := Module.jacobson R R\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson (L65-L67)\ndef jacobson (I : Ideal R) : Ideal R :=\nsInf { J : Ideal R | I \u2264 J \u2227 IsMaximal J }\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_bijective (L196-L200)\ntheorem map_jacobson_of_bijective {f : R \u2192+* S} (hf : Function.Bijective f) :\n map f I.jacobson = (map f I).jacobson :=\nmap_jacobson_of_surjective hf.right\n (le_trans (le_of_eq ((RingHom.injective_iff_ker_eq_bot f).1 hf.left)) bot_le)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_top_iff (L82-L89)\ntheorem jacobson_eq_top_iff : jacobson I = \u22a4 \u2194 I = \u22a4 :=\n\u27e8fun H =>\n by_contradiction fun hi => let \u27e8M, hm, him\u27e9 := exists_le_maximal I hi\n lt_top_iff_ne_top.1\n (lt_of_le_of_lt (show jacobson I \u2264 M from sInf_le \u27e8him, hm\u27e9) <|\n lt_top_iff_ne_top.2 hm.ne_top) H,\n fun H => eq_top_iff.2 <| le_sInf fun _ \u27e8hij, _\u27e9 => H \u25b8 hij\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_idem (L71-L73)\ntheorem jacobson_idem : jacobson (jacobson I) = jacobson I :=\nle_antisymm (sInf_le_sInf fun _ hJ => \u27e8sInf_le hJ, hJ.2\u27e9) le_jacobson\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_bot (L90-L91)\ntheorem jacobson_eq_bot : jacobson I = \u22a5 \u2192 I = \u22a5 := fun h => eq_bot_iff.mpr (h \u25b8 le_jacobson)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.radical_le_jacobson (L273-L275)\ntheorem radical_le_jacobson : radical I \u2264 jacobson I :=\nle_sInf fun _ hJ => (radical_eq_sInf I).symm \u25b8 sInf_le \u27e8hJ.left, IsMaximal.isPrime hJ.right\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_surjective (L177-L195)\ntheorem map_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) :\n RingHom.ker f \u2264 I \u2192 map f I.jacobson = (map f I).jacobson := by\nintro h\n unfold Ideal.jacobson\n -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11036): dot notation for `RingHom.ker` does not work\n have : \u2200 J \u2208 { J : Ideal R | I \u2264 J \u2227 J.IsMaximal }, RingHom.ker f \u2264 J :=\n fun J hJ => le_trans h hJ.left\n refine Trans.trans (map_sInf hf this) (le_antisymm ?_ ?_)\n \u00b7 refine\n sInf_le_sInf fun J hJ =>\n \u27e8comap f J, \u27e8\u27e8le_comap_of_map_le hJ.1, ?_\u27e9, map_comap_of_surjective f hf J\u27e9\u27e9\n haveI : J.IsMaximal := hJ.right\n exact comap_isMaximal_of_surjective f hf\n \u00b7 refine sInf_le_sInf_of_subset_insert_top fun j hj => hj.recOn fun J hJ => ?_\n rw [\u2190 hJ.2]\n rcases map_eq_top_or_isMaximal_of_surjective f hf hJ.left.right with htop | hmax\n \u00b7 exact htop.symm \u25b8 Set.mem_insert \u22a4 _\n \u00b7 exact Set.mem_insert_of_mem \u22a4 \u27e8map_mono hJ.1.1, hmax\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_add_sub_mem_of_mem_jacobson (L121-L127)\ntheorem exists_mul_add_sub_mem_of_mem_jacobson {I : Ideal R} (r : R) (h : r \u2208 jacobson I) :\n \u2203 s, s * (r + 1) - 1 \u2208 I := by\nobtain \u27e8s, hs\u27e9 := mem_jacobson_iff.1 h 1\n use s\n rw [mul_add, mul_one]\n simpa using hs\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal' (L146-L163)\ntheorem eq_jacobson_iff_sInf_maximal' :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, \u2200 (K : Ideal R), J < K \u2192 K = \u22a4) \u2227 I = sInf M :=\neq_jacobson_iff_sInf_maximal.trans\n \u27e8fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ K hK =>\n Or.recOn (hM.1 J hJ) (fun h => h.1.2 K hK) fun h => eq_top_iff.2 (le_of_lt (h \u25b8 hK)),\n hM.2\u27e9\u27e9,\n fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ =>\n Or.recOn (Classical.em (J = \u22a4)) (fun h => Or.inr h) fun h => Or.inl \u27e8\u27e8h, hM.1 J hJ\u27e9\u27e9,\n hM.2\u27e9\u27e9\u27e9\n\n/-- An ideal `I` equals its Jacobson radical if and only if every element outside `I`\nalso lies outside of a maximal ideal containing `I`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_jacobson (L279-L281)\nlemma isRadical_jacobson (I : Ideal R) : I.jacobson.IsRadical :=\nisRadical_of_eq_jacobson jacobson_idem\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isUnit_of_sub_one_mem_jacobson_bot (L282-L287)\ntheorem isUnit_of_sub_one_mem_jacobson_bot (r : R) (h : r - 1 \u2208 jacobson (\u22a5 : Ideal R)) :\n IsUnit r := by\nobtain \u27e8s, hs\u27e9 := exists_mul_sub_mem_of_sub_one_mem_jacobson r h\n rw [mem_bot, sub_eq_zero, mul_comm] at hs\n exact .of_mul_eq_one _ hs\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.mem_jacobson_iff (L99-L120)\ntheorem mem_jacobson_iff {x : R} : x \u2208 jacobson I \u2194 \u2200 y, \u2203 z, z * y * x + z - 1 \u2208 I :=\n\u27e8fun hx y =>\n by_cases\n (fun hxy : I \u2294 span {y * x + 1} = \u22a4 =>\n let \u27e8p, hpi, q, hq, hpq\u27e9 := Submodule.mem_sup.1 ((eq_top_iff_one _).1 hxy)\n let \u27e8r, hr\u27e9 := mem_span_singleton'.1 hq\n \u27e8r, by\n rw [mul_assoc, \u2190 mul_add_one, hr, \u2190 hpq, \u2190 neg_sub, add_sub_cancel_right]\n exact I.neg_mem hpi\u27e9)\n fun hxy : I \u2294 span {y * x + 1} \u2260 \u22a4 => let \u27e8M, hm1, hm2\u27e9 := exists_le_maximal _ hxy\n suffices x \u2209 M from (this <| mem_sInf.1 hx \u27e8le_trans le_sup_left hm2, hm1\u27e9).elim\n fun hxm => hm1.1.1 <| (eq_top_iff_one _).2 <| add_sub_cancel_left (y * x) 1 \u25b8\n M.sub_mem (le_sup_right.trans hm2 <| subset_span rfl) (M.mul_mem_left _ hxm),\n fun hx => mem_sInf.2 fun M \u27e8him, hm\u27e9 => by_contradiction fun hxm =>\n let \u27e8y, i, hi, df\u27e9 := hm.exists_inv hxm\n let \u27e8z, hz\u27e9 := hx (-y)\n hm.1.1 <| (eq_top_iff_one _).2 <| sub_sub_cancel (z * -y * x + z) 1 \u25b8\n M.sub_mem (by\n rw [mul_assoc, \u2190 mul_add_one, neg_mul, \u2190 sub_eq_iff_eq_add.mpr df.symm, neg_sub,\n sub_add_cancel]\n exact M.mul_mem_left _ hi) <| him hz\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson_of_surjective (L205-L223)\ntheorem comap_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) {K : Ideal S} :\n comap f K.jacobson = (comap f K).jacobson := by\nunfold Ideal.jacobson\n refine le_antisymm ?_ ?_\n \u00b7 rw [\u2190 top_inf_eq (sInf _), \u2190 sInf_insert, comap_sInf', sInf_eq_iInf]\n refine iInf_le_iInf_of_subset fun J hJ => ?_\n have : comap f (map f J) = J :=\n Trans.trans (comap_map_of_surjective f hf J)\n (le_antisymm (sup_le_iff.2 \u27e8le_of_eq rfl, le_trans (comap_mono bot_le) hJ.left\u27e9)\n le_sup_left)\n rcases map_eq_top_or_isMaximal_of_surjective _ hf hJ.right with htop | hmax\n \u00b7 exact \u27e8\u22a4, Set.mem_insert \u22a4 _, htop \u25b8 this\u27e9\n \u00b7 exact \u27e8map f J, Set.mem_insert_of_mem _ \u27e8le_map_of_comap_le_of_surjective f hf hJ.1, hmax\u27e9,\n this\u27e9\n \u00b7 simp_rw [comap_sInf, le_iInf_iff]\n intro J hJ\n haveI : J.IsMaximal := hJ.right\n exact sInf_le \u27e8comap_mono hJ.left, comap_isMaximal_of_surjective _ hf\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Jacobson.Artinian.Module (L25-L34)\nlemma Module.finite_of_isSemisimpleRing [IsJacobsonRing R] [IsSemisimpleRing A] :\n Module.Finite R A :=\nhave (I : MaximalSpectrum A) := finite_of_finite_type_of_isJacobsonRing R (A \u29f8 I.asIdeal)\n .equiv ((IsArtinianRing.equivPi A).restrictScalars R).toLinearEquiv.symm\n\n/-- If `A` is a finite type algebra over `R`, then `A` is an Artinian ring and `R` is Jacobson\nimplies `A` is finite over `R`. -/\n/- If made an instance, causes timeouts synthesizing `FaithfulSMul R I.ResidueField` at\n`Ideal.algebraMap_residueField_eq_zero` and `Ideal.ker_algebraMap_residueField` during\nsimpNF linting. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_bot (L78-L80)\ntheorem jacobson_bot : jacobson (\u22a5 : Ideal R) = Ring.jacobson R := by\nsimp_rw [jacobson, Ring.jacobson, Module.jacobson, bot_le, true_and, isMaximal_def]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_self_of_isMaximal (L92-L94)\ntheorem jacobson_eq_self_of_isMaximal [H : IsMaximal I] : I.jacobson = I :=\nle_antisymm (sInf_le \u27e8le_of_eq rfl, H\u27e9) le_jacobson\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_mono (L225-L229)\ntheorem jacobson_mono {I J : Ideal R} : I \u2264 J \u2192 I.jacobson \u2264 J.jacobson := by\nintro h x hx\n rw [jacobson, mem_sInf] at hx \u22a2\n exact fun K \u27e8hK, hK_max\u27e9 => hx \u27e8Trans.trans h hK, hK_max\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal (L135-L145)\ntheorem eq_jacobson_iff_sInf_maximal :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, IsMaximal J \u2228 J = \u22a4) \u2227 I = sInf M := by\nuse fun hI => \u27e8{ J : Ideal R | I \u2264 J \u2227 J.IsMaximal }, \u27e8fun _ hJ => Or.inl hJ.right, hI.symm\u27e9\u27e9\n rintro \u27e8M, hM, hInf\u27e9\n refine le_antisymm (fun x hx => ?_) le_jacobson\n rw [hInf, mem_sInf]\n intro I hI\n rcases hM I hI with is_max | is_top\n \u00b7 exact (mem_sInf.1 hx) \u27e8le_sInf_iff.1 (le_of_eq hInf) I hI, is_max\u27e9\n \u00b7 exact is_top.symm \u25b8 Submodule.mem_top\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.le_jacobson (L68-L69)\ntheorem le_jacobson : I \u2264 jacobson I := fun _ hx => mem_sInf.mpr fun _ hJ => hJ.left hx\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_of_eq_jacobson (L276-L278)\ntheorem isRadical_of_eq_jacobson (h : jacobson I = I) : I.IsRadical :=\nradical_le_jacobson.trans h.le\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_top (L75-L77)\ntheorem jacobson_top : jacobson (\u22a4 : Ideal R) = \u22a4 :=\neq_top_iff.2 le_jacobson\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson (L201-L204)\ntheorem comap_jacobson {f : R \u2192+* S} {K : Ideal S} :\n comap f K.jacobson = sInf (comap f '' { J : Ideal S | K \u2264 J \u2227 J.IsMaximal }) :=\nTrans.trans (comap_sInf' f _) sInf_eq_iInf.symm\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_notMem (L164-L176)\ntheorem eq_jacobson_iff_notMem :\n I.jacobson = I \u2194 \u2200 x \u2209 I, \u2203 M : Ideal R, (I \u2264 M \u2227 M.IsMaximal) \u2227 x \u2209 M := by\nconstructor\n \u00b7 intro h x hx\n rw [\u2190 h, Ideal.jacobson, mem_sInf] at hx\n push Not at hx\n exact hx\n \u00b7 refine fun h => le_antisymm (fun x hx => ?_) le_jacobson\n contrapose hx\n rw [Ideal.jacobson, mem_sInf]\n push Not\n exact h x hx\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_sub_mem_of_sub_one_mem_jacobson (L128-L134)\ntheorem exists_mul_sub_mem_of_sub_one_mem_jacobson {I : Ideal R} (r : R) (h : r - 1 \u2208 jacobson I) :\n \u2203 s, s * r - 1 \u2208 I := by\nconvert exists_mul_add_sub_mem_of_mem_jacobson _ h\n simp\n\n/-- An ideal equals its Jacobson radical iff it is the intersection of a set of maximal ideals.\nAllowing the set to include \u22a4 is equivalent, and is included only to simplify some proofs. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.ringJacobson_le_jacobson (L230-L233)\ntheorem ringJacobson_le_jacobson {I : Ideal R} : Ring.jacobson R \u2264 I.jacobson :=\njacobson_bot.symm.trans_le (jacobson_mono bot_le)\n\n/-- The Jacobson radical of a two-sided ideal is two-sided. -/\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.RingTheory.Jacobson.Radical).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem jacobson_smul_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] (N : Submodule R M) :\n Ring.jacobson R \u2022 N < \u22a4\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson (L43-L47)\ndef jacobson : Submodule R M :=\nsInf { m : Submodule R M | IsCoatom m }\n\nvariable {R R\u2082 M M\u2082}\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.le_comap_jacobson (L48-L54)\ntheorem le_comap_jacobson : jacobson R M \u2264 comap f (jacobson R\u2082 M\u2082) := by\nconv_rhs => rw [jacobson, sInf_eq_iInf', comap_iInf]\n refine le_iInf_iff.mpr fun S m hm \u21a6 ?_\n obtain h | h := isCoatom_comap_or_eq_top f S.2\n \u00b7 exact mem_sInf.mp hm _ h\n \u00b7 simpa only [h] using mem_top\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_le (L55-L57)\ntheorem map_jacobson_le : map f (jacobson R M) \u2264 jacobson R\u2082 M\u2082 :=\nmap_le_iff_le_comap.mpr (le_comap_jacobson f)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_eq_bot_of_injective (L58-L64)\ntheorem jacobson_eq_bot_of_injective (inj : Function.Injective f) (h : jacobson R\u2082 M\u2082 = \u22a5) :\n jacobson R M = \u22a5 :=\nle_bot_iff.mp <| (le_comap_jacobson f).trans <| by\n simp_rw [h, comap_bot, (LinearMap.ker_eq_bot.mpr inj).le]\n\nvariable {f}\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_ker_le (L65-L72)\ntheorem map_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nle_antisymm (map_jacobson_le f) <| by\n rw [jacobson, sInf_eq_iInf'] at le\n conv_rhs => rw [jacobson, sInf_eq_iInf', map_iInf_of_ker_le surj le]\n exact le_iInf fun m \u21a6 sInf_le (isCoatom_map_of_ker_le surj (le_iInf_iff.mp le m) m.2)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_ker_le (L73-L77)\ntheorem comap_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M := by\nrw [\u2190 map_jacobson_of_ker_le surj le, comap_map_eq_self le]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_bijective (L78-L81)\ntheorem map_jacobson_of_bijective (hf : Function.Bijective f) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nmap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_bijective (L82-L85)\ntheorem comap_jacobson_of_bijective (hf : Function.Bijective f) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M :=\ncomap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_of_le (L86-L89)\ntheorem jacobson_quotient_of_le {N : Submodule R M} (le : N \u2264 jacobson R M) :\n jacobson R (M \u29f8 N) = map N.mkQ (jacobson R M) :=\n(map_jacobson_of_ker_le N.mkQ_surjective <| by rwa [ker_mkQ]).symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_le_of_eq_bot (L90-L95)\ntheorem jacobson_le_of_eq_bot {N : Submodule R M} (h : jacobson R (M \u29f8 N) = \u22a5) :\n jacobson R M \u2264 N := by\nsimp_rw [\u2190 N.ker_mkQ, \u2190 comap_bot, \u2190 h, le_comap_jacobson]\n\nvariable (R M)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_jacobson (L97-L99)\ntheorem jacobson_quotient_jacobson : jacobson R (M \u29f8 jacobson R M) = \u22a5 := by\nrw [jacobson_quotient_of_le le_rfl, mkQ_map_self]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_lt_top (L100-L103)\ntheorem jacobson_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] : jacobson R M < \u22a4 := by\nobtain \u27e8m, hm, -\u27e9 := (eq_top_or_exists_le_coatom (\u22a5 : Submodule R M)).resolve_left bot_ne_top\n exact (sInf_le <| Set.mem_setOf.mpr hm).trans_lt hm.1.lt_top\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_le (L108-L114)\ntheorem jacobson_pi_le : jacobson R (\u03a0 i, M i) \u2264 Submodule.pi Set.univ (jacobson R <| M \u00b7) := by\nsimp_rw [\u2190 iInf_comap_proj, jacobson, sInf_eq_iInf', comap_iInf, le_iInf_iff]\n intro i m\n exact iInf_le_of_le \u27e8_, (isCoatom_comap_iff <| LinearMap.proj_surjective i).mpr m.2\u27e9 le_rfl\n\n/-- A product of modules with trivial Jacobson radical (e.g. simple modules) also has trivial\nJacobson radical. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_eq_bot (L115-L119)\ntheorem jacobson_pi_eq_bot (h : \u2200 i, jacobson R (M i) = \u22a5) : jacobson R (\u03a0 i, M i) = \u22a5 :=\nle_bot_iff.mp <| (jacobson_pi_le R M).trans <| by simp_rw [h, pi_univ_bot, le_rfl]\n\nend Module\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson (L129-L130)\nabbrev jacobson : Ideal R := Module.jacobson R R\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson (L65-L67)\ndef jacobson (I : Ideal R) : Ideal R :=\nsInf { J : Ideal R | I \u2264 J \u2227 IsMaximal J }\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_bijective (L196-L200)\ntheorem map_jacobson_of_bijective {f : R \u2192+* S} (hf : Function.Bijective f) :\n map f I.jacobson = (map f I).jacobson :=\nmap_jacobson_of_surjective hf.right\n (le_trans (le_of_eq ((RingHom.injective_iff_ker_eq_bot f).1 hf.left)) bot_le)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_top_iff (L82-L89)\ntheorem jacobson_eq_top_iff : jacobson I = \u22a4 \u2194 I = \u22a4 :=\n\u27e8fun H =>\n by_contradiction fun hi => let \u27e8M, hm, him\u27e9 := exists_le_maximal I hi\n lt_top_iff_ne_top.1\n (lt_of_le_of_lt (show jacobson I \u2264 M from sInf_le \u27e8him, hm\u27e9) <|\n lt_top_iff_ne_top.2 hm.ne_top) H,\n fun H => eq_top_iff.2 <| le_sInf fun _ \u27e8hij, _\u27e9 => H \u25b8 hij\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_idem (L71-L73)\ntheorem jacobson_idem : jacobson (jacobson I) = jacobson I :=\nle_antisymm (sInf_le_sInf fun _ hJ => \u27e8sInf_le hJ, hJ.2\u27e9) le_jacobson\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_bot (L90-L91)\ntheorem jacobson_eq_bot : jacobson I = \u22a5 \u2192 I = \u22a5 := fun h => eq_bot_iff.mpr (h \u25b8 le_jacobson)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.radical_le_jacobson (L273-L275)\ntheorem radical_le_jacobson : radical I \u2264 jacobson I :=\nle_sInf fun _ hJ => (radical_eq_sInf I).symm \u25b8 sInf_le \u27e8hJ.left, IsMaximal.isPrime hJ.right\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_surjective (L177-L195)\ntheorem map_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) :\n RingHom.ker f \u2264 I \u2192 map f I.jacobson = (map f I).jacobson := by\nintro h\n unfold Ideal.jacobson\n -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11036): dot notation for `RingHom.ker` does not work\n have : \u2200 J \u2208 { J : Ideal R | I \u2264 J \u2227 J.IsMaximal }, RingHom.ker f \u2264 J :=\n fun J hJ => le_trans h hJ.left\n refine Trans.trans (map_sInf hf this) (le_antisymm ?_ ?_)\n \u00b7 refine\n sInf_le_sInf fun J hJ =>\n \u27e8comap f J, \u27e8\u27e8le_comap_of_map_le hJ.1, ?_\u27e9, map_comap_of_surjective f hf J\u27e9\u27e9\n haveI : J.IsMaximal := hJ.right\n exact comap_isMaximal_of_surjective f hf\n \u00b7 refine sInf_le_sInf_of_subset_insert_top fun j hj => hj.recOn fun J hJ => ?_\n rw [\u2190 hJ.2]\n rcases map_eq_top_or_isMaximal_of_surjective f hf hJ.left.right with htop | hmax\n \u00b7 exact htop.symm \u25b8 Set.mem_insert \u22a4 _\n \u00b7 exact Set.mem_insert_of_mem \u22a4 \u27e8map_mono hJ.1.1, hmax\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_add_sub_mem_of_mem_jacobson (L121-L127)\ntheorem exists_mul_add_sub_mem_of_mem_jacobson {I : Ideal R} (r : R) (h : r \u2208 jacobson I) :\n \u2203 s, s * (r + 1) - 1 \u2208 I := by\nobtain \u27e8s, hs\u27e9 := mem_jacobson_iff.1 h 1\n use s\n rw [mul_add, mul_one]\n simpa using hs\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal' (L146-L163)\ntheorem eq_jacobson_iff_sInf_maximal' :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, \u2200 (K : Ideal R), J < K \u2192 K = \u22a4) \u2227 I = sInf M :=\neq_jacobson_iff_sInf_maximal.trans\n \u27e8fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ K hK =>\n Or.recOn (hM.1 J hJ) (fun h => h.1.2 K hK) fun h => eq_top_iff.2 (le_of_lt (h \u25b8 hK)),\n hM.2\u27e9\u27e9,\n fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ =>\n Or.recOn (Classical.em (J = \u22a4)) (fun h => Or.inr h) fun h => Or.inl \u27e8\u27e8h, hM.1 J hJ\u27e9\u27e9,\n hM.2\u27e9\u27e9\u27e9\n\n/-- An ideal `I` equals its Jacobson radical if and only if every element outside `I`\nalso lies outside of a maximal ideal containing `I`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_jacobson (L279-L281)\nlemma isRadical_jacobson (I : Ideal R) : I.jacobson.IsRadical :=\nisRadical_of_eq_jacobson jacobson_idem\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isUnit_of_sub_one_mem_jacobson_bot (L282-L287)\ntheorem isUnit_of_sub_one_mem_jacobson_bot (r : R) (h : r - 1 \u2208 jacobson (\u22a5 : Ideal R)) :\n IsUnit r := by\nobtain \u27e8s, hs\u27e9 := exists_mul_sub_mem_of_sub_one_mem_jacobson r h\n rw [mem_bot, sub_eq_zero, mul_comm] at hs\n exact .of_mul_eq_one _ hs\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.mem_jacobson_iff (L99-L120)\ntheorem mem_jacobson_iff {x : R} : x \u2208 jacobson I \u2194 \u2200 y, \u2203 z, z * y * x + z - 1 \u2208 I :=\n\u27e8fun hx y =>\n by_cases\n (fun hxy : I \u2294 span {y * x + 1} = \u22a4 =>\n let \u27e8p, hpi, q, hq, hpq\u27e9 := Submodule.mem_sup.1 ((eq_top_iff_one _).1 hxy)\n let \u27e8r, hr\u27e9 := mem_span_singleton'.1 hq\n \u27e8r, by\n rw [mul_assoc, \u2190 mul_add_one, hr, \u2190 hpq, \u2190 neg_sub, add_sub_cancel_right]\n exact I.neg_mem hpi\u27e9)\n fun hxy : I \u2294 span {y * x + 1} \u2260 \u22a4 => let \u27e8M, hm1, hm2\u27e9 := exists_le_maximal _ hxy\n suffices x \u2209 M from (this <| mem_sInf.1 hx \u27e8le_trans le_sup_left hm2, hm1\u27e9).elim\n fun hxm => hm1.1.1 <| (eq_top_iff_one _).2 <| add_sub_cancel_left (y * x) 1 \u25b8\n M.sub_mem (le_sup_right.trans hm2 <| subset_span rfl) (M.mul_mem_left _ hxm),\n fun hx => mem_sInf.2 fun M \u27e8him, hm\u27e9 => by_contradiction fun hxm =>\n let \u27e8y, i, hi, df\u27e9 := hm.exists_inv hxm\n let \u27e8z, hz\u27e9 := hx (-y)\n hm.1.1 <| (eq_top_iff_one _).2 <| sub_sub_cancel (z * -y * x + z) 1 \u25b8\n M.sub_mem (by\n rw [mul_assoc, \u2190 mul_add_one, neg_mul, \u2190 sub_eq_iff_eq_add.mpr df.symm, neg_sub,\n sub_add_cancel]\n exact M.mul_mem_left _ hi) <| him hz\u27e9\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson_of_surjective (L205-L223)\ntheorem comap_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) {K : Ideal S} :\n comap f K.jacobson = (comap f K).jacobson := by\nunfold Ideal.jacobson\n refine le_antisymm ?_ ?_\n \u00b7 rw [\u2190 top_inf_eq (sInf _), \u2190 sInf_insert, comap_sInf', sInf_eq_iInf]\n refine iInf_le_iInf_of_subset fun J hJ => ?_\n have : comap f (map f J) = J :=\n Trans.trans (comap_map_of_surjective f hf J)\n (le_antisymm (sup_le_iff.2 \u27e8le_of_eq rfl, le_trans (comap_mono bot_le) hJ.left\u27e9)\n le_sup_left)\n rcases map_eq_top_or_isMaximal_of_surjective _ hf hJ.right with htop | hmax\n \u00b7 exact \u27e8\u22a4, Set.mem_insert \u22a4 _, htop \u25b8 this\u27e9\n \u00b7 exact \u27e8map f J, Set.mem_insert_of_mem _ \u27e8le_map_of_comap_le_of_surjective f hf hJ.1, hmax\u27e9,\n this\u27e9\n \u00b7 simp_rw [comap_sInf, le_iInf_iff]\n intro J hJ\n haveI : J.IsMaximal := hJ.right\n exact sInf_le \u27e8comap_mono hJ.left, comap_isMaximal_of_surjective _ hf\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Jacobson.Artinian.Module (L25-L34)\nlemma Module.finite_of_isSemisimpleRing [IsJacobsonRing R] [IsSemisimpleRing A] :\n Module.Finite R A :=\nhave (I : MaximalSpectrum A) := finite_of_finite_type_of_isJacobsonRing R (A \u29f8 I.asIdeal)\n .equiv ((IsArtinianRing.equivPi A).restrictScalars R).toLinearEquiv.symm\n\n/-- If `A` is a finite type algebra over `R`, then `A` is an Artinian ring and `R` is Jacobson\nimplies `A` is finite over `R`. -/\n/- If made an instance, causes timeouts synthesizing `FaithfulSMul R I.ResidueField` at\n`Ideal.algebraMap_residueField_eq_zero` and `Ideal.ker_algebraMap_residueField` during\nsimpNF linting. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_bot (L78-L80)\ntheorem jacobson_bot : jacobson (\u22a5 : Ideal R) = Ring.jacobson R := by\nsimp_rw [jacobson, Ring.jacobson, Module.jacobson, bot_le, true_and, isMaximal_def]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_self_of_isMaximal (L92-L94)\ntheorem jacobson_eq_self_of_isMaximal [H : IsMaximal I] : I.jacobson = I :=\nle_antisymm (sInf_le \u27e8le_of_eq rfl, H\u27e9) le_jacobson\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_mono (L225-L229)\ntheorem jacobson_mono {I J : Ideal R} : I \u2264 J \u2192 I.jacobson \u2264 J.jacobson := by\nintro h x hx\n rw [jacobson, mem_sInf] at hx \u22a2\n exact fun K \u27e8hK, hK_max\u27e9 => hx \u27e8Trans.trans h hK, hK_max\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal (L135-L145)\ntheorem eq_jacobson_iff_sInf_maximal :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, IsMaximal J \u2228 J = \u22a4) \u2227 I = sInf M := by\nuse fun hI => \u27e8{ J : Ideal R | I \u2264 J \u2227 J.IsMaximal }, \u27e8fun _ hJ => Or.inl hJ.right, hI.symm\u27e9\u27e9\n rintro \u27e8M, hM, hInf\u27e9\n refine le_antisymm (fun x hx => ?_) le_jacobson\n rw [hInf, mem_sInf]\n intro I hI\n rcases hM I hI with is_max | is_top\n \u00b7 exact (mem_sInf.1 hx) \u27e8le_sInf_iff.1 (le_of_eq hInf) I hI, is_max\u27e9\n \u00b7 exact is_top.symm \u25b8 Submodule.mem_top\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.le_jacobson (L68-L69)\ntheorem le_jacobson : I \u2264 jacobson I := fun _ hx => mem_sInf.mpr fun _ hJ => hJ.left hx\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_of_eq_jacobson (L276-L278)\ntheorem isRadical_of_eq_jacobson (h : jacobson I = I) : I.IsRadical :=\nradical_le_jacobson.trans h.le\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_top (L75-L77)\ntheorem jacobson_top : jacobson (\u22a4 : Ideal R) = \u22a4 :=\neq_top_iff.2 le_jacobson\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson (L201-L204)\ntheorem comap_jacobson {f : R \u2192+* S} {K : Ideal S} :\n comap f K.jacobson = sInf (comap f '' { J : Ideal S | K \u2264 J \u2227 J.IsMaximal }) :=\nTrans.trans (comap_sInf' f _) sInf_eq_iInf.symm\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_notMem (L164-L176)\ntheorem eq_jacobson_iff_notMem :\n I.jacobson = I \u2194 \u2200 x \u2209 I, \u2203 M : Ideal R, (I \u2264 M \u2227 M.IsMaximal) \u2227 x \u2209 M := by\nconstructor\n \u00b7 intro h x hx\n rw [\u2190 h, Ideal.jacobson, mem_sInf] at hx\n push Not at hx\n exact hx\n \u00b7 refine fun h => le_antisymm (fun x hx => ?_) le_jacobson\n contrapose hx\n rw [Ideal.jacobson, mem_sInf]\n push Not\n exact h x hx\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_sub_mem_of_sub_one_mem_jacobson (L128-L134)\ntheorem exists_mul_sub_mem_of_sub_one_mem_jacobson {I : Ideal R} (r : R) (h : r - 1 \u2208 jacobson I) :\n \u2203 s, s * r - 1 \u2208 I := by\nconvert exists_mul_add_sub_mem_of_mem_jacobson _ h\n simp\n\n/-- An ideal equals its Jacobson radical iff it is the intersection of a set of maximal ideals.\nAllowing the set to include \u22a4 is equivalent, and is included only to simplify some proofs. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.ringJacobson_le_jacobson (L230-L233)\ntheorem ringJacobson_le_jacobson {I : Ideal R} : Ring.jacobson R \u2264 I.jacobson :=\njacobson_bot.symm.trans_le (jacobson_mono bot_le)\n\n/-- The Jacobson radical of a two-sided ideal is two-sided. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Jacobson/Radical.lean", "module": "Mathlib.RingTheory.Jacobson.Radical", "declaration": "Mathlib.RingTheory.Jacobson.Radical.jacobson_smul_lt_top", "span": "L191-L195", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Jacobson/Radical.lean#L191"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6326, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 15860, "lean_code_chars": 14356, "natural_language_chars": 1504, "lean_code_ratio": 0.9052, "line_count": 433, "imports_count": 0, "declarations_count": 1645, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "646db0a0f08bd2cb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.DFinsupp.Defs.coe_zsmul", "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.Data.DFinsupp.Defs)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem coe_zsmul [\u2200 i, AddGroup (\u03b2 i)] (b : \u2124) (v : \u03a0\u2080 i, \u03b2 i) : \u21d1(b \u2022 v) = b \u2022 \u21d1v\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.DFinsupp.Defs.instDFunLike (L77-L82)\ninstance instDFunLike : DFunLike (\u03a0\u2080 i, \u03b2 i) \u03b9 \u03b2 :=\n\u27e8fun f => f.toFun, fun \u27e8f\u2081, s\u2081\u27e9 \u27e8f\u2082, s\u2081\u27e9 \u21a6 fun (h : f\u2081 = f\u2082) \u21a6 by\n subst h\n congr\n subsingleton \u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.DFinsupp.Defs.toFun_eq_coe (L84-L86)\ntheorem toFun_eq_coe (f : \u03a0\u2080 i, \u03b2 i) : f.toFun = f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.DFinsupp.Defs.ext (L88-L90)\ntheorem ext {f g : \u03a0\u2080 i, \u03b2 i} (h : \u2200 i, f i = g i) : f = g :=\nDFunLike.ext _ _ h\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.DFinsupp.Defs.ne_iff (L91-L92)\nlemma ne_iff {f g : \u03a0\u2080 i, \u03b2 i} : f \u2260 g \u2194 \u2203 i, f i \u2260 g i := DFunLike.ne_iff\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.DFinsupp.Defs.zero_apply (L103-L116)\ntheorem zero_apply (i : \u03b9) : (0 : \u03a0\u2080 i, \u03b2 i) i = 0 :=\nrfl\n\n/-- The composition of `f : \u03b2\u2081 \u2192 \u03b2\u2082` and `g : \u03a0\u2080 i, \u03b2\u2081 i` is\n `mapRange f hf g : \u03a0\u2080 i, \u03b2\u2082 i`, well defined when `f 0 = 0`.\n\nThis preserves the structure on `f`, and exists in various bundled forms for when `f` is itself\nbundled:\n\n* `DFinsupp.mapRange.addMonoidHom`\n* `DFinsupp.mapRange.addEquiv`\n* `dfinsupp.mapRange.linearMap`\n* `dfinsupp.mapRange.linearEquiv`\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange (L117-L121)\ndef mapRange (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (hf : \u2200 i, f i 0 = 0) (x : \u03a0\u2080 i, \u03b2\u2081 i) : \u03a0\u2080 i, \u03b2\u2082 i :=\n\u27e8fun i => f i (x i),\n x.support'.map fun s => \u27e8s.1, fun i => (s.2 i).imp_right fun h : x i = 0 => by\n rw [\u2190 hf i, \u2190 h]\u27e9\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_apply (L123-L126)\ntheorem mapRange_apply (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (hf : \u2200 i, f i 0 = 0) (g : \u03a0\u2080 i, \u03b2\u2081 i) (i : \u03b9) :\n mapRange f hf g i = f i (g i) :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_id (L128-L132)\ntheorem mapRange_id (h : \u2200 i, id (0 : \u03b2\u2081 i) = 0 := fun _ => rfl) (g : \u03a0\u2080 i : \u03b9, \u03b2\u2081 i) :\nmapRange (fun i => (id : \u03b2\u2081 i \u2192 \u03b2\u2081 i)) h g = g := by\n ext\n rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_comp (L133-L138)\ntheorem mapRange_comp (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (f\u2082 : \u2200 i, \u03b2 i \u2192 \u03b2\u2081 i) (hf : \u2200 i, f i 0 = 0)\n (hf\u2082 : \u2200 i, f\u2082 i 0 = 0) (h : \u2200 i, (f i \u2218 f\u2082 i) 0 = 0) (g : \u03a0\u2080 i : \u03b9, \u03b2 i) :\n mapRange (fun i => f i \u2218 f\u2082 i) h g = mapRange f hf (mapRange f\u2082 hf\u2082 g) := by\next\n simp only [mapRange_apply]; rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_zero (L140-L146)\ntheorem mapRange_zero (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (hf : \u2200 i, f i 0 = 0) :\n mapRange f hf (0 : \u03a0\u2080 i, \u03b2\u2081 i) = 0 := by\next\n simp only [mapRange_apply, coe_zero, Pi.zero_apply, hf]\n\n/-- Let `f i` be a binary operation `\u03b2\u2081 i \u2192 \u03b2\u2082 i \u2192 \u03b2 i` such that `f i 0 0 = 0`.\nThen `zipWith f hf` is a binary operation `\u03a0\u2080 i, \u03b2\u2081 i \u2192 \u03a0\u2080 i, \u03b2\u2082 i \u2192 \u03a0\u2080 i, \u03b2 i`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.DFinsupp.Defs.zipWith (L147-L158)\ndef zipWith (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i \u2192 \u03b2 i) (hf : \u2200 i, f i 0 0 = 0) (x : \u03a0\u2080 i, \u03b2\u2081 i) (y : \u03a0\u2080 i, \u03b2\u2082 i) :\n \u03a0\u2080 i, \u03b2 i :=\n\u27e8fun i => f i (x i) (y i), by\n refine x.support'.bind fun xs => ?_\n refine y.support'.map fun ys => ?_\n refine \u27e8xs + ys, fun i => ?_\u27e9\n obtain h1 | (h1 : x i = 0) := xs.prop i\n \u00b7 grind\n obtain h2 | (h2 : y i = 0) := ys.prop i\n \u00b7 grind\n grind\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.DFinsupp.Defs.zipWith_apply (L160-L169)\ntheorem zipWith_apply (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i \u2192 \u03b2 i) (hf : \u2200 i, f i 0 0 = 0) (g\u2081 : \u03a0\u2080 i, \u03b2\u2081 i)\n (g\u2082 : \u03a0\u2080 i, \u03b2\u2082 i) (i : \u03b9) : zipWith f hf g\u2081 g\u2082 i = f i (g\u2081 i) (g\u2082 i) :=\nrfl\n\nsection Piecewise\n\nvariable (x y : \u03a0\u2080 i, \u03b2 i) (s : Set \u03b9) [\u2200 i, Decidable (i \u2208 s)]\n\n/-- `x.piecewise y s` is the finitely supported function equal to `x` on the set `s`,\n and to `y` on its complement. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.DFinsupp.Defs.piecewise (L170-L172)\ndef piecewise : \u03a0\u2080 i, \u03b2 i :=\nzipWith (fun i x y => if i \u2208 s then x else y) (fun _ => ite_self 0) x y\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.DFinsupp.Defs.piecewise_apply (L173-L175)\ntheorem piecewise_apply (i : \u03b9) : x.piecewise y s i = if i \u2208 s then x i else y i :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.DFinsupp.Defs.coe_piecewise (L177-L185)\ntheorem coe_piecewise : \u21d1(x.piecewise y s) = s.piecewise x y :=\nrfl\n\nend Piecewise\n\nend Basic\n\nsection Algebra\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_comm (L127-L134)\ntheorem prod_comm {\u03b9\u2081 \u03b9\u2082 : Sort _} {\u03b2\u2081 : \u03b9\u2081 \u2192 Type*} {\u03b2\u2082 : \u03b9\u2082 \u2192 Type*} [DecidableEq \u03b9\u2081]\n [DecidableEq \u03b9\u2082] [\u2200 i, Zero (\u03b2\u2081 i)] [\u2200 i, Zero (\u03b2\u2082 i)] [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)]\n [\u2200 (i) (x : \u03b2\u2082 i), Decidable (x \u2260 0)] [CommMonoid \u03b3] (f\u2081 : \u03a0\u2080 i, \u03b2\u2081 i) (f\u2082 : \u03a0\u2080 i, \u03b2\u2082 i)\n (h : \u2200 i, \u03b2\u2081 i \u2192 \u2200 i, \u03b2\u2082 i \u2192 \u03b3) :\n (f\u2081.prod fun i\u2081 x\u2081 => f\u2082.prod fun i\u2082 x\u2082 => h i\u2081 x\u2081 i\u2082 x\u2082) =\n f\u2082.prod fun i\u2082 x\u2082 => f\u2081.prod fun i\u2081 x\u2081 => h i\u2081 x\u2081 i\u2082 x\u2082 :=\nFinset.prod_comm\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sum_apply (L136-L141)\ntheorem sum_apply {\u03b9} {\u03b2 : \u03b9 \u2192 Type v} {\u03b9\u2081 : Type u\u2081} [DecidableEq \u03b9\u2081] {\u03b2\u2081 : \u03b9\u2081 \u2192 Type v\u2081}\n [\u2200 i\u2081, Zero (\u03b2\u2081 i\u2081)] [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)] [\u2200 i, AddCommMonoid (\u03b2 i)]\n {f : \u03a0\u2080 i\u2081, \u03b2\u2081 i\u2081} {g : \u2200 i\u2081, \u03b2\u2081 i\u2081 \u2192 \u03a0\u2080 i, \u03b2 i} {i\u2082 : \u03b9} :\n (f.sum g) i\u2082 = f.sum fun i\u2081 b => g i\u2081 b i\u2082 :=\nmap_sum (evalAddMonoidHom i\u2082) _ f.support\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_one (L155-L158)\ntheorem prod_one [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {f : \u03a0\u2080 i, \u03b2 i} : (f.prod fun _ _ => (1 : \u03b3)) = 1 :=\nFinset.prod_const_one\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.coe_finset_sum (L61-L64)\ntheorem coe_finset_sum {\u03b1} [\u2200 i, AddCommMonoid (\u03b2 i)] (s : Finset \u03b1) (g : \u03b1 \u2192 \u03a0\u2080 i, \u03b2 i) :\n \u21d1(\u2211 a \u2208 s, g a) = \u2211 a \u2208 s, \u21d1(g a) :=\nmap_sum coeFnAddMonoidHom g s\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.evalAddMonoidHom (L57-L59)\ndef evalAddMonoidHom [\u2200 i, AddZeroClass (\u03b2 i)] (i : \u03b9) : (\u03a0\u2080 i, \u03b2 i) \u2192+ \u03b2 i :=\n(Pi.evalAddMonoidHom \u03b2 i).comp coeFnAddMonoidHom\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_mul (L160-L164)\ntheorem prod_mul [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {f : \u03a0\u2080 i, \u03b2 i} {h\u2081 h\u2082 : \u2200 i, \u03b2 i \u2192 \u03b3} :\n (f.prod fun i b => h\u2081 i b * h\u2082 i b) = f.prod h\u2081 * f.prod h\u2082 :=\nFinset.prod_mul_distrib\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumAddHom (L283-L306)\ndef sumAddHom [\u2200 i, AddZeroClass (\u03b2 i)] [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, \u03b2 i \u2192+ \u03b3) :\n (\u03a0\u2080 i, \u03b2 i) \u2192+ \u03b3 where\n __ := sumZeroHom fun i => \u03c6 i |>.toZeroHom\nmap_add' := by\n rintro \u27e8f, sf, hf\u27e9 \u27e8g, sg, hg\u27e9\n change (\u2211 i \u2208 _, _) = (\u2211 i \u2208 _, _) + \u2211 i \u2208 _, _\n simp only [AddMonoidHom.toZeroHom_coe, coe_add, coe_mk', Pi.add_apply, map_add,\n Finset.sum_add_distrib]\n congr 1\n \u00b7 refine (Finset.sum_subset ?_ ?_).symm\n \u00b7 intro i\n simp only [Multiset.mem_toFinset, Multiset.mem_add]\n exact Or.inl\n \u00b7 intro i _ H2\n simp only [Multiset.mem_toFinset] at H2\n rw [(hf i).resolve_left H2, map_zero]\n \u00b7 refine (Finset.sum_subset ?_ ?_).symm\n \u00b7 intro i\n simp only [Multiset.mem_toFinset, Multiset.mem_add]\n exact Or.inr\n \u00b7 intro i _ H2\n simp only [Multiset.mem_toFinset] at H2\n rw [(hg i).resolve_left H2, map_zero]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_eq_one (L172-L175)\ntheorem prod_eq_one [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {f : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (hyp : \u2200 i, h i (f i) = 1) : f.prod h = 1 :=\nFinset.prod_eq_one fun i _ => hyp i\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom (L223-L248)\ndef sumZeroHom [\u2200 i, Zero (\u03b2 i)] [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, ZeroHom (\u03b2 i) \u03b3) :\n ZeroHom (\u03a0\u2080 i, \u03b2 i) \u03b3 where\n toFun f :=\n(f.support'.lift fun s => \u2211 i \u2208 Multiset.toFinset s.1, \u03c6 i (f i)) <| by\n rintro \u27e8sx, hx\u27e9 \u27e8sy, hy\u27e9\n dsimp only [Subtype.coe_mk, toFun_eq_coe] at *\n have H1 : sx.toFinset \u2229 sy.toFinset \u2286 sx.toFinset := Finset.inter_subset_left\n have H2 : sx.toFinset \u2229 sy.toFinset \u2286 sy.toFinset := Finset.inter_subset_right\n refine\n (Finset.sum_subset H1 ?_).symm.trans\n ((Finset.sum_congr rfl ?_).trans (Finset.sum_subset H2 ?_))\n \u00b7 intro i H1 H2\n rw [Finset.mem_inter] at H2\n simp only [Multiset.mem_toFinset] at H1 H2\n convert map_zero (\u03c6 i)\n exact (hy i).resolve_left (mt (And.intro H1) H2)\n \u00b7 intro i _\n rfl\n \u00b7 intro i H1 H2\n rw [Finset.mem_inter] at H2\n simp only [Multiset.mem_toFinset] at H1 H2\n convert map_zero (\u03c6 i)\n exact (hx i).resolve_left (mt (fun H3 => And.intro H3 H1) H2)\n map_zero' := by\n simp only [toFun_eq_coe, coe_zero, Pi.zero_apply, map_zero, Finset.sum_const_zero]; rfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.finset_sum_apply (L66-L76)\ntheorem finset_sum_apply {\u03b1} [\u2200 i, AddCommMonoid (\u03b2 i)] (s : Finset \u03b1) (g : \u03b1 \u2192 \u03a0\u2080 i, \u03b2 i) (i : \u03b9) :\n (\u2211 a \u2208 s, g a) i = \u2211 a \u2208 s, g a i :=\nmap_sum (evalAddMonoidHom i) g s\n\nend Algebra\n\nsection ProdAndSum\n\nvariable [DecidableEq \u03b9]\n\n/-- `DFinsupp.prod f g` is the product of `g i (f i)` over the support of `f`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.support_sum (L142-L153)\ntheorem support_sum {\u03b9\u2081 : Type u\u2081} [DecidableEq \u03b9\u2081] {\u03b2\u2081 : \u03b9\u2081 \u2192 Type v\u2081} [\u2200 i\u2081, Zero (\u03b2\u2081 i\u2081)]\n [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)] [\u2200 i, AddCommMonoid (\u03b2 i)]\n [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] {f : \u03a0\u2080 i\u2081, \u03b2\u2081 i\u2081} {g : \u2200 i\u2081, \u03b2\u2081 i\u2081 \u2192 \u03a0\u2080 i, \u03b2 i} :\n (f.sum g).support \u2286 f.support.biUnion fun i => (g i (f i)).support := by\nhave :\n \u2200 i\u2081 : \u03b9,\n (f.sum fun (i : \u03b9\u2081) (b : \u03b2\u2081 i) => (g i b) i\u2081) \u2260 0 \u2192 \u2203 i : \u03b9\u2081, f i \u2260 0 \u2227 \u00ac(g i (f i)) i\u2081 = 0 :=\n fun i\u2081 h =>\n let \u27e8i, hi, Ne\u27e9 := Finset.exists_ne_zero_of_sum_ne_zero h\n \u27e8i, mem_support_iff.1 hi, Ne\u27e9\n simpa [Finset.subset_iff, mem_support_iff, Finset.mem_biUnion, sum_apply] using this\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom_single (L250-L254)\ntheorem sumZeroHom_single [\u2200 i, Zero (\u03b2 i)] [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, ZeroHom (\u03b2 i) \u03b3) (i)\n (x : \u03b2 i) : sumZeroHom \u03c6 (single i x) = \u03c6 i x := by\ndsimp [sumZeroHom, single, Trunc.lift_mk]\n rw [Multiset.toFinset_singleton, Finset.sum_singleton, Pi.single_eq_same]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_neg_index (L121-L125)\ntheorem prod_neg_index [\u2200 i, AddGroup (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {g : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (h0 : \u2200 i, h i 0 = 1) :\n (-g).prod h = g.prod fun i b => h i (-b) :=\nprod_mapRange_index h0\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom_apply (L266-L281)\ntheorem sumZeroHom_apply [\u2200 i, AddZeroClass (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, ZeroHom (\u03b2 i) \u03b3) (f : \u03a0\u2080 i, \u03b2 i) :\n sumZeroHom \u03c6 f = f.sum fun x => \u03c6 x := by\nrcases f with \u27e8f, s, hf\u27e9\n change (\u2211 i \u2208 _, _) = \u2211 i \u2208 _ with _, _\n rw [Finset.sum_filter, Finset.sum_congr rfl]\n intro i _\n dsimp only [coe_mk', Subtype.coe_mk] at *\n split_ifs with h\n \u00b7 rfl\n \u00b7 rw [not_not.mp h, map_zero]\n\n/--\nWhen summing over an `AddMonoidHom`, the decidability assumption is not needed, and the result is\nalso an `AddMonoidHom`.\n-/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_single_index (L112-L119)\ntheorem prod_single_index [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {i : \u03b9} {b : \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (h_zero : h i 0 = 1) : (single i b).prod h = h i b := by\nby_cases h : b \u2260 0\n \u00b7 simp [DFinsupp.prod, support_single_ne_zero h]\n \u00b7 rw [not_not] at h\n simp [h, h_zero]\n rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_mapRange_index (L90-L105)\ntheorem prod_mapRange_index {\u03b2\u2081 : \u03b9 \u2192 Type v\u2081} {\u03b2\u2082 : \u03b9 \u2192 Type v\u2082} [\u2200 i, Zero (\u03b2\u2081 i)]\n [\u2200 i, Zero (\u03b2\u2082 i)] [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)] [\u2200 (i) (x : \u03b2\u2082 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] {f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i} {hf : \u2200 i, f i 0 = 0} {g : \u03a0\u2080 i, \u03b2\u2081 i} {h : \u2200 i, \u03b2\u2082 i \u2192 \u03b3}\n (h0 : \u2200 i, h i 0 = 1) : (mapRange f hf g).prod h = g.prod fun i b => h i (f i b) := by\nrw [mapRange_def]\n refine (Finset.prod_subset support_mk_subset ?_).trans ?_\n \u00b7 intro i h1 h2\n simp only [mem_support_toFun, ne_eq] at h1\n simp only [Finset.coe_sort_coe, mem_support_toFun, mk_apply, ne_eq, h1, not_false_iff,\n dite_eq_ite, ite_true, not_not] at h2\n simp [h2, h0]\n \u00b7 refine Finset.prod_congr rfl ?_\n intro i h1\n simp only [mem_support_toFun, ne_eq] at h1\n simp [h1]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_ne_zero_iff (L215-L222)\nlemma prod_ne_zero_iff : f.prod g \u2260 0 \u2194 \u2200 i \u2208 f.support, g i (f i) \u2260 0 := Finset.prod_ne_zero_iff\nend CommMonoidWithZero\n\n/--\nWhen summing over an `ZeroHom`, the decidability assumption is not needed, and the result is\nalso an `ZeroHom`.\n-/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_inv (L166-L170)\ntheorem prod_inv [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [DivisionCommMonoid \u03b3] {f : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} :\n (f.prod fun i b => (h i b)\u207b\u00b9) = (f.prod h)\u207b\u00b9 :=\n(map_prod (invMonoidHom : \u03b3 \u2192* \u03b3) _ f.support).symm\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.smul_sum (L176-L180)\ntheorem smul_sum {\u03b1 : Type*} [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [AddCommMonoid \u03b3] [DistribSMul \u03b1 \u03b3] {f : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} {c : \u03b1} :\n c \u2022 f.sum h = f.sum fun a b => c \u2022 h a b :=\nFinset.smul_sum\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod (L78-L81)\ndef prod [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3] (f : \u03a0\u2080 i, \u03b2 i)\n (g : \u2200 i, \u03b2 i \u2192 \u03b3) : \u03b3 :=\n\u220f i \u2208 f.support, g i (f i)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_add_index (L182-L198)\ntheorem prod_add_index [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] {f g : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (h_zero : \u2200 i, h i 0 = 1)\n (h_add : \u2200 i b\u2081 b\u2082, h i (b\u2081 + b\u2082) = h i b\u2081 * h i b\u2082) : (f + g).prod h = f.prod h * g.prod h :=\nhave f_eq : (\u220f i \u2208 f.support \u222a g.support, h i (f i)) = f.prod h :=\n (Finset.prod_subset Finset.subset_union_left <| by\n simp +contextual [h_zero]).symm\n have g_eq : (\u220f i \u2208 f.support \u222a g.support, h i (g i)) = g.prod h :=\n (Finset.prod_subset Finset.subset_union_right <| by\n simp +contextual [h_zero]).symm\n calc\n (\u220f i \u2208 (f + g).support, h i ((f + g) i)) = \u220f i \u2208 f.support \u222a g.support, h i ((f + g) i) :=\n Finset.prod_subset support_add <| by\n simp +contextual [h_zero]\n _ = (\u220f i \u2208 f.support \u222a g.support, h i (f i)) * \u220f i \u2208 f.support \u222a g.support, h i (g i) := by\n { simp [h_add, Finset.prod_mul_distrib] }\n _ = _ := by rw [f_eq, g_eq]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom_piSingle (L256-L265)\ntheorem sumZeroHom_piSingle [\u2200 i, Zero (\u03b2 i)] [AddCommMonoid \u03b3] (i) (\u03c6 : ZeroHom (\u03b2 i) \u03b3) :\n sumZeroHom (Pi.single i \u03c6) = \u03c6.comp { toFun := (\u00b7 i), map_zero' := rfl } := by\next \u27e8f, sf, hf\u27e9\n simp only [sumZeroHom, Trunc.lift, toFun_eq_coe, ZeroHom.coe_mk, coe_mk', ZeroHom.coe_comp,\n Function.comp_apply]\n rw [Finset.sum_eq_single i (fun j _ hji => ?_) (fun hi => ?_), Pi.single_eq_same]\n \u00b7 simp [hji]\n \u00b7 simp [(hf i).resolve_left (by simpa using hi)]\n\n/-- While we didn't need decidable instances to define it, we do to reduce it to a sum -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_eq_zero_iff (L214-L214)\nlemma prod_eq_zero_iff : f.prod g = 0 \u2194 \u2203 i \u2208 f.support, g i (f i) = 0 := Finset.prod_eq_zero_iff\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_zero_index (L107-L110)\ntheorem prod_zero_index [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] {h : \u2200 i, \u03b2 i \u2192 \u03b3} : (0 : \u03a0\u2080 i, \u03b2 i).prod h = 1 :=\nrfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_eq_prod_fintype (L200-L212)\ntheorem prod_eq_prod_fintype [Fintype \u03b9] [\u2200 i, Zero (\u03b2 i)] [\u2200 (i : \u03b9) (x : \u03b2 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] (v : \u03a0\u2080 i, \u03b2 i) {f : \u2200 i, \u03b2 i \u2192 \u03b3} (hf : \u2200 i, f i 0 = 1) :\n v.prod f = \u220f i, f i (DFinsupp.equivFunOnFintype v i) := by\nsuffices (\u220f i \u2208 v.support, f i (v i)) = \u220f i, f i (v i) by simp [DFinsupp.prod, this]\n apply Finset.prod_subset v.support.subset_univ\n intro i _ hi\n rw [mem_support_iff, not_not] at hi\n rw [hi, hf]\n\nsection CommMonoidWithZero\nvariable [\u03a0 i, Zero (\u03b2 i)] [CommMonoidWithZero \u03b3] [Nontrivial \u03b3] [NoZeroDivisors \u03b3]\n [\u03a0 i, DecidableEq (\u03b2 i)] {f : \u03a0\u2080 i, \u03b2 i} {g : \u03a0 i, \u03b2 i \u2192 \u03b3}\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.Data.DFinsupp.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 coe_zsmul [\u2200 i, AddGroup (\u03b2 i)] (b : \u2124) (v : \u03a0\u2080 i, \u03b2 i) : \u21d1(b \u2022 v) = b \u2022 \u21d1v\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.DFinsupp.Defs.instDFunLike (L77-L82)\ninstance instDFunLike : DFunLike (\u03a0\u2080 i, \u03b2 i) \u03b9 \u03b2 :=\n\u27e8fun f => f.toFun, fun \u27e8f\u2081, s\u2081\u27e9 \u27e8f\u2082, s\u2081\u27e9 \u21a6 fun (h : f\u2081 = f\u2082) \u21a6 by\n subst h\n congr\n subsingleton \u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.DFinsupp.Defs.toFun_eq_coe (L84-L86)\ntheorem toFun_eq_coe (f : \u03a0\u2080 i, \u03b2 i) : f.toFun = f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.DFinsupp.Defs.ext (L88-L90)\ntheorem ext {f g : \u03a0\u2080 i, \u03b2 i} (h : \u2200 i, f i = g i) : f = g :=\nDFunLike.ext _ _ h\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.DFinsupp.Defs.ne_iff (L91-L92)\nlemma ne_iff {f g : \u03a0\u2080 i, \u03b2 i} : f \u2260 g \u2194 \u2203 i, f i \u2260 g i := DFunLike.ne_iff\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.DFinsupp.Defs.zero_apply (L103-L116)\ntheorem zero_apply (i : \u03b9) : (0 : \u03a0\u2080 i, \u03b2 i) i = 0 :=\nrfl\n\n/-- The composition of `f : \u03b2\u2081 \u2192 \u03b2\u2082` and `g : \u03a0\u2080 i, \u03b2\u2081 i` is\n `mapRange f hf g : \u03a0\u2080 i, \u03b2\u2082 i`, well defined when `f 0 = 0`.\n\nThis preserves the structure on `f`, and exists in various bundled forms for when `f` is itself\nbundled:\n\n* `DFinsupp.mapRange.addMonoidHom`\n* `DFinsupp.mapRange.addEquiv`\n* `dfinsupp.mapRange.linearMap`\n* `dfinsupp.mapRange.linearEquiv`\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange (L117-L121)\ndef mapRange (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (hf : \u2200 i, f i 0 = 0) (x : \u03a0\u2080 i, \u03b2\u2081 i) : \u03a0\u2080 i, \u03b2\u2082 i :=\n\u27e8fun i => f i (x i),\n x.support'.map fun s => \u27e8s.1, fun i => (s.2 i).imp_right fun h : x i = 0 => by\n rw [\u2190 hf i, \u2190 h]\u27e9\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_apply (L123-L126)\ntheorem mapRange_apply (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (hf : \u2200 i, f i 0 = 0) (g : \u03a0\u2080 i, \u03b2\u2081 i) (i : \u03b9) :\n mapRange f hf g i = f i (g i) :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_id (L128-L132)\ntheorem mapRange_id (h : \u2200 i, id (0 : \u03b2\u2081 i) = 0 := fun _ => rfl) (g : \u03a0\u2080 i : \u03b9, \u03b2\u2081 i) :\nmapRange (fun i => (id : \u03b2\u2081 i \u2192 \u03b2\u2081 i)) h g = g := by\n ext\n rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_comp (L133-L138)\ntheorem mapRange_comp (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (f\u2082 : \u2200 i, \u03b2 i \u2192 \u03b2\u2081 i) (hf : \u2200 i, f i 0 = 0)\n (hf\u2082 : \u2200 i, f\u2082 i 0 = 0) (h : \u2200 i, (f i \u2218 f\u2082 i) 0 = 0) (g : \u03a0\u2080 i : \u03b9, \u03b2 i) :\n mapRange (fun i => f i \u2218 f\u2082 i) h g = mapRange f hf (mapRange f\u2082 hf\u2082 g) := by\next\n simp only [mapRange_apply]; rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.DFinsupp.Defs.mapRange_zero (L140-L146)\ntheorem mapRange_zero (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i) (hf : \u2200 i, f i 0 = 0) :\n mapRange f hf (0 : \u03a0\u2080 i, \u03b2\u2081 i) = 0 := by\next\n simp only [mapRange_apply, coe_zero, Pi.zero_apply, hf]\n\n/-- Let `f i` be a binary operation `\u03b2\u2081 i \u2192 \u03b2\u2082 i \u2192 \u03b2 i` such that `f i 0 0 = 0`.\nThen `zipWith f hf` is a binary operation `\u03a0\u2080 i, \u03b2\u2081 i \u2192 \u03a0\u2080 i, \u03b2\u2082 i \u2192 \u03a0\u2080 i, \u03b2 i`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.DFinsupp.Defs.zipWith (L147-L158)\ndef zipWith (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i \u2192 \u03b2 i) (hf : \u2200 i, f i 0 0 = 0) (x : \u03a0\u2080 i, \u03b2\u2081 i) (y : \u03a0\u2080 i, \u03b2\u2082 i) :\n \u03a0\u2080 i, \u03b2 i :=\n\u27e8fun i => f i (x i) (y i), by\n refine x.support'.bind fun xs => ?_\n refine y.support'.map fun ys => ?_\n refine \u27e8xs + ys, fun i => ?_\u27e9\n obtain h1 | (h1 : x i = 0) := xs.prop i\n \u00b7 grind\n obtain h2 | (h2 : y i = 0) := ys.prop i\n \u00b7 grind\n grind\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.DFinsupp.Defs.zipWith_apply (L160-L169)\ntheorem zipWith_apply (f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i \u2192 \u03b2 i) (hf : \u2200 i, f i 0 0 = 0) (g\u2081 : \u03a0\u2080 i, \u03b2\u2081 i)\n (g\u2082 : \u03a0\u2080 i, \u03b2\u2082 i) (i : \u03b9) : zipWith f hf g\u2081 g\u2082 i = f i (g\u2081 i) (g\u2082 i) :=\nrfl\n\nsection Piecewise\n\nvariable (x y : \u03a0\u2080 i, \u03b2 i) (s : Set \u03b9) [\u2200 i, Decidable (i \u2208 s)]\n\n/-- `x.piecewise y s` is the finitely supported function equal to `x` on the set `s`,\n and to `y` on its complement. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.DFinsupp.Defs.piecewise (L170-L172)\ndef piecewise : \u03a0\u2080 i, \u03b2 i :=\nzipWith (fun i x y => if i \u2208 s then x else y) (fun _ => ite_self 0) x y\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.DFinsupp.Defs.piecewise_apply (L173-L175)\ntheorem piecewise_apply (i : \u03b9) : x.piecewise y s i = if i \u2208 s then x i else y i :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.DFinsupp.Defs.coe_piecewise (L177-L185)\ntheorem coe_piecewise : \u21d1(x.piecewise y s) = s.piecewise x y :=\nrfl\n\nend Piecewise\n\nend Basic\n\nsection Algebra\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_comm (L127-L134)\ntheorem prod_comm {\u03b9\u2081 \u03b9\u2082 : Sort _} {\u03b2\u2081 : \u03b9\u2081 \u2192 Type*} {\u03b2\u2082 : \u03b9\u2082 \u2192 Type*} [DecidableEq \u03b9\u2081]\n [DecidableEq \u03b9\u2082] [\u2200 i, Zero (\u03b2\u2081 i)] [\u2200 i, Zero (\u03b2\u2082 i)] [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)]\n [\u2200 (i) (x : \u03b2\u2082 i), Decidable (x \u2260 0)] [CommMonoid \u03b3] (f\u2081 : \u03a0\u2080 i, \u03b2\u2081 i) (f\u2082 : \u03a0\u2080 i, \u03b2\u2082 i)\n (h : \u2200 i, \u03b2\u2081 i \u2192 \u2200 i, \u03b2\u2082 i \u2192 \u03b3) :\n (f\u2081.prod fun i\u2081 x\u2081 => f\u2082.prod fun i\u2082 x\u2082 => h i\u2081 x\u2081 i\u2082 x\u2082) =\n f\u2082.prod fun i\u2082 x\u2082 => f\u2081.prod fun i\u2081 x\u2081 => h i\u2081 x\u2081 i\u2082 x\u2082 :=\nFinset.prod_comm\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sum_apply (L136-L141)\ntheorem sum_apply {\u03b9} {\u03b2 : \u03b9 \u2192 Type v} {\u03b9\u2081 : Type u\u2081} [DecidableEq \u03b9\u2081] {\u03b2\u2081 : \u03b9\u2081 \u2192 Type v\u2081}\n [\u2200 i\u2081, Zero (\u03b2\u2081 i\u2081)] [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)] [\u2200 i, AddCommMonoid (\u03b2 i)]\n {f : \u03a0\u2080 i\u2081, \u03b2\u2081 i\u2081} {g : \u2200 i\u2081, \u03b2\u2081 i\u2081 \u2192 \u03a0\u2080 i, \u03b2 i} {i\u2082 : \u03b9} :\n (f.sum g) i\u2082 = f.sum fun i\u2081 b => g i\u2081 b i\u2082 :=\nmap_sum (evalAddMonoidHom i\u2082) _ f.support\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_one (L155-L158)\ntheorem prod_one [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {f : \u03a0\u2080 i, \u03b2 i} : (f.prod fun _ _ => (1 : \u03b3)) = 1 :=\nFinset.prod_const_one\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.coe_finset_sum (L61-L64)\ntheorem coe_finset_sum {\u03b1} [\u2200 i, AddCommMonoid (\u03b2 i)] (s : Finset \u03b1) (g : \u03b1 \u2192 \u03a0\u2080 i, \u03b2 i) :\n \u21d1(\u2211 a \u2208 s, g a) = \u2211 a \u2208 s, \u21d1(g a) :=\nmap_sum coeFnAddMonoidHom g s\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.evalAddMonoidHom (L57-L59)\ndef evalAddMonoidHom [\u2200 i, AddZeroClass (\u03b2 i)] (i : \u03b9) : (\u03a0\u2080 i, \u03b2 i) \u2192+ \u03b2 i :=\n(Pi.evalAddMonoidHom \u03b2 i).comp coeFnAddMonoidHom\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_mul (L160-L164)\ntheorem prod_mul [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {f : \u03a0\u2080 i, \u03b2 i} {h\u2081 h\u2082 : \u2200 i, \u03b2 i \u2192 \u03b3} :\n (f.prod fun i b => h\u2081 i b * h\u2082 i b) = f.prod h\u2081 * f.prod h\u2082 :=\nFinset.prod_mul_distrib\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumAddHom (L283-L306)\ndef sumAddHom [\u2200 i, AddZeroClass (\u03b2 i)] [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, \u03b2 i \u2192+ \u03b3) :\n (\u03a0\u2080 i, \u03b2 i) \u2192+ \u03b3 where\n __ := sumZeroHom fun i => \u03c6 i |>.toZeroHom\nmap_add' := by\n rintro \u27e8f, sf, hf\u27e9 \u27e8g, sg, hg\u27e9\n change (\u2211 i \u2208 _, _) = (\u2211 i \u2208 _, _) + \u2211 i \u2208 _, _\n simp only [AddMonoidHom.toZeroHom_coe, coe_add, coe_mk', Pi.add_apply, map_add,\n Finset.sum_add_distrib]\n congr 1\n \u00b7 refine (Finset.sum_subset ?_ ?_).symm\n \u00b7 intro i\n simp only [Multiset.mem_toFinset, Multiset.mem_add]\n exact Or.inl\n \u00b7 intro i _ H2\n simp only [Multiset.mem_toFinset] at H2\n rw [(hf i).resolve_left H2, map_zero]\n \u00b7 refine (Finset.sum_subset ?_ ?_).symm\n \u00b7 intro i\n simp only [Multiset.mem_toFinset, Multiset.mem_add]\n exact Or.inr\n \u00b7 intro i _ H2\n simp only [Multiset.mem_toFinset] at H2\n rw [(hg i).resolve_left H2, map_zero]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_eq_one (L172-L175)\ntheorem prod_eq_one [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {f : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (hyp : \u2200 i, h i (f i) = 1) : f.prod h = 1 :=\nFinset.prod_eq_one fun i _ => hyp i\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom (L223-L248)\ndef sumZeroHom [\u2200 i, Zero (\u03b2 i)] [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, ZeroHom (\u03b2 i) \u03b3) :\n ZeroHom (\u03a0\u2080 i, \u03b2 i) \u03b3 where\n toFun f :=\n(f.support'.lift fun s => \u2211 i \u2208 Multiset.toFinset s.1, \u03c6 i (f i)) <| by\n rintro \u27e8sx, hx\u27e9 \u27e8sy, hy\u27e9\n dsimp only [Subtype.coe_mk, toFun_eq_coe] at *\n have H1 : sx.toFinset \u2229 sy.toFinset \u2286 sx.toFinset := Finset.inter_subset_left\n have H2 : sx.toFinset \u2229 sy.toFinset \u2286 sy.toFinset := Finset.inter_subset_right\n refine\n (Finset.sum_subset H1 ?_).symm.trans\n ((Finset.sum_congr rfl ?_).trans (Finset.sum_subset H2 ?_))\n \u00b7 intro i H1 H2\n rw [Finset.mem_inter] at H2\n simp only [Multiset.mem_toFinset] at H1 H2\n convert map_zero (\u03c6 i)\n exact (hy i).resolve_left (mt (And.intro H1) H2)\n \u00b7 intro i _\n rfl\n \u00b7 intro i H1 H2\n rw [Finset.mem_inter] at H2\n simp only [Multiset.mem_toFinset] at H1 H2\n convert map_zero (\u03c6 i)\n exact (hx i).resolve_left (mt (fun H3 => And.intro H3 H1) H2)\n map_zero' := by\n simp only [toFun_eq_coe, coe_zero, Pi.zero_apply, map_zero, Finset.sum_const_zero]; rfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.finset_sum_apply (L66-L76)\ntheorem finset_sum_apply {\u03b1} [\u2200 i, AddCommMonoid (\u03b2 i)] (s : Finset \u03b1) (g : \u03b1 \u2192 \u03a0\u2080 i, \u03b2 i) (i : \u03b9) :\n (\u2211 a \u2208 s, g a) i = \u2211 a \u2208 s, g a i :=\nmap_sum (evalAddMonoidHom i) g s\n\nend Algebra\n\nsection ProdAndSum\n\nvariable [DecidableEq \u03b9]\n\n/-- `DFinsupp.prod f g` is the product of `g i (f i)` over the support of `f`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.support_sum (L142-L153)\ntheorem support_sum {\u03b9\u2081 : Type u\u2081} [DecidableEq \u03b9\u2081] {\u03b2\u2081 : \u03b9\u2081 \u2192 Type v\u2081} [\u2200 i\u2081, Zero (\u03b2\u2081 i\u2081)]\n [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)] [\u2200 i, AddCommMonoid (\u03b2 i)]\n [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] {f : \u03a0\u2080 i\u2081, \u03b2\u2081 i\u2081} {g : \u2200 i\u2081, \u03b2\u2081 i\u2081 \u2192 \u03a0\u2080 i, \u03b2 i} :\n (f.sum g).support \u2286 f.support.biUnion fun i => (g i (f i)).support := by\nhave :\n \u2200 i\u2081 : \u03b9,\n (f.sum fun (i : \u03b9\u2081) (b : \u03b2\u2081 i) => (g i b) i\u2081) \u2260 0 \u2192 \u2203 i : \u03b9\u2081, f i \u2260 0 \u2227 \u00ac(g i (f i)) i\u2081 = 0 :=\n fun i\u2081 h =>\n let \u27e8i, hi, Ne\u27e9 := Finset.exists_ne_zero_of_sum_ne_zero h\n \u27e8i, mem_support_iff.1 hi, Ne\u27e9\n simpa [Finset.subset_iff, mem_support_iff, Finset.mem_biUnion, sum_apply] using this\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom_single (L250-L254)\ntheorem sumZeroHom_single [\u2200 i, Zero (\u03b2 i)] [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, ZeroHom (\u03b2 i) \u03b3) (i)\n (x : \u03b2 i) : sumZeroHom \u03c6 (single i x) = \u03c6 i x := by\ndsimp [sumZeroHom, single, Trunc.lift_mk]\n rw [Multiset.toFinset_singleton, Finset.sum_singleton, Pi.single_eq_same]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_neg_index (L121-L125)\ntheorem prod_neg_index [\u2200 i, AddGroup (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {g : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (h0 : \u2200 i, h i 0 = 1) :\n (-g).prod h = g.prod fun i b => h i (-b) :=\nprod_mapRange_index h0\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom_apply (L266-L281)\ntheorem sumZeroHom_apply [\u2200 i, AddZeroClass (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [AddCommMonoid \u03b3] (\u03c6 : \u2200 i, ZeroHom (\u03b2 i) \u03b3) (f : \u03a0\u2080 i, \u03b2 i) :\n sumZeroHom \u03c6 f = f.sum fun x => \u03c6 x := by\nrcases f with \u27e8f, s, hf\u27e9\n change (\u2211 i \u2208 _, _) = \u2211 i \u2208 _ with _, _\n rw [Finset.sum_filter, Finset.sum_congr rfl]\n intro i _\n dsimp only [coe_mk', Subtype.coe_mk] at *\n split_ifs with h\n \u00b7 rfl\n \u00b7 rw [not_not.mp h, map_zero]\n\n/--\nWhen summing over an `AddMonoidHom`, the decidability assumption is not needed, and the result is\nalso an `AddMonoidHom`.\n-/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_single_index (L112-L119)\ntheorem prod_single_index [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3]\n {i : \u03b9} {b : \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (h_zero : h i 0 = 1) : (single i b).prod h = h i b := by\nby_cases h : b \u2260 0\n \u00b7 simp [DFinsupp.prod, support_single_ne_zero h]\n \u00b7 rw [not_not] at h\n simp [h, h_zero]\n rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_mapRange_index (L90-L105)\ntheorem prod_mapRange_index {\u03b2\u2081 : \u03b9 \u2192 Type v\u2081} {\u03b2\u2082 : \u03b9 \u2192 Type v\u2082} [\u2200 i, Zero (\u03b2\u2081 i)]\n [\u2200 i, Zero (\u03b2\u2082 i)] [\u2200 (i) (x : \u03b2\u2081 i), Decidable (x \u2260 0)] [\u2200 (i) (x : \u03b2\u2082 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] {f : \u2200 i, \u03b2\u2081 i \u2192 \u03b2\u2082 i} {hf : \u2200 i, f i 0 = 0} {g : \u03a0\u2080 i, \u03b2\u2081 i} {h : \u2200 i, \u03b2\u2082 i \u2192 \u03b3}\n (h0 : \u2200 i, h i 0 = 1) : (mapRange f hf g).prod h = g.prod fun i b => h i (f i b) := by\nrw [mapRange_def]\n refine (Finset.prod_subset support_mk_subset ?_).trans ?_\n \u00b7 intro i h1 h2\n simp only [mem_support_toFun, ne_eq] at h1\n simp only [Finset.coe_sort_coe, mem_support_toFun, mk_apply, ne_eq, h1, not_false_iff,\n dite_eq_ite, ite_true, not_not] at h2\n simp [h2, h0]\n \u00b7 refine Finset.prod_congr rfl ?_\n intro i h1\n simp only [mem_support_toFun, ne_eq] at h1\n simp [h1]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_ne_zero_iff (L215-L222)\nlemma prod_ne_zero_iff : f.prod g \u2260 0 \u2194 \u2200 i \u2208 f.support, g i (f i) \u2260 0 := Finset.prod_ne_zero_iff\nend CommMonoidWithZero\n\n/--\nWhen summing over an `ZeroHom`, the decidability assumption is not needed, and the result is\nalso an `ZeroHom`.\n-/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_inv (L166-L170)\ntheorem prod_inv [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [DivisionCommMonoid \u03b3] {f : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} :\n (f.prod fun i b => (h i b)\u207b\u00b9) = (f.prod h)\u207b\u00b9 :=\n(map_prod (invMonoidHom : \u03b3 \u2192* \u03b3) _ f.support).symm\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.smul_sum (L176-L180)\ntheorem smul_sum {\u03b1 : Type*} [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [AddCommMonoid \u03b3] [DistribSMul \u03b1 \u03b3] {f : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} {c : \u03b1} :\n c \u2022 f.sum h = f.sum fun a b => c \u2022 h a b :=\nFinset.smul_sum\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod (L78-L81)\ndef prod [\u2200 i, Zero (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)] [CommMonoid \u03b3] (f : \u03a0\u2080 i, \u03b2 i)\n (g : \u2200 i, \u03b2 i \u2192 \u03b3) : \u03b3 :=\n\u220f i \u2208 f.support, g i (f i)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_add_index (L182-L198)\ntheorem prod_add_index [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] {f g : \u03a0\u2080 i, \u03b2 i} {h : \u2200 i, \u03b2 i \u2192 \u03b3} (h_zero : \u2200 i, h i 0 = 1)\n (h_add : \u2200 i b\u2081 b\u2082, h i (b\u2081 + b\u2082) = h i b\u2081 * h i b\u2082) : (f + g).prod h = f.prod h * g.prod h :=\nhave f_eq : (\u220f i \u2208 f.support \u222a g.support, h i (f i)) = f.prod h :=\n (Finset.prod_subset Finset.subset_union_left <| by\n simp +contextual [h_zero]).symm\n have g_eq : (\u220f i \u2208 f.support \u222a g.support, h i (g i)) = g.prod h :=\n (Finset.prod_subset Finset.subset_union_right <| by\n simp +contextual [h_zero]).symm\n calc\n (\u220f i \u2208 (f + g).support, h i ((f + g) i)) = \u220f i \u2208 f.support \u222a g.support, h i ((f + g) i) :=\n Finset.prod_subset support_add <| by\n simp +contextual [h_zero]\n _ = (\u220f i \u2208 f.support \u222a g.support, h i (f i)) * \u220f i \u2208 f.support \u222a g.support, h i (g i) := by\n { simp [h_add, Finset.prod_mul_distrib] }\n _ = _ := by rw [f_eq, g_eq]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.sumZeroHom_piSingle (L256-L265)\ntheorem sumZeroHom_piSingle [\u2200 i, Zero (\u03b2 i)] [AddCommMonoid \u03b3] (i) (\u03c6 : ZeroHom (\u03b2 i) \u03b3) :\n sumZeroHom (Pi.single i \u03c6) = \u03c6.comp { toFun := (\u00b7 i), map_zero' := rfl } := by\next \u27e8f, sf, hf\u27e9\n simp only [sumZeroHom, Trunc.lift, toFun_eq_coe, ZeroHom.coe_mk, coe_mk', ZeroHom.coe_comp,\n Function.comp_apply]\n rw [Finset.sum_eq_single i (fun j _ hji => ?_) (fun hi => ?_), Pi.single_eq_same]\n \u00b7 simp [hji]\n \u00b7 simp [(hf i).resolve_left (by simpa using hi)]\n\n/-- While we didn't need decidable instances to define it, we do to reduce it to a sum -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_eq_zero_iff (L214-L214)\nlemma prod_eq_zero_iff : f.prod g = 0 \u2194 \u2203 i \u2208 f.support, g i (f i) = 0 := Finset.prod_eq_zero_iff\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_zero_index (L107-L110)\ntheorem prod_zero_index [\u2200 i, AddCommMonoid (\u03b2 i)] [\u2200 (i) (x : \u03b2 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] {h : \u2200 i, \u03b2 i \u2192 \u03b3} : (0 : \u03a0\u2080 i, \u03b2 i).prod h = 1 :=\nrfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.DFinsupp.BigOperators.prod_eq_prod_fintype (L200-L212)\ntheorem prod_eq_prod_fintype [Fintype \u03b9] [\u2200 i, Zero (\u03b2 i)] [\u2200 (i : \u03b9) (x : \u03b2 i), Decidable (x \u2260 0)]\n [CommMonoid \u03b3] (v : \u03a0\u2080 i, \u03b2 i) {f : \u2200 i, \u03b2 i \u2192 \u03b3} (hf : \u2200 i, f i 0 = 1) :\n v.prod f = \u220f i, f i (DFinsupp.equivFunOnFintype v i) := by\nsuffices (\u220f i \u2208 v.support, f i (v i)) = \u220f i, f i (v i) by simp [DFinsupp.prod, this]\n apply Finset.prod_subset v.support.subset_univ\n intro i _ hi\n rw [mem_support_iff, not_not] at hi\n rw [hi, hf]\n\nsection CommMonoidWithZero\nvariable [\u03a0 i, Zero (\u03b2 i)] [CommMonoidWithZero \u03b3] [Nontrivial \u03b3] [NoZeroDivisors \u03b3]\n [\u03a0 i, DecidableEq (\u03b2 i)] {f : \u03a0\u2080 i, \u03b2 i} {g : \u03a0 i, \u03b2 i \u2192 \u03b3}\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/DFinsupp/Defs.lean", "module": "Mathlib.Data.DFinsupp.Defs", "declaration": "Mathlib.Data.DFinsupp.Defs.coe_zsmul", "span": "L266-L268", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/DFinsupp/Defs.lean#L266"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 7563, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 17067, "lean_code_chars": 15572, "natural_language_chars": 1495, "lean_code_ratio": 0.9124, "line_count": 490, "imports_count": 0, "declarations_count": 2036, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "9a954caa175fde96", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.CharP.Two.intCast_eq_ite", "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.Algebra.CharP.Two)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem intCast_eq_ite (n : \u2124) : (n : R) = if Even n then 0 else 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.CharP.Two.of_one_ne_zero_of_two_eq_zero (L37-L46)\ntheorem of_one_ne_zero_of_two_eq_zero (h\u2081 : (1 : R) \u2260 0) (h\u2082 : (2 : R) = 0) : CharP R 2 where\n cast_eq_zero_iff n := by\nobtain hn | hn := Nat.even_or_odd n\n \u00b7 simp_rw [hn.two_dvd, iff_true]\n exact natCast_eq_zero_of_even_of_two_eq_zero hn h\u2082\n \u00b7 simp_rw [hn.not_two_dvd_nat, iff_false]\n rwa [natCast_eq_one_of_odd_of_two_eq_zero hn h\u2082]\n\nvariable [CharP R 2]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.CharP.Two.two_eq_zero (L48-L50)\ntheorem two_eq_zero : (2 : R) = 0 := by\nrw [\u2190 Nat.cast_two, CharP.cast_eq_zero]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.CharP.Two.natCast_eq_ite (L51-L53)\ntheorem natCast_eq_ite (n : \u2115) : (n : R) = if Even n then 0 else 1 := by\ninduction n <;> aesop (add simp [one_add_one_eq_two])\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.CharP.Two.range_natCast (L55-L60)\ntheorem range_natCast : Set.range ((\u2191) : \u2115 \u2192 R) = {0, 1} := by\nrw [funext natCast_eq_ite, Set.range_ite_const]\n \u00b7 use 0; simp\n \u00b7 use 1; simp\n\nvariable (R) in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.CharP.Two.natCast_cases (L61-L63)\ntheorem natCast_cases (n : \u2115) : (n : R) = 0 \u2228 (n : R) = 1 :=\nrange_natCast.le (Set.mem_range_self _)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.CharP.Two.natCast_eq_mod (L64-L66)\ntheorem natCast_eq_mod (n : \u2115) : (n : R) = (n % 2 : \u2115) := by\nsimp [natCast_eq_ite, Nat.even_iff]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.CharP.Two.ofNat_eq_mod (L68-L70)\ntheorem ofNat_eq_mod (n : \u2115) [n.AtLeastTwo] : (ofNat(n) : R) = (ofNat(n) % 2 : \u2115) :=\nnatCast_eq_mod n\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.CharP.Two.add_self_eq_zero (L80-L81)\ntheorem add_self_eq_zero (x : R) : x + x = 0 := by rw [\u2190 two_mul x, two_eq_zero, zero_mul]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.CharP.Two.neg_eq (L100-L102)\ntheorem neg_eq (x : R) : -x = x := by\nrw [neg_eq_iff_add_eq_zero, add_self_eq_zero]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.CharP.Two.neg_eq' (L103-L105)\ntheorem neg_eq' : Neg.neg = (id : R \u2192 R) :=\nfunext neg_eq\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.CharP.Two.sub_eq_add (L107-L108)\ntheorem sub_eq_add (x y : R) : x - y = x + y := by rw [sub_eq_add_neg, neg_eq]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.CharP.Two.add_eq_iff_eq_add (L109-L111)\ntheorem add_eq_iff_eq_add {a b c : R} : a + b = c \u2194 a = c + b := by\nrw [\u2190 sub_eq_iff_eq_add, sub_eq_add]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.CharP.Two.eq_add_iff_add_eq (L112-L114)\ntheorem eq_add_iff_add_eq {a b c : R} : a = b + c \u2194 a + c = b := by\nrw [\u2190 eq_sub_iff_add_eq, sub_eq_add]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.CharP.Two.range_intCast (L126-L131)\ntheorem range_intCast : Set.range ((\u2191) : \u2124 \u2192 R) = {0, 1} := by\nrw [funext intCast_eq_ite, Set.range_ite_const]\n \u00b7 use 0; simp\n \u00b7 use 1; simp\n\nvariable (R) in\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.CharP.Two.intCast_cases (L132-L134)\ntheorem intCast_cases (n : \u2124) : (n : R) = 0 \u2228 (n : R) = 1 :=\n(Set.ext_iff.1 range_intCast _).1 (Set.mem_range_self _)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_injOn_Iio (L59-L66)\nlemma natCast_injOn_Iio : (Set.Iio p).InjOn ((\u2191) : \u2115 \u2192 R) :=\nfun _a ha _b hb hab \u21a6 ((natCast_eq_natCast _ _).1 hab).eq_of_lt_of_lt ha hb\n\nend AddMonoidWithOne\n\nsection AddGroupWithOne\nvariable [AddGroupWithOne R] (p : \u2115) [CharP R p] {a b : \u2124}\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_injective_algebraMap' (L66-L71)\ntheorem charP_of_injective_algebraMap' (R : Type*) [CommRing R] [Semiring A]\n [Algebra R A] [FaithfulSMul R A] (p : \u2115) [CharP R p] : CharP A p :=\ncharP_of_injective_ringHom (FaithfulSMul.algebraMap_injective R A) p\n\n/-- If a ring homomorphism `R \u2192+* A` is injective and `R` has characteristic zero\nthen so does `A`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP (L132-L132)\ninstance charP [CharP R p] : CharP L p := L.subtype.charP L.subtype_injective p\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_eq_natCast (L52-L58)\nlemma natCast_eq_natCast : (a : R) = b \u2194 a \u2261 b [MOD p] := by\nwlog hle : a \u2264 b\n \u00b7 rw [eq_comm, this R p (le_of_not_ge hle), Nat.ModEq.comm]\n rw [Nat.modEq_iff_dvd' hle, \u2190 cast_eq_zero_iff R p (b - a),\n \u2190 add_right_cancel_iff (G := R) (a := a) (b := b - a), zero_add, \u2190 Nat.cast_add,\n Nat.sub_add_cancel hle, eq_comm]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_isFractionRing (L208-L211)\ntheorem charP_of_isFractionRing [CharP R p] : CharP K p :=\ncharP_of_injective_algebraMap (IsFractionRing.injective R K) p\n\n/-- If `R` has characteristic `0`, then so does Frac(R). -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero (L197-L207)\ninstance charZero [CharZero R] : CharZero (FreeAlgebra R X) :=\ncharZero_of_injective_algebraMap FreeAlgebra.algebraMap_leftInverse.injective\n\nend FreeAlgebra\n\nnamespace IsFractionRing\n\nvariable (R : Type*) {K : Type*} [CommRing R] [Field K] [Algebra R K] [IsFractionRing R K]\nvariable (p : \u2115)\n\n/-- If `R` has characteristic `p`, then so does Frac(R). -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_injective_ringHom (L56-L61)\ntheorem charP_of_injective_ringHom [NonAssocSemiring R] [NonAssocSemiring A]\n {f : R \u2192+* A} (h : Function.Injective f) (p : \u2115) [CharP R p] : CharP A p where\n cast_eq_zero_iff x := by\nrw [\u2190 CharP.cast_eq_zero_iff R p x, \u2190 map_natCast f x, map_eq_zero_iff f h]\n\n/-- If the algebra map `R \u2192+* A` is injective then `A` has the same characteristic as `R`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero_of_isFractionRing (L212-L217)\ntheorem charZero_of_isFractionRing [CharZero R] : CharZero K :=\n@CharP.charP_to_charZero K _ (charP_of_isFractionRing R 0)\n\nvariable [IsDomain R]\n\n/-- If `R` has characteristic `p`, then so does `FractionRing R`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.CharP.Algebra.CharP (L38-L43)\ntheorem CharP.dvd_of_ringHom [NonAssocSemiring R] [NonAssocSemiring A]\n (f : R \u2192+* A) (p q : \u2115) [CharP R p] [CharP A q] : q \u2223 p := by\nrefine (CharP.cast_eq_zero_iff A q p).mp ?_\n rw [\u2190 map_natCast f p, CharP.cast_eq_zero, map_zero]\n\n/-- Given `R \u2192+* A`, where `R` is a domain with `char R > 0`, then `char A = char R`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.CharP.Algebra.RingHom (L83-L95)\ntheorem RingHom.charP [NonAssocSemiring R] [NonAssocSemiring A] (f : R \u2192+* A)\n (H : Function.Injective f) (p : \u2115) [CharP A p] : CharP R p := by\nobtain \u27e8q, h\u27e9 := CharP.exists R\n exact CharP.eq _ (charP_of_injective_ringHom H q) \u2039CharP A p\u203a \u25b8 h\n\n/-- If `R \u2192+* A` is injective, then `R` is of characteristic `p` if and only if `A` is also of\ncharacteristic `p`. Similar to `RingHom.charZero_iff`. -/\nprotected theorem RingHom.charP_iff [NonAssocSemiring R] [NonAssocSemiring A]\n (f : R \u2192+* A) (H : Function.Injective f) (p : \u2115) : CharP R p \u2194 CharP A p :=\n \u27e8fun _ \u21a6 charP_of_injective_ringHom H p, fun _ \u21a6 f.charP H p\u27e9\n\n/-- If a ring homomorphism `R \u2192+* A` is injective then `A` has the same exponential characteristic\nas `R`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.CharP.Algebra.Algebra (L182-L185)\ntheorem Algebra.ringChar_eq : ringChar K = ringChar L := by\nrw [ringChar.eq_iff, Algebra.charP_iff K L]\n apply ringChar.charP\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_injective_algebraMap (L62-L65)\ntheorem charP_of_injective_algebraMap [CommSemiring R] [Semiring A] [Algebra R A]\n (h : Function.Injective (algebraMap R A)) (p : \u2115) [CharP R p] : CharP A p :=\ncharP_of_injective_ringHom h p\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.CharP.Algebra.expChar_of_injective_ringHom (L96-L104)\nlemma expChar_of_injective_ringHom\n [NonAssocSemiring R] [NonAssocSemiring A] {f : R \u2192+* A} (h : Function.Injective f)\n (q : \u2115) [hR : ExpChar R q] : ExpChar A q := by\nrcases hR with _ | hprime\n \u00b7 haveI := charZero_of_injective_ringHom h; exact .zero\n haveI := charP_of_injective_ringHom h q; exact .prime hprime\n\n/-- If `R \u2192+* A` is injective, and `A` is of exponential characteristic `p`, then `R` is also of\nexponential characteristic `p`. Similar to `RingHom.charZero`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero_of_injective_algebraMap (L77-L82)\ntheorem charZero_of_injective_algebraMap [CommSemiring R] [Semiring A] [Algebra R A]\n (h : Function.Injective (algebraMap R A)) [CharZero R] : CharZero A :=\ncharZero_of_injective_ringHom h\n\n/-- If `R \u2192+* A` is injective, and `A` is of characteristic `p`, then `R` is also of\ncharacteristic `p`. Similar to `RingHom.charZero`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.CharP.Basic.intCast_injOn_Ico (L73-L91)\nlemma intCast_injOn_Ico [IsRightCancelAdd R] : InjOn (Int.cast : \u2124 \u2192 R) (Ico 0 p) := by\nrintro a \u27e8ha\u2080, ha\u27e9 b \u27e8hb\u2080, hb\u27e9 hab\n lift a to \u2115 using ha\u2080\n lift b to \u2115 using hb\u2080\n norm_cast at *\n exact natCast_injOn_Iio _ _ ha hb hab\n\nend AddGroupWithOne\nend CharP\n\nnamespace CharP\n\nsection NonAssocSemiring\n\nvariable {R} [NonAssocSemiring R]\n\nvariable (R) in\n/-- If a ring `R` is of characteristic `p`, then for any prime number `q` different from `p`,\nit is not zero in `R`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero_of_injective_ringHom (L72-L76)\ntheorem charZero_of_injective_ringHom [NonAssocSemiring R] [NonAssocSemiring A]\n {f : R \u2192+* A} (h : Function.Injective f) [CharZero R] : CharZero A where\n cast_injective _ _ _ := CharZero.cast_injective <| h <| by simpa only [map_natCast f]\n/-- If the algebra map `R \u2192+* A` is injective and `R` has characteristic zero then so does `A`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.CharP.Algebra.expChar (L133-L149)\ninstance expChar [ExpChar R p] : ExpChar L p := L.subtype.expChar L.subtype_injective p\nend Subfield\n\n/-!\nAs an application, a `\u211a`-algebra has characteristic zero.\n-/\n\n-- `CharP.charP_to_charZero A _ (charP_of_injective_algebraMap h 0)` does not work\n-- here as it would require `Ring A`.\nsection QAlgebra\n\nvariable (R : Type*) [Nontrivial R]\n\n/-- A nontrivial `\u211a`-algebra has `CharP` equal to zero.\n\nThis cannot be a (local) instance because it would immediately form a loop with the\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.CharP.Basic.cast_ne_zero_of_ne_of_prime (L92-L98)\nlemma cast_ne_zero_of_ne_of_prime [Nontrivial R]\n {p q : \u2115} [CharP R p] (hq : q.Prime) (hneq : p \u2260 q) : (q : R) \u2260 0 := fun h \u21a6 by\nrw [cast_eq_zero_iff R p q] at h\n rcases hq.eq_one_or_self_of_dvd _ h with rfl | h\n \u00b7 exact false_of_nontrivial_of_char_one (R := R)\n \u00b7 exact hneq h\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.CharP.Algebra.algebraRat (L153-L158)\ntheorem algebraRat.charP_zero [Semiring R] [Algebra \u211a R] : CharP R 0 :=\ncharP_of_injective_algebraMap (algebraMap \u211a R).injective 0\n\n/-- A nontrivial `\u211a`-algebra has characteristic zero.\n\nThis cannot be a (local) instance because it would immediately form a loop with the\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.CharP.Basic.intCast_eq_intCast (L67-L69)\nlemma intCast_eq_intCast : (a : R) = b \u2194 a \u2261 b [ZMOD p] := by\nrw [eq_comm, \u2190 sub_eq_zero, \u2190 Int.cast_sub, CharP.intCast_eq_zero_iff R p, Int.modEq_iff_dvd]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_eq_natCast' (L41-L46)\nlemma natCast_eq_natCast' (h : a \u2261 b [MOD p]) : (a : R) = b := by\nwlog hle : a \u2264 b\n \u00b7 exact (this R p h.symm (le_of_not_ge hle)).symm\n rw [Nat.modEq_iff_dvd' hle] at h\n rw [\u2190 Nat.sub_add_cancel hle, Nat.cast_add, (cast_eq_zero_iff R p _).mpr h, zero_add]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.CharP.Algebra.ExpChar (L124-L131)\ntheorem ExpChar.of_injective_algebraMap' [CommRing R] [CommRing A]\n [Algebra R A] [FaithfulSMul R A] (q : \u2115) [ExpChar R q] : ExpChar A q :=\nexpChar_of_injective_ringHom (FaithfulSMul.algebraMap_injective R A) q\n\nnamespace Subfield\n\nvariable [DivisionRing R] (L : Subfield R) (p : \u2115)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.CharP.Basic.intCast_eq_intCast_mod (L70-L72)\nlemma intCast_eq_intCast_mod : (a : R) = a % (p : \u2124) :=\n(CharP.intCast_eq_intCast R p).mpr (Int.mod_modEq a p).symm\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.CharP.Algebra.expChar_of_injective_algebraMap (L119-L123)\nlemma expChar_of_injective_algebraMap [CommSemiring R] [Semiring A] [Algebra R A]\n (h : Function.Injective (algebraMap R A)) (q : \u2115) [ExpChar R q] : ExpChar A q :=\nexpChar_of_injective_ringHom h q\n\nvariable (R) in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_eq_natCast_mod (L47-L51)\nlemma natCast_eq_natCast_mod (a : \u2115) : (a : R) = a % p :=\nnatCast_eq_natCast' R p (Nat.mod_modEq a p).symm\n\nvariable [IsRightCancelAdd R]\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.Algebra.CharP.Two).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem intCast_eq_ite (n : \u2124) : (n : R) = if Even n then 0 else 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.CharP.Two.of_one_ne_zero_of_two_eq_zero (L37-L46)\ntheorem of_one_ne_zero_of_two_eq_zero (h\u2081 : (1 : R) \u2260 0) (h\u2082 : (2 : R) = 0) : CharP R 2 where\n cast_eq_zero_iff n := by\nobtain hn | hn := Nat.even_or_odd n\n \u00b7 simp_rw [hn.two_dvd, iff_true]\n exact natCast_eq_zero_of_even_of_two_eq_zero hn h\u2082\n \u00b7 simp_rw [hn.not_two_dvd_nat, iff_false]\n rwa [natCast_eq_one_of_odd_of_two_eq_zero hn h\u2082]\n\nvariable [CharP R 2]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.CharP.Two.two_eq_zero (L48-L50)\ntheorem two_eq_zero : (2 : R) = 0 := by\nrw [\u2190 Nat.cast_two, CharP.cast_eq_zero]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.CharP.Two.natCast_eq_ite (L51-L53)\ntheorem natCast_eq_ite (n : \u2115) : (n : R) = if Even n then 0 else 1 := by\ninduction n <;> aesop (add simp [one_add_one_eq_two])\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.CharP.Two.range_natCast (L55-L60)\ntheorem range_natCast : Set.range ((\u2191) : \u2115 \u2192 R) = {0, 1} := by\nrw [funext natCast_eq_ite, Set.range_ite_const]\n \u00b7 use 0; simp\n \u00b7 use 1; simp\n\nvariable (R) in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.CharP.Two.natCast_cases (L61-L63)\ntheorem natCast_cases (n : \u2115) : (n : R) = 0 \u2228 (n : R) = 1 :=\nrange_natCast.le (Set.mem_range_self _)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.CharP.Two.natCast_eq_mod (L64-L66)\ntheorem natCast_eq_mod (n : \u2115) : (n : R) = (n % 2 : \u2115) := by\nsimp [natCast_eq_ite, Nat.even_iff]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.CharP.Two.ofNat_eq_mod (L68-L70)\ntheorem ofNat_eq_mod (n : \u2115) [n.AtLeastTwo] : (ofNat(n) : R) = (ofNat(n) % 2 : \u2115) :=\nnatCast_eq_mod n\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.CharP.Two.add_self_eq_zero (L80-L81)\ntheorem add_self_eq_zero (x : R) : x + x = 0 := by rw [\u2190 two_mul x, two_eq_zero, zero_mul]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.CharP.Two.neg_eq (L100-L102)\ntheorem neg_eq (x : R) : -x = x := by\nrw [neg_eq_iff_add_eq_zero, add_self_eq_zero]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.CharP.Two.neg_eq' (L103-L105)\ntheorem neg_eq' : Neg.neg = (id : R \u2192 R) :=\nfunext neg_eq\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.CharP.Two.sub_eq_add (L107-L108)\ntheorem sub_eq_add (x y : R) : x - y = x + y := by rw [sub_eq_add_neg, neg_eq]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.CharP.Two.add_eq_iff_eq_add (L109-L111)\ntheorem add_eq_iff_eq_add {a b c : R} : a + b = c \u2194 a = c + b := by\nrw [\u2190 sub_eq_iff_eq_add, sub_eq_add]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.CharP.Two.eq_add_iff_add_eq (L112-L114)\ntheorem eq_add_iff_add_eq {a b c : R} : a = b + c \u2194 a + c = b := by\nrw [\u2190 eq_sub_iff_add_eq, sub_eq_add]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.CharP.Two.range_intCast (L126-L131)\ntheorem range_intCast : Set.range ((\u2191) : \u2124 \u2192 R) = {0, 1} := by\nrw [funext intCast_eq_ite, Set.range_ite_const]\n \u00b7 use 0; simp\n \u00b7 use 1; simp\n\nvariable (R) in\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.CharP.Two.intCast_cases (L132-L134)\ntheorem intCast_cases (n : \u2124) : (n : R) = 0 \u2228 (n : R) = 1 :=\n(Set.ext_iff.1 range_intCast _).1 (Set.mem_range_self _)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_injOn_Iio (L59-L66)\nlemma natCast_injOn_Iio : (Set.Iio p).InjOn ((\u2191) : \u2115 \u2192 R) :=\nfun _a ha _b hb hab \u21a6 ((natCast_eq_natCast _ _).1 hab).eq_of_lt_of_lt ha hb\n\nend AddMonoidWithOne\n\nsection AddGroupWithOne\nvariable [AddGroupWithOne R] (p : \u2115) [CharP R p] {a b : \u2124}\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_injective_algebraMap' (L66-L71)\ntheorem charP_of_injective_algebraMap' (R : Type*) [CommRing R] [Semiring A]\n [Algebra R A] [FaithfulSMul R A] (p : \u2115) [CharP R p] : CharP A p :=\ncharP_of_injective_ringHom (FaithfulSMul.algebraMap_injective R A) p\n\n/-- If a ring homomorphism `R \u2192+* A` is injective and `R` has characteristic zero\nthen so does `A`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP (L132-L132)\ninstance charP [CharP R p] : CharP L p := L.subtype.charP L.subtype_injective p\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_eq_natCast (L52-L58)\nlemma natCast_eq_natCast : (a : R) = b \u2194 a \u2261 b [MOD p] := by\nwlog hle : a \u2264 b\n \u00b7 rw [eq_comm, this R p (le_of_not_ge hle), Nat.ModEq.comm]\n rw [Nat.modEq_iff_dvd' hle, \u2190 cast_eq_zero_iff R p (b - a),\n \u2190 add_right_cancel_iff (G := R) (a := a) (b := b - a), zero_add, \u2190 Nat.cast_add,\n Nat.sub_add_cancel hle, eq_comm]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_isFractionRing (L208-L211)\ntheorem charP_of_isFractionRing [CharP R p] : CharP K p :=\ncharP_of_injective_algebraMap (IsFractionRing.injective R K) p\n\n/-- If `R` has characteristic `0`, then so does Frac(R). -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero (L197-L207)\ninstance charZero [CharZero R] : CharZero (FreeAlgebra R X) :=\ncharZero_of_injective_algebraMap FreeAlgebra.algebraMap_leftInverse.injective\n\nend FreeAlgebra\n\nnamespace IsFractionRing\n\nvariable (R : Type*) {K : Type*} [CommRing R] [Field K] [Algebra R K] [IsFractionRing R K]\nvariable (p : \u2115)\n\n/-- If `R` has characteristic `p`, then so does Frac(R). -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_injective_ringHom (L56-L61)\ntheorem charP_of_injective_ringHom [NonAssocSemiring R] [NonAssocSemiring A]\n {f : R \u2192+* A} (h : Function.Injective f) (p : \u2115) [CharP R p] : CharP A p where\n cast_eq_zero_iff x := by\nrw [\u2190 CharP.cast_eq_zero_iff R p x, \u2190 map_natCast f x, map_eq_zero_iff f h]\n\n/-- If the algebra map `R \u2192+* A` is injective then `A` has the same characteristic as `R`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero_of_isFractionRing (L212-L217)\ntheorem charZero_of_isFractionRing [CharZero R] : CharZero K :=\n@CharP.charP_to_charZero K _ (charP_of_isFractionRing R 0)\n\nvariable [IsDomain R]\n\n/-- If `R` has characteristic `p`, then so does `FractionRing R`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.CharP.Algebra.CharP (L38-L43)\ntheorem CharP.dvd_of_ringHom [NonAssocSemiring R] [NonAssocSemiring A]\n (f : R \u2192+* A) (p q : \u2115) [CharP R p] [CharP A q] : q \u2223 p := by\nrefine (CharP.cast_eq_zero_iff A q p).mp ?_\n rw [\u2190 map_natCast f p, CharP.cast_eq_zero, map_zero]\n\n/-- Given `R \u2192+* A`, where `R` is a domain with `char R > 0`, then `char A = char R`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.CharP.Algebra.RingHom (L83-L95)\ntheorem RingHom.charP [NonAssocSemiring R] [NonAssocSemiring A] (f : R \u2192+* A)\n (H : Function.Injective f) (p : \u2115) [CharP A p] : CharP R p := by\nobtain \u27e8q, h\u27e9 := CharP.exists R\n exact CharP.eq _ (charP_of_injective_ringHom H q) \u2039CharP A p\u203a \u25b8 h\n\n/-- If `R \u2192+* A` is injective, then `R` is of characteristic `p` if and only if `A` is also of\ncharacteristic `p`. Similar to `RingHom.charZero_iff`. -/\nprotected theorem RingHom.charP_iff [NonAssocSemiring R] [NonAssocSemiring A]\n (f : R \u2192+* A) (H : Function.Injective f) (p : \u2115) : CharP R p \u2194 CharP A p :=\n \u27e8fun _ \u21a6 charP_of_injective_ringHom H p, fun _ \u21a6 f.charP H p\u27e9\n\n/-- If a ring homomorphism `R \u2192+* A` is injective then `A` has the same exponential characteristic\nas `R`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.CharP.Algebra.Algebra (L182-L185)\ntheorem Algebra.ringChar_eq : ringChar K = ringChar L := by\nrw [ringChar.eq_iff, Algebra.charP_iff K L]\n apply ringChar.charP\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charP_of_injective_algebraMap (L62-L65)\ntheorem charP_of_injective_algebraMap [CommSemiring R] [Semiring A] [Algebra R A]\n (h : Function.Injective (algebraMap R A)) (p : \u2115) [CharP R p] : CharP A p :=\ncharP_of_injective_ringHom h p\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.CharP.Algebra.expChar_of_injective_ringHom (L96-L104)\nlemma expChar_of_injective_ringHom\n [NonAssocSemiring R] [NonAssocSemiring A] {f : R \u2192+* A} (h : Function.Injective f)\n (q : \u2115) [hR : ExpChar R q] : ExpChar A q := by\nrcases hR with _ | hprime\n \u00b7 haveI := charZero_of_injective_ringHom h; exact .zero\n haveI := charP_of_injective_ringHom h q; exact .prime hprime\n\n/-- If `R \u2192+* A` is injective, and `A` is of exponential characteristic `p`, then `R` is also of\nexponential characteristic `p`. Similar to `RingHom.charZero`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero_of_injective_algebraMap (L77-L82)\ntheorem charZero_of_injective_algebraMap [CommSemiring R] [Semiring A] [Algebra R A]\n (h : Function.Injective (algebraMap R A)) [CharZero R] : CharZero A :=\ncharZero_of_injective_ringHom h\n\n/-- If `R \u2192+* A` is injective, and `A` is of characteristic `p`, then `R` is also of\ncharacteristic `p`. Similar to `RingHom.charZero`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.CharP.Basic.intCast_injOn_Ico (L73-L91)\nlemma intCast_injOn_Ico [IsRightCancelAdd R] : InjOn (Int.cast : \u2124 \u2192 R) (Ico 0 p) := by\nrintro a \u27e8ha\u2080, ha\u27e9 b \u27e8hb\u2080, hb\u27e9 hab\n lift a to \u2115 using ha\u2080\n lift b to \u2115 using hb\u2080\n norm_cast at *\n exact natCast_injOn_Iio _ _ ha hb hab\n\nend AddGroupWithOne\nend CharP\n\nnamespace CharP\n\nsection NonAssocSemiring\n\nvariable {R} [NonAssocSemiring R]\n\nvariable (R) in\n/-- If a ring `R` is of characteristic `p`, then for any prime number `q` different from `p`,\nit is not zero in `R`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.CharP.Algebra.charZero_of_injective_ringHom (L72-L76)\ntheorem charZero_of_injective_ringHom [NonAssocSemiring R] [NonAssocSemiring A]\n {f : R \u2192+* A} (h : Function.Injective f) [CharZero R] : CharZero A where\n cast_injective _ _ _ := CharZero.cast_injective <| h <| by simpa only [map_natCast f]\n/-- If the algebra map `R \u2192+* A` is injective and `R` has characteristic zero then so does `A`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.CharP.Algebra.expChar (L133-L149)\ninstance expChar [ExpChar R p] : ExpChar L p := L.subtype.expChar L.subtype_injective p\nend Subfield\n\n/-!\nAs an application, a `\u211a`-algebra has characteristic zero.\n-/\n\n-- `CharP.charP_to_charZero A _ (charP_of_injective_algebraMap h 0)` does not work\n-- here as it would require `Ring A`.\nsection QAlgebra\n\nvariable (R : Type*) [Nontrivial R]\n\n/-- A nontrivial `\u211a`-algebra has `CharP` equal to zero.\n\nThis cannot be a (local) instance because it would immediately form a loop with the\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.CharP.Basic.cast_ne_zero_of_ne_of_prime (L92-L98)\nlemma cast_ne_zero_of_ne_of_prime [Nontrivial R]\n {p q : \u2115} [CharP R p] (hq : q.Prime) (hneq : p \u2260 q) : (q : R) \u2260 0 := fun h \u21a6 by\nrw [cast_eq_zero_iff R p q] at h\n rcases hq.eq_one_or_self_of_dvd _ h with rfl | h\n \u00b7 exact false_of_nontrivial_of_char_one (R := R)\n \u00b7 exact hneq h\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.CharP.Algebra.algebraRat (L153-L158)\ntheorem algebraRat.charP_zero [Semiring R] [Algebra \u211a R] : CharP R 0 :=\ncharP_of_injective_algebraMap (algebraMap \u211a R).injective 0\n\n/-- A nontrivial `\u211a`-algebra has characteristic zero.\n\nThis cannot be a (local) instance because it would immediately form a loop with the\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.CharP.Basic.intCast_eq_intCast (L67-L69)\nlemma intCast_eq_intCast : (a : R) = b \u2194 a \u2261 b [ZMOD p] := by\nrw [eq_comm, \u2190 sub_eq_zero, \u2190 Int.cast_sub, CharP.intCast_eq_zero_iff R p, Int.modEq_iff_dvd]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_eq_natCast' (L41-L46)\nlemma natCast_eq_natCast' (h : a \u2261 b [MOD p]) : (a : R) = b := by\nwlog hle : a \u2264 b\n \u00b7 exact (this R p h.symm (le_of_not_ge hle)).symm\n rw [Nat.modEq_iff_dvd' hle] at h\n rw [\u2190 Nat.sub_add_cancel hle, Nat.cast_add, (cast_eq_zero_iff R p _).mpr h, zero_add]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.CharP.Algebra.ExpChar (L124-L131)\ntheorem ExpChar.of_injective_algebraMap' [CommRing R] [CommRing A]\n [Algebra R A] [FaithfulSMul R A] (q : \u2115) [ExpChar R q] : ExpChar A q :=\nexpChar_of_injective_ringHom (FaithfulSMul.algebraMap_injective R A) q\n\nnamespace Subfield\n\nvariable [DivisionRing R] (L : Subfield R) (p : \u2115)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.CharP.Basic.intCast_eq_intCast_mod (L70-L72)\nlemma intCast_eq_intCast_mod : (a : R) = a % (p : \u2124) :=\n(CharP.intCast_eq_intCast R p).mpr (Int.mod_modEq a p).symm\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.CharP.Algebra.expChar_of_injective_algebraMap (L119-L123)\nlemma expChar_of_injective_algebraMap [CommSemiring R] [Semiring A] [Algebra R A]\n (h : Function.Injective (algebraMap R A)) (q : \u2115) [ExpChar R q] : ExpChar A q :=\nexpChar_of_injective_ringHom h q\n\nvariable (R) in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.CharP.Basic.natCast_eq_natCast_mod (L47-L51)\nlemma natCast_eq_natCast_mod (a : \u2115) : (a : R) = a % p :=\nnatCast_eq_natCast' R p (Nat.mod_modEq a p).symm\n\nvariable [IsRightCancelAdd R]\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/CharP/Two.lean", "module": "Mathlib.Algebra.CharP.Two", "declaration": "Mathlib.Algebra.CharP.Two.intCast_eq_ite", "span": "L122-L124", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/CharP/Two.lean#L122"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4928, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 13101, "lean_code_chars": 11607, "natural_language_chars": 1494, "lean_code_ratio": 0.886, "line_count": 413, "imports_count": 0, "declarations_count": 1433, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "f9be28addc788031", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Group.Subgroup.Ker.MapSubtype", "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.Algebra.Group.Subgroup.Ker)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma MapSubtype.orderIso_symm_apply (H : Subgroup G) (sH' : { H' : Subgroup G // H' \u2264 H }) :\n (MapSubtype.orderIso H).symm sH' = sH'.1.subgroupOf H\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range (L67-L69)\ndef range (f : G \u2192* N) : Subgroup N :=\nSubgroup.copy ((\u22a4 : Subgroup G).map f) (Set.range f) (by simp)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.coe_range (L71-L73)\ntheorem coe_range (f : G \u2192* N) : (f.range : Set N) = Set.range f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.mem_range (L75-L77)\ntheorem mem_range {f : G \u2192* N} {y : N} : y \u2208 f.range \u2194 \u2203 x, f x = y :=\nIff.rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_eq_map (L79-L80)\ntheorem range_eq_map (f : G \u2192* N) : f.range = (\u22a4 : Subgroup G).map f := by ext; simp\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_isMulCommutative (L82-L85)\ninstance range_isMulCommutative {G : Type*} [CommGroup G] {N : Type*} [Group N] (f : G \u2192* N) :\n IsMulCommutative f.range :=\nrange_eq_map f \u25b8 Subgroup.map_isMulCommutative \u22a4 f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.restrict_range (L87-L92)\ntheorem restrict_range (f : G \u2192* N) : (f.restrict K).range = K.map f := by\nsimp_rw [SetLike.ext_iff, mem_range, mem_map, restrict_apply, SetLike.exists,\n exists_prop, forall_const]\n\n/-- The canonical surjective group homomorphism `G \u2192* f(G)` induced by a group\nhomomorphism `G \u2192* N`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.rangeRestrict (L96-L98)\ndef rangeRestrict (f : G \u2192* N) : G \u2192* f.range :=\ncodRestrict f _ fun x => \u27e8x, rfl\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.coe_rangeRestrict (L100-L102)\ntheorem coe_rangeRestrict (f : G \u2192* N) (g : G) : (f.rangeRestrict g : N) = f g :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.coe_comp_rangeRestrict (L104-L107)\ntheorem coe_comp_rangeRestrict (f : G \u2192* N) :\n ((\u2191) : f.range \u2192 N) \u2218 (\u21d1f.rangeRestrict : G \u2192 f.range) = f :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.subtype_comp_rangeRestrict (L109-L111)\ntheorem subtype_comp_rangeRestrict (f : G \u2192* N) : f.range.subtype.comp f.rangeRestrict = f :=\next <| f.coe_rangeRestrict\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.rangeRestrict_surjective (L113-L115)\ntheorem rangeRestrict_surjective (f : G \u2192* N) : Function.Surjective f.rangeRestrict :=\nfun \u27e8_, g, rfl\u27e9 => \u27e8g, rfl\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.rangeRestrict_injective_iff (L117-L119)\nlemma rangeRestrict_injective_iff {f : G \u2192* N} : Injective f.rangeRestrict \u2194 Injective f := by\nconvert Set.injective_codRestrict _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.map_range (L121-L123)\ntheorem map_range (g : N \u2192* P) (f : G \u2192* N) : f.range.map g = (g.comp f).range := by\nrw [range_eq_map, range_eq_map]; exact (\u22a4 : Subgroup G).map_map g f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_comp (L125-L126)\nlemma range_comp (g : N \u2192* P) (f : G \u2192* N) : (g.comp f).range = f.range.map g := (map_range ..).symm\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_eq_top (L128-L132)\ntheorem range_eq_top {N} [Group N] {f : G \u2192* N} :\n f.range = (\u22a4 : Subgroup N) \u2194 Function.Surjective f :=\nSetLike.ext'_iff.trans <| Iff.trans (by rw [coe_range, coe_top]) Set.range_eq_univ\n\n/-- The range of a surjective monoid homomorphism is the whole of the codomain. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun_apply (L156-L182)\nlemma toFun_apply (x : M) (y : \u03b1) : MulAction.toFun M \u03b1 y x = x \u2022 y := rfl\nend MulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Monoid A] [MulDistribMulAction M A]\n\n/-- Pullback a multiplicative distributive multiplicative action along an injective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Injective.mulDistribMulAction [Monoid B] [SMul M B] (f : B \u2192* A)\n (hf : Injective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c x y := hf <| by simp only [smul, f.map_mul, smul_mul']\n smul_one c := hf <| by simp only [smul, f.map_one, smul_one]\n\n/-- Pushforward a multiplicative distributive multiplicative action along a surjective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Surjective.mulDistribMulAction [Monoid B] [SMul M B] (f : A \u2192* B)\n (hf : Surjective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c := by simp only [hf.forall, smul_mul', \u2190 smul, \u2190 f.map_mul, implies_true]\n smul_one c := by rw [\u2190 f.map_one, \u2190 smul, smul_one]\n\nvariable (A) in\n/-- Scalar multiplication by `r` as a `MonoidHom`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_assoc (L214-L216)\nlemma smul_assoc {M N} [SMul M N] [SMul N \u03b1] [SMul M \u03b1] [IsScalarTower M N \u03b1] (x : M) (y : N)\n (z : \u03b1) : (x \u2022 y) \u2022 z = x \u2022 y \u2022 z := IsScalarTower.smul_assoc x y z\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_eq_mul (L73-L74)\nlemma smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : a \u2022 b = a * b := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)\nlemma smul_left_cancel (g : \u03b1) {x y : \u03b2} (h : g \u2022 x = g \u2022 y) : x = y := MulAction.injective g h\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulDistribMulAction (L194-L203)\ndef MulDistribMulAction.toMonoidEnd : M \u2192* Monoid.End A where\n toFun := MulDistribMulAction.toMonoidHom A\nmap_one' := MonoidHom.ext <| one_smul M\n map_mul' x y := MonoidHom.ext <| mul_smul x y\n\nend MulDistribMulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Group A] [MulDistribMulAction M A]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.SMulCommClass (L176-L182)\nlemma SMulCommClass.symm (M N \u03b1 : Type*) [SMul M \u03b1] [SMul N \u03b1] [SMulCommClass M N \u03b1] :\n SMulCommClass N M \u03b1 where smul_comm a' a b := (smul_comm a a' b).symm\n/-- Commutativity of additive actions is a symmetric relation. This lemma can't be an instance\nbecause this would cause a loop in the instance search graph. -/\nadd_decl_doc VAddCommClass.symm\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.MulOpposite (L79-L101)\nlemma MulOpposite.smul_eq_mul_unop [Mul \u03b1] (a : \u03b1\u1d50\u1d52\u1d56) (b : \u03b1) : a \u2022 b = b * a.unop := rfl\n/-- Type class for actions by additive semigroups, with notation `g +\u1d65 p`.\n\nThe `AddSemigroupAction G P` typeclass says that the additive semigroup `G` acts additively on a\ntype `P`. More precisely this means that the action satisfies the axiom\n`(g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 (g\u2082 +\u1d65 p)`. A mathematician might simply say that the additive semigroup\n`G` acts on `P`.\n\nFor example, if `A` is an additive semigroup and `X` is a type, if a mathematician says\nsay \"let `A` act on the set `X`\" they will usually mean `[AddSemigroupAction A X]`. -/\nclass AddSemigroupAction (G P : Type*) [AddSemigroup G] extends VAdd G P where\n /-- Associativity of `+\u1d65` and `+` -/\n add_vadd : \u2200 (g\u2081 g\u2082 : G) (p : P), (g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 g\u2082 +\u1d65 p\n\n/-- Type class for actions by semigroups, with notation `g \u2022 p`.\n\nThe `SemigroupAction G P` typeclass says that the semigroup `G` acts multiplicatively on a type `P`.\nMore precisely this means that the action satisfies the axiom `(g\u2081 * g\u2082) \u2022 p = g\u2081 \u2022 (g\u2082 \u2022 p)`.\nA mathematician might simply say that the semigroup `G` acts on `P`.\n\nFor example, if `G` is a semigroup and `X` is a type, if a mathematician says\nsay \"let `G` act on the set `X`\" they will probably mean `[SemigroupAction G X]`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)\nlemma invOf_smul_eq_iff : \u215fc \u2022 x = y \u2194 x = c \u2022 y := inv_smul_eq_iff (g := unitOfInvertible c)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowAction (L100-L108)\ndef arrowAction : MulAction G (A \u2192 B) where\n smul g F a := F (g\u207b\u00b9 \u2022 a)\none_smul f := by\n change (fun x => f ((1 : G)\u207b\u00b9 \u2022 x)) = f\n simp only [inv_one, one_smul]\n mul_smul x y f := by\n change (fun a => f ((x * y)\u207b\u00b9 \u2022 a)) = (fun a => f (y\u207b\u00b9 \u2022 x\u207b\u00b9 \u2022 a))\n simp only [mul_smul, mul_inv_rev]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowMulDistribMulAction (L115-L123)\ndef arrowMulDistribMulAction : MulDistribMulAction G (A \u2192 M) where\n smul_one _ := rfl\nsmul_mul _ _ _ := rfl\n\nend Arrow\n\nnamespace IsUnit\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.IsCentralScalar (L249-L255)\nlemma IsCentralScalar.unop_smul_eq_smul {M \u03b1 : Type*} [SMul M \u03b1] [SMul M\u1d50\u1d52\u1d56 \u03b1]\n [IsCentralScalar M \u03b1] (m : M\u1d50\u1d52\u1d56) (a : \u03b1) : MulOpposite.unop m \u2022 a = m \u2022 a := by\ninduction m; exact (IsCentralScalar.op_smul_eq_smul _ a).symm\n\nexport IsCentralVAdd (op_vadd_eq_vadd unop_vadd_eq_vadd)\nexport IsCentralScalar (op_smul_eq_smul unop_smul_eq_smul)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_zpow' (L210-L213)\nlemma smul_zpow' (r : M) (x : A) (z : \u2124) : r \u2022 (x ^ z) = (r \u2022 x) ^ z :=\nmap_zpow (MulDistribMulAction.toMonoidHom A r) x z\n\nend MulDistribMulAction\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Semigroup (L218-L242)\ninstance Semigroup.isScalarTower [Semigroup \u03b1] : IsScalarTower \u03b1 \u03b1 \u03b1 := \u27e8mul_assoc\u27e9\n/-- An instance of `SMulDistribClass G R S` states that the multiplicative\naction of `G` on `S` is determined by the multiplicative actions of `G` on `R`\nand `R` on `S`.\n\nThis is similar to `IsScalarTower` except that the action of `G` distributes\nover the action of `R` on `S`.\n\nE.g. if `M/L/K` is a tower of galois extensions then `SMulDistribClass Gal(M/K) L M`. -/\nclass SMulDistribClass (G R S : Type*) [SMul G R] [SMul G S] [SMul R S] : Prop where\n smul_distrib_smul (g : G) (r : R) (s : S) : g \u2022 r \u2022 s = (g \u2022 r) \u2022 (g \u2022 s)\n\nexport SMulDistribClass (smul_distrib_smul)\n\n/-- A typeclass indicating that the right (aka `AddOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `+\u1d65`. -/\nclass IsCentralVAdd (M \u03b1 : Type*) [VAdd M \u03b1] [VAdd M\u1d43\u1d52\u1d56 \u03b1] : Prop where\n /-- The right and left actions of `M` on `\u03b1` are equal. -/\n op_vadd_eq_vadd : \u2200 (m : M) (a : \u03b1), AddOpposite.op m +\u1d65 a = m +\u1d65 a\n\n/-- A typeclass indicating that the right (aka `MulOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `\u2022`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_div' (L207-L209)\nlemma smul_div' (r : M) (x y : A) : r \u2022 (x / y) = r \u2022 x / r \u2022 y :=\nmap_div (MulDistribMulAction.toMonoidHom A r) x y\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_invOf_smul (L88-L97)\nlemma smul_eq_iff_eq_invOf_smul : c \u2022 x = y \u2194 x = \u215fc \u2022 y :=\nsmul_eq_iff_eq_inv_smul (g := unitOfInvertible c)\n\nend Monoid\nend MulAction\n\nsection Arrow\nvariable {G A B : Type*} [DivisionMonoid G] [MulAction G A]\n\n/-- If `G` acts on `A`, then it acts also on `A \u2192 B`, by `(g \u2022 F) a = F (g\u207b\u00b9 \u2022 a)`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)\nlemma smul_eq_iff_eq_inv_smul (g : \u03b1) {x y : \u03b2} : g \u2022 x = y \u2194 x = g\u207b\u00b9 \u2022 y :=\n(MulAction.toPerm g).apply_eq_iff_eq_symm_apply\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Function (L184-L188)\nlemma Function.Injective.smulCommClass [SMul M \u03b1] [SMul N \u03b1] [SMul M \u03b2] [SMul N \u03b2]\n [SMulCommClass M N \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : Injective f) (h\u2081 : \u2200 (c : M) x, f (c \u2022 x) = c \u2022 f x)\n (h\u2082 : \u2200 (c : N) x, f (c \u2022 x) = c \u2022 f x) : SMulCommClass M N \u03b1 where\n smul_comm c\u2081 c\u2082 x := hf <| by simp only [h\u2081, h\u2082, smul_comm c\u2081 c\u2082 (f x)]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)\nlemma isCancelSMul_iff_eq_one_of_smul_eq :\n IsCancelSMul \u03b1 \u03b2 \u2194 (\u2200 (g : \u03b1) (x : \u03b2), g \u2022 x = x \u2192 g = 1) := by\nrefine \u27e8fun H _ _ \u21a6 IsCancelSMul.eq_one_of_smul, fun H \u21a6 \u27e8fun g h x \u21a6 ?_\u27e9\u27e9\n rw [smul_eq_iff_eq_inv_smul, eq_comm, \u2190 mul_smul, \u2190 inv_mul_eq_one (G := \u03b1)]\n exact H (g\u207b\u00b9 * h) x\n\nend Group\n\nsection Monoid\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2] (c : \u03b1) (x y : \u03b2) [Invertible c]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_bijective (L125-L129)\ntheorem smul_bijective {m : \u03b1} (hm : IsUnit m) :\n Function.Bijective (fun (a : \u03b2) \u21a6 m \u2022 a) := by\nlift m to \u03b1\u02e3 using hm\n exact MulAction.bijective m\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smulCommClass_self (L196-L207)\ninstance smulCommClass_self (M \u03b1 : Type*) [CommMonoid M] [MulAction M \u03b1] : SMulCommClass M M \u03b1 where\n smul_comm a a' b := by rw [\u2190 mul_smul, mul_comm, mul_smul]\n/-- An instance of `VAddAssocClass M N \u03b1` states that the additive action of `M` on `\u03b1` is\ndetermined by the additive actions of `M` on `N` and `N` on `\u03b1`. -/\nclass VAddAssocClass (M N \u03b1 : Type*) [VAdd M N] [VAdd N \u03b1] [VAdd M \u03b1] : Prop where\n /-- Associativity of `+\u1d65` -/\n vadd_assoc : \u2200 (x : M) (y : N) (z : \u03b1), (x +\u1d65 y) +\u1d65 z = x +\u1d65 y +\u1d65 z\n\n/-- An instance of `IsScalarTower M N \u03b1` states that the multiplicative\naction of `M` on `\u03b1` is determined by the multiplicative actions of `M` on `N`\nand `N` on `\u03b1`. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)\ndef MulAction.toPerm (a : \u03b1) : Equiv.Perm \u03b2 :=\n\u27e8fun x => a \u2022 x, fun x => a\u207b\u00b9 \u2022 x, inv_smul_smul a, smul_inv_smul a\u27e9\n\n/-- Given an action of an additive group `\u03b1` on `\u03b2`, each `g : \u03b1` defines a permutation of `\u03b2`. -/\nadd_decl_doc AddAction.toPerm\n\n/-- `MulAction.toPerm` is injective on faithful actions. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun (L152-L154)\ndef toFun : \u03b1 \u21aa M \u2192 \u03b1 :=\n\u27e8fun y x \u21a6 x \u2022 y, fun y\u2081 y\u2082 H \u21a6 one_smul M y\u2081 \u25b8 one_smul M y\u2082 \u25b8 by convert congr_fun H 1\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.op_smul_eq_mul (L76-L77)\nlemma op_smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : MulOpposite.op a \u2022 b = b * a := rfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)\nlemma smul_left_cancel_iff (g : \u03b1) {x y : \u03b2} : g \u2022 x = g \u2022 y \u2194 x = y :=\n(MulAction.injective g).eq_iff\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Mul (L61-L65)\ndef Mul.toSMul (\u03b1 : Type*) [Mul \u03b1] : SMul \u03b1 \u03b1 := \u27e8(\u00b7 * \u00b7)\u27e9\n/-- Like `Mul.toSMul`, but multiplies on the right.\n\nSee also `Monoid.toOppositeMulAction` and `MonoidWithZero.toOppositeMulActionWithZero`. -/\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.Algebra.Group.Subgroup.Ker).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma MapSubtype.orderIso_symm_apply (H : Subgroup G) (sH' : { H' : Subgroup G // H' \u2264 H }) :\n (MapSubtype.orderIso H).symm sH' = sH'.1.subgroupOf H\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range (L67-L69)\ndef range (f : G \u2192* N) : Subgroup N :=\nSubgroup.copy ((\u22a4 : Subgroup G).map f) (Set.range f) (by simp)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.coe_range (L71-L73)\ntheorem coe_range (f : G \u2192* N) : (f.range : Set N) = Set.range f :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.mem_range (L75-L77)\ntheorem mem_range {f : G \u2192* N} {y : N} : y \u2208 f.range \u2194 \u2203 x, f x = y :=\nIff.rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_eq_map (L79-L80)\ntheorem range_eq_map (f : G \u2192* N) : f.range = (\u22a4 : Subgroup G).map f := by ext; simp\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_isMulCommutative (L82-L85)\ninstance range_isMulCommutative {G : Type*} [CommGroup G] {N : Type*} [Group N] (f : G \u2192* N) :\n IsMulCommutative f.range :=\nrange_eq_map f \u25b8 Subgroup.map_isMulCommutative \u22a4 f\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.restrict_range (L87-L92)\ntheorem restrict_range (f : G \u2192* N) : (f.restrict K).range = K.map f := by\nsimp_rw [SetLike.ext_iff, mem_range, mem_map, restrict_apply, SetLike.exists,\n exists_prop, forall_const]\n\n/-- The canonical surjective group homomorphism `G \u2192* f(G)` induced by a group\nhomomorphism `G \u2192* N`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.rangeRestrict (L96-L98)\ndef rangeRestrict (f : G \u2192* N) : G \u2192* f.range :=\ncodRestrict f _ fun x => \u27e8x, rfl\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.coe_rangeRestrict (L100-L102)\ntheorem coe_rangeRestrict (f : G \u2192* N) (g : G) : (f.rangeRestrict g : N) = f g :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.coe_comp_rangeRestrict (L104-L107)\ntheorem coe_comp_rangeRestrict (f : G \u2192* N) :\n ((\u2191) : f.range \u2192 N) \u2218 (\u21d1f.rangeRestrict : G \u2192 f.range) = f :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.subtype_comp_rangeRestrict (L109-L111)\ntheorem subtype_comp_rangeRestrict (f : G \u2192* N) : f.range.subtype.comp f.rangeRestrict = f :=\next <| f.coe_rangeRestrict\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.rangeRestrict_surjective (L113-L115)\ntheorem rangeRestrict_surjective (f : G \u2192* N) : Function.Surjective f.rangeRestrict :=\nfun \u27e8_, g, rfl\u27e9 => \u27e8g, rfl\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.rangeRestrict_injective_iff (L117-L119)\nlemma rangeRestrict_injective_iff {f : G \u2192* N} : Injective f.rangeRestrict \u2194 Injective f := by\nconvert Set.injective_codRestrict _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.map_range (L121-L123)\ntheorem map_range (g : N \u2192* P) (f : G \u2192* N) : f.range.map g = (g.comp f).range := by\nrw [range_eq_map, range_eq_map]; exact (\u22a4 : Subgroup G).map_map g f\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_comp (L125-L126)\nlemma range_comp (g : N \u2192* P) (f : G \u2192* N) : (g.comp f).range = f.range.map g := (map_range ..).symm\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Group.Subgroup.Ker.range_eq_top (L128-L132)\ntheorem range_eq_top {N} [Group N] {f : G \u2192* N} :\n f.range = (\u22a4 : Subgroup N) \u2194 Function.Surjective f :=\nSetLike.ext'_iff.trans <| Iff.trans (by rw [coe_range, coe_top]) Set.range_eq_univ\n\n/-- The range of a surjective monoid homomorphism is the whole of the codomain. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun_apply (L156-L182)\nlemma toFun_apply (x : M) (y : \u03b1) : MulAction.toFun M \u03b1 y x = x \u2022 y := rfl\nend MulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Monoid A] [MulDistribMulAction M A]\n\n/-- Pullback a multiplicative distributive multiplicative action along an injective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Injective.mulDistribMulAction [Monoid B] [SMul M B] (f : B \u2192* A)\n (hf : Injective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c x y := hf <| by simp only [smul, f.map_mul, smul_mul']\n smul_one c := hf <| by simp only [smul, f.map_one, smul_one]\n\n/-- Pushforward a multiplicative distributive multiplicative action along a surjective monoid\nhomomorphism. -/\n-- See note [reducible non-instances]\nprotected abbrev Function.Surjective.mulDistribMulAction [Monoid B] [SMul M B] (f : A \u2192* B)\n (hf : Surjective f) (smul : \u2200 (c : M) (x), f (c \u2022 x) = c \u2022 f x) : MulDistribMulAction M B where\n __ := hf.mulAction f smul\n smul_mul c := by simp only [hf.forall, smul_mul', \u2190 smul, \u2190 f.map_mul, implies_true]\n smul_one c := by rw [\u2190 f.map_one, \u2190 smul, smul_one]\n\nvariable (A) in\n/-- Scalar multiplication by `r` as a `MonoidHom`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_assoc (L214-L216)\nlemma smul_assoc {M N} [SMul M N] [SMul N \u03b1] [SMul M \u03b1] [IsScalarTower M N \u03b1] (x : M) (y : N)\n (z : \u03b1) : (x \u2022 y) \u2022 z = x \u2022 y \u2022 z := IsScalarTower.smul_assoc x y z\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smul_eq_mul (L73-L74)\nlemma smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : a \u2022 b = a * b := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)\nlemma smul_left_cancel (g : \u03b1) {x y : \u03b2} (h : g \u2022 x = g \u2022 y) : x = y := MulAction.injective g h\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulDistribMulAction (L194-L203)\ndef MulDistribMulAction.toMonoidEnd : M \u2192* Monoid.End A where\n toFun := MulDistribMulAction.toMonoidHom A\nmap_one' := MonoidHom.ext <| one_smul M\n map_mul' x y := MonoidHom.ext <| mul_smul x y\n\nend MulDistribMulAction\n\nsection MulDistribMulAction\nvariable [Monoid M] [Group A] [MulDistribMulAction M A]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.SMulCommClass (L176-L182)\nlemma SMulCommClass.symm (M N \u03b1 : Type*) [SMul M \u03b1] [SMul N \u03b1] [SMulCommClass M N \u03b1] :\n SMulCommClass N M \u03b1 where smul_comm a' a b := (smul_comm a a' b).symm\n/-- Commutativity of additive actions is a symmetric relation. This lemma can't be an instance\nbecause this would cause a loop in the instance search graph. -/\nadd_decl_doc VAddCommClass.symm\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.MulOpposite (L79-L101)\nlemma MulOpposite.smul_eq_mul_unop [Mul \u03b1] (a : \u03b1\u1d50\u1d52\u1d56) (b : \u03b1) : a \u2022 b = b * a.unop := rfl\n/-- Type class for actions by additive semigroups, with notation `g +\u1d65 p`.\n\nThe `AddSemigroupAction G P` typeclass says that the additive semigroup `G` acts additively on a\ntype `P`. More precisely this means that the action satisfies the axiom\n`(g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 (g\u2082 +\u1d65 p)`. A mathematician might simply say that the additive semigroup\n`G` acts on `P`.\n\nFor example, if `A` is an additive semigroup and `X` is a type, if a mathematician says\nsay \"let `A` act on the set `X`\" they will usually mean `[AddSemigroupAction A X]`. -/\nclass AddSemigroupAction (G P : Type*) [AddSemigroup G] extends VAdd G P where\n /-- Associativity of `+\u1d65` and `+` -/\n add_vadd : \u2200 (g\u2081 g\u2082 : G) (p : P), (g\u2081 + g\u2082) +\u1d65 p = g\u2081 +\u1d65 g\u2082 +\u1d65 p\n\n/-- Type class for actions by semigroups, with notation `g \u2022 p`.\n\nThe `SemigroupAction G P` typeclass says that the semigroup `G` acts multiplicatively on a type `P`.\nMore precisely this means that the action satisfies the axiom `(g\u2081 * g\u2082) \u2022 p = g\u2081 \u2022 (g\u2082 \u2022 p)`.\nA mathematician might simply say that the semigroup `G` acts on `P`.\n\nFor example, if `G` is a semigroup and `X` is a type, if a mathematician says\nsay \"let `G` act on the set `X`\" they will probably mean `[SemigroupAction G X]`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)\nlemma invOf_smul_eq_iff : \u215fc \u2022 x = y \u2194 x = c \u2022 y := inv_smul_eq_iff (g := unitOfInvertible c)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowAction (L100-L108)\ndef arrowAction : MulAction G (A \u2192 B) where\n smul g F a := F (g\u207b\u00b9 \u2022 a)\none_smul f := by\n change (fun x => f ((1 : G)\u207b\u00b9 \u2022 x)) = f\n simp only [inv_one, one_smul]\n mul_smul x y f := by\n change (fun a => f ((x * y)\u207b\u00b9 \u2022 a)) = (fun a => f (y\u207b\u00b9 \u2022 x\u207b\u00b9 \u2022 a))\n simp only [mul_smul, mul_inv_rev]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.arrowMulDistribMulAction (L115-L123)\ndef arrowMulDistribMulAction : MulDistribMulAction G (A \u2192 M) where\n smul_one _ := rfl\nsmul_mul _ _ _ := rfl\n\nend Arrow\n\nnamespace IsUnit\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.IsCentralScalar (L249-L255)\nlemma IsCentralScalar.unop_smul_eq_smul {M \u03b1 : Type*} [SMul M \u03b1] [SMul M\u1d50\u1d52\u1d56 \u03b1]\n [IsCentralScalar M \u03b1] (m : M\u1d50\u1d52\u1d56) (a : \u03b1) : MulOpposite.unop m \u2022 a = m \u2022 a := by\ninduction m; exact (IsCentralScalar.op_smul_eq_smul _ a).symm\n\nexport IsCentralVAdd (op_vadd_eq_vadd unop_vadd_eq_vadd)\nexport IsCentralScalar (op_smul_eq_smul unop_smul_eq_smul)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_zpow' (L210-L213)\nlemma smul_zpow' (r : M) (x : A) (z : \u2124) : r \u2022 (x ^ z) = (r \u2022 x) ^ z :=\nmap_zpow (MulDistribMulAction.toMonoidHom A r) x z\n\nend MulDistribMulAction\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Semigroup (L218-L242)\ninstance Semigroup.isScalarTower [Semigroup \u03b1] : IsScalarTower \u03b1 \u03b1 \u03b1 := \u27e8mul_assoc\u27e9\n/-- An instance of `SMulDistribClass G R S` states that the multiplicative\naction of `G` on `S` is determined by the multiplicative actions of `G` on `R`\nand `R` on `S`.\n\nThis is similar to `IsScalarTower` except that the action of `G` distributes\nover the action of `R` on `S`.\n\nE.g. if `M/L/K` is a tower of galois extensions then `SMulDistribClass Gal(M/K) L M`. -/\nclass SMulDistribClass (G R S : Type*) [SMul G R] [SMul G S] [SMul R S] : Prop where\n smul_distrib_smul (g : G) (r : R) (s : S) : g \u2022 r \u2022 s = (g \u2022 r) \u2022 (g \u2022 s)\n\nexport SMulDistribClass (smul_distrib_smul)\n\n/-- A typeclass indicating that the right (aka `AddOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `+\u1d65`. -/\nclass IsCentralVAdd (M \u03b1 : Type*) [VAdd M \u03b1] [VAdd M\u1d43\u1d52\u1d56 \u03b1] : Prop where\n /-- The right and left actions of `M` on `\u03b1` are equal. -/\n op_vadd_eq_vadd : \u2200 (m : M) (a : \u03b1), AddOpposite.op m +\u1d65 a = m +\u1d65 a\n\n/-- A typeclass indicating that the right (aka `MulOpposite`) and left actions by `M` on `\u03b1` are\nequal, that is that `M` acts centrally on `\u03b1`. This can be thought of as a version of commutativity\nfor `\u2022`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_div' (L207-L209)\nlemma smul_div' (r : M) (x y : A) : r \u2022 (x / y) = r \u2022 x / r \u2022 y :=\nmap_div (MulDistribMulAction.toMonoidHom A r) x y\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_invOf_smul (L88-L97)\nlemma smul_eq_iff_eq_invOf_smul : c \u2022 x = y \u2194 x = \u215fc \u2022 y :=\nsmul_eq_iff_eq_inv_smul (g := unitOfInvertible c)\n\nend Monoid\nend MulAction\n\nsection Arrow\nvariable {G A B : Type*} [DivisionMonoid G] [MulAction G A]\n\n/-- If `G` acts on `A`, then it acts also on `A \u2192 B`, by `(g \u2022 F) a = F (g\u207b\u00b9 \u2022 a)`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)\nlemma smul_eq_iff_eq_inv_smul (g : \u03b1) {x y : \u03b2} : g \u2022 x = y \u2194 x = g\u207b\u00b9 \u2022 y :=\n(MulAction.toPerm g).apply_eq_iff_eq_symm_apply\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Function (L184-L188)\nlemma Function.Injective.smulCommClass [SMul M \u03b1] [SMul N \u03b1] [SMul M \u03b2] [SMul N \u03b2]\n [SMulCommClass M N \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : Injective f) (h\u2081 : \u2200 (c : M) x, f (c \u2022 x) = c \u2022 f x)\n (h\u2082 : \u2200 (c : N) x, f (c \u2022 x) = c \u2022 f x) : SMulCommClass M N \u03b1 where\n smul_comm c\u2081 c\u2082 x := hf <| by simp only [h\u2081, h\u2082, smul_comm c\u2081 c\u2082 (f x)]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)\nlemma isCancelSMul_iff_eq_one_of_smul_eq :\n IsCancelSMul \u03b1 \u03b2 \u2194 (\u2200 (g : \u03b1) (x : \u03b2), g \u2022 x = x \u2192 g = 1) := by\nrefine \u27e8fun H _ _ \u21a6 IsCancelSMul.eq_one_of_smul, fun H \u21a6 \u27e8fun g h x \u21a6 ?_\u27e9\u27e9\n rw [smul_eq_iff_eq_inv_smul, eq_comm, \u2190 mul_smul, \u2190 inv_mul_eq_one (G := \u03b1)]\n exact H (g\u207b\u00b9 * h) x\n\nend Group\n\nsection Monoid\nvariable [Monoid \u03b1] [MulAction \u03b1 \u03b2] (c : \u03b1) (x y : \u03b2) [Invertible c]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_bijective (L125-L129)\ntheorem smul_bijective {m : \u03b1} (hm : IsUnit m) :\n Function.Bijective (fun (a : \u03b2) \u21a6 m \u2022 a) := by\nlift m to \u03b1\u02e3 using hm\n exact MulAction.bijective m\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.smulCommClass_self (L196-L207)\ninstance smulCommClass_self (M \u03b1 : Type*) [CommMonoid M] [MulAction M \u03b1] : SMulCommClass M M \u03b1 where\n smul_comm a a' b := by rw [\u2190 mul_smul, mul_comm, mul_smul]\n/-- An instance of `VAddAssocClass M N \u03b1` states that the additive action of `M` on `\u03b1` is\ndetermined by the additive actions of `M` on `N` and `N` on `\u03b1`. -/\nclass VAddAssocClass (M N \u03b1 : Type*) [VAdd M N] [VAdd N \u03b1] [VAdd M \u03b1] : Prop where\n /-- Associativity of `+\u1d65` -/\n vadd_assoc : \u2200 (x : M) (y : N) (z : \u03b1), (x +\u1d65 y) +\u1d65 z = x +\u1d65 y +\u1d65 z\n\n/-- An instance of `IsScalarTower M N \u03b1` states that the multiplicative\naction of `M` on `\u03b1` is determined by the multiplicative actions of `M` on `N`\nand `N` on `\u03b1`. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)\ndef MulAction.toPerm (a : \u03b1) : Equiv.Perm \u03b2 :=\n\u27e8fun x => a \u2022 x, fun x => a\u207b\u00b9 \u2022 x, inv_smul_smul a, smul_inv_smul a\u27e9\n\n/-- Given an action of an additive group `\u03b1` on `\u03b2`, each `g : \u03b1` defines a permutation of `\u03b2`. -/\nadd_decl_doc AddAction.toPerm\n\n/-- `MulAction.toPerm` is injective on faithful actions. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.toFun (L152-L154)\ndef toFun : \u03b1 \u21aa M \u2192 \u03b1 :=\n\u27e8fun y x \u21a6 x \u2022 y, fun y\u2081 y\u2082 H \u21a6 one_smul M y\u2081 \u25b8 one_smul M y\u2082 \u25b8 by convert congr_fun H 1\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.op_smul_eq_mul (L76-L77)\nlemma op_smul_eq_mul {\u03b1 : Type*} [Mul \u03b1] (a b : \u03b1) : MulOpposite.op a \u2022 b = b * a := rfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)\nlemma smul_left_cancel_iff (g : \u03b1) {x y : \u03b2} : g \u2022 x = g \u2022 y \u2194 x = y :=\n(MulAction.injective g).eq_iff\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Group.Action.Defs.Mul (L61-L65)\ndef Mul.toSMul (\u03b1 : Type*) [Mul \u03b1] : SMul \u03b1 \u03b1 := \u27e8(\u00b7 * \u00b7)\u27e9\n/-- Like `Mul.toSMul`, but multiplies on the right.\n\nSee also `Monoid.toOppositeMulAction` and `MonoidWithZero.toOppositeMulActionWithZero`. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Group/Subgroup/Ker.lean", "module": "Mathlib.Algebra.Group.Subgroup.Ker", "declaration": "Mathlib.Algebra.Group.Subgroup.Ker.MapSubtype", "span": "L496-L499", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Subgroup/Ker.lean#L496"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 5699, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 15015, "lean_code_chars": 13512, "natural_language_chars": 1503, "lean_code_ratio": 0.8999, "line_count": 421, "imports_count": 0, "declarations_count": 1785, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "2877a3c4c419101f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.Coalgebra.Basic.rTensor_counit_comul", "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.RingTheory.Coalgebra.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem rTensor_counit_comul (a : A) : counit.rTensor A (comul a) = 1 \u2297\u209c[R] a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.coassoc_apply (L95-L98)\ntheorem coassoc_apply (a : A) :\n TensorProduct.assoc R A A A (comul.rTensor A (comul a)) = comul.lTensor A (comul a) :=\nLinearMap.congr_fun coassoc a\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.coassoc_symm_apply (L100-L103)\ntheorem coassoc_symm_apply (a : A) :\n (TensorProduct.assoc R A A A).symm (comul.lTensor A (comul a)) = comul.rTensor A (comul a) := by\nrw [(TensorProduct.assoc R A A A).symm_apply_eq, coassoc_apply a]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.coassoc_symm (L105-L109)\ntheorem coassoc_symm :\n (TensorProduct.assoc R A A A).symm \u2218\u2097 comul.lTensor A \u2218\u2097 comul =\n comul.rTensor A \u2218\u2097 (comul (R := R)) :=\nLinearMap.ext coassoc_symm_apply\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.lTensor_counit_comul (L115-L117)\ntheorem lTensor_counit_comul (a : A) : counit.lTensor A (comul a) = a \u2297\u209c[R] 1 :=\nLinearMap.congr_fun lTensor_counit_comp_comul a\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_counit_tmul_eq (L119-L122)\nlemma sum_counit_tmul_eq {a : A} (repr : Coalgebra.Repr R a) :\n \u2211 i \u2208 repr.index, counit (R := R) (repr.left i) \u2297\u209c (repr.right i) = 1 \u2297\u209c[R] a := by\nsimpa [\u2190 repr.eq, map_sum] using congr($(rTensor_counit_comp_comul (R := R) (A := A)) a)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_tmul_counit_eq (L124-L128)\nlemma sum_tmul_counit_eq {a : A} (repr : Coalgebra.Repr R a) :\n \u2211 i \u2208 repr.index, (repr.left i) \u2297\u209c counit (R := R) (repr.right i) = a \u2297\u209c[R] 1 := by\nsimpa [\u2190 repr.eq, map_sum] using congr($(lTensor_counit_comp_comul (R := R) (A := A)) a)\n\n-- Cannot be @[simp] because `a\u2082` cannot be inferred by `simp`.\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_tmul_tmul_eq (L129-L137)\nlemma sum_tmul_tmul_eq {a : A} (repr : Repr R a)\n (a\u2081 : (i : repr.\u03b9) \u2192 Repr R (repr.left i)) (a\u2082 : (i : repr.\u03b9) \u2192 Repr R (repr.right i)) :\n \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2081 i).index,\n (a\u2081 i).left j \u2297\u209c[R] ((a\u2081 i).right j \u2297\u209c[R] repr.right i)\n = \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2082 i).index,\n repr.left i \u2297\u209c[R] ((a\u2082 i).left j \u2297\u209c[R] (a\u2082 i).right j) := by\nsimpa [(a\u2082 _).eq, \u2190 (a\u2081 _).eq, \u2190 TensorProduct.tmul_sum,\n TensorProduct.sum_tmul, \u2190 repr.eq] using congr($(coassoc (R := R)) a)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_counit_tmul_map_eq (L139-L145)\ntheorem sum_counit_tmul_map_eq {B : Type*} [AddCommMonoid B] [Module R B]\n {F : Type*} [FunLike F A B] [LinearMapClass F R A B] (f : F) (a : A) {repr : Repr R a} :\n \u2211 i \u2208 repr.index, counit (R := R) (repr.left i) \u2297\u209c f (repr.right i) = 1 \u2297\u209c[R] f a := by\nhave := sum_counit_tmul_eq repr\n apply_fun LinearMap.lTensor R (f : A \u2192\u2097[R] B) at this\n simp_all only [map_sum, LinearMap.lTensor_tmul, LinearMap.coe_coe]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_map_tmul_counit_eq (L147-L154)\ntheorem sum_map_tmul_counit_eq {B : Type*} [AddCommMonoid B] [Module R B]\n {F : Type*} [FunLike F A B] [LinearMapClass F R A B] (f : F) (a : A) {repr : Repr R a} :\n \u2211 i \u2208 repr.index, f (repr.left i) \u2297\u209c counit (R := R) (repr.right i) = f a \u2297\u209c[R] 1 := by\nhave := sum_tmul_counit_eq repr\n apply_fun LinearMap.rTensor R (f : A \u2192\u2097[R] B) at this\n simp_all only [map_sum, LinearMap.rTensor_tmul, LinearMap.coe_coe]\n\n-- Cannot be @[simp] because `a\u2081` cannot be inferred by `simp`.\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_map_tmul_tmul_eq (L155-L166)\ntheorem sum_map_tmul_tmul_eq {B : Type*} [AddCommMonoid B] [Module R B]\n {F : Type*} [FunLike F A B] [LinearMapClass F R A B] (f g h : F) (a : A) {repr : Repr R a}\n {a\u2081 : (i : repr.\u03b9) \u2192 Repr R (repr.left i)} {a\u2082 : (i : repr.\u03b9) \u2192 Repr R (repr.right i)} :\n \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2082 i).index,\n f (repr.left i) \u2297\u209c (g ((a\u2082 i).left j) \u2297\u209c h ((a\u2082 i).right j)) =\n \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2081 i).index,\n f ((a\u2081 i).left j) \u2297\u209c[R] (g ((a\u2081 i).right j) \u2297\u209c[R] h (repr.right i)) := by\nhave := sum_tmul_tmul_eq repr a\u2081 a\u2082\n apply_fun TensorProduct.map (f : A \u2192\u2097[R] B)\n (TensorProduct.map (g : A \u2192\u2097[R] B) (h : A \u2192\u2097[R] B)) at this\n simp_all only [map_sum, TensorProduct.map_tmul, LinearMap.coe_coe]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_counit_smul (L167-L171)\nlemma sum_counit_smul (\ud835\udce1 : Repr R a) :\n \u2211 x \u2208 \ud835\udce1.index, counit (R := R) (\ud835\udce1.left x) \u2022 \ud835\udce1.right x = a := by\nsimpa only [map_sum, TensorProduct.lift.tmul, LinearMap.lsmul_apply, one_smul]\n using congr(TensorProduct.lift (LinearMap.lsmul R A) $(sum_counit_tmul_eq (R := R) \ud835\udce1))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.lift_lsmul_comp_counit_comp_comul (L172-L189)\nlemma lift_lsmul_comp_counit_comp_comul :\n TensorProduct.lift (.lsmul R A \u2218\u2097 counit) \u2218\u2097 comul = .id := by\nhave := rTensor_counit_comp_comul (R := R) (A := A)\n apply_fun (TensorProduct.lift (LinearMap.lsmul R A) \u2218\u2097 \u00b7) at this\n rw [LinearMap.rTensor, \u2190 LinearMap.comp_assoc, TensorProduct.lift_comp_map, LinearMap.compl\u2082_id]\n at this\n ext\n simp [this]\n\nvariable (R A) in\n/-- A coalgebra `A` is cocommutative if its comultiplication `\u03b4 : A \u2192 A \u2297 A` commutes with the\nswapping `\u03b2 : A \u2297 A \u2243 A \u2297 A` of the factors in the tensor product. -/\nclass IsCocomm where\n protected comm_comp_comul : (TensorProduct.comm R A A).comp comul = comul\n\nvariable [IsCocomm R A]\n\nvariable (R A) in\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.toCoalgebra (L205-L211)\ninstance toCoalgebra : Coalgebra R R where\n comul := (TensorProduct.mk R R R) 1\ncounit := .id\n coassoc := rfl\n rTensor_counit_comp_comul := by ext; rfl\n lTensor_counit_comp_comul := by ext; rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.comul_apply (L213-L214)\ntheorem comul_apply (r : R) : comul r = 1 \u2297\u209c[R] r := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.counit_apply (L216-L217)\ntheorem counit_apply (r : R) : counit r = r := rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgEquiv (L58-L61)\ndef toCoalgEquiv [EquivLike F A B] [CoalgEquivClass F R A B] (f : F) : A \u2243\u2097c[R] B :=\n{ (f : A \u2192\u2097c[R] B), (f : A \u2243\u2097[R] B) with }\n\n/-- Reinterpret an element of a type of coalgebra equivalences as a coalgebra equivalence. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgHom_inj (L110-L112)\ntheorem toCoalgHom_inj {e\u2081 e\u2082 : A \u2243\u2097c[R] B} : (\u2191e\u2081 : A \u2192\u2097c[R] B) = e\u2082 \u2194 e\u2081 = e\u2082 :=\ntoCoalgHom_injective.eq_iff\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convNonUnitalSemiring (L123-L144)\ninstance convNonUnitalSemiring : NonUnitalSemiring (WithConv (C \u2192\u2097[R] A)) where\n mul_assoc f g h := toConv_injective.eq_iff.mpr <| calc\n_ = (\u03bc \u2218\u2097 rTensor _ \u03bc) \u2218\u2097 (((f.ofConv \u2297\u2098 g.ofConv) \u2297\u2098 h.ofConv) \u2218\u2097\n (TensorProduct.assoc R C C C).symm) \u2218\u2097 lTensor C \u03b4 \u2218\u2097 \u03b4 := by\n ext; simp [comp_assoc, coassoc_symm, convMul_def]\n _ = (\u03bc \u2218\u2097 rTensor A \u03bc \u2218\u2097 \u2191(TensorProduct.assoc R A A A).symm) \u2218\u2097\n (f.ofConv \u2297\u2098 (g.ofConv \u2297\u2098 h.ofConv)) \u2218\u2097 lTensor C \u03b4 \u2218\u2097 \u03b4 := by\n simp only [map_map_comp_assoc_symm_eq, comp_assoc]\n _ = (\u03bc \u2218\u2097 .lTensor _ \u03bc) \u2218\u2097 (f.ofConv \u2297\u2098 (g.ofConv \u2297\u2098 h.ofConv)) \u2218\u2097 (lTensor C \u03b4 \u2218\u2097 \u03b4) := by\n congr 1\n ext\n simp [mul_assoc]\n _ = \u03bc \u2218\u2097 (f.ofConv \u2297\u2098 \u03bc \u2218\u2097 (g.ofConv \u2297\u2098 h.ofConv) \u2218\u2097 \u03b4) \u2218\u2097 \u03b4 := by ext; simp\n\nend NonUnitalSemiring\n\nsection NonUnitalRing\nvariable [NonUnitalRing A] [AddCommMonoid C] [Module R A] [SMulCommClass R A A]\n [IsScalarTower R A A] [Module R C] [Coalgebra R C]\n\n/-- Non-unital convolution ring structure on linear maps from a coalgebra to a\nnon-unital algebra. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_coe (L127-L129)\ntheorem coe_coe : \u21d1(e : A \u2192\u2097c[R] B) = e :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_toLinearEquiv (L139-L141)\ntheorem coe_toLinearEquiv : \u21d1(e : A \u2243\u2097[R] B) = e :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul_comp_coalgHom_distrib (L115-L122)\nlemma convMul_comp_coalgHom_distrib [AddCommMonoid B] [Module R B] [CoalgebraStruct R B]\n (f g : WithConv (C \u2192\u2097[R] A)) (h : B \u2192\u2097c[R] C) :\n (f * g).ofConv.comp h.toLinearMap =\n (toConv (f.ofConv.comp h.toLinearMap) * toConv (g.ofConv.comp h.toLinearMap)).ofConv := by\nsimp [convMul_def, map_comp, comp_assoc]\n\n/-- Non-unital convolution semiring structure on linear maps from a coalgebra to a\nnon-unital algebra. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul_apply (L62-L64)\nlemma convMul_apply (f g : WithConv (C \u2192\u2097[R] A)) (c : C) :\n (f * g) c = mul' R A (.map f.ofConv g.ofConv (comul c)) := rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul (L55-L57)\ninstance convMul : Mul (WithConv (C \u2192\u2097[R] A)) where\n mul f g := toConv (mul' R A \u2218\u2097 map f.ofConv g.ofConv \u2218\u2097 comul)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_toCoalgHom (L143-L145)\ntheorem coe_toCoalgHom : \u21d1(e : A \u2192\u2097c[R] B) = e :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convOne (L165-L166)\ninstance convOne : One (WithConv (C \u2192\u2097[R] A)) where one := toConv (Algebra.linearMap R A \u2218\u2097 counit)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.instCoeToCoalgEquiv (L62-L71)\ninstance instCoeToCoalgEquiv\n [EquivLike F A B] [CoalgEquivClass F R A B] : CoeHead F (A \u2243\u2097c[R] B) where\n coe f := toCoalgEquiv f\nend CoalgEquivClass\n\nnamespace CoalgEquiv\n\nvariable [CommSemiring R]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgHom_eq_coe (L135-L137)\ntheorem toCoalgHom_eq_coe (f : A \u2243\u2097c[R] B) : f.toCoalgHom = f :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.algHom_comp_convMul_distrib (L155-L164)\nlemma algHom_comp_convMul_distrib (h : A \u2192\u2090 B) (f g : WithConv (C \u2192\u2097[R] A)) :\n h.toLinearMap.comp (f * g).ofConv =\n (toConv (h.toLinearMap.comp f.ofConv) * toConv (h.toLinearMap.comp g.ofConv)).ofConv := by\nsimp [convMul_def, map_comp, \u2190 comp_assoc, AlgHom.comp_mul']\n\nend CoalgebraStruct\n\nvariable [Coalgebra R C]\n\n/-- Convolution unit on linear maps from a coalgebra to an algebra. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convNonUnitalNonAssocSemiring (L71-L76)\ninstance convNonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring (WithConv (C \u2192\u2097[R] A)) where\n left_distrib f g h := by ext; simp [map_add_right]\nright_distrib f g h := by ext; simp [map_add_left]\n zero_mul f := by ext; simp\n mul_zero f := by ext; simp\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toLinearEquiv_eq_coe (L131-L133)\ntheorem toLinearEquiv_eq_coe (f : A \u2243\u2097c[R] B) : f.toLinearEquiv = f :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convOne_def (L167-L168)\nlemma convOne_def : (1 : WithConv (C \u2192\u2097[R] A)) = toConv (Algebra.linearMap R A \u2218\u2097 counit) := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul_def (L58-L60)\nlemma convMul_def (f g : WithConv (C \u2192\u2097[R] A)) :\n f * g = toConv (mul' R A \u2218\u2097 map f.ofConv g.ofConv \u2218\u2097 comul) := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_mk (L114-L116)\ntheorem coe_mk {f h h\u2080 h\u2081 h\u2082 h\u2083 h\u2084 h\u2085} :\n (\u27e8\u27e8\u27e8\u27e8f, h\u27e9, h\u2080\u27e9, h\u2081, h\u2082\u27e9, h\u2083, h\u2084, h\u2085\u27e9 : A \u2243\u2097c[R] B) = f := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toEquiv_inj (L86-L88)\ntheorem toEquiv_inj {e\u2081 e\u2082 : A \u2243\u2097c[R] B} : e\u2081.toEquiv = e\u2082.toEquiv \u2194 e\u2081 = e\u2082 :=\ntoEquiv_injective.eq_iff\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.nonUnitalAlgHom_comp_convMul_distrib (L108-L114)\nlemma nonUnitalAlgHom_comp_convMul_distrib\n [NonUnitalNonAssocSemiring B] [Module R B] [SMulCommClass R B B] [IsScalarTower R B B]\n (h : A \u2192\u2099\u2090[R] B) (f g : WithConv (C \u2192\u2097[R] A)) :\n (h : A \u2192\u2097[R] B).comp (f * g).ofConv =\n (toConv ((h : A \u2192\u2097[R] B).comp f.ofConv) * toConv ((h : A \u2192\u2097[R] B).comp g.ofConv)).ofConv := by\nsimp [convMul_def, map_comp, \u2190 comp_assoc, NonUnitalAlgHom.comp_mul']\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convSemiring (L173-L184)\ninstance convSemiring : Semiring (WithConv (C \u2192\u2097[R] A)) where\n one_mul f := by ext; simp [convOne_def, \u2190 map_comp_rTensor]\nmul_one f := by ext; simp [convOne_def, \u2190 map_comp_lTensor]\n\nend Semiring\n\nsection CommSemiring\nvariable [CommSemiring A] [AddCommMonoid C] [Algebra R A] [Module R C] [Coalgebra R C]\n [IsCocomm R C]\n\n/-- Commutative convolution semiring structure on linear maps from a cocommutative coalgebra to an\nalgebra. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convCommSemiring (L185-L193)\ninstance convCommSemiring : CommSemiring (WithConv (C \u2192\u2097[R] A)) where\n mul_comm f g := by ext x; rw [convMul_apply, \u2190 comm_comul R x, map_comm, mul'_comm, convMul_apply]\nend CommSemiring\n\nsection Ring\nvariable [Ring A] [AddCommMonoid C] [Algebra R A] [Module R C] [Coalgebra R C]\n\n/-- Convolution ring structure on linear maps from a coalgebra to an algebra. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toEquiv_injective (L80-L84)\ntheorem toEquiv_injective : Function.Injective (toEquiv : (A \u2243\u2097c[R] B) \u2192 A \u2243 B) :=\nfun \u27e8_, _, _, _\u27e9 \u27e8_, _, _, _\u27e9 h =>\n (CoalgEquiv.mk.injEq _ _ _ _ _ _ _ _).mpr\n \u27e8CoalgHom.ext (congr_fun (Equiv.mk.inj h).1), (Equiv.mk.inj h).2\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toEquiv (L78-L79)\ndef toEquiv : (A \u2243\u2097c[R] B) \u2192 A \u2243 B := fun f => f.toLinearEquiv.toEquiv\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgHom_injective (L89-L91)\ntheorem toCoalgHom_injective : Function.Injective (toCoalgHom : (A \u2243\u2097c[R] B) \u2192 A \u2192\u2097c[R] B) :=\nfun _ _ H => toEquiv_injective <| Equiv.ext <| CoalgHom.congr_fun H\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.RingTheory.Coalgebra.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 rTensor_counit_comul (a : A) : counit.rTensor A (comul a) = 1 \u2297\u209c[R] a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.coassoc_apply (L95-L98)\ntheorem coassoc_apply (a : A) :\n TensorProduct.assoc R A A A (comul.rTensor A (comul a)) = comul.lTensor A (comul a) :=\nLinearMap.congr_fun coassoc a\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.coassoc_symm_apply (L100-L103)\ntheorem coassoc_symm_apply (a : A) :\n (TensorProduct.assoc R A A A).symm (comul.lTensor A (comul a)) = comul.rTensor A (comul a) := by\nrw [(TensorProduct.assoc R A A A).symm_apply_eq, coassoc_apply a]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.coassoc_symm (L105-L109)\ntheorem coassoc_symm :\n (TensorProduct.assoc R A A A).symm \u2218\u2097 comul.lTensor A \u2218\u2097 comul =\n comul.rTensor A \u2218\u2097 (comul (R := R)) :=\nLinearMap.ext coassoc_symm_apply\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.lTensor_counit_comul (L115-L117)\ntheorem lTensor_counit_comul (a : A) : counit.lTensor A (comul a) = a \u2297\u209c[R] 1 :=\nLinearMap.congr_fun lTensor_counit_comp_comul a\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_counit_tmul_eq (L119-L122)\nlemma sum_counit_tmul_eq {a : A} (repr : Coalgebra.Repr R a) :\n \u2211 i \u2208 repr.index, counit (R := R) (repr.left i) \u2297\u209c (repr.right i) = 1 \u2297\u209c[R] a := by\nsimpa [\u2190 repr.eq, map_sum] using congr($(rTensor_counit_comp_comul (R := R) (A := A)) a)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_tmul_counit_eq (L124-L128)\nlemma sum_tmul_counit_eq {a : A} (repr : Coalgebra.Repr R a) :\n \u2211 i \u2208 repr.index, (repr.left i) \u2297\u209c counit (R := R) (repr.right i) = a \u2297\u209c[R] 1 := by\nsimpa [\u2190 repr.eq, map_sum] using congr($(lTensor_counit_comp_comul (R := R) (A := A)) a)\n\n-- Cannot be @[simp] because `a\u2082` cannot be inferred by `simp`.\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_tmul_tmul_eq (L129-L137)\nlemma sum_tmul_tmul_eq {a : A} (repr : Repr R a)\n (a\u2081 : (i : repr.\u03b9) \u2192 Repr R (repr.left i)) (a\u2082 : (i : repr.\u03b9) \u2192 Repr R (repr.right i)) :\n \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2081 i).index,\n (a\u2081 i).left j \u2297\u209c[R] ((a\u2081 i).right j \u2297\u209c[R] repr.right i)\n = \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2082 i).index,\n repr.left i \u2297\u209c[R] ((a\u2082 i).left j \u2297\u209c[R] (a\u2082 i).right j) := by\nsimpa [(a\u2082 _).eq, \u2190 (a\u2081 _).eq, \u2190 TensorProduct.tmul_sum,\n TensorProduct.sum_tmul, \u2190 repr.eq] using congr($(coassoc (R := R)) a)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_counit_tmul_map_eq (L139-L145)\ntheorem sum_counit_tmul_map_eq {B : Type*} [AddCommMonoid B] [Module R B]\n {F : Type*} [FunLike F A B] [LinearMapClass F R A B] (f : F) (a : A) {repr : Repr R a} :\n \u2211 i \u2208 repr.index, counit (R := R) (repr.left i) \u2297\u209c f (repr.right i) = 1 \u2297\u209c[R] f a := by\nhave := sum_counit_tmul_eq repr\n apply_fun LinearMap.lTensor R (f : A \u2192\u2097[R] B) at this\n simp_all only [map_sum, LinearMap.lTensor_tmul, LinearMap.coe_coe]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_map_tmul_counit_eq (L147-L154)\ntheorem sum_map_tmul_counit_eq {B : Type*} [AddCommMonoid B] [Module R B]\n {F : Type*} [FunLike F A B] [LinearMapClass F R A B] (f : F) (a : A) {repr : Repr R a} :\n \u2211 i \u2208 repr.index, f (repr.left i) \u2297\u209c counit (R := R) (repr.right i) = f a \u2297\u209c[R] 1 := by\nhave := sum_tmul_counit_eq repr\n apply_fun LinearMap.rTensor R (f : A \u2192\u2097[R] B) at this\n simp_all only [map_sum, LinearMap.rTensor_tmul, LinearMap.coe_coe]\n\n-- Cannot be @[simp] because `a\u2081` cannot be inferred by `simp`.\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_map_tmul_tmul_eq (L155-L166)\ntheorem sum_map_tmul_tmul_eq {B : Type*} [AddCommMonoid B] [Module R B]\n {F : Type*} [FunLike F A B] [LinearMapClass F R A B] (f g h : F) (a : A) {repr : Repr R a}\n {a\u2081 : (i : repr.\u03b9) \u2192 Repr R (repr.left i)} {a\u2082 : (i : repr.\u03b9) \u2192 Repr R (repr.right i)} :\n \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2082 i).index,\n f (repr.left i) \u2297\u209c (g ((a\u2082 i).left j) \u2297\u209c h ((a\u2082 i).right j)) =\n \u2211 i \u2208 repr.index, \u2211 j \u2208 (a\u2081 i).index,\n f ((a\u2081 i).left j) \u2297\u209c[R] (g ((a\u2081 i).right j) \u2297\u209c[R] h (repr.right i)) := by\nhave := sum_tmul_tmul_eq repr a\u2081 a\u2082\n apply_fun TensorProduct.map (f : A \u2192\u2097[R] B)\n (TensorProduct.map (g : A \u2192\u2097[R] B) (h : A \u2192\u2097[R] B)) at this\n simp_all only [map_sum, TensorProduct.map_tmul, LinearMap.coe_coe]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.sum_counit_smul (L167-L171)\nlemma sum_counit_smul (\ud835\udce1 : Repr R a) :\n \u2211 x \u2208 \ud835\udce1.index, counit (R := R) (\ud835\udce1.left x) \u2022 \ud835\udce1.right x = a := by\nsimpa only [map_sum, TensorProduct.lift.tmul, LinearMap.lsmul_apply, one_smul]\n using congr(TensorProduct.lift (LinearMap.lsmul R A) $(sum_counit_tmul_eq (R := R) \ud835\udce1))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.lift_lsmul_comp_counit_comp_comul (L172-L189)\nlemma lift_lsmul_comp_counit_comp_comul :\n TensorProduct.lift (.lsmul R A \u2218\u2097 counit) \u2218\u2097 comul = .id := by\nhave := rTensor_counit_comp_comul (R := R) (A := A)\n apply_fun (TensorProduct.lift (LinearMap.lsmul R A) \u2218\u2097 \u00b7) at this\n rw [LinearMap.rTensor, \u2190 LinearMap.comp_assoc, TensorProduct.lift_comp_map, LinearMap.compl\u2082_id]\n at this\n ext\n simp [this]\n\nvariable (R A) in\n/-- A coalgebra `A` is cocommutative if its comultiplication `\u03b4 : A \u2192 A \u2297 A` commutes with the\nswapping `\u03b2 : A \u2297 A \u2243 A \u2297 A` of the factors in the tensor product. -/\nclass IsCocomm where\n protected comm_comp_comul : (TensorProduct.comm R A A).comp comul = comul\n\nvariable [IsCocomm R A]\n\nvariable (R A) in\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.toCoalgebra (L205-L211)\ninstance toCoalgebra : Coalgebra R R where\n comul := (TensorProduct.mk R R R) 1\ncounit := .id\n coassoc := rfl\n rTensor_counit_comp_comul := by ext; rfl\n lTensor_counit_comp_comul := by ext; rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.comul_apply (L213-L214)\ntheorem comul_apply (r : R) : comul r = 1 \u2297\u209c[R] r := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Coalgebra.Basic.counit_apply (L216-L217)\ntheorem counit_apply (r : R) : counit r = r := rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgEquiv (L58-L61)\ndef toCoalgEquiv [EquivLike F A B] [CoalgEquivClass F R A B] (f : F) : A \u2243\u2097c[R] B :=\n{ (f : A \u2192\u2097c[R] B), (f : A \u2243\u2097[R] B) with }\n\n/-- Reinterpret an element of a type of coalgebra equivalences as a coalgebra equivalence. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgHom_inj (L110-L112)\ntheorem toCoalgHom_inj {e\u2081 e\u2082 : A \u2243\u2097c[R] B} : (\u2191e\u2081 : A \u2192\u2097c[R] B) = e\u2082 \u2194 e\u2081 = e\u2082 :=\ntoCoalgHom_injective.eq_iff\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convNonUnitalSemiring (L123-L144)\ninstance convNonUnitalSemiring : NonUnitalSemiring (WithConv (C \u2192\u2097[R] A)) where\n mul_assoc f g h := toConv_injective.eq_iff.mpr <| calc\n_ = (\u03bc \u2218\u2097 rTensor _ \u03bc) \u2218\u2097 (((f.ofConv \u2297\u2098 g.ofConv) \u2297\u2098 h.ofConv) \u2218\u2097\n (TensorProduct.assoc R C C C).symm) \u2218\u2097 lTensor C \u03b4 \u2218\u2097 \u03b4 := by\n ext; simp [comp_assoc, coassoc_symm, convMul_def]\n _ = (\u03bc \u2218\u2097 rTensor A \u03bc \u2218\u2097 \u2191(TensorProduct.assoc R A A A).symm) \u2218\u2097\n (f.ofConv \u2297\u2098 (g.ofConv \u2297\u2098 h.ofConv)) \u2218\u2097 lTensor C \u03b4 \u2218\u2097 \u03b4 := by\n simp only [map_map_comp_assoc_symm_eq, comp_assoc]\n _ = (\u03bc \u2218\u2097 .lTensor _ \u03bc) \u2218\u2097 (f.ofConv \u2297\u2098 (g.ofConv \u2297\u2098 h.ofConv)) \u2218\u2097 (lTensor C \u03b4 \u2218\u2097 \u03b4) := by\n congr 1\n ext\n simp [mul_assoc]\n _ = \u03bc \u2218\u2097 (f.ofConv \u2297\u2098 \u03bc \u2218\u2097 (g.ofConv \u2297\u2098 h.ofConv) \u2218\u2097 \u03b4) \u2218\u2097 \u03b4 := by ext; simp\n\nend NonUnitalSemiring\n\nsection NonUnitalRing\nvariable [NonUnitalRing A] [AddCommMonoid C] [Module R A] [SMulCommClass R A A]\n [IsScalarTower R A A] [Module R C] [Coalgebra R C]\n\n/-- Non-unital convolution ring structure on linear maps from a coalgebra to a\nnon-unital algebra. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_coe (L127-L129)\ntheorem coe_coe : \u21d1(e : A \u2192\u2097c[R] B) = e :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_toLinearEquiv (L139-L141)\ntheorem coe_toLinearEquiv : \u21d1(e : A \u2243\u2097[R] B) = e :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul_comp_coalgHom_distrib (L115-L122)\nlemma convMul_comp_coalgHom_distrib [AddCommMonoid B] [Module R B] [CoalgebraStruct R B]\n (f g : WithConv (C \u2192\u2097[R] A)) (h : B \u2192\u2097c[R] C) :\n (f * g).ofConv.comp h.toLinearMap =\n (toConv (f.ofConv.comp h.toLinearMap) * toConv (g.ofConv.comp h.toLinearMap)).ofConv := by\nsimp [convMul_def, map_comp, comp_assoc]\n\n/-- Non-unital convolution semiring structure on linear maps from a coalgebra to a\nnon-unital algebra. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul_apply (L62-L64)\nlemma convMul_apply (f g : WithConv (C \u2192\u2097[R] A)) (c : C) :\n (f * g) c = mul' R A (.map f.ofConv g.ofConv (comul c)) := rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul (L55-L57)\ninstance convMul : Mul (WithConv (C \u2192\u2097[R] A)) where\n mul f g := toConv (mul' R A \u2218\u2097 map f.ofConv g.ofConv \u2218\u2097 comul)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_toCoalgHom (L143-L145)\ntheorem coe_toCoalgHom : \u21d1(e : A \u2192\u2097c[R] B) = e :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convOne (L165-L166)\ninstance convOne : One (WithConv (C \u2192\u2097[R] A)) where one := toConv (Algebra.linearMap R A \u2218\u2097 counit)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.instCoeToCoalgEquiv (L62-L71)\ninstance instCoeToCoalgEquiv\n [EquivLike F A B] [CoalgEquivClass F R A B] : CoeHead F (A \u2243\u2097c[R] B) where\n coe f := toCoalgEquiv f\nend CoalgEquivClass\n\nnamespace CoalgEquiv\n\nvariable [CommSemiring R]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgHom_eq_coe (L135-L137)\ntheorem toCoalgHom_eq_coe (f : A \u2243\u2097c[R] B) : f.toCoalgHom = f :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.algHom_comp_convMul_distrib (L155-L164)\nlemma algHom_comp_convMul_distrib (h : A \u2192\u2090 B) (f g : WithConv (C \u2192\u2097[R] A)) :\n h.toLinearMap.comp (f * g).ofConv =\n (toConv (h.toLinearMap.comp f.ofConv) * toConv (h.toLinearMap.comp g.ofConv)).ofConv := by\nsimp [convMul_def, map_comp, \u2190 comp_assoc, AlgHom.comp_mul']\n\nend CoalgebraStruct\n\nvariable [Coalgebra R C]\n\n/-- Convolution unit on linear maps from a coalgebra to an algebra. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convNonUnitalNonAssocSemiring (L71-L76)\ninstance convNonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring (WithConv (C \u2192\u2097[R] A)) where\n left_distrib f g h := by ext; simp [map_add_right]\nright_distrib f g h := by ext; simp [map_add_left]\n zero_mul f := by ext; simp\n mul_zero f := by ext; simp\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toLinearEquiv_eq_coe (L131-L133)\ntheorem toLinearEquiv_eq_coe (f : A \u2243\u2097c[R] B) : f.toLinearEquiv = f :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convOne_def (L167-L168)\nlemma convOne_def : (1 : WithConv (C \u2192\u2097[R] A)) = toConv (Algebra.linearMap R A \u2218\u2097 counit) := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convMul_def (L58-L60)\nlemma convMul_def (f g : WithConv (C \u2192\u2097[R] A)) :\n f * g = toConv (mul' R A \u2218\u2097 map f.ofConv g.ofConv \u2218\u2097 comul) := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.coe_mk (L114-L116)\ntheorem coe_mk {f h h\u2080 h\u2081 h\u2082 h\u2083 h\u2084 h\u2085} :\n (\u27e8\u27e8\u27e8\u27e8f, h\u27e9, h\u2080\u27e9, h\u2081, h\u2082\u27e9, h\u2083, h\u2084, h\u2085\u27e9 : A \u2243\u2097c[R] B) = f := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toEquiv_inj (L86-L88)\ntheorem toEquiv_inj {e\u2081 e\u2082 : A \u2243\u2097c[R] B} : e\u2081.toEquiv = e\u2082.toEquiv \u2194 e\u2081 = e\u2082 :=\ntoEquiv_injective.eq_iff\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.nonUnitalAlgHom_comp_convMul_distrib (L108-L114)\nlemma nonUnitalAlgHom_comp_convMul_distrib\n [NonUnitalNonAssocSemiring B] [Module R B] [SMulCommClass R B B] [IsScalarTower R B B]\n (h : A \u2192\u2099\u2090[R] B) (f g : WithConv (C \u2192\u2097[R] A)) :\n (h : A \u2192\u2097[R] B).comp (f * g).ofConv =\n (toConv ((h : A \u2192\u2097[R] B).comp f.ofConv) * toConv ((h : A \u2192\u2097[R] B).comp g.ofConv)).ofConv := by\nsimp [convMul_def, map_comp, \u2190 comp_assoc, NonUnitalAlgHom.comp_mul']\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convSemiring (L173-L184)\ninstance convSemiring : Semiring (WithConv (C \u2192\u2097[R] A)) where\n one_mul f := by ext; simp [convOne_def, \u2190 map_comp_rTensor]\nmul_one f := by ext; simp [convOne_def, \u2190 map_comp_lTensor]\n\nend Semiring\n\nsection CommSemiring\nvariable [CommSemiring A] [AddCommMonoid C] [Algebra R A] [Module R C] [Coalgebra R C]\n [IsCocomm R C]\n\n/-- Commutative convolution semiring structure on linear maps from a cocommutative coalgebra to an\nalgebra. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Coalgebra.Convolution.convCommSemiring (L185-L193)\ninstance convCommSemiring : CommSemiring (WithConv (C \u2192\u2097[R] A)) where\n mul_comm f g := by ext x; rw [convMul_apply, \u2190 comm_comul R x, map_comm, mul'_comm, convMul_apply]\nend CommSemiring\n\nsection Ring\nvariable [Ring A] [AddCommMonoid C] [Algebra R A] [Module R C] [Coalgebra R C]\n\n/-- Convolution ring structure on linear maps from a coalgebra to an algebra. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toEquiv_injective (L80-L84)\ntheorem toEquiv_injective : Function.Injective (toEquiv : (A \u2243\u2097c[R] B) \u2192 A \u2243 B) :=\nfun \u27e8_, _, _, _\u27e9 \u27e8_, _, _, _\u27e9 h =>\n (CoalgEquiv.mk.injEq _ _ _ _ _ _ _ _).mpr\n \u27e8CoalgHom.ext (congr_fun (Equiv.mk.inj h).1), (Equiv.mk.inj h).2\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toEquiv (L78-L79)\ndef toEquiv : (A \u2243\u2097c[R] B) \u2192 A \u2243 B := fun f => f.toLinearEquiv.toEquiv\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Coalgebra.Equiv.toCoalgHom_injective (L89-L91)\ntheorem toCoalgHom_injective : Function.Injective (toCoalgHom : (A \u2243\u2097c[R] B) \u2192 A \u2192\u2097c[R] B) :=\nfun _ _ H => toEquiv_injective <| Equiv.ext <| CoalgHom.congr_fun H\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Coalgebra/Basic.lean", "module": "Mathlib.RingTheory.Coalgebra.Basic", "declaration": "Mathlib.RingTheory.Coalgebra.Basic.rTensor_counit_comul", "span": "L111-L113", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Coalgebra/Basic.lean#L111"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 5875, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 14284, "lean_code_chars": 12781, "natural_language_chars": 1503, "lean_code_ratio": 0.8948, "line_count": 404, "imports_count": 0, "declarations_count": 1612, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "52d0c075c0155c2f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Vertex.VertexOperator.ext", "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.Algebra.Vertex.VertexOperator)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ext (A B : VertexOperator R V) (h : \u2200 v : V, A v = B v) :\n A = B\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.VertexOperator (L39-L45)\nabbrev VertexOperator (R : Type*) (V : Type*) [CommRing R] [AddCommGroup V]\n [Module R V] := HVertexOperator \u2124 R V V\nnamespace VertexOperator\n\nopen HVertexOperator\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff (L51-L55)\ndef ncoeff : VertexOperator R V \u2192\u2097[R] \u2124 \u2192 Module.End R V where\n toFun A n := HVertexOperator.coeff A (-n - 1)\nmap_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff_apply (L56-L62)\ntheorem ncoeff_apply (A : VertexOperator R V) (n : \u2124) : ncoeff A n = coeff A (-n - 1) :=\nrfl\n\n/-- In the literature, the `n`th normalized coefficient of a vertex operator `A` is written as\neither `A\u2099` or `A(n)`. -/\nscoped[VertexOperator] notation A \"[[\" n \"]]\" => ncoeff A n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.coeff_eq_ncoeff (L64-L67)\ntheorem coeff_eq_ncoeff (A : VertexOperator R V)\n (n : \u2124) : HVertexOperator.coeff A n = A[[-n - 1]] := by\nrw [ncoeff_apply, neg_sub, Int.sub_neg, add_sub_cancel_left]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff_eq_zero_of_lt_order (L68-L72)\ntheorem ncoeff_eq_zero_of_lt_order (A : VertexOperator R V) (n : \u2124) (x : V)\n (h : -n - 1 < HahnSeries.order ((HahnModule.of R).symm (A x))) : (A[[n]]) x = 0 := by\nsimp only [ncoeff, HVertexOperator.coeff, LinearMap.coe_mk, AddHom.coe_mk]\n exact HahnSeries.coeff_eq_zero_of_lt_order h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.coeff_eq_zero_of_lt_order (L73-L83)\ntheorem coeff_eq_zero_of_lt_order (A : VertexOperator R V) (n : \u2124) (x : V)\n (h : n < HahnSeries.order ((HahnModule.of R).symm (A x))) : coeff A n x = 0 := by\nrw [coeff_eq_ncoeff, ncoeff_eq_zero_of_lt_order A (-n - 1) x]\n lia\n\n/-- Given an endomorphism-valued function on integers satisfying a pointwise bounded-pole condition,\nwe produce a vertex operator. -/\nnoncomputable def of_coeff (f : \u2124 \u2192 Module.End R V)\n (hf : \u2200 x, BddBelow (Function.support fun y \u21a6 f y x)) : VertexOperator R V :=\n HVertexOperator.of_coeff f fun x \u21a6 (BddBelow.isWF (hf x)).isPWO\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.of_coeff_apply_coeff (L85-L89)\ntheorem of_coeff_apply_coeff (f : \u2124 \u2192 Module.End R V)\n (hf : \u2200 x, BddBelow (Function.support fun y \u21a6 f y x)) (x : V) (n : \u2124) :\n ((HahnModule.of R).symm ((of_coeff f hf) x)).coeff n = (f n) x := by\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff_of_coeff (L91-L97)\ntheorem ncoeff_of_coeff (f : \u2124 \u2192 Module.End R V)\n (hf : \u2200 x, BddBelow (Function.support fun y \u21a6 f y x)) (n : \u2124) :\n (of_coeff f hf)[[n]] = f (-n - 1) := by\next v\n rw [ncoeff_apply, coeff_apply_apply, of_coeff_apply_coeff]\n\nend VertexOperator\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.comp (L138-L148)\ndef comp : HVertexOperator (\u0393' \u00d7\u2097 \u0393) R U W where\n toFun u := HahnModule.of R (HahnSeries.ofIterate (compHahnSeries A B u))\nmap_add' := by\n intro u v\n ext g\n simp [HahnSeries.ofIterate]\n map_smul' := by\n intro r x\n ext g\n simp [HahnSeries.ofIterate]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.compHahnSeries_add (L121-L127)\ntheorem compHahnSeries_add (u v : U) :\n compHahnSeries A B (u + v) = compHahnSeries A B u + compHahnSeries A B v := by\next\n simp only [compHahnSeries_coeff, map_add, coeff_apply_apply, HahnSeries.coeff_add', Pi.add_apply]\n rw [\u2190 HahnSeries.coeff_add]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.compHahnSeries_smul (L129-L136)\ntheorem compHahnSeries_smul (r : R) (u : U) :\n compHahnSeries A B (r \u2022 u) = r \u2022 compHahnSeries A B u := by\next\n simp only [compHahnSeries_coeff, map_smul, coeff_apply_apply, HahnSeries.coeff_smul]\n rw [\u2190 HahnSeries.coeff_smul]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The composite of two heterogeneous vertex operators, as a heterogeneous vertex operator. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_of_coeff (L89-L92)\ntheorem coeff_of_coeff (f : \u0393 \u2192 V \u2192\u2097[R] W)\n (hf : \u2200 (x : V), (Function.support (fun g => f g x)).IsPWO) : (of_coeff f hf).coeff = f :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.of_coeff_coeff (L94-L109)\ntheorem of_coeff_coeff (A : HVertexOperator \u0393 R V W) : of_coeff A.coeff A.coeff_isPWOsupport = A :=\nrfl\n\nend Coeff\n\nsection Products\n\nvariable {\u0393 \u0393' : Type*} [PartialOrder \u0393] [PartialOrder \u0393'] {R : Type*}\n [CommRing R] {U V W : Type*} [AddCommGroup U] [Module R U] [AddCommGroup V] [Module R V]\n [AddCommGroup W] [Module R W] (A : HVertexOperator \u0393 R V W) (B : HVertexOperator \u0393' R U V)\n\nopen HahnModule\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The composite of two heterogeneous vertex operators acting on a vector, as an iterated Hahn\nseries. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.HVertexOperator (L42-L51)\nabbrev HVertexOperator (\u0393 : Type*) [PartialOrder \u0393] (R : Type*) [CommRing R]\n (V : Type*) (W : Type*) [AddCommGroup V] [Module R V] [AddCommGroup W] [Module R W] :=\nV \u2192\u2097[R] (HahnModule \u0393 R W)\n\nnamespace HVertexOperator\n\nsection Coeff\n\nopen HahnModule\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_comp (L150-L156)\ntheorem coeff_comp (g : \u0393' \u00d7\u2097 \u0393) :\n (comp A B).coeff g = A.coeff (ofLex g).2 \u2218\u2097 B.coeff (ofLex g).1 := by\nrfl\n\nend Products\n\nend HVertexOperator\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.compHahnSeries (L111-L119)\ndef compHahnSeries (u : U) : HahnSeries \u0393' (HahnSeries \u0393 W) where\n coeff g' := A (coeff B g' u)\nisPWO_support' := by\n refine Set.IsPWO.mono (((of R).symm (B u)).isPWO_support') ?_\n simp only [coeff_apply_apply, Function.support_subset_iff, ne_eq, Function.mem_support]\n intro g' hg' hAB\n exact hg' (by simp [hAB])\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_isPWOsupport (L68-L71)\ntheorem coeff_isPWOsupport (A : HVertexOperator \u0393 R V W) (v : V) :\n ((of R).symm (A v)).coeff.support.IsPWO :=\n((of R).symm (A v)).isPWO_support'\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.of_coeff (L82-L87)\ndef of_coeff (f : \u0393 \u2192 V \u2192\u2097[R] W) (hf : \u2200 (x : V), (Function.support (f \u00b7 x)).IsPWO) :\n HVertexOperator \u0393 R V W where\n toFun x := (of R) { coeff := fun g => f g x, isPWO_support' := hf x }\nmap_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_inj (L73-L80)\ntheorem coeff_inj : Function.Injective (coeff : HVertexOperator \u0393 R V W \u2192\u2097[R] \u0393 \u2192 (V \u2192\u2097[R] W)) := by\nintro _ _ h\n ext v n\n exact congrFun (congrArg DFunLike.coe (congrFun h n)) v\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Given a coefficient function valued in linear maps satisfying a partially well-ordered support\ncondition, we produce a heterogeneous vertex operator. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff (L60-L67)\ndef coeff : HVertexOperator \u0393 R V W \u2192\u2097[R] \u0393 \u2192 V \u2192\u2097[R] W where\n toFun A n := {\ntoFun v := ((of R).symm (A v)).coeff n\n map_add' u v := by simp\n map_smul' r v := by simp }\n map_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; 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.Algebra.Vertex.VertexOperator).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem ext (A B : VertexOperator R V) (h : \u2200 v : V, A v = B v) :\n A = B\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.VertexOperator (L39-L45)\nabbrev VertexOperator (R : Type*) (V : Type*) [CommRing R] [AddCommGroup V]\n [Module R V] := HVertexOperator \u2124 R V V\nnamespace VertexOperator\n\nopen HVertexOperator\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff (L51-L55)\ndef ncoeff : VertexOperator R V \u2192\u2097[R] \u2124 \u2192 Module.End R V where\n toFun A n := HVertexOperator.coeff A (-n - 1)\nmap_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff_apply (L56-L62)\ntheorem ncoeff_apply (A : VertexOperator R V) (n : \u2124) : ncoeff A n = coeff A (-n - 1) :=\nrfl\n\n/-- In the literature, the `n`th normalized coefficient of a vertex operator `A` is written as\neither `A\u2099` or `A(n)`. -/\nscoped[VertexOperator] notation A \"[[\" n \"]]\" => ncoeff A n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.coeff_eq_ncoeff (L64-L67)\ntheorem coeff_eq_ncoeff (A : VertexOperator R V)\n (n : \u2124) : HVertexOperator.coeff A n = A[[-n - 1]] := by\nrw [ncoeff_apply, neg_sub, Int.sub_neg, add_sub_cancel_left]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff_eq_zero_of_lt_order (L68-L72)\ntheorem ncoeff_eq_zero_of_lt_order (A : VertexOperator R V) (n : \u2124) (x : V)\n (h : -n - 1 < HahnSeries.order ((HahnModule.of R).symm (A x))) : (A[[n]]) x = 0 := by\nsimp only [ncoeff, HVertexOperator.coeff, LinearMap.coe_mk, AddHom.coe_mk]\n exact HahnSeries.coeff_eq_zero_of_lt_order h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.coeff_eq_zero_of_lt_order (L73-L83)\ntheorem coeff_eq_zero_of_lt_order (A : VertexOperator R V) (n : \u2124) (x : V)\n (h : n < HahnSeries.order ((HahnModule.of R).symm (A x))) : coeff A n x = 0 := by\nrw [coeff_eq_ncoeff, ncoeff_eq_zero_of_lt_order A (-n - 1) x]\n lia\n\n/-- Given an endomorphism-valued function on integers satisfying a pointwise bounded-pole condition,\nwe produce a vertex operator. -/\nnoncomputable def of_coeff (f : \u2124 \u2192 Module.End R V)\n (hf : \u2200 x, BddBelow (Function.support fun y \u21a6 f y x)) : VertexOperator R V :=\n HVertexOperator.of_coeff f fun x \u21a6 (BddBelow.isWF (hf x)).isPWO\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.of_coeff_apply_coeff (L85-L89)\ntheorem of_coeff_apply_coeff (f : \u2124 \u2192 Module.End R V)\n (hf : \u2200 x, BddBelow (Function.support fun y \u21a6 f y x)) (x : V) (n : \u2124) :\n ((HahnModule.of R).symm ((of_coeff f hf) x)).coeff n = (f n) x := by\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Vertex.VertexOperator.ncoeff_of_coeff (L91-L97)\ntheorem ncoeff_of_coeff (f : \u2124 \u2192 Module.End R V)\n (hf : \u2200 x, BddBelow (Function.support fun y \u21a6 f y x)) (n : \u2124) :\n (of_coeff f hf)[[n]] = f (-n - 1) := by\next v\n rw [ncoeff_apply, coeff_apply_apply, of_coeff_apply_coeff]\n\nend VertexOperator\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.comp (L138-L148)\ndef comp : HVertexOperator (\u0393' \u00d7\u2097 \u0393) R U W where\n toFun u := HahnModule.of R (HahnSeries.ofIterate (compHahnSeries A B u))\nmap_add' := by\n intro u v\n ext g\n simp [HahnSeries.ofIterate]\n map_smul' := by\n intro r x\n ext g\n simp [HahnSeries.ofIterate]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.compHahnSeries_add (L121-L127)\ntheorem compHahnSeries_add (u v : U) :\n compHahnSeries A B (u + v) = compHahnSeries A B u + compHahnSeries A B v := by\next\n simp only [compHahnSeries_coeff, map_add, coeff_apply_apply, HahnSeries.coeff_add', Pi.add_apply]\n rw [\u2190 HahnSeries.coeff_add]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.compHahnSeries_smul (L129-L136)\ntheorem compHahnSeries_smul (r : R) (u : U) :\n compHahnSeries A B (r \u2022 u) = r \u2022 compHahnSeries A B u := by\next\n simp only [compHahnSeries_coeff, map_smul, coeff_apply_apply, HahnSeries.coeff_smul]\n rw [\u2190 HahnSeries.coeff_smul]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The composite of two heterogeneous vertex operators, as a heterogeneous vertex operator. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_of_coeff (L89-L92)\ntheorem coeff_of_coeff (f : \u0393 \u2192 V \u2192\u2097[R] W)\n (hf : \u2200 (x : V), (Function.support (fun g => f g x)).IsPWO) : (of_coeff f hf).coeff = f :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.of_coeff_coeff (L94-L109)\ntheorem of_coeff_coeff (A : HVertexOperator \u0393 R V W) : of_coeff A.coeff A.coeff_isPWOsupport = A :=\nrfl\n\nend Coeff\n\nsection Products\n\nvariable {\u0393 \u0393' : Type*} [PartialOrder \u0393] [PartialOrder \u0393'] {R : Type*}\n [CommRing R] {U V W : Type*} [AddCommGroup U] [Module R U] [AddCommGroup V] [Module R V]\n [AddCommGroup W] [Module R W] (A : HVertexOperator \u0393 R V W) (B : HVertexOperator \u0393' R U V)\n\nopen HahnModule\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The composite of two heterogeneous vertex operators acting on a vector, as an iterated Hahn\nseries. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.HVertexOperator (L42-L51)\nabbrev HVertexOperator (\u0393 : Type*) [PartialOrder \u0393] (R : Type*) [CommRing R]\n (V : Type*) (W : Type*) [AddCommGroup V] [Module R V] [AddCommGroup W] [Module R W] :=\nV \u2192\u2097[R] (HahnModule \u0393 R W)\n\nnamespace HVertexOperator\n\nsection Coeff\n\nopen HahnModule\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_comp (L150-L156)\ntheorem coeff_comp (g : \u0393' \u00d7\u2097 \u0393) :\n (comp A B).coeff g = A.coeff (ofLex g).2 \u2218\u2097 B.coeff (ofLex g).1 := by\nrfl\n\nend Products\n\nend HVertexOperator\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.compHahnSeries (L111-L119)\ndef compHahnSeries (u : U) : HahnSeries \u0393' (HahnSeries \u0393 W) where\n coeff g' := A (coeff B g' u)\nisPWO_support' := by\n refine Set.IsPWO.mono (((of R).symm (B u)).isPWO_support') ?_\n simp only [coeff_apply_apply, Function.support_subset_iff, ne_eq, Function.mem_support]\n intro g' hg' hAB\n exact hg' (by simp [hAB])\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_isPWOsupport (L68-L71)\ntheorem coeff_isPWOsupport (A : HVertexOperator \u0393 R V W) (v : V) :\n ((of R).symm (A v)).coeff.support.IsPWO :=\n((of R).symm (A v)).isPWO_support'\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.of_coeff (L82-L87)\ndef of_coeff (f : \u0393 \u2192 V \u2192\u2097[R] W) (hf : \u2200 (x : V), (Function.support (f \u00b7 x)).IsPWO) :\n HVertexOperator \u0393 R V W where\n toFun x := (of R) { coeff := fun g => f g x, isPWO_support' := hf x }\nmap_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff_inj (L73-L80)\ntheorem coeff_inj : Function.Injective (coeff : HVertexOperator \u0393 R V W \u2192\u2097[R] \u0393 \u2192 (V \u2192\u2097[R] W)) := by\nintro _ _ h\n ext v n\n exact congrFun (congrArg DFunLike.coe (congrFun h n)) v\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Given a coefficient function valued in linear maps satisfying a partially well-ordered support\ncondition, we produce a heterogeneous vertex operator. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Vertex.HVertexOperator.coeff (L60-L67)\ndef coeff : HVertexOperator \u0393 R V W \u2192\u2097[R] \u0393 \u2192 V \u2192\u2097[R] W where\n toFun A n := {\ntoFun v := ((of R).symm (A v)).coeff n\n map_add' u v := by simp\n map_smul' r v := by simp }\n map_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Vertex/VertexOperator.lean", "module": "Mathlib.Algebra.Vertex.VertexOperator", "declaration": "Mathlib.Algebra.Vertex.VertexOperator.ext", "span": "L47-L50", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Vertex/VertexOperator.lean#L47"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 2829, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 7984, "lean_code_chars": 7018, "natural_language_chars": 966, "lean_code_ratio": 0.879, "line_count": 243, "imports_count": 0, "declarations_count": 906, "diagnostics_count": 0, "retrieval_snippets_count": 20, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "ac40a293f16d4c30", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Polynomial.Laurent.trunc", "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.Algebra.Polynomial.Laurent)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef trunc : R[T;T\u207b\u00b9] \u2192+ R[X]\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.LaurentPolynomial (L84-L86)\nabbrev LaurentPolynomial (R : Type*) [Semiring R] :=\nAddMonoidAlgebra R \u2124\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.LaurentPolynomial (L93-L97)\ntheorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T\u207b\u00b9]} (h : \u2200 a, p a = q a) : p = q :=\nFinsupp.ext h\n\n/-- The ring homomorphism, taking a polynomial with coefficients in `R` to a Laurent polynomial\nwith coefficients in `R`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L98-L102)\ndef Polynomial.toLaurent [Semiring R] : R[X] \u2192+* R[T;T\u207b\u00b9] :=\n(mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R).toRingHom\n\n/-- This is not a simp lemma, as it is usually preferable to use the lemmas about `C` and `X`\ninstead. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L103-L108)\ntheorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) :\n toLaurent p = p.toFinsupp.mapDomain (\u2191) :=\nrfl\n\n/-- The `R`-algebra map, taking a polynomial with coefficients in `R` to a Laurent polynomial\nwith coefficients in `R`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L109-L111)\ndef Polynomial.toLaurentAlg [CommSemiring R] : R[X] \u2192\u2090[R] R[T;T\u207b\u00b9] :=\n(mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L116-L124)\ntheorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f :=\nrfl\n\nnamespace LaurentPolynomial\n\nsection Semiring\n\nvariable [Semiring R]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.single_zero_one_eq_one (L125-L131)\ntheorem single_zero_one_eq_one : (.single 0 1 : R[T;T\u207b\u00b9]) = (1 : R[T;T\u207b\u00b9]) :=\nrfl\n\n/-! ### The functions `C` and `T`. -/\n\n/-- The ring homomorphism `C`, including `R` into the ring of Laurent polynomials over `R` as\nthe constant Laurent polynomials. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.C (L132-L134)\ndef C : R \u2192+* R[T;T\u207b\u00b9] :=\nsingleZeroRingHom\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.algebraMap_apply (L135-L142)\ntheorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) :\n algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) :=\nrfl\n\n/-- When we have `[CommSemiring R]`, the function `C` is the same as `algebraMap R R[T;T\u207b\u00b9]`.\n(But note that `C` is defined when `R` is not necessarily commutative, in which case\n`algebraMap` is not available.)\n-/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.C_eq_algebraMap (L143-L145)\ntheorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T\u207b\u00b9] r :=\nrfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.single_eq_C (L146-L147)\ntheorem single_eq_C (r : R) : .single 0 r = C r := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T (L156-L158)\ndef T (n : \u2124) : R[T;T\u207b\u00b9] :=\n.single n 1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T_zero (L163-L165)\ntheorem T_zero : (T 0 : R[T;T\u207b\u00b9]) = 1 :=\nrfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T_add (L166-L168)\ntheorem T_add (m n : \u2124) : (T (m + n) : R[T;T\u207b\u00b9]) = T m * T n := by\nsimp [T, single_mul_single]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T_sub (L169-L170)\ntheorem T_sub (m n : \u2124) : (T (m - n) : R[T;T\u207b\u00b9]) = T m * T (-n) := by rw [\u2190 T_add, sub_eq_add_neg]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_eq_eval\u2082AlgHom_CAlgHom (L189-L192)\ntheorem mapAlgHom_eq_eval\u2082AlgHom_CAlgHom (f : A \u2192\u2090[R] B) : mapAlgHom f = eval\u2082AlgHom\n (CAlgHom.comp f) X (fun a => (commute_X (C (f a))).symm) := by\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.lcoeff_comp_mapAlgHom_eq (L197-L201)\nlemma lcoeff_comp_mapAlgHom_eq (f : A \u2192\u2090[R] B) (n : \u2115) :\n (lcoeff B n).restrictScalars R \u2218\u2097 (mapAlgHom f).toLinearMap =\n f.toLinearMap \u2218\u2097 (lcoeff A n).restrictScalars R := by\next f; simp\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.CAlgHom (L95-L100)\ndef CAlgHom : A \u2192\u2090[R] A[X] where\n toRingHom := C\ncommutes' _ := rfl\n\n/-- Extensionality lemma for algebra maps out of `A'[X]` over a smaller base ring than `A'`\n-/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.subalgebraNontrivial (L117-L127)\ninstance subalgebraNontrivial [Nontrivial A] : Nontrivial (Subalgebra R A[X]) :=\n\u27e8\u27e8\u22a5, \u22a4, by\n rw [Ne, SetLike.ext_iff, not_forall]\n refine \u27e8X, ?_\u27e9\n simp only [Algebra.mem_bot, not_exists, Set.mem_range, iff_true, Algebra.mem_top,\n algebraMap_apply]\n intro x\n rw [ext_iff, not_forall]\n refine \u27e81, ?_\u27e9\n simp\u27e9\u27e9\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.toFinsupp_algebraMap (L73-L77)\ntheorem toFinsupp_algebraMap (r : R) : (algebraMap R A[X] r).toFinsupp = algebraMap R _ r :=\nshow toFinsupp (C (algebraMap _ _ r)) = _ by\n rw [toFinsupp_C]\n rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom (L167-L170)\ndef mapAlgHom (f : A \u2192\u2090[R] B) : Polynomial A \u2192\u2090[R] Polynomial B where\n toRingHom := mapRingHom f.toRingHom\ncommutes' := by simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.ringHom_eval\u2082_intCastRingHom (L145-L148)\ntheorem ringHom_eval\u2082_intCastRingHom {R S : Type*} [Ring R] [Ring S] (p : \u2124[X]) (f : R \u2192+* S)\n (r : R) : f (eval\u2082 (Int.castRingHom R) r p) = eval\u2082 (Int.castRingHom S) (f r) p :=\nalgHom_eval\u2082_algebraMap p f.toIntAlgHom r\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.eval\u2082_intCastRingHom_X (L150-L156)\ntheorem eval\u2082_intCastRingHom_X {R : Type*} [Ring R] (p : \u2124[X]) (f : \u2124[X] \u2192+* R) :\n eval\u2082 (Int.castRingHom R) (f X) p = f p :=\neval\u2082_algebraMap_X p f.toIntAlgHom\n\n/-- `Polynomial.eval\u2082` as an `AlgHom` for noncommutative algebras.\n\nThis is `Polynomial.eval\u2082RingHom'` for `AlgHom`s. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.eval\u2082_algebraMap_X (L136-L143)\ntheorem eval\u2082_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])\n (f : R[X] \u2192\u2090[R] A) : eval\u2082 (algebraMap R A) (f X) p = f p := by\nconv_rhs => rw [\u2190 Polynomial.sum_C_mul_X_pow_eq p]\n simp only [eval\u2082_eq_sum, sum_def]\n simp only [map_sum, map_mul, map_pow]\n simp [Polynomial.C_eq_algebraMap]\n\n-- these used to be about `algebraMap \u2124 R`, but now the simp-normal form is `Int.castRingHom R`.\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algebraMap_apply (L69-L71)\ntheorem algebraMap_apply (r : R) : algebraMap R A[X] r = C (algebraMap R A r) :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgEquiv (L206-L208)\ndef mapAlgEquiv (f : A \u2243\u2090[R] B) : Polynomial A \u2243\u2090[R] Polynomial B :=\nAlgEquiv.ofAlgHom (mapAlgHom f.toAlgHom) (mapAlgHom f.symm.toAlgHom) (by simp) (by simp)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_monomial (L202-L205)\nlemma mapAlgHom_monomial (f : A \u2192\u2090[R] B) (n : \u2115) (a : A) :\n mapAlgHom f (monomial n a) = monomial n (f a) := by simp\n/-- If `A` and `B` are isomorphic as `R`-algebras, then so are their polynomial rings -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_id (L176-L178)\ntheorem mapAlgHom_id : mapAlgHom (AlgHom.id R A) = AlgHom.id R (Polynomial A) :=\nAlgHom.ext fun _x => map_id\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algebraMap_eq (L90-L93)\ntheorem algebraMap_eq : algebraMap R R[X] = C :=\nrfl\n\n/-- `Polynomial.C` as an `AlgHom`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.eval\u2082AlgHom (L158-L166)\ndef eval\u2082AlgHom (f : A \u2192\u2090[R] B) (b : B) (hf : \u2200 a, Commute (f a) b) : A[X] \u2192\u2090[R] B where\n toRingHom := eval\u2082RingHom' f b hf\ncommutes' _ := (eval\u2082_C _ _).trans (f.commutes _)\n\nsection Map\n\n/-- `Polynomial.map` as an `AlgHom` for noncommutative algebras.\n\n This is the algebra version of `Polynomial.mapRingHom`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_coe_ringHom (L180-L183)\ntheorem mapAlgHom_coe_ringHom (f : A \u2192\u2090[R] B) :\n \u2191(mapAlgHom f : _ \u2192\u2090[R] Polynomial B) = (mapRingHom \u2191f : Polynomial A \u2192+* Polynomial B) :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.C_eq_algebraMap (L86-L88)\ntheorem C_eq_algebraMap (r : R) : C r = algebraMap R R[X] r :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.ofFinsupp_algebraMap (L78-L85)\ntheorem ofFinsupp_algebraMap (r : R) : (\u27e8algebraMap R _ r\u27e9 : A[X]) = algebraMap R A[X] r :=\ntoFinsupp_injective (toFinsupp_algebraMap _).symm\n\n/-- When we have `[CommSemiring R]`, the function `C` is the same as `algebraMap R R[X]`.\n\n(But note that `C` is defined when `R` is not necessarily commutative, in which case\n`algebraMap` is not available.)\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algHom_ext' (L102-L110)\ntheorem algHom_ext' {f g : A[X] \u2192\u2090[R] B}\n (hC : f.comp CAlgHom = g.comp CAlgHom)\n (hX : f X = g X) : f = g :=\nAlgHom.coe_ringHom_injective (ringHom_ext' (congr_arg AlgHom.toRingHom hC) hX)\n\nvariable (R) in\nopen AddMonoidAlgebra in\n/-- Algebra isomorphism between `R[X]` and `R[\u2115]`. This is just an\nimplementation detail, but it can be useful to transfer results from `Finsupp` to polynomials. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_comp (L185-L188)\ntheorem mapAlgHom_comp (C : Type*) [Semiring C] [Algebra R C] (f : B \u2192\u2090[R] C) (g : A \u2192\u2090[R] B) :\n (mapAlgHom f).comp (mapAlgHom g) = mapAlgHom (f.comp g) := by\next <;> simp\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.coeff_mapAlgHom_apply (L193-L196)\nlemma coeff_mapAlgHom_apply (f : A \u2192\u2090[R] B) (p : A[X]) (n : \u2115) :\n coeff (mapAlgHom f p) n = f (coeff p n) := by\nsimp\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.coe_mapAlgHom (L172-L174)\ntheorem coe_mapAlgHom (f : A \u2192\u2090[R] B) : \u21d1(mapAlgHom f) = map f :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.toFinsuppIsoAlg (L112-L116)\ndef toFinsuppIsoAlg : R[X] \u2243\u2090[R] R[\u2115] :=\n{ toFinsuppIso R with\n commutes' := fun r => by\n dsimp }\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algHom_eval\u2082_algebraMap (L129-L134)\ntheorem algHom_eval\u2082_algebraMap {R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] (p : R[X]) (f : A \u2192\u2090[R] B) (a : A) :\n f (eval\u2082 (algebraMap R A) a p) = eval\u2082 (algebraMap R B) (f a) p := by\nsimp only [eval\u2082_eq_sum, sum_def]\n simp only [map_sum, map_mul, map_pow, AlgHom.commutes]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algebraOfAlgebra (L55-L67)\ninstance algebraOfAlgebra : Algebra R A[X] where\n smul_def' r p :=\ntoFinsupp_injective <| by\n dsimp only [RingHom.toFun_eq_coe, RingHom.comp_apply]\n rw [toFinsupp_smul, toFinsupp_mul, toFinsupp_C]\n exact Algebra.smul_def' _ _\n commutes' r p :=\n toFinsupp_injective <| by\n dsimp only [RingHom.toFun_eq_coe, RingHom.comp_apply]\n simp_rw [toFinsupp_mul, toFinsupp_C]\n convert Algebra.commutes' r p.toFinsupp\n algebraMap := C.comp (algebraMap R A)\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.Algebra.Polynomial.Laurent).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef trunc : R[T;T\u207b\u00b9] \u2192+ R[X]\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.LaurentPolynomial (L84-L86)\nabbrev LaurentPolynomial (R : Type*) [Semiring R] :=\nAddMonoidAlgebra R \u2124\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.LaurentPolynomial (L93-L97)\ntheorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T\u207b\u00b9]} (h : \u2200 a, p a = q a) : p = q :=\nFinsupp.ext h\n\n/-- The ring homomorphism, taking a polynomial with coefficients in `R` to a Laurent polynomial\nwith coefficients in `R`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L98-L102)\ndef Polynomial.toLaurent [Semiring R] : R[X] \u2192+* R[T;T\u207b\u00b9] :=\n(mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R).toRingHom\n\n/-- This is not a simp lemma, as it is usually preferable to use the lemmas about `C` and `X`\ninstead. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L103-L108)\ntheorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) :\n toLaurent p = p.toFinsupp.mapDomain (\u2191) :=\nrfl\n\n/-- The `R`-algebra map, taking a polynomial with coefficients in `R` to a Laurent polynomial\nwith coefficients in `R`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L109-L111)\ndef Polynomial.toLaurentAlg [CommSemiring R] : R[X] \u2192\u2090[R] R[T;T\u207b\u00b9] :=\n(mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.Polynomial (L116-L124)\ntheorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f :=\nrfl\n\nnamespace LaurentPolynomial\n\nsection Semiring\n\nvariable [Semiring R]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.single_zero_one_eq_one (L125-L131)\ntheorem single_zero_one_eq_one : (.single 0 1 : R[T;T\u207b\u00b9]) = (1 : R[T;T\u207b\u00b9]) :=\nrfl\n\n/-! ### The functions `C` and `T`. -/\n\n/-- The ring homomorphism `C`, including `R` into the ring of Laurent polynomials over `R` as\nthe constant Laurent polynomials. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.C (L132-L134)\ndef C : R \u2192+* R[T;T\u207b\u00b9] :=\nsingleZeroRingHom\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.algebraMap_apply (L135-L142)\ntheorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) :\n algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) :=\nrfl\n\n/-- When we have `[CommSemiring R]`, the function `C` is the same as `algebraMap R R[T;T\u207b\u00b9]`.\n(But note that `C` is defined when `R` is not necessarily commutative, in which case\n`algebraMap` is not available.)\n-/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.C_eq_algebraMap (L143-L145)\ntheorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T\u207b\u00b9] r :=\nrfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.single_eq_C (L146-L147)\ntheorem single_eq_C (r : R) : .single 0 r = C r := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T (L156-L158)\ndef T (n : \u2124) : R[T;T\u207b\u00b9] :=\n.single n 1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T_zero (L163-L165)\ntheorem T_zero : (T 0 : R[T;T\u207b\u00b9]) = 1 :=\nrfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T_add (L166-L168)\ntheorem T_add (m n : \u2124) : (T (m + n) : R[T;T\u207b\u00b9]) = T m * T n := by\nsimp [T, single_mul_single]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Polynomial.Laurent.T_sub (L169-L170)\ntheorem T_sub (m n : \u2124) : (T (m - n) : R[T;T\u207b\u00b9]) = T m * T (-n) := by rw [\u2190 T_add, sub_eq_add_neg]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_eq_eval\u2082AlgHom_CAlgHom (L189-L192)\ntheorem mapAlgHom_eq_eval\u2082AlgHom_CAlgHom (f : A \u2192\u2090[R] B) : mapAlgHom f = eval\u2082AlgHom\n (CAlgHom.comp f) X (fun a => (commute_X (C (f a))).symm) := by\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.lcoeff_comp_mapAlgHom_eq (L197-L201)\nlemma lcoeff_comp_mapAlgHom_eq (f : A \u2192\u2090[R] B) (n : \u2115) :\n (lcoeff B n).restrictScalars R \u2218\u2097 (mapAlgHom f).toLinearMap =\n f.toLinearMap \u2218\u2097 (lcoeff A n).restrictScalars R := by\next f; simp\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.CAlgHom (L95-L100)\ndef CAlgHom : A \u2192\u2090[R] A[X] where\n toRingHom := C\ncommutes' _ := rfl\n\n/-- Extensionality lemma for algebra maps out of `A'[X]` over a smaller base ring than `A'`\n-/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.subalgebraNontrivial (L117-L127)\ninstance subalgebraNontrivial [Nontrivial A] : Nontrivial (Subalgebra R A[X]) :=\n\u27e8\u27e8\u22a5, \u22a4, by\n rw [Ne, SetLike.ext_iff, not_forall]\n refine \u27e8X, ?_\u27e9\n simp only [Algebra.mem_bot, not_exists, Set.mem_range, iff_true, Algebra.mem_top,\n algebraMap_apply]\n intro x\n rw [ext_iff, not_forall]\n refine \u27e81, ?_\u27e9\n simp\u27e9\u27e9\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.toFinsupp_algebraMap (L73-L77)\ntheorem toFinsupp_algebraMap (r : R) : (algebraMap R A[X] r).toFinsupp = algebraMap R _ r :=\nshow toFinsupp (C (algebraMap _ _ r)) = _ by\n rw [toFinsupp_C]\n rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom (L167-L170)\ndef mapAlgHom (f : A \u2192\u2090[R] B) : Polynomial A \u2192\u2090[R] Polynomial B where\n toRingHom := mapRingHom f.toRingHom\ncommutes' := by simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.ringHom_eval\u2082_intCastRingHom (L145-L148)\ntheorem ringHom_eval\u2082_intCastRingHom {R S : Type*} [Ring R] [Ring S] (p : \u2124[X]) (f : R \u2192+* S)\n (r : R) : f (eval\u2082 (Int.castRingHom R) r p) = eval\u2082 (Int.castRingHom S) (f r) p :=\nalgHom_eval\u2082_algebraMap p f.toIntAlgHom r\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.eval\u2082_intCastRingHom_X (L150-L156)\ntheorem eval\u2082_intCastRingHom_X {R : Type*} [Ring R] (p : \u2124[X]) (f : \u2124[X] \u2192+* R) :\n eval\u2082 (Int.castRingHom R) (f X) p = f p :=\neval\u2082_algebraMap_X p f.toIntAlgHom\n\n/-- `Polynomial.eval\u2082` as an `AlgHom` for noncommutative algebras.\n\nThis is `Polynomial.eval\u2082RingHom'` for `AlgHom`s. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.eval\u2082_algebraMap_X (L136-L143)\ntheorem eval\u2082_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])\n (f : R[X] \u2192\u2090[R] A) : eval\u2082 (algebraMap R A) (f X) p = f p := by\nconv_rhs => rw [\u2190 Polynomial.sum_C_mul_X_pow_eq p]\n simp only [eval\u2082_eq_sum, sum_def]\n simp only [map_sum, map_mul, map_pow]\n simp [Polynomial.C_eq_algebraMap]\n\n-- these used to be about `algebraMap \u2124 R`, but now the simp-normal form is `Int.castRingHom R`.\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algebraMap_apply (L69-L71)\ntheorem algebraMap_apply (r : R) : algebraMap R A[X] r = C (algebraMap R A r) :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgEquiv (L206-L208)\ndef mapAlgEquiv (f : A \u2243\u2090[R] B) : Polynomial A \u2243\u2090[R] Polynomial B :=\nAlgEquiv.ofAlgHom (mapAlgHom f.toAlgHom) (mapAlgHom f.symm.toAlgHom) (by simp) (by simp)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_monomial (L202-L205)\nlemma mapAlgHom_monomial (f : A \u2192\u2090[R] B) (n : \u2115) (a : A) :\n mapAlgHom f (monomial n a) = monomial n (f a) := by simp\n/-- If `A` and `B` are isomorphic as `R`-algebras, then so are their polynomial rings -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_id (L176-L178)\ntheorem mapAlgHom_id : mapAlgHom (AlgHom.id R A) = AlgHom.id R (Polynomial A) :=\nAlgHom.ext fun _x => map_id\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algebraMap_eq (L90-L93)\ntheorem algebraMap_eq : algebraMap R R[X] = C :=\nrfl\n\n/-- `Polynomial.C` as an `AlgHom`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.eval\u2082AlgHom (L158-L166)\ndef eval\u2082AlgHom (f : A \u2192\u2090[R] B) (b : B) (hf : \u2200 a, Commute (f a) b) : A[X] \u2192\u2090[R] B where\n toRingHom := eval\u2082RingHom' f b hf\ncommutes' _ := (eval\u2082_C _ _).trans (f.commutes _)\n\nsection Map\n\n/-- `Polynomial.map` as an `AlgHom` for noncommutative algebras.\n\n This is the algebra version of `Polynomial.mapRingHom`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_coe_ringHom (L180-L183)\ntheorem mapAlgHom_coe_ringHom (f : A \u2192\u2090[R] B) :\n \u2191(mapAlgHom f : _ \u2192\u2090[R] Polynomial B) = (mapRingHom \u2191f : Polynomial A \u2192+* Polynomial B) :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.C_eq_algebraMap (L86-L88)\ntheorem C_eq_algebraMap (r : R) : C r = algebraMap R R[X] r :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.ofFinsupp_algebraMap (L78-L85)\ntheorem ofFinsupp_algebraMap (r : R) : (\u27e8algebraMap R _ r\u27e9 : A[X]) = algebraMap R A[X] r :=\ntoFinsupp_injective (toFinsupp_algebraMap _).symm\n\n/-- When we have `[CommSemiring R]`, the function `C` is the same as `algebraMap R R[X]`.\n\n(But note that `C` is defined when `R` is not necessarily commutative, in which case\n`algebraMap` is not available.)\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algHom_ext' (L102-L110)\ntheorem algHom_ext' {f g : A[X] \u2192\u2090[R] B}\n (hC : f.comp CAlgHom = g.comp CAlgHom)\n (hX : f X = g X) : f = g :=\nAlgHom.coe_ringHom_injective (ringHom_ext' (congr_arg AlgHom.toRingHom hC) hX)\n\nvariable (R) in\nopen AddMonoidAlgebra in\n/-- Algebra isomorphism between `R[X]` and `R[\u2115]`. This is just an\nimplementation detail, but it can be useful to transfer results from `Finsupp` to polynomials. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.mapAlgHom_comp (L185-L188)\ntheorem mapAlgHom_comp (C : Type*) [Semiring C] [Algebra R C] (f : B \u2192\u2090[R] C) (g : A \u2192\u2090[R] B) :\n (mapAlgHom f).comp (mapAlgHom g) = mapAlgHom (f.comp g) := by\next <;> simp\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.coeff_mapAlgHom_apply (L193-L196)\nlemma coeff_mapAlgHom_apply (f : A \u2192\u2090[R] B) (p : A[X]) (n : \u2115) :\n coeff (mapAlgHom f p) n = f (coeff p n) := by\nsimp\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.coe_mapAlgHom (L172-L174)\ntheorem coe_mapAlgHom (f : A \u2192\u2090[R] B) : \u21d1(mapAlgHom f) = map f :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.toFinsuppIsoAlg (L112-L116)\ndef toFinsuppIsoAlg : R[X] \u2243\u2090[R] R[\u2115] :=\n{ toFinsuppIso R with\n commutes' := fun r => by\n dsimp }\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algHom_eval\u2082_algebraMap (L129-L134)\ntheorem algHom_eval\u2082_algebraMap {R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] (p : R[X]) (f : A \u2192\u2090[R] B) (a : A) :\n f (eval\u2082 (algebraMap R A) a p) = eval\u2082 (algebraMap R B) (f a) p := by\nsimp only [eval\u2082_eq_sum, sum_def]\n simp only [map_sum, map_mul, map_pow, AlgHom.commutes]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Polynomial.AlgebraMap.algebraOfAlgebra (L55-L67)\ninstance algebraOfAlgebra : Algebra R A[X] where\n smul_def' r p :=\ntoFinsupp_injective <| by\n dsimp only [RingHom.toFun_eq_coe, RingHom.comp_apply]\n rw [toFinsupp_smul, toFinsupp_mul, toFinsupp_C]\n exact Algebra.smul_def' _ _\n commutes' r p :=\n toFinsupp_injective <| by\n dsimp only [RingHom.toFun_eq_coe, RingHom.comp_apply]\n simp_rw [toFinsupp_mul, toFinsupp_C]\n convert Algebra.commutes' r p.toFinsupp\n algebraMap := C.comp (algebraMap R A)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Polynomial/Laurent.lean", "module": "Mathlib.Algebra.Polynomial.Laurent", "declaration": "Mathlib.Algebra.Polynomial.Laurent.trunc", "span": "L297-L299", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Laurent.lean#L297"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4561, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 11725, "lean_code_chars": 10222, "natural_language_chars": 1503, "lean_code_ratio": 0.8718, "line_count": 383, "imports_count": 0, "declarations_count": 1337, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "d92070639f1c4173", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.PNat.Xgcd.gcdB'", "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.Data.PNat.Xgcd)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef gcdB' : \u2115+\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.PNat.Xgcd.mk' (L79-L82)\ndef mk' (w : \u2115+) (x : \u2115) (y : \u2115) (z : \u2115+) (a : \u2115+) (b : \u2115+) : XgcdType :=\nmk w.val.pred x y z.val.pred a.val.pred b.val.pred\n\n/-- `w = wp + 1` -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.PNat.Xgcd.w (L83-L86)\ndef w : \u2115+ :=\nsuccPNat u.wp\n\n/-- `z = zp + 1` -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.PNat.Xgcd.z (L87-L90)\ndef z : \u2115+ :=\nsuccPNat u.zp\n\n/-- `a = ap + 1` -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.PNat.Xgcd.a (L91-L94)\ndef a : \u2115+ :=\nsuccPNat u.ap\n\n/-- `b = bp + 1` -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.PNat.Xgcd.b (L95-L98)\ndef b : \u2115+ :=\nsuccPNat u.bp\n\n/-- `r = a % b`: remainder -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.PNat.Xgcd.r (L99-L102)\ndef r : \u2115 :=\n(u.ap + 1) % (u.bp + 1)\n\n/-- `q = ap / bp`: quotient -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.PNat.Xgcd.q (L103-L106)\ndef q : \u2115 :=\n(u.ap + 1) / (u.bp + 1)\n\n/-- `qp = q - 1` -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.PNat.Xgcd.qp (L107-L114)\ndef qp : \u2115 :=\nu.q - 1\n\n/-- The map `v` gives the product of the matrix\n`[[w, x], [y, z]] = [[wp + 1, x], [y, zp + 1]]`\nand the vector `[a, b] = [ap + 1, bp + 1]`. The map\n`vp` gives `[sp, tp]` such that `v = [sp + 1, tp + 1]`.\n-/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.PNat.Xgcd.vp (L115-L118)\ndef vp : \u2115 \u00d7 \u2115 :=\n\u27e8u.wp + u.x + u.ap + u.wp * u.ap + u.x * u.bp, u.y + u.zp + u.bp + u.y * u.ap + u.zp * u.bp\u27e9\n\n/-- `v = [sp + 1, tp + 1]`, check `vp` -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.PNat.Xgcd.v (L119-L122)\ndef v : \u2115 \u00d7 \u2115 :=\n\u27e8u.w * u.a + u.x * u.b, u.y * u.a + u.z * u.b\u27e9\n\n/-- `succ\u2082 [t.1, t.2] = [t.1.succ, t.2.succ]` -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.PNat.Xgcd.succ\u2082 (L123-L125)\ndef succ\u2082 (t : \u2115 \u00d7 \u2115) : \u2115 \u00d7 \u2115 :=\n\u27e8t.1.succ, t.2.succ\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.PNat.Xgcd.v_eq_succ_vp (L126-L129)\ntheorem v_eq_succ_vp : u.v = succ\u2082 u.vp := by\next <;> dsimp [v, vp, w, z, a, b, succ\u2082] <;> ring_nf\n\n/-- `IsSpecial` holds if the matrix has determinant one. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.PNat.Xgcd.IsSpecial (L130-L133)\ndef IsSpecial : Prop :=\nu.wp + u.zp + u.wp * u.zp = u.x * u.y\n\n/-- `IsSpecial'` is an alternative of `IsSpecial`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.PNat.Xgcd.IsSpecial' (L134-L136)\ndef IsSpecial' : Prop :=\nu.w * u.z = succPNat (u.x * u.y)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.PNat.Xgcd.isSpecial_iff (L137-L150)\ntheorem isSpecial_iff : u.IsSpecial \u2194 u.IsSpecial' := by\ndsimp [IsSpecial, IsSpecial']\n let \u27e8wp, x, y, zp, ap, bp\u27e9 := u\n constructor <;> intro h <;> simp only [w, succPNat, succ_eq_add_one, z] at * <;>\n simp only [\u2190 coe_inj, mul_coe, mk_coe] at *\n \u00b7 simp_all [\u2190 h]; ring\n \u00b7 simp only [Nat.mul_add, Nat.add_mul, one_mul, mul_one, \u2190 Nat.add_assoc,\n Nat.add_right_cancel_iff] at h\n rw [\u2190 h]; ring\n\n/-- `IsReduced` holds if the two entries in the vector are the\nsame. The reduction algorithm will produce a system with this\nproperty, whose product vector is the same as for the original\nsystem. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_lt_succPNat (L84-L86)\ntheorem succPNat_lt_succPNat {m n : \u2115} : m.succPNat < n.succPNat \u2194 m < n :=\nsuccPNat_strictMono.lt_iff_lt\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_inj (L59-L61)\ntheorem natPred_inj {m n : \u2115+} : m.natPred = n.natPred \u2194 m = n :=\nnatPred_injective.eq_iff\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.PNat.Basic.coeAddHom (L119-L124)\ndef coeAddHom : AddHom \u2115+ \u2115 where\n toFun := (\u2191)\nmap_add' := add_coe\n\n\n/-- The order isomorphism between \u2115 and \u2115+ given by `succ`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_le_natPred (L55-L57)\ntheorem natPred_le_natPred {m n : \u2115+} : m.natPred \u2264 n.natPred \u2194 m \u2264 n :=\nnatPred_strictMono.le_iff_le\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.PNat.Basic.one_add_natPred (L33-L35)\ntheorem one_add_natPred (n : \u2115+) : 1 + n.natPred = n := by\nrw [natPred, add_tsub_cancel_iff_le.mpr <| show 1 \u2264 (n : \u2115) from n.2]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_le_succPNat (L88-L90)\ntheorem succPNat_le_succPNat {m n : \u2115} : m.succPNat \u2264 n.succPNat \u2194 m \u2264 n :=\nsuccPNat_strictMono.le_iff_le\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_injective (L91-L93)\ntheorem succPNat_injective : Function.Injective succPNat :=\nsuccPNat_strictMono.injective\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.PNat.Basic.add_one_le_iff (L136-L137)\ntheorem add_one_le_iff : \u2200 {a b : \u2115+}, a + 1 \u2264 b \u2194 a < b := Nat.add_one_le_iff\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.PNat.Basic.coe_inj (L110-L112)\ntheorem coe_inj {m n : \u2115+} : (m : \u2115) = n \u2194 m = n :=\nSubtype.ext_iff.symm\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.PNat.Basic.instOrderBot (L138-L141)\ninstance instOrderBot : OrderBot \u2115+ where\n bot := 1\nbot_le a := a.property\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_monotone (L44-L46)\ntheorem natPred_monotone : Monotone natPred :=\nnatPred_strictMono.monotone\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_injective (L47-L49)\ntheorem natPred_injective : Function.Injective natPred :=\nnatPred_strictMono.injective\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_lt_natPred (L51-L53)\ntheorem natPred_lt_natPred {m n : \u2115+} : m.natPred < n.natPred \u2194 m < n :=\nnatPred_strictMono.lt_iff_lt\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_strictMono (L77-L78)\ntheorem succPNat_strictMono : StrictMono succPNat := fun _ _ => Nat.succ_lt_succ\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_add_one (L37-L39)\ntheorem natPred_add_one (n : \u2115+) : n.natPred + 1 = n :=\n(add_comm _ _).trans n.one_add_natPred\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.PNat.Basic.bot_eq_one (L143-L146)\ntheorem bot_eq_one : (\u22a5 : \u2115+) = 1 :=\nrfl\n\n/-- Strong induction on `\u2115+`, with `n = 1` treated separately. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.PNat.Basic.val_ofNat (L63-L66)\nlemma val_ofNat (n : \u2115) [NeZero n] :\n ((ofNat(n) : \u2115+) : \u2115) = OfNat.ofNat n :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.PNat.Basic.mk_ofNat (L68-L75)\nlemma mk_ofNat (n : \u2115) (h : 0 < n) :\n @Eq \u2115+ (\u27e8ofNat(n), h\u27e9 : \u2115+) (haveI : NeZero n := \u27e8h.ne'\u27e9; OfNat.ofNat n) :=\nrfl\n\nend PNat\n\nnamespace Nat\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.PNat.Basic.recOn (L160-L168)\ndef recOn (n : \u2115+) {p : \u2115+ \u2192 Sort*} (one : p 1) (succ : \u2200 n, p n \u2192 p (n + 1)) : p n := by\nrcases n with \u27e8n, h\u27e9\n induction n with\n | zero => exact absurd h (by decide)\n | succ n IH =>\n rcases n with - | n\n \u00b7 exact one\n \u00b7 exact succ _ (IH n.succ_pos)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.PNat.Basic.add_coe (L114-L117)\ntheorem add_coe (m n : \u2115+) : ((m + n : \u2115+) : \u2115) = m + n :=\nrfl\n\n/-- `coe` promoted to an `AddHom`, that is, a morphism which preserves addition. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_mono (L80-L82)\ntheorem succPNat_mono : Monotone succPNat :=\nsuccPNat_strictMono.monotone\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_strictMono (L41-L42)\ntheorem natPred_strictMono : StrictMono natPred := fun m _ h => Nat.pred_lt_pred m.2.ne' h\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_inj (L95-L108)\ntheorem succPNat_inj {n m : \u2115} : succPNat n = succPNat m \u2194 n = m :=\nsuccPNat_injective.eq_iff\n\nend Nat\n\nnamespace PNat\n\nopen Nat\n\n/-- We now define a long list of structures on `\u2115+` induced by\nsimilar structures on `\u2115`. Most of these behave in a completely\nobvious way, but there are a few things to be said about\nsubtraction, division and powers.\n-/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.PNat.Basic.caseStrongInductionOn (L147-L158)\ndef caseStrongInductionOn {p : \u2115+ \u2192 Sort*} (a : \u2115+) (hz : p 1)\n (hi : \u2200 n, (\u2200 m, m \u2264 n \u2192 p m) \u2192 p (n + 1)) : p a := by\napply strongInductionOn a\n rintro \u27e8k, kprop\u27e9 hk\n rcases k with - | k\n \u00b7 exact (lt_irrefl 0 kprop).elim\n rcases k with - | k\n \u00b7 exact hz\n exact hi \u27e8k.succ, Nat.succ_pos _\u27e9 fun m hm => hk _ (Nat.lt_succ_iff.2 hm)\n\n/-- An induction principle for `\u2115+`: it takes values in `Sort*`, so it applies also to Types,\nnot only to `Prop`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.PNat.Basic.lt_add_one_iff (L134-L135)\ntheorem lt_add_one_iff : \u2200 {a b : \u2115+}, a < b + 1 \u2194 a \u2264 b := Nat.lt_add_one_iff\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.Data.PNat.Xgcd).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef gcdB' : \u2115+\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.PNat.Xgcd.mk' (L79-L82)\ndef mk' (w : \u2115+) (x : \u2115) (y : \u2115) (z : \u2115+) (a : \u2115+) (b : \u2115+) : XgcdType :=\nmk w.val.pred x y z.val.pred a.val.pred b.val.pred\n\n/-- `w = wp + 1` -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.PNat.Xgcd.w (L83-L86)\ndef w : \u2115+ :=\nsuccPNat u.wp\n\n/-- `z = zp + 1` -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.PNat.Xgcd.z (L87-L90)\ndef z : \u2115+ :=\nsuccPNat u.zp\n\n/-- `a = ap + 1` -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.PNat.Xgcd.a (L91-L94)\ndef a : \u2115+ :=\nsuccPNat u.ap\n\n/-- `b = bp + 1` -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.PNat.Xgcd.b (L95-L98)\ndef b : \u2115+ :=\nsuccPNat u.bp\n\n/-- `r = a % b`: remainder -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.PNat.Xgcd.r (L99-L102)\ndef r : \u2115 :=\n(u.ap + 1) % (u.bp + 1)\n\n/-- `q = ap / bp`: quotient -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.PNat.Xgcd.q (L103-L106)\ndef q : \u2115 :=\n(u.ap + 1) / (u.bp + 1)\n\n/-- `qp = q - 1` -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.PNat.Xgcd.qp (L107-L114)\ndef qp : \u2115 :=\nu.q - 1\n\n/-- The map `v` gives the product of the matrix\n`[[w, x], [y, z]] = [[wp + 1, x], [y, zp + 1]]`\nand the vector `[a, b] = [ap + 1, bp + 1]`. The map\n`vp` gives `[sp, tp]` such that `v = [sp + 1, tp + 1]`.\n-/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.PNat.Xgcd.vp (L115-L118)\ndef vp : \u2115 \u00d7 \u2115 :=\n\u27e8u.wp + u.x + u.ap + u.wp * u.ap + u.x * u.bp, u.y + u.zp + u.bp + u.y * u.ap + u.zp * u.bp\u27e9\n\n/-- `v = [sp + 1, tp + 1]`, check `vp` -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.PNat.Xgcd.v (L119-L122)\ndef v : \u2115 \u00d7 \u2115 :=\n\u27e8u.w * u.a + u.x * u.b, u.y * u.a + u.z * u.b\u27e9\n\n/-- `succ\u2082 [t.1, t.2] = [t.1.succ, t.2.succ]` -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.PNat.Xgcd.succ\u2082 (L123-L125)\ndef succ\u2082 (t : \u2115 \u00d7 \u2115) : \u2115 \u00d7 \u2115 :=\n\u27e8t.1.succ, t.2.succ\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.PNat.Xgcd.v_eq_succ_vp (L126-L129)\ntheorem v_eq_succ_vp : u.v = succ\u2082 u.vp := by\next <;> dsimp [v, vp, w, z, a, b, succ\u2082] <;> ring_nf\n\n/-- `IsSpecial` holds if the matrix has determinant one. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.PNat.Xgcd.IsSpecial (L130-L133)\ndef IsSpecial : Prop :=\nu.wp + u.zp + u.wp * u.zp = u.x * u.y\n\n/-- `IsSpecial'` is an alternative of `IsSpecial`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.PNat.Xgcd.IsSpecial' (L134-L136)\ndef IsSpecial' : Prop :=\nu.w * u.z = succPNat (u.x * u.y)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.PNat.Xgcd.isSpecial_iff (L137-L150)\ntheorem isSpecial_iff : u.IsSpecial \u2194 u.IsSpecial' := by\ndsimp [IsSpecial, IsSpecial']\n let \u27e8wp, x, y, zp, ap, bp\u27e9 := u\n constructor <;> intro h <;> simp only [w, succPNat, succ_eq_add_one, z] at * <;>\n simp only [\u2190 coe_inj, mul_coe, mk_coe] at *\n \u00b7 simp_all [\u2190 h]; ring\n \u00b7 simp only [Nat.mul_add, Nat.add_mul, one_mul, mul_one, \u2190 Nat.add_assoc,\n Nat.add_right_cancel_iff] at h\n rw [\u2190 h]; ring\n\n/-- `IsReduced` holds if the two entries in the vector are the\nsame. The reduction algorithm will produce a system with this\nproperty, whose product vector is the same as for the original\nsystem. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_lt_succPNat (L84-L86)\ntheorem succPNat_lt_succPNat {m n : \u2115} : m.succPNat < n.succPNat \u2194 m < n :=\nsuccPNat_strictMono.lt_iff_lt\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_inj (L59-L61)\ntheorem natPred_inj {m n : \u2115+} : m.natPred = n.natPred \u2194 m = n :=\nnatPred_injective.eq_iff\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.PNat.Basic.coeAddHom (L119-L124)\ndef coeAddHom : AddHom \u2115+ \u2115 where\n toFun := (\u2191)\nmap_add' := add_coe\n\n\n/-- The order isomorphism between \u2115 and \u2115+ given by `succ`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_le_natPred (L55-L57)\ntheorem natPred_le_natPred {m n : \u2115+} : m.natPred \u2264 n.natPred \u2194 m \u2264 n :=\nnatPred_strictMono.le_iff_le\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.PNat.Basic.one_add_natPred (L33-L35)\ntheorem one_add_natPred (n : \u2115+) : 1 + n.natPred = n := by\nrw [natPred, add_tsub_cancel_iff_le.mpr <| show 1 \u2264 (n : \u2115) from n.2]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_le_succPNat (L88-L90)\ntheorem succPNat_le_succPNat {m n : \u2115} : m.succPNat \u2264 n.succPNat \u2194 m \u2264 n :=\nsuccPNat_strictMono.le_iff_le\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_injective (L91-L93)\ntheorem succPNat_injective : Function.Injective succPNat :=\nsuccPNat_strictMono.injective\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.PNat.Basic.add_one_le_iff (L136-L137)\ntheorem add_one_le_iff : \u2200 {a b : \u2115+}, a + 1 \u2264 b \u2194 a < b := Nat.add_one_le_iff\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.PNat.Basic.coe_inj (L110-L112)\ntheorem coe_inj {m n : \u2115+} : (m : \u2115) = n \u2194 m = n :=\nSubtype.ext_iff.symm\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.PNat.Basic.instOrderBot (L138-L141)\ninstance instOrderBot : OrderBot \u2115+ where\n bot := 1\nbot_le a := a.property\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_monotone (L44-L46)\ntheorem natPred_monotone : Monotone natPred :=\nnatPred_strictMono.monotone\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_injective (L47-L49)\ntheorem natPred_injective : Function.Injective natPred :=\nnatPred_strictMono.injective\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_lt_natPred (L51-L53)\ntheorem natPred_lt_natPred {m n : \u2115+} : m.natPred < n.natPred \u2194 m < n :=\nnatPred_strictMono.lt_iff_lt\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_strictMono (L77-L78)\ntheorem succPNat_strictMono : StrictMono succPNat := fun _ _ => Nat.succ_lt_succ\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_add_one (L37-L39)\ntheorem natPred_add_one (n : \u2115+) : n.natPred + 1 = n :=\n(add_comm _ _).trans n.one_add_natPred\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.PNat.Basic.bot_eq_one (L143-L146)\ntheorem bot_eq_one : (\u22a5 : \u2115+) = 1 :=\nrfl\n\n/-- Strong induction on `\u2115+`, with `n = 1` treated separately. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.PNat.Basic.val_ofNat (L63-L66)\nlemma val_ofNat (n : \u2115) [NeZero n] :\n ((ofNat(n) : \u2115+) : \u2115) = OfNat.ofNat n :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.PNat.Basic.mk_ofNat (L68-L75)\nlemma mk_ofNat (n : \u2115) (h : 0 < n) :\n @Eq \u2115+ (\u27e8ofNat(n), h\u27e9 : \u2115+) (haveI : NeZero n := \u27e8h.ne'\u27e9; OfNat.ofNat n) :=\nrfl\n\nend PNat\n\nnamespace Nat\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.PNat.Basic.recOn (L160-L168)\ndef recOn (n : \u2115+) {p : \u2115+ \u2192 Sort*} (one : p 1) (succ : \u2200 n, p n \u2192 p (n + 1)) : p n := by\nrcases n with \u27e8n, h\u27e9\n induction n with\n | zero => exact absurd h (by decide)\n | succ n IH =>\n rcases n with - | n\n \u00b7 exact one\n \u00b7 exact succ _ (IH n.succ_pos)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.PNat.Basic.add_coe (L114-L117)\ntheorem add_coe (m n : \u2115+) : ((m + n : \u2115+) : \u2115) = m + n :=\nrfl\n\n/-- `coe` promoted to an `AddHom`, that is, a morphism which preserves addition. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_mono (L80-L82)\ntheorem succPNat_mono : Monotone succPNat :=\nsuccPNat_strictMono.monotone\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.PNat.Basic.natPred_strictMono (L41-L42)\ntheorem natPred_strictMono : StrictMono natPred := fun m _ h => Nat.pred_lt_pred m.2.ne' h\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.PNat.Basic.succPNat_inj (L95-L108)\ntheorem succPNat_inj {n m : \u2115} : succPNat n = succPNat m \u2194 n = m :=\nsuccPNat_injective.eq_iff\n\nend Nat\n\nnamespace PNat\n\nopen Nat\n\n/-- We now define a long list of structures on `\u2115+` induced by\nsimilar structures on `\u2115`. Most of these behave in a completely\nobvious way, but there are a few things to be said about\nsubtraction, division and powers.\n-/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.PNat.Basic.caseStrongInductionOn (L147-L158)\ndef caseStrongInductionOn {p : \u2115+ \u2192 Sort*} (a : \u2115+) (hz : p 1)\n (hi : \u2200 n, (\u2200 m, m \u2264 n \u2192 p m) \u2192 p (n + 1)) : p a := by\napply strongInductionOn a\n rintro \u27e8k, kprop\u27e9 hk\n rcases k with - | k\n \u00b7 exact (lt_irrefl 0 kprop).elim\n rcases k with - | k\n \u00b7 exact hz\n exact hi \u27e8k.succ, Nat.succ_pos _\u27e9 fun m hm => hk _ (Nat.lt_succ_iff.2 hm)\n\n/-- An induction principle for `\u2115+`: it takes values in `Sort*`, so it applies also to Types,\nnot only to `Prop`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.PNat.Basic.lt_add_one_iff (L134-L135)\ntheorem lt_add_one_iff : \u2200 {a b : \u2115+}, a < b + 1 \u2194 a \u2264 b := Nat.lt_add_one_iff\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/PNat/Xgcd.lean", "module": "Mathlib.Data.PNat.Xgcd", "declaration": "Mathlib.Data.PNat.Xgcd.gcdB'", "span": "L383-L385", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/PNat/Xgcd.lean#L383"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3616, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 8662, "lean_code_chars": 7171, "natural_language_chars": 1491, "lean_code_ratio": 0.8279, "line_count": 366, "imports_count": 0, "declarations_count": 901, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "ca1323a7541db6b2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Combinatorics.SimpleGraph.Metric.Reachable", "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.Combinatorics.SimpleGraph.Metric)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma Reachable.dist_triangle_right (h : G.Reachable v w) (u) :\n G.dist u w \u2264 G.dist u v + G.dist v w\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_sInf (L58-L67)\ntheorem edist_eq_sInf : G.edist u v = sInf (Set.range fun w : G.Walk u v \u21a6 (w.length : \u2115\u221e)) := rfl\nprotected theorem Reachable.exists_walk_length_eq_edist (hr : G.Reachable u v) :\n \u2203 p : G.Walk u v, p.length = G.edist u v :=\n csInf_mem <| Set.range_nonempty_iff_nonempty.mpr hr\n\nprotected theorem Connected.exists_walk_length_eq_edist (hconn : G.Connected) (u v : V) :\n \u2203 p : G.Walk u v, p.length = G.edist u v :=\n (hconn u v).exists_walk_length_eq_edist\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_le (L68-L72)\ntheorem edist_le (p : G.Walk u v) :\n G.edist u v \u2264 p.length :=\nsInf_le \u27e8p, rfl\u27e9\nprotected alias Walk.edist_le := edist_le\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_zero_iff (L74-L77)\ntheorem edist_eq_zero_iff :\n G.edist u v = 0 \u2194 u = v := by\napply Iff.intro <;> simp [edist, ENat.iInf_eq_zero]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_self (L79-L81)\ntheorem edist_self : edist G v v = 0 :=\nedist_eq_zero_iff.mpr rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_pos_of_ne (L82-L85)\ntheorem edist_pos_of_ne (hne : u \u2260 v) :\n 0 < G.edist u v :=\npos_iff_ne_zero.mpr <| edist_eq_zero_iff.ne.mpr hne\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_top_of_not_reachable (L86-L89)\nlemma edist_eq_top_of_not_reachable (h : \u00acG.Reachable u v) :\n G.edist u v = \u22a4 := by\nsimp [edist, not_reachable_iff_isEmpty_walk.mp h]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.reachable_of_edist_ne_top (L90-L93)\ntheorem reachable_of_edist_ne_top (h : G.edist u v \u2260 \u22a4) :\n G.Reachable u v :=\nnot_not.mp <| edist_eq_top_of_not_reachable.mt h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.exists_walk_of_edist_ne_top (L94-L109)\nlemma exists_walk_of_edist_ne_top (h : G.edist u v \u2260 \u22a4) :\n \u2203 p : G.Walk u v, p.length = G.edist u v :=\n(reachable_of_edist_ne_top h).exists_walk_length_eq_edist\n\nprotected theorem edist_triangle : G.edist u w \u2264 G.edist u v + G.edist v w := by\n cases eq_or_ne (G.edist u v) \u22a4 with\n | inl huv => simp [huv]\n | inr huv =>\n cases eq_or_ne (G.edist v w) \u22a4 with\n | inl hvw => simp [hvw]\n | inr hvw =>\n obtain \u27e8p, hp\u27e9 := exists_walk_of_edist_ne_top huv\n obtain \u27e8q, hq\u27e9 := exists_walk_of_edist_ne_top hvw\n rw [\u2190 hp, \u2190 hq, \u2190 Nat.cast_add, \u2190 Walk.length_append]\n exact edist_le _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_comm (L110-L114)\ntheorem edist_comm : G.edist u v = G.edist v u := by\nrw [edist_eq_sInf, \u2190 Set.image_univ, \u2190 Set.image_univ_of_surjective Walk.reverse_surjective,\n \u2190 Set.image_comp, Set.image_univ, Function.comp_def]\n simp_rw [Walk.length_reverse, \u2190 edist_eq_sInf]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.exists_walk_of_edist_eq_coe (L115-L120)\nlemma exists_walk_of_edist_eq_coe {k : \u2115} (h : G.edist u v = k) :\n \u2203 p : G.Walk u v, p.length = k :=\nhave : G.edist u v \u2260 \u22a4 := by rw [h]; exact ENat.coe_ne_top _\n have \u27e8p, hp\u27e9 := exists_walk_of_edist_ne_top this\n \u27e8p, Nat.cast_injective (hp.trans h)\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_ne_top_iff_reachable (L121-L129)\nlemma edist_ne_top_iff_reachable : G.edist u v \u2260 \u22a4 \u2194 G.Reachable u v := by\nrefine \u27e8reachable_of_edist_ne_top, fun h \u21a6 ?_\u27e9\n by_contra hx\n simp only [edist, iInf_eq_top, ENat.coe_ne_top] at hx\n exact h.elim hx\n\n/--\nThe extended distance between vertices is equal to `1` if and only if these vertices are adjacent.\n-/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_one_iff_adj (L131-L136)\ntheorem edist_eq_one_iff_adj : G.edist u v = 1 \u2194 G.Adj u v := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_walk_of_edist_ne_top <| by rw [h]; simp\n exact w.adj_of_length_eq_one <| Nat.cast_eq_one.mp <| h \u25b8 hw\n \u00b7 exact le_antisymm (edist_le h.toWalk) (Order.one_le_iff_pos.mpr <| edist_pos_of_ne h.ne)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_le_one_iff_adj_or_eq (L137-L144)\nlemma edist_le_one_iff_adj_or_eq : G.edist u v \u2264 1 \u2194 G.Adj u v \u2228 u = v := by\nby_cases huv : u = v\n \u00b7 simp [huv]\n \u00b7 simp only [huv, or_false]\n have h : 0 < G.edist u v := edist_pos_of_ne huv\n rw [(Order.one_le_iff_pos.mpr h).ge_iff_eq']\n exact edist_eq_one_iff_adj\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_two_iff (L145-L161)\nlemma edist_eq_two_iff {u v : V} :\n G.edist u v = 2 \u2194 u \u2260 v \u2227 \u00ac G.Adj u v \u2227 (G.commonNeighbors u v).Nonempty := by\nrefine \u27e8fun h \u21a6 \u27e8?_, ?_, ?_\u27e9, fun h \u21a6 le_antisymm ?_ ?_\u27e9\n \u00b7 simp +decide [\u2190 G.edist_eq_zero_iff.not (b := u = v), h]\n \u00b7 simp +decide [\u2190 edist_eq_one_iff_adj, h]\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_walk_of_edist_eq_coe h\n use w.getVert 1\n suffices w.getVert 1 \u2208 G.commonNeighbors (w.getVert 0) (w.getVert w.length) by simpa\n refine hw \u25b8 G.mem_commonNeighbors.mp ?_\n exact \u27e8w.adj_getVert_succ (by simp [hw]), (w.adj_getVert_succ (by simp [hw])).symm\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := h.2.2\n rw [mem_commonNeighbors] at hw\n have := (Walk.cons hw.1 <| .cons hw.2.symm .nil).edist_le\n simp_all\n \u00b7 by_contra! hc\n cases ENat.le_one_iff_eq_zero_or_eq_one.mp (Order.le_of_lt_succ hc) <;> simp_all\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.two_lt_edist_iff (L162-L174)\nlemma two_lt_edist_iff {u v : V} :\n 2 < G.edist u v \u2194 u \u2260 v \u2227 \u00ac G.Adj u v \u2227 (G.commonNeighbors u v) = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 lt_of_le_of_ne ?_ (Ne.symm ?_)\u27e9\n \u00b7 have hn : u \u2260 v := fun hc \u21a6 by simp [hc] at h\n have : \u00ac G.Adj u v := fun hc \u21a6 by simp +decide [edist_eq_one_iff_adj.mpr hc] at h\n use hn, this\n by_contra! hc\n simp [edist_eq_two_iff.mpr \u27e8hn, this, hc\u27e9] at h\n \u00b7 rw [\u2190 one_add_one_eq_two]\n refine Order.add_one_le_of_lt <| lt_of_le_of_ne ?_ ?_\n <;> grind [Order.one_le_iff_pos, pos_iff_ne_zero, edist_eq_zero_iff, edist_eq_one_iff_adj]\n \u00b7 simp_all [edist_eq_two_iff]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsAcyclic (L55-L57)\ndef IsAcyclic : Prop := \u2200 \u2983v : V\u2984 (c : G.Walk v v), \u00acc.IsCycle\n/-- A *tree* is a connected acyclic graph. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_maximal_isAcyclic_of_le_isAcyclic (L127-L135)\ntheorem exists_maximal_isAcyclic_of_le_isAcyclic\n {H : SimpleGraph V} (hHG : H \u2264 G) (hH : H.IsAcyclic) :\n \u2203 H' : SimpleGraph V, H \u2264 H' \u2227 Maximal (fun H => H \u2264 G \u2227 H.IsAcyclic) H' := by\nrefine zorn_le_nonempty\u2080 {H | H \u2264 G \u2227 H.IsAcyclic} (fun c hcs hc y hy \u21a6 ?_) _ \u27e8hHG, hH\u27e9\n refine \u27e8sSup c, \u27e8?_, ?_\u27e9, fun _ \u21a6 le_sSup\u27e9\n \u00b7 grind [sSup_le_iff]\n \u00b7 exact isAcyclic_sSup_of_isAcyclic_directedOn c (by grind) hc.directedOn\n\n/-- A connected component of an acyclic graph is a tree. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Iso (L80-L83)\nlemma Iso.isAcyclic_iff (f : G \u2243g G') : G.IsAcyclic \u2194 G'.IsAcyclic :=\n\u27e8fun h \u21a6 h.embedding f.symm, fun h \u21a6 h.embedding f\u27e9\n\n/-- Isomorphic graphs are trees together. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_adj_isBridge (L167-L180)\ntheorem isAcyclic_iff_forall_adj_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984, G.Adj v w \u2192 G.IsBridge s(v, w) := by\nsimp_rw [isBridge_iff_adj_and_forall_cycle_notMem]\n constructor\n \u00b7 intro ha v w hvw\n apply And.intro hvw\n intro u p hp\n cases ha p hp\n \u00b7 rintro hb v (_ | \u27e8ha, p\u27e9) hp\n \u00b7 exact hp.not_of_nil\n \u00b7 apply (hb ha).2 _ hp\n rw [Walk.edges_cons]\n apply List.mem_cons_self\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_reachable_eq (L413-L427)\ntheorem maximal_isAcyclic_iff_reachable_eq {F : SimpleGraph V} (hle : F \u2264 G) (hF : F.IsAcyclic) :\n Maximal (fun F \u21a6 F \u2264 G \u2227 F.IsAcyclic) F \u2194 F.Reachable = G.Reachable := by\nrefine \u27e8reachable_eq_of_maximal_isAcyclic F, fun h \u21a6 ?_\u27e9\n by_contra\n have \u27e8H, hFH, hHG, hH\u27e9 := exists_gt_of_not_maximal \u27e8hle, hF\u27e9 this\n have \u27e8e, heH, heF\u27e9 := Set.exists_of_ssubset <| edgeSet_strict_mono hFH\n have h_bridge : (F \u2294 fromEdgeSet {e}).IsBridge e := by\n refine isAcyclic_iff_forall_edge_isBridge.mp ?_ <| by simp [H.not_isDiag_of_mem_edgeSet heH]\n exact hH.anti <| sup_le_iff.mpr \u27e8hFH.le, H.fromEdgeSet_le.mpr <| by grind\u27e9\n have : (F \u2294 fromEdgeSet {e}) \\ fromEdgeSet {e} = F := by simpa using heF\n cases e\n rw [isBridge_iff, this, h] at h_bridge\n exact h_bridge.right <| hHG heH |>.reachable\n\n/-- A subgraph of a connected graph is maximal acyclic iff it is a tree. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_pairwise_not_isEdgeReachable_two (L650-L658)\nlemma isAcyclic_iff_pairwise_not_isEdgeReachable_two :\n G.IsAcyclic \u2194 Pairwise (\u00acG.IsEdgeReachable 2 \u00b7 \u00b7) := by\nrefine \u27e8fun h _ _ hne he \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_isCycle_of_two_le_isEdgeReachable hne le_rfl he\n exact h w hw\n \u00b7 refine isAcyclic_iff_forall_adj_isBridge.mpr fun _ _ hadj \u21a6 ?_\n exact isBridge_iff_adj_and_not_isEdgeConnected_two.mpr \u27e8hadj, h hadj.ne\u27e9\n\nend SimpleGraph\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_edge_isBridge (L181-L184)\ntheorem isAcyclic_iff_forall_edge_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983e\u2984, e \u2208 (G.edgeSet) \u2192 G.IsBridge e := by\nsimp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sSup_of_isAcyclic_directedOn (L118-L126)\nlemma isAcyclic_sSup_of_isAcyclic_directedOn (Hs : Set <| SimpleGraph V)\n (h_acyc : \u2200 H \u2208 Hs, H.IsAcyclic) (h_dir : DirectedOn (\u00b7 \u2264 \u00b7) Hs) : IsAcyclic (sSup Hs) := by\nrcases Hs.eq_empty_or_nonempty with rfl | hnemp\n \u00b7 simp\n \u00b7 intro u p hp\n obtain \u27e8H, hH, hpH\u27e9 := p.exists_mem_contains_edges_of_directed Hs hnemp h_dir\n exact h_acyc H hH (p.transfer H hpH) <| Walk.IsCycle.transfer hp hpH\n\n/-- Every acyclic subgraph `H \u2264 G` is contained in a maximal such subgraph. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_maximal_isAcyclic (L444-L449)\ntheorem isTree_iff_maximal_isAcyclic : G.IsTree \u2194 Nonempty V \u2227 Maximal IsAcyclic G := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8_, h\u27e9 \u21a6 G.maximal_isAcyclic_iff_isTree.mp h\u27e9\n have := h.nonempty\n exact \u27e8this, G.maximal_isAcyclic_iff_isTree.mpr h\u27e9\n\n/-- Every acyclic subgraph can be extended to a spanning forest. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_add_edge_iff_of_not_reachable (L374-L379)\ntheorem isAcyclic_add_edge_iff_of_not_reachable (x y : V) (hxy : \u00ac G.Reachable x y) :\n (G \u2294 fromEdgeSet {s(x, y)}).IsAcyclic \u2194 IsAcyclic G :=\n\u27e8.anti le_sup_left, .isAcyclic_sup_fromEdgeSet_of_not_reachable hxy\u27e9\n\n/-- Adding an edge results in an acyclic graph iff the original graph was acyclic and\nthe edge connects vertices that previously had no path between them. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Subgraph (L151-L153)\nlemma Subgraph.isAcyclic_coe_bot (G : SimpleGraph V) : (\u22a5 : G.Subgraph).coe.IsAcyclic :=\n@IsAcyclic.of_subsingleton _ (Set.isEmpty_coe_sort.mpr rfl).instSubsingleton _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_connected_and_card (L486-L499)\nlemma isTree_iff_connected_and_card [Finite V] :\n G.IsTree \u2194 G.Connected \u2227 Nat.card G.edgeSet + 1 = Nat.card V := by\nhave := Fintype.ofFinite V\n classical\n refine \u27e8fun h \u21a6 \u27e8h.connected, by simpa [edgeFinset] using h.card_edgeFinset\u27e9,\n fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 \u27e8h\u2081, ?_\u27e9\u27e9\n simp_rw [isAcyclic_iff_forall_adj_isBridge]\n refine fun x y h \u21a6 by_contra fun hbr \u21a6\n (h\u2081.connected_delete_edge_of_not_isBridge hbr).card_vert_le_card_edgeSet_add_one.not_gt ?_\n rw [Nat.card_eq_fintype_card, \u2190 edgeFinset_card, \u2190 h\u2082, Nat.card_eq_fintype_card,\n \u2190 edgeFinset_card, add_lt_add_iff_right]\n exact Finset.card_lt_card <| by simpa [deleteEdges, edgeFinset]\n\n/-- The minimum degree of all vertices in a nontrivial tree is one. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Connected (L428-L436)\ntheorem Connected.maximal_le_isAcyclic_iff_isTree {T : SimpleGraph V} (hG : G.Connected)\n (hT : T \u2264 G) : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) T \u2194 T.IsTree := by\nhave := hG.nonempty\n refine \u27e8fun h \u21a6 \u27e8\u27e8fun u v \u21a6 ?_\u27e9, h.1.2\u27e9, fun hT' \u21a6 ?_\u27e9\n \u00b7 exact G.reachable_eq_of_maximal_isAcyclic T h \u25b8 hG.preconnected u v\n \u00b7 rw [maximal_isAcyclic_iff_reachable_eq hT hT'.isAcyclic,\n T.preconnected_iff_reachable_eq_top.mp hT'.preconnected,\n G.preconnected_iff_reachable_eq_top.mp hG.preconnected]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isCycle_of_two_le_isEdgeReachable (L642-L649)\nlemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u \u2260 v) {n : \u2115} (hn : 2 \u2264 n)\n (h : G.IsEdgeReachable n u v) : \u2203 w : G.Walk u u, w.IsCycle := by\nclassical\n obtain \u27e8w, hw, h\u27e9 := exists_adj_isEdgeReachable_two huv (h.anti hn)\n have := @h {s(u, w)} (by simp)\n obtain \u27e8w, p, hp\u2081, hp\u2082\u27e9 := adj_and_reachable_delete_edges_iff_exists_cycle.mp \u27e8hw, this\u27e9\n exact \u27e8p.rotate _ (p.fst_mem_support_of_mem_edges hp\u2082), IsCycle.rotate hp\u2081 _\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sup_fromEdgeSet_iff (L380-L396)\ntheorem isAcyclic_sup_fromEdgeSet_iff {u v : V} :\n (G \u2294 fromEdgeSet {s(u, v)}).IsAcyclic \u2194\n G.IsAcyclic \u2227 (G.Reachable u v \u2192 u = v \u2228 G.Adj u v) := by\nby_cases huv : u = v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, Sym2.mem_diagSet, Sym2.mk_isDiag_iff]\n by_cases hadj : G.Adj u v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, mem_edgeSet]\n refine \u27e8?_, fun \u27e8hacyc, hreach\u27e9 \u21a6 hacyc.isAcyclic_sup_fromEdgeSet_of_not_reachable <| by grind\u27e9\n refine fun hacyc \u21a6 \u27e8hacyc.anti le_sup_left, fun hreach \u21a6 False.elim ?_\u27e9\n have := isAcyclic_iff_forall_edge_isBridge.mp (e := s(u, v)) hacyc <| by simp [huv]\n refine isBridge_iff.mp this |>.right <| hreach.mono <| Eq.le <| Eq.symm ?_\n rw [sup_sdiff_right_self]\n exact deleteEdges_eq_self.mpr <| Set.disjoint_singleton_right.mpr hadj\n\n/--\nThe reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsTree (L154-L156)\nlemma IsTree.of_subsingleton [Nonempty V] [Subsingleton V] {G : SimpleGraph V} : G.IsTree :=\n\u27e8.of_subsingleton, .of_subsingleton\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_path_unique (L225-L227)\ntheorem isAcyclic_iff_path_unique : G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984 (p q : G.Path v w), p = q :=\n\u27e8IsAcyclic.path_unique, isAcyclic_of_path_unique\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_existsUnique_path (L248-L269)\ntheorem isTree_iff_existsUnique_path :\n G.IsTree \u2194 Nonempty V \u2227 \u2200 v w : V, \u2203! p : G.Walk v w, p.IsPath := by\nclassical\n rw [isTree_iff, isAcyclic_iff_path_unique]\n constructor\n \u00b7 rintro \u27e8hc, hu\u27e9\n refine \u27e8hc.nonempty, ?_\u27e9\n intro v w\n let q := (hc v w).some.toPath\n use q\n simp only [true_and, Path.isPath]\n intro p hp\n specialize hu \u27e8p, hp\u27e9 q\n exact Subtype.ext_iff.mp hu\n \u00b7 rintro \u27e8hV, h\u27e9\n refine \u27e8Connected.mk ?_, ?_\u27e9\n \u00b7 intro v w\n obtain \u27e8p, _\u27e9 := h v w\n exact p.reachable\n \u00b7 rintro v w \u27e8p, hp\u27e9 \u27e8q, hq\u27e9\n simp only [ExistsUnique.unique (h v w) hp hq]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic (L450-L456)\ntheorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H \u2264 G)\n (hH_isAcyclic : H.IsAcyclic) :\n \u2203 F : SimpleGraph V, H \u2264 F \u2227 F \u2264 G \u2227 F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic\n grind [maximal_isAcyclic_iff_reachable_eq, Maximal]\n\n/-- Every graph has a spanning forest. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le (L457-L462)\ntheorem exists_isAcyclic_reachable_eq_le :\n \u2203 F \u2264 G, F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot\n grind\n\n/-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_of_path_unique (L214-L224)\ntheorem isAcyclic_of_path_unique (h : \u2200 (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by\nintro v c hc\n simp only [Walk.isCycle_def, Ne] at hc\n cases c with\n | nil => cases hc.2.1 rfl\n | cons ha c' =>\n simp only [Walk.isTrail_cons, Walk.support_cons, List.tail_cons] at hc\n specialize h _ _ \u27e8c', by simp only [Walk.isPath_def, hc.2]\u27e9 (Path.singleton ha.symm)\n rw [Path.singleton, Subtype.mk.injEq] at h\n simp [h] at hc\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.reachable_eq_of_maximal_isAcyclic (L397-L412)\nlemma reachable_eq_of_maximal_isAcyclic (F : SimpleGraph V)\n (h : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) F) : F.Reachable = G.Reachable := by\next u v\n refine \u27e8.mono h.prop.left, fun \u27e8p\u27e9 \u21a6 ?_\u27e9\n by_contra\n let s : F.ConnectedComponent := .mk _ u\n have : v \u2209 s := this \u2218 s.reachable_of_mem_supp rfl\n have : \u2203 d \u2208 p.darts, d.fst \u2208 s \u2227 d.snd \u2209 s := p.exists_boundary_dart s rfl this\n rcases this with \u27e8\u27e8\u27e8u', v'\u27e9, huv\u27e9, _, hu, hv\u27e9\n have : \u00acF.Reachable v' u' := mt ConnectedComponent.sound <| s.mem_supp_iff u' |>.mp hu \u25b8 hv\n suffices F \u2294 fromEdgeSet {s(v', u')} \u2264 F by\n grind [Adj.reachable, sup_le_iff, le_iff_adj, fromEdgeSet_adj]\n refine h.le_of_ge \u27e8?_, h.prop.right.isAcyclic_sup_fromEdgeSet_of_not_reachable this\u27e9 le_sup_left\n grind [Maximal, sup_le, le_iff_adj, fromEdgeSet_adj, huv.symm]\n\n/-- A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_isTree (L438-L443)\ntheorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :\n Maximal IsAcyclic T \u2194 T.IsTree := by\nsimp [\u2190 connected_top.maximal_le_isAcyclic_iff_isTree le_top]\n\n/-- A maximally acyclic graph is a tree. This is similar to `maximal_isAcyclic_iff_isTree` except\nwith `Nonempty V` as part of the iff rather than an assumption. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_of_minimal_connected (L353-L359)\nlemma isTree_of_minimal_connected (h : Minimal Connected G) : IsTree G := by\nrw [isTree_iff, and_iff_right h.prop, isAcyclic_iff_forall_adj_isBridge]\n exact fun _ _ _ \u21a6 by_contra fun hbr \u21a6 h.not_prop_of_lt\n (by simpa [deleteEdges, \u2190 edgeSet_ssubset_edgeSet])\n <| h.prop.connected_delete_edge_of_not_isBridge hbr\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_minimal_connected (L360-L368)\nlemma isTree_iff_minimal_connected : IsTree G \u2194 Minimal Connected G := by\nrefine \u27e8fun htree \u21a6 \u27e8htree.connected, fun G' h' hle u v hadj \u21a6 ?_\u27e9, isTree_of_minimal_connected\u27e9\n have \u27e8p, hp\u27e9 := h'.exists_isPath u v\n have := congrArg Walk.edges <| congrArg Subtype.val <|\n htree.isAcyclic.path_unique \u27e8p.mapLe hle, hp.mapLe hle\u27e9 <| Path.singleton hadj\n simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this\n simp [this, p.adj_of_mem_edges]\n\n/-- Connecting two unreachable vertices by an edge preserves acyclicity. -/\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.Combinatorics.SimpleGraph.Metric).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma Reachable.dist_triangle_right (h : G.Reachable v w) (u) :\n G.dist u w \u2264 G.dist u v + G.dist v w\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_sInf (L58-L67)\ntheorem edist_eq_sInf : G.edist u v = sInf (Set.range fun w : G.Walk u v \u21a6 (w.length : \u2115\u221e)) := rfl\nprotected theorem Reachable.exists_walk_length_eq_edist (hr : G.Reachable u v) :\n \u2203 p : G.Walk u v, p.length = G.edist u v :=\n csInf_mem <| Set.range_nonempty_iff_nonempty.mpr hr\n\nprotected theorem Connected.exists_walk_length_eq_edist (hconn : G.Connected) (u v : V) :\n \u2203 p : G.Walk u v, p.length = G.edist u v :=\n (hconn u v).exists_walk_length_eq_edist\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_le (L68-L72)\ntheorem edist_le (p : G.Walk u v) :\n G.edist u v \u2264 p.length :=\nsInf_le \u27e8p, rfl\u27e9\nprotected alias Walk.edist_le := edist_le\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_zero_iff (L74-L77)\ntheorem edist_eq_zero_iff :\n G.edist u v = 0 \u2194 u = v := by\napply Iff.intro <;> simp [edist, ENat.iInf_eq_zero]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_self (L79-L81)\ntheorem edist_self : edist G v v = 0 :=\nedist_eq_zero_iff.mpr rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_pos_of_ne (L82-L85)\ntheorem edist_pos_of_ne (hne : u \u2260 v) :\n 0 < G.edist u v :=\npos_iff_ne_zero.mpr <| edist_eq_zero_iff.ne.mpr hne\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_top_of_not_reachable (L86-L89)\nlemma edist_eq_top_of_not_reachable (h : \u00acG.Reachable u v) :\n G.edist u v = \u22a4 := by\nsimp [edist, not_reachable_iff_isEmpty_walk.mp h]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.reachable_of_edist_ne_top (L90-L93)\ntheorem reachable_of_edist_ne_top (h : G.edist u v \u2260 \u22a4) :\n G.Reachable u v :=\nnot_not.mp <| edist_eq_top_of_not_reachable.mt h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.exists_walk_of_edist_ne_top (L94-L109)\nlemma exists_walk_of_edist_ne_top (h : G.edist u v \u2260 \u22a4) :\n \u2203 p : G.Walk u v, p.length = G.edist u v :=\n(reachable_of_edist_ne_top h).exists_walk_length_eq_edist\n\nprotected theorem edist_triangle : G.edist u w \u2264 G.edist u v + G.edist v w := by\n cases eq_or_ne (G.edist u v) \u22a4 with\n | inl huv => simp [huv]\n | inr huv =>\n cases eq_or_ne (G.edist v w) \u22a4 with\n | inl hvw => simp [hvw]\n | inr hvw =>\n obtain \u27e8p, hp\u27e9 := exists_walk_of_edist_ne_top huv\n obtain \u27e8q, hq\u27e9 := exists_walk_of_edist_ne_top hvw\n rw [\u2190 hp, \u2190 hq, \u2190 Nat.cast_add, \u2190 Walk.length_append]\n exact edist_le _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_comm (L110-L114)\ntheorem edist_comm : G.edist u v = G.edist v u := by\nrw [edist_eq_sInf, \u2190 Set.image_univ, \u2190 Set.image_univ_of_surjective Walk.reverse_surjective,\n \u2190 Set.image_comp, Set.image_univ, Function.comp_def]\n simp_rw [Walk.length_reverse, \u2190 edist_eq_sInf]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.exists_walk_of_edist_eq_coe (L115-L120)\nlemma exists_walk_of_edist_eq_coe {k : \u2115} (h : G.edist u v = k) :\n \u2203 p : G.Walk u v, p.length = k :=\nhave : G.edist u v \u2260 \u22a4 := by rw [h]; exact ENat.coe_ne_top _\n have \u27e8p, hp\u27e9 := exists_walk_of_edist_ne_top this\n \u27e8p, Nat.cast_injective (hp.trans h)\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_ne_top_iff_reachable (L121-L129)\nlemma edist_ne_top_iff_reachable : G.edist u v \u2260 \u22a4 \u2194 G.Reachable u v := by\nrefine \u27e8reachable_of_edist_ne_top, fun h \u21a6 ?_\u27e9\n by_contra hx\n simp only [edist, iInf_eq_top, ENat.coe_ne_top] at hx\n exact h.elim hx\n\n/--\nThe extended distance between vertices is equal to `1` if and only if these vertices are adjacent.\n-/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_one_iff_adj (L131-L136)\ntheorem edist_eq_one_iff_adj : G.edist u v = 1 \u2194 G.Adj u v := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_walk_of_edist_ne_top <| by rw [h]; simp\n exact w.adj_of_length_eq_one <| Nat.cast_eq_one.mp <| h \u25b8 hw\n \u00b7 exact le_antisymm (edist_le h.toWalk) (Order.one_le_iff_pos.mpr <| edist_pos_of_ne h.ne)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_le_one_iff_adj_or_eq (L137-L144)\nlemma edist_le_one_iff_adj_or_eq : G.edist u v \u2264 1 \u2194 G.Adj u v \u2228 u = v := by\nby_cases huv : u = v\n \u00b7 simp [huv]\n \u00b7 simp only [huv, or_false]\n have h : 0 < G.edist u v := edist_pos_of_ne huv\n rw [(Order.one_le_iff_pos.mpr h).ge_iff_eq']\n exact edist_eq_one_iff_adj\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.edist_eq_two_iff (L145-L161)\nlemma edist_eq_two_iff {u v : V} :\n G.edist u v = 2 \u2194 u \u2260 v \u2227 \u00ac G.Adj u v \u2227 (G.commonNeighbors u v).Nonempty := by\nrefine \u27e8fun h \u21a6 \u27e8?_, ?_, ?_\u27e9, fun h \u21a6 le_antisymm ?_ ?_\u27e9\n \u00b7 simp +decide [\u2190 G.edist_eq_zero_iff.not (b := u = v), h]\n \u00b7 simp +decide [\u2190 edist_eq_one_iff_adj, h]\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_walk_of_edist_eq_coe h\n use w.getVert 1\n suffices w.getVert 1 \u2208 G.commonNeighbors (w.getVert 0) (w.getVert w.length) by simpa\n refine hw \u25b8 G.mem_commonNeighbors.mp ?_\n exact \u27e8w.adj_getVert_succ (by simp [hw]), (w.adj_getVert_succ (by simp [hw])).symm\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := h.2.2\n rw [mem_commonNeighbors] at hw\n have := (Walk.cons hw.1 <| .cons hw.2.symm .nil).edist_le\n simp_all\n \u00b7 by_contra! hc\n cases ENat.le_one_iff_eq_zero_or_eq_one.mp (Order.le_of_lt_succ hc) <;> simp_all\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Metric.two_lt_edist_iff (L162-L174)\nlemma two_lt_edist_iff {u v : V} :\n 2 < G.edist u v \u2194 u \u2260 v \u2227 \u00ac G.Adj u v \u2227 (G.commonNeighbors u v) = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 lt_of_le_of_ne ?_ (Ne.symm ?_)\u27e9\n \u00b7 have hn : u \u2260 v := fun hc \u21a6 by simp [hc] at h\n have : \u00ac G.Adj u v := fun hc \u21a6 by simp +decide [edist_eq_one_iff_adj.mpr hc] at h\n use hn, this\n by_contra! hc\n simp [edist_eq_two_iff.mpr \u27e8hn, this, hc\u27e9] at h\n \u00b7 rw [\u2190 one_add_one_eq_two]\n refine Order.add_one_le_of_lt <| lt_of_le_of_ne ?_ ?_\n <;> grind [Order.one_le_iff_pos, pos_iff_ne_zero, edist_eq_zero_iff, edist_eq_one_iff_adj]\n \u00b7 simp_all [edist_eq_two_iff]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsAcyclic (L55-L57)\ndef IsAcyclic : Prop := \u2200 \u2983v : V\u2984 (c : G.Walk v v), \u00acc.IsCycle\n/-- A *tree* is a connected acyclic graph. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_maximal_isAcyclic_of_le_isAcyclic (L127-L135)\ntheorem exists_maximal_isAcyclic_of_le_isAcyclic\n {H : SimpleGraph V} (hHG : H \u2264 G) (hH : H.IsAcyclic) :\n \u2203 H' : SimpleGraph V, H \u2264 H' \u2227 Maximal (fun H => H \u2264 G \u2227 H.IsAcyclic) H' := by\nrefine zorn_le_nonempty\u2080 {H | H \u2264 G \u2227 H.IsAcyclic} (fun c hcs hc y hy \u21a6 ?_) _ \u27e8hHG, hH\u27e9\n refine \u27e8sSup c, \u27e8?_, ?_\u27e9, fun _ \u21a6 le_sSup\u27e9\n \u00b7 grind [sSup_le_iff]\n \u00b7 exact isAcyclic_sSup_of_isAcyclic_directedOn c (by grind) hc.directedOn\n\n/-- A connected component of an acyclic graph is a tree. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Iso (L80-L83)\nlemma Iso.isAcyclic_iff (f : G \u2243g G') : G.IsAcyclic \u2194 G'.IsAcyclic :=\n\u27e8fun h \u21a6 h.embedding f.symm, fun h \u21a6 h.embedding f\u27e9\n\n/-- Isomorphic graphs are trees together. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_adj_isBridge (L167-L180)\ntheorem isAcyclic_iff_forall_adj_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984, G.Adj v w \u2192 G.IsBridge s(v, w) := by\nsimp_rw [isBridge_iff_adj_and_forall_cycle_notMem]\n constructor\n \u00b7 intro ha v w hvw\n apply And.intro hvw\n intro u p hp\n cases ha p hp\n \u00b7 rintro hb v (_ | \u27e8ha, p\u27e9) hp\n \u00b7 exact hp.not_of_nil\n \u00b7 apply (hb ha).2 _ hp\n rw [Walk.edges_cons]\n apply List.mem_cons_self\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_reachable_eq (L413-L427)\ntheorem maximal_isAcyclic_iff_reachable_eq {F : SimpleGraph V} (hle : F \u2264 G) (hF : F.IsAcyclic) :\n Maximal (fun F \u21a6 F \u2264 G \u2227 F.IsAcyclic) F \u2194 F.Reachable = G.Reachable := by\nrefine \u27e8reachable_eq_of_maximal_isAcyclic F, fun h \u21a6 ?_\u27e9\n by_contra\n have \u27e8H, hFH, hHG, hH\u27e9 := exists_gt_of_not_maximal \u27e8hle, hF\u27e9 this\n have \u27e8e, heH, heF\u27e9 := Set.exists_of_ssubset <| edgeSet_strict_mono hFH\n have h_bridge : (F \u2294 fromEdgeSet {e}).IsBridge e := by\n refine isAcyclic_iff_forall_edge_isBridge.mp ?_ <| by simp [H.not_isDiag_of_mem_edgeSet heH]\n exact hH.anti <| sup_le_iff.mpr \u27e8hFH.le, H.fromEdgeSet_le.mpr <| by grind\u27e9\n have : (F \u2294 fromEdgeSet {e}) \\ fromEdgeSet {e} = F := by simpa using heF\n cases e\n rw [isBridge_iff, this, h] at h_bridge\n exact h_bridge.right <| hHG heH |>.reachable\n\n/-- A subgraph of a connected graph is maximal acyclic iff it is a tree. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_pairwise_not_isEdgeReachable_two (L650-L658)\nlemma isAcyclic_iff_pairwise_not_isEdgeReachable_two :\n G.IsAcyclic \u2194 Pairwise (\u00acG.IsEdgeReachable 2 \u00b7 \u00b7) := by\nrefine \u27e8fun h _ _ hne he \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 obtain \u27e8w, hw\u27e9 := exists_isCycle_of_two_le_isEdgeReachable hne le_rfl he\n exact h w hw\n \u00b7 refine isAcyclic_iff_forall_adj_isBridge.mpr fun _ _ hadj \u21a6 ?_\n exact isBridge_iff_adj_and_not_isEdgeConnected_two.mpr \u27e8hadj, h hadj.ne\u27e9\n\nend SimpleGraph\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_forall_edge_isBridge (L181-L184)\ntheorem isAcyclic_iff_forall_edge_isBridge :\n G.IsAcyclic \u2194 \u2200 \u2983e\u2984, e \u2208 (G.edgeSet) \u2192 G.IsBridge e := by\nsimp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sSup_of_isAcyclic_directedOn (L118-L126)\nlemma isAcyclic_sSup_of_isAcyclic_directedOn (Hs : Set <| SimpleGraph V)\n (h_acyc : \u2200 H \u2208 Hs, H.IsAcyclic) (h_dir : DirectedOn (\u00b7 \u2264 \u00b7) Hs) : IsAcyclic (sSup Hs) := by\nrcases Hs.eq_empty_or_nonempty with rfl | hnemp\n \u00b7 simp\n \u00b7 intro u p hp\n obtain \u27e8H, hH, hpH\u27e9 := p.exists_mem_contains_edges_of_directed Hs hnemp h_dir\n exact h_acyc H hH (p.transfer H hpH) <| Walk.IsCycle.transfer hp hpH\n\n/-- Every acyclic subgraph `H \u2264 G` is contained in a maximal such subgraph. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_maximal_isAcyclic (L444-L449)\ntheorem isTree_iff_maximal_isAcyclic : G.IsTree \u2194 Nonempty V \u2227 Maximal IsAcyclic G := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8_, h\u27e9 \u21a6 G.maximal_isAcyclic_iff_isTree.mp h\u27e9\n have := h.nonempty\n exact \u27e8this, G.maximal_isAcyclic_iff_isTree.mpr h\u27e9\n\n/-- Every acyclic subgraph can be extended to a spanning forest. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_add_edge_iff_of_not_reachable (L374-L379)\ntheorem isAcyclic_add_edge_iff_of_not_reachable (x y : V) (hxy : \u00ac G.Reachable x y) :\n (G \u2294 fromEdgeSet {s(x, y)}).IsAcyclic \u2194 IsAcyclic G :=\n\u27e8.anti le_sup_left, .isAcyclic_sup_fromEdgeSet_of_not_reachable hxy\u27e9\n\n/-- Adding an edge results in an acyclic graph iff the original graph was acyclic and\nthe edge connects vertices that previously had no path between them. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Subgraph (L151-L153)\nlemma Subgraph.isAcyclic_coe_bot (G : SimpleGraph V) : (\u22a5 : G.Subgraph).coe.IsAcyclic :=\n@IsAcyclic.of_subsingleton _ (Set.isEmpty_coe_sort.mpr rfl).instSubsingleton _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_connected_and_card (L486-L499)\nlemma isTree_iff_connected_and_card [Finite V] :\n G.IsTree \u2194 G.Connected \u2227 Nat.card G.edgeSet + 1 = Nat.card V := by\nhave := Fintype.ofFinite V\n classical\n refine \u27e8fun h \u21a6 \u27e8h.connected, by simpa [edgeFinset] using h.card_edgeFinset\u27e9,\n fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 \u27e8h\u2081, ?_\u27e9\u27e9\n simp_rw [isAcyclic_iff_forall_adj_isBridge]\n refine fun x y h \u21a6 by_contra fun hbr \u21a6\n (h\u2081.connected_delete_edge_of_not_isBridge hbr).card_vert_le_card_edgeSet_add_one.not_gt ?_\n rw [Nat.card_eq_fintype_card, \u2190 edgeFinset_card, \u2190 h\u2082, Nat.card_eq_fintype_card,\n \u2190 edgeFinset_card, add_lt_add_iff_right]\n exact Finset.card_lt_card <| by simpa [deleteEdges, edgeFinset]\n\n/-- The minimum degree of all vertices in a nontrivial tree is one. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.Connected (L428-L436)\ntheorem Connected.maximal_le_isAcyclic_iff_isTree {T : SimpleGraph V} (hG : G.Connected)\n (hT : T \u2264 G) : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) T \u2194 T.IsTree := by\nhave := hG.nonempty\n refine \u27e8fun h \u21a6 \u27e8\u27e8fun u v \u21a6 ?_\u27e9, h.1.2\u27e9, fun hT' \u21a6 ?_\u27e9\n \u00b7 exact G.reachable_eq_of_maximal_isAcyclic T h \u25b8 hG.preconnected u v\n \u00b7 rw [maximal_isAcyclic_iff_reachable_eq hT hT'.isAcyclic,\n T.preconnected_iff_reachable_eq_top.mp hT'.preconnected,\n G.preconnected_iff_reachable_eq_top.mp hG.preconnected]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isCycle_of_two_le_isEdgeReachable (L642-L649)\nlemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u \u2260 v) {n : \u2115} (hn : 2 \u2264 n)\n (h : G.IsEdgeReachable n u v) : \u2203 w : G.Walk u u, w.IsCycle := by\nclassical\n obtain \u27e8w, hw, h\u27e9 := exists_adj_isEdgeReachable_two huv (h.anti hn)\n have := @h {s(u, w)} (by simp)\n obtain \u27e8w, p, hp\u2081, hp\u2082\u27e9 := adj_and_reachable_delete_edges_iff_exists_cycle.mp \u27e8hw, this\u27e9\n exact \u27e8p.rotate _ (p.fst_mem_support_of_mem_edges hp\u2082), IsCycle.rotate hp\u2081 _\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_sup_fromEdgeSet_iff (L380-L396)\ntheorem isAcyclic_sup_fromEdgeSet_iff {u v : V} :\n (G \u2294 fromEdgeSet {s(u, v)}).IsAcyclic \u2194\n G.IsAcyclic \u2227 (G.Reachable u v \u2192 u = v \u2228 G.Adj u v) := by\nby_cases huv : u = v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, Sym2.mem_diagSet, Sym2.mk_isDiag_iff]\n by_cases hadj : G.Adj u v\n \u00b7 grind [sup_eq_left, fromEdgeSet_le, mem_edgeSet]\n refine \u27e8?_, fun \u27e8hacyc, hreach\u27e9 \u21a6 hacyc.isAcyclic_sup_fromEdgeSet_of_not_reachable <| by grind\u27e9\n refine fun hacyc \u21a6 \u27e8hacyc.anti le_sup_left, fun hreach \u21a6 False.elim ?_\u27e9\n have := isAcyclic_iff_forall_edge_isBridge.mp (e := s(u, v)) hacyc <| by simp [huv]\n refine isBridge_iff.mp this |>.right <| hreach.mono <| Eq.le <| Eq.symm ?_\n rw [sup_sdiff_right_self]\n exact deleteEdges_eq_self.mpr <| Set.disjoint_singleton_right.mpr hadj\n\n/--\nThe reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.IsTree (L154-L156)\nlemma IsTree.of_subsingleton [Nonempty V] [Subsingleton V] {G : SimpleGraph V} : G.IsTree :=\n\u27e8.of_subsingleton, .of_subsingleton\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_iff_path_unique (L225-L227)\ntheorem isAcyclic_iff_path_unique : G.IsAcyclic \u2194 \u2200 \u2983v w : V\u2984 (p q : G.Path v w), p = q :=\n\u27e8IsAcyclic.path_unique, isAcyclic_of_path_unique\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_existsUnique_path (L248-L269)\ntheorem isTree_iff_existsUnique_path :\n G.IsTree \u2194 Nonempty V \u2227 \u2200 v w : V, \u2203! p : G.Walk v w, p.IsPath := by\nclassical\n rw [isTree_iff, isAcyclic_iff_path_unique]\n constructor\n \u00b7 rintro \u27e8hc, hu\u27e9\n refine \u27e8hc.nonempty, ?_\u27e9\n intro v w\n let q := (hc v w).some.toPath\n use q\n simp only [true_and, Path.isPath]\n intro p hp\n specialize hu \u27e8p, hp\u27e9 q\n exact Subtype.ext_iff.mp hu\n \u00b7 rintro \u27e8hV, h\u27e9\n refine \u27e8Connected.mk ?_, ?_\u27e9\n \u00b7 intro v w\n obtain \u27e8p, _\u27e9 := h v w\n exact p.reachable\n \u00b7 rintro v w \u27e8p, hp\u27e9 \u27e8q, hq\u27e9\n simp only [ExistsUnique.unique (h v w) hp hq]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic (L450-L456)\ntheorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H \u2264 G)\n (hH_isAcyclic : H.IsAcyclic) :\n \u2203 F : SimpleGraph V, H \u2264 F \u2227 F \u2264 G \u2227 F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic\n grind [maximal_isAcyclic_iff_reachable_eq, Maximal]\n\n/-- Every graph has a spanning forest. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.exists_isAcyclic_reachable_eq_le (L457-L462)\ntheorem exists_isAcyclic_reachable_eq_le :\n \u2203 F \u2264 G, F.IsAcyclic \u2227 F.Reachable = G.Reachable := by\nobtain \u27e8F, hF\u27e9 := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot\n grind\n\n/-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isAcyclic_of_path_unique (L214-L224)\ntheorem isAcyclic_of_path_unique (h : \u2200 (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by\nintro v c hc\n simp only [Walk.isCycle_def, Ne] at hc\n cases c with\n | nil => cases hc.2.1 rfl\n | cons ha c' =>\n simp only [Walk.isTrail_cons, Walk.support_cons, List.tail_cons] at hc\n specialize h _ _ \u27e8c', by simp only [Walk.isPath_def, hc.2]\u27e9 (Path.singleton ha.symm)\n rw [Path.singleton, Subtype.mk.injEq] at h\n simp [h] at hc\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.reachable_eq_of_maximal_isAcyclic (L397-L412)\nlemma reachable_eq_of_maximal_isAcyclic (F : SimpleGraph V)\n (h : Maximal (fun H \u21a6 H \u2264 G \u2227 H.IsAcyclic) F) : F.Reachable = G.Reachable := by\next u v\n refine \u27e8.mono h.prop.left, fun \u27e8p\u27e9 \u21a6 ?_\u27e9\n by_contra\n let s : F.ConnectedComponent := .mk _ u\n have : v \u2209 s := this \u2218 s.reachable_of_mem_supp rfl\n have : \u2203 d \u2208 p.darts, d.fst \u2208 s \u2227 d.snd \u2209 s := p.exists_boundary_dart s rfl this\n rcases this with \u27e8\u27e8\u27e8u', v'\u27e9, huv\u27e9, _, hu, hv\u27e9\n have : \u00acF.Reachable v' u' := mt ConnectedComponent.sound <| s.mem_supp_iff u' |>.mp hu \u25b8 hv\n suffices F \u2294 fromEdgeSet {s(v', u')} \u2264 F by\n grind [Adj.reachable, sup_le_iff, le_iff_adj, fromEdgeSet_adj]\n refine h.le_of_ge \u27e8?_, h.prop.right.isAcyclic_sup_fromEdgeSet_of_not_reachable this\u27e9 le_sup_left\n grind [Maximal, sup_le, le_iff_adj, fromEdgeSet_adj, huv.symm]\n\n/-- A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.maximal_isAcyclic_iff_isTree (L438-L443)\ntheorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :\n Maximal IsAcyclic T \u2194 T.IsTree := by\nsimp [\u2190 connected_top.maximal_le_isAcyclic_iff_isTree le_top]\n\n/-- A maximally acyclic graph is a tree. This is similar to `maximal_isAcyclic_iff_isTree` except\nwith `Nonempty V` as part of the iff rather than an assumption. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_of_minimal_connected (L353-L359)\nlemma isTree_of_minimal_connected (h : Minimal Connected G) : IsTree G := by\nrw [isTree_iff, and_iff_right h.prop, isAcyclic_iff_forall_adj_isBridge]\n exact fun _ _ _ \u21a6 by_contra fun hbr \u21a6 h.not_prop_of_lt\n (by simpa [deleteEdges, \u2190 edgeSet_ssubset_edgeSet])\n <| h.prop.connected_delete_edge_of_not_isBridge hbr\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Combinatorics.SimpleGraph.Acyclic.isTree_iff_minimal_connected (L360-L368)\nlemma isTree_iff_minimal_connected : IsTree G \u2194 Minimal Connected G := by\nrefine \u27e8fun htree \u21a6 \u27e8htree.connected, fun G' h' hle u v hadj \u21a6 ?_\u27e9, isTree_of_minimal_connected\u27e9\n have \u27e8p, hp\u27e9 := h'.exists_isPath u v\n have := congrArg Walk.edges <| congrArg Subtype.val <|\n htree.isAcyclic.path_unique \u27e8p.mapLe hle, hp.mapLe hle\u27e9 <| Path.singleton hadj\n simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this\n simp [this, p.adj_of_mem_edges]\n\n/-- Connecting two unreachable vertices by an edge preserves acyclicity. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Metric.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Metric", "declaration": "Mathlib.Combinatorics.SimpleGraph.Metric.Reachable", "span": "L283-L289", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Metric.lean#L283"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 7746, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 20127, "lean_code_chars": 18618, "natural_language_chars": 1509, "lean_code_ratio": 0.925, "line_count": 517, "imports_count": 0, "declarations_count": 2003, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "612d1a559c83cdb1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Compactness.Lindelof.Filter", "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.Topology.Compactness.Lindelof)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Filter.comap_coLindelof_le {f : X \u2192 Y} (hf : Continuous f) :\n (Filter.coLindelof Y).comap f \u2264 Filter.coLindelof X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L51-L55)\ndef IsLindelof (s : Set X) :=\n\u2200 \u2983f\u2984 [NeBot f] [CountableInterFilter f], f \u2264 \ud835\udcdf s \u2192 \u2203 x \u2208 s, ClusterPt x f\n\n/-- The complement to a Lindel\u00f6f set belongs to a filter `f` with the countable intersection\n property if it belongs to each filter `\ud835\udcdd x \u2293 f`, `x \u2208 s`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L56-L63)\ntheorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f]\n (hf : \u2200 x \u2208 s, s\u1d9c \u2208 \ud835\udcdd x \u2293 f) : s\u1d9c \u2208 f := by\ncontrapose! hf\n simp only [notMem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf \u22a2\n exact hs inf_le_right\n\n/-- The complement to a Lindel\u00f6f set belongs to a filter `f` with the countable intersection\n property if each `x \u2208 s` has a neighborhood `t` within `s` such that `t\u1d9c` belongs to `f`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L64-L71)\ntheorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X}\n [CountableInterFilter f] (hf : \u2200 x \u2208 s, \u2203 t \u2208 \ud835\udcdd[s] x, t\u1d9c \u2208 f) : s\u1d9c \u2208 f := by\nrefine hs.compl_mem_sets fun x hx \u21a6 ?_\n rw [\u2190 disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left]\n exact hf x hx\n\n/-- If `p : Set X \u2192 Prop` is stable under restriction and union, and each point `x`\n of a Lindel\u00f6f set `s` has a neighborhood `t` within `s` such that `p t`, then `p s` holds. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L73-L81)\ntheorem IsLindelof.induction_on (hs : IsLindelof s) {p : Set X \u2192 Prop}\n (hmono : \u2200 \u2983s t\u2984, s \u2286 t \u2192 p t \u2192 p s)\n (hcountable_union : \u2200 (S : Set (Set X)), S.Countable \u2192 (\u2200 s \u2208 S, p s) \u2192 p (\u22c3\u2080 S))\n (hnhds : \u2200 x \u2208 s, \u2203 t \u2208 \ud835\udcdd[s] x, p t) : p s := by\nlet f : Filter X := ofCountableUnion {t | p t} hcountable_union (fun t ht _ hsub \u21a6 hmono hsub ht)\n have : s\u1d9c \u2208 f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds)\n rwa [\u2190 compl_compl s]\n\n/-- The intersection of a Lindel\u00f6f set and a closed set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L82-L89)\ntheorem IsLindelof.inter_right (hs : IsLindelof s) (ht : IsClosed t) : IsLindelof (s \u2229 t) := by\nintro f hnf _ hstf\n rw [\u2190 inf_principal, le_inf_iff] at hstf\n obtain \u27e8x, hsx, hx\u27e9 : \u2203 x \u2208 s, ClusterPt x f := hs hstf.1\n have hxt : x \u2208 t := ht.mem_of_nhdsWithin_neBot <| hx.mono hstf.2\n exact \u27e8x, \u27e8hsx, hxt\u27e9, hx\u27e9\n\n/-- The intersection of a closed set and a Lindel\u00f6f set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L90-L93)\ntheorem IsLindelof.inter_left (ht : IsLindelof t) (hs : IsClosed s) : IsLindelof (s \u2229 t) :=\ninter_comm t s \u25b8 ht.inter_right hs\n\n/-- The set difference of a Lindel\u00f6f set and an open set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L94-L97)\ntheorem IsLindelof.diff (hs : IsLindelof s) (ht : IsOpen t) : IsLindelof (s \\ t) :=\nhs.inter_right (isClosed_compl_iff.mpr ht)\n\n/-- A closed subset of a Lindel\u00f6f set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L98-L101)\ntheorem IsLindelof.of_isClosed_subset (hs : IsLindelof s) (ht : IsClosed t) (h : t \u2286 s) :\n IsLindelof t := inter_eq_self_of_subset_right h \u25b8 hs.inter_right ht\n/-- A continuous image of a Lindel\u00f6f set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L102-L116)\ntheorem IsLindelof.image_of_continuousOn {f : X \u2192 Y} (hs : IsLindelof s) (hf : ContinuousOn f s) :\n IsLindelof (f '' s) := by\nintro l lne _ ls\n have : NeBot (l.comap f \u2293 \ud835\udcdf s) :=\n comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls)\n obtain \u27e8x, hxs, hx\u27e9 : \u2203 x \u2208 s, ClusterPt x (l.comap f \u2293 \ud835\udcdf s) := @hs _ this _ inf_le_right\n haveI := hx.neBot\n use f x, mem_image_of_mem f hxs\n have : Tendsto f (\ud835\udcdd x \u2293 (comap f l \u2293 \ud835\udcdf s)) (\ud835\udcdd (f x) \u2293 l) := by\n convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1\n rw [nhdsWithin]\n ac_rfl\n exact this.neBot\n\n/-- A continuous image of a Lindel\u00f6f set is a Lindel\u00f6f set within the codomain. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L117-L121)\ntheorem IsLindelof.image {f : X \u2192 Y} (hs : IsLindelof s) (hf : Continuous f) :\n IsLindelof (f '' s) := hs.image_of_continuousOn hf.continuousOn\n/-- A filter with the countable intersection property that is finer than the principal filter on\na Lindel\u00f6f set `s` contains any open set that contains all cluster points of `s`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L122-L132)\ntheorem IsLindelof.adherence_nhdset {f : Filter X} [CountableInterFilter f] (hs : IsLindelof s)\n (hf\u2082 : f \u2264 \ud835\udcdf s) (ht\u2081 : IsOpen t) (ht\u2082 : \u2200 x \u2208 s, ClusterPt x f \u2192 x \u2208 t) : t \u2208 f :=\n(eq_or_neBot _).casesOn mem_of_eq_bot fun _ \u21a6\n let \u27e8x, hx, hfx\u27e9 := @hs (f \u2293 \ud835\udcdf t\u1d9c) _ _ <| inf_le_of_left_le hf\u2082\n have : x \u2208 t := ht\u2082 x hx hfx.of_inf_left\n have : t\u1d9c \u2229 t \u2208 \ud835\udcdd[t\u1d9c] x := inter_mem_nhdsWithin _ (ht\u2081.mem_nhds this)\n have A : \ud835\udcdd[t\u1d9c] x = \u22a5 := empty_mem_iff_bot.1 <| compl_inter_self t \u25b8 this\n have : \ud835\udcdd[t\u1d9c] x \u2260 \u22a5 := hfx.of_inf_right.ne\n absurd A this\n\n/-- For every open cover of a Lindel\u00f6f set, there exists a countable subcover. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L133-L156)\ntheorem IsLindelof.elim_countable_subcover {\u03b9 : Type v} (hs : IsLindelof s) (U : \u03b9 \u2192 Set X)\n (hUo : \u2200 i, IsOpen (U i)) (hsU : s \u2286 \u22c3 i, U i) :\n \u2203 r : Set \u03b9, r.Countable \u2227 (s \u2286 \u22c3 i \u2208 r, U i) := by\nhave hmono : \u2200 \u2983s t : Set X\u2984, s \u2286 t \u2192 (\u2203 r : Set \u03b9, r.Countable \u2227 t \u2286 \u22c3 i \u2208 r, U i)\n \u2192 (\u2203 r : Set \u03b9, r.Countable \u2227 s \u2286 \u22c3 i \u2208 r, U i) := by\n intro _ _ hst \u27e8r, \u27e8hrcountable, hsub\u27e9\u27e9\n exact \u27e8r, hrcountable, Subset.trans hst hsub\u27e9\n have hcountable_union : \u2200 (S : Set (Set X)), S.Countable\n \u2192 (\u2200 s \u2208 S, \u2203 r : Set \u03b9, r.Countable \u2227 (s \u2286 \u22c3 i \u2208 r, U i))\n \u2192 \u2203 r : Set \u03b9, r.Countable \u2227 (\u22c3\u2080 S \u2286 \u22c3 i \u2208 r, U i) := by\n intro S hS hsr\n choose! r hr using hsr\n refine \u27e8\u22c3 s \u2208 S, r s, hS.biUnion_iff.mpr (fun s hs \u21a6 (hr s hs).1), ?_\u27e9\n refine sUnion_subset ?h.right.h\n simp only [mem_iUnion, exists_prop, iUnion_exists, biUnion_and']\n exact fun i is x hx \u21a6 mem_biUnion is ((hr i is).2 hx)\n have h_nhds : \u2200 x \u2208 s, \u2203 t \u2208 \ud835\udcdd[s] x, \u2203 r : Set \u03b9, r.Countable \u2227 (t \u2286 \u22c3 i \u2208 r, U i) := by\n intro x hx\n let \u27e8i, hi\u27e9 := mem_iUnion.1 (hsU hx)\n refine \u27e8U i, mem_nhdsWithin_of_mem_nhds ((hUo i).mem_nhds hi), {i}, by simp, ?_\u27e9\n simp only [mem_singleton_iff, iUnion_iUnion_eq_left]\n exact Subset.refl _\n exact hs.induction_on hmono hcountable_union h_nhds\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L157-L170)\ntheorem IsLindelof.elim_nhds_subcover' (hs : IsLindelof s) (U : \u2200 x \u2208 s, Set X)\n (hU : \u2200 x (hx : x \u2208 s), U x \u2039x \u2208 s\u203a \u2208 \ud835\udcdd x) :\n \u2203 t : Set s, t.Countable \u2227 s \u2286 \u22c3 x \u2208 t, U (x : s) x.2 := by\nhave := hs.elim_countable_subcover (fun x : s \u21a6 interior (U x x.2)) (fun _ \u21a6 isOpen_interior)\n fun x hx \u21a6\n mem_iUnion.2 \u27e8\u27e8x, hx\u27e9, mem_interior_iff_mem_nhds.2 <| hU _ _\u27e9\n rcases this with \u27e8r, \u27e8hr, hs\u27e9\u27e9\n use r, hr\n apply Subset.trans hs\n apply iUnion\u2082_subset\n intro i hi\n apply Subset.trans interior_subset\n exact subset_iUnion_of_subset i (subset_iUnion_of_subset hi (Subset.refl _))\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L171-L183)\ntheorem IsLindelof.elim_nhds_subcover (hs : IsLindelof s) (U : X \u2192 Set X)\n (hU : \u2200 x \u2208 s, U x \u2208 \ud835\udcdd x) :\n \u2203 t : Set X, t.Countable \u2227 (\u2200 x \u2208 t, x \u2208 s) \u2227 s \u2286 \u22c3 x \u2208 t, U x := by\nlet \u27e8t, \u27e8htc, htsub\u27e9\u27e9 := hs.elim_nhds_subcover' (fun x _ \u21a6 U x) hU\n refine \u27e8\u2191t, Countable.image htc Subtype.val, ?_\u27e9\n constructor\n \u00b7 intro _\n simp only [mem_image, Subtype.exists, exists_and_right, exists_eq_right, forall_exists_index]\n tauto\n \u00b7 have : \u22c3 x \u2208 t, U \u2191x = \u22c3 x \u2208 Subtype.val '' t, U x := biUnion_image.symm\n rwa [\u2190 this]\n\n/-- For every nonempty open cover of a Lindel\u00f6f set, there exists a subcover indexed by \u2115. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L184-L199)\ntheorem IsLindelof.indexed_countable_subcover {\u03b9 : Type v} [Nonempty \u03b9]\n (hs : IsLindelof s) (U : \u03b9 \u2192 Set X) (hUo : \u2200 i, IsOpen (U i)) (hsU : s \u2286 \u22c3 i, U i) :\n \u2203 f : \u2115 \u2192 \u03b9, s \u2286 \u22c3 n, U (f n) := by\nobtain \u27e8c, \u27e8c_count, c_cov\u27e9\u27e9 := hs.elim_countable_subcover U hUo hsU\n rcases c.eq_empty_or_nonempty with rfl | c_nonempty\n \u00b7 simp only [mem_empty_iff_false, iUnion_of_empty, iUnion_empty] at c_cov\n simp only [subset_eq_empty c_cov rfl, empty_subset, exists_const]\n obtain \u27e8f, f_surj\u27e9 := (Set.countable_iff_exists_surjective c_nonempty).mp c_count\n refine \u27e8fun x \u21a6 f x, c_cov.trans <| iUnion\u2082_subset_iff.mpr (?_ : \u2200 i \u2208 c, U i \u2286 \u22c3 n, U (f n))\u27e9\n intro x hx\n obtain \u27e8n, hn\u27e9 := f_surj \u27e8x, hx\u27e9\n exact subset_iUnion_of_subset n <| subset_of_eq (by rw [hn])\n\n/-- The neighborhood filter of a Lindel\u00f6f set is disjoint with a filter `l` with the countable\nintersection property if and only if the neighborhood filter of each point of this set\nis disjoint with `l`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_generateFrom' (L550-L559)\ntheorem isCompact_generateFrom' [T : TopologicalSpace X]\n {S : Set (Set X)} (hTS : T = generateFrom S) {s : Set X}\n (h : \u2200 (\u03b9 : Type u) (U : \u03b9 \u2192 S), s \u2286 \u22c3 i, U i \u2192 \u2203 J : Set \u03b9, J.Finite \u2227 s \u2286 \u22c3 i \u2208 J, U i) :\n IsCompact s :=\nisCompact_generateFrom hTS fun P hP hs \u21a6\n have \u27e8J, hJ, cover\u27e9 := h P (fun a \u21a6 \u27e8a.1, hP a.2\u27e9) (sUnion_eq_iUnion \u25b8 hs)\n \u27e8(\u00b7.1) '' J, \u27e8by simp, hJ.image _, by aesop\u27e9\u27e9\n\nnamespace Filter\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iUnion (L479-L482)\ntheorem isCompact_iUnion {\u03b9 : Sort*} {f : \u03b9 \u2192 Set X} [Finite \u03b9] (h : \u2200 i, IsCompact (f i)) :\n IsCompact (\u22c3 i, f i) :=\n(finite_range f).isCompact_sUnion <| forall_mem_range.2 h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Compactness.Compact.mem_cocompact' (L570-L572)\ntheorem mem_cocompact' : s \u2208 cocompact X \u2194 \u2203 t, IsCompact t \u2227 s\u1d9c \u2286 t :=\nmem_cocompact.trans <| exists_congr fun _ => and_congr_right fun _ => compl_subset_comm\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_ultrafilter_le_nhds (L134-L142)\ntheorem isCompact_iff_ultrafilter_le_nhds :\n IsCompact s \u2194 \u2200 f : Ultrafilter X, \u2191f \u2264 \ud835\udcdf s \u2192 \u2203 x \u2208 s, \u2191f \u2264 \ud835\udcdd x := by\nrefine (forall_neBot_le_iff ?_).trans ?_\n \u00b7 rintro f g hle \u27e8x, hxs, hxf\u27e9\n exact \u27e8x, hxs, hxf.mono hle\u27e9\n \u00b7 simp only [Ultrafilter.clusterPt_iff]\n\nalias \u27e8IsCompact.ultrafilter_le_nhds, _\u27e9 := isCompact_iff_ultrafilter_le_nhds\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_finite (L495-L497)\ntheorem isCompact_iff_finite [DiscreteTopology X] : IsCompact s \u2194 s.Finite :=\n\u27e8fun h => h.finite_of_discrete, fun h => h.isCompact\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_generateFrom (L532-L549)\ntheorem isCompact_generateFrom [T : TopologicalSpace X]\n {S : Set (Set X)} (hTS : T = generateFrom S) {s : Set X}\n (h : \u2200 P \u2286 S, s \u2286 \u22c3\u2080 P \u2192 \u2203 Q \u2286 P, Q.Finite \u2227 s \u2286 \u22c3\u2080 Q) :\n IsCompact s := by\nrw [isCompact_iff_ultrafilter_le_nhds', hTS]\n intro F hsF\n by_contra hF\n have hSF : \u2200 x \u2208 s, \u2203 t, x \u2208 t \u2227 t \u2208 S \u2227 t \u2209 F := by simpa [nhds_generateFrom] using hF\n choose! U hxU hSU hUF using hSF\n obtain \u27e8Q, hQU, hQ, hsQ\u27e9 := h (U '' s) (by simpa [Set.subset_def])\n (fun x hx \u21a6 Set.mem_sUnion_of_mem (hxU _ hx) (by grind))\n have : \u2200 s \u2208 Q, s \u2209 F := fun s hsQ \u21a6 (hQU hsQ).choose_spec.2 \u25b8 hUF _ (hQU hsQ).choose_spec.1\n have hQF : \u22c2\u2080 (compl '' Q) \u2208 F.sets := by simpa [Filter.biInter_mem hQ, F.compl_mem_iff_notMem]\n have : \u22c3\u2080 Q \u2209 F := by\n simpa [-Set.sInter_image, \u2190 Set.compl_sUnion, hsQ, F.compl_mem_iff_notMem] using hQF\n exact this (F.mem_of_superset hsF hsQ)\n\nomit [TopologicalSpace X] in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Compactness.Compact.hasBasis_cocompact (L560-L566)\ntheorem hasBasis_cocompact : (cocompact X).HasBasis IsCompact compl :=\nhasBasis_biInf_principal'\n (fun s hs t ht =>\n \u27e8s \u222a t, hs.union ht, compl_subset_compl.2 subset_union_left,\n compl_subset_compl.2 subset_union_right\u27e9)\n \u27e8\u2205, isCompact_empty\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Compactness.Compact.CompactSpace (L287-L292)\nlemma CompactSpace.nonempty_sInter [CompactSpace X] {s : Set (Set X)} (hsc : \u2200 t \u2208 s, IsClosed t)\n (hs : \u2200 t \u2286 s, t.Finite \u2192 (\u22c2\u2080 t).Nonempty) : (\u22c2\u2080 s).Nonempty := by\nsimpa using isCompact_univ.nonempty_inter_sInter hsc (by simpa using hs)\n\n/-- Cantor's intersection theorem for `iInter`:\nthe intersection of a directed family of nonempty compact closed sets is nonempty. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_of_finite_subcover (L339-L355)\ntheorem isCompact_of_finite_subcover\n (h : \u2200 {\u03b9 : Type u} (U : \u03b9 \u2192 Set X), (\u2200 i, IsOpen (U i)) \u2192 (s \u2286 \u22c3 i, U i) \u2192\n \u2203 t : Finset \u03b9, s \u2286 \u22c3 i \u2208 t, U i) :\n IsCompact s := fun f hf hfs => by\ncontrapose! h\n simp only [ClusterPt, not_neBot, \u2190 disjoint_iff, SetCoe.forall',\n (nhds_basis_opens _).disjoint_iff_left] at h\n choose U hU hUf using h\n refine \u27e8s, U, fun x => (hU x).2, fun x hx => mem_iUnion.2 \u27e8\u27e8x, hx\u27e9, (hU _).1\u27e9, fun t ht => ?_\u27e9\n refine compl_notMem (le_principal_iff.1 hfs) ?_\n refine mem_of_superset ((biInter_finset_mem t).2 fun x _ => hUf x) ?_\n rw [subset_compl_comm, compl_iInter\u2082]\n simpa only [compl_compl]\n\n-- TODO: reformulate using `Disjoint`\n/-- A set `s` is compact if for every family of closed sets whose intersection avoids `s`,\nthere exists a finite subfamily whose intersection avoids `s`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Compactness.Compact.cocompact_le_cofinite (L576-L578)\ntheorem cocompact_le_cofinite : cocompact X \u2264 cofinite := fun s hs =>\ncompl_compl s \u25b8 hs.isCompact.compl_mem_cocompact\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Compactness.Bases.eq_sUnion_finset_of_isTopologicalBasis_of_isCompact_open (L42-L54)\nlemma eq_sUnion_finset_of_isTopologicalBasis_of_isCompact_open (b : Set (Set X))\n (hb : IsTopologicalBasis b) (U : Set X) (hUc : IsCompact U) (hUo : IsOpen U) :\n \u2203 s : Finset b, U = (s : Set b).sUnion := by\nhave hb' : b = range (fun i \u21a6 i : b \u2192 Set X) := by simp\n rw [hb'] at hb\n choose s hs hU using eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open _ hb U hUc hUo\n have : Finite s := hs\n let _ : Fintype s := Fintype.ofFinite _\n use s.toFinset\n simp [hU]\n\n/-- If `X` has a basis consisting of compact opens, then an open set in `X` is compact open iff\n it is a finite union of some elements in the basis -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Compactness.Compact.exists_subset_nhds_of_isCompact' (L508-L531)\ntheorem exists_subset_nhds_of_isCompact' [Nonempty \u03b9] {V : \u03b9 \u2192 Set X}\n (hV : Directed (\u00b7 \u2287 \u00b7) V) (hV_cpct : \u2200 i, IsCompact (V i)) (hV_closed : \u2200 i, IsClosed (V i))\n {U : Set X} (hU : \u2200 x \u2208 \u22c2 i, V i, U \u2208 \ud835\udcdd x) : \u2203 i, V i \u2286 U := by\nobtain \u27e8W, hsubW, W_op, hWU\u27e9 := exists_open_set_nhds hU\n suffices \u2203 i, V i \u2286 W from this.imp fun i hi => hi.trans hWU\n by_contra! H\n replace H : \u2200 i, (V i \u2229 W\u1d9c).Nonempty := fun i => Set.inter_compl_nonempty_iff.mpr (H i)\n have : (\u22c2 i, V i \u2229 W\u1d9c).Nonempty := by\n refine\n IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ (fun i j => ?_) H\n (fun i => (hV_cpct i).inter_right W_op.isClosed_compl) fun i =>\n (hV_closed i).inter W_op.isClosed_compl\n rcases hV i j with \u27e8k, hki, hkj\u27e9\n refine \u27e8k, \u27e8fun x => ?_, fun x => ?_\u27e9\u27e9 <;> simp only [and_imp, mem_inter_iff, mem_compl_iff] <;>\n tauto\n have : \u00ac\u22c2 i : \u03b9, V i \u2286 W := by simpa [\u2190 iInter_inter, inter_compl_nonempty_iff]\n contradiction\n\nomit [TopologicalSpace X] in\n/--\n**Alexander's subbasis theorem**. Suppose `X` is a topological space with a subbasis `S` and `s` is\na subset of `X`. Then `s` is compact if for any open cover of `s` with all elements taken from `S`,\nthere is a finite subcover.\n-/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_accumulate (L471-L474)\ntheorem isCompact_accumulate {K : \u2115 \u2192 Set X} (hK : \u2200 n, IsCompact (K n)) (n : \u2115) :\n IsCompact (accumulate K n) :=\n(finite_le_nat n).isCompact_biUnion fun k _ => hK k\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Compactness.Compact.Set (L456-L458)\ntheorem Set.Subsingleton.isCompact (hs : s.Subsingleton) : IsCompact s :=\nSubsingleton.induction_on hs isCompact_empty fun _ => isCompact_singleton\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Compactness.Compact.Finset (L467-L470)\ntheorem Finset.isCompact_biUnion (s : Finset \u03b9) {f : \u03b9 \u2192 Set X} (hf : \u2200 i \u2208 s, IsCompact (f i)) :\n IsCompact (\u22c3 i \u2208 s, f i) :=\ns.finite_toSet.isCompact_biUnion hf\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Compactness.Bases.isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis (L55-L63)\ntheorem isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis (b : \u03b9 \u2192 Set X)\n (hb : IsTopologicalBasis (Set.range b)) (hb' : \u2200 i, IsCompact (b i)) (U : Set X) :\n IsCompact U \u2227 IsOpen U \u2194 \u2203 s : Set \u03b9, s.Finite \u2227 U = \u22c3 i \u2208 s, b i := by\nconstructor\n \u00b7 exact fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open _ hb U h\u2081 h\u2082\n \u00b7 rintro \u27e8s, hs, rfl\u27e9\n constructor\n \u00b7 exact hs.isCompact_biUnion fun i _ => hb' i\n \u00b7 exact isOpen_biUnion fun i _ => hb.isOpen (Set.mem_range_self _)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_ultrafilter_le_nhds' (L143-L150)\ntheorem isCompact_iff_ultrafilter_le_nhds' :\n IsCompact s \u2194 \u2200 f : Ultrafilter X, s \u2208 f \u2192 \u2203 x \u2208 s, \u2191f \u2264 \ud835\udcdd x := by\nsimp only [isCompact_iff_ultrafilter_le_nhds, le_principal_iff, Ultrafilter.mem_coe]\n\nalias \u27e8IsCompact.ultrafilter_le_nhds', _\u27e9 := isCompact_iff_ultrafilter_le_nhds'\n\n/-- If a compact set belongs to a filter and this filter has a unique cluster point `y` in this set,\nthen the filter is less than or equal to `\ud835\udcdd y`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_of_finite_subfamily_closed (L356-L367)\ntheorem isCompact_of_finite_subfamily_closed\n (h : \u2200 {\u03b9 : Type u} (t : \u03b9 \u2192 Set X), (\u2200 i, IsClosed (t i)) \u2192 (s \u2229 \u22c2 i, t i) = \u2205 \u2192\n \u2203 u : Finset \u03b9, (s \u2229 \u22c2 i \u2208 u, t i) = \u2205) :\n IsCompact s :=\nisCompact_of_finite_subcover fun U hUo hsU => by\n rw [\u2190 disjoint_compl_right_iff_subset, compl_iUnion, disjoint_iff] at hsU\n rcases h (fun i => (U i)\u1d9c) (fun i => (hUo _).isClosed_compl) hsU with \u27e8t, ht\u27e9\n refine \u27e8t, ?_\u27e9\n rwa [\u2190 disjoint_compl_right_iff_subset, compl_iUnion\u2082, disjoint_iff]\n\n/-- A set `s` is compact if and only if\nfor every open cover of `s`, there exists a finite subcover. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_finite_subcover (L368-L375)\ntheorem isCompact_iff_finite_subcover :\n IsCompact s \u2194 \u2200 {\u03b9 : Type u} (U : \u03b9 \u2192 Set X),\n (\u2200 i, IsOpen (U i)) \u2192 (s \u2286 \u22c3 i, U i) \u2192 \u2203 t : Finset \u03b9, s \u2286 \u22c3 i \u2208 t, U i :=\n\u27e8fun hs => hs.elim_finite_subcover, isCompact_of_finite_subcover\u27e9\n\n/-- A set `s` is compact if and only if\nfor every family of closed sets whose intersection avoids `s`,\nthere exists a finite subfamily whose intersection avoids `s`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Compactness.Compact.mem_cocompact (L567-L569)\ntheorem mem_cocompact : s \u2208 cocompact X \u2194 \u2203 t, IsCompact t \u2227 t\u1d9c \u2286 s :=\nhasBasis_cocompact.mem_iff\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_singleton (L452-L455)\ntheorem isCompact_singleton {x : X} : IsCompact ({x} : Set X) := fun _ hf hfa =>\n\u27e8x, rfl, ClusterPt.of_le_nhds'\n (hfa.trans <| by simpa only [principal_singleton] using pure_le_nhds x) hf\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Compactness.Compact.IsCompact (L40-L42)\nlemma IsCompact.exists_clusterPt (hs : IsCompact s) {f : Filter X} [NeBot f] (hf : f \u2264 \ud835\udcdf s) :\n \u2203 x \u2208 s, ClusterPt x f := hs hf\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Compactness.Bases.eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open (L21-L41)\nlemma eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open (b : \u03b9 \u2192 Set X)\n (hb : IsTopologicalBasis (Set.range b)) (U : Set X) (hUc : IsCompact U) (hUo : IsOpen U) :\n \u2203 s : Set \u03b9, s.Finite \u2227 U = \u22c3 i \u2208 s, b i := by\nobtain \u27e8Y, f, e, hf\u27e9 := hb.open_eq_iUnion hUo\n choose f' hf' using hf\n have : b \u2218 f' = f := funext hf'\n subst this\n obtain \u27e8t, ht\u27e9 :=\n hUc.elim_finite_subcover (b \u2218 f') (fun i => hb.isOpen (Set.mem_range_self _)) (by rw [e])\n classical\n refine \u27e8t.image f', Set.toFinite _, le_antisymm ?_ ?_\u27e9\n \u00b7 refine Set.Subset.trans ht ?_\n simp only [Set.iUnion_subset_iff]\n intro i hi\n simpa using subset_iUnion\u2082 (s := fun i _ => b (f' i)) i hi\n \u00b7 apply Set.iUnion\u2082_subset\n rintro i hi\n obtain \u27e8j, -, rfl\u27e9 := Finset.mem_image.mp hi\n rw [e]\n exact Set.subset_iUnion (b \u2218 f') j\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_empty (L449-L451)\ntheorem isCompact_empty : IsCompact (\u2205 : Set X) := fun _f hnf hsf =>\nNot.elim hnf.ne <| empty_mem_iff_bot.1 <| le_principal_iff.1 hsf\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_finite_subfamily_closed (L376-L383)\ntheorem isCompact_iff_finite_subfamily_closed :\n IsCompact s \u2194 \u2200 {\u03b9 : Type u} (t : \u03b9 \u2192 Set X),\n (\u2200 i, IsClosed (t i)) \u2192 (s \u2229 \u22c2 i, t i) = \u2205 \u2192 \u2203 u : Finset \u03b9, (s \u2229 \u22c2 i \u2208 u, t i) = \u2205 :=\n\u27e8fun hs => hs.elim_finite_subfamily_closed, isCompact_of_finite_subfamily_closed\u27e9\n\n/-- If `s : Set (X \u00d7 Y)` belongs to `\ud835\udcdd x \u00d7\u02e2 l` for all `x` from a compact set `K`,\nthen it belongs to `(\ud835\udcdd\u02e2 K) \u00d7\u02e2 l`,\ni.e., there exist an open `U \u2287 K` and `t \u2208 l` such that `U \u00d7\u02e2 t \u2286 s`. -/\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.Topology.Compactness.Lindelof).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Filter.comap_coLindelof_le {f : X \u2192 Y} (hf : Continuous f) :\n (Filter.coLindelof Y).comap f \u2264 Filter.coLindelof X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L51-L55)\ndef IsLindelof (s : Set X) :=\n\u2200 \u2983f\u2984 [NeBot f] [CountableInterFilter f], f \u2264 \ud835\udcdf s \u2192 \u2203 x \u2208 s, ClusterPt x f\n\n/-- The complement to a Lindel\u00f6f set belongs to a filter `f` with the countable intersection\n property if it belongs to each filter `\ud835\udcdd x \u2293 f`, `x \u2208 s`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L56-L63)\ntheorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f]\n (hf : \u2200 x \u2208 s, s\u1d9c \u2208 \ud835\udcdd x \u2293 f) : s\u1d9c \u2208 f := by\ncontrapose! hf\n simp only [notMem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf \u22a2\n exact hs inf_le_right\n\n/-- The complement to a Lindel\u00f6f set belongs to a filter `f` with the countable intersection\n property if each `x \u2208 s` has a neighborhood `t` within `s` such that `t\u1d9c` belongs to `f`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L64-L71)\ntheorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X}\n [CountableInterFilter f] (hf : \u2200 x \u2208 s, \u2203 t \u2208 \ud835\udcdd[s] x, t\u1d9c \u2208 f) : s\u1d9c \u2208 f := by\nrefine hs.compl_mem_sets fun x hx \u21a6 ?_\n rw [\u2190 disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left]\n exact hf x hx\n\n/-- If `p : Set X \u2192 Prop` is stable under restriction and union, and each point `x`\n of a Lindel\u00f6f set `s` has a neighborhood `t` within `s` such that `p t`, then `p s` holds. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L73-L81)\ntheorem IsLindelof.induction_on (hs : IsLindelof s) {p : Set X \u2192 Prop}\n (hmono : \u2200 \u2983s t\u2984, s \u2286 t \u2192 p t \u2192 p s)\n (hcountable_union : \u2200 (S : Set (Set X)), S.Countable \u2192 (\u2200 s \u2208 S, p s) \u2192 p (\u22c3\u2080 S))\n (hnhds : \u2200 x \u2208 s, \u2203 t \u2208 \ud835\udcdd[s] x, p t) : p s := by\nlet f : Filter X := ofCountableUnion {t | p t} hcountable_union (fun t ht _ hsub \u21a6 hmono hsub ht)\n have : s\u1d9c \u2208 f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds)\n rwa [\u2190 compl_compl s]\n\n/-- The intersection of a Lindel\u00f6f set and a closed set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L82-L89)\ntheorem IsLindelof.inter_right (hs : IsLindelof s) (ht : IsClosed t) : IsLindelof (s \u2229 t) := by\nintro f hnf _ hstf\n rw [\u2190 inf_principal, le_inf_iff] at hstf\n obtain \u27e8x, hsx, hx\u27e9 : \u2203 x \u2208 s, ClusterPt x f := hs hstf.1\n have hxt : x \u2208 t := ht.mem_of_nhdsWithin_neBot <| hx.mono hstf.2\n exact \u27e8x, \u27e8hsx, hxt\u27e9, hx\u27e9\n\n/-- The intersection of a closed set and a Lindel\u00f6f set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L90-L93)\ntheorem IsLindelof.inter_left (ht : IsLindelof t) (hs : IsClosed s) : IsLindelof (s \u2229 t) :=\ninter_comm t s \u25b8 ht.inter_right hs\n\n/-- The set difference of a Lindel\u00f6f set and an open set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L94-L97)\ntheorem IsLindelof.diff (hs : IsLindelof s) (ht : IsOpen t) : IsLindelof (s \\ t) :=\nhs.inter_right (isClosed_compl_iff.mpr ht)\n\n/-- A closed subset of a Lindel\u00f6f set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L98-L101)\ntheorem IsLindelof.of_isClosed_subset (hs : IsLindelof s) (ht : IsClosed t) (h : t \u2286 s) :\n IsLindelof t := inter_eq_self_of_subset_right h \u25b8 hs.inter_right ht\n/-- A continuous image of a Lindel\u00f6f set is a Lindel\u00f6f set. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L102-L116)\ntheorem IsLindelof.image_of_continuousOn {f : X \u2192 Y} (hs : IsLindelof s) (hf : ContinuousOn f s) :\n IsLindelof (f '' s) := by\nintro l lne _ ls\n have : NeBot (l.comap f \u2293 \ud835\udcdf s) :=\n comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls)\n obtain \u27e8x, hxs, hx\u27e9 : \u2203 x \u2208 s, ClusterPt x (l.comap f \u2293 \ud835\udcdf s) := @hs _ this _ inf_le_right\n haveI := hx.neBot\n use f x, mem_image_of_mem f hxs\n have : Tendsto f (\ud835\udcdd x \u2293 (comap f l \u2293 \ud835\udcdf s)) (\ud835\udcdd (f x) \u2293 l) := by\n convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1\n rw [nhdsWithin]\n ac_rfl\n exact this.neBot\n\n/-- A continuous image of a Lindel\u00f6f set is a Lindel\u00f6f set within the codomain. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L117-L121)\ntheorem IsLindelof.image {f : X \u2192 Y} (hs : IsLindelof s) (hf : Continuous f) :\n IsLindelof (f '' s) := hs.image_of_continuousOn hf.continuousOn\n/-- A filter with the countable intersection property that is finer than the principal filter on\na Lindel\u00f6f set `s` contains any open set that contains all cluster points of `s`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L122-L132)\ntheorem IsLindelof.adherence_nhdset {f : Filter X} [CountableInterFilter f] (hs : IsLindelof s)\n (hf\u2082 : f \u2264 \ud835\udcdf s) (ht\u2081 : IsOpen t) (ht\u2082 : \u2200 x \u2208 s, ClusterPt x f \u2192 x \u2208 t) : t \u2208 f :=\n(eq_or_neBot _).casesOn mem_of_eq_bot fun _ \u21a6\n let \u27e8x, hx, hfx\u27e9 := @hs (f \u2293 \ud835\udcdf t\u1d9c) _ _ <| inf_le_of_left_le hf\u2082\n have : x \u2208 t := ht\u2082 x hx hfx.of_inf_left\n have : t\u1d9c \u2229 t \u2208 \ud835\udcdd[t\u1d9c] x := inter_mem_nhdsWithin _ (ht\u2081.mem_nhds this)\n have A : \ud835\udcdd[t\u1d9c] x = \u22a5 := empty_mem_iff_bot.1 <| compl_inter_self t \u25b8 this\n have : \ud835\udcdd[t\u1d9c] x \u2260 \u22a5 := hfx.of_inf_right.ne\n absurd A this\n\n/-- For every open cover of a Lindel\u00f6f set, there exists a countable subcover. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L133-L156)\ntheorem IsLindelof.elim_countable_subcover {\u03b9 : Type v} (hs : IsLindelof s) (U : \u03b9 \u2192 Set X)\n (hUo : \u2200 i, IsOpen (U i)) (hsU : s \u2286 \u22c3 i, U i) :\n \u2203 r : Set \u03b9, r.Countable \u2227 (s \u2286 \u22c3 i \u2208 r, U i) := by\nhave hmono : \u2200 \u2983s t : Set X\u2984, s \u2286 t \u2192 (\u2203 r : Set \u03b9, r.Countable \u2227 t \u2286 \u22c3 i \u2208 r, U i)\n \u2192 (\u2203 r : Set \u03b9, r.Countable \u2227 s \u2286 \u22c3 i \u2208 r, U i) := by\n intro _ _ hst \u27e8r, \u27e8hrcountable, hsub\u27e9\u27e9\n exact \u27e8r, hrcountable, Subset.trans hst hsub\u27e9\n have hcountable_union : \u2200 (S : Set (Set X)), S.Countable\n \u2192 (\u2200 s \u2208 S, \u2203 r : Set \u03b9, r.Countable \u2227 (s \u2286 \u22c3 i \u2208 r, U i))\n \u2192 \u2203 r : Set \u03b9, r.Countable \u2227 (\u22c3\u2080 S \u2286 \u22c3 i \u2208 r, U i) := by\n intro S hS hsr\n choose! r hr using hsr\n refine \u27e8\u22c3 s \u2208 S, r s, hS.biUnion_iff.mpr (fun s hs \u21a6 (hr s hs).1), ?_\u27e9\n refine sUnion_subset ?h.right.h\n simp only [mem_iUnion, exists_prop, iUnion_exists, biUnion_and']\n exact fun i is x hx \u21a6 mem_biUnion is ((hr i is).2 hx)\n have h_nhds : \u2200 x \u2208 s, \u2203 t \u2208 \ud835\udcdd[s] x, \u2203 r : Set \u03b9, r.Countable \u2227 (t \u2286 \u22c3 i \u2208 r, U i) := by\n intro x hx\n let \u27e8i, hi\u27e9 := mem_iUnion.1 (hsU hx)\n refine \u27e8U i, mem_nhdsWithin_of_mem_nhds ((hUo i).mem_nhds hi), {i}, by simp, ?_\u27e9\n simp only [mem_singleton_iff, iUnion_iUnion_eq_left]\n exact Subset.refl _\n exact hs.induction_on hmono hcountable_union h_nhds\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L157-L170)\ntheorem IsLindelof.elim_nhds_subcover' (hs : IsLindelof s) (U : \u2200 x \u2208 s, Set X)\n (hU : \u2200 x (hx : x \u2208 s), U x \u2039x \u2208 s\u203a \u2208 \ud835\udcdd x) :\n \u2203 t : Set s, t.Countable \u2227 s \u2286 \u22c3 x \u2208 t, U (x : s) x.2 := by\nhave := hs.elim_countable_subcover (fun x : s \u21a6 interior (U x x.2)) (fun _ \u21a6 isOpen_interior)\n fun x hx \u21a6\n mem_iUnion.2 \u27e8\u27e8x, hx\u27e9, mem_interior_iff_mem_nhds.2 <| hU _ _\u27e9\n rcases this with \u27e8r, \u27e8hr, hs\u27e9\u27e9\n use r, hr\n apply Subset.trans hs\n apply iUnion\u2082_subset\n intro i hi\n apply Subset.trans interior_subset\n exact subset_iUnion_of_subset i (subset_iUnion_of_subset hi (Subset.refl _))\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L171-L183)\ntheorem IsLindelof.elim_nhds_subcover (hs : IsLindelof s) (U : X \u2192 Set X)\n (hU : \u2200 x \u2208 s, U x \u2208 \ud835\udcdd x) :\n \u2203 t : Set X, t.Countable \u2227 (\u2200 x \u2208 t, x \u2208 s) \u2227 s \u2286 \u22c3 x \u2208 t, U x := by\nlet \u27e8t, \u27e8htc, htsub\u27e9\u27e9 := hs.elim_nhds_subcover' (fun x _ \u21a6 U x) hU\n refine \u27e8\u2191t, Countable.image htc Subtype.val, ?_\u27e9\n constructor\n \u00b7 intro _\n simp only [mem_image, Subtype.exists, exists_and_right, exists_eq_right, forall_exists_index]\n tauto\n \u00b7 have : \u22c3 x \u2208 t, U \u2191x = \u22c3 x \u2208 Subtype.val '' t, U x := biUnion_image.symm\n rwa [\u2190 this]\n\n/-- For every nonempty open cover of a Lindel\u00f6f set, there exists a subcover indexed by \u2115. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Compactness.Lindelof.IsLindelof (L184-L199)\ntheorem IsLindelof.indexed_countable_subcover {\u03b9 : Type v} [Nonempty \u03b9]\n (hs : IsLindelof s) (U : \u03b9 \u2192 Set X) (hUo : \u2200 i, IsOpen (U i)) (hsU : s \u2286 \u22c3 i, U i) :\n \u2203 f : \u2115 \u2192 \u03b9, s \u2286 \u22c3 n, U (f n) := by\nobtain \u27e8c, \u27e8c_count, c_cov\u27e9\u27e9 := hs.elim_countable_subcover U hUo hsU\n rcases c.eq_empty_or_nonempty with rfl | c_nonempty\n \u00b7 simp only [mem_empty_iff_false, iUnion_of_empty, iUnion_empty] at c_cov\n simp only [subset_eq_empty c_cov rfl, empty_subset, exists_const]\n obtain \u27e8f, f_surj\u27e9 := (Set.countable_iff_exists_surjective c_nonempty).mp c_count\n refine \u27e8fun x \u21a6 f x, c_cov.trans <| iUnion\u2082_subset_iff.mpr (?_ : \u2200 i \u2208 c, U i \u2286 \u22c3 n, U (f n))\u27e9\n intro x hx\n obtain \u27e8n, hn\u27e9 := f_surj \u27e8x, hx\u27e9\n exact subset_iUnion_of_subset n <| subset_of_eq (by rw [hn])\n\n/-- The neighborhood filter of a Lindel\u00f6f set is disjoint with a filter `l` with the countable\nintersection property if and only if the neighborhood filter of each point of this set\nis disjoint with `l`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_generateFrom' (L550-L559)\ntheorem isCompact_generateFrom' [T : TopologicalSpace X]\n {S : Set (Set X)} (hTS : T = generateFrom S) {s : Set X}\n (h : \u2200 (\u03b9 : Type u) (U : \u03b9 \u2192 S), s \u2286 \u22c3 i, U i \u2192 \u2203 J : Set \u03b9, J.Finite \u2227 s \u2286 \u22c3 i \u2208 J, U i) :\n IsCompact s :=\nisCompact_generateFrom hTS fun P hP hs \u21a6\n have \u27e8J, hJ, cover\u27e9 := h P (fun a \u21a6 \u27e8a.1, hP a.2\u27e9) (sUnion_eq_iUnion \u25b8 hs)\n \u27e8(\u00b7.1) '' J, \u27e8by simp, hJ.image _, by aesop\u27e9\u27e9\n\nnamespace Filter\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iUnion (L479-L482)\ntheorem isCompact_iUnion {\u03b9 : Sort*} {f : \u03b9 \u2192 Set X} [Finite \u03b9] (h : \u2200 i, IsCompact (f i)) :\n IsCompact (\u22c3 i, f i) :=\n(finite_range f).isCompact_sUnion <| forall_mem_range.2 h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Compactness.Compact.mem_cocompact' (L570-L572)\ntheorem mem_cocompact' : s \u2208 cocompact X \u2194 \u2203 t, IsCompact t \u2227 s\u1d9c \u2286 t :=\nmem_cocompact.trans <| exists_congr fun _ => and_congr_right fun _ => compl_subset_comm\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_ultrafilter_le_nhds (L134-L142)\ntheorem isCompact_iff_ultrafilter_le_nhds :\n IsCompact s \u2194 \u2200 f : Ultrafilter X, \u2191f \u2264 \ud835\udcdf s \u2192 \u2203 x \u2208 s, \u2191f \u2264 \ud835\udcdd x := by\nrefine (forall_neBot_le_iff ?_).trans ?_\n \u00b7 rintro f g hle \u27e8x, hxs, hxf\u27e9\n exact \u27e8x, hxs, hxf.mono hle\u27e9\n \u00b7 simp only [Ultrafilter.clusterPt_iff]\n\nalias \u27e8IsCompact.ultrafilter_le_nhds, _\u27e9 := isCompact_iff_ultrafilter_le_nhds\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_finite (L495-L497)\ntheorem isCompact_iff_finite [DiscreteTopology X] : IsCompact s \u2194 s.Finite :=\n\u27e8fun h => h.finite_of_discrete, fun h => h.isCompact\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_generateFrom (L532-L549)\ntheorem isCompact_generateFrom [T : TopologicalSpace X]\n {S : Set (Set X)} (hTS : T = generateFrom S) {s : Set X}\n (h : \u2200 P \u2286 S, s \u2286 \u22c3\u2080 P \u2192 \u2203 Q \u2286 P, Q.Finite \u2227 s \u2286 \u22c3\u2080 Q) :\n IsCompact s := by\nrw [isCompact_iff_ultrafilter_le_nhds', hTS]\n intro F hsF\n by_contra hF\n have hSF : \u2200 x \u2208 s, \u2203 t, x \u2208 t \u2227 t \u2208 S \u2227 t \u2209 F := by simpa [nhds_generateFrom] using hF\n choose! U hxU hSU hUF using hSF\n obtain \u27e8Q, hQU, hQ, hsQ\u27e9 := h (U '' s) (by simpa [Set.subset_def])\n (fun x hx \u21a6 Set.mem_sUnion_of_mem (hxU _ hx) (by grind))\n have : \u2200 s \u2208 Q, s \u2209 F := fun s hsQ \u21a6 (hQU hsQ).choose_spec.2 \u25b8 hUF _ (hQU hsQ).choose_spec.1\n have hQF : \u22c2\u2080 (compl '' Q) \u2208 F.sets := by simpa [Filter.biInter_mem hQ, F.compl_mem_iff_notMem]\n have : \u22c3\u2080 Q \u2209 F := by\n simpa [-Set.sInter_image, \u2190 Set.compl_sUnion, hsQ, F.compl_mem_iff_notMem] using hQF\n exact this (F.mem_of_superset hsF hsQ)\n\nomit [TopologicalSpace X] in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Compactness.Compact.hasBasis_cocompact (L560-L566)\ntheorem hasBasis_cocompact : (cocompact X).HasBasis IsCompact compl :=\nhasBasis_biInf_principal'\n (fun s hs t ht =>\n \u27e8s \u222a t, hs.union ht, compl_subset_compl.2 subset_union_left,\n compl_subset_compl.2 subset_union_right\u27e9)\n \u27e8\u2205, isCompact_empty\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Compactness.Compact.CompactSpace (L287-L292)\nlemma CompactSpace.nonempty_sInter [CompactSpace X] {s : Set (Set X)} (hsc : \u2200 t \u2208 s, IsClosed t)\n (hs : \u2200 t \u2286 s, t.Finite \u2192 (\u22c2\u2080 t).Nonempty) : (\u22c2\u2080 s).Nonempty := by\nsimpa using isCompact_univ.nonempty_inter_sInter hsc (by simpa using hs)\n\n/-- Cantor's intersection theorem for `iInter`:\nthe intersection of a directed family of nonempty compact closed sets is nonempty. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_of_finite_subcover (L339-L355)\ntheorem isCompact_of_finite_subcover\n (h : \u2200 {\u03b9 : Type u} (U : \u03b9 \u2192 Set X), (\u2200 i, IsOpen (U i)) \u2192 (s \u2286 \u22c3 i, U i) \u2192\n \u2203 t : Finset \u03b9, s \u2286 \u22c3 i \u2208 t, U i) :\n IsCompact s := fun f hf hfs => by\ncontrapose! h\n simp only [ClusterPt, not_neBot, \u2190 disjoint_iff, SetCoe.forall',\n (nhds_basis_opens _).disjoint_iff_left] at h\n choose U hU hUf using h\n refine \u27e8s, U, fun x => (hU x).2, fun x hx => mem_iUnion.2 \u27e8\u27e8x, hx\u27e9, (hU _).1\u27e9, fun t ht => ?_\u27e9\n refine compl_notMem (le_principal_iff.1 hfs) ?_\n refine mem_of_superset ((biInter_finset_mem t).2 fun x _ => hUf x) ?_\n rw [subset_compl_comm, compl_iInter\u2082]\n simpa only [compl_compl]\n\n-- TODO: reformulate using `Disjoint`\n/-- A set `s` is compact if for every family of closed sets whose intersection avoids `s`,\nthere exists a finite subfamily whose intersection avoids `s`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Compactness.Compact.cocompact_le_cofinite (L576-L578)\ntheorem cocompact_le_cofinite : cocompact X \u2264 cofinite := fun s hs =>\ncompl_compl s \u25b8 hs.isCompact.compl_mem_cocompact\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Compactness.Bases.eq_sUnion_finset_of_isTopologicalBasis_of_isCompact_open (L42-L54)\nlemma eq_sUnion_finset_of_isTopologicalBasis_of_isCompact_open (b : Set (Set X))\n (hb : IsTopologicalBasis b) (U : Set X) (hUc : IsCompact U) (hUo : IsOpen U) :\n \u2203 s : Finset b, U = (s : Set b).sUnion := by\nhave hb' : b = range (fun i \u21a6 i : b \u2192 Set X) := by simp\n rw [hb'] at hb\n choose s hs hU using eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open _ hb U hUc hUo\n have : Finite s := hs\n let _ : Fintype s := Fintype.ofFinite _\n use s.toFinset\n simp [hU]\n\n/-- If `X` has a basis consisting of compact opens, then an open set in `X` is compact open iff\n it is a finite union of some elements in the basis -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Compactness.Compact.exists_subset_nhds_of_isCompact' (L508-L531)\ntheorem exists_subset_nhds_of_isCompact' [Nonempty \u03b9] {V : \u03b9 \u2192 Set X}\n (hV : Directed (\u00b7 \u2287 \u00b7) V) (hV_cpct : \u2200 i, IsCompact (V i)) (hV_closed : \u2200 i, IsClosed (V i))\n {U : Set X} (hU : \u2200 x \u2208 \u22c2 i, V i, U \u2208 \ud835\udcdd x) : \u2203 i, V i \u2286 U := by\nobtain \u27e8W, hsubW, W_op, hWU\u27e9 := exists_open_set_nhds hU\n suffices \u2203 i, V i \u2286 W from this.imp fun i hi => hi.trans hWU\n by_contra! H\n replace H : \u2200 i, (V i \u2229 W\u1d9c).Nonempty := fun i => Set.inter_compl_nonempty_iff.mpr (H i)\n have : (\u22c2 i, V i \u2229 W\u1d9c).Nonempty := by\n refine\n IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ (fun i j => ?_) H\n (fun i => (hV_cpct i).inter_right W_op.isClosed_compl) fun i =>\n (hV_closed i).inter W_op.isClosed_compl\n rcases hV i j with \u27e8k, hki, hkj\u27e9\n refine \u27e8k, \u27e8fun x => ?_, fun x => ?_\u27e9\u27e9 <;> simp only [and_imp, mem_inter_iff, mem_compl_iff] <;>\n tauto\n have : \u00ac\u22c2 i : \u03b9, V i \u2286 W := by simpa [\u2190 iInter_inter, inter_compl_nonempty_iff]\n contradiction\n\nomit [TopologicalSpace X] in\n/--\n**Alexander's subbasis theorem**. Suppose `X` is a topological space with a subbasis `S` and `s` is\na subset of `X`. Then `s` is compact if for any open cover of `s` with all elements taken from `S`,\nthere is a finite subcover.\n-/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_accumulate (L471-L474)\ntheorem isCompact_accumulate {K : \u2115 \u2192 Set X} (hK : \u2200 n, IsCompact (K n)) (n : \u2115) :\n IsCompact (accumulate K n) :=\n(finite_le_nat n).isCompact_biUnion fun k _ => hK k\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Compactness.Compact.Set (L456-L458)\ntheorem Set.Subsingleton.isCompact (hs : s.Subsingleton) : IsCompact s :=\nSubsingleton.induction_on hs isCompact_empty fun _ => isCompact_singleton\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Compactness.Compact.Finset (L467-L470)\ntheorem Finset.isCompact_biUnion (s : Finset \u03b9) {f : \u03b9 \u2192 Set X} (hf : \u2200 i \u2208 s, IsCompact (f i)) :\n IsCompact (\u22c3 i \u2208 s, f i) :=\ns.finite_toSet.isCompact_biUnion hf\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Compactness.Bases.isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis (L55-L63)\ntheorem isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis (b : \u03b9 \u2192 Set X)\n (hb : IsTopologicalBasis (Set.range b)) (hb' : \u2200 i, IsCompact (b i)) (U : Set X) :\n IsCompact U \u2227 IsOpen U \u2194 \u2203 s : Set \u03b9, s.Finite \u2227 U = \u22c3 i \u2208 s, b i := by\nconstructor\n \u00b7 exact fun \u27e8h\u2081, h\u2082\u27e9 \u21a6 eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open _ hb U h\u2081 h\u2082\n \u00b7 rintro \u27e8s, hs, rfl\u27e9\n constructor\n \u00b7 exact hs.isCompact_biUnion fun i _ => hb' i\n \u00b7 exact isOpen_biUnion fun i _ => hb.isOpen (Set.mem_range_self _)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_ultrafilter_le_nhds' (L143-L150)\ntheorem isCompact_iff_ultrafilter_le_nhds' :\n IsCompact s \u2194 \u2200 f : Ultrafilter X, s \u2208 f \u2192 \u2203 x \u2208 s, \u2191f \u2264 \ud835\udcdd x := by\nsimp only [isCompact_iff_ultrafilter_le_nhds, le_principal_iff, Ultrafilter.mem_coe]\n\nalias \u27e8IsCompact.ultrafilter_le_nhds', _\u27e9 := isCompact_iff_ultrafilter_le_nhds'\n\n/-- If a compact set belongs to a filter and this filter has a unique cluster point `y` in this set,\nthen the filter is less than or equal to `\ud835\udcdd y`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_of_finite_subfamily_closed (L356-L367)\ntheorem isCompact_of_finite_subfamily_closed\n (h : \u2200 {\u03b9 : Type u} (t : \u03b9 \u2192 Set X), (\u2200 i, IsClosed (t i)) \u2192 (s \u2229 \u22c2 i, t i) = \u2205 \u2192\n \u2203 u : Finset \u03b9, (s \u2229 \u22c2 i \u2208 u, t i) = \u2205) :\n IsCompact s :=\nisCompact_of_finite_subcover fun U hUo hsU => by\n rw [\u2190 disjoint_compl_right_iff_subset, compl_iUnion, disjoint_iff] at hsU\n rcases h (fun i => (U i)\u1d9c) (fun i => (hUo _).isClosed_compl) hsU with \u27e8t, ht\u27e9\n refine \u27e8t, ?_\u27e9\n rwa [\u2190 disjoint_compl_right_iff_subset, compl_iUnion\u2082, disjoint_iff]\n\n/-- A set `s` is compact if and only if\nfor every open cover of `s`, there exists a finite subcover. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_finite_subcover (L368-L375)\ntheorem isCompact_iff_finite_subcover :\n IsCompact s \u2194 \u2200 {\u03b9 : Type u} (U : \u03b9 \u2192 Set X),\n (\u2200 i, IsOpen (U i)) \u2192 (s \u2286 \u22c3 i, U i) \u2192 \u2203 t : Finset \u03b9, s \u2286 \u22c3 i \u2208 t, U i :=\n\u27e8fun hs => hs.elim_finite_subcover, isCompact_of_finite_subcover\u27e9\n\n/-- A set `s` is compact if and only if\nfor every family of closed sets whose intersection avoids `s`,\nthere exists a finite subfamily whose intersection avoids `s`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Compactness.Compact.mem_cocompact (L567-L569)\ntheorem mem_cocompact : s \u2208 cocompact X \u2194 \u2203 t, IsCompact t \u2227 t\u1d9c \u2286 s :=\nhasBasis_cocompact.mem_iff\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_singleton (L452-L455)\ntheorem isCompact_singleton {x : X} : IsCompact ({x} : Set X) := fun _ hf hfa =>\n\u27e8x, rfl, ClusterPt.of_le_nhds'\n (hfa.trans <| by simpa only [principal_singleton] using pure_le_nhds x) hf\u27e9\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Compactness.Compact.IsCompact (L40-L42)\nlemma IsCompact.exists_clusterPt (hs : IsCompact s) {f : Filter X} [NeBot f] (hf : f \u2264 \ud835\udcdf s) :\n \u2203 x \u2208 s, ClusterPt x f := hs hf\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Compactness.Bases.eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open (L21-L41)\nlemma eq_finite_iUnion_of_isTopologicalBasis_of_isCompact_open (b : \u03b9 \u2192 Set X)\n (hb : IsTopologicalBasis (Set.range b)) (U : Set X) (hUc : IsCompact U) (hUo : IsOpen U) :\n \u2203 s : Set \u03b9, s.Finite \u2227 U = \u22c3 i \u2208 s, b i := by\nobtain \u27e8Y, f, e, hf\u27e9 := hb.open_eq_iUnion hUo\n choose f' hf' using hf\n have : b \u2218 f' = f := funext hf'\n subst this\n obtain \u27e8t, ht\u27e9 :=\n hUc.elim_finite_subcover (b \u2218 f') (fun i => hb.isOpen (Set.mem_range_self _)) (by rw [e])\n classical\n refine \u27e8t.image f', Set.toFinite _, le_antisymm ?_ ?_\u27e9\n \u00b7 refine Set.Subset.trans ht ?_\n simp only [Set.iUnion_subset_iff]\n intro i hi\n simpa using subset_iUnion\u2082 (s := fun i _ => b (f' i)) i hi\n \u00b7 apply Set.iUnion\u2082_subset\n rintro i hi\n obtain \u27e8j, -, rfl\u27e9 := Finset.mem_image.mp hi\n rw [e]\n exact Set.subset_iUnion (b \u2218 f') j\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_empty (L449-L451)\ntheorem isCompact_empty : IsCompact (\u2205 : Set X) := fun _f hnf hsf =>\nNot.elim hnf.ne <| empty_mem_iff_bot.1 <| le_principal_iff.1 hsf\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Compactness.Compact.isCompact_iff_finite_subfamily_closed (L376-L383)\ntheorem isCompact_iff_finite_subfamily_closed :\n IsCompact s \u2194 \u2200 {\u03b9 : Type u} (t : \u03b9 \u2192 Set X),\n (\u2200 i, IsClosed (t i)) \u2192 (s \u2229 \u22c2 i, t i) = \u2205 \u2192 \u2203 u : Finset \u03b9, (s \u2229 \u22c2 i \u2208 u, t i) = \u2205 :=\n\u27e8fun hs => hs.elim_finite_subfamily_closed, isCompact_of_finite_subfamily_closed\u27e9\n\n/-- If `s : Set (X \u00d7 Y)` belongs to `\ud835\udcdd x \u00d7\u02e2 l` for all `x` from a compact set `K`,\nthen it belongs to `(\ud835\udcdd\u02e2 K) \u00d7\u02e2 l`,\ni.e., there exist an open `U \u2287 K` and `t \u2208 l` such that `U \u00d7\u02e2 t \u2286 s`. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Compactness/Lindelof.lean", "module": "Mathlib.Topology.Compactness.Lindelof", "declaration": "Mathlib.Topology.Compactness.Lindelof.Filter", "span": "L589-L595", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Compactness/Lindelof.lean#L589"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 8854, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 22219, "lean_code_chars": 20713, "natural_language_chars": 1506, "lean_code_ratio": 0.9322, "line_count": 544, "imports_count": 0, "declarations_count": 2693, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "0c3fd49636441313", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_compl_bijective", "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.GroupTheory.GroupAction.SubMulAction.Combination)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem mulActionHom_compl_bijective :\n Function.Bijective (mulActionHom_compl G \u03b1 hm)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.subMulAction (L58-L61)\ndef subMulAction : SubMulAction G (Finset \u03b1) where\n carrier := Set.powersetCard \u03b1 n\nsmul_mem' g s := (Finset.card_smul_finset g s).trans\n```\n\n-- snippet 2\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.coe_smul (L69-L72)\ntheorem coe_smul {n : \u2115} {g : G} {s : powersetCard \u03b1 n} :\n ((g \u2022 s : powersetCard \u03b1 n) : Finset \u03b1) = g \u2022 s :=\nSubMulAction.val_smul (p := subMulAction G \u03b1 n) g s\n```\n\n-- snippet 3\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.stabilizer_coe (L74-L78)\ntheorem stabilizer_coe {n : \u2115} (s : powersetCard \u03b1 n) :\n stabilizer G s = stabilizer G (s : Set \u03b1) := by\next g\n simp [mem_stabilizer_iff, \u2190 Subtype.coe_inj, \u2190 Finset.coe_inj]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.addAction_faithful (L79-L98)\ntheorem addAction_faithful {G : Type*} [AddGroup G] [AddAction G \u03b1] {n : \u2115}\n (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) {g : G} :\n AddAction.toPerm g = (1 : Perm (powersetCard \u03b1 n)) \u2194 AddAction.toPerm g = (1 : Perm \u03b1) := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 contrapose h with h\n have : \u2203 a, (g +\u1d65 a : \u03b1) \u2260 a := by simpa [Equiv.ext_iff] using h\n obtain \u27e8a, ha\u27e9 := this\n obtain \u27e8s, has, has'\u27e9 := exists_mem_notMem hn h\u03b1 (Ne.symm ha)\n rw [Equiv.ext_iff, not_forall]\n use s\n contrapose! has'\n simp only [AddAction.toPerm_apply, coe_one, id_eq] at has'\n rw [\u2190 has']\n simpa [\u2190 mem_coe_iff]\n \u00b7 simp only [Equiv.ext_iff, AddAction.toPerm_apply] at h \u22a2\n simp [Subtype.ext_iff, Finset.ext_iff, mem_vadd_finset, h]\n\n/-- If an additive group `G` acts faithfully on `\u03b1`,\nthen it acts faithfully on `powersetCard \u03b1 n`,\nprovided `1 \u2264 n < ENat.card \u03b1`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.faithfulVAdd (L99-L107)\ntheorem faithfulVAdd {G : Type*} [AddGroup G] [AddAction G \u03b1] {n : \u2115}\n (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) [FaithfulVAdd G \u03b1] :\n FaithfulVAdd G (powersetCard \u03b1 n) := by\nrw [faithfulVAdd_iff]\n intro g hg\n apply AddAction.toPerm_injective (\u03b1 := G) (\u03b2 := \u03b1)\n rw [AddAction.toPerm_zero, \u2190 addAction_faithful hn h\u03b1]\n exact Perm.ext_iff.mpr hg\n```\n\n-- snippet 6\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulAction_faithful (L108-L125)\ntheorem mulAction_faithful (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) {g : G} :\n MulAction.toPerm g = (1 : Perm (powersetCard \u03b1 n)) \u2194 MulAction.toPerm g = (1 : Perm \u03b1) := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 contrapose h with h\n have : \u2203 a, (g \u2022 a : \u03b1) \u2260 a := by simpa [Equiv.ext_iff] using h\n obtain \u27e8a, ha\u27e9 := this\n obtain \u27e8s, has, has'\u27e9 := exists_mem_notMem hn h\u03b1 (Ne.symm ha)\n rw [Equiv.ext_iff, not_forall]\n use s\n contrapose! has'\n simp only [MulAction.toPerm_apply, coe_one, id_eq] at has'\n rw [\u2190 has']\n simpa only [coe_smul, smul_mem_smul_finset_iff, \u2190 mem_coe_iff]\n \u00b7 simp only [Equiv.ext_iff, MulAction.toPerm_apply] at h \u22a2\n simp [Subtype.ext_iff, Finset.ext_iff, mem_smul_finset, h]\n\n/-- If a group `G` acts faithfully on `\u03b1`, then\nit acts faithfully on `powersetCard \u03b1 n` provided `1 \u2264 n < ENat.card \u03b1`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.faithfulSMul (L126-L133)\ntheorem faithfulSMul (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) [FaithfulSMul G \u03b1] :\n FaithfulSMul G (powersetCard \u03b1 n) := by\nrw [faithfulSMul_iff]\n intro g hg\n apply MulAction.toPerm_injective (\u03b1 := G) (\u03b2 := \u03b1)\n rw [MulAction.toPerm_one, \u2190 mulAction_faithful hn h\u03b1]\n exact Perm.ext_iff.mpr hg\n```\n\n-- snippet 8\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_of_embedding (L142-L148)\ndef mulActionHom_of_embedding : (Fin n \u21aa \u03b1) \u2192[G] powersetCard \u03b1 n where\n toFun := ofFinEmb n \u03b1\nmap_smul' g f := by\n rw [\u2190 Subtype.coe_inj, coe_smul, f.smul_def, val_ofFinEmb, val_ofFinEmb,\n Finset.smul_finset_def, \u2190 Finset.map_map, Finset.map_eq_image]\n simp [toPerm]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.coe_mulActionHom_of_embedding (L150-L153)\ntheorem coe_mulActionHom_of_embedding (f : Fin n \u21aa \u03b1) :\n \u2191((mulActionHom_of_embedding G \u03b1 n).toFun f) = Finset.univ.map f :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_of_embedding_surjective (L155-L161)\ntheorem mulActionHom_of_embedding_surjective :\n Function.Surjective (mulActionHom_of_embedding G \u03b1 n) := by\nintro \u27e8s, hs\u27e9\n obtain \u27e8f : Fin n \u21aa \u03b1, hf\u27e9 :=\n Function.Embedding.exists_of_card_eq_finset (by rw [hs, Fintype.card_fin])\n exact \u27e8f, Subtype.ext hf\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.isPretransitive_of_isMultiplyPretransitive (L167-L170)\ntheorem isPretransitive_of_isMultiplyPretransitive (h : IsMultiplyPretransitive G \u03b1 n) :\n IsPretransitive G (powersetCard \u03b1 n) :=\nIsPretransitive.of_surjective_map (mulActionHom_of_embedding_surjective G \u03b1) h\n```\n\n-- snippet 12\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.isPretransitive (L171-L181)\ntheorem isPretransitive : IsPretransitive (Perm \u03b1) (powersetCard \u03b1 n) :=\nisPretransitive_of_isMultiplyPretransitive _ (isMultiplyPretransitive \u03b1 n)\n\nsection compl\n\nvariable (\u03b1)\n\nvariable [Fintype \u03b1] {m : \u2115} (hm : m + n = Fintype.card \u03b1)\ninclude hm\n\n/-- The complement of a combination, as an equivariant map. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_compl (L182-L186)\ndef mulActionHom_compl : powersetCard \u03b1 n \u2192[G] powersetCard \u03b1 m where\n toFun := compl hm\nmap_smul' g s := by ext; simp [\u2190 Finset.inv_smul_mem_iff]\n\nvariable {hm} in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.coe_mulActionHom_compl (L187-L191)\ntheorem coe_mulActionHom_compl {s : powersetCard \u03b1 n} :\n (mulActionHom_compl G \u03b1 hm s : Finset \u03b1) = (s : Finset \u03b1)\u1d9c :=\nrfl\n\nvariable {hm} in\n```\n\n-- snippet 15\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mem_mulActionHom_compl (L192-L195)\ntheorem mem_mulActionHom_compl {s : powersetCard \u03b1 n} {a : \u03b1} :\n a \u2208 mulActionHom_compl G \u03b1 hm s \u2194 a \u2209 s :=\nFinset.mem_compl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_one (L279-L282)\ntheorem stabilizerEquivStabilizer_one :\n stabilizerEquivStabilizer (one_smul G a).symm = MulEquiv.refl (stabilizer G a) := by\next; simp [stabilizerEquivStabilizer_apply]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_le_snd (L232-L239)\nlemma orbitRel_le_snd :\n orbitRel G (\u03b1 \u00d7 \u03b2) \u2264 (orbitRel G \u03b2).comap Prod.snd :=\nSetoid.le_def.2 snd_mem_orbit_of_mem_orbit\n\nend Orbit\n\nsection Stabilizer\n```\n\n-- snippet 18\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizer_smul_eq_stabilizer_map_conj (L251-L259)\ntheorem stabilizer_smul_eq_stabilizer_map_conj (g : G) (a : \u03b1) :\n stabilizer G (g \u2022 a) = (stabilizer G a).map (MulAut.conj g).toMonoidHom := by\next h\n rw [mem_stabilizer_iff, \u2190 smul_left_cancel_iff g\u207b\u00b9, smul_smul, smul_smul, smul_smul,\n inv_mul_cancel, one_smul, \u2190 mem_stabilizer_iff, Subgroup.mem_map_equiv, MulAut.conj_symm_apply]\n\nvariable {g h k : G} {a b c : \u03b1}\n\n/-- The natural group equivalence between the stabilizers of two elements in the same orbit. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer (L260-L264)\ndef stabilizerEquivStabilizer (hg : b = g \u2022 a) : stabilizer G a \u2243* stabilizer G b :=\n((MulAut.conj g).subgroupMap (stabilizer G a)).trans\n (MulEquiv.subgroupCongr (by\n rw [hg, stabilizer_smul_eq_stabilizer_map_conj g a, \u2190 MulEquiv.toMonoidHom_eq_coe]))\n```\n\n-- snippet 20\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_inv (L288-L306)\ntheorem stabilizerEquivStabilizer_inv (hg : b = g\u207b\u00b9 \u2022 a) :\n stabilizerEquivStabilizer hg =\n (stabilizerEquivStabilizer (inv_smul_eq_iff.mp hg.symm)).symm := by\next; simp [stabilizerEquivStabilizer]\n\n/-- A bijection between the stabilizers of two elements in the same orbit. -/\nnoncomputable def stabilizerEquivStabilizerOfOrbitRel (h : orbitRel G \u03b1 a b) :\n stabilizer G a \u2243* stabilizer G b :=\n (stabilizerEquivStabilizer (Classical.choose_spec h).symm).symm\n\nend Stabilizer\n\nend MulAction\n\nnamespace AddAction\nvariable {G \u03b1 : Type*} [AddGroup G] [AddAction G \u03b1]\n\nvariable {g h k : G} {a b c : \u03b1}\n/-- If the stabilizer of `x` is `S`, then the stabilizer of `g +\u1d65 x` is `g + S + (-g)`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.fst_mem_orbit_of_mem_orbit (L51-L55)\nlemma fst_mem_orbit_of_mem_orbit {x y : \u03b1 \u00d7 \u03b2} (h : x \u2208 MulAction.orbit M y) :\n x.1 \u2208 MulAction.orbit M y.1 := by\nrcases h with \u27e8g, rfl\u27e9\n exact mem_orbit _ _\n```\n\n-- snippet 22\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.pretransitive_iff_subsingleton_quotient (L179-L188)\ntheorem pretransitive_iff_subsingleton_quotient :\n IsPretransitive G \u03b1 \u2194 Subsingleton (orbitRel.Quotient G \u03b1) := by\nrefine \u27e8fun _ \u21a6 \u27e8fun a b \u21a6 ?_\u27e9, fun _ \u21a6 \u27e8fun a b \u21a6 ?_\u27e9\u27e9\n \u00b7 refine Quot.inductionOn a (fun x \u21a6 ?_)\n exact Quot.inductionOn b (fun y \u21a6 Quot.sound <| exists_smul_eq G y x)\n \u00b7 have h : Quotient.mk (orbitRel G \u03b1) b = \u27e6a\u27e7 := Subsingleton.elim _ _\n exact Quotient.eq''.mp h\n\n/-- If `\u03b1` is non-empty, an action is pretransitive if and only if the quotient has exactly one\nelement. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_subgroupOf (L155-L176)\nlemma orbitRel_subgroupOf (H K : Subgroup G) :\n orbitRel (H.subgroupOf K) \u03b1 = orbitRel (H \u2293 K : Subgroup G) \u03b1 := by\nrw [\u2190 Subgroup.subgroupOf_map_subtype]\n ext x\n simp_rw [orbitRel_apply]\n refine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 rcases h with \u27e8\u27e8gv, gp\u27e9, rfl\u27e9\n simp only\n refine mem_orbit _ (\u27e8gv, ?_\u27e9 : Subgroup.map K.subtype (H.subgroupOf K))\n simpa using gp\n \u00b7 rcases h with \u27e8\u27e8gv, gp\u27e9, rfl\u27e9\n simp only\n simp only [Subgroup.subgroupOf_map_subtype, Subgroup.mem_inf] at gp\n refine mem_orbit _ (\u27e8\u27e8gv, ?_\u27e9, ?_\u27e9 : H.subgroupOf K)\n \u00b7 exact gp.2\n \u00b7 simp only [Subgroup.mem_subgroupOf]\n exact gp.1\n\nvariable (G \u03b1)\n\n/-- An action is pretransitive if and only if the quotient by `MulAction.orbitRel` is a\nsubsingleton. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_symm_apply (L269-L272)\ntheorem stabilizerEquivStabilizer_symm_apply (hg : b = g \u2022 a) (x : stabilizer G b) :\n (stabilizerEquivStabilizer hg).symm x = MulAut.conj g\u207b\u00b9 x := by\nsimp [stabilizerEquivStabilizer]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.pretransitive_iff_unique_quotient_of_nonempty (L191-L198)\ntheorem pretransitive_iff_unique_quotient_of_nonempty [Nonempty \u03b1] :\n IsPretransitive G \u03b1 \u2194 Nonempty (Unique <| orbitRel.Quotient G \u03b1) := by\nrw [unique_iff_subsingleton_and_nonempty, pretransitive_iff_subsingleton_quotient, iff_self_and]\n exact fun _ \u21a6 (nonempty_quotient_iff _).mpr inferInstance\n\nvariable {G \u03b1}\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 26\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_zero (L336-L339)\ntheorem stabilizerEquivStabilizer_zero :\n stabilizerEquivStabilizer (zero_vadd G a).symm = AddEquiv.refl (stabilizer G a) := by\next; simp [stabilizerEquivStabilizer_apply]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_subgroup_le (L151-L153)\nlemma orbitRel_subgroup_le (H : Subgroup G) : orbitRel H \u03b1 \u2264 orbitRel G \u03b1 :=\nSetoid.le_def.2 mem_orbit_of_mem_orbit_subgroup\n```\n\n-- snippet 28\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizer_vadd_eq_stabilizer_map_conj (L307-L316)\ntheorem stabilizer_vadd_eq_stabilizer_map_conj (g : G) (a : \u03b1) :\n stabilizer G (g +\u1d65 a) = (stabilizer G a).map (AddAut.conj g).toMul.toAddMonoidHom := by\next h\n rw [mem_stabilizer_iff, \u2190 vadd_left_cancel_iff (-g), vadd_vadd, vadd_vadd, vadd_vadd,\n neg_add_cancel, zero_vadd, \u2190 mem_stabilizer_iff, AddSubgroup.mem_map_equiv,\n AddAut.conj_symm_apply]\n\nvariable {g h k : G} {a b c : \u03b1}\n\n/-- The natural group equivalence between the stabilizers of two elements in the same orbit. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_trans (L273-L278)\ntheorem stabilizerEquivStabilizer_trans (hg : b = g \u2022 a) (hh : c = h \u2022 b) (hk : c = k \u2022 a)\n (H : k = h * g) :\n (stabilizerEquivStabilizer hg).trans (stabilizerEquivStabilizer hh) =\n stabilizerEquivStabilizer hk := by\next; simp [stabilizerEquivStabilizer_apply, H]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_symm (L283-L287)\ntheorem stabilizerEquivStabilizer_symm (hg : b = g \u2022 a) :\n (stabilizerEquivStabilizer hg).symm =\n stabilizerEquivStabilizer (eq_inv_smul_iff.mpr hg.symm) := by\next x; simp [stabilizerEquivStabilizer]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.nontrivial_of_fixedPoints_ne_univ (L126-L133)\ntheorem nontrivial_of_fixedPoints_ne_univ (h : fixedPoints G \u03b1 \u2260 .univ) :\n Nontrivial \u03b1 :=\n(subsingleton_or_nontrivial \u03b1).resolve_left fun _ \u21a6 h fixedPoints_of_subsingleton\n\nsection Orbit\n\n-- TODO: This proof is redoing a special case of `MulAction.IsInvariantBlock.isBlock`. Can we move\n-- this lemma earlier to golf?\n```\n\n-- snippet 32\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbit_eq_univ (L69-L77)\ntheorem orbit_eq_univ [IsPretransitive M \u03b1] (a : \u03b1) : orbit M a = Set.univ :=\n(surjective_smul M a).range_eq\n\nend Orbit\n\nsection FixedPoints\n\nvariable {M \u03b1}\n```\n\n-- snippet 33\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.subsingleton_orbit_iff_mem_fixedPoints (L79-L86)\ntheorem subsingleton_orbit_iff_mem_fixedPoints {a : \u03b1} :\n (orbit M a).Subsingleton \u2194 a \u2208 fixedPoints M \u03b1 := by\nrw [mem_fixedPoints]\n constructor\n \u00b7 exact fun h m \u21a6 h (mem_orbit a m) (mem_orbit_self a)\n \u00b7 rintro h _ \u27e8m, rfl\u27e9 y \u27e8p, rfl\u27e9\n simp only [h]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.mem_fixedPoints_iff_card_orbit_eq_one (L88-L93)\ntheorem mem_fixedPoints_iff_card_orbit_eq_one {a : \u03b1} [Fintype (orbit M a)] :\n a \u2208 fixedPoints M \u03b1 \u2194 Fintype.card (orbit M a) = 1 := by\nsimp only [\u2190 subsingleton_orbit_iff_mem_fixedPoints, le_antisymm_iff,\n Fintype.card_le_one_iff_subsingleton, Nat.add_one_le_iff, Fintype.card_pos_iff,\n Set.subsingleton_coe, iff_self_and, Set.nonempty_coe_sort, nonempty_orbit, implies_true]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_apply (L265-L268)\ntheorem stabilizerEquivStabilizer_apply (hg : b = g \u2022 a) (x : stabilizer G a) :\n stabilizerEquivStabilizer hg x = MulAut.conj g x := by\nsimp [stabilizerEquivStabilizer]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.smul_cancel_of_non_zero_divisor (L107-L116)\ntheorem smul_cancel_of_non_zero_divisor {M G : Type*} [Monoid M] [AddGroup G]\n [DistribMulAction M G] (k : M) (h : \u2200 x : G, k \u2022 x = 0 \u2192 x = 0) {a b : G} (h' : k \u2022 a = k \u2022 b) :\n a = b := by\nrw [\u2190 sub_eq_zero]\n refine h _ ?_\n rw [smul_sub, h', sub_self]\n\nnamespace MulAction\nvariable {G \u03b1 \u03b2 : Type*} [Group G] [MulAction G \u03b1] [MulAction G \u03b2]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.snd_mem_orbit_of_mem_orbit (L57-L61)\nlemma snd_mem_orbit_of_mem_orbit {x y : \u03b1 \u00d7 \u03b2} (h : x \u2208 MulAction.orbit M y) :\n x.2 \u2208 MulAction.orbit M y.2 := by\nrcases h with \u27e8g, rfl\u27e9\n exact mem_orbit _ _\n```\n\n-- snippet 38\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_le_fst (L227-L230)\nlemma orbitRel_le_fst :\n orbitRel G (\u03b1 \u00d7 \u03b2) \u2264 (orbitRel G \u03b1).comap Prod.fst :=\nSetoid.le_def.2 fst_mem_orbit_of_mem_orbit\n```\n\n-- snippet 39\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_neg (L345-L356)\ntheorem stabilizerEquivStabilizer_neg (hg : b = -g +\u1d65 a) :\n stabilizerEquivStabilizer hg =\n (stabilizerEquivStabilizer (neg_vadd_eq_iff.mp hg.symm)).symm := by\next; simp [stabilizerEquivStabilizer]\n\n/-- A bijection between the stabilizers of two elements in the same orbit. -/\nnoncomputable def stabilizerEquivStabilizerOfOrbitRel (h : orbitRel G \u03b1 a b) :\n stabilizer G a \u2243+ stabilizer G b :=\n (stabilizerEquivStabilizer (Classical.choose_spec h).symm).symm\n\nend AddAction\n```\n\n-- snippet 40\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.smul_orbit (L135-L141)\ntheorem smul_orbit (g : G) (a : \u03b1) : g \u2022 orbit G a = orbit G a :=\n(smul_orbit_subset g a).antisymm <|\n calc\n orbit G a = g \u2022 g\u207b\u00b9 \u2022 orbit G a := (smul_inv_smul _ _).symm\n _ \u2286 g \u2022 orbit G a := Set.image_mono (smul_orbit_subset _ _)\n\n/-- The action of a group on an orbit is transitive. -/\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.GroupTheory.GroupAction.SubMulAction.Combination).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem mulActionHom_compl_bijective :\n Function.Bijective (mulActionHom_compl G \u03b1 hm)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.subMulAction (L58-L61)\ndef subMulAction : SubMulAction G (Finset \u03b1) where\n carrier := Set.powersetCard \u03b1 n\nsmul_mem' g s := (Finset.card_smul_finset g s).trans\n```\n\n-- snippet 2\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.coe_smul (L69-L72)\ntheorem coe_smul {n : \u2115} {g : G} {s : powersetCard \u03b1 n} :\n ((g \u2022 s : powersetCard \u03b1 n) : Finset \u03b1) = g \u2022 s :=\nSubMulAction.val_smul (p := subMulAction G \u03b1 n) g s\n```\n\n-- snippet 3\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.stabilizer_coe (L74-L78)\ntheorem stabilizer_coe {n : \u2115} (s : powersetCard \u03b1 n) :\n stabilizer G s = stabilizer G (s : Set \u03b1) := by\next g\n simp [mem_stabilizer_iff, \u2190 Subtype.coe_inj, \u2190 Finset.coe_inj]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.addAction_faithful (L79-L98)\ntheorem addAction_faithful {G : Type*} [AddGroup G] [AddAction G \u03b1] {n : \u2115}\n (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) {g : G} :\n AddAction.toPerm g = (1 : Perm (powersetCard \u03b1 n)) \u2194 AddAction.toPerm g = (1 : Perm \u03b1) := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 contrapose h with h\n have : \u2203 a, (g +\u1d65 a : \u03b1) \u2260 a := by simpa [Equiv.ext_iff] using h\n obtain \u27e8a, ha\u27e9 := this\n obtain \u27e8s, has, has'\u27e9 := exists_mem_notMem hn h\u03b1 (Ne.symm ha)\n rw [Equiv.ext_iff, not_forall]\n use s\n contrapose! has'\n simp only [AddAction.toPerm_apply, coe_one, id_eq] at has'\n rw [\u2190 has']\n simpa [\u2190 mem_coe_iff]\n \u00b7 simp only [Equiv.ext_iff, AddAction.toPerm_apply] at h \u22a2\n simp [Subtype.ext_iff, Finset.ext_iff, mem_vadd_finset, h]\n\n/-- If an additive group `G` acts faithfully on `\u03b1`,\nthen it acts faithfully on `powersetCard \u03b1 n`,\nprovided `1 \u2264 n < ENat.card \u03b1`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.faithfulVAdd (L99-L107)\ntheorem faithfulVAdd {G : Type*} [AddGroup G] [AddAction G \u03b1] {n : \u2115}\n (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) [FaithfulVAdd G \u03b1] :\n FaithfulVAdd G (powersetCard \u03b1 n) := by\nrw [faithfulVAdd_iff]\n intro g hg\n apply AddAction.toPerm_injective (\u03b1 := G) (\u03b2 := \u03b1)\n rw [AddAction.toPerm_zero, \u2190 addAction_faithful hn h\u03b1]\n exact Perm.ext_iff.mpr hg\n```\n\n-- snippet 6\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulAction_faithful (L108-L125)\ntheorem mulAction_faithful (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) {g : G} :\n MulAction.toPerm g = (1 : Perm (powersetCard \u03b1 n)) \u2194 MulAction.toPerm g = (1 : Perm \u03b1) := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 contrapose h with h\n have : \u2203 a, (g \u2022 a : \u03b1) \u2260 a := by simpa [Equiv.ext_iff] using h\n obtain \u27e8a, ha\u27e9 := this\n obtain \u27e8s, has, has'\u27e9 := exists_mem_notMem hn h\u03b1 (Ne.symm ha)\n rw [Equiv.ext_iff, not_forall]\n use s\n contrapose! has'\n simp only [MulAction.toPerm_apply, coe_one, id_eq] at has'\n rw [\u2190 has']\n simpa only [coe_smul, smul_mem_smul_finset_iff, \u2190 mem_coe_iff]\n \u00b7 simp only [Equiv.ext_iff, MulAction.toPerm_apply] at h \u22a2\n simp [Subtype.ext_iff, Finset.ext_iff, mem_smul_finset, h]\n\n/-- If a group `G` acts faithfully on `\u03b1`, then\nit acts faithfully on `powersetCard \u03b1 n` provided `1 \u2264 n < ENat.card \u03b1`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.faithfulSMul (L126-L133)\ntheorem faithfulSMul (hn : 1 \u2264 n) (h\u03b1 : n < ENat.card \u03b1) [FaithfulSMul G \u03b1] :\n FaithfulSMul G (powersetCard \u03b1 n) := by\nrw [faithfulSMul_iff]\n intro g hg\n apply MulAction.toPerm_injective (\u03b1 := G) (\u03b2 := \u03b1)\n rw [MulAction.toPerm_one, \u2190 mulAction_faithful hn h\u03b1]\n exact Perm.ext_iff.mpr hg\n```\n\n-- snippet 8\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_of_embedding (L142-L148)\ndef mulActionHom_of_embedding : (Fin n \u21aa \u03b1) \u2192[G] powersetCard \u03b1 n where\n toFun := ofFinEmb n \u03b1\nmap_smul' g f := by\n rw [\u2190 Subtype.coe_inj, coe_smul, f.smul_def, val_ofFinEmb, val_ofFinEmb,\n Finset.smul_finset_def, \u2190 Finset.map_map, Finset.map_eq_image]\n simp [toPerm]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.coe_mulActionHom_of_embedding (L150-L153)\ntheorem coe_mulActionHom_of_embedding (f : Fin n \u21aa \u03b1) :\n \u2191((mulActionHom_of_embedding G \u03b1 n).toFun f) = Finset.univ.map f :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_of_embedding_surjective (L155-L161)\ntheorem mulActionHom_of_embedding_surjective :\n Function.Surjective (mulActionHom_of_embedding G \u03b1 n) := by\nintro \u27e8s, hs\u27e9\n obtain \u27e8f : Fin n \u21aa \u03b1, hf\u27e9 :=\n Function.Embedding.exists_of_card_eq_finset (by rw [hs, Fintype.card_fin])\n exact \u27e8f, Subtype.ext hf\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.isPretransitive_of_isMultiplyPretransitive (L167-L170)\ntheorem isPretransitive_of_isMultiplyPretransitive (h : IsMultiplyPretransitive G \u03b1 n) :\n IsPretransitive G (powersetCard \u03b1 n) :=\nIsPretransitive.of_surjective_map (mulActionHom_of_embedding_surjective G \u03b1) h\n```\n\n-- snippet 12\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.isPretransitive (L171-L181)\ntheorem isPretransitive : IsPretransitive (Perm \u03b1) (powersetCard \u03b1 n) :=\nisPretransitive_of_isMultiplyPretransitive _ (isMultiplyPretransitive \u03b1 n)\n\nsection compl\n\nvariable (\u03b1)\n\nvariable [Fintype \u03b1] {m : \u2115} (hm : m + n = Fintype.card \u03b1)\ninclude hm\n\n/-- The complement of a combination, as an equivariant map. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_compl (L182-L186)\ndef mulActionHom_compl : powersetCard \u03b1 n \u2192[G] powersetCard \u03b1 m where\n toFun := compl hm\nmap_smul' g s := by ext; simp [\u2190 Finset.inv_smul_mem_iff]\n\nvariable {hm} in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.coe_mulActionHom_compl (L187-L191)\ntheorem coe_mulActionHom_compl {s : powersetCard \u03b1 n} :\n (mulActionHom_compl G \u03b1 hm s : Finset \u03b1) = (s : Finset \u03b1)\u1d9c :=\nrfl\n\nvariable {hm} in\n```\n\n-- snippet 15\n```lean\n-- Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mem_mulActionHom_compl (L192-L195)\ntheorem mem_mulActionHom_compl {s : powersetCard \u03b1 n} {a : \u03b1} :\n a \u2208 mulActionHom_compl G \u03b1 hm s \u2194 a \u2209 s :=\nFinset.mem_compl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_one (L279-L282)\ntheorem stabilizerEquivStabilizer_one :\n stabilizerEquivStabilizer (one_smul G a).symm = MulEquiv.refl (stabilizer G a) := by\next; simp [stabilizerEquivStabilizer_apply]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_le_snd (L232-L239)\nlemma orbitRel_le_snd :\n orbitRel G (\u03b1 \u00d7 \u03b2) \u2264 (orbitRel G \u03b2).comap Prod.snd :=\nSetoid.le_def.2 snd_mem_orbit_of_mem_orbit\n\nend Orbit\n\nsection Stabilizer\n```\n\n-- snippet 18\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizer_smul_eq_stabilizer_map_conj (L251-L259)\ntheorem stabilizer_smul_eq_stabilizer_map_conj (g : G) (a : \u03b1) :\n stabilizer G (g \u2022 a) = (stabilizer G a).map (MulAut.conj g).toMonoidHom := by\next h\n rw [mem_stabilizer_iff, \u2190 smul_left_cancel_iff g\u207b\u00b9, smul_smul, smul_smul, smul_smul,\n inv_mul_cancel, one_smul, \u2190 mem_stabilizer_iff, Subgroup.mem_map_equiv, MulAut.conj_symm_apply]\n\nvariable {g h k : G} {a b c : \u03b1}\n\n/-- The natural group equivalence between the stabilizers of two elements in the same orbit. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer (L260-L264)\ndef stabilizerEquivStabilizer (hg : b = g \u2022 a) : stabilizer G a \u2243* stabilizer G b :=\n((MulAut.conj g).subgroupMap (stabilizer G a)).trans\n (MulEquiv.subgroupCongr (by\n rw [hg, stabilizer_smul_eq_stabilizer_map_conj g a, \u2190 MulEquiv.toMonoidHom_eq_coe]))\n```\n\n-- snippet 20\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_inv (L288-L306)\ntheorem stabilizerEquivStabilizer_inv (hg : b = g\u207b\u00b9 \u2022 a) :\n stabilizerEquivStabilizer hg =\n (stabilizerEquivStabilizer (inv_smul_eq_iff.mp hg.symm)).symm := by\next; simp [stabilizerEquivStabilizer]\n\n/-- A bijection between the stabilizers of two elements in the same orbit. -/\nnoncomputable def stabilizerEquivStabilizerOfOrbitRel (h : orbitRel G \u03b1 a b) :\n stabilizer G a \u2243* stabilizer G b :=\n (stabilizerEquivStabilizer (Classical.choose_spec h).symm).symm\n\nend Stabilizer\n\nend MulAction\n\nnamespace AddAction\nvariable {G \u03b1 : Type*} [AddGroup G] [AddAction G \u03b1]\n\nvariable {g h k : G} {a b c : \u03b1}\n/-- If the stabilizer of `x` is `S`, then the stabilizer of `g +\u1d65 x` is `g + S + (-g)`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.fst_mem_orbit_of_mem_orbit (L51-L55)\nlemma fst_mem_orbit_of_mem_orbit {x y : \u03b1 \u00d7 \u03b2} (h : x \u2208 MulAction.orbit M y) :\n x.1 \u2208 MulAction.orbit M y.1 := by\nrcases h with \u27e8g, rfl\u27e9\n exact mem_orbit _ _\n```\n\n-- snippet 22\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.pretransitive_iff_subsingleton_quotient (L179-L188)\ntheorem pretransitive_iff_subsingleton_quotient :\n IsPretransitive G \u03b1 \u2194 Subsingleton (orbitRel.Quotient G \u03b1) := by\nrefine \u27e8fun _ \u21a6 \u27e8fun a b \u21a6 ?_\u27e9, fun _ \u21a6 \u27e8fun a b \u21a6 ?_\u27e9\u27e9\n \u00b7 refine Quot.inductionOn a (fun x \u21a6 ?_)\n exact Quot.inductionOn b (fun y \u21a6 Quot.sound <| exists_smul_eq G y x)\n \u00b7 have h : Quotient.mk (orbitRel G \u03b1) b = \u27e6a\u27e7 := Subsingleton.elim _ _\n exact Quotient.eq''.mp h\n\n/-- If `\u03b1` is non-empty, an action is pretransitive if and only if the quotient has exactly one\nelement. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_subgroupOf (L155-L176)\nlemma orbitRel_subgroupOf (H K : Subgroup G) :\n orbitRel (H.subgroupOf K) \u03b1 = orbitRel (H \u2293 K : Subgroup G) \u03b1 := by\nrw [\u2190 Subgroup.subgroupOf_map_subtype]\n ext x\n simp_rw [orbitRel_apply]\n refine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 rcases h with \u27e8\u27e8gv, gp\u27e9, rfl\u27e9\n simp only\n refine mem_orbit _ (\u27e8gv, ?_\u27e9 : Subgroup.map K.subtype (H.subgroupOf K))\n simpa using gp\n \u00b7 rcases h with \u27e8\u27e8gv, gp\u27e9, rfl\u27e9\n simp only\n simp only [Subgroup.subgroupOf_map_subtype, Subgroup.mem_inf] at gp\n refine mem_orbit _ (\u27e8\u27e8gv, ?_\u27e9, ?_\u27e9 : H.subgroupOf K)\n \u00b7 exact gp.2\n \u00b7 simp only [Subgroup.mem_subgroupOf]\n exact gp.1\n\nvariable (G \u03b1)\n\n/-- An action is pretransitive if and only if the quotient by `MulAction.orbitRel` is a\nsubsingleton. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_symm_apply (L269-L272)\ntheorem stabilizerEquivStabilizer_symm_apply (hg : b = g \u2022 a) (x : stabilizer G b) :\n (stabilizerEquivStabilizer hg).symm x = MulAut.conj g\u207b\u00b9 x := by\nsimp [stabilizerEquivStabilizer]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.pretransitive_iff_unique_quotient_of_nonempty (L191-L198)\ntheorem pretransitive_iff_unique_quotient_of_nonempty [Nonempty \u03b1] :\n IsPretransitive G \u03b1 \u2194 Nonempty (Unique <| orbitRel.Quotient G \u03b1) := by\nrw [unique_iff_subsingleton_and_nonempty, pretransitive_iff_subsingleton_quotient, iff_self_and]\n exact fun _ \u21a6 (nonempty_quotient_iff _).mpr inferInstance\n\nvariable {G \u03b1}\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 26\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_zero (L336-L339)\ntheorem stabilizerEquivStabilizer_zero :\n stabilizerEquivStabilizer (zero_vadd G a).symm = AddEquiv.refl (stabilizer G a) := by\next; simp [stabilizerEquivStabilizer_apply]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_subgroup_le (L151-L153)\nlemma orbitRel_subgroup_le (H : Subgroup G) : orbitRel H \u03b1 \u2264 orbitRel G \u03b1 :=\nSetoid.le_def.2 mem_orbit_of_mem_orbit_subgroup\n```\n\n-- snippet 28\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizer_vadd_eq_stabilizer_map_conj (L307-L316)\ntheorem stabilizer_vadd_eq_stabilizer_map_conj (g : G) (a : \u03b1) :\n stabilizer G (g +\u1d65 a) = (stabilizer G a).map (AddAut.conj g).toMul.toAddMonoidHom := by\next h\n rw [mem_stabilizer_iff, \u2190 vadd_left_cancel_iff (-g), vadd_vadd, vadd_vadd, vadd_vadd,\n neg_add_cancel, zero_vadd, \u2190 mem_stabilizer_iff, AddSubgroup.mem_map_equiv,\n AddAut.conj_symm_apply]\n\nvariable {g h k : G} {a b c : \u03b1}\n\n/-- The natural group equivalence between the stabilizers of two elements in the same orbit. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_trans (L273-L278)\ntheorem stabilizerEquivStabilizer_trans (hg : b = g \u2022 a) (hh : c = h \u2022 b) (hk : c = k \u2022 a)\n (H : k = h * g) :\n (stabilizerEquivStabilizer hg).trans (stabilizerEquivStabilizer hh) =\n stabilizerEquivStabilizer hk := by\next; simp [stabilizerEquivStabilizer_apply, H]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_symm (L283-L287)\ntheorem stabilizerEquivStabilizer_symm (hg : b = g \u2022 a) :\n (stabilizerEquivStabilizer hg).symm =\n stabilizerEquivStabilizer (eq_inv_smul_iff.mpr hg.symm) := by\next x; simp [stabilizerEquivStabilizer]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.nontrivial_of_fixedPoints_ne_univ (L126-L133)\ntheorem nontrivial_of_fixedPoints_ne_univ (h : fixedPoints G \u03b1 \u2260 .univ) :\n Nontrivial \u03b1 :=\n(subsingleton_or_nontrivial \u03b1).resolve_left fun _ \u21a6 h fixedPoints_of_subsingleton\n\nsection Orbit\n\n-- TODO: This proof is redoing a special case of `MulAction.IsInvariantBlock.isBlock`. Can we move\n-- this lemma earlier to golf?\n```\n\n-- snippet 32\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbit_eq_univ (L69-L77)\ntheorem orbit_eq_univ [IsPretransitive M \u03b1] (a : \u03b1) : orbit M a = Set.univ :=\n(surjective_smul M a).range_eq\n\nend Orbit\n\nsection FixedPoints\n\nvariable {M \u03b1}\n```\n\n-- snippet 33\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.subsingleton_orbit_iff_mem_fixedPoints (L79-L86)\ntheorem subsingleton_orbit_iff_mem_fixedPoints {a : \u03b1} :\n (orbit M a).Subsingleton \u2194 a \u2208 fixedPoints M \u03b1 := by\nrw [mem_fixedPoints]\n constructor\n \u00b7 exact fun h m \u21a6 h (mem_orbit a m) (mem_orbit_self a)\n \u00b7 rintro h _ \u27e8m, rfl\u27e9 y \u27e8p, rfl\u27e9\n simp only [h]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.mem_fixedPoints_iff_card_orbit_eq_one (L88-L93)\ntheorem mem_fixedPoints_iff_card_orbit_eq_one {a : \u03b1} [Fintype (orbit M a)] :\n a \u2208 fixedPoints M \u03b1 \u2194 Fintype.card (orbit M a) = 1 := by\nsimp only [\u2190 subsingleton_orbit_iff_mem_fixedPoints, le_antisymm_iff,\n Fintype.card_le_one_iff_subsingleton, Nat.add_one_le_iff, Fintype.card_pos_iff,\n Set.subsingleton_coe, iff_self_and, Set.nonempty_coe_sort, nonempty_orbit, implies_true]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_apply (L265-L268)\ntheorem stabilizerEquivStabilizer_apply (hg : b = g \u2022 a) (x : stabilizer G a) :\n stabilizerEquivStabilizer hg x = MulAut.conj g x := by\nsimp [stabilizerEquivStabilizer]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.smul_cancel_of_non_zero_divisor (L107-L116)\ntheorem smul_cancel_of_non_zero_divisor {M G : Type*} [Monoid M] [AddGroup G]\n [DistribMulAction M G] (k : M) (h : \u2200 x : G, k \u2022 x = 0 \u2192 x = 0) {a b : G} (h' : k \u2022 a = k \u2022 b) :\n a = b := by\nrw [\u2190 sub_eq_zero]\n refine h _ ?_\n rw [smul_sub, h', sub_self]\n\nnamespace MulAction\nvariable {G \u03b1 \u03b2 : Type*} [Group G] [MulAction G \u03b1] [MulAction G \u03b2]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.snd_mem_orbit_of_mem_orbit (L57-L61)\nlemma snd_mem_orbit_of_mem_orbit {x y : \u03b1 \u00d7 \u03b2} (h : x \u2208 MulAction.orbit M y) :\n x.2 \u2208 MulAction.orbit M y.2 := by\nrcases h with \u27e8g, rfl\u27e9\n exact mem_orbit _ _\n```\n\n-- snippet 38\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.orbitRel_le_fst (L227-L230)\nlemma orbitRel_le_fst :\n orbitRel G (\u03b1 \u00d7 \u03b2) \u2264 (orbitRel G \u03b1).comap Prod.fst :=\nSetoid.le_def.2 fst_mem_orbit_of_mem_orbit\n```\n\n-- snippet 39\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.stabilizerEquivStabilizer_neg (L345-L356)\ntheorem stabilizerEquivStabilizer_neg (hg : b = -g +\u1d65 a) :\n stabilizerEquivStabilizer hg =\n (stabilizerEquivStabilizer (neg_vadd_eq_iff.mp hg.symm)).symm := by\next; simp [stabilizerEquivStabilizer]\n\n/-- A bijection between the stabilizers of two elements in the same orbit. -/\nnoncomputable def stabilizerEquivStabilizerOfOrbitRel (h : orbitRel G \u03b1 a b) :\n stabilizer G a \u2243+ stabilizer G b :=\n (stabilizerEquivStabilizer (Classical.choose_spec h).symm).symm\n\nend AddAction\n```\n\n-- snippet 40\n```lean\n-- Mathlib.GroupTheory.GroupAction.Basic.smul_orbit (L135-L141)\ntheorem smul_orbit (g : G) (a : \u03b1) : g \u2022 orbit G a = orbit G a :=\n(smul_orbit_subset g a).antisymm <|\n calc\n orbit G a = g \u2022 g\u207b\u00b9 \u2022 orbit G a := (smul_inv_smul _ _).symm\n _ \u2286 g \u2022 orbit G a := Set.image_mono (smul_orbit_subset _ _)\n\n/-- The action of a group on an orbit is transitive. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/GroupAction/SubMulAction/Combination.lean", "module": "Mathlib.GroupTheory.GroupAction.SubMulAction.Combination", "declaration": "Mathlib.GroupTheory.GroupAction.SubMulAction.Combination.mulActionHom_compl_bijective", "span": "L203-L213", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/GroupAction/SubMulAction/Combination.lean#L203"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 6278, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 17259, "lean_code_chars": 15734, "natural_language_chars": 1525, "lean_code_ratio": 0.9116, "line_count": 491, "imports_count": 0, "declarations_count": 1611, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "dd5f81ee9f392b90", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.LinearAlgebra.RootSystem.RootPositive.apply_reflection_reflection", "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.LinearAlgebra.RootSystem.RootPositive)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma apply_reflection_reflection (x y : M) :\n B.form (P.reflection i x) (P.reflection i y) = B.form x y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.apply_root_ne_zero (L61-L63)\nlemma apply_root_ne_zero : B.form (P.root i) \u2260 0 :=\nfun contra \u21a6 B.ne_zero i <| by simp [contra]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.two_mul_apply_root_root (L64-L70)\nlemma two_mul_apply_root_root :\n 2 * B.form (P.root i) (P.root j) = P.pairing i j * B.form (P.root j) (P.root j) := by\nrw [two_mul, \u2190 eq_sub_iff_add_eq]\n nth_rw 1 [\u2190 B.isOrthogonal_reflection j]\n rw [reflection_apply, reflection_apply_self, root_coroot'_eq_pairing, LinearMap.map_sub\u2082,\n LinearMap.map_smul\u2082, smul_eq_mul, map_neg, map_neg, mul_neg, neg_sub_neg]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.pairing_mul_eq_pairing_mul_swap (L71-L76)\nlemma pairing_mul_eq_pairing_mul_swap :\n P.pairing j i * B.form (P.root i) (P.root i) =\n P.pairing i j * B.form (P.root j) (P.root j) := by\nrw [\u2190 B.two_mul_apply_root_root i j, \u2190 B.two_mul_apply_root_root j i, \u2190 B.symm.eq,\n RingHom.id_apply]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.apply_root_root_zero_iff (L83-L108)\nlemma apply_root_root_zero_iff [IsDomain R] [NeZero (2 : R)] :\n B.form (P.root i) (P.root j) = 0 \u2194 P.pairing i j = 0 := by\ncalc B.form (P.root i) (P.root j) = 0\n \u2194 2 * B.form (P.root i) (P.root j) = 0 := by simp [two_ne_zero]\n _ \u2194 P.pairing i j * B.form (P.root j) (P.root j) = 0 := by rw [B.two_mul_apply_root_root i j]\n _ \u2194 P.pairing i j = 0 := by simp [B.ne_zero j]\n\nend InvariantForm\n\nvariable (S) in\n/-- Given a root pairing, this is an invariant symmetric bilinear form satisfying a positivity\ncondition. -/\nstructure RootPositiveForm (P : RootPairing \u03b9 R M N) [P.IsValuedIn S] where\n /-- The bilinear form bundled inside a `RootPositiveForm`. -/\n form : LinearMap.BilinForm R M\n symm : form.IsSymm\n isOrthogonal_reflection (i : \u03b9) : form.IsOrthogonal (P.reflection i)\n exists_eq (i j : \u03b9) : \u2203 s, algebraMap S R s = form (P.root i) (P.root j)\n exists_pos_eq (i : \u03b9) : \u2203 s > 0, algebraMap S R s = form (P.root i) (P.root i)\n\nvariable {P : RootPairing \u03b9 R M N} [P.IsValuedIn S] (B : P.RootPositiveForm S) (i j : \u03b9)\n [FaithfulSMul S R] [Module S M] [IsScalarTower S R M]\n\nnamespace RootPositiveForm\n\nomit [Module S M] [IsScalarTower S R M] in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.form_apply_root_ne_zero (L109-L115)\nlemma form_apply_root_ne_zero (i : \u03b9) :\n B.form (P.root i) (P.root i) \u2260 0 := by\nobtain \u27e8s, hs, hs'\u27e9 := B.exists_pos_eq i\n simpa [\u2190 hs'] using hs.ne'\n\n/-- Forgetting the positivity condition, we may regard a `RootPositiveForm` as an `InvariantForm`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.two_mul_apply_root_root (L123-L128)\nlemma two_mul_apply_root_root :\n 2 * B.form (P.root i) (P.root j) = P.pairing i j * B.form (P.root j) (P.root j) :=\nB.toInvariantForm.two_mul_apply_root_root i j\n\n/-- Given a root-positive form associated to a root pairing with coefficients in `R` but taking\nvalues in `S`, this is the associated `S`-bilinear form on the `S`-span of the roots. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.posForm (L129-L141)\ndef posForm :\n LinearMap.BilinForm S (span S (range P.root)) :=\nLinearMap.restrictScalarsRange\u2082 (span S (range P.root)).subtype (span S (range P.root)).subtype\n (Algebra.linearMap S R) (FaithfulSMul.algebraMap_injective S R) B.form\n (fun \u27e8x, hx\u27e9 \u27e8y, hy\u27e9 \u21a6 by\n apply LinearMap.BilinMap.apply_apply_mem_of_mem_span\n (s := range P.root) (t := range P.root)\n (B := (LinearMap.restrictScalars\u2097 S R _ _ _).comp (B.form.restrictScalars S))\n \u00b7 rintro - \u27e8i, rfl\u27e9 - \u27e8j, rfl\u27e9\n simpa using B.exists_eq i j\n \u00b7 simpa\n \u00b7 simpa)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.algebraMap_apply_eq_form_iff (L147-L150)\nlemma algebraMap_apply_eq_form_iff {x y : span S (range P.root)} {s : S} :\n algebraMap S R s = B.form x y \u2194 s = B.posForm x y := by\nsimp [RootPositiveForm.posForm]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.zero_lt_posForm_iff (L151-L156)\nlemma zero_lt_posForm_iff {x y : span S (range P.root)} :\n 0 < B.posForm x y \u2194 \u2203 s > 0, algebraMap S R s = B.form x y := by\nrefine \u27e8fun h \u21a6 \u27e8B.posForm x y, h, by simp\u27e9, fun \u27e8s, h, h'\u27e9 \u21a6 ?_\u27e9\n rw [\u2190 B.algebraMap_posForm] at h'\n rwa [\u2190 FaithfulSMul.algebraMap_injective S R h']\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.zero_lt_posForm_apply_root (L157-L161)\nlemma zero_lt_posForm_apply_root (i : \u03b9)\n (hi : P.root i \u2208 span S (range P.root) := subset_span (mem_range_self i)) :\n0 < B.posForm \u27e8P.root i, hi\u27e9 \u27e8P.root i, hi\u27e9 := by\n simpa only [zero_lt_posForm_iff] using B.exists_pos_eq i\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.isSymm_posForm (L162-L168)\nlemma isSymm_posForm :\n B.posForm.IsSymm where\n eq x y := by\napply FaithfulSMul.algebraMap_injective S R\n simpa using B.symm.eq x y\n\n/-- The length of the `i`-th root w.r.t. a root-positive form taking values in `S`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.rootLength (L169-L171)\ndef rootLength (i : \u03b9) : S :=\nB.posForm (P.rootSpanMem S i) (P.rootSpanMem S i)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.rootLength_pos (L172-L174)\nlemma rootLength_pos (i : \u03b9) : 0 < B.rootLength i := by\nsimpa using B.zero_lt_posForm_apply_root i\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.rootLength_reflectionPerm_self (L176-L179)\nlemma rootLength_reflectionPerm_self (i : \u03b9) :\n B.rootLength (P.reflectionPerm i i) = B.rootLength i := by\nsimp [rootLength, rootSpanMem_reflectionPerm_self]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.pairingIn_mul_eq_pairingIn_mul_swap (L184-L189)\nlemma pairingIn_mul_eq_pairingIn_mul_swap :\n P.pairingIn S j i * B.rootLength i = P.pairingIn S i j * B.rootLength j := by\nsimpa only [\u2190 (algebraMap_injective S R).eq_iff, algebraMap_pairingIn, map_mul,\n B.algebraMap_rootLength] using B.toInvariantForm.pairing_mul_eq_pairing_mul_swap i j\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.toCoweightBasis (L313-L316)\ndef toCoweightBasis :\n Basis b.support R N :=\nBase.toWeightBasis (P := P.flip) b.flip\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.pos_or_neg_of_sum_smul_root_mem (L199-L231)\nlemma pos_or_neg_of_sum_smul_root_mem (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 range P.root) (hf\u2080 : f.support \u2286 b.support) :\n 0 < f \u2228 f < 0 := by\nsuffices \u2200 (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 AddSubmonoid.closure (P.root '' b.support))\n (hf\u2080 : f.support \u2286 b.support) (hf' : f \u2260 0), 0 < f by\n obtain \u27e8k, hk\u27e9 := hf\n have hf' : f \u2260 0 := by rintro rfl; exact P.ne_zero k <| by simp [hk]\n rcases b.root_mem_or_neg_mem k with hk' | hk' <;> rw [hk] at hk'\n \u00b7 left; exact this f hk' hf\u2080 hf'\n \u00b7 right; simpa using this (-f) (by convert hk'; simp) (by simpa only [support_neg]) (by simpa)\n intro f hf hf\u2080 hf'\n let f' : b.support \u2192 \u2124 := fun i \u21a6 f i\n replace hf : \u2211 j, f' j \u2022 P.root j \u2208 AddSubmonoid.closure (P.root '' b.support) := by\n suffices \u2211 j, f' j \u2022 P.root j = \u2211 j \u2208 b.support, f j \u2022 P.root j by rwa [this]\n rw [\u2190 b.support.sum_finset_coe]; rfl\n rw [\u2190 span_nat_eq_addSubmonoidClosure, mem_toAddSubmonoid,\n Fintype.mem_span_image_iff_exists_fun] at hf\n obtain \u27e8c, hc\u27e9 := hf\n replace hc (i : b.support) : c i = f' i := Fintype.linearIndependent_iff\u209b.mp\n (b.linearIndepOn_root.restrict_scalars' \u2124) (Int.ofNat \u2218 c) f' (by simpa) i\n have aux : 0 \u2264 f := by\n intro i\n by_cases hi : i \u2208 b.support\n \u00b7 change 0 \u2264 f' \u27e8i, hi\u27e9\n simp [\u2190 hc]\n \u00b7 replace hi : i \u2209 f.support := by contrapose! hi; exact hf\u2080 hi\n simp_all\n refine Pi.lt_def.mpr \u27e8aux, ?_\u27e9\n by_contra! contra\n replace contra : f = 0 := le_antisymm contra aux\n contradiction\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.chainTopCoeff_eq_of_ne (L286-L297)\nlemma chainTopCoeff_eq_of_ne (hij : i \u2260 j) :\n P.chainTopCoeff i j = -P.pairingIn \u2124 j i := by\nrw [\u2190 chainTopCoeff_sub_chainBotCoeff (b.linearIndependent_pair_of_ne hij)]\n simp\n\nend RootPairing\n\nsection RootSystem\n\nvariable {P : RootPairing \u03b9 R M N} (b : P.Base) [P.IsRootSystem]\n\n/-- A base of a root system yields a basis of the root space. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.height_ne_zero (L392-L411)\nlemma height_ne_zero (i : \u03b9) :\n b.height i \u2260 0 := by\nobtain \u27e8f, hf\u2080, hf\u2081, hf\u2082\u27e9 := b.exists_root_eq_sum_int i\n rw [height_eq_sum hf\u2082]\n rcases hf\u2081 with pos | neg\n \u00b7 refine (Finset.sum_pos' (fun i _ \u21a6 pos.le i) ?_).ne'\n by_contra! contra\n replace contra (j : \u03b9) : f j = 0 := by\n by_cases hj : j \u2208 f.support\n \u00b7 exact le_antisymm (contra j (hf\u2080 hj)) (pos.le j)\n \u00b7 simpa using hj\n exact P.ne_zero i <| by simp [hf\u2082, contra]\n \u00b7 refine (Finset.sum_neg' (fun i _ \u21a6 neg.le i) ?_).ne\n by_contra! contra\n replace contra (j : \u03b9) : f j = 0 := by\n by_cases hj : j \u2208 f.support\n \u00b7 exact le_antisymm (neg.le j) (contra j (hf\u2080 hj))\n \u00b7 simpa using hj\n exact P.ne_zero i <| by simp [hf\u2082, contra]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_int_root_support (L131-L136)\nlemma span_int_root_support :\n span \u2124 (P.root '' b.support) = span \u2124 (range P.root) := by\nrefine le_antisymm (span_mono <| image_subset_range _ _) (span_le.mpr ?_)\n rintro - \u27e8i, rfl\u27e9\n exact b.root_mem_span_int i\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.height (L375-L378)\ndef height (i : \u03b9) : \u2124 :=\n\u2211 j \u2208 b.support, (b.exists_root_eq_sum_int i).choose j\n\nvariable {b} in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.root_ne_neg_of_ne (L101-L109)\nlemma root_ne_neg_of_ne [Nontrivial R] {i j : \u03b9}\n (hi : i \u2208 b.support) (hj : j \u2208 b.support) (hij : i \u2260 j) :\n P.root i \u2260 -P.root j := by\nclassical\n intro contra\n have := linearIndepOn_iff'.mp b.linearIndepOn_root ({i, j} : Finset \u03b9) 1\n (by simp [Set.insert_subset_iff, hi, hj]) (by simp [Finset.sum_pair hij, contra])\n simp_all\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.not_nonpos_iff_pos_of_sum_mem_range_root (L232-L242)\nlemma not_nonpos_iff_pos_of_sum_mem_range_root (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 range P.root) (hf\u2080 : f.support \u2286 b.support) :\n (\u00ac f \u2264 0) \u2194 0 < f := by\nrw [Pi.lt_def]\n refine \u27e8fun h \u21a6 \u27e8?_, ?_\u27e9, fun \u27e8h, \u27e8i, hi\u27e9\u27e9 contra \u21a6 by simp [le_antisymm contra h] at hi\u27e9\n \u00b7 rcases b.pos_or_neg_of_sum_smul_root_mem f hf hf\u2080 with h' | h'\n \u00b7 exact le_of_lt h'\n \u00b7 exfalso\n exact h (le_of_lt h')\n \u00b7 contrapose! h; exact h\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_coroot_support (L148-L152)\nlemma span_coroot_support :\n span R (P.coroot '' b.support) = P.corootSpan R :=\nb.flip.span_root_support\n\nopen Finsupp in\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.not_nonneg_iff_neg_of_sum_mem_range_root (L243-L250)\nlemma not_nonneg_iff_neg_of_sum_mem_range_root (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 range P.root) (hf\u2080 : f.support \u2286 b.support) :\n (\u00ac 0 \u2264 f) \u2194 f < 0 := by\nreplace hf : \u2211 j \u2208 b.support, (-f) j \u2022 P.root j \u2208 range P.root := by\n rw [\u2190 neg_mem_range_root_iff]; simpa\n have := b.not_nonpos_iff_pos_of_sum_mem_range_root (-f) hf (by simpa)\n simp_all\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.toWeightBasis (L298-L303)\ndef toWeightBasis :\n Basis b.support R M :=\nBasis.mk b.linearIndepOn_root <| by\n change \u22a4 \u2264 span R (range <| P.root \u2218 ((\u2191) : b.support \u2192 \u03b9))\n simp [range_comp]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.support_nonempty (L86-L91)\nlemma support_nonempty [Nonempty \u03b9] [NeZero (2 : R)] : b.support.Nonempty := by\nby_contra! contra\n inhabit \u03b9\n simpa [P.ne_zero default, contra] using b.root_mem_or_neg_mem default\n\n/-- Interchanging roots and coroots, one still has a base of a root pairing. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.coroot_mem_span_int (L126-L129)\nlemma coroot_mem_span_int (i : \u03b9) :\n P.coroot i \u2208 span \u2124 (P.coroot '' b.support) :=\nb.flip.root_mem_span_int i\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_int_coroot_support (L138-L141)\nlemma span_int_coroot_support :\n span \u2124 (P.coroot '' b.support) = span \u2124 (range P.coroot) :=\nb.flip.span_int_root_support\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.pairingIn_le_zero_of_ne (L273-L281)\nlemma pairingIn_le_zero_of_ne [IsDomain R] [P.IsCrystallographic] [Finite \u03b9]\n {i j} (hij : i \u2260 j) (hi : i \u2208 b.support) (hj : j \u2208 b.support) :\n P.pairingIn \u2124 i j \u2264 0 := by\nby_contra! h\n exact b.sub_notMem_range_root hi hj <| P.root_sub_root_mem_of_pairingIn_pos h hij\n\nvariable {b}\nvariable [IsDomain R] [P.IsCrystallographic] [Finite \u03b9] {i j : b.support}\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.eq_one_or_neg_one_of_mem_support_of_smul_mem_aux (L153-L179)\nlemma eq_one_or_neg_one_of_mem_support_of_smul_mem_aux [Finite \u03b9]\n [IsAddTorsionFree M] [IsAddTorsionFree N]\n (i : \u03b9) (h : i \u2208 b.support) (t : R) (ht : t \u2022 P.root i \u2208 range P.root) :\n \u2203 z : \u2124, z * t = 1 := by\nclassical\n obtain \u27e8j, hj\u27e9 := ht\n obtain \u27e8f, hf\u27e9 : \u2203 f : b.support \u2192 \u2124, P.coroot i = \u2211 i, (t * f i) \u2022 P.coroot i := by\n have : P.coroot j \u2208 span \u2124 (P.coroot '' b.support) := b.coroot_mem_span_int j\n rw [image_eq_range, mem_span_range_iff_exists_fun] at this\n refine this.imp fun f hf \u21a6 ?_\n simp only [Finset.coe_sort_coe] at hf\n simp_rw [mul_smul, \u2190 Finset.smul_sum, Int.cast_smul_eq_zsmul, hf,\n coroot_eq_smul_coroot_iff.mpr hj]\n use f \u27e8i, h\u27e9\n replace hf : P.coroot i = linearCombination R (fun k : b.support \u21a6 P.coroot k)\n (t \u2022 (linearEquivFunOnFinite R _ _).symm (fun x \u21a6 (f x : R))) := by\n rw [map_smul, linearCombination_eq_fintype_linearCombination_apply,\n Fintype.linearCombination_apply, hf]\n simp_rw [mul_smul, \u2190 Finset.smul_sum]\n let g : b.support \u2192\u2080 R := single \u27e8i, h\u27e9 1\n have hg : P.coroot i = linearCombination R (fun k : b.support \u21a6 P.coroot k) g := by simp [g]\n rw [hg] at hf\n have : Injective (linearCombination R fun k : b.support \u21a6 P.coroot k) := b.linearIndepOn_coroot\n simpa [g, linearEquivFunOnFinite, mul_comm t] using (DFunLike.congr_fun (this hf) \u27e8i, h\u27e9).symm\n\nvariable [CharZero R]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_root_support (L143-L146)\nlemma span_root_support :\n span R (P.root '' b.support) = P.rootSpan R := by\nrw [\u2190 span_span_of_tower (R := \u2124), span_int_root_support, span_span_of_tower]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.sub_notMem_range_root (L251-L267)\nlemma sub_notMem_range_root\n {i j : \u03b9} (hi : i \u2208 b.support) (hj : j \u2208 b.support) :\n P.root i - P.root j \u2209 range P.root := by\nrcases eq_or_ne j i with rfl | hij\n \u00b7 simpa only [sub_self, mem_range, not_exists] using fun k \u21a6 P.ne_zero k\n classical\n let f : \u03b9 \u2192 \u2124 := fun k \u21a6 if k = i then 1 else if k = j then -1 else 0\n have hf : \u2211 k \u2208 b.support, f k \u2022 P.root k = P.root i - P.root j := by\n have : {i, j} \u2286 b.support := by aesop (add simp Finset.insert_subset_iff)\n rw [\u2190 Finset.sum_subset (s\u2081 := {i, j}) (s\u2082 := b.support) (by lia) (by aesop),\n Finset.sum_insert (by grind), Finset.sum_singleton]\n simp [f, hij, sub_eq_add_neg]\n intro contra\n rcases b.pos_or_neg_of_sum_smul_root_mem f (by rwa [hf]) (by aesop) with pos | neg\n \u00b7 simpa [hij, f] using le_of_lt pos j\n \u00b7 simpa [hij, f] using le_of_lt neg i\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.exists_root_eq_sum_int (L355-L374)\nlemma exists_root_eq_sum_int [CharZero R] (i : \u03b9) :\n \u2203 f : \u03b9 \u2192 \u2124, f.support \u2286 b.support \u2227 (0 < f \u2228 f < 0) \u2227\n P.root i = \u2211 j \u2208 b.support, f j \u2022 P.root j := by\nobtain \u27e8f, hf, hf' | hf'\u27e9 := b.exists_root_eq_sum_nat_or_neg i\n \u00b7 refine \u27e8Nat.cast \u2218 f, by simpa, Or.inl <| Pi.lt_def.mpr \u27e8fun _ \u21a6 by simp, ?_\u27e9, by simp [hf']\u27e9\n by_contra! contra\n replace contra : f = 0 := by ext i; simpa using contra i\n exact P.ne_zero i <| by simp [hf', contra]\n \u00b7 refine \u27e8-Nat.cast \u2218 f, by simpa, Or.inr <| Pi.lt_def.mpr \u27e8fun _ \u21a6 by simp, ?_\u27e9, by simp [hf']\u27e9\n by_contra! contra\n replace contra : f = 0 := by ext i; simpa using contra i\n exact P.ne_zero i <| by simp [hf', contra]\n\nend RootPairing\n\nsection PositiveRoots\n\nvariable {P : RootPairing \u03b9 R M N} (b : P.Base) [CharZero R]\n\n/-- Given a base `\u03b1\u2081, \u03b1\u2082, \u2026`, the height of a root `\u2211 z\u1d62\u03b1\u1d62` relative to this base is `\u2211 z\u1d62`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.eq_one_or_neg_one_of_mem_support_of_smul_mem (L180-L198)\nlemma eq_one_or_neg_one_of_mem_support_of_smul_mem [Finite \u03b9]\n [IsAddTorsionFree M] [IsAddTorsionFree N]\n (i : \u03b9) (h : i \u2208 b.support) (t : R) (ht : t \u2022 P.root i \u2208 range P.root) :\n t = 1 \u2228 t = -1 := by\nobtain \u27e8z, hz\u27e9 := b.eq_one_or_neg_one_of_mem_support_of_smul_mem_aux i h t ht\n replace ht : (z : R) \u2022 P.coroot i \u2208 range P.coroot := by\n obtain \u27e8j, hj\u27e9 := ht\n simpa only [coroot_eq_smul_coroot_iff.mpr hj, smul_smul, hz, one_smul] using mem_range_self j\n obtain \u27e8w, hw\u27e9 := b.flip.eq_one_or_neg_one_of_mem_support_of_smul_mem_aux i h _ ht\n have : (z : R) * w = 1 := by\n simpa [mul_mul_mul_comm _ t, mul_comm t, mul_comm _ (z : R), hz] using congr_arg\u2082 (\u00b7 * \u00b7) hz hw\n suffices z = 1 \u2228 z = -1 by\n rcases this with rfl | rfl\n \u00b7 left; simpa using hz\n \u00b7 right; simpa [neg_eq_iff_eq_neg] using hz\n norm_cast at this\n rw [Int.mul_eq_one_iff_eq_one_or_neg_one] at this\n tauto\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.root_mem_span_int (L116-L125)\nlemma root_mem_span_int (i : \u03b9) :\n P.root i \u2208 span \u2124 (P.root '' b.support) := by\nhave := b.root_mem_or_neg_mem i\n simp only [\u2190 span_nat_eq_addSubmonoidClosure, mem_toAddSubmonoid] at this\n rw [\u2190 span_span_of_tower (R := \u2115)]\n rcases this with hi | hi\n \u00b7 exact subset_span hi\n \u00b7 rw [\u2190 neg_mem_iff]\n exact subset_span hi\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.sub_notMem_range_coroot (L268-L272)\nlemma sub_notMem_range_coroot\n {i j : \u03b9} (hi : i \u2208 b.support) (hj : j \u2208 b.support) :\n P.coroot i - P.coroot j \u2209 range P.coroot :=\nb.flip.sub_notMem_range_root hi hj\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.height_eq_sum (L379-L391)\nlemma height_eq_sum {i : \u03b9} {f : \u03b9 \u2192 \u2124} (heq : P.root i = \u2211 j \u2208 b.support, f j \u2022 P.root j) :\n b.height i = \u2211 j \u2208 b.support, f j := by\nsuffices \u2200 j \u2208 b.support, (b.exists_root_eq_sum_int i).choose j = f j from\n Finset.sum_congr rfl this\n intro j hj\n obtain \u27e8-, -, h\u27e9 := (b.exists_root_eq_sum_int i).choose_spec\n rw [h, b.support.sum_subtype (p := (\u00b7 \u2208 b.support)) (by simp) (F := inferInstance),\n b.support.sum_subtype (p := (\u00b7 \u2208 b.support)) (by simp) (F := inferInstance)] at heq\n have aux (j : b.support) := Fintype.linearIndependent_iff\u209b.mp\n (b.linearIndepOn_root.restrict_scalars' \u2124) ((b.exists_root_eq_sum_int i).choose \u2218 (\u2191))\n (f \u2218 (\u2191)) (by simpa) j\n simpa using aux \u27e8j, hj\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.exists_root_eq_sum_nat_or_neg (L334-L354)\nlemma exists_root_eq_sum_nat_or_neg (i : \u03b9) :\n \u2203 f : \u03b9 \u2192 \u2115, f.support \u2286 b.support \u2227\n (P.root i = \u2211 j \u2208 b.support, f j \u2022 P.root j \u2228\n P.root i = - \u2211 j \u2208 b.support, f j \u2022 P.root j) := by\nclassical\n simp_rw [\u2190 neg_eq_iff_eq_neg]\n suffices \u2200 m \u2208 AddSubmonoid.closure (P.root '' b.support),\n \u2203 f : \u03b9 \u2192 \u2115, f.support \u2286 b.support \u2227 m = \u2211 j \u2208 b.support, f j \u2022 P.root j by\n rcases b.root_mem_or_neg_mem i with hi | hi\n \u00b7 obtain \u27e8f, hf, hf'\u27e9 := this _ hi\n exact \u27e8f, hf, Or.inl hf'\u27e9\n \u00b7 obtain \u27e8f, hf, hf'\u27e9 := this _ hi\n exact \u27e8f, hf, Or.inr hf'\u27e9\n intro m hm\n refine AddSubmonoid.closure_induction ?_ \u27e80, by simp\u27e9 ?_ hm\n \u00b7 rintro - \u27e8j, hj, rfl\u27e9\n exact \u27e8Pi.single j 1, by simpa, by aesop (add simp Pi.single_apply)\u27e9\n \u00b7 intro _ _ _ _ \u27e8f, hf, hf'\u27e9 \u27e8g, hg, hg'\u27e9\n refine \u27e8f + g, ?_, by simp [hf', hg', add_smul, Finset.sum_add_distrib]\u27e9\n exact (support_add f g).trans <| union_subset_iff.mpr \u27e8hf, hg\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.linearIndependent_pair_of_ne (L110-L115)\nlemma linearIndependent_pair_of_ne {i j : b.support} (hij : i \u2260 j) :\n LinearIndependent R ![P.root i, P.root j] := by\nhave : ({(j : \u03b9), (i : \u03b9)} : Set \u03b9) \u2286 b.support := by simp [pair_subset_iff]\n rw [\u2190 linearIndepOn_id_range_iff (by simp_all)]\n simpa [image_pair] using LinearIndepOn.id_image <| b.linearIndepOn_root.mono this\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.LinearAlgebra.RootSystem.RootPositive).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma apply_reflection_reflection (x y : M) :\n B.form (P.reflection i x) (P.reflection i y) = B.form x y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.apply_root_ne_zero (L61-L63)\nlemma apply_root_ne_zero : B.form (P.root i) \u2260 0 :=\nfun contra \u21a6 B.ne_zero i <| by simp [contra]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.two_mul_apply_root_root (L64-L70)\nlemma two_mul_apply_root_root :\n 2 * B.form (P.root i) (P.root j) = P.pairing i j * B.form (P.root j) (P.root j) := by\nrw [two_mul, \u2190 eq_sub_iff_add_eq]\n nth_rw 1 [\u2190 B.isOrthogonal_reflection j]\n rw [reflection_apply, reflection_apply_self, root_coroot'_eq_pairing, LinearMap.map_sub\u2082,\n LinearMap.map_smul\u2082, smul_eq_mul, map_neg, map_neg, mul_neg, neg_sub_neg]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.pairing_mul_eq_pairing_mul_swap (L71-L76)\nlemma pairing_mul_eq_pairing_mul_swap :\n P.pairing j i * B.form (P.root i) (P.root i) =\n P.pairing i j * B.form (P.root j) (P.root j) := by\nrw [\u2190 B.two_mul_apply_root_root i j, \u2190 B.two_mul_apply_root_root j i, \u2190 B.symm.eq,\n RingHom.id_apply]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.apply_root_root_zero_iff (L83-L108)\nlemma apply_root_root_zero_iff [IsDomain R] [NeZero (2 : R)] :\n B.form (P.root i) (P.root j) = 0 \u2194 P.pairing i j = 0 := by\ncalc B.form (P.root i) (P.root j) = 0\n \u2194 2 * B.form (P.root i) (P.root j) = 0 := by simp [two_ne_zero]\n _ \u2194 P.pairing i j * B.form (P.root j) (P.root j) = 0 := by rw [B.two_mul_apply_root_root i j]\n _ \u2194 P.pairing i j = 0 := by simp [B.ne_zero j]\n\nend InvariantForm\n\nvariable (S) in\n/-- Given a root pairing, this is an invariant symmetric bilinear form satisfying a positivity\ncondition. -/\nstructure RootPositiveForm (P : RootPairing \u03b9 R M N) [P.IsValuedIn S] where\n /-- The bilinear form bundled inside a `RootPositiveForm`. -/\n form : LinearMap.BilinForm R M\n symm : form.IsSymm\n isOrthogonal_reflection (i : \u03b9) : form.IsOrthogonal (P.reflection i)\n exists_eq (i j : \u03b9) : \u2203 s, algebraMap S R s = form (P.root i) (P.root j)\n exists_pos_eq (i : \u03b9) : \u2203 s > 0, algebraMap S R s = form (P.root i) (P.root i)\n\nvariable {P : RootPairing \u03b9 R M N} [P.IsValuedIn S] (B : P.RootPositiveForm S) (i j : \u03b9)\n [FaithfulSMul S R] [Module S M] [IsScalarTower S R M]\n\nnamespace RootPositiveForm\n\nomit [Module S M] [IsScalarTower S R M] in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.form_apply_root_ne_zero (L109-L115)\nlemma form_apply_root_ne_zero (i : \u03b9) :\n B.form (P.root i) (P.root i) \u2260 0 := by\nobtain \u27e8s, hs, hs'\u27e9 := B.exists_pos_eq i\n simpa [\u2190 hs'] using hs.ne'\n\n/-- Forgetting the positivity condition, we may regard a `RootPositiveForm` as an `InvariantForm`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.two_mul_apply_root_root (L123-L128)\nlemma two_mul_apply_root_root :\n 2 * B.form (P.root i) (P.root j) = P.pairing i j * B.form (P.root j) (P.root j) :=\nB.toInvariantForm.two_mul_apply_root_root i j\n\n/-- Given a root-positive form associated to a root pairing with coefficients in `R` but taking\nvalues in `S`, this is the associated `S`-bilinear form on the `S`-span of the roots. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.posForm (L129-L141)\ndef posForm :\n LinearMap.BilinForm S (span S (range P.root)) :=\nLinearMap.restrictScalarsRange\u2082 (span S (range P.root)).subtype (span S (range P.root)).subtype\n (Algebra.linearMap S R) (FaithfulSMul.algebraMap_injective S R) B.form\n (fun \u27e8x, hx\u27e9 \u27e8y, hy\u27e9 \u21a6 by\n apply LinearMap.BilinMap.apply_apply_mem_of_mem_span\n (s := range P.root) (t := range P.root)\n (B := (LinearMap.restrictScalars\u2097 S R _ _ _).comp (B.form.restrictScalars S))\n \u00b7 rintro - \u27e8i, rfl\u27e9 - \u27e8j, rfl\u27e9\n simpa using B.exists_eq i j\n \u00b7 simpa\n \u00b7 simpa)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.algebraMap_apply_eq_form_iff (L147-L150)\nlemma algebraMap_apply_eq_form_iff {x y : span S (range P.root)} {s : S} :\n algebraMap S R s = B.form x y \u2194 s = B.posForm x y := by\nsimp [RootPositiveForm.posForm]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.zero_lt_posForm_iff (L151-L156)\nlemma zero_lt_posForm_iff {x y : span S (range P.root)} :\n 0 < B.posForm x y \u2194 \u2203 s > 0, algebraMap S R s = B.form x y := by\nrefine \u27e8fun h \u21a6 \u27e8B.posForm x y, h, by simp\u27e9, fun \u27e8s, h, h'\u27e9 \u21a6 ?_\u27e9\n rw [\u2190 B.algebraMap_posForm] at h'\n rwa [\u2190 FaithfulSMul.algebraMap_injective S R h']\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.zero_lt_posForm_apply_root (L157-L161)\nlemma zero_lt_posForm_apply_root (i : \u03b9)\n (hi : P.root i \u2208 span S (range P.root) := subset_span (mem_range_self i)) :\n0 < B.posForm \u27e8P.root i, hi\u27e9 \u27e8P.root i, hi\u27e9 := by\n simpa only [zero_lt_posForm_iff] using B.exists_pos_eq i\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.isSymm_posForm (L162-L168)\nlemma isSymm_posForm :\n B.posForm.IsSymm where\n eq x y := by\napply FaithfulSMul.algebraMap_injective S R\n simpa using B.symm.eq x y\n\n/-- The length of the `i`-th root w.r.t. a root-positive form taking values in `S`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.rootLength (L169-L171)\ndef rootLength (i : \u03b9) : S :=\nB.posForm (P.rootSpanMem S i) (P.rootSpanMem S i)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.rootLength_pos (L172-L174)\nlemma rootLength_pos (i : \u03b9) : 0 < B.rootLength i := by\nsimpa using B.zero_lt_posForm_apply_root i\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.rootLength_reflectionPerm_self (L176-L179)\nlemma rootLength_reflectionPerm_self (i : \u03b9) :\n B.rootLength (P.reflectionPerm i i) = B.rootLength i := by\nsimp [rootLength, rootSpanMem_reflectionPerm_self]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.RootPositive.pairingIn_mul_eq_pairingIn_mul_swap (L184-L189)\nlemma pairingIn_mul_eq_pairingIn_mul_swap :\n P.pairingIn S j i * B.rootLength i = P.pairingIn S i j * B.rootLength j := by\nsimpa only [\u2190 (algebraMap_injective S R).eq_iff, algebraMap_pairingIn, map_mul,\n B.algebraMap_rootLength] using B.toInvariantForm.pairing_mul_eq_pairing_mul_swap i j\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.toCoweightBasis (L313-L316)\ndef toCoweightBasis :\n Basis b.support R N :=\nBase.toWeightBasis (P := P.flip) b.flip\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.pos_or_neg_of_sum_smul_root_mem (L199-L231)\nlemma pos_or_neg_of_sum_smul_root_mem (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 range P.root) (hf\u2080 : f.support \u2286 b.support) :\n 0 < f \u2228 f < 0 := by\nsuffices \u2200 (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 AddSubmonoid.closure (P.root '' b.support))\n (hf\u2080 : f.support \u2286 b.support) (hf' : f \u2260 0), 0 < f by\n obtain \u27e8k, hk\u27e9 := hf\n have hf' : f \u2260 0 := by rintro rfl; exact P.ne_zero k <| by simp [hk]\n rcases b.root_mem_or_neg_mem k with hk' | hk' <;> rw [hk] at hk'\n \u00b7 left; exact this f hk' hf\u2080 hf'\n \u00b7 right; simpa using this (-f) (by convert hk'; simp) (by simpa only [support_neg]) (by simpa)\n intro f hf hf\u2080 hf'\n let f' : b.support \u2192 \u2124 := fun i \u21a6 f i\n replace hf : \u2211 j, f' j \u2022 P.root j \u2208 AddSubmonoid.closure (P.root '' b.support) := by\n suffices \u2211 j, f' j \u2022 P.root j = \u2211 j \u2208 b.support, f j \u2022 P.root j by rwa [this]\n rw [\u2190 b.support.sum_finset_coe]; rfl\n rw [\u2190 span_nat_eq_addSubmonoidClosure, mem_toAddSubmonoid,\n Fintype.mem_span_image_iff_exists_fun] at hf\n obtain \u27e8c, hc\u27e9 := hf\n replace hc (i : b.support) : c i = f' i := Fintype.linearIndependent_iff\u209b.mp\n (b.linearIndepOn_root.restrict_scalars' \u2124) (Int.ofNat \u2218 c) f' (by simpa) i\n have aux : 0 \u2264 f := by\n intro i\n by_cases hi : i \u2208 b.support\n \u00b7 change 0 \u2264 f' \u27e8i, hi\u27e9\n simp [\u2190 hc]\n \u00b7 replace hi : i \u2209 f.support := by contrapose! hi; exact hf\u2080 hi\n simp_all\n refine Pi.lt_def.mpr \u27e8aux, ?_\u27e9\n by_contra! contra\n replace contra : f = 0 := le_antisymm contra aux\n contradiction\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.chainTopCoeff_eq_of_ne (L286-L297)\nlemma chainTopCoeff_eq_of_ne (hij : i \u2260 j) :\n P.chainTopCoeff i j = -P.pairingIn \u2124 j i := by\nrw [\u2190 chainTopCoeff_sub_chainBotCoeff (b.linearIndependent_pair_of_ne hij)]\n simp\n\nend RootPairing\n\nsection RootSystem\n\nvariable {P : RootPairing \u03b9 R M N} (b : P.Base) [P.IsRootSystem]\n\n/-- A base of a root system yields a basis of the root space. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.height_ne_zero (L392-L411)\nlemma height_ne_zero (i : \u03b9) :\n b.height i \u2260 0 := by\nobtain \u27e8f, hf\u2080, hf\u2081, hf\u2082\u27e9 := b.exists_root_eq_sum_int i\n rw [height_eq_sum hf\u2082]\n rcases hf\u2081 with pos | neg\n \u00b7 refine (Finset.sum_pos' (fun i _ \u21a6 pos.le i) ?_).ne'\n by_contra! contra\n replace contra (j : \u03b9) : f j = 0 := by\n by_cases hj : j \u2208 f.support\n \u00b7 exact le_antisymm (contra j (hf\u2080 hj)) (pos.le j)\n \u00b7 simpa using hj\n exact P.ne_zero i <| by simp [hf\u2082, contra]\n \u00b7 refine (Finset.sum_neg' (fun i _ \u21a6 neg.le i) ?_).ne\n by_contra! contra\n replace contra (j : \u03b9) : f j = 0 := by\n by_cases hj : j \u2208 f.support\n \u00b7 exact le_antisymm (neg.le j) (contra j (hf\u2080 hj))\n \u00b7 simpa using hj\n exact P.ne_zero i <| by simp [hf\u2082, contra]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_int_root_support (L131-L136)\nlemma span_int_root_support :\n span \u2124 (P.root '' b.support) = span \u2124 (range P.root) := by\nrefine le_antisymm (span_mono <| image_subset_range _ _) (span_le.mpr ?_)\n rintro - \u27e8i, rfl\u27e9\n exact b.root_mem_span_int i\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.height (L375-L378)\ndef height (i : \u03b9) : \u2124 :=\n\u2211 j \u2208 b.support, (b.exists_root_eq_sum_int i).choose j\n\nvariable {b} in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.root_ne_neg_of_ne (L101-L109)\nlemma root_ne_neg_of_ne [Nontrivial R] {i j : \u03b9}\n (hi : i \u2208 b.support) (hj : j \u2208 b.support) (hij : i \u2260 j) :\n P.root i \u2260 -P.root j := by\nclassical\n intro contra\n have := linearIndepOn_iff'.mp b.linearIndepOn_root ({i, j} : Finset \u03b9) 1\n (by simp [Set.insert_subset_iff, hi, hj]) (by simp [Finset.sum_pair hij, contra])\n simp_all\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.not_nonpos_iff_pos_of_sum_mem_range_root (L232-L242)\nlemma not_nonpos_iff_pos_of_sum_mem_range_root (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 range P.root) (hf\u2080 : f.support \u2286 b.support) :\n (\u00ac f \u2264 0) \u2194 0 < f := by\nrw [Pi.lt_def]\n refine \u27e8fun h \u21a6 \u27e8?_, ?_\u27e9, fun \u27e8h, \u27e8i, hi\u27e9\u27e9 contra \u21a6 by simp [le_antisymm contra h] at hi\u27e9\n \u00b7 rcases b.pos_or_neg_of_sum_smul_root_mem f hf hf\u2080 with h' | h'\n \u00b7 exact le_of_lt h'\n \u00b7 exfalso\n exact h (le_of_lt h')\n \u00b7 contrapose! h; exact h\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_coroot_support (L148-L152)\nlemma span_coroot_support :\n span R (P.coroot '' b.support) = P.corootSpan R :=\nb.flip.span_root_support\n\nopen Finsupp in\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.not_nonneg_iff_neg_of_sum_mem_range_root (L243-L250)\nlemma not_nonneg_iff_neg_of_sum_mem_range_root (f : \u03b9 \u2192 \u2124)\n (hf : \u2211 j \u2208 b.support, f j \u2022 P.root j \u2208 range P.root) (hf\u2080 : f.support \u2286 b.support) :\n (\u00ac 0 \u2264 f) \u2194 f < 0 := by\nreplace hf : \u2211 j \u2208 b.support, (-f) j \u2022 P.root j \u2208 range P.root := by\n rw [\u2190 neg_mem_range_root_iff]; simpa\n have := b.not_nonpos_iff_pos_of_sum_mem_range_root (-f) hf (by simpa)\n simp_all\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.toWeightBasis (L298-L303)\ndef toWeightBasis :\n Basis b.support R M :=\nBasis.mk b.linearIndepOn_root <| by\n change \u22a4 \u2264 span R (range <| P.root \u2218 ((\u2191) : b.support \u2192 \u03b9))\n simp [range_comp]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.support_nonempty (L86-L91)\nlemma support_nonempty [Nonempty \u03b9] [NeZero (2 : R)] : b.support.Nonempty := by\nby_contra! contra\n inhabit \u03b9\n simpa [P.ne_zero default, contra] using b.root_mem_or_neg_mem default\n\n/-- Interchanging roots and coroots, one still has a base of a root pairing. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.coroot_mem_span_int (L126-L129)\nlemma coroot_mem_span_int (i : \u03b9) :\n P.coroot i \u2208 span \u2124 (P.coroot '' b.support) :=\nb.flip.root_mem_span_int i\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_int_coroot_support (L138-L141)\nlemma span_int_coroot_support :\n span \u2124 (P.coroot '' b.support) = span \u2124 (range P.coroot) :=\nb.flip.span_int_root_support\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.pairingIn_le_zero_of_ne (L273-L281)\nlemma pairingIn_le_zero_of_ne [IsDomain R] [P.IsCrystallographic] [Finite \u03b9]\n {i j} (hij : i \u2260 j) (hi : i \u2208 b.support) (hj : j \u2208 b.support) :\n P.pairingIn \u2124 i j \u2264 0 := by\nby_contra! h\n exact b.sub_notMem_range_root hi hj <| P.root_sub_root_mem_of_pairingIn_pos h hij\n\nvariable {b}\nvariable [IsDomain R] [P.IsCrystallographic] [Finite \u03b9] {i j : b.support}\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.eq_one_or_neg_one_of_mem_support_of_smul_mem_aux (L153-L179)\nlemma eq_one_or_neg_one_of_mem_support_of_smul_mem_aux [Finite \u03b9]\n [IsAddTorsionFree M] [IsAddTorsionFree N]\n (i : \u03b9) (h : i \u2208 b.support) (t : R) (ht : t \u2022 P.root i \u2208 range P.root) :\n \u2203 z : \u2124, z * t = 1 := by\nclassical\n obtain \u27e8j, hj\u27e9 := ht\n obtain \u27e8f, hf\u27e9 : \u2203 f : b.support \u2192 \u2124, P.coroot i = \u2211 i, (t * f i) \u2022 P.coroot i := by\n have : P.coroot j \u2208 span \u2124 (P.coroot '' b.support) := b.coroot_mem_span_int j\n rw [image_eq_range, mem_span_range_iff_exists_fun] at this\n refine this.imp fun f hf \u21a6 ?_\n simp only [Finset.coe_sort_coe] at hf\n simp_rw [mul_smul, \u2190 Finset.smul_sum, Int.cast_smul_eq_zsmul, hf,\n coroot_eq_smul_coroot_iff.mpr hj]\n use f \u27e8i, h\u27e9\n replace hf : P.coroot i = linearCombination R (fun k : b.support \u21a6 P.coroot k)\n (t \u2022 (linearEquivFunOnFinite R _ _).symm (fun x \u21a6 (f x : R))) := by\n rw [map_smul, linearCombination_eq_fintype_linearCombination_apply,\n Fintype.linearCombination_apply, hf]\n simp_rw [mul_smul, \u2190 Finset.smul_sum]\n let g : b.support \u2192\u2080 R := single \u27e8i, h\u27e9 1\n have hg : P.coroot i = linearCombination R (fun k : b.support \u21a6 P.coroot k) g := by simp [g]\n rw [hg] at hf\n have : Injective (linearCombination R fun k : b.support \u21a6 P.coroot k) := b.linearIndepOn_coroot\n simpa [g, linearEquivFunOnFinite, mul_comm t] using (DFunLike.congr_fun (this hf) \u27e8i, h\u27e9).symm\n\nvariable [CharZero R]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.span_root_support (L143-L146)\nlemma span_root_support :\n span R (P.root '' b.support) = P.rootSpan R := by\nrw [\u2190 span_span_of_tower (R := \u2124), span_int_root_support, span_span_of_tower]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.sub_notMem_range_root (L251-L267)\nlemma sub_notMem_range_root\n {i j : \u03b9} (hi : i \u2208 b.support) (hj : j \u2208 b.support) :\n P.root i - P.root j \u2209 range P.root := by\nrcases eq_or_ne j i with rfl | hij\n \u00b7 simpa only [sub_self, mem_range, not_exists] using fun k \u21a6 P.ne_zero k\n classical\n let f : \u03b9 \u2192 \u2124 := fun k \u21a6 if k = i then 1 else if k = j then -1 else 0\n have hf : \u2211 k \u2208 b.support, f k \u2022 P.root k = P.root i - P.root j := by\n have : {i, j} \u2286 b.support := by aesop (add simp Finset.insert_subset_iff)\n rw [\u2190 Finset.sum_subset (s\u2081 := {i, j}) (s\u2082 := b.support) (by lia) (by aesop),\n Finset.sum_insert (by grind), Finset.sum_singleton]\n simp [f, hij, sub_eq_add_neg]\n intro contra\n rcases b.pos_or_neg_of_sum_smul_root_mem f (by rwa [hf]) (by aesop) with pos | neg\n \u00b7 simpa [hij, f] using le_of_lt pos j\n \u00b7 simpa [hij, f] using le_of_lt neg i\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.exists_root_eq_sum_int (L355-L374)\nlemma exists_root_eq_sum_int [CharZero R] (i : \u03b9) :\n \u2203 f : \u03b9 \u2192 \u2124, f.support \u2286 b.support \u2227 (0 < f \u2228 f < 0) \u2227\n P.root i = \u2211 j \u2208 b.support, f j \u2022 P.root j := by\nobtain \u27e8f, hf, hf' | hf'\u27e9 := b.exists_root_eq_sum_nat_or_neg i\n \u00b7 refine \u27e8Nat.cast \u2218 f, by simpa, Or.inl <| Pi.lt_def.mpr \u27e8fun _ \u21a6 by simp, ?_\u27e9, by simp [hf']\u27e9\n by_contra! contra\n replace contra : f = 0 := by ext i; simpa using contra i\n exact P.ne_zero i <| by simp [hf', contra]\n \u00b7 refine \u27e8-Nat.cast \u2218 f, by simpa, Or.inr <| Pi.lt_def.mpr \u27e8fun _ \u21a6 by simp, ?_\u27e9, by simp [hf']\u27e9\n by_contra! contra\n replace contra : f = 0 := by ext i; simpa using contra i\n exact P.ne_zero i <| by simp [hf', contra]\n\nend RootPairing\n\nsection PositiveRoots\n\nvariable {P : RootPairing \u03b9 R M N} (b : P.Base) [CharZero R]\n\n/-- Given a base `\u03b1\u2081, \u03b1\u2082, \u2026`, the height of a root `\u2211 z\u1d62\u03b1\u1d62` relative to this base is `\u2211 z\u1d62`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.eq_one_or_neg_one_of_mem_support_of_smul_mem (L180-L198)\nlemma eq_one_or_neg_one_of_mem_support_of_smul_mem [Finite \u03b9]\n [IsAddTorsionFree M] [IsAddTorsionFree N]\n (i : \u03b9) (h : i \u2208 b.support) (t : R) (ht : t \u2022 P.root i \u2208 range P.root) :\n t = 1 \u2228 t = -1 := by\nobtain \u27e8z, hz\u27e9 := b.eq_one_or_neg_one_of_mem_support_of_smul_mem_aux i h t ht\n replace ht : (z : R) \u2022 P.coroot i \u2208 range P.coroot := by\n obtain \u27e8j, hj\u27e9 := ht\n simpa only [coroot_eq_smul_coroot_iff.mpr hj, smul_smul, hz, one_smul] using mem_range_self j\n obtain \u27e8w, hw\u27e9 := b.flip.eq_one_or_neg_one_of_mem_support_of_smul_mem_aux i h _ ht\n have : (z : R) * w = 1 := by\n simpa [mul_mul_mul_comm _ t, mul_comm t, mul_comm _ (z : R), hz] using congr_arg\u2082 (\u00b7 * \u00b7) hz hw\n suffices z = 1 \u2228 z = -1 by\n rcases this with rfl | rfl\n \u00b7 left; simpa using hz\n \u00b7 right; simpa [neg_eq_iff_eq_neg] using hz\n norm_cast at this\n rw [Int.mul_eq_one_iff_eq_one_or_neg_one] at this\n tauto\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.root_mem_span_int (L116-L125)\nlemma root_mem_span_int (i : \u03b9) :\n P.root i \u2208 span \u2124 (P.root '' b.support) := by\nhave := b.root_mem_or_neg_mem i\n simp only [\u2190 span_nat_eq_addSubmonoidClosure, mem_toAddSubmonoid] at this\n rw [\u2190 span_span_of_tower (R := \u2115)]\n rcases this with hi | hi\n \u00b7 exact subset_span hi\n \u00b7 rw [\u2190 neg_mem_iff]\n exact subset_span hi\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.sub_notMem_range_coroot (L268-L272)\nlemma sub_notMem_range_coroot\n {i j : \u03b9} (hi : i \u2208 b.support) (hj : j \u2208 b.support) :\n P.coroot i - P.coroot j \u2209 range P.coroot :=\nb.flip.sub_notMem_range_root hi hj\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.height_eq_sum (L379-L391)\nlemma height_eq_sum {i : \u03b9} {f : \u03b9 \u2192 \u2124} (heq : P.root i = \u2211 j \u2208 b.support, f j \u2022 P.root j) :\n b.height i = \u2211 j \u2208 b.support, f j := by\nsuffices \u2200 j \u2208 b.support, (b.exists_root_eq_sum_int i).choose j = f j from\n Finset.sum_congr rfl this\n intro j hj\n obtain \u27e8-, -, h\u27e9 := (b.exists_root_eq_sum_int i).choose_spec\n rw [h, b.support.sum_subtype (p := (\u00b7 \u2208 b.support)) (by simp) (F := inferInstance),\n b.support.sum_subtype (p := (\u00b7 \u2208 b.support)) (by simp) (F := inferInstance)] at heq\n have aux (j : b.support) := Fintype.linearIndependent_iff\u209b.mp\n (b.linearIndepOn_root.restrict_scalars' \u2124) ((b.exists_root_eq_sum_int i).choose \u2218 (\u2191))\n (f \u2218 (\u2191)) (by simpa) j\n simpa using aux \u27e8j, hj\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.exists_root_eq_sum_nat_or_neg (L334-L354)\nlemma exists_root_eq_sum_nat_or_neg (i : \u03b9) :\n \u2203 f : \u03b9 \u2192 \u2115, f.support \u2286 b.support \u2227\n (P.root i = \u2211 j \u2208 b.support, f j \u2022 P.root j \u2228\n P.root i = - \u2211 j \u2208 b.support, f j \u2022 P.root j) := by\nclassical\n simp_rw [\u2190 neg_eq_iff_eq_neg]\n suffices \u2200 m \u2208 AddSubmonoid.closure (P.root '' b.support),\n \u2203 f : \u03b9 \u2192 \u2115, f.support \u2286 b.support \u2227 m = \u2211 j \u2208 b.support, f j \u2022 P.root j by\n rcases b.root_mem_or_neg_mem i with hi | hi\n \u00b7 obtain \u27e8f, hf, hf'\u27e9 := this _ hi\n exact \u27e8f, hf, Or.inl hf'\u27e9\n \u00b7 obtain \u27e8f, hf, hf'\u27e9 := this _ hi\n exact \u27e8f, hf, Or.inr hf'\u27e9\n intro m hm\n refine AddSubmonoid.closure_induction ?_ \u27e80, by simp\u27e9 ?_ hm\n \u00b7 rintro - \u27e8j, hj, rfl\u27e9\n exact \u27e8Pi.single j 1, by simpa, by aesop (add simp Pi.single_apply)\u27e9\n \u00b7 intro _ _ _ _ \u27e8f, hf, hf'\u27e9 \u27e8g, hg, hg'\u27e9\n refine \u27e8f + g, ?_, by simp [hf', hg', add_smul, Finset.sum_add_distrib]\u27e9\n exact (support_add f g).trans <| union_subset_iff.mpr \u27e8hf, hg\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.RootSystem.Base.linearIndependent_pair_of_ne (L110-L115)\nlemma linearIndependent_pair_of_ne {i j : b.support} (hij : i \u2260 j) :\n LinearIndependent R ![P.root i, P.root j] := by\nhave : ({(j : \u03b9), (i : \u03b9)} : Set \u03b9) \u2286 b.support := by simp [pair_subset_iff]\n rw [\u2190 linearIndepOn_id_range_iff (by simp_all)]\n simpa [image_pair] using LinearIndepOn.id_image <| b.linearIndepOn_root.mono this\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/RootSystem/RootPositive.lean", "module": "Mathlib.LinearAlgebra.RootSystem.RootPositive", "declaration": "Mathlib.LinearAlgebra.RootSystem.RootPositive.apply_reflection_reflection", "span": "L78-L81", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/RootSystem/RootPositive.lean#L78"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 8030, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 21383, "lean_code_chars": 19869, "natural_language_chars": 1514, "lean_code_ratio": 0.9292, "line_count": 567, "imports_count": 0, "declarations_count": 2278, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "812b0b98b08b6548", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Category.Grp.Basic.commGroupIsoToMulEquiv", "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.Algebra.Category.Grp.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef commGroupIsoToMulEquiv {X Y : CommGrpCat} (i : X \u2245 Y) : X \u2243* Y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.of (L59-L63)\nabbrev of (M : Type u) [Group M] : GrpCat := \u27e8M\u27e9\nend GrpCat\n\n/-- The type of morphisms in `AddGrpCat R`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.Hom (L97-L100)\nabbrev Hom.hom {X Y : GrpCat.{u}} (f : Hom X Y) :=\nConcreteCategory.hom (C := GrpCat) f\n\n/-- Typecheck a `MonoidHom` as a morphism in `GrpCat`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.ofHom (L102-L106)\nabbrev ofHom {X Y : Type u} [Group X] [Group Y] (f : X \u2192* Y) : of X \u27f6 of Y :=\nConcreteCategory.ofHom (C := GrpCat) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.Hom (L107-L116)\ndef Hom.Simps.hom (X Y : GrpCat.{u}) (f : Hom X Y) :=\nf.hom\n\ninitialize_simps_projections Hom (hom' \u2192 hom)\ninitialize_simps_projections AddGrpCat.Hom (hom' \u2192 hom)\n\n/-!\nThe results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.\n-/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.coe_id (L118-L119)\nlemma coe_id {X : GrpCat} : (\ud835\udfd9 X : X \u2192 X) = id := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.coe_comp (L121-L122)\nlemma coe_comp {X Y Z : GrpCat} {f : X \u27f6 Y} {g : Y \u27f6 Z} : (f \u226b g : X \u2192 Z) = g \u2218 f := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.ext (L126-L128)\nlemma ext {X Y : GrpCat} {f g : X \u27f6 Y} (w : \u2200 x : X, f x = g x) : f = g :=\nConcreteCategory.hom_ext _ _ w\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.coe_of (L131-L133)\ntheorem coe_of (R : Type u) [Group R] : \u2191(GrpCat.of R) = R :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_id (L135-L137)\nlemma hom_id {X : GrpCat} : (\ud835\udfd9 X : X \u27f6 X).hom = MonoidHom.id X := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.id_apply (L139-L141)\nlemma id_apply (X : GrpCat) (x : X) :\n (\ud835\udfd9 X : X \u27f6 X) x = x := by simp\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_comp (L143-L146)\nlemma hom_comp {X Y T : GrpCat} (f : X \u27f6 Y) (g : Y \u27f6 T) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.comp_apply (L148-L150)\nlemma comp_apply {X Y T : GrpCat} (f : X \u27f6 Y) (g : Y \u27f6 T) (x : X) :\n (f \u226b g) x = g (f x) := by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_ext (L152-L154)\nlemma hom_ext {X Y : GrpCat} {f g : X \u27f6 Y} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_ofHom (L156-L157)\nlemma hom_ofHom {R S : Type u} [Group R] [Group S] (f : R \u2192* S) : (ofHom f).hom = f := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.ofHom_hom (L159-L161)\nlemma ofHom_hom {X Y : GrpCat} (f : X \u27f6 Y) :\n ofHom (Hom.hom f) = f := rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_inv_apply (L145-L147)\nlemma hom_inv_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : B) : e.hom (e.inv x) = x := by\nsimp\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.Hom (L83-L87)\nabbrev Hom.hom {A B : AlgCat.{v} R} (f : Hom A B) :=\nConcreteCategory.hom (C := AlgCat R) f\n\nvariable {R} in\n/-- Typecheck an `AlgHom` as a morphism in `AlgCat`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.of (L53-L55)\nabbrev of (X : Type v) [Ring X] [Algebra R X] : AlgCat.{v} R :=\n\u27e8X\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_comp (L134-L138)\nlemma ofHom_comp {X Y Z : Type v} [Ring X] [Ring Y] [Ring Z] [Algebra R X] [Algebra R Y]\n [Algebra R Z] (f : X \u2192\u2090[R] Y) (g : Y \u2192\u2090[R] Z) :\n ofHom (g.comp f) = ofHom f \u226b ofHom g :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.comp_apply (L115-L117)\nlemma comp_apply {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) (a : A) :\n (f \u226b g) a = g (f a) := by simp\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_map (L153-L156)\nlemma forget_map {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n (forget (AlgCat.{v} R)).map f = (f : _ \u2192 _) :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.coe_of (L56-L61)\nlemma coe_of (X : Type v) [Ring X] [Algebra R X] : (of R X : Type v) = X :=\nrfl\n\nvariable {R} in\nset_option backward.privateInPublic true in\n/-- The type of morphisms in `AlgCat R`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_hom (L127-L129)\nlemma ofHom_hom {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n ofHom (Hom.hom f) = f := rfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToModule (L168-L172)\ninstance hasForgetToModule : HasForget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R) where\n forget\u2082 :=\n{ obj := fun M => ModuleCat.of R M\n map := fun f => ModuleCat.ofHom f.hom.toLinearMap }\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_apply (L139-L141)\nlemma ofHom_apply {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) (x : X) : ofHom f x = f x := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.free (L185-L190)\ndef free : Type u \u2964 AlgCat.{u} R where\n obj S := of R (FreeAlgebra R S)\nmap f := ofHom <| FreeAlgebra.lift _ <| FreeAlgebra.\u03b9 _ \u2218 f\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The free/forget adjunction for `R`-algebras. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_id (L131-L132)\nlemma ofHom_id {X : Type v} [Ring X] [Algebra R X] : ofHom (AlgHom.id R X) = \ud835\udfd9 (of R X) := rfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.AlgEquiv (L208-L215)\ndef AlgEquiv.toAlgebraIso {g\u2081 : Ring X\u2081} {g\u2082 : Ring X\u2082} {m\u2081 : Algebra R X\u2081} {m\u2082 : Algebra R X\u2082}\n (e : X\u2081 \u2243\u2090[R] X\u2082) : AlgCat.of R X\u2081 \u2245 AlgCat.of R X\u2082 where\n hom := AlgCat.ofHom (e : X\u2081 \u2192\u2090[R] X\u2082)\ninv := AlgCat.ofHom (e.symm : X\u2082 \u2192\u2090[R] X\u2081)\n\nnamespace CategoryTheory.Iso\n\n/-- Build an `AlgEquiv` from an isomorphism in the category `AlgCat R`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.id_apply (L107-L109)\nlemma id_apply (A : AlgCat.{v} R) (a : A) :\n (\ud835\udfd9 A : A \u27f6 A) a = a := by simp\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_id (L104-L106)\nlemma hom_id {A : AlgCat.{v} R} : (\ud835\udfd9 A : A \u27f6 A).hom = AlgHom.id R A := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ofHom (L123-L125)\nlemma hom_ofHom {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) : (ofHom f).hom = f := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_map (L179-L183)\nlemma forget\u2082_module_map {X Y : AlgCat.{v} R} (f : X \u27f6 Y) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.ofHom f.hom.toLinearMap :=\nrfl\n\n/-- The \"free algebra\" functor, sending a type `S` to the free algebra on `S`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_obj (L151-L152)\nlemma forget_obj {A : AlgCat.{v} R} : (forget (AlgCat.{v} R)).obj A = A := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.inv_hom_apply (L142-L144)\nlemma inv_hom_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : A) : e.inv (e.hom x) = x := by\nsimp\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_comp (L111-L114)\nlemma hom_comp {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom (L88-L93)\nabbrev ofHom {A B : Type v} [Ring A] [Ring B] [Algebra R A] [Algebra R B] (f : A \u2192\u2090[R] B) :\n of R A \u27f6 of R B :=\nConcreteCategory.ofHom (C := AlgCat R) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ext (L119-L121)\nlemma hom_ext {A B : AlgCat.{v} R} {f g : A \u27f6 B} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.adj (L191-L198)\ndef adj : free.{u} R \u22a3 forget (AlgCat.{u} R) :=\nAdjunction.mkOfHomEquiv\n { homEquiv := fun _ _ =>\n { toFun := fun f \u21a6 (FreeAlgebra.lift _).symm f.hom\n invFun := fun f \u21a6 ofHom <| (FreeAlgebra.lift _) f\n left_inv := fun f \u21a6 by aesop\n right_inv := fun f \u21a6 by simp [forget_obj] } }\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToRing (L163-L167)\ninstance hasForgetToRing : HasForget\u2082 (AlgCat.{v} R) RingCat.{v} where\n forget\u2082 :=\n{ obj := fun A => RingCat.of A\n map := fun f => RingCat.ofHom f.hom.toRingHom }\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_obj (L174-L177)\nlemma forget\u2082_module_obj (X : AlgCat.{v} R) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).obj X = ModuleCat.of R X :=\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.Algebra.Category.Grp.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef commGroupIsoToMulEquiv {X Y : CommGrpCat} (i : X \u2245 Y) : X \u2243* Y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.of (L59-L63)\nabbrev of (M : Type u) [Group M] : GrpCat := \u27e8M\u27e9\nend GrpCat\n\n/-- The type of morphisms in `AddGrpCat R`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.Hom (L97-L100)\nabbrev Hom.hom {X Y : GrpCat.{u}} (f : Hom X Y) :=\nConcreteCategory.hom (C := GrpCat) f\n\n/-- Typecheck a `MonoidHom` as a morphism in `GrpCat`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.ofHom (L102-L106)\nabbrev ofHom {X Y : Type u} [Group X] [Group Y] (f : X \u2192* Y) : of X \u27f6 of Y :=\nConcreteCategory.ofHom (C := GrpCat) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.Hom (L107-L116)\ndef Hom.Simps.hom (X Y : GrpCat.{u}) (f : Hom X Y) :=\nf.hom\n\ninitialize_simps_projections Hom (hom' \u2192 hom)\ninitialize_simps_projections AddGrpCat.Hom (hom' \u2192 hom)\n\n/-!\nThe results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.\n-/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.coe_id (L118-L119)\nlemma coe_id {X : GrpCat} : (\ud835\udfd9 X : X \u2192 X) = id := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.coe_comp (L121-L122)\nlemma coe_comp {X Y Z : GrpCat} {f : X \u27f6 Y} {g : Y \u27f6 Z} : (f \u226b g : X \u2192 Z) = g \u2218 f := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.ext (L126-L128)\nlemma ext {X Y : GrpCat} {f g : X \u27f6 Y} (w : \u2200 x : X, f x = g x) : f = g :=\nConcreteCategory.hom_ext _ _ w\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.coe_of (L131-L133)\ntheorem coe_of (R : Type u) [Group R] : \u2191(GrpCat.of R) = R :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_id (L135-L137)\nlemma hom_id {X : GrpCat} : (\ud835\udfd9 X : X \u27f6 X).hom = MonoidHom.id X := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.id_apply (L139-L141)\nlemma id_apply (X : GrpCat) (x : X) :\n (\ud835\udfd9 X : X \u27f6 X) x = x := by simp\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_comp (L143-L146)\nlemma hom_comp {X Y T : GrpCat} (f : X \u27f6 Y) (g : Y \u27f6 T) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.comp_apply (L148-L150)\nlemma comp_apply {X Y T : GrpCat} (f : X \u27f6 Y) (g : Y \u27f6 T) (x : X) :\n (f \u226b g) x = g (f x) := by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_ext (L152-L154)\nlemma hom_ext {X Y : GrpCat} {f g : X \u27f6 Y} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.hom_ofHom (L156-L157)\nlemma hom_ofHom {R S : Type u} [Group R] [Group S] (f : R \u2192* S) : (ofHom f).hom = f := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Category.Grp.Basic.ofHom_hom (L159-L161)\nlemma ofHom_hom {X Y : GrpCat} (f : X \u27f6 Y) :\n ofHom (Hom.hom f) = f := rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_inv_apply (L145-L147)\nlemma hom_inv_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : B) : e.hom (e.inv x) = x := by\nsimp\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.Hom (L83-L87)\nabbrev Hom.hom {A B : AlgCat.{v} R} (f : Hom A B) :=\nConcreteCategory.hom (C := AlgCat R) f\n\nvariable {R} in\n/-- Typecheck an `AlgHom` as a morphism in `AlgCat`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.of (L53-L55)\nabbrev of (X : Type v) [Ring X] [Algebra R X] : AlgCat.{v} R :=\n\u27e8X\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_comp (L134-L138)\nlemma ofHom_comp {X Y Z : Type v} [Ring X] [Ring Y] [Ring Z] [Algebra R X] [Algebra R Y]\n [Algebra R Z] (f : X \u2192\u2090[R] Y) (g : Y \u2192\u2090[R] Z) :\n ofHom (g.comp f) = ofHom f \u226b ofHom g :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.comp_apply (L115-L117)\nlemma comp_apply {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) (a : A) :\n (f \u226b g) a = g (f a) := by simp\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_map (L153-L156)\nlemma forget_map {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n (forget (AlgCat.{v} R)).map f = (f : _ \u2192 _) :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.coe_of (L56-L61)\nlemma coe_of (X : Type v) [Ring X] [Algebra R X] : (of R X : Type v) = X :=\nrfl\n\nvariable {R} in\nset_option backward.privateInPublic true in\n/-- The type of morphisms in `AlgCat R`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_hom (L127-L129)\nlemma ofHom_hom {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n ofHom (Hom.hom f) = f := rfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToModule (L168-L172)\ninstance hasForgetToModule : HasForget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R) where\n forget\u2082 :=\n{ obj := fun M => ModuleCat.of R M\n map := fun f => ModuleCat.ofHom f.hom.toLinearMap }\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_apply (L139-L141)\nlemma ofHom_apply {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) (x : X) : ofHom f x = f x := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.free (L185-L190)\ndef free : Type u \u2964 AlgCat.{u} R where\n obj S := of R (FreeAlgebra R S)\nmap f := ofHom <| FreeAlgebra.lift _ <| FreeAlgebra.\u03b9 _ \u2218 f\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The free/forget adjunction for `R`-algebras. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_id (L131-L132)\nlemma ofHom_id {X : Type v} [Ring X] [Algebra R X] : ofHom (AlgHom.id R X) = \ud835\udfd9 (of R X) := rfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.AlgEquiv (L208-L215)\ndef AlgEquiv.toAlgebraIso {g\u2081 : Ring X\u2081} {g\u2082 : Ring X\u2082} {m\u2081 : Algebra R X\u2081} {m\u2082 : Algebra R X\u2082}\n (e : X\u2081 \u2243\u2090[R] X\u2082) : AlgCat.of R X\u2081 \u2245 AlgCat.of R X\u2082 where\n hom := AlgCat.ofHom (e : X\u2081 \u2192\u2090[R] X\u2082)\ninv := AlgCat.ofHom (e.symm : X\u2082 \u2192\u2090[R] X\u2081)\n\nnamespace CategoryTheory.Iso\n\n/-- Build an `AlgEquiv` from an isomorphism in the category `AlgCat R`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.id_apply (L107-L109)\nlemma id_apply (A : AlgCat.{v} R) (a : A) :\n (\ud835\udfd9 A : A \u27f6 A) a = a := by simp\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_id (L104-L106)\nlemma hom_id {A : AlgCat.{v} R} : (\ud835\udfd9 A : A \u27f6 A).hom = AlgHom.id R A := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ofHom (L123-L125)\nlemma hom_ofHom {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) : (ofHom f).hom = f := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_map (L179-L183)\nlemma forget\u2082_module_map {X Y : AlgCat.{v} R} (f : X \u27f6 Y) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.ofHom f.hom.toLinearMap :=\nrfl\n\n/-- The \"free algebra\" functor, sending a type `S` to the free algebra on `S`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_obj (L151-L152)\nlemma forget_obj {A : AlgCat.{v} R} : (forget (AlgCat.{v} R)).obj A = A := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.inv_hom_apply (L142-L144)\nlemma inv_hom_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : A) : e.inv (e.hom x) = x := by\nsimp\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_comp (L111-L114)\nlemma hom_comp {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom (L88-L93)\nabbrev ofHom {A B : Type v} [Ring A] [Ring B] [Algebra R A] [Algebra R B] (f : A \u2192\u2090[R] B) :\n of R A \u27f6 of R B :=\nConcreteCategory.ofHom (C := AlgCat R) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ext (L119-L121)\nlemma hom_ext {A B : AlgCat.{v} R} {f g : A \u27f6 B} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.adj (L191-L198)\ndef adj : free.{u} R \u22a3 forget (AlgCat.{u} R) :=\nAdjunction.mkOfHomEquiv\n { homEquiv := fun _ _ =>\n { toFun := fun f \u21a6 (FreeAlgebra.lift _).symm f.hom\n invFun := fun f \u21a6 ofHom <| (FreeAlgebra.lift _) f\n left_inv := fun f \u21a6 by aesop\n right_inv := fun f \u21a6 by simp [forget_obj] } }\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToRing (L163-L167)\ninstance hasForgetToRing : HasForget\u2082 (AlgCat.{v} R) RingCat.{v} where\n forget\u2082 :=\n{ obj := fun A => RingCat.of A\n map := fun f => RingCat.ofHom f.hom.toRingHom }\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_obj (L174-L177)\nlemma forget\u2082_module_obj (X : AlgCat.{v} R) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).obj X = ModuleCat.of R X :=\nrfl\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Category/Grp/Basic.lean", "module": "Mathlib.Algebra.Category.Grp.Basic", "declaration": "Mathlib.Algebra.Category.Grp.Basic.commGroupIsoToMulEquiv", "span": "L538-L547", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Category/Grp/Basic.lean#L538"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3857, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 9561, "lean_code_chars": 8058, "natural_language_chars": 1503, "lean_code_ratio": 0.8428, "line_count": 335, "imports_count": 0, "declarations_count": 1180, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "c5f66cdaea112948", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.Etale.StandardEtale.inv_aeval_X_g", "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.RingTheory.Etale.StandardEtale)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma inv_aeval_X_g :\n (\u2191P.hasMap_X.2.unit\u207b\u00b9 : P.Ring) = Ideal.Quotient.mk _ .X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.HasMap (L75-L78)\ndef HasMap (x : S) : Prop :=\naeval x P.f = 0 \u2227 IsUnit (aeval x P.g)\n\n/-- The map `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2192\u2090[R] S` sending `X` to `x`, given `P.HasMap x`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.lift (L79-L83)\ndef lift (x : S) (h : P.HasMap x) : P.Ring \u2192\u2090[R] S :=\nIdeal.Quotient.lift\u2090 _ (aevalAeval x \u2191(h.2.unit\u207b\u00b9))\n (Ideal.span_le (I := RingHom.ker _).mpr (by simp [Set.pair_subset_iff, h.1]))\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.lift_X (L85-L88)\nlemma lift_X (x : S) (h : P.HasMap x) : P.lift x h P.X = x := by\nsimp [lift, StandardEtalePair.Ring, StandardEtalePair.X]\n\nvariable {P} in\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.HasMap (L89-L91)\nlemma HasMap.map {x : S} (h : P.HasMap x) (f : S \u2192\u2090[R] T) : P.HasMap (f x) :=\n\u27e8by simp [aeval_algHom, h.1], by simpa [aeval_algHom] using h.2.map f\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.HasMap (L92-L99)\nlemma HasMap.isUnit_derivative_f {x : S} (h : P.HasMap x) :\n IsUnit (P.f.derivative.aeval x) := by\nobtain \u27e8p\u2081, p\u2082, n, e\u27e9 := P.cond\n have : aeval x P.f.derivative \u2223 aeval x P.g ^ n :=\n \u27e8_, by simpa [h.1] using congr(aeval x $e.symm)\u27e9\n exact isUnit_of_dvd_unit this (.pow _ h.2)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.aeval_X_g_mul_mk_X (L100-L109)\nlemma aeval_X_g_mul_mk_X : aeval P.X P.g * Ideal.Quotient.mk _ .X = 1 := by\nhave : aeval (R := R) P.X = (Ideal.Quotient.mk\u2090 _ _).comp Polynomial.CAlgHom := by\n ext; simp [StandardEtalePair.Ring, StandardEtalePair.X]\n rw [this]\n dsimp [StandardEtalePair.Ring]\n rw [\u2190 map_mul, \u2190 map_one (Ideal.Quotient.mk _), \u2190 sub_eq_zero, \u2190 map_sub, mul_comm]\n exact Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span (Set.mem_insert_of_mem _ rfl))\n\nset_option backward.isDefEq.respectTransparency false in\nvariable {P} in\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.hasMap_X (L110-L117)\nlemma hasMap_X : P.HasMap P.X :=\nhave : aeval (R := R) P.X = (Ideal.Quotient.mk\u2090 _ _).comp Polynomial.CAlgHom := by\n ext; simp [StandardEtalePair.Ring, StandardEtalePair.X]\n \u27e8this \u25b8 Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span (Set.mem_insert _ _)),\n IsUnit.of_mul_eq_one _ P.aeval_X_g_mul_mk_X\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\nvariable {P} in\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.hom_ext (L119-L131)\nlemma hom_ext {f g : P.Ring \u2192\u2090[R] S} (H : f P.X = g P.X) : f = g := by\nhave H : (f.comp (Ideal.Quotient.mk\u2090 R _)).comp CAlgHom =\n (g.comp (Ideal.Quotient.mk\u2090 R _)).comp CAlgHom := Polynomial.algHom_ext (by simpa)\n have H' : aeval (R := R) P.X = (Ideal.Quotient.mk\u2090 _ _).comp Polynomial.CAlgHom := by\n ext; simp [StandardEtalePair.Ring, StandardEtalePair.X]\n refine Ideal.Quotient.algHom_ext _ (Polynomial.algHom_ext' H ?_)\n change f.toMonoidHom (Ideal.Quotient.mk _ .X) = g.toMonoidHom (Ideal.Quotient.mk _ .X)\n rw [\u2190 show (\u2191P.hasMap_X.2.unit\u207b\u00b9 : P.Ring) = Ideal.Quotient.mk _ .X from\n Units.mul_eq_one_iff_inv_eq.mp P.aeval_X_g_mul_mk_X, \u2190 Units.coe_map_inv, \u2190 Units.coe_map_inv]\n congr 2\n ext\n simpa [H'] using congr($H _)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.lift_X_left (L133-L135)\nlemma lift_X_left : P.lift P.X P.hasMap_X = .id _ _ :=\nP.hom_ext (by simp)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.homEquiv (L143-L148)\ndef homEquiv : (P.Ring \u2192\u2090[R] S) \u2243 { x : S // P.HasMap x } where\n toFun f := \u27e8f P.X, hasMap_X.map f\u27e9\ninvFun x := P.lift x.1 x.2\n left_inv f := P.hom_ext (by simp)\n right_inv x := by simp\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.existsUnique_hasMap_of_hasMap_quotient_of_sq_eq_bot (L149-L179)\nlemma existsUnique_hasMap_of_hasMap_quotient_of_sq_eq_bot\n (I : Ideal S) (hI : I ^ 2 = \u22a5) (x : S) (hx : P.HasMap (Ideal.Quotient.mk I x)) :\n \u2203! \u03b5, \u03b5 \u2208 I \u2227 P.HasMap (x + \u03b5) := by\nhave hf := Ideal.Quotient.eq_zero_iff_mem.mp\n ((aeval_algHom_apply (Ideal.Quotient.mk\u2090 R I) _ _).symm.trans hx.1)\n obtain \u27e8\u27e8_, a, ha, -\u27e9, rfl\u27e9 := hx.2\n obtain \u27e8a, rfl\u27e9 := Ideal.Quotient.mk_surjective a\n simp_rw [\u2190 Ideal.Quotient.mk\u2090_eq_mk R, aeval_algHom_apply, \u2190 map_mul, \u2190 map_one\n (Ideal.Quotient.mk\u2090 R I), Ideal.Quotient.mk\u2090_eq_mk, Ideal.Quotient.mk_eq_mk_iff_sub_mem] at ha\n obtain \u27e8p\u2081, p\u2082, n, e\u27e9 := P.cond\n apply_fun aeval x at e\n simp only [map_add, map_mul, map_pow] at e\n obtain \u27e8\u03b5, h\u03b5I, b, hb\u27e9 : \u2203 \u03b5 \u2208 I, \u2203 b, aeval x (derivative P.f) * b = 1 + \u03b5 := by\n refine \u27e8_, ?_, (a ^ n * aeval x p\u2081), sub_eq_iff_eq_add'.mp rfl\u27e9\n convert_to (aeval x P.g * a) ^ n - 1 - aeval x P.f * (a ^ n * aeval x p\u2082) \u2208 I\n \u00b7 linear_combination a ^ n * e\n \u00b7 exact sub_mem (Ideal.mem_of_dvd _ (sub_one_dvd_pow_sub_one _ _) ha) (I.mul_mem_right _ hf)\n have : aeval x P.f ^ 2 = 0 := hI.le (Ideal.pow_mem_pow hf 2)\n have : aeval x P.f * \u03b5 = 0 := ((pow_two _).symm.trans hI).le (Ideal.mul_mem_mul hf h\u03b5I)\n refine \u27e8aeval x P.f * -b, \u27e8I.mul_mem_right _ hf, ?_, ?_\u27e9, ?_\u27e9\n \u00b7 rw [Polynomial.aeval_add_of_sq_eq_zero _ _ _ (by grind)]; grind\n \u00b7 rw [\u2190 IsNilpotent.isUnit_quotient_mk_iff (I := I) \u27e82, hI\u27e9, \u2190 Ideal.Quotient.mk\u2090_eq_mk R,\n \u2190 aeval_algHom_apply, Ideal.Quotient.mk\u2090_eq_mk, map_add,\n Ideal.Quotient.eq_zero_iff_mem.mpr (I.mul_mem_right _ hf), add_zero]\n exact hx.2\n \u00b7 rintro \u03b5' \u27e8h\u03b5'I, h\u03b5', h\u03b5''\u27e9\n rw [Polynomial.aeval_add_of_sq_eq_zero _ _ _ (hI.le (Ideal.pow_mem_pow h\u03b5'I 2))] at h\u03b5'\n have : \u03b5 * \u03b5' = 0 := ((pow_two _).symm.trans hI).le (Ideal.mul_mem_mul h\u03b5I h\u03b5'I)\n grind\n\n-- This works even if `f` is not monic. Generalize if we care.\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivPolynomialQuotient (L196-L199)\ndef equivPolynomialQuotient :\n P.Ring \u2243\u2090[R] R[X][Y] \u29f8 Ideal.span {C P.f, Y * C P.g - 1} := .refl ..\n/-- `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2243 (R[X]/f)[1/g]` -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivAwayAdjoinRoot (L200-L213)\ndef equivAwayAdjoinRoot :\n P.Ring \u2243\u2090[R] Localization.Away (AdjoinRoot.mk P.f P.g) := by\nrefine .ofAlgHom (P.lift (algebraMap (AdjoinRoot P.f) _ (.root P.f)) \u27e8?_, ?_\u27e9)\n (IsLocalization.liftAlgHom (M := .powers <| AdjoinRoot.mk P.f P.g)\n (f := AdjoinRoot.liftAlgHom _ _ P.X P.hasMap_X.1) <| Subtype.forall.mpr ?_) ?_ ?_\n \u00b7 rw [aeval_algebraMap_apply, AdjoinRoot.aeval_eq, AdjoinRoot.mk_self, map_zero]\n \u00b7 rw [aeval_algebraMap_apply, AdjoinRoot.aeval_eq]\n exact IsLocalization.Away.algebraMap_isUnit ..\n \u00b7 change Submonoid.powers _ \u2264 (IsUnit.submonoid _).comap _\n simpa [Submonoid.powers_le, IsUnit.mem_submonoid_iff] using P.hasMap_X.2\n \u00b7 ext; simp [Algebra.algHom]\n \u00b7 ext; simp\n\n/-- `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2243 R[X][1/g]/f` -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivAwayQuotient (L214-L236)\ndef equivAwayQuotient :\n P.Ring \u2243\u2090[R] Localization.Away P.g \u29f8 Ideal.span {algebraMap _ (Localization.Away P.g) P.f} := by\nrefine .ofAlgHom (P.lift (algebraMap R[X] _ .X) \u27e8?_, ?_\u27e9)\n (Ideal.Quotient.lift\u2090 _ (IsLocalization.liftAlgHom (M := .powers <| P.g)\n (f := aeval P.X) <| Subtype.forall.mpr ?_) ?_)\n ?_ ?_\n \u00b7 rw [aeval_algebraMap_apply, IsScalarTower.algebraMap_apply _ (Localization.Away P.g) (_ \u29f8 _),\n Ideal.Quotient.algebraMap_eq, aeval_X_left_apply, Ideal.Quotient.mk_singleton_self]\n \u00b7 rw [aeval_algebraMap_apply, IsScalarTower.algebraMap_apply _ (Localization.Away P.g) (_ \u29f8 _),\n aeval_X_left_apply]\n exact (IsLocalization.Away.algebraMap_isUnit ..).map _\n \u00b7 change Submonoid.powers _ \u2264 (IsUnit.submonoid _).comap _\n simpa [Submonoid.powers_le, IsUnit.mem_submonoid_iff] using P.hasMap_X.2\n \u00b7 change Ideal.span _ \u2264 RingHom.ker _\n simpa [Ideal.span_le] using P.hasMap_X.1\n \u00b7 apply Ideal.Quotient.algHom_ext\n ext\n simp [Algebra.algHom, IsScalarTower.algebraMap_apply R[X] (Localization.Away P.g) (_ \u29f8 _),\n -Ideal.Quotient.mk_algebraMap]\n \u00b7 ext; simp [IsScalarTower.algebraMap_apply R[X] (Localization.Away P.g) (_ \u29f8 _),\n -Ideal.Quotient.mk_algebraMap]\n\n/-- `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2243 R[X, Y]/\u27e8f, Yg-1\u27e9` -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivMvPolynomialQuotient (L237-L243)\ndef equivMvPolynomialQuotient :\n P.Ring \u2243\u2090[R] MvPolynomial (Fin 2) R \u29f8 Ideal.span\n {Bivariate.equivMvPolynomial R (C P.f), Bivariate.equivMvPolynomial R (.X * C P.g - 1)} :=\nIdeal.quotientEquivAlg _ _ (Bivariate.equivMvPolynomial R)\n (by simp only [Ideal.map_span, Set.image_insert_eq, Set.image_singleton]; rfl)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_equiv (L104-L107)\ntheorem of_equiv [FormallyEtale R A] (e : A \u2243\u2090[R] B) : FormallyEtale R B :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.of_equiv e, FormallySmooth.of_equiv e\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Etale.Basic.comp_bijective (L81-L89)\nlemma comp_bijective [FormallyEtale R A] (I : Ideal B) (hI : I ^ 2 = \u22a5) :\n Function.Bijective ((Ideal.Quotient.mk\u2090 R I).comp : (A \u2192\u2090[R] B) \u2192 A \u2192\u2090[R] B \u29f8 I) :=\n\u27e8FormallyUnramified.comp_injective I hI, FormallySmooth.comp_surjective R A I hI\u27e9\n\n/--\nAn `R`-algebra `A` is formally etale iff \"for every `R`-algebra `B`,\nevery square-zero ideal `I : Ideal B` and `f : A \u2192\u2090[R] B \u29f8 I`, there exists\na unique lift `A \u2192\u2090[R] B`\".\n-/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_comp_bijective (L90-L99)\ntheorem iff_comp_bijective :\n FormallyEtale R A \u2194 \u2200 \u2983B : Type max u v\u2984 [CommRing B] [Algebra R B] (I : Ideal B), I ^ 2 = \u22a5 \u2192\n Function.Bijective ((Ideal.Quotient.mk\u2090 R I).comp : (A \u2192\u2090[R] B) \u2192 A \u2192\u2090[R] B \u29f8 I) :=\n\u27e8fun _ _ \u21a6 comp_bijective R A, fun H \u21a6\n have : FormallyUnramified R A := FormallyUnramified.iff_comp_injective_of_small.{max u v}.mpr\n (by aesop (add safe Function.Bijective.injective))\n have : FormallySmooth R A := FormallySmooth.of_comp_surjective\n (by aesop (add safe Function.Bijective.surjective))\n .of_formallyUnramified_and_formallySmooth\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_restrictScalars (L123-L128)\nlemma of_restrictScalars [FormallyUnramified R A] [FormallyEtale R B] :\n FormallyEtale A B :=\nhave := FormallyUnramified.of_restrictScalars R A B\n have := FormallySmooth.of_restrictScalars R A B\n .of_formallyUnramified_and_formallySmooth\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Etale.Kaehler.KaehlerDifferential (L38-L46)\ndef KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale [Algebra.FormallyEtale S T] :\n T \u2297[S] \u03a9[S\u2044R] \u2243\u2097[T] \u03a9[T\u2044R] := by\nrefine LinearEquiv.ofBijective (mapBaseChange R S T)\n \u27e8?_, fun x \u21a6 (KaehlerDifferential.exact_mapBaseChange_map R S T x).mp (Subsingleton.elim _ _)\u27e9\n rw [injective_iff_map_eq_zero]\n intro x hx\n obtain \u27e8x, rfl\u27e9 := (Algebra.H1Cotangent.exact_\u03b4_mapBaseChange R S T x).mp hx\n rw [Subsingleton.elim x 0, map_zero]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Etale.Field.iff_exists_algEquiv_prod (L182-L207)\ntheorem iff_exists_algEquiv_prod [EssFiniteType K A] :\n FormallyEtale K A \u2194\n \u2203 (I : Type u) (_ : Finite I) (Ai : I \u2192 Type u) (_ : \u2200 i, Field (Ai i))\n (_ : \u2200 i, Algebra K (Ai i)) (_ : A \u2243\u2090[K] \u03a0 i, Ai i),\n \u2200 i, Algebra.IsSeparable K (Ai i) := by\nclassical\n constructor\n \u00b7 intro H\n have := FormallyUnramified.finite_of_free K A\n have := FormallyUnramified.isReduced_of_field K A\n have : IsArtinianRing A := isArtinian_of_tower K inferInstance\n let v (i : MaximalSpectrum A) : A := (IsArtinianRing.equivPi A).symm (Pi.single i 1)\n rw [FormallyEtale.iff_of_equiv ((IsArtinianRing.equivPi A).restrictScalars K),\n FormallyEtale.pi_iff] at H\n exact \u27e8_, inferInstance, _, _, _, (IsArtinianRing.equivPi A).restrictScalars K,\n fun I \u21a6 (iff_isSeparable _ _).mp inferInstance\u27e9\n \u00b7 intro \u27e8I, _, Ai, _, _, e, _\u27e9\n rw [FormallyEtale.iff_of_equiv e, FormallyEtale.pi_iff]\n exact fun I \u21a6 of_isSeparable K (Ai I)\n\nend Algebra.FormallyEtale\n\n/--\n`A` is \u00e9tale over a field `K` if and only if\n`A` is a finite product of finite separable field extensions.\n-/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Etale.Kaehler.tensorCotangentSpaceOfFormallyEtale (L95-L142)\ndef tensorCotangentSpaceOfFormallyEtale\n (H : f.toRingHom.FormallyEtale) :\n T \u2297[S] P.CotangentSpace \u2243\u2097[T] Q.CotangentSpace :=\nletI := f.toRingHom.toAlgebra\n haveI : IsScalarTower R P.Ring Q.Ring :=\n .of_algebraMap_eq fun r \u21a6 (f.toRingHom_algebraMap r).symm\n letI := ((algebraMap S T).comp (algebraMap P.Ring S)).toAlgebra\n haveI : IsScalarTower P.Ring S T := .of_algebraMap_eq' rfl\n haveI : IsScalarTower P.Ring Q.Ring T :=\n .of_algebraMap_eq fun r \u21a6 (f.algebraMap_toRingHom r).symm\n haveI : FormallyEtale P.Ring Q.Ring := \u2039_\u203a\n { __ := (CotangentSpace.map f).liftBaseChange T\n invFun := LinearMap.liftBaseChange T (by\n refine LinearMap.liftBaseChange _ ?_ \u2218\u2097\n (tensorKaehlerEquivOfFormallyEtale R P.Ring Q.Ring).symm.toLinearMap\n exact (TensorProduct.mk _ _ _ 1).restrictScalars P.Ring \u2218\u2097\n (TensorProduct.mk _ _ _ 1).restrictScalars P.Ring)\n left_inv x := by\n change (LinearMap.liftBaseChange _ _ \u2218\u2097 LinearMap.liftBaseChange _ _) x =\n LinearMap.id (R := T) x\n congr 1\n ext : 4\n refine Derivation.liftKaehlerDifferential_unique\n (R := R) (S := P.Ring) (M := T \u2297[S] P.CotangentSpace) _ _ ?_\n ext a\n have : (tensorKaehlerEquivOfFormallyEtale R P.Ring Q.Ring).symm\n ((D R Q.Ring) (f.toRingHom a)) = 1 \u2297\u209c D _ _ a :=\n tensorKaehlerEquivOfFormallyEtale_symm_D_algebraMap R P.Ring Q.Ring a\n simp [this]\n right_inv x := by\n change (LinearMap.liftBaseChange _ _ \u2218\u2097 LinearMap.liftBaseChange _ _) x =\n LinearMap.id (R := T) x\n congr 1\n ext a\n dsimp\n obtain \u27e8x, hx\u27e9 := (tensorKaehlerEquivOfFormallyEtale R P.Ring _).surjective (D R Q.Ring a)\n simp only [one_smul, \u2190 hx, LinearEquiv.symm_apply_apply]\n change (((CotangentSpace.map f).liftBaseChange T).restrictScalars Q.Ring \u2218\u2097\n LinearMap.liftBaseChange _ _) x = ((TensorProduct.mk _ _ _ 1) \u2218\u2097\n (tensorKaehlerEquivOfFormallyEtale R P.Ring Q.Ring).toLinearMap) x\n congr 1\n ext a\n simp; rfl }\n\n/-- (Implementation)\nIf `J \u2243 Q \u2297\u209a I` (e.g. when `T = Q \u2297\u209a S` and `P \u2192 Q` is flat), then `T \u2297\u209b I/I\u00b2 \u2243 J/J\u00b2`.\nThis is the inverse. -/\nnoncomputable\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_isLocalizationAway (L249-L252)\ntheorem of_isLocalizationAway (r : R) [IsLocalization.Away r A] : Etale R A where\n formallyEtale := Algebra.FormallyEtale.of_isLocalization (Submonoid.powers r)\nfinitePresentation := IsLocalization.Away.finitePresentation r\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_formallyUnramified_and_formallySmooth (L73-L76)\ntheorem of_formallyUnramified_and_formallySmooth [FormallyUnramified R A]\n [FormallySmooth R A] : FormallyEtale R A :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr \u27e8\u2039_\u203a, \u2039_\u203a\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Etale.Field.iff_isSeparable (L158-L161)\ntheorem iff_isSeparable [EssFiniteType K L] :\n FormallyEtale K L \u2194 Algebra.IsSeparable K L :=\n\u27e8fun _ \u21a6 FormallyUnramified.isSeparable K L, fun _ \u21a6 of_isSeparable K L\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Etale.Basic.comp (L118-L122)\ntheorem comp [FormallyEtale R A] [FormallyEtale A B] :\n FormallyEtale R B :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.comp R A B, FormallySmooth.comp R A B\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_of_equiv (L108-L117)\ntheorem iff_of_equiv (e : A \u2243\u2090[R] B) : FormallyEtale R A \u2194 FormallyEtale R B :=\n\u27e8fun _ \u21a6 of_equiv e, fun _ \u21a6 of_equiv e.symm\u27e9\n\nend OfEquiv\n\nsection Comp\n\nvariable [Algebra A B] [IsScalarTower R A B]\n\nvariable (R A B) in\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Etale.Basic.localization_base (L197-L201)\ntheorem localization_base [FormallyEtale R S\u2098] : FormallyEtale R\u2098 S\u2098 :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.localization_base M, FormallySmooth.localization_base M\u27e9\n\n/-- The localization of a formally \u00e9tale map is formally \u00e9tale. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Etale.Field.iff_formallyUnramified_of_field (L173-L176)\nlemma iff_formallyUnramified_of_field [EssFiniteType K A] :\n FormallyEtale K A \u2194 FormallyUnramified K A :=\n\u27e8fun _ \u21a6 inferInstance, fun _ \u21a6 .of_formallyUnramified_of_field K A\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Etale.Basic.localization_map (L202-L210)\ntheorem localization_map [FormallyEtale R S] : FormallyEtale R\u2098 S\u2098 := by\nhaveI : FormallyEtale S S\u2098 := FormallyEtale.of_isLocalization (M.map (algebraMap R S))\n haveI : FormallyEtale R S\u2098 := FormallyEtale.comp R S S\u2098\n exact FormallyEtale.localization_base M\n\nend Localization\n\nend FormallyEtale\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_of_surjective (L142-L148)\nlemma iff_of_surjective\n {R S : Type*} [CommRing R] [CommRing S]\n [Algebra R S] (h : Function.Surjective (algebraMap R S)) :\n Algebra.FormallyEtale R S \u2194 IsIdempotentElem (RingHom.ker (algebraMap R S)) := by\nrw [FormallyEtale.iff_formallyUnramified_and_formallySmooth, \u2190 FormallySmooth.iff_of_surjective h,\n and_iff_right (FormallyUnramified.of_surjective (Algebra.ofId R S) h)]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_formallyUnramified_and_formallySmooth (L66-L69)\ntheorem iff_formallyUnramified_and_formallySmooth :\n FormallyEtale R A \u2194 FormallyUnramified R A \u2227 FormallySmooth R A :=\n\u27e8fun _ \u21a6 \u27e8inferInstance, inferInstance\u27e9, fun \u27e8_, _\u27e9 \u21a6 \u27e8inferInstance, inferInstance\u27e9\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Etale.Basic.formallyEtale_algebraMap (L274-L277)\nlemma formallyEtale_algebraMap [Algebra R S] :\n (algebraMap R S).FormallyEtale \u2194 Algebra.FormallyEtale R S := by\nrw [FormallyEtale, toAlgebra_algebraMap]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Etale.Field.Algebra (L208-L223)\ntheorem Algebra.Etale.iff_exists_algEquiv_prod :\n Etale K A \u2194\n \u2203 (I : Type u) (_ : Finite I) (Ai : I \u2192 Type u) (_ : \u2200 i, Field (Ai i))\n (_ : \u2200 i, Algebra K (Ai i)) (_ : A \u2243\u2090[K] \u03a0 i, Ai i),\n \u2200 i, Module.Finite K (Ai i) \u2227 Algebra.IsSeparable K (Ai i) := by\nconstructor\n \u00b7 intro H\n obtain \u27e8I, _, Ai, _, _, e, _\u27e9 := (FormallyEtale.iff_exists_algEquiv_prod K A).mp inferInstance\n have := FormallyUnramified.finite_of_free K A\n exact \u27e8_, \u2039_\u203a, _, _, _, e, fun i \u21a6 \u27e8.of_surjective ((LinearMap.proj i).comp e.toLinearMap)\n ((Function.surjective_eval i).comp e.surjective), inferInstance\u27e9\u27e9\n \u00b7 intro \u27e8I, _, Ai, _, _, e, H\u27e9\n choose h\u2081 h\u2082 using H\n have := Module.Finite.of_surjective e.symm.toLinearMap e.symm.surjective\n refine \u27e8?_, FinitePresentation.of_finiteType.mp inferInstance\u27e9\n exact (FormallyEtale.iff_exists_algEquiv_prod K A).mpr \u27e8_, inferInstance, _, _, _, e, h\u2082\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Etale.Basic.FormallyEtale (L270-L273)\ndef FormallyEtale (f : R \u2192+* S) : Prop :=\nletI := f.toAlgebra\n Algebra.FormallyEtale R S\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Etale.Field.of_formallyUnramified_of_field (L163-L172)\nlemma of_formallyUnramified_of_field [EssFiniteType K A] [FormallyUnramified K A] :\n FormallyEtale K A := by\nhave := FormallyUnramified.isReduced_of_field K A\n have : IsArtinianRing A := .of_finite K A\n have (I : MaximalSpectrum A) : FormallyEtale K (A \u29f8 I.asIdeal) := by\n rw [FormallyEtale.iff_isSeparable, \u2190 FormallyUnramified.iff_isSeparable]\n infer_instance\n exact .of_equiv ((IsArtinianRing.equivPi A).restrictScalars K).symm\n\nvariable {K A} in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Etale.Field.of_isSeparable_aux (L56-L97)\ntheorem of_isSeparable_aux [Algebra.IsSeparable K L] [EssFiniteType K L] :\n FormallyEtale K L := by\n-- We already know that for field extensions\n -- IsSeparable + EssFiniteType => FormallyUnramified + Finite\n have := FormallyUnramified.of_isSeparable K L\n have := FormallyUnramified.finite_of_free (R := K) (S := L)\n -- We shall show that any `f : L \u2192 B/I` can be lifted to `L \u2192 B` if `I^2 = \u22a5`\n refine FormallyEtale.iff_comp_bijective.mpr fun B _ _ I h \u21a6 ?_\n refine \u27e8FormallyUnramified.iff_comp_injective_of_small.mp\n (FormallyUnramified.of_isSeparable K L) I h, ?_\u27e9\n intro f\n -- By separability and finiteness, we may assume `L = K(\u03b1)` with `p` the minpoly of `\u03b1`.\n let pb := Field.powerBasisOfFiniteOfSeparable K L\n -- Let `x : B` such that `f(\u03b1) = x` in `B / I`.\n obtain \u27e8x, hx\u27e9 := Ideal.Quotient.mk_surjective (f pb.gen)\n have helper : \u2200 x, IsScalarTower.toAlgHom K B (B \u29f8 I) x = Ideal.Quotient.mk I x := fun _ \u21a6 rfl\n -- Then `p(x) = 0 mod I`, and the goal is to find some `\u03b5 \u2208 I` such that\n -- `p(x + \u03b5) = p(x) + \u03b5 p'(x) = 0`, and we will get our lift into `B`.\n have hx' : Ideal.Quotient.mk I (aeval x (minpoly K pb.gen)) = 0 := by\n rw [\u2190 helper, \u2190 aeval_algHom_apply, helper, hx, aeval_algHom_apply, minpoly.aeval, map_zero]\n -- Since `p` is separable, `-p'(x)` is invertible in `B \u29f8 I`,\n obtain \u27e8u, hu\u27e9 : \u2203 u, (aeval x) (derivative (minpoly K pb.gen)) * u + 1 \u2208 I := by\n have := (isUnit_iff_ne_zero.mpr ((Algebra.IsSeparable.isSeparable K\n pb.gen).aeval_derivative_ne_zero (minpoly.aeval K _))).map f\n rw [\u2190 aeval_algHom_apply, \u2190 hx, \u2190 helper, aeval_algHom_apply, helper] at this\n obtain \u27e8u, hu\u27e9 := Ideal.Quotient.mk_surjective (-this.unit\u207b\u00b9 : B \u29f8 I)\n use u\n rw [\u2190 Ideal.Quotient.eq_zero_iff_mem, map_add, map_mul, map_one, hu, mul_neg,\n IsUnit.mul_val_inv, neg_add_cancel]\n -- And `\u03b5 = p(x)/(-p'(x))` works.\n use pb.liftEquiv.symm \u27e8x + u * aeval x (minpoly K pb.gen), ?_\u27e9\n \u00b7 apply pb.algHom_ext\n simp [hx, hx']\n \u00b7 rw [\u2190 eval_map_algebraMap, Polynomial.eval_add_of_sq_eq_zero, derivative_map,\n \u2190 one_mul (eval x _), eval_map_algebraMap, eval_map_algebraMap, \u2190 mul_assoc, \u2190 add_mul,\n \u2190 Ideal.mem_bot, \u2190 h, pow_two, add_comm]\n \u00b7 exact Ideal.mul_mem_mul hu (Ideal.Quotient.eq_zero_iff_mem.mp hx')\n rw [\u2190 Ideal.mem_bot, \u2190 h]\n apply Ideal.pow_mem_pow\n rw [\u2190 Ideal.Quotient.eq_zero_iff_mem, map_mul, hx', mul_zero]\n\nopen scoped IntermediateField in\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_isLocalization (L190-L193)\ntheorem of_isLocalization : FormallyEtale R R\u2098 :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.of_isLocalization M, FormallySmooth.of_isLocalization M\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_restrictScalars (L129-L132)\nlemma iff_restrictScalars [FormallyEtale R A] :\n Algebra.FormallyEtale R B \u2194 Algebra.FormallyEtale A B :=\n\u27e8fun _ \u21a6 .of_restrictScalars (R := R), fun _ \u21a6 .comp _ A _\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Etale.Field.of_isSeparable (L98-L157)\nlemma of_isSeparable [Algebra.IsSeparable K L] : FormallyEtale K L := by\n-- We shall show that any `f : L \u2192 B/I` can be lifted to `L \u2192 B` if `I^2 = \u22a5`.\n refine FormallyEtale.iff_comp_bijective.mpr fun B _ _ I h \u21a6 ?_\n -- But we already know that there exists a unique lift for every finite subfield of `L`\n -- by `of_isSeparable_aux`, so we can glue them all together.\n refine \u27e8FormallyUnramified.iff_comp_injective_of_small.mp\n (FormallyUnramified.of_isSeparable K L) I h, ?_\u27e9\n intro f\n have : \u2200 k : L, \u2203! g : K\u27eek\u27ef \u2192\u2090[K] B,\n (Ideal.Quotient.mk\u2090 K I).comp g = f.comp (IsScalarTower.toAlgHom K _ L) := by\n intro k\n have := IsSeparable.of_algHom _ _ (IsScalarTower.toAlgHom K (K\u27eek\u27ef) L)\n have := IntermediateField.adjoin.finiteDimensional\n (Algebra.IsSeparable.isSeparable K k).isIntegral\n have := FormallyEtale.of_isSeparable_aux K (K\u27eek\u27ef)\n have := FormallyEtale.comp_bijective (R := K) (A := K\u27eek\u27ef) I h\n exact this.existsUnique _\n choose g hg\u2081 hg\u2082 using this\n have hg\u2083 : \u2200 x y (h : x \u2208 K\u27eey\u27ef), g y \u27e8x, h\u27e9 = g x (IntermediateField.AdjoinSimple.gen K x) := by\n intro x y h\n have e : K\u27eex\u27ef \u2264 K\u27eey\u27ef := by\n rw [IntermediateField.adjoin_le_iff]\n rintro _ rfl\n exact h\n rw [\u2190 hg\u2082 _ ((g _).comp (IntermediateField.inclusion e))]\n \u00b7 rfl\n apply AlgHom.ext\n rw [\u2190 AlgHom.comp_assoc, hg\u2081, AlgHom.comp_assoc]\n simp\n have H : \u2200 x y : L, \u2203 \u03b1 : L, x \u2208 K\u27ee\u03b1\u27ef \u2227 y \u2208 K\u27ee\u03b1\u27ef := by\n intro x y\n have : FiniteDimensional K K\u27eex, y\u27ef := by\n apply IntermediateField.finiteDimensional_adjoin\n intro x _; exact (Algebra.IsSeparable.isSeparable K x).isIntegral\n have := IsSeparable.of_algHom _ _ (IsScalarTower.toAlgHom K (K\u27eex, y\u27ef) L)\n obtain \u27e8\u27e8\u03b1, h\u03b1\u27e9, e\u27e9 := Field.exists_primitive_element K K\u27eex, y\u27ef\n apply_fun (IntermediateField.map (IntermediateField.val _)) at e\n rw [IntermediateField.adjoin_map, \u2190 AlgHom.fieldRange_eq_map] at e\n simp only [IntermediateField.coe_val, Set.image_singleton,\n IntermediateField.fieldRange_val] at e\n have hx : x \u2208 K\u27ee\u03b1\u27ef := e \u25b8 IntermediateField.subset_adjoin K {x, y} (by simp)\n have hy : y \u2208 K\u27ee\u03b1\u27ef := e \u25b8 IntermediateField.subset_adjoin K {x, y} (by simp)\n exact \u27e8\u03b1, hx, hy\u27e9\n refine \u27e8\u27e8\u27e8\u27e8\u27e8fun x \u21a6 g x (IntermediateField.AdjoinSimple.gen K x), ?_\u27e9, ?_\u27e9, ?_, ?_\u27e9, ?_\u27e9, ?_\u27e9\n \u00b7 change g 1 1 = 1; rw [map_one]\n \u00b7 intro x y\n obtain \u27e8\u03b1, hx, hy\u27e9 := H x y\n simp only [\u2190 hg\u2083 _ _ hx, \u2190 hg\u2083 _ _ hy, \u2190 map_mul, \u2190 hg\u2083 _ _ (mul_mem hx hy)]\n rfl\n \u00b7 change g 0 0 = 0; rw [map_zero]\n \u00b7 intro x y\n obtain \u27e8\u03b1, hx, hy\u27e9 := H x y\n simp only [\u2190 hg\u2083 _ _ hx, \u2190 hg\u2083 _ _ hy, \u2190 map_add, \u2190 hg\u2083 _ _ (add_mem hx hy)]\n rfl\n \u00b7 intro r\n change g _ (algebraMap K _ r) = _\n rw [AlgHom.commutes]\n \u00b7 ext x\n simpa using AlgHom.congr_fun (hg\u2081 x) (IntermediateField.AdjoinSimple.gen K 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.RingTheory.Etale.StandardEtale).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma inv_aeval_X_g :\n (\u2191P.hasMap_X.2.unit\u207b\u00b9 : P.Ring) = Ideal.Quotient.mk _ .X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.HasMap (L75-L78)\ndef HasMap (x : S) : Prop :=\naeval x P.f = 0 \u2227 IsUnit (aeval x P.g)\n\n/-- The map `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2192\u2090[R] S` sending `X` to `x`, given `P.HasMap x`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.lift (L79-L83)\ndef lift (x : S) (h : P.HasMap x) : P.Ring \u2192\u2090[R] S :=\nIdeal.Quotient.lift\u2090 _ (aevalAeval x \u2191(h.2.unit\u207b\u00b9))\n (Ideal.span_le (I := RingHom.ker _).mpr (by simp [Set.pair_subset_iff, h.1]))\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.lift_X (L85-L88)\nlemma lift_X (x : S) (h : P.HasMap x) : P.lift x h P.X = x := by\nsimp [lift, StandardEtalePair.Ring, StandardEtalePair.X]\n\nvariable {P} in\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.HasMap (L89-L91)\nlemma HasMap.map {x : S} (h : P.HasMap x) (f : S \u2192\u2090[R] T) : P.HasMap (f x) :=\n\u27e8by simp [aeval_algHom, h.1], by simpa [aeval_algHom] using h.2.map f\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.HasMap (L92-L99)\nlemma HasMap.isUnit_derivative_f {x : S} (h : P.HasMap x) :\n IsUnit (P.f.derivative.aeval x) := by\nobtain \u27e8p\u2081, p\u2082, n, e\u27e9 := P.cond\n have : aeval x P.f.derivative \u2223 aeval x P.g ^ n :=\n \u27e8_, by simpa [h.1] using congr(aeval x $e.symm)\u27e9\n exact isUnit_of_dvd_unit this (.pow _ h.2)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.aeval_X_g_mul_mk_X (L100-L109)\nlemma aeval_X_g_mul_mk_X : aeval P.X P.g * Ideal.Quotient.mk _ .X = 1 := by\nhave : aeval (R := R) P.X = (Ideal.Quotient.mk\u2090 _ _).comp Polynomial.CAlgHom := by\n ext; simp [StandardEtalePair.Ring, StandardEtalePair.X]\n rw [this]\n dsimp [StandardEtalePair.Ring]\n rw [\u2190 map_mul, \u2190 map_one (Ideal.Quotient.mk _), \u2190 sub_eq_zero, \u2190 map_sub, mul_comm]\n exact Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span (Set.mem_insert_of_mem _ rfl))\n\nset_option backward.isDefEq.respectTransparency false in\nvariable {P} in\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.hasMap_X (L110-L117)\nlemma hasMap_X : P.HasMap P.X :=\nhave : aeval (R := R) P.X = (Ideal.Quotient.mk\u2090 _ _).comp Polynomial.CAlgHom := by\n ext; simp [StandardEtalePair.Ring, StandardEtalePair.X]\n \u27e8this \u25b8 Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span (Set.mem_insert _ _)),\n IsUnit.of_mul_eq_one _ P.aeval_X_g_mul_mk_X\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\nvariable {P} in\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.hom_ext (L119-L131)\nlemma hom_ext {f g : P.Ring \u2192\u2090[R] S} (H : f P.X = g P.X) : f = g := by\nhave H : (f.comp (Ideal.Quotient.mk\u2090 R _)).comp CAlgHom =\n (g.comp (Ideal.Quotient.mk\u2090 R _)).comp CAlgHom := Polynomial.algHom_ext (by simpa)\n have H' : aeval (R := R) P.X = (Ideal.Quotient.mk\u2090 _ _).comp Polynomial.CAlgHom := by\n ext; simp [StandardEtalePair.Ring, StandardEtalePair.X]\n refine Ideal.Quotient.algHom_ext _ (Polynomial.algHom_ext' H ?_)\n change f.toMonoidHom (Ideal.Quotient.mk _ .X) = g.toMonoidHom (Ideal.Quotient.mk _ .X)\n rw [\u2190 show (\u2191P.hasMap_X.2.unit\u207b\u00b9 : P.Ring) = Ideal.Quotient.mk _ .X from\n Units.mul_eq_one_iff_inv_eq.mp P.aeval_X_g_mul_mk_X, \u2190 Units.coe_map_inv, \u2190 Units.coe_map_inv]\n congr 2\n ext\n simpa [H'] using congr($H _)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.lift_X_left (L133-L135)\nlemma lift_X_left : P.lift P.X P.hasMap_X = .id _ _ :=\nP.hom_ext (by simp)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.homEquiv (L143-L148)\ndef homEquiv : (P.Ring \u2192\u2090[R] S) \u2243 { x : S // P.HasMap x } where\n toFun f := \u27e8f P.X, hasMap_X.map f\u27e9\ninvFun x := P.lift x.1 x.2\n left_inv f := P.hom_ext (by simp)\n right_inv x := by simp\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.existsUnique_hasMap_of_hasMap_quotient_of_sq_eq_bot (L149-L179)\nlemma existsUnique_hasMap_of_hasMap_quotient_of_sq_eq_bot\n (I : Ideal S) (hI : I ^ 2 = \u22a5) (x : S) (hx : P.HasMap (Ideal.Quotient.mk I x)) :\n \u2203! \u03b5, \u03b5 \u2208 I \u2227 P.HasMap (x + \u03b5) := by\nhave hf := Ideal.Quotient.eq_zero_iff_mem.mp\n ((aeval_algHom_apply (Ideal.Quotient.mk\u2090 R I) _ _).symm.trans hx.1)\n obtain \u27e8\u27e8_, a, ha, -\u27e9, rfl\u27e9 := hx.2\n obtain \u27e8a, rfl\u27e9 := Ideal.Quotient.mk_surjective a\n simp_rw [\u2190 Ideal.Quotient.mk\u2090_eq_mk R, aeval_algHom_apply, \u2190 map_mul, \u2190 map_one\n (Ideal.Quotient.mk\u2090 R I), Ideal.Quotient.mk\u2090_eq_mk, Ideal.Quotient.mk_eq_mk_iff_sub_mem] at ha\n obtain \u27e8p\u2081, p\u2082, n, e\u27e9 := P.cond\n apply_fun aeval x at e\n simp only [map_add, map_mul, map_pow] at e\n obtain \u27e8\u03b5, h\u03b5I, b, hb\u27e9 : \u2203 \u03b5 \u2208 I, \u2203 b, aeval x (derivative P.f) * b = 1 + \u03b5 := by\n refine \u27e8_, ?_, (a ^ n * aeval x p\u2081), sub_eq_iff_eq_add'.mp rfl\u27e9\n convert_to (aeval x P.g * a) ^ n - 1 - aeval x P.f * (a ^ n * aeval x p\u2082) \u2208 I\n \u00b7 linear_combination a ^ n * e\n \u00b7 exact sub_mem (Ideal.mem_of_dvd _ (sub_one_dvd_pow_sub_one _ _) ha) (I.mul_mem_right _ hf)\n have : aeval x P.f ^ 2 = 0 := hI.le (Ideal.pow_mem_pow hf 2)\n have : aeval x P.f * \u03b5 = 0 := ((pow_two _).symm.trans hI).le (Ideal.mul_mem_mul hf h\u03b5I)\n refine \u27e8aeval x P.f * -b, \u27e8I.mul_mem_right _ hf, ?_, ?_\u27e9, ?_\u27e9\n \u00b7 rw [Polynomial.aeval_add_of_sq_eq_zero _ _ _ (by grind)]; grind\n \u00b7 rw [\u2190 IsNilpotent.isUnit_quotient_mk_iff (I := I) \u27e82, hI\u27e9, \u2190 Ideal.Quotient.mk\u2090_eq_mk R,\n \u2190 aeval_algHom_apply, Ideal.Quotient.mk\u2090_eq_mk, map_add,\n Ideal.Quotient.eq_zero_iff_mem.mpr (I.mul_mem_right _ hf), add_zero]\n exact hx.2\n \u00b7 rintro \u03b5' \u27e8h\u03b5'I, h\u03b5', h\u03b5''\u27e9\n rw [Polynomial.aeval_add_of_sq_eq_zero _ _ _ (hI.le (Ideal.pow_mem_pow h\u03b5'I 2))] at h\u03b5'\n have : \u03b5 * \u03b5' = 0 := ((pow_two _).symm.trans hI).le (Ideal.mul_mem_mul h\u03b5I h\u03b5'I)\n grind\n\n-- This works even if `f` is not monic. Generalize if we care.\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivPolynomialQuotient (L196-L199)\ndef equivPolynomialQuotient :\n P.Ring \u2243\u2090[R] R[X][Y] \u29f8 Ideal.span {C P.f, Y * C P.g - 1} := .refl ..\n/-- `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2243 (R[X]/f)[1/g]` -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivAwayAdjoinRoot (L200-L213)\ndef equivAwayAdjoinRoot :\n P.Ring \u2243\u2090[R] Localization.Away (AdjoinRoot.mk P.f P.g) := by\nrefine .ofAlgHom (P.lift (algebraMap (AdjoinRoot P.f) _ (.root P.f)) \u27e8?_, ?_\u27e9)\n (IsLocalization.liftAlgHom (M := .powers <| AdjoinRoot.mk P.f P.g)\n (f := AdjoinRoot.liftAlgHom _ _ P.X P.hasMap_X.1) <| Subtype.forall.mpr ?_) ?_ ?_\n \u00b7 rw [aeval_algebraMap_apply, AdjoinRoot.aeval_eq, AdjoinRoot.mk_self, map_zero]\n \u00b7 rw [aeval_algebraMap_apply, AdjoinRoot.aeval_eq]\n exact IsLocalization.Away.algebraMap_isUnit ..\n \u00b7 change Submonoid.powers _ \u2264 (IsUnit.submonoid _).comap _\n simpa [Submonoid.powers_le, IsUnit.mem_submonoid_iff] using P.hasMap_X.2\n \u00b7 ext; simp [Algebra.algHom]\n \u00b7 ext; simp\n\n/-- `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2243 R[X][1/g]/f` -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivAwayQuotient (L214-L236)\ndef equivAwayQuotient :\n P.Ring \u2243\u2090[R] Localization.Away P.g \u29f8 Ideal.span {algebraMap _ (Localization.Away P.g) P.f} := by\nrefine .ofAlgHom (P.lift (algebraMap R[X] _ .X) \u27e8?_, ?_\u27e9)\n (Ideal.Quotient.lift\u2090 _ (IsLocalization.liftAlgHom (M := .powers <| P.g)\n (f := aeval P.X) <| Subtype.forall.mpr ?_) ?_)\n ?_ ?_\n \u00b7 rw [aeval_algebraMap_apply, IsScalarTower.algebraMap_apply _ (Localization.Away P.g) (_ \u29f8 _),\n Ideal.Quotient.algebraMap_eq, aeval_X_left_apply, Ideal.Quotient.mk_singleton_self]\n \u00b7 rw [aeval_algebraMap_apply, IsScalarTower.algebraMap_apply _ (Localization.Away P.g) (_ \u29f8 _),\n aeval_X_left_apply]\n exact (IsLocalization.Away.algebraMap_isUnit ..).map _\n \u00b7 change Submonoid.powers _ \u2264 (IsUnit.submonoid _).comap _\n simpa [Submonoid.powers_le, IsUnit.mem_submonoid_iff] using P.hasMap_X.2\n \u00b7 change Ideal.span _ \u2264 RingHom.ker _\n simpa [Ideal.span_le] using P.hasMap_X.1\n \u00b7 apply Ideal.Quotient.algHom_ext\n ext\n simp [Algebra.algHom, IsScalarTower.algebraMap_apply R[X] (Localization.Away P.g) (_ \u29f8 _),\n -Ideal.Quotient.mk_algebraMap]\n \u00b7 ext; simp [IsScalarTower.algebraMap_apply R[X] (Localization.Away P.g) (_ \u29f8 _),\n -Ideal.Quotient.mk_algebraMap]\n\n/-- `R[X][Y]/\u27e8f, Yg-1\u27e9 \u2243 R[X, Y]/\u27e8f, Yg-1\u27e9` -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Etale.StandardEtale.equivMvPolynomialQuotient (L237-L243)\ndef equivMvPolynomialQuotient :\n P.Ring \u2243\u2090[R] MvPolynomial (Fin 2) R \u29f8 Ideal.span\n {Bivariate.equivMvPolynomial R (C P.f), Bivariate.equivMvPolynomial R (.X * C P.g - 1)} :=\nIdeal.quotientEquivAlg _ _ (Bivariate.equivMvPolynomial R)\n (by simp only [Ideal.map_span, Set.image_insert_eq, Set.image_singleton]; rfl)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_equiv (L104-L107)\ntheorem of_equiv [FormallyEtale R A] (e : A \u2243\u2090[R] B) : FormallyEtale R B :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.of_equiv e, FormallySmooth.of_equiv e\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Etale.Basic.comp_bijective (L81-L89)\nlemma comp_bijective [FormallyEtale R A] (I : Ideal B) (hI : I ^ 2 = \u22a5) :\n Function.Bijective ((Ideal.Quotient.mk\u2090 R I).comp : (A \u2192\u2090[R] B) \u2192 A \u2192\u2090[R] B \u29f8 I) :=\n\u27e8FormallyUnramified.comp_injective I hI, FormallySmooth.comp_surjective R A I hI\u27e9\n\n/--\nAn `R`-algebra `A` is formally etale iff \"for every `R`-algebra `B`,\nevery square-zero ideal `I : Ideal B` and `f : A \u2192\u2090[R] B \u29f8 I`, there exists\na unique lift `A \u2192\u2090[R] B`\".\n-/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_comp_bijective (L90-L99)\ntheorem iff_comp_bijective :\n FormallyEtale R A \u2194 \u2200 \u2983B : Type max u v\u2984 [CommRing B] [Algebra R B] (I : Ideal B), I ^ 2 = \u22a5 \u2192\n Function.Bijective ((Ideal.Quotient.mk\u2090 R I).comp : (A \u2192\u2090[R] B) \u2192 A \u2192\u2090[R] B \u29f8 I) :=\n\u27e8fun _ _ \u21a6 comp_bijective R A, fun H \u21a6\n have : FormallyUnramified R A := FormallyUnramified.iff_comp_injective_of_small.{max u v}.mpr\n (by aesop (add safe Function.Bijective.injective))\n have : FormallySmooth R A := FormallySmooth.of_comp_surjective\n (by aesop (add safe Function.Bijective.surjective))\n .of_formallyUnramified_and_formallySmooth\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_restrictScalars (L123-L128)\nlemma of_restrictScalars [FormallyUnramified R A] [FormallyEtale R B] :\n FormallyEtale A B :=\nhave := FormallyUnramified.of_restrictScalars R A B\n have := FormallySmooth.of_restrictScalars R A B\n .of_formallyUnramified_and_formallySmooth\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Etale.Kaehler.KaehlerDifferential (L38-L46)\ndef KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale [Algebra.FormallyEtale S T] :\n T \u2297[S] \u03a9[S\u2044R] \u2243\u2097[T] \u03a9[T\u2044R] := by\nrefine LinearEquiv.ofBijective (mapBaseChange R S T)\n \u27e8?_, fun x \u21a6 (KaehlerDifferential.exact_mapBaseChange_map R S T x).mp (Subsingleton.elim _ _)\u27e9\n rw [injective_iff_map_eq_zero]\n intro x hx\n obtain \u27e8x, rfl\u27e9 := (Algebra.H1Cotangent.exact_\u03b4_mapBaseChange R S T x).mp hx\n rw [Subsingleton.elim x 0, map_zero]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Etale.Field.iff_exists_algEquiv_prod (L182-L207)\ntheorem iff_exists_algEquiv_prod [EssFiniteType K A] :\n FormallyEtale K A \u2194\n \u2203 (I : Type u) (_ : Finite I) (Ai : I \u2192 Type u) (_ : \u2200 i, Field (Ai i))\n (_ : \u2200 i, Algebra K (Ai i)) (_ : A \u2243\u2090[K] \u03a0 i, Ai i),\n \u2200 i, Algebra.IsSeparable K (Ai i) := by\nclassical\n constructor\n \u00b7 intro H\n have := FormallyUnramified.finite_of_free K A\n have := FormallyUnramified.isReduced_of_field K A\n have : IsArtinianRing A := isArtinian_of_tower K inferInstance\n let v (i : MaximalSpectrum A) : A := (IsArtinianRing.equivPi A).symm (Pi.single i 1)\n rw [FormallyEtale.iff_of_equiv ((IsArtinianRing.equivPi A).restrictScalars K),\n FormallyEtale.pi_iff] at H\n exact \u27e8_, inferInstance, _, _, _, (IsArtinianRing.equivPi A).restrictScalars K,\n fun I \u21a6 (iff_isSeparable _ _).mp inferInstance\u27e9\n \u00b7 intro \u27e8I, _, Ai, _, _, e, _\u27e9\n rw [FormallyEtale.iff_of_equiv e, FormallyEtale.pi_iff]\n exact fun I \u21a6 of_isSeparable K (Ai I)\n\nend Algebra.FormallyEtale\n\n/--\n`A` is \u00e9tale over a field `K` if and only if\n`A` is a finite product of finite separable field extensions.\n-/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Etale.Kaehler.tensorCotangentSpaceOfFormallyEtale (L95-L142)\ndef tensorCotangentSpaceOfFormallyEtale\n (H : f.toRingHom.FormallyEtale) :\n T \u2297[S] P.CotangentSpace \u2243\u2097[T] Q.CotangentSpace :=\nletI := f.toRingHom.toAlgebra\n haveI : IsScalarTower R P.Ring Q.Ring :=\n .of_algebraMap_eq fun r \u21a6 (f.toRingHom_algebraMap r).symm\n letI := ((algebraMap S T).comp (algebraMap P.Ring S)).toAlgebra\n haveI : IsScalarTower P.Ring S T := .of_algebraMap_eq' rfl\n haveI : IsScalarTower P.Ring Q.Ring T :=\n .of_algebraMap_eq fun r \u21a6 (f.algebraMap_toRingHom r).symm\n haveI : FormallyEtale P.Ring Q.Ring := \u2039_\u203a\n { __ := (CotangentSpace.map f).liftBaseChange T\n invFun := LinearMap.liftBaseChange T (by\n refine LinearMap.liftBaseChange _ ?_ \u2218\u2097\n (tensorKaehlerEquivOfFormallyEtale R P.Ring Q.Ring).symm.toLinearMap\n exact (TensorProduct.mk _ _ _ 1).restrictScalars P.Ring \u2218\u2097\n (TensorProduct.mk _ _ _ 1).restrictScalars P.Ring)\n left_inv x := by\n change (LinearMap.liftBaseChange _ _ \u2218\u2097 LinearMap.liftBaseChange _ _) x =\n LinearMap.id (R := T) x\n congr 1\n ext : 4\n refine Derivation.liftKaehlerDifferential_unique\n (R := R) (S := P.Ring) (M := T \u2297[S] P.CotangentSpace) _ _ ?_\n ext a\n have : (tensorKaehlerEquivOfFormallyEtale R P.Ring Q.Ring).symm\n ((D R Q.Ring) (f.toRingHom a)) = 1 \u2297\u209c D _ _ a :=\n tensorKaehlerEquivOfFormallyEtale_symm_D_algebraMap R P.Ring Q.Ring a\n simp [this]\n right_inv x := by\n change (LinearMap.liftBaseChange _ _ \u2218\u2097 LinearMap.liftBaseChange _ _) x =\n LinearMap.id (R := T) x\n congr 1\n ext a\n dsimp\n obtain \u27e8x, hx\u27e9 := (tensorKaehlerEquivOfFormallyEtale R P.Ring _).surjective (D R Q.Ring a)\n simp only [one_smul, \u2190 hx, LinearEquiv.symm_apply_apply]\n change (((CotangentSpace.map f).liftBaseChange T).restrictScalars Q.Ring \u2218\u2097\n LinearMap.liftBaseChange _ _) x = ((TensorProduct.mk _ _ _ 1) \u2218\u2097\n (tensorKaehlerEquivOfFormallyEtale R P.Ring Q.Ring).toLinearMap) x\n congr 1\n ext a\n simp; rfl }\n\n/-- (Implementation)\nIf `J \u2243 Q \u2297\u209a I` (e.g. when `T = Q \u2297\u209a S` and `P \u2192 Q` is flat), then `T \u2297\u209b I/I\u00b2 \u2243 J/J\u00b2`.\nThis is the inverse. -/\nnoncomputable\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_isLocalizationAway (L249-L252)\ntheorem of_isLocalizationAway (r : R) [IsLocalization.Away r A] : Etale R A where\n formallyEtale := Algebra.FormallyEtale.of_isLocalization (Submonoid.powers r)\nfinitePresentation := IsLocalization.Away.finitePresentation r\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_formallyUnramified_and_formallySmooth (L73-L76)\ntheorem of_formallyUnramified_and_formallySmooth [FormallyUnramified R A]\n [FormallySmooth R A] : FormallyEtale R A :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr \u27e8\u2039_\u203a, \u2039_\u203a\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Etale.Field.iff_isSeparable (L158-L161)\ntheorem iff_isSeparable [EssFiniteType K L] :\n FormallyEtale K L \u2194 Algebra.IsSeparable K L :=\n\u27e8fun _ \u21a6 FormallyUnramified.isSeparable K L, fun _ \u21a6 of_isSeparable K L\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Etale.Basic.comp (L118-L122)\ntheorem comp [FormallyEtale R A] [FormallyEtale A B] :\n FormallyEtale R B :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.comp R A B, FormallySmooth.comp R A B\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_of_equiv (L108-L117)\ntheorem iff_of_equiv (e : A \u2243\u2090[R] B) : FormallyEtale R A \u2194 FormallyEtale R B :=\n\u27e8fun _ \u21a6 of_equiv e, fun _ \u21a6 of_equiv e.symm\u27e9\n\nend OfEquiv\n\nsection Comp\n\nvariable [Algebra A B] [IsScalarTower R A B]\n\nvariable (R A B) in\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Etale.Basic.localization_base (L197-L201)\ntheorem localization_base [FormallyEtale R S\u2098] : FormallyEtale R\u2098 S\u2098 :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.localization_base M, FormallySmooth.localization_base M\u27e9\n\n/-- The localization of a formally \u00e9tale map is formally \u00e9tale. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Etale.Field.iff_formallyUnramified_of_field (L173-L176)\nlemma iff_formallyUnramified_of_field [EssFiniteType K A] :\n FormallyEtale K A \u2194 FormallyUnramified K A :=\n\u27e8fun _ \u21a6 inferInstance, fun _ \u21a6 .of_formallyUnramified_of_field K A\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Etale.Basic.localization_map (L202-L210)\ntheorem localization_map [FormallyEtale R S] : FormallyEtale R\u2098 S\u2098 := by\nhaveI : FormallyEtale S S\u2098 := FormallyEtale.of_isLocalization (M.map (algebraMap R S))\n haveI : FormallyEtale R S\u2098 := FormallyEtale.comp R S S\u2098\n exact FormallyEtale.localization_base M\n\nend Localization\n\nend FormallyEtale\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_of_surjective (L142-L148)\nlemma iff_of_surjective\n {R S : Type*} [CommRing R] [CommRing S]\n [Algebra R S] (h : Function.Surjective (algebraMap R S)) :\n Algebra.FormallyEtale R S \u2194 IsIdempotentElem (RingHom.ker (algebraMap R S)) := by\nrw [FormallyEtale.iff_formallyUnramified_and_formallySmooth, \u2190 FormallySmooth.iff_of_surjective h,\n and_iff_right (FormallyUnramified.of_surjective (Algebra.ofId R S) h)]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_formallyUnramified_and_formallySmooth (L66-L69)\ntheorem iff_formallyUnramified_and_formallySmooth :\n FormallyEtale R A \u2194 FormallyUnramified R A \u2227 FormallySmooth R A :=\n\u27e8fun _ \u21a6 \u27e8inferInstance, inferInstance\u27e9, fun \u27e8_, _\u27e9 \u21a6 \u27e8inferInstance, inferInstance\u27e9\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Etale.Basic.formallyEtale_algebraMap (L274-L277)\nlemma formallyEtale_algebraMap [Algebra R S] :\n (algebraMap R S).FormallyEtale \u2194 Algebra.FormallyEtale R S := by\nrw [FormallyEtale, toAlgebra_algebraMap]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Etale.Field.Algebra (L208-L223)\ntheorem Algebra.Etale.iff_exists_algEquiv_prod :\n Etale K A \u2194\n \u2203 (I : Type u) (_ : Finite I) (Ai : I \u2192 Type u) (_ : \u2200 i, Field (Ai i))\n (_ : \u2200 i, Algebra K (Ai i)) (_ : A \u2243\u2090[K] \u03a0 i, Ai i),\n \u2200 i, Module.Finite K (Ai i) \u2227 Algebra.IsSeparable K (Ai i) := by\nconstructor\n \u00b7 intro H\n obtain \u27e8I, _, Ai, _, _, e, _\u27e9 := (FormallyEtale.iff_exists_algEquiv_prod K A).mp inferInstance\n have := FormallyUnramified.finite_of_free K A\n exact \u27e8_, \u2039_\u203a, _, _, _, e, fun i \u21a6 \u27e8.of_surjective ((LinearMap.proj i).comp e.toLinearMap)\n ((Function.surjective_eval i).comp e.surjective), inferInstance\u27e9\u27e9\n \u00b7 intro \u27e8I, _, Ai, _, _, e, H\u27e9\n choose h\u2081 h\u2082 using H\n have := Module.Finite.of_surjective e.symm.toLinearMap e.symm.surjective\n refine \u27e8?_, FinitePresentation.of_finiteType.mp inferInstance\u27e9\n exact (FormallyEtale.iff_exists_algEquiv_prod K A).mpr \u27e8_, inferInstance, _, _, _, e, h\u2082\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Etale.Basic.FormallyEtale (L270-L273)\ndef FormallyEtale (f : R \u2192+* S) : Prop :=\nletI := f.toAlgebra\n Algebra.FormallyEtale R S\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Etale.Field.of_formallyUnramified_of_field (L163-L172)\nlemma of_formallyUnramified_of_field [EssFiniteType K A] [FormallyUnramified K A] :\n FormallyEtale K A := by\nhave := FormallyUnramified.isReduced_of_field K A\n have : IsArtinianRing A := .of_finite K A\n have (I : MaximalSpectrum A) : FormallyEtale K (A \u29f8 I.asIdeal) := by\n rw [FormallyEtale.iff_isSeparable, \u2190 FormallyUnramified.iff_isSeparable]\n infer_instance\n exact .of_equiv ((IsArtinianRing.equivPi A).restrictScalars K).symm\n\nvariable {K A} in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Etale.Field.of_isSeparable_aux (L56-L97)\ntheorem of_isSeparable_aux [Algebra.IsSeparable K L] [EssFiniteType K L] :\n FormallyEtale K L := by\n-- We already know that for field extensions\n -- IsSeparable + EssFiniteType => FormallyUnramified + Finite\n have := FormallyUnramified.of_isSeparable K L\n have := FormallyUnramified.finite_of_free (R := K) (S := L)\n -- We shall show that any `f : L \u2192 B/I` can be lifted to `L \u2192 B` if `I^2 = \u22a5`\n refine FormallyEtale.iff_comp_bijective.mpr fun B _ _ I h \u21a6 ?_\n refine \u27e8FormallyUnramified.iff_comp_injective_of_small.mp\n (FormallyUnramified.of_isSeparable K L) I h, ?_\u27e9\n intro f\n -- By separability and finiteness, we may assume `L = K(\u03b1)` with `p` the minpoly of `\u03b1`.\n let pb := Field.powerBasisOfFiniteOfSeparable K L\n -- Let `x : B` such that `f(\u03b1) = x` in `B / I`.\n obtain \u27e8x, hx\u27e9 := Ideal.Quotient.mk_surjective (f pb.gen)\n have helper : \u2200 x, IsScalarTower.toAlgHom K B (B \u29f8 I) x = Ideal.Quotient.mk I x := fun _ \u21a6 rfl\n -- Then `p(x) = 0 mod I`, and the goal is to find some `\u03b5 \u2208 I` such that\n -- `p(x + \u03b5) = p(x) + \u03b5 p'(x) = 0`, and we will get our lift into `B`.\n have hx' : Ideal.Quotient.mk I (aeval x (minpoly K pb.gen)) = 0 := by\n rw [\u2190 helper, \u2190 aeval_algHom_apply, helper, hx, aeval_algHom_apply, minpoly.aeval, map_zero]\n -- Since `p` is separable, `-p'(x)` is invertible in `B \u29f8 I`,\n obtain \u27e8u, hu\u27e9 : \u2203 u, (aeval x) (derivative (minpoly K pb.gen)) * u + 1 \u2208 I := by\n have := (isUnit_iff_ne_zero.mpr ((Algebra.IsSeparable.isSeparable K\n pb.gen).aeval_derivative_ne_zero (minpoly.aeval K _))).map f\n rw [\u2190 aeval_algHom_apply, \u2190 hx, \u2190 helper, aeval_algHom_apply, helper] at this\n obtain \u27e8u, hu\u27e9 := Ideal.Quotient.mk_surjective (-this.unit\u207b\u00b9 : B \u29f8 I)\n use u\n rw [\u2190 Ideal.Quotient.eq_zero_iff_mem, map_add, map_mul, map_one, hu, mul_neg,\n IsUnit.mul_val_inv, neg_add_cancel]\n -- And `\u03b5 = p(x)/(-p'(x))` works.\n use pb.liftEquiv.symm \u27e8x + u * aeval x (minpoly K pb.gen), ?_\u27e9\n \u00b7 apply pb.algHom_ext\n simp [hx, hx']\n \u00b7 rw [\u2190 eval_map_algebraMap, Polynomial.eval_add_of_sq_eq_zero, derivative_map,\n \u2190 one_mul (eval x _), eval_map_algebraMap, eval_map_algebraMap, \u2190 mul_assoc, \u2190 add_mul,\n \u2190 Ideal.mem_bot, \u2190 h, pow_two, add_comm]\n \u00b7 exact Ideal.mul_mem_mul hu (Ideal.Quotient.eq_zero_iff_mem.mp hx')\n rw [\u2190 Ideal.mem_bot, \u2190 h]\n apply Ideal.pow_mem_pow\n rw [\u2190 Ideal.Quotient.eq_zero_iff_mem, map_mul, hx', mul_zero]\n\nopen scoped IntermediateField in\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Etale.Basic.of_isLocalization (L190-L193)\ntheorem of_isLocalization : FormallyEtale R R\u2098 :=\nFormallyEtale.iff_formallyUnramified_and_formallySmooth.mpr\n \u27e8FormallyUnramified.of_isLocalization M, FormallySmooth.of_isLocalization M\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Etale.Basic.iff_restrictScalars (L129-L132)\nlemma iff_restrictScalars [FormallyEtale R A] :\n Algebra.FormallyEtale R B \u2194 Algebra.FormallyEtale A B :=\n\u27e8fun _ \u21a6 .of_restrictScalars (R := R), fun _ \u21a6 .comp _ A _\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Etale.Field.of_isSeparable (L98-L157)\nlemma of_isSeparable [Algebra.IsSeparable K L] : FormallyEtale K L := by\n-- We shall show that any `f : L \u2192 B/I` can be lifted to `L \u2192 B` if `I^2 = \u22a5`.\n refine FormallyEtale.iff_comp_bijective.mpr fun B _ _ I h \u21a6 ?_\n -- But we already know that there exists a unique lift for every finite subfield of `L`\n -- by `of_isSeparable_aux`, so we can glue them all together.\n refine \u27e8FormallyUnramified.iff_comp_injective_of_small.mp\n (FormallyUnramified.of_isSeparable K L) I h, ?_\u27e9\n intro f\n have : \u2200 k : L, \u2203! g : K\u27eek\u27ef \u2192\u2090[K] B,\n (Ideal.Quotient.mk\u2090 K I).comp g = f.comp (IsScalarTower.toAlgHom K _ L) := by\n intro k\n have := IsSeparable.of_algHom _ _ (IsScalarTower.toAlgHom K (K\u27eek\u27ef) L)\n have := IntermediateField.adjoin.finiteDimensional\n (Algebra.IsSeparable.isSeparable K k).isIntegral\n have := FormallyEtale.of_isSeparable_aux K (K\u27eek\u27ef)\n have := FormallyEtale.comp_bijective (R := K) (A := K\u27eek\u27ef) I h\n exact this.existsUnique _\n choose g hg\u2081 hg\u2082 using this\n have hg\u2083 : \u2200 x y (h : x \u2208 K\u27eey\u27ef), g y \u27e8x, h\u27e9 = g x (IntermediateField.AdjoinSimple.gen K x) := by\n intro x y h\n have e : K\u27eex\u27ef \u2264 K\u27eey\u27ef := by\n rw [IntermediateField.adjoin_le_iff]\n rintro _ rfl\n exact h\n rw [\u2190 hg\u2082 _ ((g _).comp (IntermediateField.inclusion e))]\n \u00b7 rfl\n apply AlgHom.ext\n rw [\u2190 AlgHom.comp_assoc, hg\u2081, AlgHom.comp_assoc]\n simp\n have H : \u2200 x y : L, \u2203 \u03b1 : L, x \u2208 K\u27ee\u03b1\u27ef \u2227 y \u2208 K\u27ee\u03b1\u27ef := by\n intro x y\n have : FiniteDimensional K K\u27eex, y\u27ef := by\n apply IntermediateField.finiteDimensional_adjoin\n intro x _; exact (Algebra.IsSeparable.isSeparable K x).isIntegral\n have := IsSeparable.of_algHom _ _ (IsScalarTower.toAlgHom K (K\u27eex, y\u27ef) L)\n obtain \u27e8\u27e8\u03b1, h\u03b1\u27e9, e\u27e9 := Field.exists_primitive_element K K\u27eex, y\u27ef\n apply_fun (IntermediateField.map (IntermediateField.val _)) at e\n rw [IntermediateField.adjoin_map, \u2190 AlgHom.fieldRange_eq_map] at e\n simp only [IntermediateField.coe_val, Set.image_singleton,\n IntermediateField.fieldRange_val] at e\n have hx : x \u2208 K\u27ee\u03b1\u27ef := e \u25b8 IntermediateField.subset_adjoin K {x, y} (by simp)\n have hy : y \u2208 K\u27ee\u03b1\u27ef := e \u25b8 IntermediateField.subset_adjoin K {x, y} (by simp)\n exact \u27e8\u03b1, hx, hy\u27e9\n refine \u27e8\u27e8\u27e8\u27e8\u27e8fun x \u21a6 g x (IntermediateField.AdjoinSimple.gen K x), ?_\u27e9, ?_\u27e9, ?_, ?_\u27e9, ?_\u27e9, ?_\u27e9\n \u00b7 change g 1 1 = 1; rw [map_one]\n \u00b7 intro x y\n obtain \u27e8\u03b1, hx, hy\u27e9 := H x y\n simp only [\u2190 hg\u2083 _ _ hx, \u2190 hg\u2083 _ _ hy, \u2190 map_mul, \u2190 hg\u2083 _ _ (mul_mem hx hy)]\n rfl\n \u00b7 change g 0 0 = 0; rw [map_zero]\n \u00b7 intro x y\n obtain \u27e8\u03b1, hx, hy\u27e9 := H x y\n simp only [\u2190 hg\u2083 _ _ hx, \u2190 hg\u2083 _ _ hy, \u2190 map_add, \u2190 hg\u2083 _ _ (add_mem hx hy)]\n rfl\n \u00b7 intro r\n change g _ (algebraMap K _ r) = _\n rw [AlgHom.commutes]\n \u00b7 ext x\n simpa using AlgHom.congr_fun (hg\u2081 x) (IntermediateField.AdjoinSimple.gen K x)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Etale/StandardEtale.lean", "module": "Mathlib.RingTheory.Etale.StandardEtale", "declaration": "Mathlib.RingTheory.Etale.StandardEtale.inv_aeval_X_g", "span": "L136-L141", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Etale/StandardEtale.lean#L136"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 10325, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 26325, "lean_code_chars": 24818, "natural_language_chars": 1507, "lean_code_ratio": 0.9428, "line_count": 641, "imports_count": 0, "declarations_count": 2770, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "524f720fb4bb11d4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.OmegaCompletePartialOrder.apply_mono", "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.Order.OmegaCompletePartialOrder)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem apply_mono {f g : \u03b1 \u2192\ud835\udc84 \u03b2} {x y : \u03b1} (h\u2081 : f \u2264 g) (h\u2082 : x \u2264 y) : f x \u2264 g y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.Chain (L71-L76)\ndef Chain (\u03b1 : Type u) [Preorder \u03b1] :=\n\u2115 \u2192o \u03b1\n\nnamespace Chain\nvariable [Preorder \u03b1] [Preorder \u03b2] [Preorder \u03b3]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.isChain_range (L95-L96)\nlemma isChain_range : IsChain (\u00b7 \u2264 \u00b7) (Set.range c) := Monotone.isChain_range (OrderHomClass.mono c)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.directed (L97-L101)\nlemma directed : Directed (\u00b7 \u2264 \u00b7) c := directedOn_range.2 c.isChain_range.directedOn\n/-- `map` function for `Chain` -/\n-- Not `@[simps]`: we need `@[simps!]` to see through the type synonym `Chain \u03b2 = \u2115 \u2192o \u03b2`,\n-- but then we'd get the `FunLike` instance for `OrderHom` instead.\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map (L102-L104)\ndef map : Chain \u03b2 :=\nf.comp c\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.mem_map (L109-L111)\ntheorem mem_map (x : \u03b1) : x \u2208 c \u2192 f x \u2208 Chain.map c f :=\nfun \u27e8i, h\u27e9 => \u27e8i, h.symm \u25b8 rfl\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.exists_of_mem_map (L112-L114)\ntheorem exists_of_mem_map {b : \u03b2} : b \u2208 c.map f \u2192 \u2203 a, a \u2208 c \u2227 f a = b :=\nfun \u27e8i, h\u27e9 => \u27e8c i, \u27e8i, rfl\u27e9, h.symm\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.mem_map_iff (L116-L121)\ntheorem mem_map_iff {b : \u03b2} : b \u2208 c.map f \u2194 \u2203 a, a \u2208 c \u2227 f a = b :=\n\u27e8exists_of_mem_map _, fun h => by\n rcases h with \u27e8w, h, h'\u27e9\n subst b\n apply mem_map c _ h\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map_id (L123-L125)\ntheorem map_id : c.map OrderHom.id = c :=\nOrderHom.comp_id _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map_comp (L126-L128)\ntheorem map_comp : (c.map f).map g = c.map (g.comp f) :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map_le_map (L130-L136)\ntheorem map_le_map {g : \u03b1 \u2192o \u03b2} (h : f \u2264 g) : c.map f \u2264 c.map g :=\nfun i => by simp only [map_coe, Function.comp_apply]; exists i; apply h\n\n/-- `OmegaCompletePartialOrder.Chain.zip` pairs up the elements of two chains\nthat have the same index. -/\n-- Not `@[simps]`: we need `@[simps!]` to see through the type synonym `Chain \u03b2 = \u2115 \u2192o \u03b2`,\n-- but then we'd get the `FunLike` instance for `OrderHom` instead.\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.zip (L137-L139)\ndef zip (c\u2080 : Chain \u03b1) (c\u2081 : Chain \u03b2) : Chain (\u03b1 \u00d7 \u03b2) :=\nOrderHom.prod c\u2080 c\u2081\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.pair (L143-L148)\ndef pair (a b : \u03b1) (hab : a \u2264 b) : Chain \u03b1 where\n toFun\n | 0 => a\n | _ => b\n monotone' _ _ _ := by aesop\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.le_\u03c9Sup_of_le (L192-L194)\ntheorem le_\u03c9Sup_of_le {c : Chain \u03b1} {x : \u03b1} (i : \u2115) (h : x \u2264 c i) : x \u2264 \u03c9Sup c :=\nle_trans h (le_\u03c9Sup c _)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.\u03c9Sup_total (L195-L203)\ntheorem \u03c9Sup_total {c : Chain \u03b1} {x : \u03b1} (h : \u2200 i, c i \u2264 x \u2228 x \u2264 c i) : \u03c9Sup c \u2264 x \u2228 x \u2264 \u03c9Sup c :=\nby_cases\n (fun (this : \u2200 i, c i \u2264 x) => Or.inl (\u03c9Sup_le _ _ this))\n (fun (this : \u00ac\u2200 i, c i \u2264 x) =>\n have : \u2203 i, \u00acc i \u2264 x := by simp only [not_forall] at this \u22a2; assumption\n let \u27e8i, hx\u27e9 := this\n have : x \u2264 c i := (h i).resolve_left hx\n Or.inr <| le_\u03c9Sup_of_le _ this)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.\u03c9Sup_le_\u03c9Sup_of_le (L205-L209)\ntheorem \u03c9Sup_le_\u03c9Sup_of_le {c\u2080 c\u2081 : Chain \u03b1} (h : c\u2080 \u2264 c\u2081) : \u03c9Sup c\u2080 \u2264 \u03c9Sup c\u2081 :=\n(\u03c9Sup_le _ _) fun i => by\n obtain \u27e8_, h\u27e9 := h i\n exact le_trans h (le_\u03c9Sup _ _)\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.Order.OmegaCompletePartialOrder).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem apply_mono {f g : \u03b1 \u2192\ud835\udc84 \u03b2} {x y : \u03b1} (h\u2081 : f \u2264 g) (h\u2082 : x \u2264 y) : f x \u2264 g y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.Chain (L71-L76)\ndef Chain (\u03b1 : Type u) [Preorder \u03b1] :=\n\u2115 \u2192o \u03b1\n\nnamespace Chain\nvariable [Preorder \u03b1] [Preorder \u03b2] [Preorder \u03b3]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.isChain_range (L95-L96)\nlemma isChain_range : IsChain (\u00b7 \u2264 \u00b7) (Set.range c) := Monotone.isChain_range (OrderHomClass.mono c)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.directed (L97-L101)\nlemma directed : Directed (\u00b7 \u2264 \u00b7) c := directedOn_range.2 c.isChain_range.directedOn\n/-- `map` function for `Chain` -/\n-- Not `@[simps]`: we need `@[simps!]` to see through the type synonym `Chain \u03b2 = \u2115 \u2192o \u03b2`,\n-- but then we'd get the `FunLike` instance for `OrderHom` instead.\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map (L102-L104)\ndef map : Chain \u03b2 :=\nf.comp c\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.mem_map (L109-L111)\ntheorem mem_map (x : \u03b1) : x \u2208 c \u2192 f x \u2208 Chain.map c f :=\nfun \u27e8i, h\u27e9 => \u27e8i, h.symm \u25b8 rfl\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.exists_of_mem_map (L112-L114)\ntheorem exists_of_mem_map {b : \u03b2} : b \u2208 c.map f \u2192 \u2203 a, a \u2208 c \u2227 f a = b :=\nfun \u27e8i, h\u27e9 => \u27e8c i, \u27e8i, rfl\u27e9, h.symm\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.mem_map_iff (L116-L121)\ntheorem mem_map_iff {b : \u03b2} : b \u2208 c.map f \u2194 \u2203 a, a \u2208 c \u2227 f a = b :=\n\u27e8exists_of_mem_map _, fun h => by\n rcases h with \u27e8w, h, h'\u27e9\n subst b\n apply mem_map c _ h\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map_id (L123-L125)\ntheorem map_id : c.map OrderHom.id = c :=\nOrderHom.comp_id _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map_comp (L126-L128)\ntheorem map_comp : (c.map f).map g = c.map (g.comp f) :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.map_le_map (L130-L136)\ntheorem map_le_map {g : \u03b1 \u2192o \u03b2} (h : f \u2264 g) : c.map f \u2264 c.map g :=\nfun i => by simp only [map_coe, Function.comp_apply]; exists i; apply h\n\n/-- `OmegaCompletePartialOrder.Chain.zip` pairs up the elements of two chains\nthat have the same index. -/\n-- Not `@[simps]`: we need `@[simps!]` to see through the type synonym `Chain \u03b2 = \u2115 \u2192o \u03b2`,\n-- but then we'd get the `FunLike` instance for `OrderHom` instead.\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.zip (L137-L139)\ndef zip (c\u2080 : Chain \u03b1) (c\u2081 : Chain \u03b2) : Chain (\u03b1 \u00d7 \u03b2) :=\nOrderHom.prod c\u2080 c\u2081\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.pair (L143-L148)\ndef pair (a b : \u03b1) (hab : a \u2264 b) : Chain \u03b1 where\n toFun\n | 0 => a\n | _ => b\n monotone' _ _ _ := by aesop\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.le_\u03c9Sup_of_le (L192-L194)\ntheorem le_\u03c9Sup_of_le {c : Chain \u03b1} {x : \u03b1} (i : \u2115) (h : x \u2264 c i) : x \u2264 \u03c9Sup c :=\nle_trans h (le_\u03c9Sup c _)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.\u03c9Sup_total (L195-L203)\ntheorem \u03c9Sup_total {c : Chain \u03b1} {x : \u03b1} (h : \u2200 i, c i \u2264 x \u2228 x \u2264 c i) : \u03c9Sup c \u2264 x \u2228 x \u2264 \u03c9Sup c :=\nby_cases\n (fun (this : \u2200 i, c i \u2264 x) => Or.inl (\u03c9Sup_le _ _ this))\n (fun (this : \u00ac\u2200 i, c i \u2264 x) =>\n have : \u2203 i, \u00acc i \u2264 x := by simp only [not_forall] at this \u22a2; assumption\n let \u27e8i, hx\u27e9 := this\n have : x \u2264 c i := (h i).resolve_left hx\n Or.inr <| le_\u03c9Sup_of_le _ this)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.OmegaCompletePartialOrder.\u03c9Sup_le_\u03c9Sup_of_le (L205-L209)\ntheorem \u03c9Sup_le_\u03c9Sup_of_le {c\u2080 c\u2081 : Chain \u03b1} (h : c\u2080 \u2264 c\u2081) : \u03c9Sup c\u2080 \u2264 \u03c9Sup c\u2081 :=\n(\u03c9Sup_le _ _) fun i => by\n obtain \u27e8_, h\u27e9 := h i\n exact le_trans h (le_\u03c9Sup _ _)\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/OmegaCompletePartialOrder.lean", "module": "Mathlib.Order.OmegaCompletePartialOrder", "declaration": "Mathlib.Order.OmegaCompletePartialOrder.apply_mono", "span": "L595-L597", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/OmegaCompletePartialOrder.lean#L595"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1558, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4160, "lean_code_chars": 3327, "natural_language_chars": 833, "lean_code_ratio": 0.7998, "line_count": 135, "imports_count": 0, "declarations_count": 487, "diagnostics_count": 0, "retrieval_snippets_count": 15, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "d970aec037c755d9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Analytic.Inverse.leftInv_coeff_one", "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.Analysis.Analytic.Inverse)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem leftInv_coeff_one (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.leftInv i x 1 = (continuousMultilinearCurryFin1 \ud835\udd5c F E).symm i.symm\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_coeff_zero (L76-L78)\ntheorem leftInv_coeff_zero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.leftInv i x 0 = ContinuousMultilinearMap.uncurry0 \ud835\udd5c _ x := by rw [leftInv]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_removeZero (L85-L100)\ntheorem leftInv_removeZero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.removeZero.leftInv i x = p.leftInv i x := by\next1 n\n induction n using Nat.strongRec' with | _ n IH\n match n with\n | 0 => simp -- if one replaces `simp` with `refl`, the proof times out in the kernel.\n | 1 => simp -- TODO: why?\n | n + 2 =>\n simp only [leftInv, neg_inj]\n refine Finset.sum_congr rfl fun c cuniv => ?_\n rcases c with \u27e8c, hc\u27e9\n ext v\n simp [IH _ hc]\n\n/-- The left inverse to a formal multilinear series is indeed a left inverse, provided its linear\nterm is invertible. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_comp (L101-L179)\ntheorem leftInv_comp (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n (leftInv p i x).comp p = id \ud835\udd5c E x := by\next n v\n classical\n match n with\n | 0 =>\n simp only [comp_coeff_zero', leftInv_coeff_zero, ContinuousMultilinearMap.uncurry0_apply,\n id_apply_zero]\n | 1 =>\n simp only [leftInv_coeff_one, comp_coeff_one, h, id_apply_one, ContinuousLinearEquiv.coe_apply,\n ContinuousLinearEquiv.symm_apply_apply, continuousMultilinearCurryFin1_symm_apply]\n | n + 2 =>\n have A :\n (Finset.univ : Finset (Composition (n + 2))) =\n {c | Composition.length c < n + 2}.toFinset \u222a {Composition.ones (n + 2)} := by\n refine Subset.antisymm (fun c _ => ?_) (subset_univ _)\n by_cases! h : c.length < n + 2\n \u00b7 simp [h]\n \u00b7 simp [Composition.eq_ones_iff_le_length.2 h]\n have B :\n Disjoint ({c | Composition.length c < n + 2} : Set (Composition (n + 2))).toFinset\n {Composition.ones (n + 2)} := by\n simp\n have C :\n ((p.leftInv i x (Composition.ones (n + 2)).length)\n fun j : Fin (Composition.ones n.succ.succ).length =>\n p 1 fun _ => v ((Fin.castLE (Composition.length_le _)) j)) =\n p.leftInv i x (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j := by\n apply FormalMultilinearSeries.congr _ (Composition.ones_length _) fun j hj1 hj2 => ?_\n exact FormalMultilinearSeries.congr _ rfl fun k _ _ => by congr\n have D :\n (p.leftInv i x (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j) =\n -\u2211 c \u2208 {c : Composition (n + 2) | c.length < n + 2}.toFinset,\n (p.leftInv i x c.length) (p.applyComposition c v) := by\n simp only [leftInv, ContinuousMultilinearMap.neg_apply, neg_inj,\n ContinuousMultilinearMap.sum_apply]\n convert\n (sum_toFinset_eq_subtype\n (fun c : Composition (n + 2) => c.length < n + 2)\n (fun c : Composition (n + 2) =>\n (ContinuousMultilinearMap.compAlongComposition\n (p.compContinuousLinearMap (i.symm : F \u2192L[\ud835\udd5c] E)) c (p.leftInv i x c.length))\n fun j : Fin (n + 2) => p 1 fun _ : Fin 1 => v j)).symm.trans\n _\n simp only [compContinuousLinearMap_applyComposition,\n ContinuousMultilinearMap.compAlongComposition_apply]\n congr\n ext c\n congr\n ext k\n simp [h]\n simp [FormalMultilinearSeries.comp, A, Finset.sum_union B,\n applyComposition_ones, C, D, -Set.toFinset_setOf, -Finset.union_singleton]\n\n/-! ### The right inverse of a formal multilinear series -/\n\n\n/-- The right inverse of a formal multilinear series, where the `n`-th term is defined inductively\nin terms of the previous ones to make sure that `p \u2218 (rightInv p i) = id`. For this, the linear\nterm `p\u2081` in `p` should be invertible. In the definition, `i` is a linear isomorphism that should\ncoincide with `p\u2081`, so that one can use its inverse in the construction. The definition does not\nuse that `i = p\u2081`, but proofs that the definition is well-behaved do.\n\nThe `n`-th term in `p \u2218 q` is `\u2211 p\u2096 (q_{j\u2081}, ..., q_{j\u2096})` over `j\u2081 + ... + j\u2096 = n`. In this\nexpression, `q\u2099` appears only once, in `p\u2081 (q\u2099)`. We adjust the definition of `q\u2099` so that this\nterm compensates the rest of the sum, using `i\u207b\u00b9` as an inverse to `p\u2081`.\n\nThese formulas only make sense when the constant term `p\u2080` vanishes. The definition we give is\ngeneral, but it ignores the value of `p\u2080`.\n-/\nnoncomputable def rightInv (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n FormalMultilinearSeries \ud835\udd5c F E\n | 0 => ContinuousMultilinearMap.uncurry0 \ud835\udd5c _ x\n | 1 => (continuousMultilinearCurryFin1 \ud835\udd5c F E).symm i.symm\n | n + 2 =>\n let q : FormalMultilinearSeries \ud835\udd5c F E := fun k => if k < n + 2 then rightInv p i x k else 0;\n -(i.symm : F \u2192L[\ud835\udd5c] E).compContinuousMultilinearMap ((p.comp q) (n + 2))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_coeff_zero (L181-L183)\ntheorem rightInv_coeff_zero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.rightInv i x 0 = ContinuousMultilinearMap.uncurry0 \ud835\udd5c _ x := by rw [rightInv]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_coeff_one (L185-L189)\ntheorem rightInv_coeff_one (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.rightInv i x 1 = (continuousMultilinearCurryFin1 \ud835\udd5c F E).symm i.symm := by rw [rightInv]\n/-- The right inverse does not depend on the zeroth coefficient of a formal multilinear\nseries. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_removeZero (L190-L202)\ntheorem rightInv_removeZero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.removeZero.rightInv i x = p.rightInv i x := by\next1 n\n induction n using Nat.strongRec' with | _ n IH\n match n with\n | 0 => simp only [rightInv_coeff_zero]\n | 1 => simp only [rightInv_coeff_one]\n | n + 2 =>\n simp only [rightInv, neg_inj]\n rw [removeZero_comp_of_pos _ _ (add_pos_of_nonneg_of_pos n.zero_le zero_lt_two)]\n congr (config := { closePost := false }) 2 with k\n by_cases hk : k < n + 2 <;> simp [hk, IH]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.comp_rightInv_aux1 (L203-L230)\ntheorem comp_rightInv_aux1 {n : \u2115} (hn : 0 < n) (p : FormalMultilinearSeries \ud835\udd5c E F)\n (q : FormalMultilinearSeries \ud835\udd5c F E) (v : Fin n \u2192 F) :\n p.comp q n v =\n \u2211 c \u2208 {c : Composition n | 1 < c.length}.toFinset,\n p c.length (q.applyComposition c v) + p 1 fun _ => q n v := by\nclassical\n have A :\n (Finset.univ : Finset (Composition n)) =\n {c | 1 < Composition.length c}.toFinset \u222a {Composition.single n hn} := by\n refine Subset.antisymm (fun c _ => ?_) (subset_univ _)\n by_cases h : 1 < c.length\n \u00b7 simp [h]\n \u00b7 have : c.length = 1 := by\n refine (eq_iff_le_not_lt.2 \u27e8?_, h\u27e9).symm; exact c.length_pos_of_pos hn\n rw [\u2190 Composition.eq_single_iff_length hn] at this\n simp [this]\n have B :\n Disjoint ({c | 1 < Composition.length c} : Set (Composition n)).toFinset\n {Composition.single n hn} := by\n simp\n have C :\n p (Composition.single n hn).length (q.applyComposition (Composition.single n hn) v) =\n p 1 fun _ : Fin 1 => q n v := by\n apply p.congr (Composition.single_length hn) fun j hj1 _ => ?_\n simp [applyComposition_single]\n simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, C, -Set.toFinset_setOf,\n -add_right_inj, -Composition.single_length, -Finset.union_singleton]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.comp_rightInv_aux2 (L231-L246)\ntheorem comp_rightInv_aux2 (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) (n : \u2115)\n (v : Fin (n + 2) \u2192 F) :\n \u2211 c \u2208 {c : Composition (n + 2) | 1 < c.length}.toFinset,\n p c.length (applyComposition (fun k : \u2115 => ite (k < n + 2) (p.rightInv i x k) 0) c v) =\n \u2211 c \u2208 {c : Composition (n + 2) | 1 < c.length}.toFinset,\n p c.length ((p.rightInv i x).applyComposition c v) := by\nhave N : 0 < n + 2 := by simp\n refine sum_congr rfl fun c hc => p.congr rfl fun j hj1 hj2 => ?_\n have : \u2200 k, c.blocksFun k < n + 2 := by\n simp only [Set.mem_toFinset (s := {c : Composition (n + 2) | 1 < c.length}),\n Set.mem_setOf_eq] at hc\n simp [\u2190 Composition.ne_single_iff N, Composition.eq_single_iff_length, ne_of_gt hc]\n simp [applyComposition, this]\n\n/-- The right inverse to a formal multilinear series is indeed a right inverse, provided its linear\nterm is invertible and its constant term vanishes. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.comp_rightInv (L247-L263)\ntheorem comp_rightInv (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n p.comp (rightInv p i x) = id \ud835\udd5c F (p 0 0) := by\next (n v)\n match n with\n | 0 =>\n simp only [comp_coeff_zero', Matrix.zero_empty, id_apply_zero]\n congr\n ext i\n exact i.elim0\n | 1 =>\n simp only [comp_coeff_one, h, rightInv_coeff_one, ContinuousLinearEquiv.apply_symm_apply,\n id_apply_one, ContinuousLinearEquiv.coe_apply, continuousMultilinearCurryFin1_symm_apply]\n | n + 2 =>\n have N : 0 < n + 2 := by simp\n simp [comp_rightInv_aux1 N, h, rightInv, comp_rightInv_aux2, -Set.toFinset_setOf]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_coeff (L264-L283)\ntheorem rightInv_coeff (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (n : \u2115) (hn : 2 \u2264 n) :\n p.rightInv i x n =\n -(i.symm : F \u2192L[\ud835\udd5c] E).compContinuousMultilinearMap\n (\u2211 c \u2208 ({c | 1 < Composition.length c}.toFinset : Finset (Composition n)),\n p.compAlongComposition (p.rightInv i x) c) := by\nmatch n with\n | 0 => exact False.elim (zero_lt_two.not_ge hn)\n | 1 => exact False.elim (one_lt_two.not_ge hn)\n | n + 2 =>\n simp only [rightInv, neg_inj]\n congr (config := { closePost := false }) 1\n ext v\n have N : 0 < n + 2 := by simp\n have : ((p 1) fun _ : Fin 1 => 0) = 0 := ContinuousMultilinearMap.map_zero _\n simp [comp_rightInv_aux1 N, this, comp_rightInv_aux2, -Set.toFinset_setOf]\n\n/-! ### Coincidence of the left and the right inverse -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_eq_rightInv (L284-L366)\ntheorem leftInv_eq_rightInv (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n leftInv p i x = rightInv p i x :=\ncalc\n leftInv p i x = (leftInv p i x).comp (id \ud835\udd5c F (p 0 0)) := by simp\n _ = (leftInv p i x).comp (p.comp (rightInv p i x)) := by rw [comp_rightInv p i _ h]\n _ = ((leftInv p i x).comp p).comp (rightInv p i x) := by rw [comp_assoc]\n _ = (id \ud835\udd5c E x).comp (rightInv p i x) := by rw [leftInv_comp p i _ h]\n _ = rightInv p i x := by simp [id_comp' _ _ 0]\n\n/-!\n### Convergence of the inverse of a power series\n\nAssume that `p` is a convergent multilinear series, and let `q` be its (left or right) inverse.\nUsing the left-inverse formula gives\n$$\nq_n = - (p_1)^{-n} \\sum_{k=0}^{n-1} \\sum_{i_1 + \\dotsc + i_k = n} q_k (p_{i_1}, \\dotsc, p_{i_k}).\n$$\nAssume for simplicity that we are in dimension `1` and `p\u2081 = 1`. In the formula for `q\u2099`, the term\n`q_{n-1}` appears with a multiplicity of `n-1` (choosing the index `i_j` for which `i_j = 2` while\nall the other indices are equal to `1`), which indicates that `q\u2099` might grow like `n!`. This is\nbad for summability properties.\n\nIt turns out that the right-inverse formula is better behaved, and should instead be used for this\nkind of estimate. It reads\n$$\nq_n = - (p_1)^{-1} \\sum_{k=2}^n \\sum_{i_1 + \\dotsc + i_k = n} p_k (q_{i_1}, \\dotsc, q_{i_k}).\n$$\nHere, `q_{n-1}` can only appear in the term with `k = 2`, and it only appears twice, so there is\nhope this formula can lead to an at most geometric behavior.\n\nLet `Q\u2099 = \u2016q\u2099\u2016`. Bounding `\u2016p\u2096\u2016` with `C r^k` gives an inequality\n$$\nQ_n \u2264 C' \\sum_{k=2}^n r^k \\sum_{i_1 + \\dotsc + i_k = n} Q_{i_1} \\dotsm Q_{i_k}.\n$$\n\nThis formula is not enough to prove by naive induction on `n` a bound of the form `Q\u2099 \u2264 D R^n`.\nHowever, assuming that the inequality above were an equality, one could get a formula for the\ngenerating series of the `Q\u2099`:\n\n$$\n\\begin{align}\nQ(z) & := \\sum Q_n z^n = Q_1 z + C' \\sum_{2 \\leq k \\leq n} \\sum_{i_1 + \\dotsc + i_k = n}\n (r z^{i_1} Q_{i_1}) \\dotsm (r z^{i_k} Q_{i_k})\n\\\\ & = Q_1 z + C' \\sum_{k = 2}^\\infty (\\sum_{i_1 \\geq 1} r z^{i_1} Q_{i_1})\n \\dotsm (\\sum_{i_k \\geq 1} r z^{i_k} Q_{i_k})\n\\\\ & = Q_1 z + C' \\sum_{k = 2}^\\infty (r Q(z))^k\n= Q_1 z + C' (r Q(z))^2 / (1 - r Q(z)).\n\\end{align}\n$$\n\nOne can solve this formula explicitly. The solution is analytic in a neighborhood of `0` in `\u2102`,\nhence its coefficients grow at most geometrically (by a contour integral argument), and therefore\nthe original `Q\u2099`, which are bounded by these ones, are also at most geometric.\n\nThis classical argument is not really satisfactory, as it requires an a priori bound on a complex\nanalytic function. Another option would be to compute explicitly its terms (with binomial\ncoefficients) to obtain an explicit geometric bound, but this would be very painful.\n\nInstead, we will use the above intuition, but in a slightly different form, with finite sums and an\ninduction. I learnt this trick in [poeschel2017siegelsternberg]. Let\n$S_n = \\sum_{k=1}^n Q_k a^k$ (where `a` is a positive real parameter to be chosen suitably small).\nThe above computation but with finite sums shows that\n\n$$\nS_n \\leq Q_1 a + C' \\sum_{k=2}^n (r S_{n-1})^k.\n$$\n\nIn particular, $S_n \\leq Q_1 a + C' (r S_{n-1})^2 / (1- r S_{n-1})$.\nAssume that $S_{n-1} \\leq K a$, where `K > Q\u2081` is fixed and `a` is small enough so that\n`r K a \u2264 1/2` (to control the denominator). Then this equation gives a bound\n$S_n \\leq Q_1 a + 2 C' r^2 K^2 a^2$.\nIf `a` is small enough, this is bounded by `K a` as the second term is quadratic in `a`, and\ntherefore negligible.\n\nBy induction, we deduce `S\u2099 \u2264 K a` for all `n`, which gives in particular the fact that `a\u207f Q\u2099`\nremains bounded.\n-/\n\n\n/-- First technical lemma to control the growth of coefficients of the inverse. Bound the explicit\nexpression for `\u2211_{k mul_nonneg hr (mul_nonneg (pow_nonneg ha _) (hp _))\n rintro \u27e8k, c\u27e9 hd\n simp only [Set.mem_toFinset (s := {c | 1 < Composition.length c}), mem_Ico, mem_sigma,\n Set.mem_setOf_eq] at hd\n simp only [mem_compPartialSumTarget_iff]\n refine \u27e8hd.2, c.length_le.trans_lt hd.1.2, fun j => ?_\u27e9\n have : c \u2260 Composition.single k (zero_lt_two.trans_le hd.1.1) := by\n simp [Composition.eq_single_iff_length, ne_of_gt hd.2]\n rw [Composition.ne_single_iff] at this\n exact (this j).trans_le (Nat.lt_succ_iff.mp hd.1.2)\n _ = \u2211 e \u2208 compPartialSumSource 2 (n + 1) n, \u220f j : Fin e.1, r * (a ^ e.2 j * p (e.2 j)) := by\n symm\n apply compChangeOfVariables_sum\n rintro \u27e8k, blocksFun\u27e9 H\n have K : (compChangeOfVariables 2 (n + 1) n \u27e8k, blocksFun\u27e9 H).snd.length = k := by simp\n congr 2 <;> try rw [K]\n rw [Fin.heq_fun_iff K.symm]\n intro j\n rw [compChangeOfVariables_blocksFun]\n _ = \u2211 j \u2208 Ico 2 (n + 1), r ^ j * (\u2211 k \u2208 Ico 1 n, a ^ k * p k) ^ j := by\n rw [compPartialSumSource,\n \u2190 sum_sigma' (Ico 2 (n + 1))\n (fun k : \u2115 => (Fintype.piFinset fun _ : Fin k => Ico 1 n : Finset (Fin k \u2192 \u2115)))\n (fun n e => \u220f j : Fin n, r * (a ^ e j * p (e j)))]\n congr! with j\n simp only [\u2190 @MultilinearMap.mkPiAlgebra_apply \u211d (Fin j) _ \u211d]\n simp only [\u2190\n MultilinearMap.map_sum_finset (MultilinearMap.mkPiAlgebra \u211d (Fin j) \u211d) fun _ (m : \u2115) =>\n r * (a ^ m * p m)]\n simp only [MultilinearMap.mkPiAlgebra_apply]\n simp [prod_const, \u2190 mul_sum, mul_pow]\n\n/-- Second technical lemma to control the growth of coefficients of the inverse. Bound the explicit\nexpression for `\u2211_{k \u2016p.rightInv i x k\u2016)\n (fun k => norm_nonneg _) hr ha\n\n/-- If a a formal multilinear series has a positive radius of convergence, then its right inverse\nalso has a positive radius of convergence. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.radius_rightInv_pos_of_radius_pos (L483-L553)\ntheorem radius_rightInv_pos_of_radius_pos\n {p : FormalMultilinearSeries \ud835\udd5c E F} {i : E \u2243L[\ud835\udd5c] F} {x : E}\n (hp : 0 < p.radius) : 0 < (p.rightInv i x).radius := by\nobtain \u27e8C, r, Cpos, rpos, ple\u27e9 :\n \u2203 (C r : _) (_ : 0 < C) (_ : 0 < r), \u2200 n : \u2115, \u2016p n\u2016 \u2264 C * r ^ n :=\n le_mul_pow_of_radius_pos p hp\n let I := \u2016(i.symm : F \u2192L[\ud835\udd5c] E)\u2016\n -- choose `a` small enough to make sure that `\u2211_{k \u2264 n} a\u1d4f Q\u2096` will be controllable by\n -- induction\n obtain \u27e8a, apos, ha1, ha2\u27e9 :\n \u2203 (a : _) (apos : 0 < a),\n 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a \u2264 1 \u2227 r * (I + 1) * a \u2264 1 / 2 := by\n have :\n Tendsto (fun a => 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a) (\ud835\udcdd 0)\n (\ud835\udcdd (2 * I * C * r ^ 2 * (I + 1) ^ 2 * 0)) :=\n tendsto_const_nhds.mul tendsto_id\n have A : \u2200\u1da0 a in \ud835\udcdd 0, 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a < 1 := by\n apply (tendsto_order.1 this).2; simp [zero_lt_one]\n have : Tendsto (fun a => r * (I + 1) * a) (\ud835\udcdd 0) (\ud835\udcdd (r * (I + 1) * 0)) :=\n tendsto_const_nhds.mul tendsto_id\n have B : \u2200\u1da0 a in \ud835\udcdd 0, r * (I + 1) * a < 1 / 2 := by\n apply (tendsto_order.1 this).2; simp\n have C : \u2200\u1da0 a in \ud835\udcdd[>] (0 : \u211d), (0 : \u211d) < a := by\n filter_upwards [self_mem_nhdsWithin] with _ ha using ha\n rcases (C.and ((A.and B).filter_mono inf_le_left)).exists with \u27e8a, ha\u27e9\n exact \u27e8a, ha.1, ha.2.1.le, ha.2.2.le\u27e9\n -- check by induction that the partial sums are suitably bounded, using the choice of `a` and the\n -- inductive control from Lemma `radius_rightInv_pos_of_radius_pos_aux2`.\n let S n := \u2211 k \u2208 Ico 1 n, a ^ k * \u2016p.rightInv i x k\u2016\n have IRec : \u2200 n, 1 \u2264 n \u2192 S n \u2264 (I + 1) * a := by\n apply Nat.le_induction\n \u00b7 simp only [S]\n rw [Ico_eq_empty_of_le (le_refl 1), sum_empty]\n exact mul_nonneg (add_nonneg (norm_nonneg _) zero_le_one) apos.le\n \u00b7 intro n one_le_n hn\n have In : 2 \u2264 n + 1 := by lia\n have rSn : r * S n \u2264 1 / 2 :=\n calc\n r * S n \u2264 r * ((I + 1) * a) := by gcongr\n _ \u2264 1 / 2 := by rwa [\u2190 mul_assoc]\n calc\n S (n + 1) \u2264 I * a + I * C * \u2211 k \u2208 Ico 2 (n + 1), (r * S n) ^ k :=\n radius_rightInv_pos_of_radius_pos_aux2 In p i rpos.le apos.le Cpos.le ple\n _ = I * a + I * C * (((r * S n) ^ 2 - (r * S n) ^ (n + 1)) / (1 - r * S n)) := by\n rw [geom_sum_Ico' _ In]; exact ne_of_lt (rSn.trans_lt (by norm_num))\n _ \u2264 I * a + I * C * ((r * S n) ^ 2 / (1 / 2)) := by\n gcongr\n \u00b7 simp only [sub_le_self_iff]\n positivity\n \u00b7 linarith only [rSn]\n _ = I * a + 2 * I * C * (r * S n) ^ 2 := by ring\n _ \u2264 I * a + 2 * I * C * (r * ((I + 1) * a)) ^ 2 := by gcongr\n _ = (I + 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a) * a := by ring\n _ \u2264 (I + 1) * a := by gcongr\n -- conclude that all coefficients satisfy `a\u207f Q\u2099 \u2264 (I + 1) a`.\n let a' : NNReal := \u27e8a, apos.le\u27e9\n suffices H : (a' : ENNReal) \u2264 (p.rightInv i x).radius by\n apply lt_of_lt_of_le _ H\n -- Prior to https://github.com/leanprover/lean4/pull/2734, this was `exact_mod_cast apos`.\n simpa only [ENNReal.coe_pos]\n apply le_radius_of_eventually_le _ ((I + 1) * a)\n filter_upwards [Ici_mem_atTop 1] with n (hn : 1 \u2264 n)\n calc\n \u2016p.rightInv i x n\u2016 * (a' : \u211d) ^ n = a ^ n * \u2016p.rightInv i x n\u2016 := mul_comm _ _\n _ \u2264 \u2211 k \u2208 Ico 1 (n + 1), a ^ k * \u2016p.rightInv i x k\u2016 :=\n (haveI : \u2200 k \u2208 Ico 1 (n + 1), 0 \u2264 a ^ k * \u2016p.rightInv i x k\u2016 := fun k _ => by positivity\n single_le_sum this (by simp [hn]))\n _ \u2264 (I + 1) * a := IRec (n + 1) (by simp)\n\n/-- If a a formal multilinear series has a positive radius of convergence, then its left inverse\nalso has a positive radius of convergence. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.radius_leftInv_pos_of_radius_pos (L554-L568)\ntheorem radius_leftInv_pos_of_radius_pos\n {p : FormalMultilinearSeries \ud835\udd5c E F} {i : E \u2243L[\ud835\udd5c] F} {x : E}\n (hp : 0 < p.radius) (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n 0 < (p.leftInv i x).radius := by\nrw [leftInv_eq_rightInv _ _ _ h]\n exact radius_rightInv_pos_of_radius_pos hp\n\nend FormalMultilinearSeries\n\n/-!\n### The inverse of an analytic open partial homeomorphism is analytic\n-/\n\nopen FormalMultilinearSeries List\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticAt_congr (L495-L497)\ntheorem analyticAt_congr (h : f =\u1da0[\ud835\udcdd x] g) : AnalyticAt \ud835\udd5c f x \u2194 AnalyticAt \ud835\udd5c g x :=\n\u27e8fun hf \u21a6 hf.congr h, fun hg \u21a6 hg.congr h.symm\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Analytic.Basic.ContinuousLinearMap (L546-L557)\ntheorem ContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall (g : F \u2192L[\ud835\udd5c] G)\n (h : HasFPowerSeriesWithinOnBall f p s x r) :\n HasFPowerSeriesWithinOnBall (g \u2218 f) (g.compFormalMultilinearSeries p) s x r where\n r_le := h.r_le.trans (p.radius_le_radius_continuousLinearMap_comp _)\nr_pos := h.r_pos\n hasSum hy h'y := by\n simpa only [ContinuousLinearMap.compFormalMultilinearSeries_apply,\n ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply] using\n g.hasSum (h.hasSum hy h'y)\n\n/-- If a function `f` has a power series `p` on a ball and `g` is linear, then `g \u2218 f` has the\npower series `g \u2218 p` on the same ball. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)\ntheorem one_add_cpow_hasFPowerSeriesAt_zero {a : \u2102} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 :=\none_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)\ntheorem binomialSeries_radius_ge_one {\ud835\udd42 : Type*} [RCLike \ud835\udd42] {\ud835\udd38 : Type*} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} :\n 1 \u2264 (binomialSeries \ud835\udd38 a).radius := by\nby_cases ha : \u2200 (k : \u2115), a \u2260 k\n \u00b7 rw [binomialSeries_radius_eq_one ha]\n \u00b7 push Not at ha\n rcases ha with \u27e8k, rfl\u27e9\n simp [binomialSeries_radius_eq_top_of_nat]\n\nnamespace Complex\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesWithinAt_iff_of_nhds (L391-L397)\nlemma hasFPowerSeriesWithinAt_iff_of_nhds (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F)\n {U : Set E} (hU : U \u2208 \ud835\udcdd x) :\n HasFPowerSeriesWithinAt f p U x \u2194 HasFPowerSeriesAt f p x := by\nrw [\u2190 hasFPowerSeriesWithinAt_univ]\n exact \u27e8fun h \u21a6 h.mono_of_mem_nhdsWithin (mem_nhdsWithin_of_mem_nhds hU),\n fun h \u21a6 h.mono (subset_univ _)\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff (L1106-L1127)\ntheorem hasFPowerSeriesAt_iff :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd 0, HasSum (fun n => z ^ n \u2022 p.coeff n) (f (z\u2080 + z)) := by\nrefine \u27e8fun \u27e8r, _, r_pos, h\u27e9 =>\n eventually_of_mem (Metric.eball_mem_nhds 0 r_pos) fun _ => by simpa using h, ?_\u27e9\n simp only [Metric.eventually_nhds_iff]\n rintro \u27e8r, r_pos, h\u27e9\n refine \u27e8p.radius \u2293 r.toNNReal, by simp, ?_, ?_\u27e9\n \u00b7 simp only [r_pos.lt, lt_inf_iff, ENNReal.coe_pos, Real.toNNReal_pos, and_true]\n obtain \u27e8z, z_pos, le_z\u27e9 := NormedField.exists_norm_lt \ud835\udd5c r_pos.lt\n have : (\u2016z\u2016\u208a : ENNReal) \u2264 p.radius := by\n simp only [dist_zero_right] at h\n apply FormalMultilinearSeries.le_radius_of_tendsto\n convert tendsto_norm.comp (h le_z).summable.tendsto_atTop_zero\n simp [norm_smul, mul_comm]\n refine lt_of_lt_of_le ?_ this\n simp only [ENNReal.coe_pos]\n exact zero_lt_iff.mpr (nnnorm_ne_zero_iff.mpr (norm_pos_iff.mp z_pos))\n \u00b7 simp only [Metric.mem_eball, lt_inf_iff, edist_lt_coe, apply_eq_pow_smul_coeff, and_imp,\n dist_zero_right] at h \u22a2\n refine fun {y} _ hyr => h ?_\n simpa [nndist_eq_nnnorm, Real.lt_toNNReal_iff_coe_lt] using hyr\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)\ntheorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave H : ((binomialSeries \u2102 (-a)).compContinuousLinearMap (-1)) =\n .ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n := by\n ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,\n Units.smul_def, \u2190 pow_add, \u2190 mul_assoc]\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (-a)) (binomialSeries \u2102 (-a : \u2102)) (-0) 1 := by\n simpa using one_add_cpow_hasFPowerSeriesOnBall_zero\n simpa [cpow_neg, Function.comp_def, \u2190 sub_eq_add_neg, H] using\n this.compContinuousLinearMap (u := -1) (x := (0 : \u2102))\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)\ntheorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :\n HasFPowerSeriesAt f p x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesWithinAt f p s x\n\n/-- Given a function `f : E \u2192 F`, we say that `f` is analytic on a set `s` if it is analytic around\nevery point of `s`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E) :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesAt f p x\n\n/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `\ud835\udcdd[s] x` -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOn (L123-L131)\ndef AnalyticOn (f : E \u2192 F) (s : Set E) : Prop :=\n\u2200 x \u2208 s, AnalyticWithinAt \ud835\udd5c f s x\n\n/-!\n### `HasFPowerSeriesOnBall` and `HasFPowerSeriesWithinOnBall`\n-/\n\nvariable {\ud835\udd5c}\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)\ntheorem binomialSeries_radius_eq_top_of_nat {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u}\n [NormedDivisionRing \ud835\udd38] [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \u2115} :\n (binomialSeries \ud835\udd38 (a : \ud835\udd42)).radius = \u22a4 := by\nsimp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n ordinaryHypergeometric_radius_top_of_neg_nat\u2081]\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `1`, when `a` is not natural. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)\ntheorem binomialSeries_eq_ordinaryHypergeometricSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42]\n {\ud835\udd38 : Type v} [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] {a b : \ud835\udd42}\n (h : \u2200 (k : \u2115), (k : \ud835\udd42) \u2260 -b) :\n binomialSeries \ud835\udd38 a =\n (ordinaryHypergeometricSeries \ud835\udd38 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by\nsimp only [binomialSeries, ordinaryHypergeometricSeries,\n FormalMultilinearSeries.ofScalars_comp_neg_id]\n congr! with n\n rw [ordinaryHypergeometricCoefficient,\n mul_inv_cancel_right\u2080 (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]\n simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,\n Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,\n ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]\n ring_nf\n simp\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `\u22a4` for natural `a`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff' (L1128-L1132)\ntheorem hasFPowerSeriesAt_iff' :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd z\u2080, HasSum (fun n => (z - z\u2080) ^ n \u2022 p.coeff n) (f z) := by\nrw [\u2190 map_add_left_nhds_zero, eventually_map, hasFPowerSeriesAt_iff]\n simp_rw [add_sub_cancel_left]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)\ntheorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : \u2102} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 1 := by\nsuffices (binomialSeries \u2102 a = FormalMultilinearSeries.ofScalars \u2102\n fun n \u21a6 iteratedDeriv n (fun (x : \u2102) \u21a6 (1 + x) ^ a) 0 / n !) by\n convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _\n \u00b7 norm_num\n \u00b7 -- TODO: use `fun_prop` for this subgoal\n apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const\n intro z hz\n apply Complex.mem_slitPlane_of_norm_lt_one\n rw [\u2190 ENNReal.ofReal_one, Metric.eball_ofReal] at hz\n simpa using hz\n \u00b7 rw [\u2190 this]\n exact binomialSeries_radius_ge_one\n simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]\n ext n\n rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), \u2190 nsmul_eq_mul',\n \u2190 Ring.descPochhammer_eq_factorial_smul_choose]\n let B := Metric.ball (0 : \u2102) 1\n suffices Set.EqOn (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B)\n (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - n)) B by\n specialize this (show 0 \u2208 _ by simp [B])\n rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this\n symm\n simpa using this\n induction n with\n | zero => simp [Set.EqOn]\n | succ n ih =>\n have : iteratedDerivWithin (n + 1) (fun (x : \u2102) \u21a6 (1 + x) ^ a) B =\n derivWithin (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B) B := by\n ext z\n rw [iteratedDerivWithin_succ]\n rw [this]\n have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : \u2102) \u21a6 (1 + x) ^ a) B) B)\n (derivWithin (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - \u2191n)) B) B := by\n intro z hz\n rw [derivWithin_congr (fun _ hz \u21a6 ih hz) (ih hz)]\n apply Set.EqOn.trans this\n intro z hz\n simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,\n deriv_const_mul_field']\n rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,\n show a - (n + 1) = a - n - 1 by ring, \u2190 mul_assoc]\n \u00b7 congr\n simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]\n \u00b7 apply Complex.mem_slitPlane_of_norm_lt_one\n simpa [B] using hz\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)\ntheorem binomialSeries_radius_eq_one {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} (ha : \u2200 (k : \u2115), a \u2260 k) : (binomialSeries \ud835\udd38 a).radius = 1 := by\nsimp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n FormalMultilinearSeries.radius_compNeg]\n conv at ha => ext; rw [ne_comm]\n exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)\ntheorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt\n (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr (L514-L516)\ntheorem analyticOnNhd_congr (hs : IsOpen s) (h : s.EqOn f g) : AnalyticOnNhd \ud835\udd5c f s \u2194\n AnalyticOnNhd \ud835\udd5c g s := \u27e8fun hf => hf.congr hs h, fun hg => hg.congr hs h.symm\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr' (L506-L508)\ntheorem analyticOnNhd_congr' (h : f =\u1da0[\ud835\udcdd\u02e2 s] g) : AnalyticOnNhd \ud835\udd5c f s \u2194 AnalyticOnNhd \ud835\udd5c g s :=\n\u27e8fun hf => hf.congr' h, fun hg => hg.congr' h.symm\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E) :=\n\u2203 r, HasFPowerSeriesWithinOnBall f p s x r\n\n-- Teach the `bound` tactic that power series have positive radius\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)\nlemma Complex.ofReal_choose (a : \u211d) (n : \u2115) :\n \u2191(Ring.choose a n) = Ring.choose (a : \u2102) n :=\nRing.map_choose (algebraMap \u211d \u2102) _ _\n\n/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given\nby `Ring.choose a`. The sum of this series is `fun x \u21a6 (1 + x) ^ a` within the radius\nof convergence. -/\nnoncomputable def binomialSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) :\n FormalMultilinearSeries \ud835\udd42 \ud835\udd38 \ud835\udd38 :=\n .ofScalars \ud835\udd38 (Ring.choose a \u00b7)\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E) :=\n\u2203 r, HasFPowerSeriesOnBall f p x r\n\n/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOn_congr (L488-L490)\nlemma analyticOn_congr (hs : EqOn f g s) : AnalyticOn \ud835\udd5c f s \u2194 AnalyticOn \ud835\udd5c g s :=\n\u27e8fun h \u21a6 h.congr hs.symm, fun h \u21a6 h.congr hs\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)\ntheorem binomialSeries_apply {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) {n} (v : Fin n \u2192 \ud835\udd38) :\n binomialSeries \ud835\udd38 a n v = Ring.choose a n \u2022 (List.ofFn v).prod := by\nsimp [binomialSeries, FormalMultilinearSeries.ofScalars]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E) :=\n\u2200 x, x \u2208 s \u2192 AnalyticAt \ud835\udd5c f x\n\n/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that\nthis is weaker than `AnalyticOnNhd \ud835\udd5c f s`, as `f` is allowed to be arbitrary outside `s`. -/\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.Analysis.Analytic.Inverse).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem leftInv_coeff_one (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.leftInv i x 1 = (continuousMultilinearCurryFin1 \ud835\udd5c F E).symm i.symm\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_coeff_zero (L76-L78)\ntheorem leftInv_coeff_zero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.leftInv i x 0 = ContinuousMultilinearMap.uncurry0 \ud835\udd5c _ x := by rw [leftInv]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_removeZero (L85-L100)\ntheorem leftInv_removeZero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.removeZero.leftInv i x = p.leftInv i x := by\next1 n\n induction n using Nat.strongRec' with | _ n IH\n match n with\n | 0 => simp -- if one replaces `simp` with `refl`, the proof times out in the kernel.\n | 1 => simp -- TODO: why?\n | n + 2 =>\n simp only [leftInv, neg_inj]\n refine Finset.sum_congr rfl fun c cuniv => ?_\n rcases c with \u27e8c, hc\u27e9\n ext v\n simp [IH _ hc]\n\n/-- The left inverse to a formal multilinear series is indeed a left inverse, provided its linear\nterm is invertible. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_comp (L101-L179)\ntheorem leftInv_comp (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n (leftInv p i x).comp p = id \ud835\udd5c E x := by\next n v\n classical\n match n with\n | 0 =>\n simp only [comp_coeff_zero', leftInv_coeff_zero, ContinuousMultilinearMap.uncurry0_apply,\n id_apply_zero]\n | 1 =>\n simp only [leftInv_coeff_one, comp_coeff_one, h, id_apply_one, ContinuousLinearEquiv.coe_apply,\n ContinuousLinearEquiv.symm_apply_apply, continuousMultilinearCurryFin1_symm_apply]\n | n + 2 =>\n have A :\n (Finset.univ : Finset (Composition (n + 2))) =\n {c | Composition.length c < n + 2}.toFinset \u222a {Composition.ones (n + 2)} := by\n refine Subset.antisymm (fun c _ => ?_) (subset_univ _)\n by_cases! h : c.length < n + 2\n \u00b7 simp [h]\n \u00b7 simp [Composition.eq_ones_iff_le_length.2 h]\n have B :\n Disjoint ({c | Composition.length c < n + 2} : Set (Composition (n + 2))).toFinset\n {Composition.ones (n + 2)} := by\n simp\n have C :\n ((p.leftInv i x (Composition.ones (n + 2)).length)\n fun j : Fin (Composition.ones n.succ.succ).length =>\n p 1 fun _ => v ((Fin.castLE (Composition.length_le _)) j)) =\n p.leftInv i x (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j := by\n apply FormalMultilinearSeries.congr _ (Composition.ones_length _) fun j hj1 hj2 => ?_\n exact FormalMultilinearSeries.congr _ rfl fun k _ _ => by congr\n have D :\n (p.leftInv i x (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j) =\n -\u2211 c \u2208 {c : Composition (n + 2) | c.length < n + 2}.toFinset,\n (p.leftInv i x c.length) (p.applyComposition c v) := by\n simp only [leftInv, ContinuousMultilinearMap.neg_apply, neg_inj,\n ContinuousMultilinearMap.sum_apply]\n convert\n (sum_toFinset_eq_subtype\n (fun c : Composition (n + 2) => c.length < n + 2)\n (fun c : Composition (n + 2) =>\n (ContinuousMultilinearMap.compAlongComposition\n (p.compContinuousLinearMap (i.symm : F \u2192L[\ud835\udd5c] E)) c (p.leftInv i x c.length))\n fun j : Fin (n + 2) => p 1 fun _ : Fin 1 => v j)).symm.trans\n _\n simp only [compContinuousLinearMap_applyComposition,\n ContinuousMultilinearMap.compAlongComposition_apply]\n congr\n ext c\n congr\n ext k\n simp [h]\n simp [FormalMultilinearSeries.comp, A, Finset.sum_union B,\n applyComposition_ones, C, D, -Set.toFinset_setOf, -Finset.union_singleton]\n\n/-! ### The right inverse of a formal multilinear series -/\n\n\n/-- The right inverse of a formal multilinear series, where the `n`-th term is defined inductively\nin terms of the previous ones to make sure that `p \u2218 (rightInv p i) = id`. For this, the linear\nterm `p\u2081` in `p` should be invertible. In the definition, `i` is a linear isomorphism that should\ncoincide with `p\u2081`, so that one can use its inverse in the construction. The definition does not\nuse that `i = p\u2081`, but proofs that the definition is well-behaved do.\n\nThe `n`-th term in `p \u2218 q` is `\u2211 p\u2096 (q_{j\u2081}, ..., q_{j\u2096})` over `j\u2081 + ... + j\u2096 = n`. In this\nexpression, `q\u2099` appears only once, in `p\u2081 (q\u2099)`. We adjust the definition of `q\u2099` so that this\nterm compensates the rest of the sum, using `i\u207b\u00b9` as an inverse to `p\u2081`.\n\nThese formulas only make sense when the constant term `p\u2080` vanishes. The definition we give is\ngeneral, but it ignores the value of `p\u2080`.\n-/\nnoncomputable def rightInv (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n FormalMultilinearSeries \ud835\udd5c F E\n | 0 => ContinuousMultilinearMap.uncurry0 \ud835\udd5c _ x\n | 1 => (continuousMultilinearCurryFin1 \ud835\udd5c F E).symm i.symm\n | n + 2 =>\n let q : FormalMultilinearSeries \ud835\udd5c F E := fun k => if k < n + 2 then rightInv p i x k else 0;\n -(i.symm : F \u2192L[\ud835\udd5c] E).compContinuousMultilinearMap ((p.comp q) (n + 2))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_coeff_zero (L181-L183)\ntheorem rightInv_coeff_zero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.rightInv i x 0 = ContinuousMultilinearMap.uncurry0 \ud835\udd5c _ x := by rw [rightInv]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_coeff_one (L185-L189)\ntheorem rightInv_coeff_one (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.rightInv i x 1 = (continuousMultilinearCurryFin1 \ud835\udd5c F E).symm i.symm := by rw [rightInv]\n/-- The right inverse does not depend on the zeroth coefficient of a formal multilinear\nseries. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_removeZero (L190-L202)\ntheorem rightInv_removeZero (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) :\n p.removeZero.rightInv i x = p.rightInv i x := by\next1 n\n induction n using Nat.strongRec' with | _ n IH\n match n with\n | 0 => simp only [rightInv_coeff_zero]\n | 1 => simp only [rightInv_coeff_one]\n | n + 2 =>\n simp only [rightInv, neg_inj]\n rw [removeZero_comp_of_pos _ _ (add_pos_of_nonneg_of_pos n.zero_le zero_lt_two)]\n congr (config := { closePost := false }) 2 with k\n by_cases hk : k < n + 2 <;> simp [hk, IH]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.comp_rightInv_aux1 (L203-L230)\ntheorem comp_rightInv_aux1 {n : \u2115} (hn : 0 < n) (p : FormalMultilinearSeries \ud835\udd5c E F)\n (q : FormalMultilinearSeries \ud835\udd5c F E) (v : Fin n \u2192 F) :\n p.comp q n v =\n \u2211 c \u2208 {c : Composition n | 1 < c.length}.toFinset,\n p c.length (q.applyComposition c v) + p 1 fun _ => q n v := by\nclassical\n have A :\n (Finset.univ : Finset (Composition n)) =\n {c | 1 < Composition.length c}.toFinset \u222a {Composition.single n hn} := by\n refine Subset.antisymm (fun c _ => ?_) (subset_univ _)\n by_cases h : 1 < c.length\n \u00b7 simp [h]\n \u00b7 have : c.length = 1 := by\n refine (eq_iff_le_not_lt.2 \u27e8?_, h\u27e9).symm; exact c.length_pos_of_pos hn\n rw [\u2190 Composition.eq_single_iff_length hn] at this\n simp [this]\n have B :\n Disjoint ({c | 1 < Composition.length c} : Set (Composition n)).toFinset\n {Composition.single n hn} := by\n simp\n have C :\n p (Composition.single n hn).length (q.applyComposition (Composition.single n hn) v) =\n p 1 fun _ : Fin 1 => q n v := by\n apply p.congr (Composition.single_length hn) fun j hj1 _ => ?_\n simp [applyComposition_single]\n simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, C, -Set.toFinset_setOf,\n -add_right_inj, -Composition.single_length, -Finset.union_singleton]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.comp_rightInv_aux2 (L231-L246)\ntheorem comp_rightInv_aux2 (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E) (n : \u2115)\n (v : Fin (n + 2) \u2192 F) :\n \u2211 c \u2208 {c : Composition (n + 2) | 1 < c.length}.toFinset,\n p c.length (applyComposition (fun k : \u2115 => ite (k < n + 2) (p.rightInv i x k) 0) c v) =\n \u2211 c \u2208 {c : Composition (n + 2) | 1 < c.length}.toFinset,\n p c.length ((p.rightInv i x).applyComposition c v) := by\nhave N : 0 < n + 2 := by simp\n refine sum_congr rfl fun c hc => p.congr rfl fun j hj1 hj2 => ?_\n have : \u2200 k, c.blocksFun k < n + 2 := by\n simp only [Set.mem_toFinset (s := {c : Composition (n + 2) | 1 < c.length}),\n Set.mem_setOf_eq] at hc\n simp [\u2190 Composition.ne_single_iff N, Composition.eq_single_iff_length, ne_of_gt hc]\n simp [applyComposition, this]\n\n/-- The right inverse to a formal multilinear series is indeed a right inverse, provided its linear\nterm is invertible and its constant term vanishes. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.comp_rightInv (L247-L263)\ntheorem comp_rightInv (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n p.comp (rightInv p i x) = id \ud835\udd5c F (p 0 0) := by\next (n v)\n match n with\n | 0 =>\n simp only [comp_coeff_zero', Matrix.zero_empty, id_apply_zero]\n congr\n ext i\n exact i.elim0\n | 1 =>\n simp only [comp_coeff_one, h, rightInv_coeff_one, ContinuousLinearEquiv.apply_symm_apply,\n id_apply_one, ContinuousLinearEquiv.coe_apply, continuousMultilinearCurryFin1_symm_apply]\n | n + 2 =>\n have N : 0 < n + 2 := by simp\n simp [comp_rightInv_aux1 N, h, rightInv, comp_rightInv_aux2, -Set.toFinset_setOf]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.rightInv_coeff (L264-L283)\ntheorem rightInv_coeff (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (n : \u2115) (hn : 2 \u2264 n) :\n p.rightInv i x n =\n -(i.symm : F \u2192L[\ud835\udd5c] E).compContinuousMultilinearMap\n (\u2211 c \u2208 ({c | 1 < Composition.length c}.toFinset : Finset (Composition n)),\n p.compAlongComposition (p.rightInv i x) c) := by\nmatch n with\n | 0 => exact False.elim (zero_lt_two.not_ge hn)\n | 1 => exact False.elim (one_lt_two.not_ge hn)\n | n + 2 =>\n simp only [rightInv, neg_inj]\n congr (config := { closePost := false }) 1\n ext v\n have N : 0 < n + 2 := by simp\n have : ((p 1) fun _ : Fin 1 => 0) = 0 := ContinuousMultilinearMap.map_zero _\n simp [comp_rightInv_aux1 N, this, comp_rightInv_aux2, -Set.toFinset_setOf]\n\n/-! ### Coincidence of the left and the right inverse -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.leftInv_eq_rightInv (L284-L366)\ntheorem leftInv_eq_rightInv (p : FormalMultilinearSeries \ud835\udd5c E F) (i : E \u2243L[\ud835\udd5c] F) (x : E)\n (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n leftInv p i x = rightInv p i x :=\ncalc\n leftInv p i x = (leftInv p i x).comp (id \ud835\udd5c F (p 0 0)) := by simp\n _ = (leftInv p i x).comp (p.comp (rightInv p i x)) := by rw [comp_rightInv p i _ h]\n _ = ((leftInv p i x).comp p).comp (rightInv p i x) := by rw [comp_assoc]\n _ = (id \ud835\udd5c E x).comp (rightInv p i x) := by rw [leftInv_comp p i _ h]\n _ = rightInv p i x := by simp [id_comp' _ _ 0]\n\n/-!\n### Convergence of the inverse of a power series\n\nAssume that `p` is a convergent multilinear series, and let `q` be its (left or right) inverse.\nUsing the left-inverse formula gives\n$$\nq_n = - (p_1)^{-n} \\sum_{k=0}^{n-1} \\sum_{i_1 + \\dotsc + i_k = n} q_k (p_{i_1}, \\dotsc, p_{i_k}).\n$$\nAssume for simplicity that we are in dimension `1` and `p\u2081 = 1`. In the formula for `q\u2099`, the term\n`q_{n-1}` appears with a multiplicity of `n-1` (choosing the index `i_j` for which `i_j = 2` while\nall the other indices are equal to `1`), which indicates that `q\u2099` might grow like `n!`. This is\nbad for summability properties.\n\nIt turns out that the right-inverse formula is better behaved, and should instead be used for this\nkind of estimate. It reads\n$$\nq_n = - (p_1)^{-1} \\sum_{k=2}^n \\sum_{i_1 + \\dotsc + i_k = n} p_k (q_{i_1}, \\dotsc, q_{i_k}).\n$$\nHere, `q_{n-1}` can only appear in the term with `k = 2`, and it only appears twice, so there is\nhope this formula can lead to an at most geometric behavior.\n\nLet `Q\u2099 = \u2016q\u2099\u2016`. Bounding `\u2016p\u2096\u2016` with `C r^k` gives an inequality\n$$\nQ_n \u2264 C' \\sum_{k=2}^n r^k \\sum_{i_1 + \\dotsc + i_k = n} Q_{i_1} \\dotsm Q_{i_k}.\n$$\n\nThis formula is not enough to prove by naive induction on `n` a bound of the form `Q\u2099 \u2264 D R^n`.\nHowever, assuming that the inequality above were an equality, one could get a formula for the\ngenerating series of the `Q\u2099`:\n\n$$\n\\begin{align}\nQ(z) & := \\sum Q_n z^n = Q_1 z + C' \\sum_{2 \\leq k \\leq n} \\sum_{i_1 + \\dotsc + i_k = n}\n (r z^{i_1} Q_{i_1}) \\dotsm (r z^{i_k} Q_{i_k})\n\\\\ & = Q_1 z + C' \\sum_{k = 2}^\\infty (\\sum_{i_1 \\geq 1} r z^{i_1} Q_{i_1})\n \\dotsm (\\sum_{i_k \\geq 1} r z^{i_k} Q_{i_k})\n\\\\ & = Q_1 z + C' \\sum_{k = 2}^\\infty (r Q(z))^k\n= Q_1 z + C' (r Q(z))^2 / (1 - r Q(z)).\n\\end{align}\n$$\n\nOne can solve this formula explicitly. The solution is analytic in a neighborhood of `0` in `\u2102`,\nhence its coefficients grow at most geometrically (by a contour integral argument), and therefore\nthe original `Q\u2099`, which are bounded by these ones, are also at most geometric.\n\nThis classical argument is not really satisfactory, as it requires an a priori bound on a complex\nanalytic function. Another option would be to compute explicitly its terms (with binomial\ncoefficients) to obtain an explicit geometric bound, but this would be very painful.\n\nInstead, we will use the above intuition, but in a slightly different form, with finite sums and an\ninduction. I learnt this trick in [poeschel2017siegelsternberg]. Let\n$S_n = \\sum_{k=1}^n Q_k a^k$ (where `a` is a positive real parameter to be chosen suitably small).\nThe above computation but with finite sums shows that\n\n$$\nS_n \\leq Q_1 a + C' \\sum_{k=2}^n (r S_{n-1})^k.\n$$\n\nIn particular, $S_n \\leq Q_1 a + C' (r S_{n-1})^2 / (1- r S_{n-1})$.\nAssume that $S_{n-1} \\leq K a$, where `K > Q\u2081` is fixed and `a` is small enough so that\n`r K a \u2264 1/2` (to control the denominator). Then this equation gives a bound\n$S_n \\leq Q_1 a + 2 C' r^2 K^2 a^2$.\nIf `a` is small enough, this is bounded by `K a` as the second term is quadratic in `a`, and\ntherefore negligible.\n\nBy induction, we deduce `S\u2099 \u2264 K a` for all `n`, which gives in particular the fact that `a\u207f Q\u2099`\nremains bounded.\n-/\n\n\n/-- First technical lemma to control the growth of coefficients of the inverse. Bound the explicit\nexpression for `\u2211_{k mul_nonneg hr (mul_nonneg (pow_nonneg ha _) (hp _))\n rintro \u27e8k, c\u27e9 hd\n simp only [Set.mem_toFinset (s := {c | 1 < Composition.length c}), mem_Ico, mem_sigma,\n Set.mem_setOf_eq] at hd\n simp only [mem_compPartialSumTarget_iff]\n refine \u27e8hd.2, c.length_le.trans_lt hd.1.2, fun j => ?_\u27e9\n have : c \u2260 Composition.single k (zero_lt_two.trans_le hd.1.1) := by\n simp [Composition.eq_single_iff_length, ne_of_gt hd.2]\n rw [Composition.ne_single_iff] at this\n exact (this j).trans_le (Nat.lt_succ_iff.mp hd.1.2)\n _ = \u2211 e \u2208 compPartialSumSource 2 (n + 1) n, \u220f j : Fin e.1, r * (a ^ e.2 j * p (e.2 j)) := by\n symm\n apply compChangeOfVariables_sum\n rintro \u27e8k, blocksFun\u27e9 H\n have K : (compChangeOfVariables 2 (n + 1) n \u27e8k, blocksFun\u27e9 H).snd.length = k := by simp\n congr 2 <;> try rw [K]\n rw [Fin.heq_fun_iff K.symm]\n intro j\n rw [compChangeOfVariables_blocksFun]\n _ = \u2211 j \u2208 Ico 2 (n + 1), r ^ j * (\u2211 k \u2208 Ico 1 n, a ^ k * p k) ^ j := by\n rw [compPartialSumSource,\n \u2190 sum_sigma' (Ico 2 (n + 1))\n (fun k : \u2115 => (Fintype.piFinset fun _ : Fin k => Ico 1 n : Finset (Fin k \u2192 \u2115)))\n (fun n e => \u220f j : Fin n, r * (a ^ e j * p (e j)))]\n congr! with j\n simp only [\u2190 @MultilinearMap.mkPiAlgebra_apply \u211d (Fin j) _ \u211d]\n simp only [\u2190\n MultilinearMap.map_sum_finset (MultilinearMap.mkPiAlgebra \u211d (Fin j) \u211d) fun _ (m : \u2115) =>\n r * (a ^ m * p m)]\n simp only [MultilinearMap.mkPiAlgebra_apply]\n simp [prod_const, \u2190 mul_sum, mul_pow]\n\n/-- Second technical lemma to control the growth of coefficients of the inverse. Bound the explicit\nexpression for `\u2211_{k \u2016p.rightInv i x k\u2016)\n (fun k => norm_nonneg _) hr ha\n\n/-- If a a formal multilinear series has a positive radius of convergence, then its right inverse\nalso has a positive radius of convergence. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.radius_rightInv_pos_of_radius_pos (L483-L553)\ntheorem radius_rightInv_pos_of_radius_pos\n {p : FormalMultilinearSeries \ud835\udd5c E F} {i : E \u2243L[\ud835\udd5c] F} {x : E}\n (hp : 0 < p.radius) : 0 < (p.rightInv i x).radius := by\nobtain \u27e8C, r, Cpos, rpos, ple\u27e9 :\n \u2203 (C r : _) (_ : 0 < C) (_ : 0 < r), \u2200 n : \u2115, \u2016p n\u2016 \u2264 C * r ^ n :=\n le_mul_pow_of_radius_pos p hp\n let I := \u2016(i.symm : F \u2192L[\ud835\udd5c] E)\u2016\n -- choose `a` small enough to make sure that `\u2211_{k \u2264 n} a\u1d4f Q\u2096` will be controllable by\n -- induction\n obtain \u27e8a, apos, ha1, ha2\u27e9 :\n \u2203 (a : _) (apos : 0 < a),\n 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a \u2264 1 \u2227 r * (I + 1) * a \u2264 1 / 2 := by\n have :\n Tendsto (fun a => 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a) (\ud835\udcdd 0)\n (\ud835\udcdd (2 * I * C * r ^ 2 * (I + 1) ^ 2 * 0)) :=\n tendsto_const_nhds.mul tendsto_id\n have A : \u2200\u1da0 a in \ud835\udcdd 0, 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a < 1 := by\n apply (tendsto_order.1 this).2; simp [zero_lt_one]\n have : Tendsto (fun a => r * (I + 1) * a) (\ud835\udcdd 0) (\ud835\udcdd (r * (I + 1) * 0)) :=\n tendsto_const_nhds.mul tendsto_id\n have B : \u2200\u1da0 a in \ud835\udcdd 0, r * (I + 1) * a < 1 / 2 := by\n apply (tendsto_order.1 this).2; simp\n have C : \u2200\u1da0 a in \ud835\udcdd[>] (0 : \u211d), (0 : \u211d) < a := by\n filter_upwards [self_mem_nhdsWithin] with _ ha using ha\n rcases (C.and ((A.and B).filter_mono inf_le_left)).exists with \u27e8a, ha\u27e9\n exact \u27e8a, ha.1, ha.2.1.le, ha.2.2.le\u27e9\n -- check by induction that the partial sums are suitably bounded, using the choice of `a` and the\n -- inductive control from Lemma `radius_rightInv_pos_of_radius_pos_aux2`.\n let S n := \u2211 k \u2208 Ico 1 n, a ^ k * \u2016p.rightInv i x k\u2016\n have IRec : \u2200 n, 1 \u2264 n \u2192 S n \u2264 (I + 1) * a := by\n apply Nat.le_induction\n \u00b7 simp only [S]\n rw [Ico_eq_empty_of_le (le_refl 1), sum_empty]\n exact mul_nonneg (add_nonneg (norm_nonneg _) zero_le_one) apos.le\n \u00b7 intro n one_le_n hn\n have In : 2 \u2264 n + 1 := by lia\n have rSn : r * S n \u2264 1 / 2 :=\n calc\n r * S n \u2264 r * ((I + 1) * a) := by gcongr\n _ \u2264 1 / 2 := by rwa [\u2190 mul_assoc]\n calc\n S (n + 1) \u2264 I * a + I * C * \u2211 k \u2208 Ico 2 (n + 1), (r * S n) ^ k :=\n radius_rightInv_pos_of_radius_pos_aux2 In p i rpos.le apos.le Cpos.le ple\n _ = I * a + I * C * (((r * S n) ^ 2 - (r * S n) ^ (n + 1)) / (1 - r * S n)) := by\n rw [geom_sum_Ico' _ In]; exact ne_of_lt (rSn.trans_lt (by norm_num))\n _ \u2264 I * a + I * C * ((r * S n) ^ 2 / (1 / 2)) := by\n gcongr\n \u00b7 simp only [sub_le_self_iff]\n positivity\n \u00b7 linarith only [rSn]\n _ = I * a + 2 * I * C * (r * S n) ^ 2 := by ring\n _ \u2264 I * a + 2 * I * C * (r * ((I + 1) * a)) ^ 2 := by gcongr\n _ = (I + 2 * I * C * r ^ 2 * (I + 1) ^ 2 * a) * a := by ring\n _ \u2264 (I + 1) * a := by gcongr\n -- conclude that all coefficients satisfy `a\u207f Q\u2099 \u2264 (I + 1) a`.\n let a' : NNReal := \u27e8a, apos.le\u27e9\n suffices H : (a' : ENNReal) \u2264 (p.rightInv i x).radius by\n apply lt_of_lt_of_le _ H\n -- Prior to https://github.com/leanprover/lean4/pull/2734, this was `exact_mod_cast apos`.\n simpa only [ENNReal.coe_pos]\n apply le_radius_of_eventually_le _ ((I + 1) * a)\n filter_upwards [Ici_mem_atTop 1] with n (hn : 1 \u2264 n)\n calc\n \u2016p.rightInv i x n\u2016 * (a' : \u211d) ^ n = a ^ n * \u2016p.rightInv i x n\u2016 := mul_comm _ _\n _ \u2264 \u2211 k \u2208 Ico 1 (n + 1), a ^ k * \u2016p.rightInv i x k\u2016 :=\n (haveI : \u2200 k \u2208 Ico 1 (n + 1), 0 \u2264 a ^ k * \u2016p.rightInv i x k\u2016 := fun k _ => by positivity\n single_le_sum this (by simp [hn]))\n _ \u2264 (I + 1) * a := IRec (n + 1) (by simp)\n\n/-- If a a formal multilinear series has a positive radius of convergence, then its left inverse\nalso has a positive radius of convergence. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Analytic.Inverse.radius_leftInv_pos_of_radius_pos (L554-L568)\ntheorem radius_leftInv_pos_of_radius_pos\n {p : FormalMultilinearSeries \ud835\udd5c E F} {i : E \u2243L[\ud835\udd5c] F} {x : E}\n (hp : 0 < p.radius) (h : p 1 = (continuousMultilinearCurryFin1 \ud835\udd5c E F).symm i) :\n 0 < (p.leftInv i x).radius := by\nrw [leftInv_eq_rightInv _ _ _ h]\n exact radius_rightInv_pos_of_radius_pos hp\n\nend FormalMultilinearSeries\n\n/-!\n### The inverse of an analytic open partial homeomorphism is analytic\n-/\n\nopen FormalMultilinearSeries List\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticAt_congr (L495-L497)\ntheorem analyticAt_congr (h : f =\u1da0[\ud835\udcdd x] g) : AnalyticAt \ud835\udd5c f x \u2194 AnalyticAt \ud835\udd5c g x :=\n\u27e8fun hf \u21a6 hf.congr h, fun hg \u21a6 hg.congr h.symm\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Analytic.Basic.ContinuousLinearMap (L546-L557)\ntheorem ContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall (g : F \u2192L[\ud835\udd5c] G)\n (h : HasFPowerSeriesWithinOnBall f p s x r) :\n HasFPowerSeriesWithinOnBall (g \u2218 f) (g.compFormalMultilinearSeries p) s x r where\n r_le := h.r_le.trans (p.radius_le_radius_continuousLinearMap_comp _)\nr_pos := h.r_pos\n hasSum hy h'y := by\n simpa only [ContinuousLinearMap.compFormalMultilinearSeries_apply,\n ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply] using\n g.hasSum (h.hasSum hy h'y)\n\n/-- If a function `f` has a power series `p` on a ball and `g` is linear, then `g \u2218 f` has the\npower series `g \u2218 p` on the same ball. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)\ntheorem one_add_cpow_hasFPowerSeriesAt_zero {a : \u2102} :\n HasFPowerSeriesAt (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 :=\none_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)\ntheorem binomialSeries_radius_ge_one {\ud835\udd42 : Type*} [RCLike \ud835\udd42] {\ud835\udd38 : Type*} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} :\n 1 \u2264 (binomialSeries \ud835\udd38 a).radius := by\nby_cases ha : \u2200 (k : \u2115), a \u2260 k\n \u00b7 rw [binomialSeries_radius_eq_one ha]\n \u00b7 push Not at ha\n rcases ha with \u27e8k, rfl\u27e9\n simp [binomialSeries_radius_eq_top_of_nat]\n\nnamespace Complex\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesWithinAt_iff_of_nhds (L391-L397)\nlemma hasFPowerSeriesWithinAt_iff_of_nhds (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F)\n {U : Set E} (hU : U \u2208 \ud835\udcdd x) :\n HasFPowerSeriesWithinAt f p U x \u2194 HasFPowerSeriesAt f p x := by\nrw [\u2190 hasFPowerSeriesWithinAt_univ]\n exact \u27e8fun h \u21a6 h.mono_of_mem_nhdsWithin (mem_nhdsWithin_of_mem_nhds hU),\n fun h \u21a6 h.mono (subset_univ _)\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff (L1106-L1127)\ntheorem hasFPowerSeriesAt_iff :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd 0, HasSum (fun n => z ^ n \u2022 p.coeff n) (f (z\u2080 + z)) := by\nrefine \u27e8fun \u27e8r, _, r_pos, h\u27e9 =>\n eventually_of_mem (Metric.eball_mem_nhds 0 r_pos) fun _ => by simpa using h, ?_\u27e9\n simp only [Metric.eventually_nhds_iff]\n rintro \u27e8r, r_pos, h\u27e9\n refine \u27e8p.radius \u2293 r.toNNReal, by simp, ?_, ?_\u27e9\n \u00b7 simp only [r_pos.lt, lt_inf_iff, ENNReal.coe_pos, Real.toNNReal_pos, and_true]\n obtain \u27e8z, z_pos, le_z\u27e9 := NormedField.exists_norm_lt \ud835\udd5c r_pos.lt\n have : (\u2016z\u2016\u208a : ENNReal) \u2264 p.radius := by\n simp only [dist_zero_right] at h\n apply FormalMultilinearSeries.le_radius_of_tendsto\n convert tendsto_norm.comp (h le_z).summable.tendsto_atTop_zero\n simp [norm_smul, mul_comm]\n refine lt_of_lt_of_le ?_ this\n simp only [ENNReal.coe_pos]\n exact zero_lt_iff.mpr (nnnorm_ne_zero_iff.mpr (norm_pos_iff.mp z_pos))\n \u00b7 simp only [Metric.mem_eball, lt_inf_iff, edist_lt_coe, apply_eq_pow_smul_coeff, and_imp,\n dist_zero_right] at h \u22a2\n refine fun {y} _ hyr => h ?_\n simpa [nndist_eq_nnnorm, Real.lt_toNNReal_iff_coe_lt] using hyr\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)\ntheorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : \u2102) :\n HasFPowerSeriesOnBall (fun x \u21a6 1 / (1 - x) ^ a)\n (.ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n) 0 1 := by\nhave H : ((binomialSeries \u2102 (-a)).compContinuousLinearMap (-1)) =\n .ofScalars \u2102 fun n \u21a6 Ring.choose (a + n - 1) n := by\n ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,\n Units.smul_def, \u2190 pow_add, \u2190 mul_assoc]\n have : HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ (-a)) (binomialSeries \u2102 (-a : \u2102)) (-0) 1 := by\n simpa using one_add_cpow_hasFPowerSeriesOnBall_zero\n simpa [cpow_neg, Function.comp_def, \u2190 sub_eq_add_neg, H] using\n this.compContinuousLinearMap (u := -1) (x := (0 : \u2102))\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)\ntheorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :\n HasFPowerSeriesAt f p x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)\ndef AnalyticWithinAt (f : E \u2192 F) (s : Set E) (x : E) : Prop :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesWithinAt f p s x\n\n/-- Given a function `f : E \u2192 F`, we say that `f` is analytic on a set `s` if it is analytic around\nevery point of `s`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)\ndef AnalyticAt (f : E \u2192 F) (x : E) :=\n\u2203 p : FormalMultilinearSeries \ud835\udd5c E F, HasFPowerSeriesAt f p x\n\n/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `\ud835\udcdd[s] x` -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOn (L123-L131)\ndef AnalyticOn (f : E \u2192 F) (s : Set E) : Prop :=\n\u2200 x \u2208 s, AnalyticWithinAt \ud835\udd5c f s x\n\n/-!\n### `HasFPowerSeriesOnBall` and `HasFPowerSeriesWithinOnBall`\n-/\n\nvariable {\ud835\udd5c}\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)\ntheorem binomialSeries_radius_eq_top_of_nat {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u}\n [NormedDivisionRing \ud835\udd38] [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \u2115} :\n (binomialSeries \ud835\udd38 (a : \ud835\udd42)).radius = \u22a4 := by\nsimp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n ordinaryHypergeometric_radius_top_of_neg_nat\u2081]\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `1`, when `a` is not natural. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)\ntheorem binomialSeries_eq_ordinaryHypergeometricSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42]\n {\ud835\udd38 : Type v} [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] {a b : \ud835\udd42}\n (h : \u2200 (k : \u2115), (k : \ud835\udd42) \u2260 -b) :\n binomialSeries \ud835\udd38 a =\n (ordinaryHypergeometricSeries \ud835\udd38 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by\nsimp only [binomialSeries, ordinaryHypergeometricSeries,\n FormalMultilinearSeries.ofScalars_comp_neg_id]\n congr! with n\n rw [ordinaryHypergeometricCoefficient,\n mul_inv_cancel_right\u2080 (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]\n simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,\n Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,\n ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]\n ring_nf\n simp\n\n/-- The radius of convergence of `binomialSeries \ud835\udd38 a` is `\u22a4` for natural `a`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Analytic.Basic.hasFPowerSeriesAt_iff' (L1128-L1132)\ntheorem hasFPowerSeriesAt_iff' :\n HasFPowerSeriesAt f p z\u2080 \u2194 \u2200\u1da0 z in \ud835\udcdd z\u2080, HasSum (fun n => (z - z\u2080) ^ n \u2022 p.coeff n) (f z) := by\nrw [\u2190 map_add_left_nhds_zero, eventually_map, hasFPowerSeriesAt_iff]\n simp_rw [add_sub_cancel_left]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)\ntheorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : \u2102} :\n HasFPowerSeriesOnBall (fun x \u21a6 (1 + x) ^ a) (binomialSeries \u2102 a) 0 1 := by\nsuffices (binomialSeries \u2102 a = FormalMultilinearSeries.ofScalars \u2102\n fun n \u21a6 iteratedDeriv n (fun (x : \u2102) \u21a6 (1 + x) ^ a) 0 / n !) by\n convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _\n \u00b7 norm_num\n \u00b7 -- TODO: use `fun_prop` for this subgoal\n apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const\n intro z hz\n apply Complex.mem_slitPlane_of_norm_lt_one\n rw [\u2190 ENNReal.ofReal_one, Metric.eball_ofReal] at hz\n simpa using hz\n \u00b7 rw [\u2190 this]\n exact binomialSeries_radius_ge_one\n simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]\n ext n\n rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), \u2190 nsmul_eq_mul',\n \u2190 Ring.descPochhammer_eq_factorial_smul_choose]\n let B := Metric.ball (0 : \u2102) 1\n suffices Set.EqOn (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B)\n (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - n)) B by\n specialize this (show 0 \u2208 _ by simp [B])\n rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this\n symm\n simpa using this\n induction n with\n | zero => simp [Set.EqOn]\n | succ n ih =>\n have : iteratedDerivWithin (n + 1) (fun (x : \u2102) \u21a6 (1 + x) ^ a) B =\n derivWithin (iteratedDerivWithin n (fun x \u21a6 (1 + x) ^ a) B) B := by\n ext z\n rw [iteratedDerivWithin_succ]\n rw [this]\n have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : \u2102) \u21a6 (1 + x) ^ a) B) B)\n (derivWithin (fun x \u21a6 (descPochhammer \u2124 n).smeval a * (1 + x) ^ (a - \u2191n)) B) B := by\n intro z hz\n rw [derivWithin_congr (fun _ hz \u21a6 ih hz) (ih hz)]\n apply Set.EqOn.trans this\n intro z hz\n simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,\n deriv_const_mul_field']\n rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,\n show a - (n + 1) = a - n - 1 by ring, \u2190 mul_assoc]\n \u00b7 congr\n simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]\n \u00b7 apply Complex.mem_slitPlane_of_norm_lt_one\n simpa [B] using hz\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)\ntheorem binomialSeries_radius_eq_one {\ud835\udd42 : Type v} [RCLike \ud835\udd42] {\ud835\udd38 : Type u} [NormedDivisionRing \ud835\udd38]\n [NormedAlgebra \ud835\udd42 \ud835\udd38] {a : \ud835\udd42} (ha : \u2200 (k : \u2115), a \u2260 k) : (binomialSeries \ud835\udd38 a).radius = 1 := by\nsimp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : \ud835\udd42)) (by norm_cast; simp),\n FormalMultilinearSeries.radius_compNeg]\n conv at ha => ext; rw [ne_comm]\n exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)\ntheorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt\n (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=\n\u27e8r, hf\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr (L514-L516)\ntheorem analyticOnNhd_congr (hs : IsOpen s) (h : s.EqOn f g) : AnalyticOnNhd \ud835\udd5c f s \u2194\n AnalyticOnNhd \ud835\udd5c g s := \u27e8fun hf => hf.congr hs h, fun hg => hg.congr hs h.symm\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOnNhd_congr' (L506-L508)\ntheorem analyticOnNhd_congr' (h : f =\u1da0[\ud835\udcdd\u02e2 s] g) : AnalyticOnNhd \ud835\udd5c f s \u2194 AnalyticOnNhd \ud835\udd5c g s :=\n\u27e8fun hf => hf.congr' h, fun hg => hg.congr' h.symm\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)\ndef HasFPowerSeriesWithinAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (s : Set E) (x : E) :=\n\u2203 r, HasFPowerSeriesWithinOnBall f p s x r\n\n-- Teach the `bound` tactic that power series have positive radius\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)\nlemma Complex.ofReal_choose (a : \u211d) (n : \u2115) :\n \u2191(Ring.choose a n) = Ring.choose (a : \u2102) n :=\nRing.map_choose (algebraMap \u211d \u2102) _ _\n\n/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given\nby `Ring.choose a`. The sum of this series is `fun x \u21a6 (1 + x) ^ a` within the radius\nof convergence. -/\nnoncomputable def binomialSeries {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) :\n FormalMultilinearSeries \ud835\udd42 \ud835\udd38 \ud835\udd38 :=\n .ofScalars \ud835\udd38 (Ring.choose a \u00b7)\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)\ndef HasFPowerSeriesAt (f : E \u2192 F) (p : FormalMultilinearSeries \ud835\udd5c E F) (x : E) :=\n\u2203 r, HasFPowerSeriesOnBall f p x r\n\n/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Analytic.Basic.analyticOn_congr (L488-L490)\nlemma analyticOn_congr (hs : EqOn f g s) : AnalyticOn \ud835\udd5c f s \u2194 AnalyticOn \ud835\udd5c g s :=\n\u27e8fun h \u21a6 h.congr hs.symm, fun h \u21a6 h.congr hs\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)\ntheorem binomialSeries_apply {\ud835\udd42 : Type u} [Field \ud835\udd42] [CharZero \ud835\udd42] (\ud835\udd38 : Type v)\n [Ring \ud835\udd38] [Algebra \ud835\udd42 \ud835\udd38] [TopologicalSpace \ud835\udd38] [IsTopologicalRing \ud835\udd38] (a : \ud835\udd42) {n} (v : Fin n \u2192 \ud835\udd38) :\n binomialSeries \ud835\udd38 a n v = Ring.choose a n \u2022 (List.ofFn v).prod := by\nsimp [binomialSeries, FormalMultilinearSeries.ofScalars]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)\ndef AnalyticOnNhd (f : E \u2192 F) (s : Set E) :=\n\u2200 x, x \u2208 s \u2192 AnalyticAt \ud835\udd5c f x\n\n/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`. Note that\nthis is weaker than `AnalyticOnNhd \ud835\udd5c f s`, as `f` is allowed to be arbitrary outside `s`. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Analytic/Inverse.lean", "module": "Mathlib.Analysis.Analytic.Inverse", "declaration": "Mathlib.Analysis.Analytic.Inverse.leftInv_coeff_one", "span": "L80-L84", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Analytic/Inverse.lean#L80"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 14623, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 38128, "lean_code_chars": 36626, "natural_language_chars": 1502, "lean_code_ratio": 0.9606, "line_count": 886, "imports_count": 0, "declarations_count": 4412, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "224a7425da3b58a5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.LinearAlgebra.Matrix.ConjTranspose.vecMul_conjTranspose", "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.LinearAlgebra.Matrix.ConjTranspose)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem vecMul_conjTranspose [Fintype n] [StarRing \u03b1] (A : Matrix m n \u03b1) (x : n \u2192 \u03b1) :\n x \u1d65* A\u1d34 = star (A *\u1d65 star x)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose (L41-L43)\ndef conjTranspose [Star \u03b1] (M : Matrix m n \u03b1) : Matrix n m \u03b1 :=\nM.transpose.map star\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_single (L48-L57)\nlemma conjTranspose_single [DecidableEq n] [DecidableEq m] [AddMonoid \u03b1]\n [StarAddMonoid \u03b1] (i : m) (j : n) (a : \u03b1) :\n (single i j a)\u1d34 = single j i (star a) := by\nchange (single i j a).transpose.map starAddEquiv = single j i (star a)\n simp\n\nsection Diagonal\n\nvariable [DecidableEq n]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.diagonal_conjTranspose (L59-L67)\ntheorem diagonal_conjTranspose [AddMonoid \u03b1] [StarAddMonoid \u03b1] (v : n \u2192 \u03b1) :\n (diagonal v)\u1d34 = diagonal (star v) := by\nrw [conjTranspose, diagonal_transpose, diagonal_map (star_zero _)]\n rfl\n\nend Diagonal\n\nsection Diag\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.diag_conjTranspose (L69-L82)\ntheorem diag_conjTranspose [Star \u03b1] (A : Matrix n n \u03b1) :\n diag A\u1d34 = star (diag A) :=\nrfl\n\nend Diag\n\nsection DotProduct\n\nvariable [Fintype m] [Fintype n]\n\nsection StarRing\n\nvariable [NonUnitalSemiring \u03b1] [StarRing \u03b1] (v w : m \u2192 \u03b1)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_dotProduct_star (L83-L84)\ntheorem star_dotProduct_star : star v \u2b1d\u1d65 star w = star (w \u2b1d\u1d65 v) := by simp [dotProduct]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_dotProduct (L85-L86)\ntheorem star_dotProduct : star v \u2b1d\u1d65 w = star (star w \u2b1d\u1d65 v) := by simp [dotProduct]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.dotProduct_star (L87-L96)\ntheorem dotProduct_star : v \u2b1d\u1d65 star w = star (w \u2b1d\u1d65 star v) := by simp [dotProduct]\nend StarRing\n\nend DotProduct\n\nsection NonUnitalSemiring\n\nvariable [NonUnitalSemiring \u03b1]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_mulVec (L97-L100)\ntheorem star_mulVec [Fintype n] [StarRing \u03b1] (M : Matrix m n \u03b1) (v : n \u2192 \u03b1) :\n star (M *\u1d65 v) = star v \u1d65* M\u1d34 :=\nfunext fun _ => (star_dotProduct_star _ _).symm\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_vecMul (L101-L104)\ntheorem star_vecMul [Fintype m] [StarRing \u03b1] (M : Matrix m n \u03b1) (v : m \u2192 \u03b1) :\n star (v \u1d65* M) = M\u1d34 *\u1d65 star v :=\nfunext fun _ => (star_dotProduct_star _ _).symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.mulVec_conjTranspose (L105-L108)\ntheorem mulVec_conjTranspose [Fintype m] [StarRing \u03b1] (A : Matrix m n \u03b1) (x : m \u2192 \u03b1) :\n A\u1d34 *\u1d65 x = star (star x \u1d65* A) :=\nfunext fun _ => star_dotProduct _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_vecMulVec (L116-L127)\ntheorem conjTranspose_vecMulVec [Mul \u03b1] [StarMul \u03b1] (w : m \u2192 \u03b1) (v : n \u2192 \u03b1) :\n (vecMulVec w v)\u1d34 = vecMulVec (star v) (star w) :=\next fun _ _ => star_mul _ _\n\nsection ConjTranspose\n\nopen Matrix\n\n/-- Tell `simp` what the entries are in a conjugate transposed matrix.\n\n Compare with `mul_apply`, `diagonal_apply_eq`, etc.\n-/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_apply (L129-L132)\ntheorem conjTranspose_apply [Star \u03b1] (M : Matrix m n \u03b1) (i j) :\n M.conjTranspose j i = star (M i j) :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_conjTranspose (L134-L137)\ntheorem conjTranspose_conjTranspose [InvolutiveStar \u03b1] (M : Matrix m n \u03b1) : M\u1d34\u1d34 = M :=\nMatrix.ext <| by simp\n\nvariable (n \u03b1) in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_involutive (L138-L141)\ntheorem conjTranspose_involutive [InvolutiveStar \u03b1] :\n (conjTranspose : Matrix n n \u03b1 \u2192 Matrix n n \u03b1).Involutive :=\nconjTranspose_conjTranspose\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_transpose (L142-L145)\ntheorem conjTranspose_transpose [Star \u03b1] (M : Matrix m n \u03b1) :\n M\u1d34\u1d40 = M.map star :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_def (L191-L193)\ntheorem adjugate_def (A : Matrix n n \u03b1) : adjugate A = of fun i => cramer A\u1d40 (Pi.single i 1) :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_zero (L136-L142)\ntheorem cramer_zero [Nontrivial n] : cramer (0 : Matrix n n \u03b1) = 0 := by\next i j\n obtain \u27e8j', hj'\u27e9 : \u2203 j', j' \u2260 j := exists_ne j\n apply det_eq_zero_of_column_eq_zero j'\n simp [updateCol_ne hj']\n\n/-- Use linearity of `cramer` to take it out of a summation. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.sum_cramer (L143-L147)\ntheorem sum_cramer {\u03b2} (s : Finset \u03b2) (f : \u03b2 \u2192 n \u2192 \u03b1) :\n (\u2211 x \u2208 s, cramer A (f x)) = cramer A (\u2211 x \u2208 s, f x) :=\n(map_sum (cramer A) ..).symm\n\n/-- Use linearity of `cramer` and vector evaluation to take `cramer A _ i` out of a summation. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_subsingleton_apply (L133-L135)\ntheorem cramer_subsingleton_apply [Subsingleton n] (A : Matrix n n \u03b1) (b : n \u2192 \u03b1) (i : n) :\n cramer A b i = b i := by rw [cramer_apply, det_eq_elem_of_subsingleton _ i, updateCol_self]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.IsSymm (L227-L229)\ntheorem IsSymm.adjugate {A : Matrix n n \u03b1} (hA : A.IsSymm) : A.adjugate.IsSymm := by\nrw [IsSymm, Matrix.adjugate_transpose, hA.eq]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_transpose_row_self (L103-L114)\ntheorem cramer_transpose_row_self (i : n) : A\u1d40.cramer (A i) = Pi.single i A.det := by\next j\n rw [cramer_apply, Pi.single_apply]\n split_ifs with h\n \u00b7 -- i = j: this entry should be `A.det`\n subst h\n simp only [updateCol_transpose, det_transpose, updateRow_eq_self]\n \u00b7 -- i \u2260 j: this entry should be 0\n rw [updateCol_transpose, det_transpose]\n apply det_zero_of_row_eq h\n rw [updateRow_self, updateRow_ne (Ne.symm h)]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramerMap (L76-L78)\ndef cramerMap (i : n) : \u03b1 :=\n(A.updateCol i b).det\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_transpose_apply (L100-L102)\ntheorem cramer_transpose_apply (i : n) : cramer A\u1d40 b i = (A.updateRow i b).det := by\nrw [cramer_apply, updateCol_transpose, det_transpose]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.Matrix.AbsoluteValue.det_sum_le (L52-L61)\ntheorem det_sum_le {\u03b9 : Type*} (s : Finset \u03b9) {A : \u03b9 \u2192 Matrix n n R} {abv : AbsoluteValue R S}\n {x : S} (hx : \u2200 k i j, abv (A k i j) \u2264 x) :\n abv (det (\u2211 k \u2208 s, A k)) \u2264 (Fintype.card n)! \u2022 (#s \u2022 x) ^ Fintype.card n :=\ndet_le fun i j =>\n calc\n abv ((\u2211 k \u2208 s, A k) i j) = abv (\u2211 k \u2208 s, A k i j) := by simp only [sum_apply]\n _ \u2264 \u2211 k \u2208 s, abv (A k i j) := abv.sum_le _ _\n _ \u2264 \u2211 _k \u2208 s, x := by gcongr; apply hx\n _ = #s \u2022 x := sum_const _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_submatrix_equiv_self (L231-L238)\ntheorem adjugate_submatrix_equiv_self (e : n \u2243 m) (A : Matrix m m \u03b1) :\n adjugate (A.submatrix e e) = (adjugate A).submatrix e e := by\next i j\n have : (fun j \u21a6 Pi.single i 1 <| e.symm j) = Pi.single (e i) 1 :=\n Function.update_comp_equiv (0 : n \u2192 \u03b1) e.symm i 1\n rw [adjugate_apply, submatrix_apply, adjugate_apply, \u2190 det_submatrix_equiv_self e,\n updateRow_submatrix_equiv, this]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramerMap_is_linear (L79-L82)\ntheorem cramerMap_is_linear (i : n) : IsLinearMap \u03b1 fun b => cramerMap A b i :=\n{ map_add := det_updateCol_add _ _\n map_smul := det_updateCol_smul _ _ }\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_row_self (L115-L119)\ntheorem cramer_row_self (i : n) (h : \u2200 j, b j = A j i) : A.cramer b = Pi.single i A.det := by\nrw [\u2190 transpose_transpose A, det_transpose]\n convert cramer_transpose_row_self A\u1d40 i\n exact funext h\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate (L188-L190)\ndef adjugate (A : Matrix n n \u03b1) : Matrix n n \u03b1 :=\nof fun i => cramer A\u1d40 (Pi.single i 1)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer (L94-L96)\ndef cramer (A : Matrix n n \u03b1) : (n \u2192 \u03b1) \u2192\u2097[\u03b1] (n \u2192 \u03b1) :=\nIsLinearMap.mk' (cramerMap A) (cramer_is_linear A)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_reindex (L164-L187)\ntheorem cramer_reindex (e : m \u2243 n) (A : Matrix m m \u03b1) (b : n \u2192 \u03b1) :\n cramer (reindex e e A) b = cramer A (b \u2218 e) \u2218 e.symm :=\ncramer_submatrix_equiv _ _ _\n\nend Cramer\n\nsection Adjugate\n\n/-!\n### `adjugate` section\n\nDefine the `adjugate` matrix and a few equations.\nThese will hold for any matrix over a commutative ring.\n-/\n\n\n/-- The adjugate matrix is the transpose of the cofactor matrix.\n\n Typically, the cofactor matrix is defined by taking minors,\n i.e. the determinant of the matrix with a row and column removed.\n However, the proof of `mul_adjugate` becomes a lot easier if we use the\n matrix replacing a column with a basis vector, since it allows us to use\n facts about the `cramer` map.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_is_linear (L83-L93)\ntheorem cramer_is_linear : IsLinearMap \u03b1 (cramerMap A) := by\nconstructor <;> intros <;> ext i\n \u00b7 apply (cramerMap_is_linear A i).1\n \u00b7 apply (cramerMap_is_linear A i).2\n\n/-- `cramer A b i` is the determinant of the matrix `A` with column `i` replaced with `b`,\n and thus `cramer A b` is the vector output by Cramer's rule on `A` and `b`.\n\n If `A * x = b` has a unique solution in `x`, `cramer A` sends the vector `b` to `A.det \u2022 x`.\n Otherwise, the outcome of `cramer` is well-defined but not necessarily useful.\n-/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_one (L121-L127)\ntheorem cramer_one : cramer (1 : Matrix n n \u03b1) = 1 := by\next i j\n convert congr_fun (cramer_row_self (1 : Matrix n n \u03b1) (Pi.single i 1) i _) j\n \u00b7 simp\n \u00b7 intro j\n rw [Matrix.one_eq_pi_single, Pi.single_comm]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_submatrix_equiv (L158-L163)\ntheorem cramer_submatrix_equiv (A : Matrix m m \u03b1) (e : n \u2243 m) (b : n \u2192 \u03b1) :\n cramer (A.submatrix e e) b = cramer A (b \u2218 e.symm) \u2218 e := by\next i\n simp_rw [Function.comp_apply, cramer_apply, updateCol_submatrix_equiv,\n det_submatrix_equiv_self e, Function.comp_def]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.Matrix.AbsoluteValue.det_le (L42-L51)\ntheorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : \u2200 i j, abv (A i j) \u2264 x) :\n abv A.det \u2264 (Fintype.card n)! \u2022 x ^ Fintype.card n :=\ncalc\n abv A.det = abv (\u2211 \u03c3 : Perm n, Perm.sign \u03c3 \u2022 \u220f i, A (\u03c3 i) i) := congr_arg abv (det_apply _)\n _ \u2264 \u2211 \u03c3 : Perm n, abv (Perm.sign \u03c3 \u2022 \u220f i, A (\u03c3 i) i) := abv.sum_le _ _\n _ = \u2211 \u03c3 : Perm n, \u220f i, abv (A (\u03c3 i) i) :=\n sum_congr rfl fun \u03c3 _ => by rw [abv.map_units_int_smul, abv.map_prod]\n _ \u2264 \u2211 _\u03c3 : Perm n, \u220f _i : n, x := by gcongr; simp [hx]\n _ = (Fintype.card n)! \u2022 x ^ Fintype.card n := by simp [Fintype.card_perm]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_transpose (L198-L226)\ntheorem adjugate_transpose (A : Matrix n n \u03b1) : (adjugate A)\u1d40 = adjugate A\u1d40 := by\next i j\n rw [transpose_apply, adjugate_apply, adjugate_apply, updateRow_transpose, det_transpose]\n rw [det_apply', det_apply']\n apply Finset.sum_congr rfl\n intro \u03c3 _\n congr 1\n by_cases h : i = \u03c3 j\n \u00b7 -- Everything except `(i, j)` (= `(\u03c3 j, j)`) is given by A, and the rest is a single `1`.\n congr\n ext j'\n subst h\n have : \u03c3 j' = \u03c3 j \u2194 j' = j := \u03c3.injective.eq_iff\n rw [updateRow_apply, updateCol_apply]\n simp_rw [this]\n rw [\u2190 dite_eq_ite, \u2190 dite_eq_ite]\n congr 1 with rfl\n rw [Pi.single_eq_same, Pi.single_eq_same]\n \u00b7 -- Otherwise, we need to show that there is a `0` somewhere in the product.\n have : (\u220f j' : n, updateCol A j (Pi.single i 1) (\u03c3 j') j') = 0 := by\n apply prod_eq_zero (mem_univ j)\n rw [updateCol_self, Pi.single_eq_of_ne' h]\n rw [this]\n apply prod_eq_zero (mem_univ (\u03c3\u207b\u00b9 i))\n simp only [Perm.coe_inv, apply_symm_apply, updateRow_self]\n apply Pi.single_eq_of_ne\n intro h'\n exact h ((symm_apply_eq \u03c3).mp h')\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_apply (L97-L99)\ntheorem cramer_apply (i : n) : cramer A b i = (A.updateCol i b).det :=\nrfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.sum_cramer_apply (L148-L157)\ntheorem sum_cramer_apply {\u03b2} (s : Finset \u03b2) (f : n \u2192 \u03b2 \u2192 \u03b1) (i : n) :\n (\u2211 x \u2208 s, cramer A (fun j => f j x) i) = cramer A (fun j : n => \u2211 x \u2208 s, f j x) i :=\ncalc\n (\u2211 x \u2208 s, cramer A (fun j => f j x) i) = (\u2211 x \u2208 s, cramer A fun j => f j x) i :=\n (Finset.sum_apply i s _).symm\n _ = cramer A (fun j : n => \u2211 x \u2208 s, f j x) i := by\n rw [sum_cramer, cramer_apply]\n congr with j\n apply Finset.sum_apply\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_apply (L194-L197)\ntheorem adjugate_apply (A : Matrix n n \u03b1) (i j : n) :\n adjugate A i j = (A.updateRow j (Pi.single i 1)).det := by\nrw [adjugate_def, of_apply, cramer_apply, updateCol_transpose, det_transpose]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.Matrix.AbsoluteValue.det_sum_smul_le (L62-L73)\ntheorem det_sum_smul_le {\u03b9 : Type*} (s : Finset \u03b9) {c : \u03b9 \u2192 R} {A : \u03b9 \u2192 Matrix n n R}\n {abv : AbsoluteValue R S} {x : S} (hx : \u2200 k i j, abv (A k i j) \u2264 x) {y : S}\n (hy : \u2200 k, abv (c k) \u2264 y) :\n abv (det (\u2211 k \u2208 s, c k \u2022 A k)) \u2264\n Nat.factorial (Fintype.card n) \u2022 (#s \u2022 y * x) ^ Fintype.card n := by\nsimpa only [smul_mul_assoc] using\n det_sum_le s fun k i j =>\n calc\n abv (c k * A k i j) = abv (c k) * abv (A k i j) := abv.map_mul _ _\n _ \u2264 y * x := mul_le_mul (hy k) (hx k i j) (abv.nonneg _) ((abv.nonneg _).trans (hy k))\n\nend Matrix\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_smul (L128-L131)\ntheorem cramer_smul (r : \u03b1) (A : Matrix n n \u03b1) :\n cramer (r \u2022 A) = r ^ (Fintype.card n - 1) \u2022 cramer A :=\nLinearMap.ext fun _ => funext fun _ => det_updateCol_smul_left _ _ _ _\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.LinearAlgebra.Matrix.ConjTranspose).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem vecMul_conjTranspose [Fintype n] [StarRing \u03b1] (A : Matrix m n \u03b1) (x : n \u2192 \u03b1) :\n x \u1d65* A\u1d34 = star (A *\u1d65 star x)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose (L41-L43)\ndef conjTranspose [Star \u03b1] (M : Matrix m n \u03b1) : Matrix n m \u03b1 :=\nM.transpose.map star\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_single (L48-L57)\nlemma conjTranspose_single [DecidableEq n] [DecidableEq m] [AddMonoid \u03b1]\n [StarAddMonoid \u03b1] (i : m) (j : n) (a : \u03b1) :\n (single i j a)\u1d34 = single j i (star a) := by\nchange (single i j a).transpose.map starAddEquiv = single j i (star a)\n simp\n\nsection Diagonal\n\nvariable [DecidableEq n]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.diagonal_conjTranspose (L59-L67)\ntheorem diagonal_conjTranspose [AddMonoid \u03b1] [StarAddMonoid \u03b1] (v : n \u2192 \u03b1) :\n (diagonal v)\u1d34 = diagonal (star v) := by\nrw [conjTranspose, diagonal_transpose, diagonal_map (star_zero _)]\n rfl\n\nend Diagonal\n\nsection Diag\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.diag_conjTranspose (L69-L82)\ntheorem diag_conjTranspose [Star \u03b1] (A : Matrix n n \u03b1) :\n diag A\u1d34 = star (diag A) :=\nrfl\n\nend Diag\n\nsection DotProduct\n\nvariable [Fintype m] [Fintype n]\n\nsection StarRing\n\nvariable [NonUnitalSemiring \u03b1] [StarRing \u03b1] (v w : m \u2192 \u03b1)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_dotProduct_star (L83-L84)\ntheorem star_dotProduct_star : star v \u2b1d\u1d65 star w = star (w \u2b1d\u1d65 v) := by simp [dotProduct]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_dotProduct (L85-L86)\ntheorem star_dotProduct : star v \u2b1d\u1d65 w = star (star w \u2b1d\u1d65 v) := by simp [dotProduct]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.dotProduct_star (L87-L96)\ntheorem dotProduct_star : v \u2b1d\u1d65 star w = star (w \u2b1d\u1d65 star v) := by simp [dotProduct]\nend StarRing\n\nend DotProduct\n\nsection NonUnitalSemiring\n\nvariable [NonUnitalSemiring \u03b1]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_mulVec (L97-L100)\ntheorem star_mulVec [Fintype n] [StarRing \u03b1] (M : Matrix m n \u03b1) (v : n \u2192 \u03b1) :\n star (M *\u1d65 v) = star v \u1d65* M\u1d34 :=\nfunext fun _ => (star_dotProduct_star _ _).symm\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.star_vecMul (L101-L104)\ntheorem star_vecMul [Fintype m] [StarRing \u03b1] (M : Matrix m n \u03b1) (v : m \u2192 \u03b1) :\n star (v \u1d65* M) = M\u1d34 *\u1d65 star v :=\nfunext fun _ => (star_dotProduct_star _ _).symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.mulVec_conjTranspose (L105-L108)\ntheorem mulVec_conjTranspose [Fintype m] [StarRing \u03b1] (A : Matrix m n \u03b1) (x : m \u2192 \u03b1) :\n A\u1d34 *\u1d65 x = star (star x \u1d65* A) :=\nfunext fun _ => star_dotProduct _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_vecMulVec (L116-L127)\ntheorem conjTranspose_vecMulVec [Mul \u03b1] [StarMul \u03b1] (w : m \u2192 \u03b1) (v : n \u2192 \u03b1) :\n (vecMulVec w v)\u1d34 = vecMulVec (star v) (star w) :=\next fun _ _ => star_mul _ _\n\nsection ConjTranspose\n\nopen Matrix\n\n/-- Tell `simp` what the entries are in a conjugate transposed matrix.\n\n Compare with `mul_apply`, `diagonal_apply_eq`, etc.\n-/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_apply (L129-L132)\ntheorem conjTranspose_apply [Star \u03b1] (M : Matrix m n \u03b1) (i j) :\n M.conjTranspose j i = star (M i j) :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_conjTranspose (L134-L137)\ntheorem conjTranspose_conjTranspose [InvolutiveStar \u03b1] (M : Matrix m n \u03b1) : M\u1d34\u1d34 = M :=\nMatrix.ext <| by simp\n\nvariable (n \u03b1) in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_involutive (L138-L141)\ntheorem conjTranspose_involutive [InvolutiveStar \u03b1] :\n (conjTranspose : Matrix n n \u03b1 \u2192 Matrix n n \u03b1).Involutive :=\nconjTranspose_conjTranspose\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.Matrix.ConjTranspose.conjTranspose_transpose (L142-L145)\ntheorem conjTranspose_transpose [Star \u03b1] (M : Matrix m n \u03b1) :\n M\u1d34\u1d40 = M.map star :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_def (L191-L193)\ntheorem adjugate_def (A : Matrix n n \u03b1) : adjugate A = of fun i => cramer A\u1d40 (Pi.single i 1) :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_zero (L136-L142)\ntheorem cramer_zero [Nontrivial n] : cramer (0 : Matrix n n \u03b1) = 0 := by\next i j\n obtain \u27e8j', hj'\u27e9 : \u2203 j', j' \u2260 j := exists_ne j\n apply det_eq_zero_of_column_eq_zero j'\n simp [updateCol_ne hj']\n\n/-- Use linearity of `cramer` to take it out of a summation. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.sum_cramer (L143-L147)\ntheorem sum_cramer {\u03b2} (s : Finset \u03b2) (f : \u03b2 \u2192 n \u2192 \u03b1) :\n (\u2211 x \u2208 s, cramer A (f x)) = cramer A (\u2211 x \u2208 s, f x) :=\n(map_sum (cramer A) ..).symm\n\n/-- Use linearity of `cramer` and vector evaluation to take `cramer A _ i` out of a summation. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_subsingleton_apply (L133-L135)\ntheorem cramer_subsingleton_apply [Subsingleton n] (A : Matrix n n \u03b1) (b : n \u2192 \u03b1) (i : n) :\n cramer A b i = b i := by rw [cramer_apply, det_eq_elem_of_subsingleton _ i, updateCol_self]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.IsSymm (L227-L229)\ntheorem IsSymm.adjugate {A : Matrix n n \u03b1} (hA : A.IsSymm) : A.adjugate.IsSymm := by\nrw [IsSymm, Matrix.adjugate_transpose, hA.eq]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_transpose_row_self (L103-L114)\ntheorem cramer_transpose_row_self (i : n) : A\u1d40.cramer (A i) = Pi.single i A.det := by\next j\n rw [cramer_apply, Pi.single_apply]\n split_ifs with h\n \u00b7 -- i = j: this entry should be `A.det`\n subst h\n simp only [updateCol_transpose, det_transpose, updateRow_eq_self]\n \u00b7 -- i \u2260 j: this entry should be 0\n rw [updateCol_transpose, det_transpose]\n apply det_zero_of_row_eq h\n rw [updateRow_self, updateRow_ne (Ne.symm h)]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramerMap (L76-L78)\ndef cramerMap (i : n) : \u03b1 :=\n(A.updateCol i b).det\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_transpose_apply (L100-L102)\ntheorem cramer_transpose_apply (i : n) : cramer A\u1d40 b i = (A.updateRow i b).det := by\nrw [cramer_apply, updateCol_transpose, det_transpose]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.Matrix.AbsoluteValue.det_sum_le (L52-L61)\ntheorem det_sum_le {\u03b9 : Type*} (s : Finset \u03b9) {A : \u03b9 \u2192 Matrix n n R} {abv : AbsoluteValue R S}\n {x : S} (hx : \u2200 k i j, abv (A k i j) \u2264 x) :\n abv (det (\u2211 k \u2208 s, A k)) \u2264 (Fintype.card n)! \u2022 (#s \u2022 x) ^ Fintype.card n :=\ndet_le fun i j =>\n calc\n abv ((\u2211 k \u2208 s, A k) i j) = abv (\u2211 k \u2208 s, A k i j) := by simp only [sum_apply]\n _ \u2264 \u2211 k \u2208 s, abv (A k i j) := abv.sum_le _ _\n _ \u2264 \u2211 _k \u2208 s, x := by gcongr; apply hx\n _ = #s \u2022 x := sum_const _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_submatrix_equiv_self (L231-L238)\ntheorem adjugate_submatrix_equiv_self (e : n \u2243 m) (A : Matrix m m \u03b1) :\n adjugate (A.submatrix e e) = (adjugate A).submatrix e e := by\next i j\n have : (fun j \u21a6 Pi.single i 1 <| e.symm j) = Pi.single (e i) 1 :=\n Function.update_comp_equiv (0 : n \u2192 \u03b1) e.symm i 1\n rw [adjugate_apply, submatrix_apply, adjugate_apply, \u2190 det_submatrix_equiv_self e,\n updateRow_submatrix_equiv, this]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramerMap_is_linear (L79-L82)\ntheorem cramerMap_is_linear (i : n) : IsLinearMap \u03b1 fun b => cramerMap A b i :=\n{ map_add := det_updateCol_add _ _\n map_smul := det_updateCol_smul _ _ }\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_row_self (L115-L119)\ntheorem cramer_row_self (i : n) (h : \u2200 j, b j = A j i) : A.cramer b = Pi.single i A.det := by\nrw [\u2190 transpose_transpose A, det_transpose]\n convert cramer_transpose_row_self A\u1d40 i\n exact funext h\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate (L188-L190)\ndef adjugate (A : Matrix n n \u03b1) : Matrix n n \u03b1 :=\nof fun i => cramer A\u1d40 (Pi.single i 1)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer (L94-L96)\ndef cramer (A : Matrix n n \u03b1) : (n \u2192 \u03b1) \u2192\u2097[\u03b1] (n \u2192 \u03b1) :=\nIsLinearMap.mk' (cramerMap A) (cramer_is_linear A)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_reindex (L164-L187)\ntheorem cramer_reindex (e : m \u2243 n) (A : Matrix m m \u03b1) (b : n \u2192 \u03b1) :\n cramer (reindex e e A) b = cramer A (b \u2218 e) \u2218 e.symm :=\ncramer_submatrix_equiv _ _ _\n\nend Cramer\n\nsection Adjugate\n\n/-!\n### `adjugate` section\n\nDefine the `adjugate` matrix and a few equations.\nThese will hold for any matrix over a commutative ring.\n-/\n\n\n/-- The adjugate matrix is the transpose of the cofactor matrix.\n\n Typically, the cofactor matrix is defined by taking minors,\n i.e. the determinant of the matrix with a row and column removed.\n However, the proof of `mul_adjugate` becomes a lot easier if we use the\n matrix replacing a column with a basis vector, since it allows us to use\n facts about the `cramer` map.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_is_linear (L83-L93)\ntheorem cramer_is_linear : IsLinearMap \u03b1 (cramerMap A) := by\nconstructor <;> intros <;> ext i\n \u00b7 apply (cramerMap_is_linear A i).1\n \u00b7 apply (cramerMap_is_linear A i).2\n\n/-- `cramer A b i` is the determinant of the matrix `A` with column `i` replaced with `b`,\n and thus `cramer A b` is the vector output by Cramer's rule on `A` and `b`.\n\n If `A * x = b` has a unique solution in `x`, `cramer A` sends the vector `b` to `A.det \u2022 x`.\n Otherwise, the outcome of `cramer` is well-defined but not necessarily useful.\n-/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_one (L121-L127)\ntheorem cramer_one : cramer (1 : Matrix n n \u03b1) = 1 := by\next i j\n convert congr_fun (cramer_row_self (1 : Matrix n n \u03b1) (Pi.single i 1) i _) j\n \u00b7 simp\n \u00b7 intro j\n rw [Matrix.one_eq_pi_single, Pi.single_comm]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_submatrix_equiv (L158-L163)\ntheorem cramer_submatrix_equiv (A : Matrix m m \u03b1) (e : n \u2243 m) (b : n \u2192 \u03b1) :\n cramer (A.submatrix e e) b = cramer A (b \u2218 e.symm) \u2218 e := by\next i\n simp_rw [Function.comp_apply, cramer_apply, updateCol_submatrix_equiv,\n det_submatrix_equiv_self e, Function.comp_def]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.Matrix.AbsoluteValue.det_le (L42-L51)\ntheorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : \u2200 i j, abv (A i j) \u2264 x) :\n abv A.det \u2264 (Fintype.card n)! \u2022 x ^ Fintype.card n :=\ncalc\n abv A.det = abv (\u2211 \u03c3 : Perm n, Perm.sign \u03c3 \u2022 \u220f i, A (\u03c3 i) i) := congr_arg abv (det_apply _)\n _ \u2264 \u2211 \u03c3 : Perm n, abv (Perm.sign \u03c3 \u2022 \u220f i, A (\u03c3 i) i) := abv.sum_le _ _\n _ = \u2211 \u03c3 : Perm n, \u220f i, abv (A (\u03c3 i) i) :=\n sum_congr rfl fun \u03c3 _ => by rw [abv.map_units_int_smul, abv.map_prod]\n _ \u2264 \u2211 _\u03c3 : Perm n, \u220f _i : n, x := by gcongr; simp [hx]\n _ = (Fintype.card n)! \u2022 x ^ Fintype.card n := by simp [Fintype.card_perm]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_transpose (L198-L226)\ntheorem adjugate_transpose (A : Matrix n n \u03b1) : (adjugate A)\u1d40 = adjugate A\u1d40 := by\next i j\n rw [transpose_apply, adjugate_apply, adjugate_apply, updateRow_transpose, det_transpose]\n rw [det_apply', det_apply']\n apply Finset.sum_congr rfl\n intro \u03c3 _\n congr 1\n by_cases h : i = \u03c3 j\n \u00b7 -- Everything except `(i, j)` (= `(\u03c3 j, j)`) is given by A, and the rest is a single `1`.\n congr\n ext j'\n subst h\n have : \u03c3 j' = \u03c3 j \u2194 j' = j := \u03c3.injective.eq_iff\n rw [updateRow_apply, updateCol_apply]\n simp_rw [this]\n rw [\u2190 dite_eq_ite, \u2190 dite_eq_ite]\n congr 1 with rfl\n rw [Pi.single_eq_same, Pi.single_eq_same]\n \u00b7 -- Otherwise, we need to show that there is a `0` somewhere in the product.\n have : (\u220f j' : n, updateCol A j (Pi.single i 1) (\u03c3 j') j') = 0 := by\n apply prod_eq_zero (mem_univ j)\n rw [updateCol_self, Pi.single_eq_of_ne' h]\n rw [this]\n apply prod_eq_zero (mem_univ (\u03c3\u207b\u00b9 i))\n simp only [Perm.coe_inv, apply_symm_apply, updateRow_self]\n apply Pi.single_eq_of_ne\n intro h'\n exact h ((symm_apply_eq \u03c3).mp h')\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_apply (L97-L99)\ntheorem cramer_apply (i : n) : cramer A b i = (A.updateCol i b).det :=\nrfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.sum_cramer_apply (L148-L157)\ntheorem sum_cramer_apply {\u03b2} (s : Finset \u03b2) (f : n \u2192 \u03b2 \u2192 \u03b1) (i : n) :\n (\u2211 x \u2208 s, cramer A (fun j => f j x) i) = cramer A (fun j : n => \u2211 x \u2208 s, f j x) i :=\ncalc\n (\u2211 x \u2208 s, cramer A (fun j => f j x) i) = (\u2211 x \u2208 s, cramer A fun j => f j x) i :=\n (Finset.sum_apply i s _).symm\n _ = cramer A (fun j : n => \u2211 x \u2208 s, f j x) i := by\n rw [sum_cramer, cramer_apply]\n congr with j\n apply Finset.sum_apply\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.adjugate_apply (L194-L197)\ntheorem adjugate_apply (A : Matrix n n \u03b1) (i j : n) :\n adjugate A i j = (A.updateRow j (Pi.single i 1)).det := by\nrw [adjugate_def, of_apply, cramer_apply, updateCol_transpose, det_transpose]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.Matrix.AbsoluteValue.det_sum_smul_le (L62-L73)\ntheorem det_sum_smul_le {\u03b9 : Type*} (s : Finset \u03b9) {c : \u03b9 \u2192 R} {A : \u03b9 \u2192 Matrix n n R}\n {abv : AbsoluteValue R S} {x : S} (hx : \u2200 k i j, abv (A k i j) \u2264 x) {y : S}\n (hy : \u2200 k, abv (c k) \u2264 y) :\n abv (det (\u2211 k \u2208 s, c k \u2022 A k)) \u2264\n Nat.factorial (Fintype.card n) \u2022 (#s \u2022 y * x) ^ Fintype.card n := by\nsimpa only [smul_mul_assoc] using\n det_sum_le s fun k i j =>\n calc\n abv (c k * A k i j) = abv (c k) * abv (A k i j) := abv.map_mul _ _\n _ \u2264 y * x := mul_le_mul (hy k) (hx k i j) (abv.nonneg _) ((abv.nonneg _).trans (hy k))\n\nend Matrix\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.Matrix.Adjugate.cramer_smul (L128-L131)\ntheorem cramer_smul (r : \u03b1) (A : Matrix n n \u03b1) :\n cramer (r \u2022 A) = r ^ (Fintype.card n - 1) \u2022 cramer A :=\nLinearMap.ext fun _ => funext fun _ => det_updateCol_smul_left _ _ _ _\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Matrix/ConjTranspose.lean", "module": "Mathlib.LinearAlgebra.Matrix.ConjTranspose", "declaration": "Mathlib.LinearAlgebra.Matrix.ConjTranspose.vecMul_conjTranspose", "span": "L109-L114", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/ConjTranspose.lean#L109"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 5539, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 14712, "lean_code_chars": 13201, "natural_language_chars": 1511, "lean_code_ratio": 0.8973, "line_count": 456, "imports_count": 0, "declarations_count": 1706, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "57958e7d9de05ff9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_id", "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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma cfcHom_id :\n cfcHom ha ((ContinuousMap.id R).restrict <| spectrum R a) = a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.is (L50-L142)\ntheorem is nearly impossible to state nicely in terms of `cfcHom` (see `cfcHom_comp`). An\nadditional advantage of the unbundled approach is that expressions like `fun x : R \u21a6 x\u207b\u00b9` are valid\narguments to `cfc`, and a bundled continuous counterpart can only make sense when the spectrum of\n`a` does not contain zero and when we have an `\u207b\u00b9` operation on the domain.\n\nA reader familiar with C\u22c6-algebra theory may be somewhat surprised at the level of abstraction here.\nFor instance, why not require `A` to be an actual C\u22c6-algebra? Why define separate continuous\nfunctional calculi for `R := \u2102`, `\u211d` or `\u211d\u22650` instead of simply using the continuous functional\ncalculus for normal elements? The reason for both can be explained with a simple example,\n`A := Matrix n n \u211d`. In Mathlib, matrices are not equipped with a norm (nor even a metric), and so\nrequiring `A` to be a C\u22c6-algebra is far too stringent. Likewise, `A` is not a `\u2102`-algebra, and so\nit is impossible to consider the `\u2102`-spectrum of `a : Matrix n n \u211d`.\n\nThere is another, more practical reason to define separate continuous functional calculi for\ndifferent scalar rings. It gives us the ability to use functions defined on these types, and the\nalgebra of functions on them. For example, for `R := \u211d` it is quite natural to consider the\nfunctions `(\u00b7\u207a : \u211d \u2192 \u211d)` and `(\u00b7\u207b : \u211d \u2192 \u211d)` because the functions `\u211d \u2192 \u211d` form a lattice ordered\ngroup. If `a : A` is selfadjoint, and we define `a\u207a := cfc (\u00b7\u207a : \u211d \u2192 \u211d) a`, and likewise for `a\u207b`,\nthen the properties `a\u207a * a\u207b = 0 = a\u207b * a\u207a` and `a = a\u207a - a\u207b` are trivial consequences of the\ncorresponding facts for functions. In contrast, if we had to do this using functions on `\u2102`, the\nproofs of these facts would be much more cumbersome.\n\n## Example\n\nThe canonical example of the continuous functional calculus is when `A := Matrix n n \u2102`, `R := \u2102`\nand `p := IsStarNormal`. In this case, `spectrum \u2102 a` consists of the eigenvalues of the normal\nmatrix `a : Matrix n n \u2102`, and, because this set is discrete, any function is continuous on the\nspectrum. The continuous functional calculus allows us to make sense of expressions like `log a`\n(`:= cfc log a`), and when `0 \u2209 spectrum \u2102 a`, we get the nice property `exp (log a) = a`, which\narises from the composition property `cfc exp (cfc log a) = cfc (exp \u2218 log) a = cfc id a = a`, since\n`exp \u2218 log = id` *on the spectrum of `a`*. Of course, there are other ways to make sense of `exp`\nand `log` for matrices (power series), and these agree with the continuous functional calculus.\nIn fact, given `f : C(spectrum \u2102 a, \u2102)`, `cfc f a` amounts to diagonalizing `a` (possible since `a`\nis normal), and applying `f` to the resulting diagonal entries. That is, if `a = u * d * star u`\nwith `u` a unitary matrix and `d` diagonal, then `cfc f a = u * d.map f * star u`.\n\nIn addition, if `a : Matrix n n \u2102` is positive semidefinite, then the `\u2102`-spectrum of `a` is\ncontained in (the range of the coercion of) `\u211d\u22650`. In this case, we get a continuous functional\ncalculus with `R := \u211d\u22650`. From this we can define `\u221aa := cfc a NNReal.sqrt`, which is also\npositive semidefinite (because `cfc` preserves the predicate), and this is truly a square root since\n```\n\u221aa * \u221aa = cfc NNReal.sqrt a * cfc NNReal.sqrt a =\n cfc (NNReal.sqrt ^ 2) a = cfc id a = a\n```\nThe composition property allows us to show that, in fact, this is the *unique* positive semidefinite\nsquare root of `a` because, if `b` is any positive semidefinite square root, then\n```\nb = cfc id b = cfc (NNReal.sqrt \u2218 (\u00b7 ^ 2)) b =\n cfc NNReal.sqrt (cfc b (\u00b7 ^ 2)) = cfc NNReal.sqrt a = \u221aa\n```\n\n## Main declarations\n\n+ `ContinuousFunctionalCalculus R A (p : A \u2192 Prop)`: a class stating that every `a : A` satisfying\n `p a` has a star algebra homomorphism from the continuous `R`-valued functions on the\n `R`-spectrum of `a` into the algebra `A`. This map is a closed embedding, and satisfies the\n **spectral mapping theorem**.\n+ `cfcHom : p a \u2192 C(spectrum R a, R) \u2192\u22c6\u2090[R] A`: the underlying star algebra homomorphism for an\n element satisfying property `p`.\n+ `cfc : (R \u2192 R) \u2192 A \u2192 A`: an unbundled version of `cfcHom` which takes the junk value `0` when\n `cfcHom` is not defined.\n+ `cfcUnits`: builds a unit from `cfc f a` when `f` is nonzero and continuous on the\n spectrum of `a`.\n\n## Main theorems\n\n+ `cfc_comp : cfc (x \u21a6 g (f x)) a = cfc g (cfc f a)`\n+ `cfc_polynomial`: the continuous functional calculus extends the polynomial functional calculus.\n\n## Implementation details\n\nInstead of defining a class depending on a term `a : A`, we register it for an `outParam` predicate\n`p : A \u2192 Prop`, and then any element of `A` satisfying this predicate has the associated star\nalgebra homomorphism with the specified properties. In so doing we avoid a common pitfall:\ndependence of the class on a term. This avoids annoying situations where `a b : A` are\npropositionally equal, but not definitionally so, and hence Lean would not be able to automatically\nidentify the continuous functional calculi associated to these elements. In order to guarantee\nthe necessary properties, we require that the continuous functional calculus preserves this\npredicate. That is, `p a \u2192 p (cfc f a)` for any function `f` continuous on the spectrum of `a`.\n\nAs stated above, the unbundled approach to `cfc` has its advantages. For instance, given an\nexpression `cfc f a`, the user is free to rewrite either `a` or `f` as desired with no possibility\nof the expression ceasing to be defined. However, this unbundling also has some potential downsides.\nIn particular, by unbundling, proof requirements are deferred until the user calls the lemmas, most\nof which have hypotheses both of `p a` and of `ContinuousOn f (spectrum R a)`.\n\nIn order to minimize burden to the user, we provide `autoParams` in terms of two tactics. Goals\nrelated to continuity are dispatched by (a small wrapper around) `fun_prop`. As for goals involving\nthe predicate `p`, it should be noted that these will only ever be of the form `IsStarNormal a`,\n`IsSelfAdjoint a` or `0 \u2264 a`. For the moment we provide a rudimentary tactic to deal with these\ngoals, but it can be modified to become more sophisticated as the need arises.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.ContinuousFunctionalCalculus (L210-L213)\nlemma ContinuousFunctionalCalculus.isCompact_spectrum (a : A) :\n IsCompact (spectrum R a) :=\nisCompact_iff_compactSpace.mpr inferInstance\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.StarAlgHom (L214-L241)\nlemma StarAlgHom.ext_continuousMap [UniqueHom R A]\n (a : A) [CompactSpace (spectrum R a)] (\u03c6 \u03c8 : C(spectrum R a, R) \u2192\u22c6\u2090[R] A)\n (h\u03c6 : Continuous \u03c6) (h\u03c8 : Continuous \u03c8)\n (h : \u03c6 (.restrict (spectrum R a) <| .id R) = \u03c8 (.restrict (spectrum R a) <| .id R)) :\n \u03c6 = \u03c8 :=\nUniqueHom.eq_of_continuous_of_map_id (spectrum R a) \u03c6 \u03c8 h\u03c6 h\u03c8 h\n\nsection cfcHom\n\nvariable {a : A} (ha : p a)\n\n-- Note: since `spectrum R a` is closed, we may always extend `f : C(spectrum R a, R)` to a function\n-- of type `C(R, R)` by the Tietze extension theorem (assuming `R` is either `\u211d`, `\u2102` or `\u211d\u22650`).\n\n/-- The star algebra homomorphism underlying an instance of the continuous functional calculus;\na version for continuous functions on the spectrum.\n\nIn this case, the user must supply the fact that `a` satisfies the predicate `p`, for otherwise it\nmay be the case that no star algebra homomorphism exists. For instance if `R := \u211d` and `a` is an\nelement whose spectrum (in `\u2102`) is disjoint from `\u211d`, then `spectrum \u211d a = \u2205` and so there can be\nno star algebra homomorphism between these spaces.\n\nWhile `ContinuousFunctionalCalculus` is stated in terms of these homomorphisms, in practice the\nuser should instead prefer `cfc` over `cfcHom`.\n-/\nnoncomputable def cfcHom : C(spectrum R a, R) \u2192\u22c6\u2090[R] A :=\n (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_continuous (L243-L245)\nlemma cfcHom_continuous : Continuous (cfcHom ha : C(spectrum R a, R) \u2192\u22c6\u2090[R] A) :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.1\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_injective (L246-L248)\nlemma cfcHom_injective : Function.Injective (cfcHom ha : C(spectrum R a, R) \u2192\u22c6\u2090[R] A) :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.1\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_map_spectrum (L254-L257)\nlemma cfcHom_map_spectrum (f : C(spectrum R a, R)) :\n spectrum R (cfcHom ha f) = Set.range f :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.2.1 f\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_predicate (L258-L262)\nlemma cfcHom_predicate (f : C(spectrum R a, R)) :\n p (cfcHom ha f) :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.2.2 f\n\nopen scoped ContinuousFunctionalCalculus in\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_eq_of_continuous_of_map_id (L263-L268)\nlemma cfcHom_eq_of_continuous_of_map_id [UniqueHom R A]\n (\u03c6 : C(spectrum R a, R) \u2192\u22c6\u2090[R] A) (h\u03c6\u2081 : Continuous \u03c6)\n (h\u03c6\u2082 : \u03c6 (.restrict (spectrum R a) <| .id R) = a) : cfcHom ha = \u03c6 :=\n(cfcHom ha).ext_continuousMap a \u03c6 (cfcHom_continuous ha) h\u03c6\u2081 <| by\n rw [cfcHom_id ha, h\u03c6\u2082]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_comp (L269-L287)\ntheorem cfcHom_comp [UniqueHom R A] (f : C(spectrum R a, R))\n (f' : C(spectrum R a, spectrum R (cfcHom ha f)))\n (hff' : \u2200 x, f x = f' x) (g : C(spectrum R (cfcHom ha f), R)) :\n cfcHom ha (g.comp f') = cfcHom (cfcHom_predicate ha f) g := by\nlet \u03c6 : C(spectrum R (cfcHom ha f), R) \u2192\u22c6\u2090[R] A :=\n (cfcHom ha).comp <| ContinuousMap.compStarAlgHom' R R f'\n suffices cfcHom (cfcHom_predicate ha f) = \u03c6 from DFunLike.congr_fun this.symm g\n refine cfcHom_eq_of_continuous_of_map_id (cfcHom_predicate ha f) \u03c6 ?_ ?_\n \u00b7 exact cfcHom_continuous ha |>.comp f'.continuous_precomp\n \u00b7 simp only [\u03c6, StarAlgHom.comp_apply, ContinuousMap.compStarAlgHom'_apply]\n congr\n ext x\n simp [hff']\n\nend cfcHom\n\nsection cfcL\n\n/-- `cfcHom` bundled as a continuous linear map. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply (L318-L320)\nlemma cfc_apply : cfc f a = cfcHom (a := a) ha \u27e8_, hf.restrict\u27e9 := by\nrw [cfc_def, dif_pos \u27e8ha, hf\u27e9]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_pi (L321-L326)\nlemma cfc_apply_pi {\u03b9 : Type*} (f : \u03b9 \u2192 R \u2192 R) (a : A) (ha : p a := by cfc_tac)\n(hf : \u2200 i, ContinuousOn (f i) (spectrum R a) := by cfc_cont_tac) :\n (fun i => cfc (f i) a) = (fun i => cfcHom (a := a) ha \u27e8_, (hf i).restrict\u27e9) := by\n ext i\n simp only [cfc_apply (f i) a ha (hf i)]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_of_not_and (L327-L330)\nlemma cfc_apply_of_not_and {f : R \u2192 R} (a : A) (ha : \u00ac (p a \u2227 ContinuousOn f (spectrum R a))) :\n cfc f a = 0 := by\nrw [cfc_def, dif_neg ha]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_of_not_predicate (L331-L334)\nlemma cfc_apply_of_not_predicate {f : R \u2192 R} (a : A) (ha : \u00ac p a) :\n cfc f a = 0 := by\nrw [cfc_def, dif_neg (not_and_of_not_left _ ha)]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_of_not_continuousOn (L335-L338)\nlemma cfc_apply_of_not_continuousOn {f : R \u2192 R} (a : A) (hf : \u00ac ContinuousOn f (spectrum R a)) :\n cfc f a = 0 := by\nrw [cfc_def, dif_neg (not_and_of_not_right _ hf)]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_eq_cfc_extend (L339-L347)\nlemma cfcHom_eq_cfc_extend {a : A} (g : R \u2192 R) (ha : p a) (f : C(spectrum R a, R)) :\n cfcHom ha f = cfc (Function.extend Subtype.val f g) a := by\nhave h : f = (spectrum R a).restrict (Function.extend Subtype.val f g) := by\n ext; simp\n have hg : ContinuousOn (Function.extend Subtype.val f g) (spectrum R a) :=\n continuousOn_iff_continuous_restrict.mpr <| h \u25b8 map_continuous f\n rw [cfc_apply ..]\n congr!\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.nnnorm_star (L60-L63)\ntheorem nnnorm_star (x : E) : \u2016star x\u2016\u208a = \u2016x\u2016\u208a :=\nSubtype.ext <| norm_star _\n\n/-- The `star` map in a normed star group is a normed group homomorphism. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_star (L56-L58)\nlemma norm_star (x : E) : \u2016x\u22c6\u2016 = \u2016x\u2016 :=\nle_antisymm (NormedStarGroup.norm_star_le x) (by simpa using NormedStarGroup.norm_star_le x\u22c6)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.eventually_star_eq (L161-L171)\nlemma eventually_star_eq {l : Filter A} (hl : l.IsIncreasingApproximateUnit) :\n \u2200\u1da0 x in l, star x = x :=\nhl.eventually_isSelfAdjoint.mp <| .of_forall fun _ \u21a6 IsSelfAdjoint.star_eq\n\nend Filter.IsIncreasingApproximateUnit\n\nnamespace CStarAlgebra\n\nopen Submodule in\n/-- To show that `l` is a one-sided approximate unit for `A`, it suffices to verify it only for\n`m : A` with `0 \u2264 m` and `\u2016m\u2016 < 1`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.hasBasis_approximateUnit (L211-L218)\nlemma hasBasis_approximateUnit :\n (approximateUnit A).HasBasis (fun x : A \u21a6 0 \u2264 x \u2227 \u2016x\u2016 < 1) ({x | \u00b7 \u2264 x} \u2229 closedBall 0 1) :=\nisBasis_nonneg_sections A |>.hasBasis.inf_principal (closedBall 0 1)\n\n/-- This is a common reasoning sequence in C\u22c6-algebra theory. If `0 \u2264 x \u2264 y \u2264 1`, then the norm of\n`z - y * z` is controlled by the norm of `star z * (1 - x) * z`, which is advantageous because the\nlatter is nonnegative. This is a key step in establishing the existence of an increasing approximate\nunit in general C\u22c6-algebras. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.star_isometry (L68-L71)\ntheorem star_isometry : Isometry (star : E \u2192 E) :=\nshow Isometry starAddEquiv from\n AddMonoidHomClass.isometry_of_norm starAddEquiv (show \u2200 x, \u2016x\u22c6\u2016 = \u2016x\u2016 from norm_star)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.eventually_isSelfAdjoint (L157-L160)\nlemma eventually_isSelfAdjoint {l : Filter A} (hl : l.IsIncreasingApproximateUnit) :\n \u2200\u1da0 x in l, IsSelfAdjoint x :=\nhl.eventually_nonneg.mp <| .of_forall fun _ \u21a6 IsSelfAdjoint.of_nonneg\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.increasingApproximateUnit (L314-L331)\nlemma increasingApproximateUnit :\n IsIncreasingApproximateUnit (approximateUnit A) where\n tendsto_mul_left := by\nrw [tendsto_mul_left_iff_tendsto_mul_right]\n \u00b7 exact tendsto_mul_right_approximateUnit\n \u00b7 rw [(hasBasis_approximateUnit A).eventually_iff]\n peel (hasBasis_approximateUnit A).ex_mem with x hx\n exact \u27e8hx, fun y hy \u21a6 (hx.1.trans hy.1).isSelfAdjoint\u27e9\n tendsto_mul_right := tendsto_mul_right_approximateUnit\n eventually_nonneg := .filter_mono inf_le_left <|\n (isBasis_nonneg_sections A).hasBasis.eventually_iff.mpr \u27e80, by simp\u27e9\n eventually_norm := .filter_mono inf_le_right <| by simp\n neBot := hasBasis_approximateUnit A |>.neBot_iff.mpr\n fun hx \u21a6 \u27e8_, \u27e8le_rfl, by simpa using hx.2.le\u27e9\u27e9\n\nend CStarAlgebra\n\nend ApproximateUnit\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_self_mul_star (L125-L128)\ntheorem norm_self_mul_star {x : E} : \u2016x * x\u22c6\u2016 = \u2016x\u2016 * \u2016x\u2016 := by\nnth_rw 1 [\u2190 star_star x]\n simp only [norm_star_mul_self, norm_star]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.RingHomIsometric (L82-L91)\ninstance RingHomIsometric.starRingEnd [NormedCommRing E] [StarRing E] [NormedStarGroup E] :\n RingHomIsometric (starRingEnd E) :=\n\u27e8@norm_star _ _ _ _\u27e9\n\n/-- A C*-ring is a normed star ring that satisfies the stronger condition `\u2016x\u2016 ^ 2 \u2264 \u2016x\u22c6 * x\u2016`\nfor every `x`. Note that this condition actually implies equality, as is shown in\n`norm_star_mul_self` below. -/\nclass CStarRing (E : Type*) [NonUnitalNormedRing E] [StarRing E] : Prop where\n norm_mul_self_le : \u2200 x : E, \u2016x\u2016 * \u2016x\u2016 \u2264 \u2016x\u22c6 * x\u2016\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.isBasis_nonneg_sections (L197-L205)\nlemma isBasis_nonneg_sections :\n IsBasis (fun x : A \u21a6 0 \u2264 x \u2227 \u2016x\u2016 < 1) ({x | \u00b7 \u2264 x}) where\n nonempty := \u27e80, by simp\u27e9\ninter {x y} hx hy := by\n peel directedOn_nonneg_ball x (by simpa) y (by simpa) with z hz\n exact \u27e8by simpa using hz.1, fun a ha \u21a6 \u27e8hz.2.1.trans ha, hz.2.2.trans ha\u27e9\u27e9\n\n/-- The canonical approximate unit in a C\u22c6-algebra generated by the basis of sets\n`{x | a \u2264 x} \u2229 closedBall 0 1` for `0 \u2264 a`. See also `CStarAlgebra.hasBasis_approximateUnit`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.norm_sub_mul_self_le_of_inr (L246-L313)\nlemma norm_sub_mul_self_le_of_inr {x y : A} (z : A) (hx\u2080 : 0 \u2264 x) (hxy : x \u2264 y) (hy\u2081 : \u2016y\u2016 \u2264 1)\n {c : \u211d} (hc : 0 \u2264 c) (h : \u2016star (z : A\u207a\u00b9) * (1 - x) * z\u2016 \u2264 c ^ 2) :\n \u2016z - y * z\u2016 \u2264 c := by\nrw [\u2190 norm_inr (\ud835\udd5c := \u2102), inr_sub, inr_mul]\n refine norm_sub_mul_self_le _ ?_ ?_ hc h\n \u00b7 rwa [inr_nonneg_iff]\n \u00b7 have hy := hx\u2080.trans hxy\n rw [Set.mem_Icc, inr_le_iff _ _ hx\u2080.isSelfAdjoint hy.isSelfAdjoint,\n \u2190 norm_le_one_iff_of_nonneg _, norm_inr]\n exact \u27e8hxy, hy\u2081\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\nvariable {A} in\n/-- This shows `CStarAlgebra.approximateUnit` is a one-sided approximate unit, but this is marked\n`private` because it is only used to prove `CStarAlgebra.increasingApproximateUnit`. -/\nprivate lemma tendsto_mul_right_approximateUnit (m : A) :\n Tendsto (\u00b7 * m) (approximateUnit A) (\ud835\udcdd m) := by\n refine tendsto_mul_right_of_forall_nonneg_tendsto (fun m hm\u2081 hm\u2082 \u21a6 ?_) m\n rw [(hasBasis_approximateUnit A).tendsto_iff nhds_basis_closedBall]\n intro \u03b5 h\u03b5\n lift \u03b5 to \u211d\u22650 using h\u03b5.le\n rw [coe_pos] at h\u03b5\n refine \u27e8cfc\u2099 (fun y : \u211d\u22650 \u21a6 1 - (1 + y)\u207b\u00b9) (\u03b5\u207b\u00b9 ^ 2 \u2022 m),\n \u27e8cfc\u2099_nonneg_of_predicate, norm_cfc\u2099_one_sub_one_add_inv_lt_one (\u03b5\u207b\u00b9 ^ 2 \u2022 m)\u27e9, ?_\u27e9\n rintro x \u27e8(hx\u2081 : _ \u2264 x), hx\u2082\u27e9\n simp only [mem_closedBall, dist_eq_norm', zero_sub, norm_neg] at hx\u2082 \u22a2\n rw [\u2190 coe_nnnorm, coe_le_coe]\n have hx\u2080 : 0 \u2264 x := cfc\u2099_nonneg_of_predicate.trans hx\u2081\n rw [\u2190 inr_le_iff _ _ (.of_nonneg cfc\u2099_nonneg_of_predicate) (.of_nonneg hx\u2080),\n nnreal_cfc\u2099_eq_cfc_inr _ _ (by simp [tsub_self]), inr_smul] at hx\u2081\n rw [\u2190 norm_inr (\ud835\udd5c := \u2102)] at hm\u2082 hx\u2082\n rw [\u2190 inr_nonneg_iff] at hx\u2080 hm\u2081\n rw [\u2190 nnnorm_inr (\ud835\udd5c := \u2102), inr_sub, inr_mul]\n generalize (x : A\u207a\u00b9) = x, (m : A\u207a\u00b9) = m at *\n set g : \u211d\u22650 \u2192 \u211d\u22650 := fun y \u21a6 1 - (1 + y)\u207b\u00b9\n have hg : Continuous g := by\n rw [\u2190 continuousOn_univ]\n fun_prop (disch := intro _ _; positivity)\n have hg' : ContinuousOn (fun y \u21a6 (1 + \u03b5\u207b\u00b9 ^ 2 \u2022 y)\u207b\u00b9) (spectrum \u211d\u22650 m) :=\n ContinuousOn.inv\u2080 (by fun_prop) fun _ _ \u21a6 by positivity\n have hx : x \u2208 Set.Icc 0 1 := mem_Icc_iff_norm_le_one.mpr \u27e8hx\u2080, hx\u2082\u27e9\n have hx' : x \u2208 Set.Icc _ 1 := \u27e8hx\u2081, hx.2\u27e9\n refine nnnorm_sub_mul_self_le m cfc_nonneg_of_predicate hx' ?_\n suffices star m * (1 - cfc g (\u03b5\u207b\u00b9 ^ 2 \u2022 m)) * m =\n cfc (fun y : \u211d\u22650 \u21a6 y * (1 + \u03b5\u207b\u00b9 ^ 2 \u2022 y)\u207b\u00b9 * y) m by\n rw [this]\n refine nnnorm_cfc_nnreal_le fun y hy \u21a6 ?_\n calc\n y * (1 + \u03b5\u207b\u00b9 ^ 2 \u2022 y)\u207b\u00b9 * y = y * \u03b5 ^ 2 * (y / (\u03b5 ^ 2 + y)) := by simp [field]\n _ \u2264 \u03b5 ^ 2 * 1 := by\n gcongr\n \u00b7 refine mul_le_of_le_one_left (zero_le _) ?_\n have hm' := hm\u2082.le\n rw [norm_le_one_iff_of_nonneg m hm\u2081, \u2190 cfc_id' \u211d\u22650 m, \u2190 cfc_one (R := \u211d\u22650) m,\n cfc_nnreal_le_iff _ _ _ (QuasispectrumRestricts.nnreal_of_nonneg hm\u2081)] at hm'\n exact hm' y hy\n \u00b7 exact div_le_one (by positivity) |>.mpr le_add_self\n _ = \u03b5 ^ 2 := mul_one _\n rw [cfc_mul _ _ m (continuousOn_id' _ |>.fun_mul hg') (continuousOn_id' _),\n cfc_mul _ _ m (continuousOn_id' _) hg', cfc_id' .., hm\u2081.star_eq]\n congr\n rw [\u2190 cfc_one (R := \u211d\u22650) m, \u2190 cfc_comp_smul _ _ _ hg.continuousOn hm\u2081,\n \u2190 cfc_tsub _ _ m (by simp [g]) hm\u2081 (by fun_prop) (Continuous.continuousOn <| by fun_prop)]\n refine cfc_congr (fun y _ \u21a6 ?_)\n simp [g, tsub_tsub_cancel_of_le]\n\n/-- The filter `CStarAlgebra.approximateUnit` generated by the sections\n`{x | a \u2264 x} \u2229 closedBall 0 1` for `0 \u2264 a` forms an increasing approximate unit. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.starNormedAddGroupHom (L64-L67)\ndef starNormedAddGroupHom : NormedAddGroupHom E E :=\n{ starAddEquiv with bound' := \u27e81, fun _ => le_trans (norm_star _).le (one_mul _).symm.le\u27e9 }\n\n/-- The `star` map in a normed star group is an isometry -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.of_le_norm_mul_star_self (L100-L114)\nlemma of_le_norm_mul_star_self\n [NonUnitalNormedRing E] [StarRing E]\n (h : \u2200 x : E, \u2016x\u2016 * \u2016x\u2016 \u2264 \u2016x * x\u22c6\u2016) : CStarRing E :=\nhave : NormedStarGroup E :=\n { norm_star_le x := by\n obtain (hx | hx) := eq_zero_or_norm_pos x\u22c6\n \u00b7 simp [hx]\n \u00b7 refine le_of_mul_le_mul_right ?_ hx\n simpa [sq, mul_comm \u2016x\u22c6\u2016] using h x\u22c6 |>.trans <| norm_mul_le _ _ }\n \u27e8star_involutive.surjective.forall.mpr <| by simpa\u27e9\n\nvariable [NonUnitalNormedRing E] [StarRing E] [CStarRing E]\n\n-- see Note [lower instance priority]\n/-- In a C*-ring, star preserves the norm. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.nnnorm_sub_mul_self_le (L219-L237)\nlemma nnnorm_sub_mul_self_le {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A]\n {x y : A} (z : A) (hx\u2080 : 0 \u2264 x) (hy : y \u2208 Set.Icc x 1) {c : \u211d\u22650}\n (h : \u2016star z * (1 - x) * z\u2016\u208a \u2264 c ^ 2) :\n \u2016z - y * z\u2016\u208a \u2264 c := by\nnth_rw 1 [\u2190 one_mul z]\n rw [\u2190 sqrt_sq c, le_sqrt_iff_sq_le, \u2190 sub_mul, sq, \u2190 CStarRing.nnnorm_star_mul_self]\n simp only [star_mul, star_sub, star_one]\n have hy\u2080 : y \u2208 Set.Icc 0 1 := \u27e8hx\u2080.trans hy.1, hy.2\u27e9\n have hy' : 1 - y \u2208 Set.Icc 0 1 := Set.sub_mem_Icc_zero_iff_right.mpr hy\u2080\n rw [hy\u2080.1.star_eq, \u2190 mul_assoc, mul_assoc (star _), \u2190 sq]\n refine nnnorm_le_nnnorm_of_nonneg_of_le (star_left_conjugate_nonneg (pow_nonneg hy'.1 2) _) ?_\n |>.trans h\n refine star_left_conjugate_le_conjugate ?_ _\n trans (1 - y)\n \u00b7 simpa using pow_antitone hy'.1 hy'.2 one_le_two\n \u00b7 gcongr\n exact hy.1\n\n/-- A variant of `nnnorm_sub_mul_self_le` which uses `\u2016\u00b7\u2016` instead of `\u2016\u00b7\u2016\u208a`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.Set (L91-L104)\nlemma Set.InvOn.one_sub_one_add_inv : Set.InvOn (fun x \u21a6 1 - (1 + x)\u207b\u00b9) (fun x \u21a6 x * (1 - x)\u207b\u00b9)\n {x : \u211d\u22650 | x < 1} {x : \u211d\u22650 | x < 1} := by\nhave : (fun x : \u211d\u22650 \u21a6 x * (1 + x)\u207b\u00b9) = fun x \u21a6 1 - (1 + x)\u207b\u00b9 := by\n ext x : 1\n simp [field, mul_tsub]\n rw [\u2190 this]\n constructor <;> intro x (hx : x < 1)\n \u00b7 have : 0 < 1 - x := tsub_pos_of_lt hx\n simp [field, tsub_add_cancel_of_le hx.le]\n \u00b7 simp [mul_assoc, \u2190 mul_inv, mul_tsub]\n field_simp\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.CStarAlgebra (L110-L152)\nlemma CStarAlgebra.directedOn_nonneg_ball :\n DirectedOn (\u00b7 \u2264 \u00b7) ({x : A | 0 \u2264 x} \u2229 Metric.ball 0 1) := by\nlet f : \u211d\u22650 \u2192 \u211d\u22650 := fun x => 1 - (1 + x)\u207b\u00b9\n let g : \u211d\u22650 \u2192 \u211d\u22650 := fun x => x * (1 - x)\u207b\u00b9\n suffices \u2200 a b : A, 0 \u2264 a \u2192 0 \u2264 b \u2192 \u2016a\u2016 < 1 \u2192 \u2016b\u2016 < 1 \u2192\n a \u2264 cfc\u2099 f (cfc\u2099 g a + cfc\u2099 g b) by\n rintro a \u27e8(ha\u2081 : 0 \u2264 a), ha\u2082\u27e9 b \u27e8(hb\u2081 : 0 \u2264 b), hb\u2082\u27e9\n simp only [Metric.mem_ball, dist_zero_right] at ha\u2082 hb\u2082\n refine \u27e8cfc\u2099 f (cfc\u2099 g a + cfc\u2099 g b), \u27e8by simp, ?_\u27e9, ?_, ?_\u27e9\n \u00b7 simpa only [Metric.mem_ball, dist_zero_right] using norm_cfc\u2099_one_sub_one_add_inv_lt_one _\n \u00b7 exact this a b ha\u2081 hb\u2081 ha\u2082 hb\u2082\n \u00b7 exact add_comm (cfc\u2099 g a) (cfc\u2099 g b) \u25b8 this b a hb\u2081 ha\u2081 hb\u2082 ha\u2082\n rintro a b ha\u2081 - ha\u2082 -\n calc\n a = cfc\u2099 (f \u2218 g) a := by\n conv_lhs => rw [\u2190 cfc\u2099_id \u211d\u22650 a]\n refine cfc\u2099_congr (Set.InvOn.one_sub_one_add_inv.1.eqOn.symm.mono fun x hx \u21a6 ?_)\n exact lt_of_le_of_lt (le_nnnorm_of_mem_quasispectrum hx) ha\u2082\n _ = cfc\u2099 f (cfc\u2099 g a) := by\n rw [cfc\u2099_comp f g a ?_ (by simp [f, tsub_self]) ?_ (by simp [g]) ha\u2081]\n \u00b7 fun_prop (disch := intro _ _; positivity)\n \u00b7 have (x) (hx : x \u2208 \u03c3\u2099 \u211d\u22650 a) : 1 - x \u2260 0 := by\n refine tsub_pos_of_lt ?_ |>.ne'\n exact lt_of_le_of_lt (le_nnnorm_of_mem_quasispectrum hx) ha\u2082\n fun_prop (disch := assumption)\n _ \u2264 cfc\u2099 f (cfc\u2099 g a + cfc\u2099 g b) := by\n have hab' : cfc\u2099 g a \u2264 cfc\u2099 g a + cfc\u2099 g b := le_add_of_nonneg_right cfc\u2099_nonneg_of_predicate\n exact CFC.monotoneOn_one_sub_one_add_inv cfc\u2099_nonneg_of_predicate\n (cfc\u2099_nonneg_of_predicate.trans hab') hab'\n\nsection ApproximateUnit\n\nopen Metric Filter Topology\n\n/-- An *increasing approximate unit* in a C\u22c6-algebra is an approximate unit contained in the\nclosed unit ball of nonnegative elements. -/\nstructure Filter.IsIncreasingApproximateUnit (l : Filter A) : Prop extends l.IsApproximateUnit where\n eventually_nonneg : \u2200\u1da0 x in l, 0 \u2264 x\n eventually_norm : \u2200\u1da0 x in l, \u2016x\u2016 \u2264 1\n\nnamespace Filter.IsIncreasingApproximateUnit\n\nomit [StarOrderedRing A] in\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.norm_cfc\u2099_one_sub_one_add_inv_lt_one (L105-L109)\nlemma norm_cfc\u2099_one_sub_one_add_inv_lt_one (a : A) :\n \u2016cfc\u2099 (fun x : \u211d\u22650 \u21a6 1 - (1 + x)\u207b\u00b9) a\u2016 < 1 :=\nnnnorm_cfc\u2099_nnreal_lt fun x _ \u21a6 tsub_lt_self zero_lt_one (by positivity)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.tendsto_mul_right_of_forall_nonneg_tendsto (L172-L185)\nlemma tendsto_mul_right_of_forall_nonneg_tendsto {l : Filter A}\n (h : \u2200 m, 0 \u2264 m \u2192 \u2016m\u2016 < 1 \u2192 Tendsto (\u00b7 * m) l (\ud835\udcdd m)) (m : A) :\n Tendsto (\u00b7 * m) l (\ud835\udcdd m) := by\nobtain \u27e8n, c, x, rfl\u27e9 := mem_span_set'.mp <| by\n change m \u2208 span \u2102 ({x | 0 \u2264 x} \u2229 ball 0 1)\n simp [span_nonneg_inter_unitBall]\n simp_rw [Finset.mul_sum]\n refine tendsto_finset_sum _ fun i _ \u21a6 ?_\n simp_rw [mul_smul_comm]\n exact tendsto_const_nhds.smul <| h (x i) (x i).2.1 <| by simpa using (x i).2.2\n\nomit [PartialOrder A] in\n/-- Multiplication on the left by `m` tends to `\ud835\udcdd m` if and only if multiplication on the right\ndoes, provided the elements are eventually selfadjoint along the filter `l`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_star_mul_self' (L129-L130)\ntheorem norm_star_mul_self' {x : E} : \u2016x\u22c6 * x\u2016 = \u2016x\u22c6\u2016 * \u2016x\u2016 := by rw [norm_star_mul_self, norm_star]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.eventually_nnnorm (L153-L156)\nlemma eventually_nnnorm {l : Filter A} (hl : l.IsIncreasingApproximateUnit) :\n \u2200\u1da0 x in l, \u2016x\u2016\u208a \u2264 1 :=\nhl.eventually_norm\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.norm_sub_mul_self_le (L238-L245)\nlemma norm_sub_mul_self_le {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A]\n {x y : A} (z : A) (hx\u2080 : 0 \u2264 x) (hy : y \u2208 Set.Icc x 1)\n {c : \u211d} (hc : 0 \u2264 c) (h : \u2016star z * (1 - x) * z\u2016 \u2264 c ^ 2) :\n \u2016z - y * z\u2016 \u2264 c :=\nnnnorm_sub_mul_self_le z hx\u2080 hy h (c := \u27e8c, hc\u27e9)\n\nvariable {A} in\n/-- A variant of `norm_sub_mul_self_le` for non-unital algebras that passes to the unitization. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_star_mul_self (L122-L124)\ntheorem norm_star_mul_self {x : E} : \u2016x\u22c6 * x\u2016 = \u2016x\u2016 * \u2016x\u2016 :=\nle_antisymm ((norm_mul_le _ _).trans (by rw [norm_star])) (CStarRing.norm_mul_self_le x)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.tendsto_mul_left_iff_tendsto_mul_right (L186-L196)\nlemma tendsto_mul_left_iff_tendsto_mul_right {l : Filter A} (hl : \u2200\u1da0 x in l, IsSelfAdjoint x) :\n (\u2200 m, Tendsto (m * \u00b7) l (\ud835\udcdd m)) \u2194 (\u2200 m, Tendsto (\u00b7 * m) l (\ud835\udcdd m)) := by\nrefine \u27e8fun h m \u21a6 ?_, fun h m \u21a6 ?_\u27e9\n all_goals\n apply (star_star m \u25b8 (continuous_star.tendsto _ |>.comp <| h (star m))).congr'\n filter_upwards [hl] with x hx\n simp [hx.star_eq]\n\nvariable (A)\n\n/-- The sections of positive strict contractions form a filter basis. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.approximateUnit (L206-L210)\ndef approximateUnit : Filter A :=\n(isBasis_nonneg_sections A).filter \u2293 \ud835\udcdf (closedBall 0 1)\n\n/-- The canonical approximate unit in a C\u22c6-algebra has a basis of sets\n`{x | a \u2264 x} \u2229 closedBall 0 1` for `0 \u2264 a`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.CFC (L54-L72)\nlemma CFC.monotoneOn_one_sub_one_add_inv :\n MonotoneOn (cfc\u2099 (fun x : \u211d\u22650 \u21a6 1 - (1 + x)\u207b\u00b9)) (Set.Ici (0 : A)) := by\nintro a ha b hb hab\n simp only [Set.mem_Ici] at ha hb\n rw [\u2190 inr_le_iff .., nnreal_cfc\u2099_eq_cfc_inr a _, nnreal_cfc\u2099_eq_cfc_inr b _]\n rw [\u2190 inr_le_iff a b (.of_nonneg ha) (.of_nonneg hb)] at hab\n rw [\u2190 inr_nonneg_iff] at ha hb\n have h_cfc_one_sub (c : A\u207a\u00b9) (hc : 0 \u2264 c := by cfc_tac) :\n cfc (fun x : \u211d\u22650 \u21a6 1 - (1 + x)\u207b\u00b9) c = 1 - cfc (\u00b7\u207b\u00b9 : \u211d\u22650 \u2192 \u211d\u22650) (1 + c) := by\n rw [cfc_tsub _ _ _ (fun x _ \u21a6 by simp) (hg := by fun_prop (disch := intro _ _; positivity)),\n cfc_const_one \u211d\u22650 c, cfc_comp' (\u00b7\u207b\u00b9) (1 + \u00b7) c ?_, cfc_add .., cfc_const_one \u211d\u22650 c,\n cfc_id' \u211d\u22650 c]\n exact continuousOn_id.inv\u2080 (Set.forall_mem_image.mpr fun x _ \u21a6 by dsimp only [id]; positivity)\n rw [h_cfc_one_sub (a : A\u207a\u00b9), h_cfc_one_sub (b : A\u207a\u00b9)]\n gcongr\n rw [\u2190 CFC.rpow_neg_one_eq_cfc_inv, \u2190 CFC.rpow_neg_one_eq_cfc_inv]\n exact rpow_neg_one_le_rpow_neg_one (by gcongr)\n\nset_option backward.isDefEq.respectTransparency false in\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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma cfcHom_id :\n cfcHom ha ((ContinuousMap.id R).restrict <| spectrum R a) = a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.is (L50-L142)\ntheorem is nearly impossible to state nicely in terms of `cfcHom` (see `cfcHom_comp`). An\nadditional advantage of the unbundled approach is that expressions like `fun x : R \u21a6 x\u207b\u00b9` are valid\narguments to `cfc`, and a bundled continuous counterpart can only make sense when the spectrum of\n`a` does not contain zero and when we have an `\u207b\u00b9` operation on the domain.\n\nA reader familiar with C\u22c6-algebra theory may be somewhat surprised at the level of abstraction here.\nFor instance, why not require `A` to be an actual C\u22c6-algebra? Why define separate continuous\nfunctional calculi for `R := \u2102`, `\u211d` or `\u211d\u22650` instead of simply using the continuous functional\ncalculus for normal elements? The reason for both can be explained with a simple example,\n`A := Matrix n n \u211d`. In Mathlib, matrices are not equipped with a norm (nor even a metric), and so\nrequiring `A` to be a C\u22c6-algebra is far too stringent. Likewise, `A` is not a `\u2102`-algebra, and so\nit is impossible to consider the `\u2102`-spectrum of `a : Matrix n n \u211d`.\n\nThere is another, more practical reason to define separate continuous functional calculi for\ndifferent scalar rings. It gives us the ability to use functions defined on these types, and the\nalgebra of functions on them. For example, for `R := \u211d` it is quite natural to consider the\nfunctions `(\u00b7\u207a : \u211d \u2192 \u211d)` and `(\u00b7\u207b : \u211d \u2192 \u211d)` because the functions `\u211d \u2192 \u211d` form a lattice ordered\ngroup. If `a : A` is selfadjoint, and we define `a\u207a := cfc (\u00b7\u207a : \u211d \u2192 \u211d) a`, and likewise for `a\u207b`,\nthen the properties `a\u207a * a\u207b = 0 = a\u207b * a\u207a` and `a = a\u207a - a\u207b` are trivial consequences of the\ncorresponding facts for functions. In contrast, if we had to do this using functions on `\u2102`, the\nproofs of these facts would be much more cumbersome.\n\n## Example\n\nThe canonical example of the continuous functional calculus is when `A := Matrix n n \u2102`, `R := \u2102`\nand `p := IsStarNormal`. In this case, `spectrum \u2102 a` consists of the eigenvalues of the normal\nmatrix `a : Matrix n n \u2102`, and, because this set is discrete, any function is continuous on the\nspectrum. The continuous functional calculus allows us to make sense of expressions like `log a`\n(`:= cfc log a`), and when `0 \u2209 spectrum \u2102 a`, we get the nice property `exp (log a) = a`, which\narises from the composition property `cfc exp (cfc log a) = cfc (exp \u2218 log) a = cfc id a = a`, since\n`exp \u2218 log = id` *on the spectrum of `a`*. Of course, there are other ways to make sense of `exp`\nand `log` for matrices (power series), and these agree with the continuous functional calculus.\nIn fact, given `f : C(spectrum \u2102 a, \u2102)`, `cfc f a` amounts to diagonalizing `a` (possible since `a`\nis normal), and applying `f` to the resulting diagonal entries. That is, if `a = u * d * star u`\nwith `u` a unitary matrix and `d` diagonal, then `cfc f a = u * d.map f * star u`.\n\nIn addition, if `a : Matrix n n \u2102` is positive semidefinite, then the `\u2102`-spectrum of `a` is\ncontained in (the range of the coercion of) `\u211d\u22650`. In this case, we get a continuous functional\ncalculus with `R := \u211d\u22650`. From this we can define `\u221aa := cfc a NNReal.sqrt`, which is also\npositive semidefinite (because `cfc` preserves the predicate), and this is truly a square root since\n```\n\u221aa * \u221aa = cfc NNReal.sqrt a * cfc NNReal.sqrt a =\n cfc (NNReal.sqrt ^ 2) a = cfc id a = a\n```\nThe composition property allows us to show that, in fact, this is the *unique* positive semidefinite\nsquare root of `a` because, if `b` is any positive semidefinite square root, then\n```\nb = cfc id b = cfc (NNReal.sqrt \u2218 (\u00b7 ^ 2)) b =\n cfc NNReal.sqrt (cfc b (\u00b7 ^ 2)) = cfc NNReal.sqrt a = \u221aa\n```\n\n## Main declarations\n\n+ `ContinuousFunctionalCalculus R A (p : A \u2192 Prop)`: a class stating that every `a : A` satisfying\n `p a` has a star algebra homomorphism from the continuous `R`-valued functions on the\n `R`-spectrum of `a` into the algebra `A`. This map is a closed embedding, and satisfies the\n **spectral mapping theorem**.\n+ `cfcHom : p a \u2192 C(spectrum R a, R) \u2192\u22c6\u2090[R] A`: the underlying star algebra homomorphism for an\n element satisfying property `p`.\n+ `cfc : (R \u2192 R) \u2192 A \u2192 A`: an unbundled version of `cfcHom` which takes the junk value `0` when\n `cfcHom` is not defined.\n+ `cfcUnits`: builds a unit from `cfc f a` when `f` is nonzero and continuous on the\n spectrum of `a`.\n\n## Main theorems\n\n+ `cfc_comp : cfc (x \u21a6 g (f x)) a = cfc g (cfc f a)`\n+ `cfc_polynomial`: the continuous functional calculus extends the polynomial functional calculus.\n\n## Implementation details\n\nInstead of defining a class depending on a term `a : A`, we register it for an `outParam` predicate\n`p : A \u2192 Prop`, and then any element of `A` satisfying this predicate has the associated star\nalgebra homomorphism with the specified properties. In so doing we avoid a common pitfall:\ndependence of the class on a term. This avoids annoying situations where `a b : A` are\npropositionally equal, but not definitionally so, and hence Lean would not be able to automatically\nidentify the continuous functional calculi associated to these elements. In order to guarantee\nthe necessary properties, we require that the continuous functional calculus preserves this\npredicate. That is, `p a \u2192 p (cfc f a)` for any function `f` continuous on the spectrum of `a`.\n\nAs stated above, the unbundled approach to `cfc` has its advantages. For instance, given an\nexpression `cfc f a`, the user is free to rewrite either `a` or `f` as desired with no possibility\nof the expression ceasing to be defined. However, this unbundling also has some potential downsides.\nIn particular, by unbundling, proof requirements are deferred until the user calls the lemmas, most\nof which have hypotheses both of `p a` and of `ContinuousOn f (spectrum R a)`.\n\nIn order to minimize burden to the user, we provide `autoParams` in terms of two tactics. Goals\nrelated to continuity are dispatched by (a small wrapper around) `fun_prop`. As for goals involving\nthe predicate `p`, it should be noted that these will only ever be of the form `IsStarNormal a`,\n`IsSelfAdjoint a` or `0 \u2264 a`. For the moment we provide a rudimentary tactic to deal with these\ngoals, but it can be modified to become more sophisticated as the need arises.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.ContinuousFunctionalCalculus (L210-L213)\nlemma ContinuousFunctionalCalculus.isCompact_spectrum (a : A) :\n IsCompact (spectrum R a) :=\nisCompact_iff_compactSpace.mpr inferInstance\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.StarAlgHom (L214-L241)\nlemma StarAlgHom.ext_continuousMap [UniqueHom R A]\n (a : A) [CompactSpace (spectrum R a)] (\u03c6 \u03c8 : C(spectrum R a, R) \u2192\u22c6\u2090[R] A)\n (h\u03c6 : Continuous \u03c6) (h\u03c8 : Continuous \u03c8)\n (h : \u03c6 (.restrict (spectrum R a) <| .id R) = \u03c8 (.restrict (spectrum R a) <| .id R)) :\n \u03c6 = \u03c8 :=\nUniqueHom.eq_of_continuous_of_map_id (spectrum R a) \u03c6 \u03c8 h\u03c6 h\u03c8 h\n\nsection cfcHom\n\nvariable {a : A} (ha : p a)\n\n-- Note: since `spectrum R a` is closed, we may always extend `f : C(spectrum R a, R)` to a function\n-- of type `C(R, R)` by the Tietze extension theorem (assuming `R` is either `\u211d`, `\u2102` or `\u211d\u22650`).\n\n/-- The star algebra homomorphism underlying an instance of the continuous functional calculus;\na version for continuous functions on the spectrum.\n\nIn this case, the user must supply the fact that `a` satisfies the predicate `p`, for otherwise it\nmay be the case that no star algebra homomorphism exists. For instance if `R := \u211d` and `a` is an\nelement whose spectrum (in `\u2102`) is disjoint from `\u211d`, then `spectrum \u211d a = \u2205` and so there can be\nno star algebra homomorphism between these spaces.\n\nWhile `ContinuousFunctionalCalculus` is stated in terms of these homomorphisms, in practice the\nuser should instead prefer `cfc` over `cfcHom`.\n-/\nnoncomputable def cfcHom : C(spectrum R a, R) \u2192\u22c6\u2090[R] A :=\n (ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_continuous (L243-L245)\nlemma cfcHom_continuous : Continuous (cfcHom ha : C(spectrum R a, R) \u2192\u22c6\u2090[R] A) :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.1\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_injective (L246-L248)\nlemma cfcHom_injective : Function.Injective (cfcHom ha : C(spectrum R a, R) \u2192\u22c6\u2090[R] A) :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.1\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_map_spectrum (L254-L257)\nlemma cfcHom_map_spectrum (f : C(spectrum R a, R)) :\n spectrum R (cfcHom ha f) = Set.range f :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.2.1 f\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_predicate (L258-L262)\nlemma cfcHom_predicate (f : C(spectrum R a, R)) :\n p (cfcHom ha f) :=\n(ContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.2.2 f\n\nopen scoped ContinuousFunctionalCalculus in\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_eq_of_continuous_of_map_id (L263-L268)\nlemma cfcHom_eq_of_continuous_of_map_id [UniqueHom R A]\n (\u03c6 : C(spectrum R a, R) \u2192\u22c6\u2090[R] A) (h\u03c6\u2081 : Continuous \u03c6)\n (h\u03c6\u2082 : \u03c6 (.restrict (spectrum R a) <| .id R) = a) : cfcHom ha = \u03c6 :=\n(cfcHom ha).ext_continuousMap a \u03c6 (cfcHom_continuous ha) h\u03c6\u2081 <| by\n rw [cfcHom_id ha, h\u03c6\u2082]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_comp (L269-L287)\ntheorem cfcHom_comp [UniqueHom R A] (f : C(spectrum R a, R))\n (f' : C(spectrum R a, spectrum R (cfcHom ha f)))\n (hff' : \u2200 x, f x = f' x) (g : C(spectrum R (cfcHom ha f), R)) :\n cfcHom ha (g.comp f') = cfcHom (cfcHom_predicate ha f) g := by\nlet \u03c6 : C(spectrum R (cfcHom ha f), R) \u2192\u22c6\u2090[R] A :=\n (cfcHom ha).comp <| ContinuousMap.compStarAlgHom' R R f'\n suffices cfcHom (cfcHom_predicate ha f) = \u03c6 from DFunLike.congr_fun this.symm g\n refine cfcHom_eq_of_continuous_of_map_id (cfcHom_predicate ha f) \u03c6 ?_ ?_\n \u00b7 exact cfcHom_continuous ha |>.comp f'.continuous_precomp\n \u00b7 simp only [\u03c6, StarAlgHom.comp_apply, ContinuousMap.compStarAlgHom'_apply]\n congr\n ext x\n simp [hff']\n\nend cfcHom\n\nsection cfcL\n\n/-- `cfcHom` bundled as a continuous linear map. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply (L318-L320)\nlemma cfc_apply : cfc f a = cfcHom (a := a) ha \u27e8_, hf.restrict\u27e9 := by\nrw [cfc_def, dif_pos \u27e8ha, hf\u27e9]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_pi (L321-L326)\nlemma cfc_apply_pi {\u03b9 : Type*} (f : \u03b9 \u2192 R \u2192 R) (a : A) (ha : p a := by cfc_tac)\n(hf : \u2200 i, ContinuousOn (f i) (spectrum R a) := by cfc_cont_tac) :\n (fun i => cfc (f i) a) = (fun i => cfcHom (a := a) ha \u27e8_, (hf i).restrict\u27e9) := by\n ext i\n simp only [cfc_apply (f i) a ha (hf i)]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_of_not_and (L327-L330)\nlemma cfc_apply_of_not_and {f : R \u2192 R} (a : A) (ha : \u00ac (p a \u2227 ContinuousOn f (spectrum R a))) :\n cfc f a = 0 := by\nrw [cfc_def, dif_neg ha]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_of_not_predicate (L331-L334)\nlemma cfc_apply_of_not_predicate {f : R \u2192 R} (a : A) (ha : \u00ac p a) :\n cfc f a = 0 := by\nrw [cfc_def, dif_neg (not_and_of_not_left _ ha)]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfc_apply_of_not_continuousOn (L335-L338)\nlemma cfc_apply_of_not_continuousOn {f : R \u2192 R} (a : A) (hf : \u00ac ContinuousOn f (spectrum R a)) :\n cfc f a = 0 := by\nrw [cfc_def, dif_neg (not_and_of_not_right _ hf)]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_eq_cfc_extend (L339-L347)\nlemma cfcHom_eq_cfc_extend {a : A} (g : R \u2192 R) (ha : p a) (f : C(spectrum R a, R)) :\n cfcHom ha f = cfc (Function.extend Subtype.val f g) a := by\nhave h : f = (spectrum R a).restrict (Function.extend Subtype.val f g) := by\n ext; simp\n have hg : ContinuousOn (Function.extend Subtype.val f g) (spectrum R a) :=\n continuousOn_iff_continuous_restrict.mpr <| h \u25b8 map_continuous f\n rw [cfc_apply ..]\n congr!\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.nnnorm_star (L60-L63)\ntheorem nnnorm_star (x : E) : \u2016star x\u2016\u208a = \u2016x\u2016\u208a :=\nSubtype.ext <| norm_star _\n\n/-- The `star` map in a normed star group is a normed group homomorphism. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_star (L56-L58)\nlemma norm_star (x : E) : \u2016x\u22c6\u2016 = \u2016x\u2016 :=\nle_antisymm (NormedStarGroup.norm_star_le x) (by simpa using NormedStarGroup.norm_star_le x\u22c6)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.eventually_star_eq (L161-L171)\nlemma eventually_star_eq {l : Filter A} (hl : l.IsIncreasingApproximateUnit) :\n \u2200\u1da0 x in l, star x = x :=\nhl.eventually_isSelfAdjoint.mp <| .of_forall fun _ \u21a6 IsSelfAdjoint.star_eq\n\nend Filter.IsIncreasingApproximateUnit\n\nnamespace CStarAlgebra\n\nopen Submodule in\n/-- To show that `l` is a one-sided approximate unit for `A`, it suffices to verify it only for\n`m : A` with `0 \u2264 m` and `\u2016m\u2016 < 1`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.hasBasis_approximateUnit (L211-L218)\nlemma hasBasis_approximateUnit :\n (approximateUnit A).HasBasis (fun x : A \u21a6 0 \u2264 x \u2227 \u2016x\u2016 < 1) ({x | \u00b7 \u2264 x} \u2229 closedBall 0 1) :=\nisBasis_nonneg_sections A |>.hasBasis.inf_principal (closedBall 0 1)\n\n/-- This is a common reasoning sequence in C\u22c6-algebra theory. If `0 \u2264 x \u2264 y \u2264 1`, then the norm of\n`z - y * z` is controlled by the norm of `star z * (1 - x) * z`, which is advantageous because the\nlatter is nonnegative. This is a key step in establishing the existence of an increasing approximate\nunit in general C\u22c6-algebras. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.star_isometry (L68-L71)\ntheorem star_isometry : Isometry (star : E \u2192 E) :=\nshow Isometry starAddEquiv from\n AddMonoidHomClass.isometry_of_norm starAddEquiv (show \u2200 x, \u2016x\u22c6\u2016 = \u2016x\u2016 from norm_star)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.eventually_isSelfAdjoint (L157-L160)\nlemma eventually_isSelfAdjoint {l : Filter A} (hl : l.IsIncreasingApproximateUnit) :\n \u2200\u1da0 x in l, IsSelfAdjoint x :=\nhl.eventually_nonneg.mp <| .of_forall fun _ \u21a6 IsSelfAdjoint.of_nonneg\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.increasingApproximateUnit (L314-L331)\nlemma increasingApproximateUnit :\n IsIncreasingApproximateUnit (approximateUnit A) where\n tendsto_mul_left := by\nrw [tendsto_mul_left_iff_tendsto_mul_right]\n \u00b7 exact tendsto_mul_right_approximateUnit\n \u00b7 rw [(hasBasis_approximateUnit A).eventually_iff]\n peel (hasBasis_approximateUnit A).ex_mem with x hx\n exact \u27e8hx, fun y hy \u21a6 (hx.1.trans hy.1).isSelfAdjoint\u27e9\n tendsto_mul_right := tendsto_mul_right_approximateUnit\n eventually_nonneg := .filter_mono inf_le_left <|\n (isBasis_nonneg_sections A).hasBasis.eventually_iff.mpr \u27e80, by simp\u27e9\n eventually_norm := .filter_mono inf_le_right <| by simp\n neBot := hasBasis_approximateUnit A |>.neBot_iff.mpr\n fun hx \u21a6 \u27e8_, \u27e8le_rfl, by simpa using hx.2.le\u27e9\u27e9\n\nend CStarAlgebra\n\nend ApproximateUnit\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_self_mul_star (L125-L128)\ntheorem norm_self_mul_star {x : E} : \u2016x * x\u22c6\u2016 = \u2016x\u2016 * \u2016x\u2016 := by\nnth_rw 1 [\u2190 star_star x]\n simp only [norm_star_mul_self, norm_star]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.RingHomIsometric (L82-L91)\ninstance RingHomIsometric.starRingEnd [NormedCommRing E] [StarRing E] [NormedStarGroup E] :\n RingHomIsometric (starRingEnd E) :=\n\u27e8@norm_star _ _ _ _\u27e9\n\n/-- A C*-ring is a normed star ring that satisfies the stronger condition `\u2016x\u2016 ^ 2 \u2264 \u2016x\u22c6 * x\u2016`\nfor every `x`. Note that this condition actually implies equality, as is shown in\n`norm_star_mul_self` below. -/\nclass CStarRing (E : Type*) [NonUnitalNormedRing E] [StarRing E] : Prop where\n norm_mul_self_le : \u2200 x : E, \u2016x\u2016 * \u2016x\u2016 \u2264 \u2016x\u22c6 * x\u2016\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.isBasis_nonneg_sections (L197-L205)\nlemma isBasis_nonneg_sections :\n IsBasis (fun x : A \u21a6 0 \u2264 x \u2227 \u2016x\u2016 < 1) ({x | \u00b7 \u2264 x}) where\n nonempty := \u27e80, by simp\u27e9\ninter {x y} hx hy := by\n peel directedOn_nonneg_ball x (by simpa) y (by simpa) with z hz\n exact \u27e8by simpa using hz.1, fun a ha \u21a6 \u27e8hz.2.1.trans ha, hz.2.2.trans ha\u27e9\u27e9\n\n/-- The canonical approximate unit in a C\u22c6-algebra generated by the basis of sets\n`{x | a \u2264 x} \u2229 closedBall 0 1` for `0 \u2264 a`. See also `CStarAlgebra.hasBasis_approximateUnit`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.norm_sub_mul_self_le_of_inr (L246-L313)\nlemma norm_sub_mul_self_le_of_inr {x y : A} (z : A) (hx\u2080 : 0 \u2264 x) (hxy : x \u2264 y) (hy\u2081 : \u2016y\u2016 \u2264 1)\n {c : \u211d} (hc : 0 \u2264 c) (h : \u2016star (z : A\u207a\u00b9) * (1 - x) * z\u2016 \u2264 c ^ 2) :\n \u2016z - y * z\u2016 \u2264 c := by\nrw [\u2190 norm_inr (\ud835\udd5c := \u2102), inr_sub, inr_mul]\n refine norm_sub_mul_self_le _ ?_ ?_ hc h\n \u00b7 rwa [inr_nonneg_iff]\n \u00b7 have hy := hx\u2080.trans hxy\n rw [Set.mem_Icc, inr_le_iff _ _ hx\u2080.isSelfAdjoint hy.isSelfAdjoint,\n \u2190 norm_le_one_iff_of_nonneg _, norm_inr]\n exact \u27e8hxy, hy\u2081\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\nvariable {A} in\n/-- This shows `CStarAlgebra.approximateUnit` is a one-sided approximate unit, but this is marked\n`private` because it is only used to prove `CStarAlgebra.increasingApproximateUnit`. -/\nprivate lemma tendsto_mul_right_approximateUnit (m : A) :\n Tendsto (\u00b7 * m) (approximateUnit A) (\ud835\udcdd m) := by\n refine tendsto_mul_right_of_forall_nonneg_tendsto (fun m hm\u2081 hm\u2082 \u21a6 ?_) m\n rw [(hasBasis_approximateUnit A).tendsto_iff nhds_basis_closedBall]\n intro \u03b5 h\u03b5\n lift \u03b5 to \u211d\u22650 using h\u03b5.le\n rw [coe_pos] at h\u03b5\n refine \u27e8cfc\u2099 (fun y : \u211d\u22650 \u21a6 1 - (1 + y)\u207b\u00b9) (\u03b5\u207b\u00b9 ^ 2 \u2022 m),\n \u27e8cfc\u2099_nonneg_of_predicate, norm_cfc\u2099_one_sub_one_add_inv_lt_one (\u03b5\u207b\u00b9 ^ 2 \u2022 m)\u27e9, ?_\u27e9\n rintro x \u27e8(hx\u2081 : _ \u2264 x), hx\u2082\u27e9\n simp only [mem_closedBall, dist_eq_norm', zero_sub, norm_neg] at hx\u2082 \u22a2\n rw [\u2190 coe_nnnorm, coe_le_coe]\n have hx\u2080 : 0 \u2264 x := cfc\u2099_nonneg_of_predicate.trans hx\u2081\n rw [\u2190 inr_le_iff _ _ (.of_nonneg cfc\u2099_nonneg_of_predicate) (.of_nonneg hx\u2080),\n nnreal_cfc\u2099_eq_cfc_inr _ _ (by simp [tsub_self]), inr_smul] at hx\u2081\n rw [\u2190 norm_inr (\ud835\udd5c := \u2102)] at hm\u2082 hx\u2082\n rw [\u2190 inr_nonneg_iff] at hx\u2080 hm\u2081\n rw [\u2190 nnnorm_inr (\ud835\udd5c := \u2102), inr_sub, inr_mul]\n generalize (x : A\u207a\u00b9) = x, (m : A\u207a\u00b9) = m at *\n set g : \u211d\u22650 \u2192 \u211d\u22650 := fun y \u21a6 1 - (1 + y)\u207b\u00b9\n have hg : Continuous g := by\n rw [\u2190 continuousOn_univ]\n fun_prop (disch := intro _ _; positivity)\n have hg' : ContinuousOn (fun y \u21a6 (1 + \u03b5\u207b\u00b9 ^ 2 \u2022 y)\u207b\u00b9) (spectrum \u211d\u22650 m) :=\n ContinuousOn.inv\u2080 (by fun_prop) fun _ _ \u21a6 by positivity\n have hx : x \u2208 Set.Icc 0 1 := mem_Icc_iff_norm_le_one.mpr \u27e8hx\u2080, hx\u2082\u27e9\n have hx' : x \u2208 Set.Icc _ 1 := \u27e8hx\u2081, hx.2\u27e9\n refine nnnorm_sub_mul_self_le m cfc_nonneg_of_predicate hx' ?_\n suffices star m * (1 - cfc g (\u03b5\u207b\u00b9 ^ 2 \u2022 m)) * m =\n cfc (fun y : \u211d\u22650 \u21a6 y * (1 + \u03b5\u207b\u00b9 ^ 2 \u2022 y)\u207b\u00b9 * y) m by\n rw [this]\n refine nnnorm_cfc_nnreal_le fun y hy \u21a6 ?_\n calc\n y * (1 + \u03b5\u207b\u00b9 ^ 2 \u2022 y)\u207b\u00b9 * y = y * \u03b5 ^ 2 * (y / (\u03b5 ^ 2 + y)) := by simp [field]\n _ \u2264 \u03b5 ^ 2 * 1 := by\n gcongr\n \u00b7 refine mul_le_of_le_one_left (zero_le _) ?_\n have hm' := hm\u2082.le\n rw [norm_le_one_iff_of_nonneg m hm\u2081, \u2190 cfc_id' \u211d\u22650 m, \u2190 cfc_one (R := \u211d\u22650) m,\n cfc_nnreal_le_iff _ _ _ (QuasispectrumRestricts.nnreal_of_nonneg hm\u2081)] at hm'\n exact hm' y hy\n \u00b7 exact div_le_one (by positivity) |>.mpr le_add_self\n _ = \u03b5 ^ 2 := mul_one _\n rw [cfc_mul _ _ m (continuousOn_id' _ |>.fun_mul hg') (continuousOn_id' _),\n cfc_mul _ _ m (continuousOn_id' _) hg', cfc_id' .., hm\u2081.star_eq]\n congr\n rw [\u2190 cfc_one (R := \u211d\u22650) m, \u2190 cfc_comp_smul _ _ _ hg.continuousOn hm\u2081,\n \u2190 cfc_tsub _ _ m (by simp [g]) hm\u2081 (by fun_prop) (Continuous.continuousOn <| by fun_prop)]\n refine cfc_congr (fun y _ \u21a6 ?_)\n simp [g, tsub_tsub_cancel_of_le]\n\n/-- The filter `CStarAlgebra.approximateUnit` generated by the sections\n`{x | a \u2264 x} \u2229 closedBall 0 1` for `0 \u2264 a` forms an increasing approximate unit. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.starNormedAddGroupHom (L64-L67)\ndef starNormedAddGroupHom : NormedAddGroupHom E E :=\n{ starAddEquiv with bound' := \u27e81, fun _ => le_trans (norm_star _).le (one_mul _).symm.le\u27e9 }\n\n/-- The `star` map in a normed star group is an isometry -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.of_le_norm_mul_star_self (L100-L114)\nlemma of_le_norm_mul_star_self\n [NonUnitalNormedRing E] [StarRing E]\n (h : \u2200 x : E, \u2016x\u2016 * \u2016x\u2016 \u2264 \u2016x * x\u22c6\u2016) : CStarRing E :=\nhave : NormedStarGroup E :=\n { norm_star_le x := by\n obtain (hx | hx) := eq_zero_or_norm_pos x\u22c6\n \u00b7 simp [hx]\n \u00b7 refine le_of_mul_le_mul_right ?_ hx\n simpa [sq, mul_comm \u2016x\u22c6\u2016] using h x\u22c6 |>.trans <| norm_mul_le _ _ }\n \u27e8star_involutive.surjective.forall.mpr <| by simpa\u27e9\n\nvariable [NonUnitalNormedRing E] [StarRing E] [CStarRing E]\n\n-- see Note [lower instance priority]\n/-- In a C*-ring, star preserves the norm. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.nnnorm_sub_mul_self_le (L219-L237)\nlemma nnnorm_sub_mul_self_le {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A]\n {x y : A} (z : A) (hx\u2080 : 0 \u2264 x) (hy : y \u2208 Set.Icc x 1) {c : \u211d\u22650}\n (h : \u2016star z * (1 - x) * z\u2016\u208a \u2264 c ^ 2) :\n \u2016z - y * z\u2016\u208a \u2264 c := by\nnth_rw 1 [\u2190 one_mul z]\n rw [\u2190 sqrt_sq c, le_sqrt_iff_sq_le, \u2190 sub_mul, sq, \u2190 CStarRing.nnnorm_star_mul_self]\n simp only [star_mul, star_sub, star_one]\n have hy\u2080 : y \u2208 Set.Icc 0 1 := \u27e8hx\u2080.trans hy.1, hy.2\u27e9\n have hy' : 1 - y \u2208 Set.Icc 0 1 := Set.sub_mem_Icc_zero_iff_right.mpr hy\u2080\n rw [hy\u2080.1.star_eq, \u2190 mul_assoc, mul_assoc (star _), \u2190 sq]\n refine nnnorm_le_nnnorm_of_nonneg_of_le (star_left_conjugate_nonneg (pow_nonneg hy'.1 2) _) ?_\n |>.trans h\n refine star_left_conjugate_le_conjugate ?_ _\n trans (1 - y)\n \u00b7 simpa using pow_antitone hy'.1 hy'.2 one_le_two\n \u00b7 gcongr\n exact hy.1\n\n/-- A variant of `nnnorm_sub_mul_self_le` which uses `\u2016\u00b7\u2016` instead of `\u2016\u00b7\u2016\u208a`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.Set (L91-L104)\nlemma Set.InvOn.one_sub_one_add_inv : Set.InvOn (fun x \u21a6 1 - (1 + x)\u207b\u00b9) (fun x \u21a6 x * (1 - x)\u207b\u00b9)\n {x : \u211d\u22650 | x < 1} {x : \u211d\u22650 | x < 1} := by\nhave : (fun x : \u211d\u22650 \u21a6 x * (1 + x)\u207b\u00b9) = fun x \u21a6 1 - (1 + x)\u207b\u00b9 := by\n ext x : 1\n simp [field, mul_tsub]\n rw [\u2190 this]\n constructor <;> intro x (hx : x < 1)\n \u00b7 have : 0 < 1 - x := tsub_pos_of_lt hx\n simp [field, tsub_add_cancel_of_le hx.le]\n \u00b7 simp [mul_assoc, \u2190 mul_inv, mul_tsub]\n field_simp\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.CStarAlgebra (L110-L152)\nlemma CStarAlgebra.directedOn_nonneg_ball :\n DirectedOn (\u00b7 \u2264 \u00b7) ({x : A | 0 \u2264 x} \u2229 Metric.ball 0 1) := by\nlet f : \u211d\u22650 \u2192 \u211d\u22650 := fun x => 1 - (1 + x)\u207b\u00b9\n let g : \u211d\u22650 \u2192 \u211d\u22650 := fun x => x * (1 - x)\u207b\u00b9\n suffices \u2200 a b : A, 0 \u2264 a \u2192 0 \u2264 b \u2192 \u2016a\u2016 < 1 \u2192 \u2016b\u2016 < 1 \u2192\n a \u2264 cfc\u2099 f (cfc\u2099 g a + cfc\u2099 g b) by\n rintro a \u27e8(ha\u2081 : 0 \u2264 a), ha\u2082\u27e9 b \u27e8(hb\u2081 : 0 \u2264 b), hb\u2082\u27e9\n simp only [Metric.mem_ball, dist_zero_right] at ha\u2082 hb\u2082\n refine \u27e8cfc\u2099 f (cfc\u2099 g a + cfc\u2099 g b), \u27e8by simp, ?_\u27e9, ?_, ?_\u27e9\n \u00b7 simpa only [Metric.mem_ball, dist_zero_right] using norm_cfc\u2099_one_sub_one_add_inv_lt_one _\n \u00b7 exact this a b ha\u2081 hb\u2081 ha\u2082 hb\u2082\n \u00b7 exact add_comm (cfc\u2099 g a) (cfc\u2099 g b) \u25b8 this b a hb\u2081 ha\u2081 hb\u2082 ha\u2082\n rintro a b ha\u2081 - ha\u2082 -\n calc\n a = cfc\u2099 (f \u2218 g) a := by\n conv_lhs => rw [\u2190 cfc\u2099_id \u211d\u22650 a]\n refine cfc\u2099_congr (Set.InvOn.one_sub_one_add_inv.1.eqOn.symm.mono fun x hx \u21a6 ?_)\n exact lt_of_le_of_lt (le_nnnorm_of_mem_quasispectrum hx) ha\u2082\n _ = cfc\u2099 f (cfc\u2099 g a) := by\n rw [cfc\u2099_comp f g a ?_ (by simp [f, tsub_self]) ?_ (by simp [g]) ha\u2081]\n \u00b7 fun_prop (disch := intro _ _; positivity)\n \u00b7 have (x) (hx : x \u2208 \u03c3\u2099 \u211d\u22650 a) : 1 - x \u2260 0 := by\n refine tsub_pos_of_lt ?_ |>.ne'\n exact lt_of_le_of_lt (le_nnnorm_of_mem_quasispectrum hx) ha\u2082\n fun_prop (disch := assumption)\n _ \u2264 cfc\u2099 f (cfc\u2099 g a + cfc\u2099 g b) := by\n have hab' : cfc\u2099 g a \u2264 cfc\u2099 g a + cfc\u2099 g b := le_add_of_nonneg_right cfc\u2099_nonneg_of_predicate\n exact CFC.monotoneOn_one_sub_one_add_inv cfc\u2099_nonneg_of_predicate\n (cfc\u2099_nonneg_of_predicate.trans hab') hab'\n\nsection ApproximateUnit\n\nopen Metric Filter Topology\n\n/-- An *increasing approximate unit* in a C\u22c6-algebra is an approximate unit contained in the\nclosed unit ball of nonnegative elements. -/\nstructure Filter.IsIncreasingApproximateUnit (l : Filter A) : Prop extends l.IsApproximateUnit where\n eventually_nonneg : \u2200\u1da0 x in l, 0 \u2264 x\n eventually_norm : \u2200\u1da0 x in l, \u2016x\u2016 \u2264 1\n\nnamespace Filter.IsIncreasingApproximateUnit\n\nomit [StarOrderedRing A] in\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.norm_cfc\u2099_one_sub_one_add_inv_lt_one (L105-L109)\nlemma norm_cfc\u2099_one_sub_one_add_inv_lt_one (a : A) :\n \u2016cfc\u2099 (fun x : \u211d\u22650 \u21a6 1 - (1 + x)\u207b\u00b9) a\u2016 < 1 :=\nnnnorm_cfc\u2099_nnreal_lt fun x _ \u21a6 tsub_lt_self zero_lt_one (by positivity)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.tendsto_mul_right_of_forall_nonneg_tendsto (L172-L185)\nlemma tendsto_mul_right_of_forall_nonneg_tendsto {l : Filter A}\n (h : \u2200 m, 0 \u2264 m \u2192 \u2016m\u2016 < 1 \u2192 Tendsto (\u00b7 * m) l (\ud835\udcdd m)) (m : A) :\n Tendsto (\u00b7 * m) l (\ud835\udcdd m) := by\nobtain \u27e8n, c, x, rfl\u27e9 := mem_span_set'.mp <| by\n change m \u2208 span \u2102 ({x | 0 \u2264 x} \u2229 ball 0 1)\n simp [span_nonneg_inter_unitBall]\n simp_rw [Finset.mul_sum]\n refine tendsto_finset_sum _ fun i _ \u21a6 ?_\n simp_rw [mul_smul_comm]\n exact tendsto_const_nhds.smul <| h (x i) (x i).2.1 <| by simpa using (x i).2.2\n\nomit [PartialOrder A] in\n/-- Multiplication on the left by `m` tends to `\ud835\udcdd m` if and only if multiplication on the right\ndoes, provided the elements are eventually selfadjoint along the filter `l`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_star_mul_self' (L129-L130)\ntheorem norm_star_mul_self' {x : E} : \u2016x\u22c6 * x\u2016 = \u2016x\u22c6\u2016 * \u2016x\u2016 := by rw [norm_star_mul_self, norm_star]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.eventually_nnnorm (L153-L156)\nlemma eventually_nnnorm {l : Filter A} (hl : l.IsIncreasingApproximateUnit) :\n \u2200\u1da0 x in l, \u2016x\u2016\u208a \u2264 1 :=\nhl.eventually_norm\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.norm_sub_mul_self_le (L238-L245)\nlemma norm_sub_mul_self_le {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A]\n {x y : A} (z : A) (hx\u2080 : 0 \u2264 x) (hy : y \u2208 Set.Icc x 1)\n {c : \u211d} (hc : 0 \u2264 c) (h : \u2016star z * (1 - x) * z\u2016 \u2264 c ^ 2) :\n \u2016z - y * z\u2016 \u2264 c :=\nnnnorm_sub_mul_self_le z hx\u2080 hy h (c := \u27e8c, hc\u27e9)\n\nvariable {A} in\n/-- A variant of `norm_sub_mul_self_le` for non-unital algebras that passes to the unitization. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.CStarAlgebra.Basic.norm_star_mul_self (L122-L124)\ntheorem norm_star_mul_self {x : E} : \u2016x\u22c6 * x\u2016 = \u2016x\u2016 * \u2016x\u2016 :=\nle_antisymm ((norm_mul_le _ _).trans (by rw [norm_star])) (CStarRing.norm_mul_self_le x)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.tendsto_mul_left_iff_tendsto_mul_right (L186-L196)\nlemma tendsto_mul_left_iff_tendsto_mul_right {l : Filter A} (hl : \u2200\u1da0 x in l, IsSelfAdjoint x) :\n (\u2200 m, Tendsto (m * \u00b7) l (\ud835\udcdd m)) \u2194 (\u2200 m, Tendsto (\u00b7 * m) l (\ud835\udcdd m)) := by\nrefine \u27e8fun h m \u21a6 ?_, fun h m \u21a6 ?_\u27e9\n all_goals\n apply (star_star m \u25b8 (continuous_star.tendsto _ |>.comp <| h (star m))).congr'\n filter_upwards [hl] with x hx\n simp [hx.star_eq]\n\nvariable (A)\n\n/-- The sections of positive strict contractions form a filter basis. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.approximateUnit (L206-L210)\ndef approximateUnit : Filter A :=\n(isBasis_nonneg_sections A).filter \u2293 \ud835\udcdf (closedBall 0 1)\n\n/-- The canonical approximate unit in a C\u22c6-algebra has a basis of sets\n`{x | a \u2264 x} \u2229 closedBall 0 1` for `0 \u2264 a`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.CStarAlgebra.ApproximateUnit.CFC (L54-L72)\nlemma CFC.monotoneOn_one_sub_one_add_inv :\n MonotoneOn (cfc\u2099 (fun x : \u211d\u22650 \u21a6 1 - (1 + x)\u207b\u00b9)) (Set.Ici (0 : A)) := by\nintro a ha b hb hab\n simp only [Set.mem_Ici] at ha hb\n rw [\u2190 inr_le_iff .., nnreal_cfc\u2099_eq_cfc_inr a _, nnreal_cfc\u2099_eq_cfc_inr b _]\n rw [\u2190 inr_le_iff a b (.of_nonneg ha) (.of_nonneg hb)] at hab\n rw [\u2190 inr_nonneg_iff] at ha hb\n have h_cfc_one_sub (c : A\u207a\u00b9) (hc : 0 \u2264 c := by cfc_tac) :\n cfc (fun x : \u211d\u22650 \u21a6 1 - (1 + x)\u207b\u00b9) c = 1 - cfc (\u00b7\u207b\u00b9 : \u211d\u22650 \u2192 \u211d\u22650) (1 + c) := by\n rw [cfc_tsub _ _ _ (fun x _ \u21a6 by simp) (hg := by fun_prop (disch := intro _ _; positivity)),\n cfc_const_one \u211d\u22650 c, cfc_comp' (\u00b7\u207b\u00b9) (1 + \u00b7) c ?_, cfc_add .., cfc_const_one \u211d\u22650 c,\n cfc_id' \u211d\u22650 c]\n exact continuousOn_id.inv\u2080 (Set.forall_mem_image.mpr fun x _ \u21a6 by dsimp only [id]; positivity)\n rw [h_cfc_one_sub (a : A\u207a\u00b9), h_cfc_one_sub (b : A\u207a\u00b9)]\n gcongr\n rw [\u2190 CFC.rpow_neg_one_eq_cfc_inv, \u2190 CFC.rpow_neg_one_eq_cfc_inv]\n exact rpow_neg_one_le_rpow_neg_one (by gcongr)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean", "module": "Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital", "declaration": "Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcHom_id", "span": "L249-L253", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean#L249"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 11343, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 30201, "lean_code_chars": 25679, "natural_language_chars": 4522, "lean_code_ratio": 0.8503, "line_count": 691, "imports_count": 0, "declarations_count": 3613, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "4a798ebf9a268ec8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_iff_tendsto_pi_pure", "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.Topology.IndicatorConstPointwise)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma tendsto_indicator_const_iff_tendsto_pi_pure [T1Space \u03b2] (b : \u03b2) [NeZero b] :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b)) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b)))\n \u2194 (Tendsto (fun i x \u21a6 x \u2208 As i) L <| Filter.pi (pure <| \u00b7 \u2208 A))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_ite (L43-L71)\nlemma tendsto_ite {\u03b2 : Type*} {p : \u03b9 \u2192 Prop} [DecidablePred p] {q : Prop} [Decidable q]\n {a b : \u03b2} {F G : Filter \u03b2}\n (haG : {a}\u1d9c \u2208 G) (hbF : {b}\u1d9c \u2208 F) (haF : principal {a} \u2264 F) (hbG : principal {b} \u2264 G) :\n Tendsto (fun i \u21a6 if p i then a else b) L (if q then F else G) \u2194 \u2200\u1da0 i in L, p i \u2194 q := by\nconstructor <;> intro h\n \u00b7 by_cases hq : q\n \u00b7 simp only [hq, ite_true] at h\n filter_upwards [mem_map.mp (h hbF)] with i hi\n simp only [Set.preimage_compl, Set.mem_compl_iff, Set.mem_preimage, Set.mem_singleton_iff,\n ite_eq_right_iff, not_forall, exists_prop] at hi\n tauto\n \u00b7 simp only [hq, ite_false] at h\n filter_upwards [mem_map.mp (h haG)] with i hi\n simp only [Set.preimage_compl, Set.mem_compl_iff, Set.mem_preimage, Set.mem_singleton_iff,\n ite_eq_left_iff, not_forall, exists_prop] at hi\n tauto\n \u00b7 have obs : (fun _ \u21a6 if q then a else b) =\u1da0[L] (fun i \u21a6 if p i then a else b) := by\n filter_upwards [h] with i hi\n simp only [hi]\n apply Tendsto.congr' obs\n by_cases hq : q\n \u00b7 simp only [hq, ite_true]\n apply le_trans _ haF\n simp\n \u00b7 simp only [hq, ite_false]\n apply le_trans _ hbG\n simp only [principal_singleton, le_pure_iff, mem_map, Set.mem_singleton_iff,\n Set.preimage_const_of_mem, univ_mem]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_apply_iff_eventually' (L72-L85)\nlemma tendsto_indicator_const_apply_iff_eventually' (b : \u03b2)\n (nhds_b : {0}\u1d9c \u2208 \ud835\udcdd b) (nhds_o : {b}\u1d9c \u2208 \ud835\udcdd 0) (x : \u03b1) :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b) x) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b) x))\n \u2194 \u2200\u1da0 i in L, (x \u2208 As i \u2194 x \u2208 A) := by\nclassical\n have heart := @tendsto_ite \u03b9 L \u03b2 (fun i \u21a6 x \u2208 As i) _ (x \u2208 A) _ b 0 (\ud835\udcdd b) (\ud835\udcdd (0 : \u03b2))\n nhds_o nhds_b ?_ ?_\n \u00b7 convert heart\n by_cases hxA : x \u2208 A <;> simp [hxA]\n \u00b7 simp only [principal_singleton, le_def, mem_pure]\n exact fun s s_nhds \u21a6 mem_of_mem_nhds s_nhds\n \u00b7 simp only [principal_singleton, le_def, mem_pure]\n exact fun s s_nhds \u21a6 mem_of_mem_nhds s_nhds\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_iff_forall_eventually' (L86-L95)\nlemma tendsto_indicator_const_iff_forall_eventually'\n (b : \u03b2) (nhds_b : {0}\u1d9c \u2208 \ud835\udcdd b) (nhds_o : {b}\u1d9c \u2208 \ud835\udcdd 0) :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b)) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b)))\n \u2194 \u2200 x, \u2200\u1da0 i in L, (x \u2208 As i \u2194 x \u2208 A) := by\nsimp_rw [tendsto_pi_nhds]\n apply forall_congr'\n exact tendsto_indicator_const_apply_iff_eventually' L b nhds_b nhds_o\n\n/-- The indicator functions of `As\u1d62` evaluated at `x` tend to the indicator function of `A`\nevaluated at `x` if and only if we eventually have the equivalence `x \u2208 As\u1d62 \u2194 x \u2208 A`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_iff_tendsto_pi_pure' (L113-L120)\nlemma tendsto_indicator_const_iff_tendsto_pi_pure'\n (b : \u03b2) (nhds_b : {0}\u1d9c \u2208 \ud835\udcdd b) (nhds_o : {b}\u1d9c \u2208 \ud835\udcdd 0) :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b)) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b)))\n \u2194 (Tendsto (fun i x \u21a6 x \u2208 As i) L <| Filter.pi (pure <| \u00b7 \u2208 A)) := by\nrw [tendsto_indicator_const_iff_forall_eventually' _ b nhds_b nhds_o, tendsto_pi]\n simp_rw [tendsto_pure]\n aesop\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.Topology.IndicatorConstPointwise).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma tendsto_indicator_const_iff_tendsto_pi_pure [T1Space \u03b2] (b : \u03b2) [NeZero b] :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b)) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b)))\n \u2194 (Tendsto (fun i x \u21a6 x \u2208 As i) L <| Filter.pi (pure <| \u00b7 \u2208 A))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_ite (L43-L71)\nlemma tendsto_ite {\u03b2 : Type*} {p : \u03b9 \u2192 Prop} [DecidablePred p] {q : Prop} [Decidable q]\n {a b : \u03b2} {F G : Filter \u03b2}\n (haG : {a}\u1d9c \u2208 G) (hbF : {b}\u1d9c \u2208 F) (haF : principal {a} \u2264 F) (hbG : principal {b} \u2264 G) :\n Tendsto (fun i \u21a6 if p i then a else b) L (if q then F else G) \u2194 \u2200\u1da0 i in L, p i \u2194 q := by\nconstructor <;> intro h\n \u00b7 by_cases hq : q\n \u00b7 simp only [hq, ite_true] at h\n filter_upwards [mem_map.mp (h hbF)] with i hi\n simp only [Set.preimage_compl, Set.mem_compl_iff, Set.mem_preimage, Set.mem_singleton_iff,\n ite_eq_right_iff, not_forall, exists_prop] at hi\n tauto\n \u00b7 simp only [hq, ite_false] at h\n filter_upwards [mem_map.mp (h haG)] with i hi\n simp only [Set.preimage_compl, Set.mem_compl_iff, Set.mem_preimage, Set.mem_singleton_iff,\n ite_eq_left_iff, not_forall, exists_prop] at hi\n tauto\n \u00b7 have obs : (fun _ \u21a6 if q then a else b) =\u1da0[L] (fun i \u21a6 if p i then a else b) := by\n filter_upwards [h] with i hi\n simp only [hi]\n apply Tendsto.congr' obs\n by_cases hq : q\n \u00b7 simp only [hq, ite_true]\n apply le_trans _ haF\n simp\n \u00b7 simp only [hq, ite_false]\n apply le_trans _ hbG\n simp only [principal_singleton, le_pure_iff, mem_map, Set.mem_singleton_iff,\n Set.preimage_const_of_mem, univ_mem]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_apply_iff_eventually' (L72-L85)\nlemma tendsto_indicator_const_apply_iff_eventually' (b : \u03b2)\n (nhds_b : {0}\u1d9c \u2208 \ud835\udcdd b) (nhds_o : {b}\u1d9c \u2208 \ud835\udcdd 0) (x : \u03b1) :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b) x) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b) x))\n \u2194 \u2200\u1da0 i in L, (x \u2208 As i \u2194 x \u2208 A) := by\nclassical\n have heart := @tendsto_ite \u03b9 L \u03b2 (fun i \u21a6 x \u2208 As i) _ (x \u2208 A) _ b 0 (\ud835\udcdd b) (\ud835\udcdd (0 : \u03b2))\n nhds_o nhds_b ?_ ?_\n \u00b7 convert heart\n by_cases hxA : x \u2208 A <;> simp [hxA]\n \u00b7 simp only [principal_singleton, le_def, mem_pure]\n exact fun s s_nhds \u21a6 mem_of_mem_nhds s_nhds\n \u00b7 simp only [principal_singleton, le_def, mem_pure]\n exact fun s s_nhds \u21a6 mem_of_mem_nhds s_nhds\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_iff_forall_eventually' (L86-L95)\nlemma tendsto_indicator_const_iff_forall_eventually'\n (b : \u03b2) (nhds_b : {0}\u1d9c \u2208 \ud835\udcdd b) (nhds_o : {b}\u1d9c \u2208 \ud835\udcdd 0) :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b)) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b)))\n \u2194 \u2200 x, \u2200\u1da0 i in L, (x \u2208 As i \u2194 x \u2208 A) := by\nsimp_rw [tendsto_pi_nhds]\n apply forall_congr'\n exact tendsto_indicator_const_apply_iff_eventually' L b nhds_b nhds_o\n\n/-- The indicator functions of `As\u1d62` evaluated at `x` tend to the indicator function of `A`\nevaluated at `x` if and only if we eventually have the equivalence `x \u2208 As\u1d62 \u2194 x \u2208 A`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_iff_tendsto_pi_pure' (L113-L120)\nlemma tendsto_indicator_const_iff_tendsto_pi_pure'\n (b : \u03b2) (nhds_b : {0}\u1d9c \u2208 \ud835\udcdd b) (nhds_o : {b}\u1d9c \u2208 \ud835\udcdd 0) :\n Tendsto (fun i \u21a6 (As i).indicator (fun (_ : \u03b1) \u21a6 b)) L (\ud835\udcdd (A.indicator (fun (_ : \u03b1) \u21a6 b)))\n \u2194 (Tendsto (fun i x \u21a6 x \u2208 As i) L <| Filter.pi (pure <| \u00b7 \u2208 A)) := by\nrw [tendsto_indicator_const_iff_forall_eventually' _ b nhds_b nhds_o, tendsto_pi]\n simp_rw [tendsto_pure]\n aesop\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/IndicatorConstPointwise.lean", "module": "Mathlib.Topology.IndicatorConstPointwise", "declaration": "Mathlib.Topology.IndicatorConstPointwise.tendsto_indicator_const_iff_tendsto_pi_pure", "span": "L121-L126", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/IndicatorConstPointwise.lean#L121"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1590, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4071, "lean_code_chars": 3529, "natural_language_chars": 542, "lean_code_ratio": 0.8669, "line_count": 87, "imports_count": 0, "declarations_count": 466, "diagnostics_count": 0, "retrieval_snippets_count": 4, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a9e37e32a4f52bac", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.LinearAlgebra.BilinearForm.Basic.coeFnAddMonoidHom", "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.LinearAlgebra.BilinearForm.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef coeFnAddMonoidHom : BilinForm R M \u2192+ M \u2192 M \u2192 R where\n toFun\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_left (L65-L66)\ntheorem add_left (x y z : M) : B (x + y) z = B x z + B y z := map_add\u2082 _ _ _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left (L67-L68)\ntheorem smul_left (a : R) (x y : M) : B (a \u2022 x) y = a * B x y := map_smul\u2082 _ _ _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_right (L69-L70)\ntheorem add_right (x y z : M) : B x (y + z) = B x y + B x z := map_add _ _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right (L71-L72)\ntheorem smul_right (a : R) (x y : M) : B x (a \u2022 y) = a * B x y := map_smul _ _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_left (L73-L74)\ntheorem zero_left (x : M) : B 0 x = 0 := map_zero\u2082 _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_right (L75-L76)\ntheorem zero_right (x : M) : B x 0 = 0 := map_zero _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_left (L77-L78)\ntheorem neg_left (x y : M\u2081) : B\u2081 (-x) y = -B\u2081 x y := map_neg\u2082 _ _ _\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_right (L79-L80)\ntheorem neg_right (x y : M\u2081) : B\u2081 x (-y) = -B\u2081 x y := map_neg _ _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_left (L81-L82)\ntheorem sub_left (x y z : M\u2081) : B\u2081 (x - y) z = B\u2081 x z - B\u2081 y z := map_sub\u2082 _ _ _ _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_right (L83-L84)\ntheorem sub_right (x y z : M\u2081) : B\u2081 x (y - z) = B\u2081 x y - B\u2081 x z := map_sub _ _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left_of_tower (L85-L87)\nlemma smul_left_of_tower (r : S) (x y : M) : B (r \u2022 x) y = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_left, Algebra.smul_def]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right_of_tower (L88-L93)\nlemma smul_right_of_tower (r : S) (x y : M) : B x (r \u2022 y) = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_right, Algebra.smul_def]\n\nvariable {D : BilinForm R M} {D\u2081 : BilinForm R\u2081 M\u2081}\n\n-- TODO: instantiate `FunLike`\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.coe_injective (L94-L98)\ntheorem coe_injective : Function.Injective ((fun B x y => B x y) : BilinForm R M \u2192 M \u2192 M \u2192 R) :=\nfun B D h => by\n ext x y\n apply congrFun\u2082 h\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.ext (L100-L101)\ntheorem ext (H : \u2200 x y : M, B x y = D x y) : B = D := ext\u2082 H\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.congr_fun (L102-L103)\ntheorem congr_fun (h : B = D) (x y : M) : B x y = D x y := congr_fun\u2082 h _ _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleParing (L58-L60)\ndef dualSubmoduleParing {N : Submodule R M} (x : B.dualSubmodule N) (y : N) : R :=\n(Submodule.mem_one.mp <| x.prop y y.prop).choose\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleParing_spec (L62-L67)\nlemma dualSubmoduleParing_spec {N : Submodule R M} (x : B.dualSubmodule N) (y : N) :\n algebraMap R S (B.dualSubmoduleParing x y) = B x y :=\n(Submodule.mem_one.mp <| x.prop y y.prop).choose_spec\n\n/-- The natural paring of `B.dualSubmodule N` and `N`. -/\n-- TODO: Show that this is perfect when `N` is a lattice and `B` is nondegenerate.\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.comp_apply (L142-L144)\ntheorem comp_apply (B : BilinForm R M') (l r : M \u2192\u2097[R] M') (v w) : B.comp l r v w = B (l v) (r w) :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.toLinHomAux\u2081 (L63-L66)\ndef toLinHomAux\u2081 (A : BilinForm R M) (x : M) : M \u2192\u2097[R] R := A x\nvariable (B)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleToDual (L70-L81)\ndef dualSubmoduleToDual [IsDomain R] [IsTorsionFree R S] (N : Submodule R M) :\n B.dualSubmodule N \u2192\u2097[R] Module.Dual R N :=\n{ toFun := fun x \u21a6\n { toFun := B.dualSubmoduleParing x\n map_add' := fun x y \u21a6 FaithfulSMul.algebraMap_injective R S (by simp)\n map_smul' := fun r m \u21a6 FaithfulSMul.algebraMap_injective R S\n (by simp [\u2190 Algebra.smul_def]) }\n map_add' := fun x y \u21a6 LinearMap.ext fun z \u21a6 FaithfulSMul.algebraMap_injective R S\n (by simp)\n map_smul' := fun r x \u21a6 LinearMap.ext fun y \u21a6 FaithfulSMul.algebraMap_injective R S\n (by simp [\u2190 Algebra.smul_def]) }\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.sum_apply (L76-L83)\ntheorem sum_apply {\u03b1} (t : Finset \u03b1) (B : \u03b1 \u2192 BilinForm R M) (v w : M) :\n (\u2211 i \u2208 t, B i) v w = \u2211 i \u2208 t, B i v w := by\nsimp only [coe_sum, Finset.sum_apply]\n\nvariable {B}\n\n/-- The linear map obtained from a `BilinForm` by fixing the right co-ordinate and evaluating in\nthe left. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.toLin'Flip_apply (L87-L100)\ntheorem toLin'Flip_apply (A : BilinForm R M) (x : M) : toLinHomFlip (M := M) A x = fun y => A y x :=\nrfl\n\nend ToLin'\n\nend BilinForm\n\nend LinearMap\n\nnamespace LinearMap\n\nvariable {R' : Type*} [CommSemiring R'] [Algebra R' R] [Module R' M] [IsScalarTower R' R M]\n\n/-- Apply a linear map on the output of a bilinear form. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_dualSubmodule_flip_of_basis (L117-L125)\nlemma dualSubmodule_dualSubmodule_flip_of_basis {\u03b9 : Type*} [Finite \u03b9]\n (hB : B.Nondegenerate) (b : Basis \u03b9 S M) :\n B.dualSubmodule (B.flip.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\nclassical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis _ hB.flip, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis_flip hB]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compRight_compLeft (L137-L140)\ntheorem compRight_compLeft (B : BilinForm R M) (l r : M \u2192\u2097[R] M) :\n (B.compRight r).compLeft l = B.comp l r :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.sum_right (L73-L75)\ntheorem sum_right {\u03b1} (t : Finset \u03b1) (w : M) (g : \u03b1 \u2192 M) :\n B w (\u2211 i \u2208 t, g i) = \u2211 i \u2208 t, B w (g i) := map_sum _ _ _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_dualSubmodule_of_basis (L135-L146)\nlemma dualSubmodule_dualSubmodule_of_basis\n {\u03b9} [Finite \u03b9] (hB : B.Nondegenerate) (hB' : B.IsSymm) (b : Basis \u03b9 S M) :\n B.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\nclassical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis hB hB']\n\nend BilinForm\n\nend LinearMap\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.sum_left (L67-L72)\ntheorem sum_left {\u03b1} (t : Finset \u03b1) (g : \u03b1 \u2192 M) (w : M) :\n B (\u2211 i \u2208 t, g i) w = \u2211 i \u2208 t, B (g i) w :=\nB.map_sum\u2082 t g w\n\nvariable (w : M)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.le_flip_dualSubmodule (L49-L57)\nlemma le_flip_dualSubmodule {N\u2081 N\u2082 : Submodule R M} :\n N\u2081 \u2264 B.flip.dualSubmodule N\u2082 \u2194 N\u2082 \u2264 B.dualSubmodule N\u2081 := by\nchange (\u2200 (x : M), x \u2208 N\u2081 \u2192 _) \u2194 \u2200 (x : M), x \u2208 N\u2082 \u2192 _\n simp only [mem_dualSubmodule, Submodule.mem_one, flip_apply]\n exact forall\u2082_comm\n\n/-- The natural paring of `B.dualSubmodule N` and `N`.\nThis is bundled as a bilinear map in `BilinForm.dualSubmoduleToDual`. -/\nnoncomputable\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.mem_dualSubmodule (L46-L48)\nlemma mem_dualSubmodule {N : Submodule R M} {x} :\n x \u2208 B.dualSubmodule N \u2194 \u2200 y \u2208 N, B x y \u2208 (1 : Submodule R S) := Iff.rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compLeft_compRight (L132-L135)\ntheorem compLeft_compRight (B : BilinForm R M) (l r : M \u2192\u2097[R] M) :\n (B.compLeft l).compRight r = B.comp l r :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compBilinForm (L102-L115)\ndef compBilinForm (f : R \u2192\u2097[R'] R') (B : BilinForm R M) : BilinForm R' M :=\ncompr\u2082 (restrictScalars\u2081\u2082 R' R' B) f\n\nend LinearMap\n\nnamespace LinearMap\n\nnamespace BilinForm\n\nsection Comp\n\nvariable {M' : Type w} [AddCommMonoid M'] [Module R M']\n\n/-- Apply a linear map on the left and right argument of a bilinear form. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_span_of_basis (L92-L116)\nlemma dualSubmodule_span_of_basis {\u03b9} [Finite \u03b9] [DecidableEq \u03b9]\n (hB : B.Nondegenerate) (b : Basis \u03b9 S M) :\n B.dualSubmodule (Submodule.span R (Set.range b)) =\n Submodule.span R (Set.range <| B.dualBasis hB b) := by\ncases nonempty_fintype \u03b9\n apply le_antisymm\n \u00b7 intro x hx\n rw [\u2190 (B.dualBasis hB b).sum_repr x]\n apply sum_mem\n rintro i -\n obtain \u27e8r, hr\u27e9 := Submodule.mem_one.mp <| hx (b i) (Submodule.subset_span \u27e8_, rfl\u27e9)\n simp only [dualBasis_repr_apply, \u2190 hr, algebraMap_smul]\n apply Submodule.smul_mem\n exact Submodule.subset_span \u27e8_, rfl\u27e9\n \u00b7 rw [Submodule.span_le]\n rintro _ \u27e8i, rfl\u27e9 y hy\n obtain \u27e8f, rfl\u27e9 := (Submodule.mem_span_range_iff_exists_fun _).mp hy\n simp only [map_sum]\n apply sum_mem\n rintro j -\n rw [\u2190 IsScalarTower.algebraMap_smul S (f j), map_smul]\n simp_rw [apply_dualBasis_left]\n rw [smul_eq_mul, mul_ite, mul_one, mul_zero, \u2190 (algebraMap R S).map_zero, \u2190 apply_ite]\n exact Submodule.mem_one.mpr \u27e8_, rfl\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.toLinHomFlip (L84-L86)\ndef toLinHomFlip : BilinForm R M \u2192\u2097[R] M \u2192\u2097[R] M \u2192\u2097[R] R :=\nflipHom.toLinearMap\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compLeft (L119-L122)\ndef compLeft (B : BilinForm R M) (f : M \u2192\u2097[R] M) : BilinForm R M :=\nB.comp f LinearMap.id\n\n/-- Apply a linear map to the right argument of a bilinear form. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule (L37-L45)\ndef dualSubmodule (N : Submodule R M) : Submodule R M where\n carrier := { x | \u2200 y \u2208 N, B x y \u2208 (1 : Submodule R S) }\nadd_mem' {a b} ha hb y hy := by simpa using add_mem (ha y hy) (hb y hy)\n zero_mem' y _ := by rw [B.zero_left]; exact zero_mem _\n smul_mem' r a ha y hy := by\n convert (1 : Submodule R S).smul_mem r (ha y hy)\n rw [\u2190 IsScalarTower.algebraMap_smul S r a]\n simp only [algebraMap_smul, map_smul_of_tower, LinearMap.smul_apply]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_flip_dualSubmodule_of_basis (L126-L134)\nlemma dualSubmodule_flip_dualSubmodule_of_basis {\u03b9 : Type*} [Finite \u03b9]\n (hB : B.Nondegenerate) (b : Basis \u03b9 S M) :\n B.flip.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\nclassical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis _ hB.flip,\n dualBasis_flip_dualBasis hB]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.comp_comp (L126-L130)\ntheorem comp_comp {M'' : Type*} [AddCommMonoid M''] [Module R M''] (B : BilinForm R M'')\n (l r : M \u2192\u2097[R] M') (l' r' : M' \u2192\u2097[R] M'') :\n (B.comp l' r').comp l r = B.comp (l'.comp l) (r'.comp r) :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleToDual_injective (L82-L91)\nlemma dualSubmoduleToDual_injective [IsDomain R] (hB : B.Nondegenerate) [IsTorsionFree R S]\n (N : Submodule R M) (hN : Submodule.span S (N : Set M) = \u22a4) :\n Function.Injective (B.dualSubmoduleToDual N) := by\nintro x y e\n ext\n apply LinearMap.ker_eq_bot.mp hB.ker_eq_bot\n apply LinearMap.ext_on hN\n intro z hz\n simpa using congr_arg (algebraMap R S) (LinearMap.congr_fun e \u27e8z, hz\u27e9)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.comp (L116-L118)\ndef comp (B : BilinForm R M') (l r : M \u2192\u2097[R] M') : BilinForm R M := B.compl\u2081\u2082 l r\n/-- Apply a linear map to the left argument of a bilinear form. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compRight (L123-L125)\ndef compRight (B : BilinForm R M) (f : M \u2192\u2097[R] M) : BilinForm R M :=\nB.comp LinearMap.id 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.LinearAlgebra.BilinearForm.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef coeFnAddMonoidHom : BilinForm R M \u2192+ M \u2192 M \u2192 R where\n toFun\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_left (L65-L66)\ntheorem add_left (x y z : M) : B (x + y) z = B x z + B y z := map_add\u2082 _ _ _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left (L67-L68)\ntheorem smul_left (a : R) (x y : M) : B (a \u2022 x) y = a * B x y := map_smul\u2082 _ _ _ _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_right (L69-L70)\ntheorem add_right (x y z : M) : B x (y + z) = B x y + B x z := map_add _ _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right (L71-L72)\ntheorem smul_right (a : R) (x y : M) : B x (a \u2022 y) = a * B x y := map_smul _ _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_left (L73-L74)\ntheorem zero_left (x : M) : B 0 x = 0 := map_zero\u2082 _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.zero_right (L75-L76)\ntheorem zero_right (x : M) : B x 0 = 0 := map_zero _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_left (L77-L78)\ntheorem neg_left (x y : M\u2081) : B\u2081 (-x) y = -B\u2081 x y := map_neg\u2082 _ _ _\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.neg_right (L79-L80)\ntheorem neg_right (x y : M\u2081) : B\u2081 x (-y) = -B\u2081 x y := map_neg _ _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_left (L81-L82)\ntheorem sub_left (x y z : M\u2081) : B\u2081 (x - y) z = B\u2081 x z - B\u2081 y z := map_sub\u2082 _ _ _ _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.sub_right (L83-L84)\ntheorem sub_right (x y z : M\u2081) : B\u2081 x (y - z) = B\u2081 x y - B\u2081 x z := map_sub _ _ _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left_of_tower (L85-L87)\nlemma smul_left_of_tower (r : S) (x y : M) : B (r \u2022 x) y = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_left, Algebra.smul_def]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_right_of_tower (L88-L93)\nlemma smul_right_of_tower (r : S) (x y : M) : B x (r \u2022 y) = r \u2022 B x y := by\nrw [\u2190 IsScalarTower.algebraMap_smul R r, smul_right, Algebra.smul_def]\n\nvariable {D : BilinForm R M} {D\u2081 : BilinForm R\u2081 M\u2081}\n\n-- TODO: instantiate `FunLike`\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.coe_injective (L94-L98)\ntheorem coe_injective : Function.Injective ((fun B x y => B x y) : BilinForm R M \u2192 M \u2192 M \u2192 R) :=\nfun B D h => by\n ext x y\n apply congrFun\u2082 h\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.ext (L100-L101)\ntheorem ext (H : \u2200 x y : M, B x y = D x y) : B = D := ext\u2082 H\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Basic.congr_fun (L102-L103)\ntheorem congr_fun (h : B = D) (x y : M) : B x y = D x y := congr_fun\u2082 h _ _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleParing (L58-L60)\ndef dualSubmoduleParing {N : Submodule R M} (x : B.dualSubmodule N) (y : N) : R :=\n(Submodule.mem_one.mp <| x.prop y y.prop).choose\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleParing_spec (L62-L67)\nlemma dualSubmoduleParing_spec {N : Submodule R M} (x : B.dualSubmodule N) (y : N) :\n algebraMap R S (B.dualSubmoduleParing x y) = B x y :=\n(Submodule.mem_one.mp <| x.prop y y.prop).choose_spec\n\n/-- The natural paring of `B.dualSubmodule N` and `N`. -/\n-- TODO: Show that this is perfect when `N` is a lattice and `B` is nondegenerate.\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.comp_apply (L142-L144)\ntheorem comp_apply (B : BilinForm R M') (l r : M \u2192\u2097[R] M') (v w) : B.comp l r v w = B (l v) (r w) :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.toLinHomAux\u2081 (L63-L66)\ndef toLinHomAux\u2081 (A : BilinForm R M) (x : M) : M \u2192\u2097[R] R := A x\nvariable (B)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleToDual (L70-L81)\ndef dualSubmoduleToDual [IsDomain R] [IsTorsionFree R S] (N : Submodule R M) :\n B.dualSubmodule N \u2192\u2097[R] Module.Dual R N :=\n{ toFun := fun x \u21a6\n { toFun := B.dualSubmoduleParing x\n map_add' := fun x y \u21a6 FaithfulSMul.algebraMap_injective R S (by simp)\n map_smul' := fun r m \u21a6 FaithfulSMul.algebraMap_injective R S\n (by simp [\u2190 Algebra.smul_def]) }\n map_add' := fun x y \u21a6 LinearMap.ext fun z \u21a6 FaithfulSMul.algebraMap_injective R S\n (by simp)\n map_smul' := fun r x \u21a6 LinearMap.ext fun y \u21a6 FaithfulSMul.algebraMap_injective R S\n (by simp [\u2190 Algebra.smul_def]) }\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.sum_apply (L76-L83)\ntheorem sum_apply {\u03b1} (t : Finset \u03b1) (B : \u03b1 \u2192 BilinForm R M) (v w : M) :\n (\u2211 i \u2208 t, B i) v w = \u2211 i \u2208 t, B i v w := by\nsimp only [coe_sum, Finset.sum_apply]\n\nvariable {B}\n\n/-- The linear map obtained from a `BilinForm` by fixing the right co-ordinate and evaluating in\nthe left. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.toLin'Flip_apply (L87-L100)\ntheorem toLin'Flip_apply (A : BilinForm R M) (x : M) : toLinHomFlip (M := M) A x = fun y => A y x :=\nrfl\n\nend ToLin'\n\nend BilinForm\n\nend LinearMap\n\nnamespace LinearMap\n\nvariable {R' : Type*} [CommSemiring R'] [Algebra R' R] [Module R' M] [IsScalarTower R' R M]\n\n/-- Apply a linear map on the output of a bilinear form. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_dualSubmodule_flip_of_basis (L117-L125)\nlemma dualSubmodule_dualSubmodule_flip_of_basis {\u03b9 : Type*} [Finite \u03b9]\n (hB : B.Nondegenerate) (b : Basis \u03b9 S M) :\n B.dualSubmodule (B.flip.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\nclassical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis _ hB.flip, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis_flip hB]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compRight_compLeft (L137-L140)\ntheorem compRight_compLeft (B : BilinForm R M) (l r : M \u2192\u2097[R] M) :\n (B.compRight r).compLeft l = B.comp l r :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.sum_right (L73-L75)\ntheorem sum_right {\u03b1} (t : Finset \u03b1) (w : M) (g : \u03b1 \u2192 M) :\n B w (\u2211 i \u2208 t, g i) = \u2211 i \u2208 t, B w (g i) := map_sum _ _ _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_dualSubmodule_of_basis (L135-L146)\nlemma dualSubmodule_dualSubmodule_of_basis\n {\u03b9} [Finite \u03b9] (hB : B.Nondegenerate) (hB' : B.IsSymm) (b : Basis \u03b9 S M) :\n B.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\nclassical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis B hB,\n dualBasis_dualBasis hB hB']\n\nend BilinForm\n\nend LinearMap\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.sum_left (L67-L72)\ntheorem sum_left {\u03b1} (t : Finset \u03b1) (g : \u03b1 \u2192 M) (w : M) :\n B (\u2211 i \u2208 t, g i) w = \u2211 i \u2208 t, B (g i) w :=\nB.map_sum\u2082 t g w\n\nvariable (w : M)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.le_flip_dualSubmodule (L49-L57)\nlemma le_flip_dualSubmodule {N\u2081 N\u2082 : Submodule R M} :\n N\u2081 \u2264 B.flip.dualSubmodule N\u2082 \u2194 N\u2082 \u2264 B.dualSubmodule N\u2081 := by\nchange (\u2200 (x : M), x \u2208 N\u2081 \u2192 _) \u2194 \u2200 (x : M), x \u2208 N\u2082 \u2192 _\n simp only [mem_dualSubmodule, Submodule.mem_one, flip_apply]\n exact forall\u2082_comm\n\n/-- The natural paring of `B.dualSubmodule N` and `N`.\nThis is bundled as a bilinear map in `BilinForm.dualSubmoduleToDual`. -/\nnoncomputable\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.mem_dualSubmodule (L46-L48)\nlemma mem_dualSubmodule {N : Submodule R M} {x} :\n x \u2208 B.dualSubmodule N \u2194 \u2200 y \u2208 N, B x y \u2208 (1 : Submodule R S) := Iff.rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compLeft_compRight (L132-L135)\ntheorem compLeft_compRight (B : BilinForm R M) (l r : M \u2192\u2097[R] M) :\n (B.compLeft l).compRight r = B.comp l r :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compBilinForm (L102-L115)\ndef compBilinForm (f : R \u2192\u2097[R'] R') (B : BilinForm R M) : BilinForm R' M :=\ncompr\u2082 (restrictScalars\u2081\u2082 R' R' B) f\n\nend LinearMap\n\nnamespace LinearMap\n\nnamespace BilinForm\n\nsection Comp\n\nvariable {M' : Type w} [AddCommMonoid M'] [Module R M']\n\n/-- Apply a linear map on the left and right argument of a bilinear form. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_span_of_basis (L92-L116)\nlemma dualSubmodule_span_of_basis {\u03b9} [Finite \u03b9] [DecidableEq \u03b9]\n (hB : B.Nondegenerate) (b : Basis \u03b9 S M) :\n B.dualSubmodule (Submodule.span R (Set.range b)) =\n Submodule.span R (Set.range <| B.dualBasis hB b) := by\ncases nonempty_fintype \u03b9\n apply le_antisymm\n \u00b7 intro x hx\n rw [\u2190 (B.dualBasis hB b).sum_repr x]\n apply sum_mem\n rintro i -\n obtain \u27e8r, hr\u27e9 := Submodule.mem_one.mp <| hx (b i) (Submodule.subset_span \u27e8_, rfl\u27e9)\n simp only [dualBasis_repr_apply, \u2190 hr, algebraMap_smul]\n apply Submodule.smul_mem\n exact Submodule.subset_span \u27e8_, rfl\u27e9\n \u00b7 rw [Submodule.span_le]\n rintro _ \u27e8i, rfl\u27e9 y hy\n obtain \u27e8f, rfl\u27e9 := (Submodule.mem_span_range_iff_exists_fun _).mp hy\n simp only [map_sum]\n apply sum_mem\n rintro j -\n rw [\u2190 IsScalarTower.algebraMap_smul S (f j), map_smul]\n simp_rw [apply_dualBasis_left]\n rw [smul_eq_mul, mul_ite, mul_one, mul_zero, \u2190 (algebraMap R S).map_zero, \u2190 apply_ite]\n exact Submodule.mem_one.mpr \u27e8_, rfl\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.toLinHomFlip (L84-L86)\ndef toLinHomFlip : BilinForm R M \u2192\u2097[R] M \u2192\u2097[R] M \u2192\u2097[R] R :=\nflipHom.toLinearMap\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compLeft (L119-L122)\ndef compLeft (B : BilinForm R M) (f : M \u2192\u2097[R] M) : BilinForm R M :=\nB.comp f LinearMap.id\n\n/-- Apply a linear map to the right argument of a bilinear form. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule (L37-L45)\ndef dualSubmodule (N : Submodule R M) : Submodule R M where\n carrier := { x | \u2200 y \u2208 N, B x y \u2208 (1 : Submodule R S) }\nadd_mem' {a b} ha hb y hy := by simpa using add_mem (ha y hy) (hb y hy)\n zero_mem' y _ := by rw [B.zero_left]; exact zero_mem _\n smul_mem' r a ha y hy := by\n convert (1 : Submodule R S).smul_mem r (ha y hy)\n rw [\u2190 IsScalarTower.algebraMap_smul S r a]\n simp only [algebraMap_smul, map_smul_of_tower, LinearMap.smul_apply]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmodule_flip_dualSubmodule_of_basis (L126-L134)\nlemma dualSubmodule_flip_dualSubmodule_of_basis {\u03b9 : Type*} [Finite \u03b9]\n (hB : B.Nondegenerate) (b : Basis \u03b9 S M) :\n B.flip.dualSubmodule (B.dualSubmodule (Submodule.span R (Set.range b))) =\n Submodule.span R (Set.range b) := by\nclassical\n letI := b.finiteDimensional_of_finite\n rw [dualSubmodule_span_of_basis B hB, dualSubmodule_span_of_basis _ hB.flip,\n dualBasis_flip_dualBasis hB]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.comp_comp (L126-L130)\ntheorem comp_comp {M'' : Type*} [AddCommMonoid M''] [Module R M''] (B : BilinForm R M'')\n (l r : M \u2192\u2097[R] M') (l' r' : M' \u2192\u2097[R] M'') :\n (B.comp l' r').comp l r = B.comp (l'.comp l) (r'.comp r) :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.DualLattice.dualSubmoduleToDual_injective (L82-L91)\nlemma dualSubmoduleToDual_injective [IsDomain R] (hB : B.Nondegenerate) [IsTorsionFree R S]\n (N : Submodule R M) (hN : Submodule.span S (N : Set M) = \u22a4) :\n Function.Injective (B.dualSubmoduleToDual N) := by\nintro x y e\n ext\n apply LinearMap.ker_eq_bot.mp hB.ker_eq_bot\n apply LinearMap.ext_on hN\n intro z hz\n simpa using congr_arg (algebraMap R S) (LinearMap.congr_fun e \u27e8z, hz\u27e9)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.comp (L116-L118)\ndef comp (B : BilinForm R M') (l r : M \u2192\u2097[R] M') : BilinForm R M := B.compl\u2081\u2082 l r\n/-- Apply a linear map to the left argument of a bilinear form. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.BilinearForm.Hom.compRight (L123-L125)\ndef compRight (B : BilinForm R M) (f : M \u2192\u2097[R] M) : BilinForm R M :=\nB.comp LinearMap.id f\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/BilinearForm/Basic.lean", "module": "Mathlib.LinearAlgebra.BilinearForm.Basic", "declaration": "Mathlib.LinearAlgebra.BilinearForm.Basic.coeFnAddMonoidHom", "span": "L124-L131", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/BilinearForm/Basic.lean#L124"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 4896, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 12758, "lean_code_chars": 11249, "natural_language_chars": 1509, "lean_code_ratio": 0.8817, "line_count": 398, "imports_count": 0, "declarations_count": 1470, "diagnostics_count": 0, "retrieval_snippets_count": 40, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "0e730dbebbedfb09", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Order.Hom.MonoidWithZero.comp", "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.Algebra.Order.Hom.MonoidWithZero)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef comp (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) : \u03b1 \u2192*\u2080o \u03b3\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.OrderMonoidWithZeroHomClass (L69-L72)\ndef OrderMonoidWithZeroHomClass.toOrderMonoidWithZeroHom [OrderHomClass F \u03b1 \u03b2]\n [MonoidWithZeroHomClass F \u03b1 \u03b2] (f : F) : \u03b1 \u2192*\u2080o \u03b2 :=\n{ (f : \u03b1 \u2192*\u2080 \u03b2) with monotone' := OrderHomClass.monotone f }\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.ext (L108-L110)\ntheorem ext (h : \u2200 a, f a = g a) : f = g :=\nDFunLike.ext f g h\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toFun_eq_coe (L111-L113)\ntheorem toFun_eq_coe (f : \u03b1 \u2192*\u2080o \u03b2) : f.toFun = (f : \u03b1 \u2192 \u03b2) :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_mk (L115-L117)\ntheorem coe_mk (f : \u03b1 \u2192*\u2080 \u03b2) (h) : (OrderMonoidWithZeroHom.mk f h : \u03b1 \u2192 \u03b2) = f :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.mk_coe (L119-L121)\ntheorem mk_coe (f : \u03b1 \u2192*\u2080o \u03b2) (h) : OrderMonoidWithZeroHom.mk (f : \u03b1 \u2192*\u2080 \u03b2) h = f := rfl\n/-- Reinterpret an ordered monoid with zero homomorphism as an order monoid homomorphism. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toOrderMonoidHom (L122-L124)\ndef toOrderMonoidHom (f : \u03b1 \u2192*\u2080o \u03b2) : \u03b1 \u2192*o \u03b2 :=\n{ f with }\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_monoidWithZeroHom (L126-L128)\ntheorem coe_monoidWithZeroHom (f : \u03b1 \u2192*\u2080o \u03b2) : \u21d1(f : \u03b1 \u2192*\u2080 \u03b2) = f :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_orderMonoidHom (L130-L132)\ntheorem coe_orderMonoidHom (f : \u03b1 \u2192*\u2080o \u03b2) : \u21d1(f : \u03b1 \u2192*o \u03b2) = f :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toOrderMonoidHom_injective (L133-L135)\ntheorem toOrderMonoidHom_injective : Injective (toOrderMonoidHom : _ \u2192 \u03b1 \u2192*o \u03b2) := fun f g h =>\next <| by convert DFunLike.ext_iff.1 h using 0\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toMonoidWithZeroHom_injective (L136-L139)\ntheorem toMonoidWithZeroHom_injective : Injective (toMonoidWithZeroHom : _ \u2192 \u03b1 \u2192*\u2080 \u03b2) :=\nfun f g h => ext <| by convert DFunLike.ext_iff.1 h using 0\n\n/-- Copy of an `OrderMonoidWithZeroHom` with a new `toFun` equal to the old one. Useful to fix\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_copy (L145-L147)\ntheorem coe_copy (f : \u03b1 \u2192*\u2080o \u03b2) (f' : \u03b1 \u2192 \u03b2) (h : f' = f) : \u21d1(f.copy f' h) = f' :=\nrfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.copy_eq (L148-L156)\ntheorem copy_eq (f : \u03b1 \u2192*\u2080o \u03b2) (f' : \u03b1 \u2192 \u03b2) (h : f' = f) : f.copy f' h = f :=\nDFunLike.ext' h\n\nvariable (\u03b1)\n\n/-- The identity map as an ordered monoid with zero homomorphism. -/\nprotected def id : \u03b1 \u2192*\u2080o \u03b1 :=\n { MonoidWithZeroHom.id \u03b1, OrderHom.id with }\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_id (L158-L160)\ntheorem coe_id : \u21d1(OrderMonoidWithZeroHom.id \u03b1) = id :=\nrfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_comp (L171-L173)\ntheorem coe_comp (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) : (f.comp g : \u03b1 \u2192 \u03b3) = f \u2218 g :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.comp_apply (L175-L177)\ntheorem comp_apply (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) (a : \u03b1) : (f.comp g) a = f (g a) :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_comp_monoidWithZeroHom (L178-L181)\ntheorem coe_comp_monoidWithZeroHom (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) :\n (f.comp g : \u03b1 \u2192*\u2080 \u03b3) = (f : \u03b2 \u2192*\u2080 \u03b3).comp g :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_comp_orderMonoidHom (L182-L185)\ntheorem coe_comp_orderMonoidHom (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) :\n (f.comp g : \u03b1 \u2192*o \u03b3) = (f : \u03b2 \u2192*o \u03b3).comp g :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.comp_assoc (L187-L190)\ntheorem comp_assoc (f : \u03b3 \u2192*\u2080o \u03b4) (g : \u03b2 \u2192*\u2080o \u03b3) (h : \u03b1 \u2192*\u2080o \u03b2) :\n (f.comp g).comp h = f.comp (g.comp h) :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.comp_id (L192-L193)\ntheorem comp_id (f : \u03b1 \u2192*\u2080o \u03b2) : f.comp (OrderMonoidWithZeroHom.id \u03b1) = f := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.id_comp (L195-L196)\ntheorem id_comp (f : \u03b1 \u2192*\u2080o \u03b2) : (OrderMonoidWithZeroHom.id \u03b2).comp f = f := rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.cancel_right (L198-L201)\ntheorem cancel_right {g\u2081 g\u2082 : \u03b2 \u2192*\u2080o \u03b3} {f : \u03b1 \u2192*\u2080o \u03b2} (hf : Function.Surjective f) :\n g\u2081.comp f = g\u2082.comp f \u2194 g\u2081 = g\u2082 :=\n\u27e8fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, fun _ => by congr\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.cancel_left (L203-L215)\ntheorem cancel_left {g : \u03b2 \u2192*\u2080o \u03b3} {f\u2081 f\u2082 : \u03b1 \u2192*\u2080o \u03b2} (hg : Function.Injective g) :\n g.comp f\u2081 = g.comp f\u2082 \u2194 f\u2081 = f\u2082 :=\n\u27e8fun h => ext fun a => hg <| by rw [\u2190 comp_apply, h, comp_apply], congr_arg _\u27e9\n\nend Preorder\n\nsection Mul\n\nvariable [LinearOrderedCommMonoidWithZero \u03b1] [LinearOrderedCommMonoidWithZero \u03b2]\n [LinearOrderedCommMonoidWithZero \u03b3]\n\n/-- For two ordered monoid morphisms `f` and `g`, their product is the ordered monoid morphism\nsending `a` to `f a * g a`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_mul (L220-L222)\ntheorem coe_mul (f g : \u03b1 \u2192*\u2080o \u03b2) : \u21d1(f * g) = f * g :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.mul_apply (L224-L226)\ntheorem mul_apply (f g : \u03b1 \u2192*\u2080o \u03b2) (a : \u03b1) : (f * g) a = f a * g a :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.mul_comp (L227-L229)\ntheorem mul_comp (g\u2081 g\u2082 : \u03b2 \u2192*\u2080o \u03b3) (f : \u03b1 \u2192*\u2080o \u03b2) : (g\u2081 * g\u2082).comp f = g\u2081.comp f * g\u2082.comp f :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with apply_nonneg := fun f => f.nonneg' }\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_mul := fun f => f.map_mul' }\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.ext (L76-L79)\ntheorem ext \u2983f g : AbsoluteValue R S\u2984 : (\u2200 x, f x = g x) \u2192 f = g :=\nDFunLike.ext _ _\n\n/-- See Note [custom simps projection]. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_eq_zero (L426-L427)\nlemma abv_eq_zero {x} : abv x = 0 \u2194 x = 0 := abv_eq_zero'\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidWithZeroHom (L165-L167)\ndef toMonoidWithZeroHom : R \u2192*\u2080 S :=\nabv\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_add_le_add := fun f => f.add_le' }\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_pos (L451-L459)\ntheorem abv_pos {a : R} : 0 < abv a \u2194 a \u2260 0 :=\n(toAbsoluteValue abv).pos_iff\n\nend OrderedSemiring\n\nsection LinearOrderedRing\n\nvariable {S : Type*} [Ring S] [LinearOrder S] [IsStrictOrderedRing S]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_right_inj_of_ne_top (L195-L197)\nlemma sub_right_inj_of_ne_top (h : a \u2260 \u22a4) : a - b = a - c \u2194 b = c :=\n(sub_right_injective_of_ne_top h).eq_iff\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_one' (L537-L541)\ntheorem abv_one' : abv 1 = 1 :=\n(toAbsoluteValue abv).map_one_of_isLeftRegular <|\n (IsRegular.of_ne_zero <| (toAbsoluteValue abv).ne_zero one_ne_zero).left\n\n/-- An absolute value as a monoid with zero homomorphism, assuming the target is a semifield. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidHom (L177-L179)\ntheorem coe_toMonoidHom : \u21d1abv.toMonoidHom = abv :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidWithZeroHom (L169-L172)\ntheorem coe_toMonoidWithZeroHom : \u21d1abv.toMonoidWithZeroHom = abv :=\nrfl\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*` and `1`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMulHom (L86-L88)\ntheorem coe_toMulHom : \u21d1abv.toMulHom = abv :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_sub_le (L491-L493)\ntheorem abv_sub_le (a b c : R) : abv (a - c) \u2264 abv (a - b) + abv (b - c) := by\nsimpa [sub_eq_add_neg, add_assoc] using abv_add abv (a - b) (b - c)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.eq_on_nat_iff_eq_on_int (L256-L268)\nlemma eq_on_nat_iff_eq_on_int {f g : AbsoluteValue R S} :\n (\u2200 n : \u2115, f n = g n) \u2194 \u2200 n : \u2124, f n = g n := by\nrefine \u27e8fun h z \u21a6 ?_, fun a n \u21a6 mod_cast a n\u27e9\n obtain \u27e8n, rfl | rfl\u27e9 := Int.eq_nat_or_neg z <;> simp [h n]\n\nend OrderedCommRing\n\nsection LinearOrderedRing\n\nvariable {R S : Type*} [Semiring R] [Ring S] [LinearOrder S] [IsStrictOrderedRing S]\n (abv : AbsoluteValue R S)\n\n/-- `AbsoluteValue.abs` is `abs` as a bundled `AbsoluteValue`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_right_strictMono_of_ne_top (L85-L87)\nlemma add_right_strictMono_of_ne_top (h : b \u2260 \u22a4) : StrictMono (fun x \u21a6 b + x) :=\nadd_right_mono.strictMono_of_injective <| add_right_injective_of_ne_top _ h\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_sub_eq_zero_iff (L141-L154)\ntheorem map_sub_eq_zero_iff (a b : R) : abv (a - b) = 0 \u2194 a = b :=\nabv.eq_zero.trans sub_eq_zero\n\nend Ring\n\nsection Semiring\n\nsection IsDomain\n\n-- all of these are true for `NoZeroDivisors S`; but it doesn't work smoothly with the\n-- `IsDomain`/`IsCancelMulZero` API\nvariable {R S : Type*} [Semiring R] [Semiring S] [PartialOrder S] (abv : AbsoluteValue R S)\nvariable [IsDomain S] [Nontrivial R]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_nat_le_self (L186-L206)\nlemma apply_nat_le_self [IsOrderedRing S] (n : \u2115) : abv n \u2264 n := by\ncases subsingleton_or_nontrivial R\n \u00b7 simp [Subsingleton.eq_zero (n : R)]\n induction n with\n | zero => simp\n | succ n ih =>\n \u00b7 grw [Nat.cast_succ, Nat.cast_succ, abv.add_le, abv.map_one, ih]\n\nend IsDomain\n\nend Semiring\n\nend OrderedSemiring\n\nsection OrderedRing\n\nsection Ring\n\nvariable {R S : Type*} [Ring R] [Ring S] [PartialOrder S] [IsOrderedRing S]\n (abv : AbsoluteValue R S)\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_neg (L505-L507)\ntheorem abv_neg (a : R) : abv (-a) = abv a :=\n(toAbsoluteValue abv).map_neg a\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_add_cancel_right_of_ne_top (L128-L130)\nlemma neg_add_cancel_right_of_ne_top (hb : b \u2260 \u22a4) (a : \u03b1) : a + -b + b = a := by\nsimp [add_assoc, neg_add_cancel_of_ne_top hb]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.listSum_le (L102-L106)\nlemma listSum_le [AddLeftMono S] (l : List R) : abv l.sum \u2264 (l.map abv).sum := by\ninduction l with\n | nil => simp\n | cons head tail ih => exact (abv.add_le ..).trans <| add_le_add_right ih (abv head)\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.not_isNontrivial_iff (L350-L356)\nlemma not_isNontrivial_iff (v : AbsoluteValue R S) :\n \u00ac v.IsNontrivial \u2194 \u2200 x \u2260 0, v x = 1 := by\nsimp only [IsNontrivial]\n push Not\n rfl\n\nomit [IsOrderedRing S] in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_left_injective_of_ne_top (L68-L70)\nlemma add_left_injective_of_ne_top (b : \u03b1) (h : b \u2260 \u22a4) : Function.Injective (fun x \u21a6 x + b) :=\n(IsAddRegular.of_ne_top h).2\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abvHom' (L542-L556)\ndef abvHom' : R \u2192*\u2080 S where\n toFun := abv; map_zero' := abv_zero abv; map_one' := abv_one' abv; map_mul' := abv_mul abv\nend Semiring\n\nend IsCancelMulZero\n\nsection LinearOrderedSemifield\n\nvariable {S : Type*} [Semifield S] [LinearOrder S]\n\nsection DivisionSemiring\n\nvariable {R : Type*} [DivisionSemiring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_nonneg (L412-L417)\nlemma abv_nonneg (x) : 0 \u2264 abv x := abv_nonneg' x\nopen Lean Meta Mathlib Meta Positivity Qq in\n/-- The `positivity` extension which identifies expressions of the form `abv a`.\nFor performance reasons, we only attempt to apply this when `abv` is a variable.\nIf it is an explicit function, e.g. `|_|` or `\u2016_\u2016`, another extension should apply. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial (L300-L317)\ndef trivial : AbsoluteValue R S where\n toFun x := if x = 0 then 0 else 1\nmap_mul' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp [hx, hy]\n nonneg' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n eq_zero' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n add_le' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp only [hx, \u2193reduceIte, hy, one_add_one_eq_two]\n rcases eq_or_ne (x + y) 0 with hxy | hxy <;> simp [hxy, one_le_two]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toAbsoluteValue (L441-L447)\ndef toAbsoluteValue : AbsoluteValue R S where\n toFun := abv\nadd_le' := abv_add'\n eq_zero' _ := abv_eq_zero'\n nonneg' := abv_nonneg'\n map_mul' := abv_mul'\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_left_injective_of_ne_top (L184-L186)\nlemma sub_left_injective_of_ne_top (h : b \u2260 \u22a4) : Function.Injective fun x \u21a6 x - b := by\nsimpa [sub_eq_add_neg] using add_left_injective_of_ne_top (-b) (by simpa)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_right_injective_of_ne_top (L71-L73)\nlemma add_right_injective_of_ne_top (b : \u03b1) (h : b \u2260 \u22a4) : Function.Injective (fun x \u21a6 b + x) :=\n(IsAddRegular.of_ne_top h).1\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_right_injective_of_ne_top (L187-L189)\nlemma sub_right_injective_of_ne_top (h : b \u2260 \u22a4) : Function.Injective fun x \u21a6 b - x := by\nsimpa [sub_eq_add_neg] using (add_right_injective_of_ne_top b h).comp neg_injective\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_mul (L430-L432)\nlemma abv_mul (x y) : abv (x * y) = abv x * abv y := abv_mul' x y\n/-- A bundled absolute value is an absolute value. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Euclidean.map_lt_map_iff (L50-L52)\ntheorem map_lt_map_iff {x y : R} (h : abv.IsEuclidean) : abv x < abv y \u2194 x \u227a y :=\nmap_lt_map_iff' h\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abs_abv_sub_le_abv_sub (L288-L299)\ntheorem abs_abv_sub_le_abv_sub (a b : R) : abs (abv a - abv b) \u2264 abv (a - b) :=\nabs_sub_le_iff.2 \u27e8abv.le_sub _ _, by rw [abv.map_sub]; apply abv.le_sub\u27e9\n\nend LinearOrderedCommRing\n\nsection trivial\n\nvariable {R : Type*} [Semiring R] [DecidablePred fun x : R \u21a6 x = 0] [NoZeroDivisors R]\nvariable {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S] [Nontrivial S]\n\n/-- The *trivial* absolute value takes the value `1` on all nonzero elements. -/\nprotected\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_self_nonneg (L236-L240)\nlemma sub_self_nonneg : 0 \u2264 a - a := by\nobtain rfl | ha := eq_or_ne a \u22a4\n \u00b7 simp\n \u00b7 rw [sub_self_eq_zero_of_ne_top ha]\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.IsNontrivial (L335-L337)\ndef IsNontrivial (v : AbsoluteValue R S) : Prop :=\n\u2203 x \u2260 0, v x \u2260 1\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_div (L560-L567)\ntheorem abv_div (a b : R) : abv (a / b) = abv a / abv b :=\nmap_div\u2080 (abvHom' abv) a b\n\nend DivisionSemiring\n\nend LinearOrderedSemifield\n\nend IsAbsoluteValue\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_lt_add_iff_right_of_ne_top (L101-L109)\nlemma add_lt_add_iff_right_of_ne_top (h : a \u2260 \u22a4) : a + b < a + c \u2194 b < c :=\n(add_right_strictMono_of_ne_top h).lt_iff_lt\n\nend LinearOrderedAddCommMonoidWithTop\n\nnamespace LinearOrderedAddCommGroupWithTop\n\nvariable [LinearOrderedAddCommGroupWithTop \u03b1] {a b c : \u03b1}\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.not_isNontrivial_apply (L358-L368)\nlemma not_isNontrivial_apply {v : AbsoluteValue R S} (hv : \u00ac v.IsNontrivial) {x : R} (hx : x \u2260 0) :\n v x = 1 :=\nv.not_isNontrivial_iff.mp hv _ hx\n\nend OrderedSemiring\n\nsection LinearOrderedSemifield\n\nvariable [Field R] [Semifield S] [LinearOrder S] [IsStrictOrderedRing S] [ExistsAddOfLE S]\n {v : AbsoluteValue R S}\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_add (L428-L429)\nlemma abv_add (x y) : abv (x + y) \u2264 abv x + abv y := abv_add' x y\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_pos (L232-L234)\nlemma neg_pos : 0 < -a \u2194 a < 0 \u2228 a = \u22a4 := by\nsimpa using sub_pos (a := 0) (b := a)\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_le_add_iff_left_of_ne_top (L89-L91)\nlemma add_le_add_iff_left_of_ne_top (h : a \u2260 \u22a4) : b + a \u2264 c + a \u2194 b \u2264 c :=\n(add_left_strictMono_of_ne_top h).le_iff_le\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.monoidWithZeroHomClass (L159-L164)\ninstance monoidWithZeroHomClass : MonoidWithZeroHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.mulHomClass with\n map_zero := fun f => f.map_zero\n map_one := fun f => f.map_one }\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*`, `0` and `1`. -/\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_sub (L508-L520)\ntheorem abv_sub (a b : R) : abv (a - b) = abv (b - a) :=\n(toAbsoluteValue abv).map_sub a b\n\nend OrderedCommRing\n\nsection LinearOrderedCommRing\n\nvariable {S : Type*} [CommRing S] [LinearOrder S] [IsStrictOrderedRing S]\n\nsection Ring\n\nvariable {R : Type*} [Ring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_inv (L557-L559)\ntheorem abv_inv (a : R) : abv a\u207b\u00b9 = (abv a)\u207b\u00b9 :=\nmap_inv\u2080 (abvHom' abv) a\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_left_strictMono_of_ne_top (L82-L84)\nlemma add_left_strictMono_of_ne_top (h : b \u2260 \u22a4) : StrictMono (fun x \u21a6 x + b) :=\nadd_left_mono.strictMono_of_injective <| add_left_injective_of_ne_top _ h\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.sub_le_add (L235-L237)\nlemma sub_le_add (a b : R) : abv (a - b) \u2264 abv a + abv b := by\nsimpa only [\u2190 sub_eq_add_neg, AbsoluteValue.map_neg] using abv.add_le a (-b)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abvHom (L478-L480)\ndef abvHom [Nontrivial R] : R \u2192*\u2080 S :=\n(toAbsoluteValue abv).toMonoidWithZeroHom\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_lt_sub_iff_left_of_ne_top (L212-L214)\nlemma sub_lt_sub_iff_left_of_ne_top (h : a \u2260 \u22a4) : b - a < c - a \u2194 b < c :=\n(sub_left_strictMono_of_ne_top h).lt_iff_lt\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_left_inj_of_ne_top (L75-L77)\nlemma add_left_inj_of_ne_top (h : a \u2260 \u22a4) : b + a = c + a \u2194 b = c :=\n(add_left_injective_of_ne_top _ h).eq_iff\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_right_inj_of_ne_top (L79-L81)\nlemma add_right_inj_of_ne_top (h : a \u2260 \u22a4) : a + b = a + c \u2194 b = c :=\n(add_right_injective_of_ne_top _ h).eq_iff\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.Simps (L80-L84)\ndef Simps.apply (f : AbsoluteValue R S) : R \u2192 S :=\nf\n\ninitialize_simps_projections AbsoluteValue (toFun \u2192 apply)\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_top (L62-L64)\ntheorem add_top (a : \u03b1) : a + \u22a4 = \u22a4 :=\nTrans.trans (add_comm _ _) (top_add _)\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_one (L474-L477)\ntheorem abv_one [Nontrivial R] : abv 1 = 1 :=\n(toAbsoluteValue abv).map_one\n\n/-- `abv` as a `MonoidWithZeroHom`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_le_sub_iff_left_of_ne_top (L208-L210)\nlemma sub_le_sub_iff_left_of_ne_top (h : a \u2260 \u22a4) : b - a \u2264 c - a \u2194 b \u2264 c :=\n(sub_left_strictMono_of_ne_top h).le_iff_le\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.top_add (L58-L60)\ntheorem top_add (a : \u03b1) : \u22a4 + a = \u22a4 :=\nLinearOrderedAddCommMonoidWithTop.top_add' a\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_pos (L226-L230)\nlemma sub_pos : 0 < a - b \u2194 b < a \u2228 b = \u22a4 := by\nobtain rfl | hb := eq_or_ne b \u22a4\n \u00b7 simp\n \u00b7 simp [\u2190 sub_self_eq_zero_of_ne_top hb, hb]\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_left_strictMono_of_ne_top (L204-L206)\nlemma sub_left_strictMono_of_ne_top (h : b \u2260 \u22a4) : StrictMono fun x \u21a6 x - b := by\nsimpa [sub_eq_add_neg] using add_left_strictMono_of_ne_top (b := -b) (by simpa)\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_lt_add_iff_left_of_ne_top (L97-L99)\nlemma add_lt_add_iff_left_of_ne_top (h : a \u2260 \u22a4) : b + a < c + a \u2194 b < c :=\n(add_left_strictMono_of_ne_top h).lt_iff_lt\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_pow (L481-L490)\ntheorem abv_pow [Nontrivial R] (abv : R \u2192 S) [IsAbsoluteValue abv] (a : R) (n : \u2115) :\n abv (a ^ n) = abv a ^ n :=\n(toAbsoluteValue abv).map_pow a n\n\nend Semiring\n\nsection Ring\n\nvariable {R : Type*} [Ring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_neg_cancel_left_of_ne_top (L119-L121)\nlemma add_neg_cancel_left_of_ne_top (ha : a \u2260 \u22a4) (b : \u03b1) : a + (-a + b) = b := by\nsimp [\u2190 add_assoc, add_neg_cancel_of_ne_top ha]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_natAbs_eq (L250-L255)\nlemma apply_natAbs_eq (x : \u2124) : abv (natAbs x) = abv x := by\nobtain \u27e8_, rfl | rfl\u27e9 := Int.eq_nat_or_neg x <;> simp\n\nopen Int in\n/-- Values of an absolute value coincide on the image of `\u2115` in `R`\nif and only if they coincide on the image of `\u2124` in `R`. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidHom (L173-L175)\ndef toMonoidHom : R \u2192* S :=\nabv\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f := f.toFun\ncoe_injective' f g h := by obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := f; obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := g; congr\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_ne_top (L149-L150)\nlemma add_ne_top : a + b \u2260 \u22a4 \u2194 a \u2260 \u22a4 \u2227 b \u2260 \u22a4 := by simp [\u2190 isAddUnit_iff]\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.addGroupSeminormClass (L238-L242)\ninstance addGroupSeminormClass : AddGroupSeminormClass (AbsoluteValue R S) R S where\n toSubadditiveHomClass := AbsoluteValue.subadditiveHomClass\nmap_zero := AbsoluteValue.map_zero\n map_neg_eq_map f a := AbsoluteValue.map_neg f a\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_one_of_isLeftRegular (L124-L126)\ntheorem map_one_of_isLeftRegular (h : IsLeftRegular (abv 1)) : abv 1 = 1 :=\nh <| by simp [\u2190 abv.map_mul]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_add_cancel_of_ne_top (L116-L118)\nlemma neg_add_cancel_of_ne_top (ha : a \u2260 \u22a4) : -a + a = 0 := by\nsimp [add_comm, add_neg_cancel_of_ne_top ha]\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abs_isAbsoluteValue (L460-L473)\ninstance abs_isAbsoluteValue : IsAbsoluteValue (abs : S \u2192 S) :=\nAbsoluteValue.abs.isAbsoluteValue\n\nend LinearOrderedRing\n\nsection OrderedRing\n\nvariable {S : Type*} [Ring S] [PartialOrder S]\n\nsection Semiring\n\nvariable {R : Type*} [Semiring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\nvariable [IsDomain S]\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_self_eq_zero_iff_ne_top (L221-L225)\nlemma sub_self_eq_zero_iff_ne_top : a - a = 0 \u2194 a \u2260 \u22a4 := by\nrw [sub_eq_add_neg, add_neg_cancel_iff_ne_top]\n\nalias \u27e8_, sub_self_eq_zero_of_ne_top\u27e9 := sub_self_eq_zero_iff_ne_top\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial_apply (L319-L334)\nlemma trivial_apply {x : R} (hx : x \u2260 0) : AbsoluteValue.trivial (S := S) x = 1 :=\nif_neg hx\n\nend trivial\n\nsection nontrivial\n\nsection OrderedSemiring\n\nvariable {R : Type*} [Semiring R] {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S]\n\n/-- An absolute value on a semiring `R` without zero divisors is *nontrivial* if it takes\na value `\u2260 1` on a nonzero element.\n\nThis has the advantage over `v \u2260 .trivial` that it does not require decidability\nof `\u00b7 = 0` in `R`. -/\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Euclidean.sub_mod_lt (L55-L74)\ntheorem sub_mod_lt (h : abv.IsEuclidean) (a : R) {b : R} (hb : b \u2260 0) : abv (a % b) < abv b :=\nh.map_lt_map_iff.mpr (EuclideanDomain.mod_lt a hb)\n\nend IsEuclidean\n\nend OrderedSemiring\n\nsection Int\n\nopen Int\n\n-- TODO: generalize to `LinearOrderedEuclideanDomain`s if we ever get a definition of those\n/-- `abs : \u2124 \u2192 \u2124` is a Euclidean absolute value -/\nprotected theorem abs_isEuclidean : IsEuclidean (AbsoluteValue.abs : AbsoluteValue \u2124 \u2124) :=\n { map_lt_map_iff' := fun {x y} =>\n show abs x < abs y \u2194 natAbs x < natAbs y by rw [abs_eq_natAbs, abs_eq_natAbs, ofNat_lt] }\n\nend Int\n\nend AbsoluteValue\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_le_add_iff_right_of_ne_top (L93-L95)\nlemma add_le_add_iff_right_of_ne_top (h : a \u2260 \u22a4) : a + b \u2264 a + c \u2194 b \u2264 c :=\n(add_right_strictMono_of_ne_top h).le_iff_le\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_zero (L448-L450)\ntheorem abv_zero : abv 0 = 0 :=\n(toAbsoluteValue abv).map_zero\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_neg_cancel_iff_ne_top (L216-L219)\nlemma add_neg_cancel_iff_ne_top : a + -a = 0 \u2194 a \u2260 \u22a4 where\n mp := by contrapose; simp +contextual\nmpr h := add_neg_cancel_of_ne_top h\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f :=\nrfl\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_add_cancel_left_of_ne_top (L122-L124)\nlemma neg_add_cancel_left_of_ne_top (ha : a \u2260 \u22a4) (b : \u03b1) : -a + (a + b) = b := by\nsimp [\u2190 add_assoc, neg_add_cancel_of_ne_top ha]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.isNontrivial_iff_ne_trivial (L338-L349)\nlemma isNontrivial_iff_ne_trivial [DecidablePred fun x : R \u21a6 x = 0] [NoZeroDivisors R]\n [Nontrivial S] (v : AbsoluteValue R S) :\n v.IsNontrivial \u2194 v \u2260 .trivial := by\nrefine \u27e8fun \u27e8x, hx\u2080, hx\u2081\u27e9 h \u21a6 hx\u2081 <| h.symm \u25b8 trivial_apply hx\u2080, fun H \u21a6 ?_\u27e9\n simp only [IsNontrivial]\n contrapose! H\n ext1 x\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n \u00b7 simp [H, hx]\n\nomit [IsOrderedRing S] in\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f := (f.eq_zero' _).2 rfl\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_neg_cancel_right_of_ne_top (L125-L127)\nlemma add_neg_cancel_right_of_ne_top (hb : b \u2260 \u22a4) (a : \u03b1) : a + b + -b = a := by\nsimp [add_assoc, add_neg_cancel_of_ne_top hb]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.sub_abv_le_abv_sub (L494-L504)\ntheorem sub_abv_le_abv_sub [IsOrderedRing S] (a b : R) : abv a - abv b \u2264 abv (a - b) :=\n(toAbsoluteValue abv).le_sub a b\n\nend Ring\n\nend OrderedRing\n\nsection OrderedCommRing\nvariable [CommRing S] [PartialOrder S] [IsOrderedRing S] [NoZeroDivisors S] [Ring R]\n (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_left_inj_of_ne_top (L191-L193)\nlemma sub_left_inj_of_ne_top (h : a \u2260 \u22a4) : b - a = c - a \u2194 b = c :=\n(sub_left_injective_of_ne_top h).eq_iff\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.Algebra.Order.Hom.MonoidWithZero).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef comp (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) : \u03b1 \u2192*\u2080o \u03b3\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.OrderMonoidWithZeroHomClass (L69-L72)\ndef OrderMonoidWithZeroHomClass.toOrderMonoidWithZeroHom [OrderHomClass F \u03b1 \u03b2]\n [MonoidWithZeroHomClass F \u03b1 \u03b2] (f : F) : \u03b1 \u2192*\u2080o \u03b2 :=\n{ (f : \u03b1 \u2192*\u2080 \u03b2) with monotone' := OrderHomClass.monotone f }\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.ext (L108-L110)\ntheorem ext (h : \u2200 a, f a = g a) : f = g :=\nDFunLike.ext f g h\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toFun_eq_coe (L111-L113)\ntheorem toFun_eq_coe (f : \u03b1 \u2192*\u2080o \u03b2) : f.toFun = (f : \u03b1 \u2192 \u03b2) :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_mk (L115-L117)\ntheorem coe_mk (f : \u03b1 \u2192*\u2080 \u03b2) (h) : (OrderMonoidWithZeroHom.mk f h : \u03b1 \u2192 \u03b2) = f :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.mk_coe (L119-L121)\ntheorem mk_coe (f : \u03b1 \u2192*\u2080o \u03b2) (h) : OrderMonoidWithZeroHom.mk (f : \u03b1 \u2192*\u2080 \u03b2) h = f := rfl\n/-- Reinterpret an ordered monoid with zero homomorphism as an order monoid homomorphism. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toOrderMonoidHom (L122-L124)\ndef toOrderMonoidHom (f : \u03b1 \u2192*\u2080o \u03b2) : \u03b1 \u2192*o \u03b2 :=\n{ f with }\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_monoidWithZeroHom (L126-L128)\ntheorem coe_monoidWithZeroHom (f : \u03b1 \u2192*\u2080o \u03b2) : \u21d1(f : \u03b1 \u2192*\u2080 \u03b2) = f :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_orderMonoidHom (L130-L132)\ntheorem coe_orderMonoidHom (f : \u03b1 \u2192*\u2080o \u03b2) : \u21d1(f : \u03b1 \u2192*o \u03b2) = f :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toOrderMonoidHom_injective (L133-L135)\ntheorem toOrderMonoidHom_injective : Injective (toOrderMonoidHom : _ \u2192 \u03b1 \u2192*o \u03b2) := fun f g h =>\next <| by convert DFunLike.ext_iff.1 h using 0\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.toMonoidWithZeroHom_injective (L136-L139)\ntheorem toMonoidWithZeroHom_injective : Injective (toMonoidWithZeroHom : _ \u2192 \u03b1 \u2192*\u2080 \u03b2) :=\nfun f g h => ext <| by convert DFunLike.ext_iff.1 h using 0\n\n/-- Copy of an `OrderMonoidWithZeroHom` with a new `toFun` equal to the old one. Useful to fix\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_copy (L145-L147)\ntheorem coe_copy (f : \u03b1 \u2192*\u2080o \u03b2) (f' : \u03b1 \u2192 \u03b2) (h : f' = f) : \u21d1(f.copy f' h) = f' :=\nrfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.copy_eq (L148-L156)\ntheorem copy_eq (f : \u03b1 \u2192*\u2080o \u03b2) (f' : \u03b1 \u2192 \u03b2) (h : f' = f) : f.copy f' h = f :=\nDFunLike.ext' h\n\nvariable (\u03b1)\n\n/-- The identity map as an ordered monoid with zero homomorphism. -/\nprotected def id : \u03b1 \u2192*\u2080o \u03b1 :=\n { MonoidWithZeroHom.id \u03b1, OrderHom.id with }\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_id (L158-L160)\ntheorem coe_id : \u21d1(OrderMonoidWithZeroHom.id \u03b1) = id :=\nrfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_comp (L171-L173)\ntheorem coe_comp (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) : (f.comp g : \u03b1 \u2192 \u03b3) = f \u2218 g :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.comp_apply (L175-L177)\ntheorem comp_apply (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) (a : \u03b1) : (f.comp g) a = f (g a) :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_comp_monoidWithZeroHom (L178-L181)\ntheorem coe_comp_monoidWithZeroHom (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) :\n (f.comp g : \u03b1 \u2192*\u2080 \u03b3) = (f : \u03b2 \u2192*\u2080 \u03b3).comp g :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_comp_orderMonoidHom (L182-L185)\ntheorem coe_comp_orderMonoidHom (f : \u03b2 \u2192*\u2080o \u03b3) (g : \u03b1 \u2192*\u2080o \u03b2) :\n (f.comp g : \u03b1 \u2192*o \u03b3) = (f : \u03b2 \u2192*o \u03b3).comp g :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.comp_assoc (L187-L190)\ntheorem comp_assoc (f : \u03b3 \u2192*\u2080o \u03b4) (g : \u03b2 \u2192*\u2080o \u03b3) (h : \u03b1 \u2192*\u2080o \u03b2) :\n (f.comp g).comp h = f.comp (g.comp h) :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.comp_id (L192-L193)\ntheorem comp_id (f : \u03b1 \u2192*\u2080o \u03b2) : f.comp (OrderMonoidWithZeroHom.id \u03b1) = f := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.id_comp (L195-L196)\ntheorem id_comp (f : \u03b1 \u2192*\u2080o \u03b2) : (OrderMonoidWithZeroHom.id \u03b2).comp f = f := rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.cancel_right (L198-L201)\ntheorem cancel_right {g\u2081 g\u2082 : \u03b2 \u2192*\u2080o \u03b3} {f : \u03b1 \u2192*\u2080o \u03b2} (hf : Function.Surjective f) :\n g\u2081.comp f = g\u2082.comp f \u2194 g\u2081 = g\u2082 :=\n\u27e8fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, fun _ => by congr\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.cancel_left (L203-L215)\ntheorem cancel_left {g : \u03b2 \u2192*\u2080o \u03b3} {f\u2081 f\u2082 : \u03b1 \u2192*\u2080o \u03b2} (hg : Function.Injective g) :\n g.comp f\u2081 = g.comp f\u2082 \u2194 f\u2081 = f\u2082 :=\n\u27e8fun h => ext fun a => hg <| by rw [\u2190 comp_apply, h, comp_apply], congr_arg _\u27e9\n\nend Preorder\n\nsection Mul\n\nvariable [LinearOrderedCommMonoidWithZero \u03b1] [LinearOrderedCommMonoidWithZero \u03b2]\n [LinearOrderedCommMonoidWithZero \u03b3]\n\n/-- For two ordered monoid morphisms `f` and `g`, their product is the ordered monoid morphism\nsending `a` to `f a * g a`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.coe_mul (L220-L222)\ntheorem coe_mul (f g : \u03b1 \u2192*\u2080o \u03b2) : \u21d1(f * g) = f * g :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.mul_apply (L224-L226)\ntheorem mul_apply (f g : \u03b1 \u2192*\u2080o \u03b2) (a : \u03b1) : (f * g) a = f a * g a :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Order.Hom.MonoidWithZero.mul_comp (L227-L229)\ntheorem mul_comp (g\u2081 g\u2082 : \u03b2 \u2192*\u2080o \u03b3) (f : \u03b1 \u2192*\u2080o \u03b2) : (g\u2081 * g\u2082).comp f = g\u2081.comp f * g\u2082.comp f :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)\ninstance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with apply_nonneg := fun f => f.nonneg' }\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)\ninstance mulHomClass : MulHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_mul := fun f => f.map_mul' }\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.ext (L76-L79)\ntheorem ext \u2983f g : AbsoluteValue R S\u2984 : (\u2200 x, f x = g x) \u2192 f = g :=\nDFunLike.ext _ _\n\n/-- See Note [custom simps projection]. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_eq_zero (L426-L427)\nlemma abv_eq_zero {x} : abv x = 0 \u2194 x = 0 := abv_eq_zero'\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidWithZeroHom (L165-L167)\ndef toMonoidWithZeroHom : R \u2192*\u2080 S :=\nabv\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)\ninstance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.zeroHomClass (R := R) (S := S) with map_add_le_add := fun f => f.add_le' }\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_pos (L451-L459)\ntheorem abv_pos {a : R} : 0 < abv a \u2194 a \u2260 0 :=\n(toAbsoluteValue abv).pos_iff\n\nend OrderedSemiring\n\nsection LinearOrderedRing\n\nvariable {S : Type*} [Ring S] [LinearOrder S] [IsStrictOrderedRing S]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_right_inj_of_ne_top (L195-L197)\nlemma sub_right_inj_of_ne_top (h : a \u2260 \u22a4) : a - b = a - c \u2194 b = c :=\n(sub_right_injective_of_ne_top h).eq_iff\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_one' (L537-L541)\ntheorem abv_one' : abv 1 = 1 :=\n(toAbsoluteValue abv).map_one_of_isLeftRegular <|\n (IsRegular.of_ne_zero <| (toAbsoluteValue abv).ne_zero one_ne_zero).left\n\n/-- An absolute value as a monoid with zero homomorphism, assuming the target is a semifield. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidHom (L177-L179)\ntheorem coe_toMonoidHom : \u21d1abv.toMonoidHom = abv :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMonoidWithZeroHom (L169-L172)\ntheorem coe_toMonoidWithZeroHom : \u21d1abv.toMonoidWithZeroHom = abv :=\nrfl\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*` and `1`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_toMulHom (L86-L88)\ntheorem coe_toMulHom : \u21d1abv.toMulHom = abv :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_sub_le (L491-L493)\ntheorem abv_sub_le (a b c : R) : abv (a - c) \u2264 abv (a - b) + abv (b - c) := by\nsimpa [sub_eq_add_neg, add_assoc] using abv_add abv (a - b) (b - c)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.eq_on_nat_iff_eq_on_int (L256-L268)\nlemma eq_on_nat_iff_eq_on_int {f g : AbsoluteValue R S} :\n (\u2200 n : \u2115, f n = g n) \u2194 \u2200 n : \u2124, f n = g n := by\nrefine \u27e8fun h z \u21a6 ?_, fun a n \u21a6 mod_cast a n\u27e9\n obtain \u27e8n, rfl | rfl\u27e9 := Int.eq_nat_or_neg z <;> simp [h n]\n\nend OrderedCommRing\n\nsection LinearOrderedRing\n\nvariable {R S : Type*} [Semiring R] [Ring S] [LinearOrder S] [IsStrictOrderedRing S]\n (abv : AbsoluteValue R S)\n\n/-- `AbsoluteValue.abs` is `abs` as a bundled `AbsoluteValue`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_right_strictMono_of_ne_top (L85-L87)\nlemma add_right_strictMono_of_ne_top (h : b \u2260 \u22a4) : StrictMono (fun x \u21a6 b + x) :=\nadd_right_mono.strictMono_of_injective <| add_right_injective_of_ne_top _ h\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_sub_eq_zero_iff (L141-L154)\ntheorem map_sub_eq_zero_iff (a b : R) : abv (a - b) = 0 \u2194 a = b :=\nabv.eq_zero.trans sub_eq_zero\n\nend Ring\n\nsection Semiring\n\nsection IsDomain\n\n-- all of these are true for `NoZeroDivisors S`; but it doesn't work smoothly with the\n-- `IsDomain`/`IsCancelMulZero` API\nvariable {R S : Type*} [Semiring R] [Semiring S] [PartialOrder S] (abv : AbsoluteValue R S)\nvariable [IsDomain S] [Nontrivial R]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_nat_le_self (L186-L206)\nlemma apply_nat_le_self [IsOrderedRing S] (n : \u2115) : abv n \u2264 n := by\ncases subsingleton_or_nontrivial R\n \u00b7 simp [Subsingleton.eq_zero (n : R)]\n induction n with\n | zero => simp\n | succ n ih =>\n \u00b7 grw [Nat.cast_succ, Nat.cast_succ, abv.add_le, abv.map_one, ih]\n\nend IsDomain\n\nend Semiring\n\nend OrderedSemiring\n\nsection OrderedRing\n\nsection Ring\n\nvariable {R S : Type*} [Ring R] [Ring S] [PartialOrder S] [IsOrderedRing S]\n (abv : AbsoluteValue R S)\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_neg (L505-L507)\ntheorem abv_neg (a : R) : abv (-a) = abv a :=\n(toAbsoluteValue abv).map_neg a\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_add_cancel_right_of_ne_top (L128-L130)\nlemma neg_add_cancel_right_of_ne_top (hb : b \u2260 \u22a4) (a : \u03b1) : a + -b + b = a := by\nsimp [add_assoc, neg_add_cancel_of_ne_top hb]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.listSum_le (L102-L106)\nlemma listSum_le [AddLeftMono S] (l : List R) : abv l.sum \u2264 (l.map abv).sum := by\ninduction l with\n | nil => simp\n | cons head tail ih => exact (abv.add_le ..).trans <| add_le_add_right ih (abv head)\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.not_isNontrivial_iff (L350-L356)\nlemma not_isNontrivial_iff (v : AbsoluteValue R S) :\n \u00ac v.IsNontrivial \u2194 \u2200 x \u2260 0, v x = 1 := by\nsimp only [IsNontrivial]\n push Not\n rfl\n\nomit [IsOrderedRing S] in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_left_injective_of_ne_top (L68-L70)\nlemma add_left_injective_of_ne_top (b : \u03b1) (h : b \u2260 \u22a4) : Function.Injective (fun x \u21a6 x + b) :=\n(IsAddRegular.of_ne_top h).2\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abvHom' (L542-L556)\ndef abvHom' : R \u2192*\u2080 S where\n toFun := abv; map_zero' := abv_zero abv; map_one' := abv_one' abv; map_mul' := abv_mul abv\nend Semiring\n\nend IsCancelMulZero\n\nsection LinearOrderedSemifield\n\nvariable {S : Type*} [Semifield S] [LinearOrder S]\n\nsection DivisionSemiring\n\nvariable {R : Type*} [DivisionSemiring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_nonneg (L412-L417)\nlemma abv_nonneg (x) : 0 \u2264 abv x := abv_nonneg' x\nopen Lean Meta Mathlib Meta Positivity Qq in\n/-- The `positivity` extension which identifies expressions of the form `abv a`.\nFor performance reasons, we only attempt to apply this when `abv` is a variable.\nIf it is an explicit function, e.g. `|_|` or `\u2016_\u2016`, another extension should apply. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial (L300-L317)\ndef trivial : AbsoluteValue R S where\n toFun x := if x = 0 then 0 else 1\nmap_mul' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp [hx, hy]\n nonneg' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n eq_zero' x := by rcases eq_or_ne x 0 with hx | hx <;> simp [hx]\n add_le' x y := by\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n rcases eq_or_ne y 0 with rfl | hy\n \u00b7 simp\n simp only [hx, \u2193reduceIte, hy, one_add_one_eq_two]\n rcases eq_or_ne (x + y) 0 with hxy | hxy <;> simp [hxy, one_le_two]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toAbsoluteValue (L441-L447)\ndef toAbsoluteValue : AbsoluteValue R S where\n toFun := abv\nadd_le' := abv_add'\n eq_zero' _ := abv_eq_zero'\n nonneg' := abv_nonneg'\n map_mul' := abv_mul'\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_left_injective_of_ne_top (L184-L186)\nlemma sub_left_injective_of_ne_top (h : b \u2260 \u22a4) : Function.Injective fun x \u21a6 x - b := by\nsimpa [sub_eq_add_neg] using add_left_injective_of_ne_top (-b) (by simpa)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_right_injective_of_ne_top (L71-L73)\nlemma add_right_injective_of_ne_top (b : \u03b1) (h : b \u2260 \u22a4) : Function.Injective (fun x \u21a6 b + x) :=\n(IsAddRegular.of_ne_top h).1\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_right_injective_of_ne_top (L187-L189)\nlemma sub_right_injective_of_ne_top (h : b \u2260 \u22a4) : Function.Injective fun x \u21a6 b - x := by\nsimpa [sub_eq_add_neg] using (add_right_injective_of_ne_top b h).comp neg_injective\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_mul (L430-L432)\nlemma abv_mul (x y) : abv (x * y) = abv x * abv y := abv_mul' x y\n/-- A bundled absolute value is an absolute value. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Euclidean.map_lt_map_iff (L50-L52)\ntheorem map_lt_map_iff {x y : R} (h : abv.IsEuclidean) : abv x < abv y \u2194 x \u227a y :=\nmap_lt_map_iff' h\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abs_abv_sub_le_abv_sub (L288-L299)\ntheorem abs_abv_sub_le_abv_sub (a b : R) : abs (abv a - abv b) \u2264 abv (a - b) :=\nabs_sub_le_iff.2 \u27e8abv.le_sub _ _, by rw [abv.map_sub]; apply abv.le_sub\u27e9\n\nend LinearOrderedCommRing\n\nsection trivial\n\nvariable {R : Type*} [Semiring R] [DecidablePred fun x : R \u21a6 x = 0] [NoZeroDivisors R]\nvariable {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S] [Nontrivial S]\n\n/-- The *trivial* absolute value takes the value `1` on all nonzero elements. -/\nprotected\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_self_nonneg (L236-L240)\nlemma sub_self_nonneg : 0 \u2264 a - a := by\nobtain rfl | ha := eq_or_ne a \u22a4\n \u00b7 simp\n \u00b7 rw [sub_self_eq_zero_of_ne_top ha]\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.IsNontrivial (L335-L337)\ndef IsNontrivial (v : AbsoluteValue R S) : Prop :=\n\u2203 x \u2260 0, v x \u2260 1\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_div (L560-L567)\ntheorem abv_div (a b : R) : abv (a / b) = abv a / abv b :=\nmap_div\u2080 (abvHom' abv) a b\n\nend DivisionSemiring\n\nend LinearOrderedSemifield\n\nend IsAbsoluteValue\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_lt_add_iff_right_of_ne_top (L101-L109)\nlemma add_lt_add_iff_right_of_ne_top (h : a \u2260 \u22a4) : a + b < a + c \u2194 b < c :=\n(add_right_strictMono_of_ne_top h).lt_iff_lt\n\nend LinearOrderedAddCommMonoidWithTop\n\nnamespace LinearOrderedAddCommGroupWithTop\n\nvariable [LinearOrderedAddCommGroupWithTop \u03b1] {a b c : \u03b1}\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.not_isNontrivial_apply (L358-L368)\nlemma not_isNontrivial_apply {v : AbsoluteValue R S} (hv : \u00ac v.IsNontrivial) {x : R} (hx : x \u2260 0) :\n v x = 1 :=\nv.not_isNontrivial_iff.mp hv _ hx\n\nend OrderedSemiring\n\nsection LinearOrderedSemifield\n\nvariable [Field R] [Semifield S] [LinearOrder S] [IsStrictOrderedRing S] [ExistsAddOfLE S]\n {v : AbsoluteValue R S}\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_add (L428-L429)\nlemma abv_add (x y) : abv (x + y) \u2264 abv x + abv y := abv_add' x y\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_pos (L232-L234)\nlemma neg_pos : 0 < -a \u2194 a < 0 \u2228 a = \u22a4 := by\nsimpa using sub_pos (a := 0) (b := a)\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_le_add_iff_left_of_ne_top (L89-L91)\nlemma add_le_add_iff_left_of_ne_top (h : a \u2260 \u22a4) : b + a \u2264 c + a \u2194 b \u2264 c :=\n(add_left_strictMono_of_ne_top h).le_iff_le\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.monoidWithZeroHomClass (L159-L164)\ninstance monoidWithZeroHomClass : MonoidWithZeroHomClass (AbsoluteValue R S) R S :=\n{ AbsoluteValue.mulHomClass with\n map_zero := fun f => f.map_zero\n map_one := fun f => f.map_one }\n\n/-- Absolute values from a nontrivial `R` to a linear ordered ring preserve `*`, `0` and `1`. -/\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_sub (L508-L520)\ntheorem abv_sub (a b : R) : abv (a - b) = abv (b - a) :=\n(toAbsoluteValue abv).map_sub a b\n\nend OrderedCommRing\n\nsection LinearOrderedCommRing\n\nvariable {S : Type*} [CommRing S] [LinearOrder S] [IsStrictOrderedRing S]\n\nsection Ring\n\nvariable {R : Type*} [Ring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_inv (L557-L559)\ntheorem abv_inv (a : R) : abv a\u207b\u00b9 = (abv a)\u207b\u00b9 :=\nmap_inv\u2080 (abvHom' abv) a\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_left_strictMono_of_ne_top (L82-L84)\nlemma add_left_strictMono_of_ne_top (h : b \u2260 \u22a4) : StrictMono (fun x \u21a6 x + b) :=\nadd_left_mono.strictMono_of_injective <| add_left_injective_of_ne_top _ h\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.sub_le_add (L235-L237)\nlemma sub_le_add (a b : R) : abv (a - b) \u2264 abv a + abv b := by\nsimpa only [\u2190 sub_eq_add_neg, AbsoluteValue.map_neg] using abv.add_le a (-b)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abvHom (L478-L480)\ndef abvHom [Nontrivial R] : R \u2192*\u2080 S :=\n(toAbsoluteValue abv).toMonoidWithZeroHom\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_lt_sub_iff_left_of_ne_top (L212-L214)\nlemma sub_lt_sub_iff_left_of_ne_top (h : a \u2260 \u22a4) : b - a < c - a \u2194 b < c :=\n(sub_left_strictMono_of_ne_top h).lt_iff_lt\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_left_inj_of_ne_top (L75-L77)\nlemma add_left_inj_of_ne_top (h : a \u2260 \u22a4) : b + a = c + a \u2194 b = c :=\n(add_left_injective_of_ne_top _ h).eq_iff\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_right_inj_of_ne_top (L79-L81)\nlemma add_right_inj_of_ne_top (h : a \u2260 \u22a4) : a + b = a + c \u2194 b = c :=\n(add_right_injective_of_ne_top _ h).eq_iff\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.Simps (L80-L84)\ndef Simps.apply (f : AbsoluteValue R S) : R \u2192 S :=\nf\n\ninitialize_simps_projections AbsoluteValue (toFun \u2192 apply)\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_top (L62-L64)\ntheorem add_top (a : \u03b1) : a + \u22a4 = \u22a4 :=\nTrans.trans (add_comm _ _) (top_add _)\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_one (L474-L477)\ntheorem abv_one [Nontrivial R] : abv 1 = 1 :=\n(toAbsoluteValue abv).map_one\n\n/-- `abv` as a `MonoidWithZeroHom`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_le_sub_iff_left_of_ne_top (L208-L210)\nlemma sub_le_sub_iff_left_of_ne_top (h : a \u2260 \u22a4) : b - a \u2264 c - a \u2194 b \u2264 c :=\n(sub_left_strictMono_of_ne_top h).le_iff_le\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.top_add (L58-L60)\ntheorem top_add (a : \u03b1) : \u22a4 + a = \u22a4 :=\nLinearOrderedAddCommMonoidWithTop.top_add' a\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_pos (L226-L230)\nlemma sub_pos : 0 < a - b \u2194 b < a \u2228 b = \u22a4 := by\nobtain rfl | hb := eq_or_ne b \u22a4\n \u00b7 simp\n \u00b7 simp [\u2190 sub_self_eq_zero_of_ne_top hb, hb]\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_left_strictMono_of_ne_top (L204-L206)\nlemma sub_left_strictMono_of_ne_top (h : b \u2260 \u22a4) : StrictMono fun x \u21a6 x - b := by\nsimpa [sub_eq_add_neg] using add_left_strictMono_of_ne_top (b := -b) (by simpa)\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_lt_add_iff_left_of_ne_top (L97-L99)\nlemma add_lt_add_iff_left_of_ne_top (h : a \u2260 \u22a4) : b + a < c + a \u2194 b < c :=\n(add_left_strictMono_of_ne_top h).lt_iff_lt\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_pow (L481-L490)\ntheorem abv_pow [Nontrivial R] (abv : R \u2192 S) [IsAbsoluteValue abv] (a : R) (n : \u2115) :\n abv (a ^ n) = abv a ^ n :=\n(toAbsoluteValue abv).map_pow a n\n\nend Semiring\n\nsection Ring\n\nvariable {R : Type*} [Ring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_neg_cancel_left_of_ne_top (L119-L121)\nlemma add_neg_cancel_left_of_ne_top (ha : a \u2260 \u22a4) (b : \u03b1) : a + (-a + b) = b := by\nsimp [\u2190 add_assoc, add_neg_cancel_of_ne_top ha]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.apply_natAbs_eq (L250-L255)\nlemma apply_natAbs_eq (x : \u2124) : abv (natAbs x) = abv x := by\nobtain \u27e8_, rfl | rfl\u27e9 := Int.eq_nat_or_neg x <;> simp\n\nopen Int in\n/-- Values of an absolute value coincide on the image of `\u2115` in `R`\nif and only if they coincide on the image of `\u2124` in `R`. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.toMonoidHom (L173-L175)\ndef toMonoidHom : R \u2192* S :=\nabv\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)\ninstance funLike : FunLike (AbsoluteValue R S) R S where\n coe f := f.toFun\ncoe_injective' f g h := by obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := f; obtain \u27e8\u27e8_, _\u27e9, _\u27e9 := g; congr\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_ne_top (L149-L150)\nlemma add_ne_top : a + b \u2260 \u22a4 \u2194 a \u2260 \u22a4 \u2227 b \u2260 \u22a4 := by simp [\u2190 isAddUnit_iff]\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.addGroupSeminormClass (L238-L242)\ninstance addGroupSeminormClass : AddGroupSeminormClass (AbsoluteValue R S) R S where\n toSubadditiveHomClass := AbsoluteValue.subadditiveHomClass\nmap_zero := AbsoluteValue.map_zero\n map_neg_eq_map f a := AbsoluteValue.map_neg f a\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.map_one_of_isLeftRegular (L124-L126)\ntheorem map_one_of_isLeftRegular (h : IsLeftRegular (abv 1)) : abv 1 = 1 :=\nh <| by simp [\u2190 abv.map_mul]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_add_cancel_of_ne_top (L116-L118)\nlemma neg_add_cancel_of_ne_top (ha : a \u2260 \u22a4) : -a + a = 0 := by\nsimp [add_comm, add_neg_cancel_of_ne_top ha]\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abs_isAbsoluteValue (L460-L473)\ninstance abs_isAbsoluteValue : IsAbsoluteValue (abs : S \u2192 S) :=\nAbsoluteValue.abs.isAbsoluteValue\n\nend LinearOrderedRing\n\nsection OrderedRing\n\nvariable {S : Type*} [Ring S] [PartialOrder S]\n\nsection Semiring\n\nvariable {R : Type*} [Semiring R] (abv : R \u2192 S) [IsAbsoluteValue abv]\nvariable [IsDomain S]\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_self_eq_zero_iff_ne_top (L221-L225)\nlemma sub_self_eq_zero_iff_ne_top : a - a = 0 \u2194 a \u2260 \u22a4 := by\nrw [sub_eq_add_neg, add_neg_cancel_iff_ne_top]\n\nalias \u27e8_, sub_self_eq_zero_of_ne_top\u27e9 := sub_self_eq_zero_iff_ne_top\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.trivial_apply (L319-L334)\nlemma trivial_apply {x : R} (hx : x \u2260 0) : AbsoluteValue.trivial (S := S) x = 1 :=\nif_neg hx\n\nend trivial\n\nsection nontrivial\n\nsection OrderedSemiring\n\nvariable {R : Type*} [Semiring R] {S : Type*} [Semiring S] [PartialOrder S] [IsOrderedRing S]\n\n/-- An absolute value on a semiring `R` without zero divisors is *nontrivial* if it takes\na value `\u2260 1` on a nonzero element.\n\nThis has the advantage over `v \u2260 .trivial` that it does not require decidability\nof `\u00b7 = 0` in `R`. -/\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Euclidean.sub_mod_lt (L55-L74)\ntheorem sub_mod_lt (h : abv.IsEuclidean) (a : R) {b : R} (hb : b \u2260 0) : abv (a % b) < abv b :=\nh.map_lt_map_iff.mpr (EuclideanDomain.mod_lt a hb)\n\nend IsEuclidean\n\nend OrderedSemiring\n\nsection Int\n\nopen Int\n\n-- TODO: generalize to `LinearOrderedEuclideanDomain`s if we ever get a definition of those\n/-- `abs : \u2124 \u2192 \u2124` is a Euclidean absolute value -/\nprotected theorem abs_isEuclidean : IsEuclidean (AbsoluteValue.abs : AbsoluteValue \u2124 \u2124) :=\n { map_lt_map_iff' := fun {x y} =>\n show abs x < abs y \u2194 natAbs x < natAbs y by rw [abs_eq_natAbs, abs_eq_natAbs, ofNat_lt] }\n\nend Int\n\nend AbsoluteValue\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_le_add_iff_right_of_ne_top (L93-L95)\nlemma add_le_add_iff_right_of_ne_top (h : a \u2260 \u22a4) : a + b \u2264 a + c \u2194 b \u2264 c :=\n(add_right_strictMono_of_ne_top h).le_iff_le\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.abv_zero (L448-L450)\ntheorem abv_zero : abv 0 = 0 :=\n(toAbsoluteValue abv).map_zero\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_neg_cancel_iff_ne_top (L216-L219)\nlemma add_neg_cancel_iff_ne_top : a + -a = 0 \u2194 a \u2260 \u22a4 where\n mp := by contrapose; simp +contextual\nmpr h := add_neg_cancel_of_ne_top h\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)\ntheorem coe_mk (f : R \u2192\u2099* S) {h\u2081 h\u2082 h\u2083} : (AbsoluteValue.mk f h\u2081 h\u2082 h\u2083 : R \u2192 S) = f :=\nrfl\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.neg_add_cancel_left_of_ne_top (L122-L124)\nlemma neg_add_cancel_left_of_ne_top (ha : a \u2260 \u22a4) (b : \u03b1) : -a + (a + b) = b := by\nsimp [\u2190 add_assoc, neg_add_cancel_of_ne_top ha]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.isNontrivial_iff_ne_trivial (L338-L349)\nlemma isNontrivial_iff_ne_trivial [DecidablePred fun x : R \u21a6 x = 0] [NoZeroDivisors R]\n [Nontrivial S] (v : AbsoluteValue R S) :\n v.IsNontrivial \u2194 v \u2260 .trivial := by\nrefine \u27e8fun \u27e8x, hx\u2080, hx\u2081\u27e9 h \u21a6 hx\u2081 <| h.symm \u25b8 trivial_apply hx\u2080, fun H \u21a6 ?_\u27e9\n simp only [IsNontrivial]\n contrapose! H\n ext1 x\n rcases eq_or_ne x 0 with rfl | hx\n \u00b7 simp\n \u00b7 simp [H, hx]\n\nomit [IsOrderedRing S] in\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)\ninstance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where\n map_zero f := (f.eq_zero' _).2 rfl\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.add_neg_cancel_right_of_ne_top (L125-L127)\nlemma add_neg_cancel_right_of_ne_top (hb : b \u2260 \u22a4) (a : \u03b1) : a + b + -b = a := by\nsimp [add_assoc, add_neg_cancel_of_ne_top hb]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Algebra.Order.AbsoluteValue.Basic.sub_abv_le_abv_sub (L494-L504)\ntheorem sub_abv_le_abv_sub [IsOrderedRing S] (a b : R) : abv a - abv b \u2264 abv (a - b) :=\n(toAbsoluteValue abv).le_sub a b\n\nend Ring\n\nend OrderedRing\n\nsection OrderedCommRing\nvariable [CommRing S] [PartialOrder S] [IsOrderedRing S] [NoZeroDivisors S] [Ring R]\n (abv : R \u2192 S) [IsAbsoluteValue abv]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Algebra.Order.AddGroupWithTop.sub_left_inj_of_ne_top (L191-L193)\nlemma sub_left_inj_of_ne_top (h : a \u2260 \u22a4) : b - a = c - a \u2194 b = c :=\n(sub_left_injective_of_ne_top h).eq_iff\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Hom/MonoidWithZero.lean", "module": "Mathlib.Algebra.Order.Hom.MonoidWithZero", "declaration": "Mathlib.Algebra.Order.Hom.MonoidWithZero.comp", "span": "L167-L169", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Hom/MonoidWithZero.lean#L167"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 10837, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 28459, "lean_code_chars": 25189, "natural_language_chars": 3270, "lean_code_ratio": 0.8851, "line_count": 984, "imports_count": 0, "declarations_count": 2785, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "ca558defd9039d63", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Sum.Basic.elim_update_left", "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.Data.Sum.Basic)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma elim_update_left {\u03b3 : Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u03b1 \u2192 \u03b3) (g : \u03b2 \u2192 \u03b3) (a : \u03b1) (x : \u03b3) :\n Sum.elim (update f a x) g = update (Sum.elim f g) (.inl a) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Sum.Basic.not_isLeft_and_isRight (L24-L27)\nlemma not_isLeft_and_isRight {x : \u03b1 \u2295 \u03b2} : \u00ac(x.isLeft \u2227 x.isRight) := by simp\nnamespace Sum\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Sum.Basic.elim_swap (L29-L33)\ntheorem elim_swap {\u03b1 \u03b2 \u03b3 : Type*} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3} :\n Sum.elim f g \u2218 Sum.swap = Sum.elim g f := by\ngrind\n\n-- Lean has removed the `@[simp]` attribute on these. For now Mathlib adds it back.\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Sum.Basic.exists_sum (L36-L40)\ntheorem exists_sum {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Sort*} (p : (\u2200 ab, \u03b3 ab) \u2192 Prop) :\n (\u2203 fab, p fab) \u2194 (\u2203 fa fb, p (Sum.rec fa fb)) := by\nrw [\u2190 not_forall_not, forall_sum]\n simp\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Sum.Basic.inl_injective (L41-L42)\ntheorem inl_injective : Function.Injective (inl : \u03b1 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ \u21a6 inl.inj\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Sum.Basic.inr_injective (L43-L44)\ntheorem inr_injective : Function.Injective (inr : \u03b2 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ \u21a6 inr.inj\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Sum.Basic.sum_rec_congr (L45-L52)\ntheorem sum_rec_congr (P : \u03b1 \u2295 \u03b2 \u2192 Sort*) (f : \u2200 i, P (inl i)) (g : \u2200 i, P (inr i))\n {x y : \u03b1 \u2295 \u03b2} (h : x = y) :\n @Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl\nsection get\n\nvariable {x : \u03b1 \u2295 \u03b2}\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Sum.Basic.eq_left_iff_getLeft_eq (L53-L55)\ntheorem eq_left_iff_getLeft_eq {a : \u03b1} : x = inl a \u2194 \u2203 h, x.getLeft h = a := by\ncases x <;> simp\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Sum.Basic.eq_right_iff_getRight_eq (L56-L58)\ntheorem eq_right_iff_getRight_eq {b : \u03b2} : x = inr b \u2194 \u2203 h, x.getRight h = b := by\ncases x <;> simp\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Sum.Basic.getLeft_eq_getLeft (L59-L61)\ntheorem getLeft_eq_getLeft? (h\u2081 : x.isLeft) (h\u2082 : x.getLeft?.isSome) :\n x.getLeft h\u2081 = x.getLeft?.get h\u2082 := by grind\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Sum.Basic.getRight_eq_getRight (L62-L64)\ntheorem getRight_eq_getRight? (h\u2081 : x.isRight) (h\u2082 : x.getRight?.isSome) :\n x.getRight h\u2081 = x.getRight?.get h\u2082 := by grind\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Sum.Basic.update_elim_inl (L76-L79)\ntheorem update_elim_inl [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3} {i : \u03b1}\n {x : \u03b3} : update (Sum.elim f g) (inl i) x = Sum.elim (update f i x) g :=\nupdate_eq_iff.2 \u27e8by simp, by simp +contextual\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Sum.Basic.update_elim_inr (L81-L84)\ntheorem update_elim_inr [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3} {i : \u03b2}\n {x : \u03b3} : update (Sum.elim f g) (inr i) x = Sum.elim f (update g i x) :=\nupdate_eq_iff.2 \u27e8by simp, by simp +contextual\u27e9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_comp_inl (L86-L89)\ntheorem update_inl_comp_inl [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1}\n {x : \u03b3} : update f (inl i) x \u2218 inl = update (f \u2218 inl) i x :=\nupdate_comp_eq_of_injective _ inl_injective _ _\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_apply_inl (L91-L94)\ntheorem update_inl_apply_inl [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i j : \u03b1}\n {x : \u03b3} : update f (inl i) x (inl j) = update (f \u2218 inl) i x j := by\ngrind\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_comp_inr (L96-L99)\ntheorem update_inl_comp_inr [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1} {x : \u03b3} :\n update f (inl i) x \u2218 inr = f \u2218 inr :=\n(update_comp_eq_of_forall_ne _ _) fun _ \u21a6 inr_ne_inl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_apply_inr (L100-L103)\ntheorem update_inl_apply_inr [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1} {j : \u03b2} {x : \u03b3} :\n update f (inl i) x (inr j) = f (inr j) :=\nFunction.update_of_ne inr_ne_inl ..\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_comp_inl (L105-L108)\ntheorem update_inr_comp_inl [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b2} {x : \u03b3} :\n update f (inr i) x \u2218 inl = f \u2218 inl :=\n(update_comp_eq_of_forall_ne _ _) fun _ \u21a6 inl_ne_inr\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_apply_inl (L109-L112)\ntheorem update_inr_apply_inl [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1} {j : \u03b2} {x : \u03b3} :\n update f (inr j) x (inl i) = f (inl i) :=\nFunction.update_of_ne inl_ne_inr ..\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_comp_inr (L114-L117)\ntheorem update_inr_comp_inr [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b2}\n {x : \u03b3} : update f (inr i) x \u2218 inr = update (f \u2218 inr) i x :=\nupdate_comp_eq_of_injective _ inr_injective _ _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_apply_inr (L119-L122)\ntheorem update_inr_apply_inr [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i j : \u03b2}\n {x : \u03b3} : update f (inr i) x (inr j) = update (f \u2218 inr) i x j := by\nrw [\u2190 update_inr_comp_inr, Function.comp_apply]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_apply_inl' (L124-L128)\ntheorem update_inl_apply_inl' {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Type*} [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)]\n {f : (i : \u03b1 \u2295 \u03b2) \u2192 \u03b3 i} {i : \u03b1} {x : \u03b3 (.inl i)} (j : \u03b1) :\n update f (.inl i) x (Sum.inl j) = update (fun j \u21a6 f (.inl j)) i x j :=\nFunction.update_apply_of_injective f Sum.inl_injective i x j\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_apply_inr' (L130-L134)\ntheorem update_inr_apply_inr' {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Type*} [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)]\n {f : (i : \u03b1 \u2295 \u03b2) \u2192 \u03b3 i} {i : \u03b2} {x : \u03b3 (.inr i)} (j : \u03b2) :\n update f (.inr i) x (Sum.inr j) = update (fun j \u21a6 f (.inr j)) i x j :=\nFunction.update_apply_of_injective f Sum.inr_injective i x j\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Sum.Basic.rec_update_left (L136-L142)\nlemma rec_update_left {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u2200 a, \u03b3 (.inl a)) (g : \u2200 b, \u03b3 (.inr b)) (a : \u03b1) (x : \u03b3 (.inl a)) :\n Sum.rec (update f a x) g = update (Sum.rec f g) (.inl a) x :=\nFunction.rec_update Sum.inl_injective (Sum.rec \u00b7 g) (fun _ _ => rfl) (fun\n | _, _, .inl _, h => (h _ rfl).elim\n | _, _, .inr _, _ => rfl) _ _ _\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Sum.Basic.rec_update_right (L144-L150)\nlemma rec_update_right {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u2200 a, \u03b3 (.inl a)) (g : \u2200 b, \u03b3 (.inr b)) (b : \u03b2) (x : \u03b3 (.inr b)) :\n Sum.rec f (update g b x) = update (Sum.rec f g) (.inr b) x :=\nFunction.rec_update Sum.inr_injective (Sum.rec f) (fun _ _ => rfl) (fun\n | _, _, .inr _, h => (h _ rfl).elim\n | _, _, .inl _, _ => rfl) _ _ _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Sum.Basic.elim_update_right (L158-L162)\nlemma elim_update_right {\u03b3 : Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u03b1 \u2192 \u03b3) (g : \u03b2 \u2192 \u03b3) (b : \u03b2) (x : \u03b3) :\n Sum.elim f (update g b x) = update (Sum.elim f g) (.inr b) x :=\nrec_update_right _ _ _ _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Sum.Order.swap_lt_swap_iff (L263-L278)\ntheorem swap_lt_swap_iff [LT \u03b1] [LT \u03b2] {a b : \u03b1 \u2295 \u03b2} : a.swap < b.swap \u2194 a < b :=\nliftRel_swap_iff\n\nend Disjoint\n\n/-! ### Linear sum of two orders -/\n\n\nnamespace Lex\n\n\n/-- The linear sum of two orders -/\nnotation:30 \u03b1 \" \u2295\u2097 \" \u03b2:29 => _root_.Lex (\u03b1 \u2295 \u03b2)\n\n--TODO: Can we make `inl\u2097`, `inr\u2097` `local notation`?\n/-- Lexicographical `Sum.inl`. Only used for pattern matching. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Sum.Lattice.inrLatticeHom (L103-L109)\ndef inrLatticeHom : LatticeHom \u03b2 (\u03b1 \u2295\u2097 \u03b2) where\n toFun := inr\u2097\nmap_sup' _ _ := rfl\n map_inf' _ _ := rfl\n\nend Lattice\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Sum.Interval.Iic_inl (L298-L298)\ntheorem Iic_inl : Iic (inl a : \u03b1 \u2295 \u03b2) = (Iic a).map Embedding.inl := rfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Sum.Order.not_inr_le_inl (L149-L151)\ntheorem not_inr_le_inl [LE \u03b1] [LE \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinr b \u2264 inl a :=\nnot_liftRel_inr_inl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Sum.Order.inl_strictMono (L177-L178)\ntheorem inl_strictMono : StrictMono (inl : \u03b1 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLT (L337-L342)\ndef toLexRelIsoLT [LT \u03b1] [LT \u03b2] :\n Sum.Lex (\u00b7 < \u00b7 : \u03b1 \u2192 \u03b1 \u2192 Prop) (\u00b7 < \u00b7 : \u03b2 \u2192 \u03b2 \u2192 Prop) \u2243r (\u00b7 < \u00b7 : \u03b1 \u2295\u2097 \u03b2 \u2192 _ \u2192 _) where\n toFun := toLex\ninvFun := ofLex\n map_rel_iff' := .rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Sum.Interval.Ici_inl (L316-L316)\ntheorem Ici_inl : Ici (inl a : \u03b1 \u2295 \u03b2) = (Ici a).map Embedding.inl := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Sum.Interval.sumLift\u2082_nonempty (L88-L93)\ntheorem sumLift\u2082_nonempty :\n (sumLift\u2082 f g a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f a\u2081 b\u2081).Nonempty) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (g a\u2082 b\u2082).Nonempty := by\nsimp only [nonempty_iff_ne_empty, Ne, sumLift\u2082_eq_empty, not_and_or, not_forall, exists_prop]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Sum.Interval.Ioi_inl (L318-L318)\ntheorem Ioi_inl : Ioi (inl a : \u03b1 \u2295 \u03b2) = (Ioi a).map Embedding.inl := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Sum.Order.noMaxOrder_iff (L221-L232)\ntheorem noMaxOrder_iff [LT \u03b1] [LT \u03b2] : NoMaxOrder (\u03b1 \u2295 \u03b2) \u2194 NoMaxOrder \u03b1 \u2227 NoMaxOrder \u03b2 :=\n\u27e8fun _ =>\n \u27e8\u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_gt (inl a : \u03b1 \u2295 \u03b2)\n \u00b7 exact \u27e8b, inl_lt_inl_iff.1 h\u27e9\n \u00b7 exact (not_inl_lt_inr h).elim\u27e9,\n \u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_gt (inr a : \u03b1 \u2295 \u03b2)\n \u00b7 exact (not_inr_lt_inl h).elim\n \u00b7 exact \u27e8b, inr_lt_inr_iff.1 h\u27e9\u27e9\u27e9,\n fun h => @Sum.noMaxOrder _ _ _ _ h.1 h.2\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Sum.Order.not_inl_lt_inr (L145-L147)\ntheorem not_inl_lt_inr [LT \u03b1] [LT \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinl b < inr a :=\nnot_liftRel_inl_inr\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Sum.Interval.Iio_inl (L300-L300)\ntheorem Iio_inl : Iio (inl a : \u03b1 \u2295 \u03b2) = (Iio a).map Embedding.inl := rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Sum.Order.inl_le_inr (L324-L326)\ntheorem inl_le_inr [LE \u03b1] [LE \u03b2] (a : \u03b1) (b : \u03b2) : toLex (inl a) \u2264 toLex (inr b) :=\nLex.sep _ _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Sum.Order.le_def (L118-L120)\ntheorem le_def [LE \u03b1] [LE \u03b2] {a b : \u03b1 \u2295 \u03b2} : a \u2264 b \u2194 LiftRel (\u00b7 \u2264 \u00b7) (\u00b7 \u2264 \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Sum.Interval.Ici_inr (L317-L317)\ntheorem Ici_inr : Ici (inr b : \u03b1 \u2295 \u03b2) = (Ici b).map Embedding.inr := rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Data.Sum.Interval.inr_mem_sumLift\u2082 (L67-L73)\ntheorem inr_mem_sumLift\u2082 {c\u2082 : \u03b3\u2082} :\n inr c\u2082 \u2208 sumLift\u2082 f g a b \u2194 \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c\u2082 \u2208 g a\u2082 b\u2082 := by\nrw [mem_sumLift\u2082, or_iff_right]\n \u00b7 simp only [inr.injEq, exists_and_left, exists_eq_left']\n rintro \u27e8_, _, c\u2082, _, _, h, _\u27e9\n exact inr_ne_inl h\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Data.Sum.Order.inr_le_inr_iff (L129-L131)\ntheorem inr_le_inr_iff [LE \u03b1] [LE \u03b2] {a b : \u03b2} : (inr a : \u03b1 \u2295 \u03b2) \u2264 inr b \u2194 a \u2264 b :=\nliftRel_inr_inr\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Data.Sum.Order.not_inr_lt_inl (L153-L159)\ntheorem not_inr_lt_inl [LT \u03b1] [LT \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinr b < inl a :=\nnot_liftRel_inr_inl\n\nsection Preorder\n\nvariable [Preorder \u03b1] [Preorder \u03b2]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Data.Sum.Order.inl_mono (L173-L174)\ntheorem inl_mono : Monotone (inl : \u03b1 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inl\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inr_inl (L270-L272)\ntheorem Ioo_inr_inl : Ioo (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Data.Sum.Order.noMinOrder_iff (L208-L219)\ntheorem noMinOrder_iff [LT \u03b1] [LT \u03b2] : NoMinOrder (\u03b1 \u2295 \u03b2) \u2194 NoMinOrder \u03b1 \u2227 NoMinOrder \u03b2 :=\n\u27e8fun _ =>\n \u27e8\u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_lt (inl a : \u03b1 \u2295 \u03b2)\n \u00b7 exact \u27e8b, inl_lt_inl_iff.1 h\u27e9\n \u00b7 exact (not_inr_lt_inl h).elim\u27e9,\n \u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_lt (inr a : \u03b1 \u2295 \u03b2)\n \u00b7 exact (not_inl_lt_inr h).elim\n \u00b7 exact \u27e8b, inr_lt_inr_iff.1 h\u27e9\u27e9\u27e9,\n fun h => @Sum.noMinOrder _ _ _ _ h.1 h.2\u27e9\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Data.Sum.Order.inr_lt_inr_iff (L137-L139)\ntheorem inr_lt_inr_iff [LT \u03b1] [LT \u03b2] {a b : \u03b2} : (inr a : \u03b1 \u2295 \u03b2) < inr b \u2194 a < b :=\nliftRel_inr_inr\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Data.Sum.Interval.inl_mem_sumLexLift (L160-L165)\nlemma inl_mem_sumLexLift {c\u2081 : \u03b3\u2081} :\n inl c\u2081 \u2208 sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c\u2081 \u2208 f\u2081 a\u2081 b\u2081) \u2228\n \u2203 a\u2081 b\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c\u2081 \u2208 g\u2081 a\u2081 b\u2082 := by\nsimp [mem_sumLexLift]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Data.Sum.Interval.mem_sumLift\u2082 (L44-L59)\ntheorem mem_sumLift\u2082 :\n c \u2208 sumLift\u2082 f g a b \u2194\n (\u2203 a\u2081 b\u2081 c\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c = inl c\u2081 \u2227 c\u2081 \u2208 f a\u2081 b\u2081) \u2228\n \u2203 a\u2082 b\u2082 c\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c = inr c\u2082 \u2227 c\u2082 \u2208 g a\u2082 b\u2082 := by\nconstructor\n \u00b7 rcases a with a | a <;> rcases b with b | b\n \u00b7 rw [sumLift\u2082, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9\n \u00b7 refine fun h \u21a6 (notMem_empty _ h).elim\n \u00b7 refine fun h \u21a6 (notMem_empty _ h).elim\n \u00b7 rw [sumLift\u2082, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9\n \u00b7 rintro (\u27e8a, b, c, rfl, rfl, rfl, h\u27e9 | \u27e8a, b, c, rfl, rfl, rfl, h\u27e9) <;> exact mem_map_of_mem _ h\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Data.Sum.Order.inl_lt_inl_iff (L133-L135)\ntheorem inl_lt_inl_iff [LT \u03b1] [LT \u03b2] {a b : \u03b1} : (inl a : \u03b1 \u2295 \u03b2) < inl b \u2194 a < b :=\nliftRel_inl_inl\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inr_inl (L258-L260)\ntheorem Icc_inr_inl : Icc (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLE (L352-L357)\ndef toLexRelIsoLE [LE \u03b1] [LE \u03b2] :\n Sum.Lex (\u00b7 \u2264 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 Prop) (\u00b7 \u2264 \u00b7 : \u03b2 \u2192 \u03b2 \u2192 Prop) \u2243r (\u00b7 \u2264 \u00b7 : \u03b1 \u2295\u2097 \u03b2 \u2192 _ \u2192 _) where\n toFun := toLex\ninvFun := ofLex\n map_rel_iff' := .rfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Data.Sum.Interval.sumLift\u2082_eq_empty (L74-L87)\ntheorem sumLift\u2082_eq_empty :\n sumLift\u2082 f g a b = \u2205 \u2194\n (\u2200 a\u2081 b\u2081, a = inl a\u2081 \u2192 b = inl b\u2081 \u2192 f a\u2081 b\u2081 = \u2205) \u2227\n \u2200 a\u2082 b\u2082, a = inr a\u2082 \u2192 b = inr b\u2082 \u2192 g a\u2082 b\u2082 = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 constructor <;>\n \u00b7 rintro a b rfl rfl\n exact map_eq_empty.1 h\n cases a <;> cases b\n \u00b7 exact map_eq_empty.2 (h.1 _ _ rfl rfl)\n \u00b7 rfl\n \u00b7 rfl\n \u00b7 exact map_eq_empty.2 (h.2 _ _ rfl rfl)\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inr_inl (L125-L126)\nlemma sumLexLift_inr_inl (a : \u03b1\u2082) (b : \u03b2\u2081) : sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inr a) (inl b) = \u2205 := rfl\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inr_inr (L276-L278)\ntheorem Ico_inr_inr : Ico (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Ico b\u2081 b\u2082).map Embedding.inr :=\nrfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inr_inl (L266-L268)\ntheorem Ioc_inr_inl : Ioc (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Data.Sum.Order.noMinOrder (L187-L196)\ninstance noMinOrder [LT \u03b1] [LT \u03b2] [NoMinOrder \u03b1] [NoMinOrder \u03b2] : NoMinOrder (\u03b1 \u2295 \u03b2) :=\n\u27e8fun a =>\n match a with\n | inl a =>\n let \u27e8b, h\u27e9 := exists_lt a\n \u27e8inl b, inl_lt_inl_iff.2 h\u27e9\n | inr a =>\n let \u27e8b, h\u27e9 := exists_lt a\n \u27e8inr b, inr_lt_inr_iff.2 h\u27e9\u27e9\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Data.Sum.Order.denselyOrdered_iff (L245-L257)\ntheorem denselyOrdered_iff [LT \u03b1] [LT \u03b2] :\n DenselyOrdered (\u03b1 \u2295 \u03b2) \u2194 DenselyOrdered \u03b1 \u2227 DenselyOrdered \u03b2 :=\n\u27e8fun _ =>\n \u27e8\u27e8fun a b h => by\n obtain \u27e8c | c, ha, hb\u27e9 := @exists_between (\u03b1 \u2295 \u03b2) _ _ _ _ (inl_lt_inl_iff.2 h)\n \u00b7 exact \u27e8c, inl_lt_inl_iff.1 ha, inl_lt_inl_iff.1 hb\u27e9\n \u00b7 exact (not_inl_lt_inr ha).elim\u27e9,\n \u27e8fun a b h => by\n obtain \u27e8c | c, ha, hb\u27e9 := @exists_between (\u03b1 \u2295 \u03b2) _ _ _ _ (inr_lt_inr_iff.2 h)\n \u00b7 exact (not_inl_lt_inr hb).elim\n \u00b7 exact \u27e8c, inr_lt_inr_iff.1 ha, inr_lt_inr_iff.1 hb\u27e9\u27e9\u27e9,\n fun h => @Sum.denselyOrdered _ _ _ _ h.1 h.2\u27e9\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_nonempty (L193-L216)\nlemma sumLexLift_nonempty :\n (sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f\u2081 a\u2081 b\u2081).Nonempty) \u2228\n (\u2203 a\u2081 b\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 ((g\u2081 a\u2081 b\u2082).Nonempty \u2228 (g\u2082 a\u2081 b\u2082).Nonempty)) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (f\u2082 a\u2082 b\u2082).Nonempty := by\nsimp only [nonempty_iff_ne_empty, Ne, sumLexLift_eq_empty, not_and_or, exists_prop, not_forall]\n\nend SumLexLift\nend Finset\n\nopen Finset\n\nnamespace Sum\n\nvariable {\u03b1 \u03b2 : Type*}\n\n/-! ### Disjoint sum of orders -/\n\n\nsection Disjoint\n\nsection LocallyFiniteOrder\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrder \u03b1] [LocallyFiniteOrder \u03b2]\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Data.Sum.Order.inl_lt_inr (L327-L329)\ntheorem inl_lt_inr [LT \u03b1] [LT \u03b2] (a : \u03b1) (b : \u03b2) : toLex (inl a) < toLex (inr b) :=\nLex.sep _ _\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Data.Sum.Order.instPreorderSum (L160-L172)\ninstance instPreorderSum : Preorder (\u03b1 \u2295 \u03b2) :=\n{ instLESum, instLTSum with\n le_refl := fun _ => LiftRel.refl _ _ _,\n le_trans := fun _ _ _ => LiftRel.trans _ _,\n lt_iff_le_not_ge := fun a b => by\n refine \u27e8fun hab => \u27e8hab.mono (fun _ _ => le_of_lt) fun _ _ => le_of_lt, ?_\u27e9, ?_\u27e9\n \u00b7 rintro (\u27e8hba\u27e9 | \u27e8hba\u27e9)\n \u00b7 exact hba.not_gt (inl_lt_inl_iff.1 hab)\n \u00b7 exact hba.not_gt (inr_lt_inr_iff.1 hab)\n \u00b7 rintro \u27e8\u27e8hab\u27e9 | \u27e8hab\u27e9, hba\u27e9\n \u00b7 exact LiftRel.inl (hab.lt_of_not_ge fun h => hba <| LiftRel.inl h)\n \u00b7 exact LiftRel.inr (hab.lt_of_not_ge fun h => hba <| LiftRel.inr h) }\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inl_inr (L250-L252)\ntheorem Ioc_inl_inr : Ioc (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inl_inl (L229-L231)\ntheorem Icc_inl_inl : Icc (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Icc a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Data.Sum.Lattice.instDistribLattice (L110-L117)\ninstance instDistribLattice [DistribLattice \u03b1] [DistribLattice \u03b2] : DistribLattice (\u03b1 \u2295\u2097 \u03b2) where\n le_sup_inf := by\nsimp only [Lex.forall, Sum.forall, inr_le_inr_iff,\n le_sup_left, inl_le_inr, sup_of_le_right, and_self,\n inf_of_le_left, implies_true, inf_of_le_right, sup_of_le_left, \u2190 inl_sup,\n \u2190 inr_sup, \u2190 inl_inf, \u2190 inr_inf, sup_inf_left, le_rfl]\n\nend Sum.Lex\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inr_inl (L262-L264)\ntheorem Ico_inr_inl : Ico (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Data.Sum.Order.toLex_le_toLex (L297-L300)\ntheorem toLex_le_toLex [LE \u03b1] [LE \u03b2] {a b : \u03b1 \u2295 \u03b2} :\n toLex a \u2264 toLex b \u2194 Lex (\u00b7 \u2264 \u00b7) (\u00b7 \u2264 \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inl_inr (L121-L123)\nlemma sumLexLift_inl_inr (a : \u03b1\u2081) (b : \u03b2\u2082) :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inl a) (inr b) = (g\u2081 a b).disjSum (g\u2082 a b) := rfl\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inl_inr (L242-L244)\ntheorem Icc_inl_inr : Icc (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Data.Sum.Interval.instLocallyFiniteOrderTop (L442-L453)\ninstance instLocallyFiniteOrderTop : LocallyFiniteOrderTop (\u03b1 \u2295\u2097 \u03b2) where\n finsetIci := Sum.elim\n(fun x => (Ici x).disjSum Finset.univ |>.map toLex.toEmbedding)\n (Ici \u00b7 |>.map (.trans .inr toLex.toEmbedding)) \u2218 ofLex\n finsetIoi := Sum.elim\n (fun x => (Ioi x).disjSum Finset.univ |>.map toLex.toEmbedding)\n (Ioi \u00b7 |>.map (.trans .inr toLex.toEmbedding)) \u2218 ofLex\n finset_mem_Ici := by simp\n finset_mem_Ioi := by simp\n\nvariable (a : \u03b1) (b : \u03b2)\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inr_inr (L128-L132)\nlemma sumLexLift_inr_inr (a : \u03b1\u2082) (b : \u03b2\u2082) :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inr a) (inr b) = (f\u2082 a b).map \u27e8_, inr_injective\u27e9 := rfl\nvariable {f\u2081 g\u2081 f\u2082 g\u2082 f\u2081' g\u2081' f\u2082' g\u2082'} {a : \u03b1\u2081 \u2295 \u03b1\u2082} {b : \u03b2\u2081 \u2295 \u03b2\u2082} {c : \u03b3\u2081 \u2295 \u03b3\u2082}\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inr_inr (L273-L275)\ntheorem Icc_inr_inr : Icc (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Icc b\u2081 b\u2082).map Embedding.inr :=\nrfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inr_inr (L279-L281)\ntheorem Ioc_inr_inr : Ioc (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Ioc b\u2081 b\u2082).map Embedding.inr :=\nrfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Data.Sum.Order.lt_def (L121-L123)\ntheorem lt_def [LT \u03b1] [LT \u03b2] {a b : \u03b1 \u2295 \u03b2} : a < b \u2194 LiftRel (\u00b7 < \u00b7) (\u00b7 < \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inr_inr (L282-L289)\ntheorem Ioo_inr_inr : Ioo (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Ioo b\u2081 b\u2082).map Embedding.inr :=\nrfl\n\nend LocallyFiniteOrder\n\nsection LocallyFiniteOrderBot\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrderBot \u03b1] [LocallyFiniteOrderBot \u03b2]\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inl_inl (L117-L119)\nlemma sumLexLift_inl_inl (a : \u03b1\u2081) (b : \u03b2\u2081) :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inl a) (inl b) = (f\u2081 a b).map Embedding.inl := rfl\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Data.Sum.Interval.mem_sumLexLift (L133-L159)\nlemma mem_sumLexLift :\n c \u2208 sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2194\n (\u2203 a\u2081 b\u2081 c\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c = inl c\u2081 \u2227 c\u2081 \u2208 f\u2081 a\u2081 b\u2081) \u2228\n (\u2203 a\u2081 b\u2082 c\u2081, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c = inl c\u2081 \u2227 c\u2081 \u2208 g\u2081 a\u2081 b\u2082) \u2228\n (\u2203 a\u2081 b\u2082 c\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c = inr c\u2082 \u2227 c\u2082 \u2208 g\u2082 a\u2081 b\u2082) \u2228\n \u2203 a\u2082 b\u2082 c\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c = inr c\u2082 \u2227 c\u2082 \u2208 f\u2082 a\u2082 b\u2082 := by\nconstructor\n \u00b7 obtain a | a := a <;> obtain b | b := b\n \u00b7 rw [sumLexLift, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9\n \u00b7 refine fun h \u21a6 (mem_disjSum.1 h).elim ?_ ?_\n \u00b7 rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr (Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr (Or.inr <| Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 exact fun h \u21a6 (notMem_empty _ h).elim\n \u00b7 rw [sumLexLift, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr (Or.inr <| Or.inr <| \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 rintro (\u27e8a, b, c, rfl, rfl, rfl, hc\u27e9 | \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9 |\n \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9 | \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 exact mem_map_of_mem _ hc\n \u00b7 exact inl_mem_disjSum.2 hc\n \u00b7 exact inr_mem_disjSum.2 hc\n \u00b7 exact mem_map_of_mem _ hc\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Data.Sum.Order.noMaxOrder (L197-L206)\ninstance noMaxOrder [LT \u03b1] [LT \u03b2] [NoMaxOrder \u03b1] [NoMaxOrder \u03b2] : NoMaxOrder (\u03b1 \u2295 \u03b2) :=\n\u27e8fun a =>\n match a with\n | inl a =>\n let \u27e8b, h\u27e9 := exists_gt a\n \u27e8inl b, inl_lt_inl_iff.2 h\u27e9\n | inr a =>\n let \u27e8b, h\u27e9 := exists_gt a\n \u27e8inr b, inr_lt_inr_iff.2 h\u27e9\u27e9\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Data.Sum.Order.denselyOrdered (L233-L243)\ninstance denselyOrdered [LT \u03b1] [LT \u03b2] [DenselyOrdered \u03b1] [DenselyOrdered \u03b2] :\n DenselyOrdered (\u03b1 \u2295 \u03b2) :=\n\u27e8fun a b h =>\n match a, b, h with\n | inl _, inl _, LiftRel.inl h =>\n let \u27e8c, ha, hb\u27e9 := exists_between h\n \u27e8toLex (inl c), LiftRel.inl ha, LiftRel.inl hb\u27e9\n | inr _, inr _, LiftRel.inr h =>\n let \u27e8c, ha, hb\u27e9 := exists_between h\n \u27e8toLex (inr c), LiftRel.inr ha, LiftRel.inr hb\u27e9\u27e9\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Data.Sum.Interval.Ioi_inr (L319-L332)\ntheorem Ioi_inr : Ioi (inr b : \u03b1 \u2295 \u03b2) = (Ioi b).map Embedding.inr := rfl\nend LocallyFiniteOrderTop\n\nend Disjoint\n\n/-! ### Lexicographical sum of orders -/\n\nnamespace Lex\n\nsection LocallyFiniteOrder\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrder \u03b1] [LocallyFiniteOrder \u03b2]\nvariable [LocallyFiniteOrderTop \u03b1] [LocallyFiniteOrderBot \u03b2]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Data.Sum.Order.inl_le_inl_iff (L125-L127)\ntheorem inl_le_inl_iff [LE \u03b1] [LE \u03b2] {a b : \u03b1} : (inl a : \u03b1 \u2295 \u03b2) \u2264 inl b \u2194 a \u2264 b :=\nliftRel_inl_inl\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Data.Sum.Order.instLTSum (L115-L117)\ninstance instLTSum [LT \u03b1] [LT \u03b2] : LT (\u03b1 \u2295 \u03b2) :=\n\u27e8LiftRel (\u00b7 < \u00b7) (\u00b7 < \u00b7)\u27e9\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inl_inr (L254-L256)\ntheorem Ioo_inl_inr : Ioo (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Data.Sum.Order.inr_strictMono (L179-L182)\ntheorem inr_strictMono : StrictMono (inr : \u03b2 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inr\nend Preorder\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Data.Sum.Interval.inl_mem_sumLift\u2082 (L60-L66)\ntheorem inl_mem_sumLift\u2082 {c\u2081 : \u03b3\u2081} :\n inl c\u2081 \u2208 sumLift\u2082 f g a b \u2194 \u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c\u2081 \u2208 f a\u2081 b\u2081 := by\nrw [mem_sumLift\u2082, or_iff_left]\n \u00b7 simp only [inl.injEq, exists_and_left, exists_eq_left']\n rintro \u27e8_, _, c\u2082, _, _, h, _\u27e9\n exact inl_ne_inr h\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Data.Sum.Order.swap_le_swap_iff (L259-L261)\ntheorem swap_le_swap_iff [LE \u03b1] [LE \u03b2] {a b : \u03b1 \u2295 \u03b2} : a.swap \u2264 b.swap \u2194 a \u2264 b :=\nliftRel_swap_iff\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Data.Sum.Interval.instLocallyFiniteOrder (L217-L228)\ninstance instLocallyFiniteOrder : LocallyFiniteOrder (\u03b1 \u2295 \u03b2) where\n finsetIcc := sumLift\u2082 Icc Icc\nfinsetIco := sumLift\u2082 Ico Ico\n finsetIoc := sumLift\u2082 Ioc Ioc\n finsetIoo := sumLift\u2082 Ioo Ioo\n finset_mem_Icc := by simp\n finset_mem_Ico := by simp\n finset_mem_Ioc := by simp\n finset_mem_Ioo := by simp\n\nvariable (a\u2081 a\u2082 : \u03b1) (b\u2081 b\u2082 : \u03b2)\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLT_coe (L344-L346)\ntheorem toLexRelIsoLT_coe [LT \u03b1] [LT \u03b2] : \u21d1(toLexRelIsoLT (\u03b1 := \u03b1) (\u03b2 := \u03b2)) = toLex :=\nrfl\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Data.Sum.Interval.Iic_inr (L299-L299)\ntheorem Iic_inr : Iic (inr b : \u03b1 \u2295 \u03b2) = (Iic b).map Embedding.inr := rfl\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Data.Sum.Lattice.instLattice (L94-L96)\ninstance instLattice : Lattice (\u03b1 \u2295\u2097 \u03b2) := { instSemilatticeSup, instSemilatticeInf with }\n/-- `Sum.Lex.inl\u2097` as a lattice homomorphism. -/\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inl_inl (L232-L234)\ntheorem Ico_inl_inl : Ico (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Ico a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Data.Sum.Interval.locallyFiniteOrder (L333-L348)\ninstance locallyFiniteOrder : LocallyFiniteOrder (\u03b1 \u2295\u2097 \u03b2) where\n finsetIcc a b :=\n(sumLexLift Icc Icc (fun a _ => Ici a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finsetIco a b :=\n (sumLexLift Ico Ico (fun a _ => Ici a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finsetIoc a b :=\n (sumLexLift Ioc Ioc (fun a _ => Ioi a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finsetIoo a b :=\n (sumLexLift Ioo Ioo (fun a _ => Ioi a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finset_mem_Icc := by simp\n finset_mem_Ico := by simp\n finset_mem_Ioc := by simp\n finset_mem_Ioo := by simp\n\nvariable (a a\u2081 a\u2082 : \u03b1) (b b\u2081 b\u2082 : \u03b2)\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Data.Sum.Order.instLESum (L112-L114)\ninstance instLESum [LE \u03b1] [LE \u03b2] : LE (\u03b1 \u2295 \u03b2) :=\n\u27e8LiftRel (\u00b7 \u2264 \u00b7) (\u00b7 \u2264 \u00b7)\u27e9\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Data.Sum.Interval.instLocallyFiniteOrderBot (L410-L421)\ninstance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (\u03b1 \u2295\u2097 \u03b2) where\n finsetIic := Sum.elim\n(Iic \u00b7 |>.map (.trans .inl toLex.toEmbedding))\n (fun x => Finset.univ.disjSum (Iic x) |>.map toLex.toEmbedding) \u2218 ofLex\n finsetIio := Sum.elim\n (Iio \u00b7 |>.map (.trans .inl toLex.toEmbedding))\n (fun x => Finset.univ.disjSum (Iio x) |>.map toLex.toEmbedding) \u2218 ofLex\n finset_mem_Iic := by simp\n finset_mem_Iio := by simp\n\nvariable (a : \u03b1) (b : \u03b2)\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_eq_empty (L179-L192)\nlemma sumLexLift_eq_empty :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b = \u2205 \u2194\n (\u2200 a\u2081 b\u2081, a = inl a\u2081 \u2192 b = inl b\u2081 \u2192 f\u2081 a\u2081 b\u2081 = \u2205) \u2227\n (\u2200 a\u2081 b\u2082, a = inl a\u2081 \u2192 b = inr b\u2082 \u2192 g\u2081 a\u2081 b\u2082 = \u2205 \u2227 g\u2082 a\u2081 b\u2082 = \u2205) \u2227\n \u2200 a\u2082 b\u2082, a = inr a\u2082 \u2192 b = inr b\u2082 \u2192 f\u2082 a\u2082 b\u2082 = \u2205 := by\nrefine \u27e8fun h \u21a6 \u27e8?_, ?_, ?_\u27e9, fun h \u21a6 ?_\u27e9\n any_goals rintro a b rfl rfl; exact map_eq_empty.1 h\n \u00b7 rintro a b rfl rfl; exact disjSum_eq_empty.1 h\n cases a <;> cases b\n \u00b7 exact map_eq_empty.2 (h.1 _ _ rfl rfl)\n \u00b7 simp [h.2.1 _ _ rfl rfl]\n \u00b7 rfl\n \u00b7 exact map_eq_empty.2 (h.2.2 _ _ rfl rfl)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inl_inl (L235-L237)\ntheorem Ioc_inl_inl : Ioc (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Ioc a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Data.Sum.Interval.inr_mem_sumLexLift (L166-L171)\nlemma inr_mem_sumLexLift {c\u2082 : \u03b3\u2082} :\n inr c\u2082 \u2208 sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2194\n (\u2203 a\u2081 b\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c\u2082 \u2208 g\u2082 a\u2081 b\u2082) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c\u2082 \u2208 f\u2082 a\u2082 b\u2082 := by\nsimp [mem_sumLexLift]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inl_inl (L238-L240)\ntheorem Ioo_inl_inl : Ioo (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Ioo a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Data.Sum.Interval.Iio_inr (L301-L307)\ntheorem Iio_inr : Iio (inr b : \u03b1 \u2295 \u03b2) = (Iio b).map Embedding.inr := rfl\nend LocallyFiniteOrderBot\n\nsection LocallyFiniteOrderTop\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrderTop \u03b1] [LocallyFiniteOrderTop \u03b2]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_mono (L172-L178)\nlemma sumLexLift_mono (hf\u2081 : \u2200 a b, f\u2081 a b \u2286 f\u2081' a b) (hf\u2082 : \u2200 a b, f\u2082 a b \u2286 f\u2082' a b)\n (hg\u2081 : \u2200 a b, g\u2081 a b \u2286 g\u2081' a b) (hg\u2082 : \u2200 a b, g\u2082 a b \u2286 g\u2082' a b) (a : \u03b1\u2081 \u2295 \u03b1\u2082)\n (b : \u03b2\u2081 \u2295 \u03b2\u2082) : sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2286 sumLexLift f\u2081' f\u2082' g\u2081' g\u2082' a b := by\ncases a <;> cases b\n exacts [map_subset_map.2 (hf\u2081 _ _), disjSum_mono (hg\u2081 _ _) (hg\u2082 _ _), Subset.rfl,\n map_subset_map.2 (hf\u2082 _ _)]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Data.Sum.Order.toLex_lt_toLex (L302-L305)\ntheorem toLex_lt_toLex [LT \u03b1] [LT \u03b2] {a b : \u03b1 \u2295 \u03b2} :\n toLex a < toLex b \u2194 Lex (\u00b7 < \u00b7) (\u00b7 < \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Data.Sum.Order.not_inl_le_inr (L141-L143)\ntheorem not_inl_le_inr [LE \u03b1] [LE \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinl b \u2264 inr a :=\nnot_liftRel_inl_inr\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLT_symm_coe (L348-L351)\ntheorem toLexRelIsoLT_symm_coe [LT \u03b1] [LT \u03b2] : \u21d1(toLexRelIsoLT (\u03b1 := \u03b1) (\u03b2 := \u03b2)).symm = ofLex :=\nrfl\n\n/-- `toLex` promoted to a `RelIso` between `\u2264` relations. -/\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Data.Sum.Lattice.inlLatticeHom (L97-L102)\ndef inlLatticeHom : LatticeHom \u03b1 (\u03b1 \u2295\u2097 \u03b2) where\n toFun := inl\u2097\nmap_sup' _ _ := rfl\n map_inf' _ _ := rfl\n\n/-- `Sum.Lex.inr\u2097` as a lattice homomorphism. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inl_inr (L246-L248)\ntheorem Ico_inl_inr : Ico (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Data.Sum.Order.inr_mono (L175-L176)\ntheorem inr_mono : Monotone (inr : \u03b2 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inr\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.Data.Sum.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma elim_update_left {\u03b3 : Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u03b1 \u2192 \u03b3) (g : \u03b2 \u2192 \u03b3) (a : \u03b1) (x : \u03b3) :\n Sum.elim (update f a x) g = update (Sum.elim f g) (.inl a) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Sum.Basic.not_isLeft_and_isRight (L24-L27)\nlemma not_isLeft_and_isRight {x : \u03b1 \u2295 \u03b2} : \u00ac(x.isLeft \u2227 x.isRight) := by simp\nnamespace Sum\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Sum.Basic.elim_swap (L29-L33)\ntheorem elim_swap {\u03b1 \u03b2 \u03b3 : Type*} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3} :\n Sum.elim f g \u2218 Sum.swap = Sum.elim g f := by\ngrind\n\n-- Lean has removed the `@[simp]` attribute on these. For now Mathlib adds it back.\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Sum.Basic.exists_sum (L36-L40)\ntheorem exists_sum {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Sort*} (p : (\u2200 ab, \u03b3 ab) \u2192 Prop) :\n (\u2203 fab, p fab) \u2194 (\u2203 fa fb, p (Sum.rec fa fb)) := by\nrw [\u2190 not_forall_not, forall_sum]\n simp\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Sum.Basic.inl_injective (L41-L42)\ntheorem inl_injective : Function.Injective (inl : \u03b1 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ \u21a6 inl.inj\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Sum.Basic.inr_injective (L43-L44)\ntheorem inr_injective : Function.Injective (inr : \u03b2 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ \u21a6 inr.inj\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Sum.Basic.sum_rec_congr (L45-L52)\ntheorem sum_rec_congr (P : \u03b1 \u2295 \u03b2 \u2192 Sort*) (f : \u2200 i, P (inl i)) (g : \u2200 i, P (inr i))\n {x y : \u03b1 \u2295 \u03b2} (h : x = y) :\n @Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl\nsection get\n\nvariable {x : \u03b1 \u2295 \u03b2}\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Sum.Basic.eq_left_iff_getLeft_eq (L53-L55)\ntheorem eq_left_iff_getLeft_eq {a : \u03b1} : x = inl a \u2194 \u2203 h, x.getLeft h = a := by\ncases x <;> simp\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Sum.Basic.eq_right_iff_getRight_eq (L56-L58)\ntheorem eq_right_iff_getRight_eq {b : \u03b2} : x = inr b \u2194 \u2203 h, x.getRight h = b := by\ncases x <;> simp\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Sum.Basic.getLeft_eq_getLeft (L59-L61)\ntheorem getLeft_eq_getLeft? (h\u2081 : x.isLeft) (h\u2082 : x.getLeft?.isSome) :\n x.getLeft h\u2081 = x.getLeft?.get h\u2082 := by grind\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Sum.Basic.getRight_eq_getRight (L62-L64)\ntheorem getRight_eq_getRight? (h\u2081 : x.isRight) (h\u2082 : x.getRight?.isSome) :\n x.getRight h\u2081 = x.getRight?.get h\u2082 := by grind\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Sum.Basic.update_elim_inl (L76-L79)\ntheorem update_elim_inl [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3} {i : \u03b1}\n {x : \u03b3} : update (Sum.elim f g) (inl i) x = Sum.elim (update f i x) g :=\nupdate_eq_iff.2 \u27e8by simp, by simp +contextual\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Sum.Basic.update_elim_inr (L81-L84)\ntheorem update_elim_inr [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3} {i : \u03b2}\n {x : \u03b3} : update (Sum.elim f g) (inr i) x = Sum.elim f (update g i x) :=\nupdate_eq_iff.2 \u27e8by simp, by simp +contextual\u27e9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_comp_inl (L86-L89)\ntheorem update_inl_comp_inl [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1}\n {x : \u03b3} : update f (inl i) x \u2218 inl = update (f \u2218 inl) i x :=\nupdate_comp_eq_of_injective _ inl_injective _ _\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_apply_inl (L91-L94)\ntheorem update_inl_apply_inl [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i j : \u03b1}\n {x : \u03b3} : update f (inl i) x (inl j) = update (f \u2218 inl) i x j := by\ngrind\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_comp_inr (L96-L99)\ntheorem update_inl_comp_inr [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1} {x : \u03b3} :\n update f (inl i) x \u2218 inr = f \u2218 inr :=\n(update_comp_eq_of_forall_ne _ _) fun _ \u21a6 inr_ne_inl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_apply_inr (L100-L103)\ntheorem update_inl_apply_inr [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1} {j : \u03b2} {x : \u03b3} :\n update f (inl i) x (inr j) = f (inr j) :=\nFunction.update_of_ne inr_ne_inl ..\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_comp_inl (L105-L108)\ntheorem update_inr_comp_inl [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b2} {x : \u03b3} :\n update f (inr i) x \u2218 inl = f \u2218 inl :=\n(update_comp_eq_of_forall_ne _ _) fun _ \u21a6 inl_ne_inr\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_apply_inl (L109-L112)\ntheorem update_inr_apply_inl [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b1} {j : \u03b2} {x : \u03b3} :\n update f (inr j) x (inl i) = f (inl i) :=\nFunction.update_of_ne inl_ne_inr ..\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_comp_inr (L114-L117)\ntheorem update_inr_comp_inr [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i : \u03b2}\n {x : \u03b3} : update f (inr i) x \u2218 inr = update (f \u2218 inr) i x :=\nupdate_comp_eq_of_injective _ inr_injective _ _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_apply_inr (L119-L122)\ntheorem update_inr_apply_inr [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)] {f : \u03b1 \u2295 \u03b2 \u2192 \u03b3} {i j : \u03b2}\n {x : \u03b3} : update f (inr i) x (inr j) = update (f \u2218 inr) i x j := by\nrw [\u2190 update_inr_comp_inr, Function.comp_apply]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Sum.Basic.update_inl_apply_inl' (L124-L128)\ntheorem update_inl_apply_inl' {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Type*} [DecidableEq \u03b1] [DecidableEq (\u03b1 \u2295 \u03b2)]\n {f : (i : \u03b1 \u2295 \u03b2) \u2192 \u03b3 i} {i : \u03b1} {x : \u03b3 (.inl i)} (j : \u03b1) :\n update f (.inl i) x (Sum.inl j) = update (fun j \u21a6 f (.inl j)) i x j :=\nFunction.update_apply_of_injective f Sum.inl_injective i x j\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Sum.Basic.update_inr_apply_inr' (L130-L134)\ntheorem update_inr_apply_inr' {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Type*} [DecidableEq \u03b2] [DecidableEq (\u03b1 \u2295 \u03b2)]\n {f : (i : \u03b1 \u2295 \u03b2) \u2192 \u03b3 i} {i : \u03b2} {x : \u03b3 (.inr i)} (j : \u03b2) :\n update f (.inr i) x (Sum.inr j) = update (fun j \u21a6 f (.inr j)) i x j :=\nFunction.update_apply_of_injective f Sum.inr_injective i x j\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Sum.Basic.rec_update_left (L136-L142)\nlemma rec_update_left {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u2200 a, \u03b3 (.inl a)) (g : \u2200 b, \u03b3 (.inr b)) (a : \u03b1) (x : \u03b3 (.inl a)) :\n Sum.rec (update f a x) g = update (Sum.rec f g) (.inl a) x :=\nFunction.rec_update Sum.inl_injective (Sum.rec \u00b7 g) (fun _ _ => rfl) (fun\n | _, _, .inl _, h => (h _ rfl).elim\n | _, _, .inr _, _ => rfl) _ _ _\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Sum.Basic.rec_update_right (L144-L150)\nlemma rec_update_right {\u03b3 : \u03b1 \u2295 \u03b2 \u2192 Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u2200 a, \u03b3 (.inl a)) (g : \u2200 b, \u03b3 (.inr b)) (b : \u03b2) (x : \u03b3 (.inr b)) :\n Sum.rec f (update g b x) = update (Sum.rec f g) (.inr b) x :=\nFunction.rec_update Sum.inr_injective (Sum.rec f) (fun _ _ => rfl) (fun\n | _, _, .inr _, h => (h _ rfl).elim\n | _, _, .inl _, _ => rfl) _ _ _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Sum.Basic.elim_update_right (L158-L162)\nlemma elim_update_right {\u03b3 : Sort*} [DecidableEq \u03b1] [DecidableEq \u03b2]\n (f : \u03b1 \u2192 \u03b3) (g : \u03b2 \u2192 \u03b3) (b : \u03b2) (x : \u03b3) :\n Sum.elim f (update g b x) = update (Sum.elim f g) (.inr b) x :=\nrec_update_right _ _ _ _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Sum.Order.swap_lt_swap_iff (L263-L278)\ntheorem swap_lt_swap_iff [LT \u03b1] [LT \u03b2] {a b : \u03b1 \u2295 \u03b2} : a.swap < b.swap \u2194 a < b :=\nliftRel_swap_iff\n\nend Disjoint\n\n/-! ### Linear sum of two orders -/\n\n\nnamespace Lex\n\n\n/-- The linear sum of two orders -/\nnotation:30 \u03b1 \" \u2295\u2097 \" \u03b2:29 => _root_.Lex (\u03b1 \u2295 \u03b2)\n\n--TODO: Can we make `inl\u2097`, `inr\u2097` `local notation`?\n/-- Lexicographical `Sum.inl`. Only used for pattern matching. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Sum.Lattice.inrLatticeHom (L103-L109)\ndef inrLatticeHom : LatticeHom \u03b2 (\u03b1 \u2295\u2097 \u03b2) where\n toFun := inr\u2097\nmap_sup' _ _ := rfl\n map_inf' _ _ := rfl\n\nend Lattice\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Sum.Interval.Iic_inl (L298-L298)\ntheorem Iic_inl : Iic (inl a : \u03b1 \u2295 \u03b2) = (Iic a).map Embedding.inl := rfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Sum.Order.not_inr_le_inl (L149-L151)\ntheorem not_inr_le_inl [LE \u03b1] [LE \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinr b \u2264 inl a :=\nnot_liftRel_inr_inl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Sum.Order.inl_strictMono (L177-L178)\ntheorem inl_strictMono : StrictMono (inl : \u03b1 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLT (L337-L342)\ndef toLexRelIsoLT [LT \u03b1] [LT \u03b2] :\n Sum.Lex (\u00b7 < \u00b7 : \u03b1 \u2192 \u03b1 \u2192 Prop) (\u00b7 < \u00b7 : \u03b2 \u2192 \u03b2 \u2192 Prop) \u2243r (\u00b7 < \u00b7 : \u03b1 \u2295\u2097 \u03b2 \u2192 _ \u2192 _) where\n toFun := toLex\ninvFun := ofLex\n map_rel_iff' := .rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Sum.Interval.Ici_inl (L316-L316)\ntheorem Ici_inl : Ici (inl a : \u03b1 \u2295 \u03b2) = (Ici a).map Embedding.inl := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Sum.Interval.sumLift\u2082_nonempty (L88-L93)\ntheorem sumLift\u2082_nonempty :\n (sumLift\u2082 f g a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f a\u2081 b\u2081).Nonempty) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (g a\u2082 b\u2082).Nonempty := by\nsimp only [nonempty_iff_ne_empty, Ne, sumLift\u2082_eq_empty, not_and_or, not_forall, exists_prop]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Sum.Interval.Ioi_inl (L318-L318)\ntheorem Ioi_inl : Ioi (inl a : \u03b1 \u2295 \u03b2) = (Ioi a).map Embedding.inl := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Sum.Order.noMaxOrder_iff (L221-L232)\ntheorem noMaxOrder_iff [LT \u03b1] [LT \u03b2] : NoMaxOrder (\u03b1 \u2295 \u03b2) \u2194 NoMaxOrder \u03b1 \u2227 NoMaxOrder \u03b2 :=\n\u27e8fun _ =>\n \u27e8\u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_gt (inl a : \u03b1 \u2295 \u03b2)\n \u00b7 exact \u27e8b, inl_lt_inl_iff.1 h\u27e9\n \u00b7 exact (not_inl_lt_inr h).elim\u27e9,\n \u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_gt (inr a : \u03b1 \u2295 \u03b2)\n \u00b7 exact (not_inr_lt_inl h).elim\n \u00b7 exact \u27e8b, inr_lt_inr_iff.1 h\u27e9\u27e9\u27e9,\n fun h => @Sum.noMaxOrder _ _ _ _ h.1 h.2\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Sum.Order.not_inl_lt_inr (L145-L147)\ntheorem not_inl_lt_inr [LT \u03b1] [LT \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinl b < inr a :=\nnot_liftRel_inl_inr\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Sum.Interval.Iio_inl (L300-L300)\ntheorem Iio_inl : Iio (inl a : \u03b1 \u2295 \u03b2) = (Iio a).map Embedding.inl := rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Sum.Order.inl_le_inr (L324-L326)\ntheorem inl_le_inr [LE \u03b1] [LE \u03b2] (a : \u03b1) (b : \u03b2) : toLex (inl a) \u2264 toLex (inr b) :=\nLex.sep _ _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Sum.Order.le_def (L118-L120)\ntheorem le_def [LE \u03b1] [LE \u03b2] {a b : \u03b1 \u2295 \u03b2} : a \u2264 b \u2194 LiftRel (\u00b7 \u2264 \u00b7) (\u00b7 \u2264 \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Sum.Interval.Ici_inr (L317-L317)\ntheorem Ici_inr : Ici (inr b : \u03b1 \u2295 \u03b2) = (Ici b).map Embedding.inr := rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Data.Sum.Interval.inr_mem_sumLift\u2082 (L67-L73)\ntheorem inr_mem_sumLift\u2082 {c\u2082 : \u03b3\u2082} :\n inr c\u2082 \u2208 sumLift\u2082 f g a b \u2194 \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c\u2082 \u2208 g a\u2082 b\u2082 := by\nrw [mem_sumLift\u2082, or_iff_right]\n \u00b7 simp only [inr.injEq, exists_and_left, exists_eq_left']\n rintro \u27e8_, _, c\u2082, _, _, h, _\u27e9\n exact inr_ne_inl h\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Data.Sum.Order.inr_le_inr_iff (L129-L131)\ntheorem inr_le_inr_iff [LE \u03b1] [LE \u03b2] {a b : \u03b2} : (inr a : \u03b1 \u2295 \u03b2) \u2264 inr b \u2194 a \u2264 b :=\nliftRel_inr_inr\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Data.Sum.Order.not_inr_lt_inl (L153-L159)\ntheorem not_inr_lt_inl [LT \u03b1] [LT \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinr b < inl a :=\nnot_liftRel_inr_inl\n\nsection Preorder\n\nvariable [Preorder \u03b1] [Preorder \u03b2]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Data.Sum.Order.inl_mono (L173-L174)\ntheorem inl_mono : Monotone (inl : \u03b1 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inl\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inr_inl (L270-L272)\ntheorem Ioo_inr_inl : Ioo (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Data.Sum.Order.noMinOrder_iff (L208-L219)\ntheorem noMinOrder_iff [LT \u03b1] [LT \u03b2] : NoMinOrder (\u03b1 \u2295 \u03b2) \u2194 NoMinOrder \u03b1 \u2227 NoMinOrder \u03b2 :=\n\u27e8fun _ =>\n \u27e8\u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_lt (inl a : \u03b1 \u2295 \u03b2)\n \u00b7 exact \u27e8b, inl_lt_inl_iff.1 h\u27e9\n \u00b7 exact (not_inr_lt_inl h).elim\u27e9,\n \u27e8fun a => by\n obtain \u27e8b | b, h\u27e9 := exists_lt (inr a : \u03b1 \u2295 \u03b2)\n \u00b7 exact (not_inl_lt_inr h).elim\n \u00b7 exact \u27e8b, inr_lt_inr_iff.1 h\u27e9\u27e9\u27e9,\n fun h => @Sum.noMinOrder _ _ _ _ h.1 h.2\u27e9\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Data.Sum.Order.inr_lt_inr_iff (L137-L139)\ntheorem inr_lt_inr_iff [LT \u03b1] [LT \u03b2] {a b : \u03b2} : (inr a : \u03b1 \u2295 \u03b2) < inr b \u2194 a < b :=\nliftRel_inr_inr\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Data.Sum.Interval.inl_mem_sumLexLift (L160-L165)\nlemma inl_mem_sumLexLift {c\u2081 : \u03b3\u2081} :\n inl c\u2081 \u2208 sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c\u2081 \u2208 f\u2081 a\u2081 b\u2081) \u2228\n \u2203 a\u2081 b\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c\u2081 \u2208 g\u2081 a\u2081 b\u2082 := by\nsimp [mem_sumLexLift]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Data.Sum.Interval.mem_sumLift\u2082 (L44-L59)\ntheorem mem_sumLift\u2082 :\n c \u2208 sumLift\u2082 f g a b \u2194\n (\u2203 a\u2081 b\u2081 c\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c = inl c\u2081 \u2227 c\u2081 \u2208 f a\u2081 b\u2081) \u2228\n \u2203 a\u2082 b\u2082 c\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c = inr c\u2082 \u2227 c\u2082 \u2208 g a\u2082 b\u2082 := by\nconstructor\n \u00b7 rcases a with a | a <;> rcases b with b | b\n \u00b7 rw [sumLift\u2082, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9\n \u00b7 refine fun h \u21a6 (notMem_empty _ h).elim\n \u00b7 refine fun h \u21a6 (notMem_empty _ h).elim\n \u00b7 rw [sumLift\u2082, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9\n \u00b7 rintro (\u27e8a, b, c, rfl, rfl, rfl, h\u27e9 | \u27e8a, b, c, rfl, rfl, rfl, h\u27e9) <;> exact mem_map_of_mem _ h\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Data.Sum.Order.inl_lt_inl_iff (L133-L135)\ntheorem inl_lt_inl_iff [LT \u03b1] [LT \u03b2] {a b : \u03b1} : (inl a : \u03b1 \u2295 \u03b2) < inl b \u2194 a < b :=\nliftRel_inl_inl\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inr_inl (L258-L260)\ntheorem Icc_inr_inl : Icc (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLE (L352-L357)\ndef toLexRelIsoLE [LE \u03b1] [LE \u03b2] :\n Sum.Lex (\u00b7 \u2264 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 Prop) (\u00b7 \u2264 \u00b7 : \u03b2 \u2192 \u03b2 \u2192 Prop) \u2243r (\u00b7 \u2264 \u00b7 : \u03b1 \u2295\u2097 \u03b2 \u2192 _ \u2192 _) where\n toFun := toLex\ninvFun := ofLex\n map_rel_iff' := .rfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Data.Sum.Interval.sumLift\u2082_eq_empty (L74-L87)\ntheorem sumLift\u2082_eq_empty :\n sumLift\u2082 f g a b = \u2205 \u2194\n (\u2200 a\u2081 b\u2081, a = inl a\u2081 \u2192 b = inl b\u2081 \u2192 f a\u2081 b\u2081 = \u2205) \u2227\n \u2200 a\u2082 b\u2082, a = inr a\u2082 \u2192 b = inr b\u2082 \u2192 g a\u2082 b\u2082 = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 constructor <;>\n \u00b7 rintro a b rfl rfl\n exact map_eq_empty.1 h\n cases a <;> cases b\n \u00b7 exact map_eq_empty.2 (h.1 _ _ rfl rfl)\n \u00b7 rfl\n \u00b7 rfl\n \u00b7 exact map_eq_empty.2 (h.2 _ _ rfl rfl)\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inr_inl (L125-L126)\nlemma sumLexLift_inr_inl (a : \u03b1\u2082) (b : \u03b2\u2081) : sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inr a) (inl b) = \u2205 := rfl\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inr_inr (L276-L278)\ntheorem Ico_inr_inr : Ico (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Ico b\u2081 b\u2082).map Embedding.inr :=\nrfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inr_inl (L266-L268)\ntheorem Ioc_inr_inl : Ioc (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Data.Sum.Order.noMinOrder (L187-L196)\ninstance noMinOrder [LT \u03b1] [LT \u03b2] [NoMinOrder \u03b1] [NoMinOrder \u03b2] : NoMinOrder (\u03b1 \u2295 \u03b2) :=\n\u27e8fun a =>\n match a with\n | inl a =>\n let \u27e8b, h\u27e9 := exists_lt a\n \u27e8inl b, inl_lt_inl_iff.2 h\u27e9\n | inr a =>\n let \u27e8b, h\u27e9 := exists_lt a\n \u27e8inr b, inr_lt_inr_iff.2 h\u27e9\u27e9\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Data.Sum.Order.denselyOrdered_iff (L245-L257)\ntheorem denselyOrdered_iff [LT \u03b1] [LT \u03b2] :\n DenselyOrdered (\u03b1 \u2295 \u03b2) \u2194 DenselyOrdered \u03b1 \u2227 DenselyOrdered \u03b2 :=\n\u27e8fun _ =>\n \u27e8\u27e8fun a b h => by\n obtain \u27e8c | c, ha, hb\u27e9 := @exists_between (\u03b1 \u2295 \u03b2) _ _ _ _ (inl_lt_inl_iff.2 h)\n \u00b7 exact \u27e8c, inl_lt_inl_iff.1 ha, inl_lt_inl_iff.1 hb\u27e9\n \u00b7 exact (not_inl_lt_inr ha).elim\u27e9,\n \u27e8fun a b h => by\n obtain \u27e8c | c, ha, hb\u27e9 := @exists_between (\u03b1 \u2295 \u03b2) _ _ _ _ (inr_lt_inr_iff.2 h)\n \u00b7 exact (not_inl_lt_inr hb).elim\n \u00b7 exact \u27e8c, inr_lt_inr_iff.1 ha, inr_lt_inr_iff.1 hb\u27e9\u27e9\u27e9,\n fun h => @Sum.denselyOrdered _ _ _ _ h.1 h.2\u27e9\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_nonempty (L193-L216)\nlemma sumLexLift_nonempty :\n (sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f\u2081 a\u2081 b\u2081).Nonempty) \u2228\n (\u2203 a\u2081 b\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 ((g\u2081 a\u2081 b\u2082).Nonempty \u2228 (g\u2082 a\u2081 b\u2082).Nonempty)) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (f\u2082 a\u2082 b\u2082).Nonempty := by\nsimp only [nonempty_iff_ne_empty, Ne, sumLexLift_eq_empty, not_and_or, exists_prop, not_forall]\n\nend SumLexLift\nend Finset\n\nopen Finset\n\nnamespace Sum\n\nvariable {\u03b1 \u03b2 : Type*}\n\n/-! ### Disjoint sum of orders -/\n\n\nsection Disjoint\n\nsection LocallyFiniteOrder\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrder \u03b1] [LocallyFiniteOrder \u03b2]\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Data.Sum.Order.inl_lt_inr (L327-L329)\ntheorem inl_lt_inr [LT \u03b1] [LT \u03b2] (a : \u03b1) (b : \u03b2) : toLex (inl a) < toLex (inr b) :=\nLex.sep _ _\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Data.Sum.Order.instPreorderSum (L160-L172)\ninstance instPreorderSum : Preorder (\u03b1 \u2295 \u03b2) :=\n{ instLESum, instLTSum with\n le_refl := fun _ => LiftRel.refl _ _ _,\n le_trans := fun _ _ _ => LiftRel.trans _ _,\n lt_iff_le_not_ge := fun a b => by\n refine \u27e8fun hab => \u27e8hab.mono (fun _ _ => le_of_lt) fun _ _ => le_of_lt, ?_\u27e9, ?_\u27e9\n \u00b7 rintro (\u27e8hba\u27e9 | \u27e8hba\u27e9)\n \u00b7 exact hba.not_gt (inl_lt_inl_iff.1 hab)\n \u00b7 exact hba.not_gt (inr_lt_inr_iff.1 hab)\n \u00b7 rintro \u27e8\u27e8hab\u27e9 | \u27e8hab\u27e9, hba\u27e9\n \u00b7 exact LiftRel.inl (hab.lt_of_not_ge fun h => hba <| LiftRel.inl h)\n \u00b7 exact LiftRel.inr (hab.lt_of_not_ge fun h => hba <| LiftRel.inr h) }\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inl_inr (L250-L252)\ntheorem Ioc_inl_inr : Ioc (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inl_inl (L229-L231)\ntheorem Icc_inl_inl : Icc (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Icc a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Data.Sum.Lattice.instDistribLattice (L110-L117)\ninstance instDistribLattice [DistribLattice \u03b1] [DistribLattice \u03b2] : DistribLattice (\u03b1 \u2295\u2097 \u03b2) where\n le_sup_inf := by\nsimp only [Lex.forall, Sum.forall, inr_le_inr_iff,\n le_sup_left, inl_le_inr, sup_of_le_right, and_self,\n inf_of_le_left, implies_true, inf_of_le_right, sup_of_le_left, \u2190 inl_sup,\n \u2190 inr_sup, \u2190 inl_inf, \u2190 inr_inf, sup_inf_left, le_rfl]\n\nend Sum.Lex\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inr_inl (L262-L264)\ntheorem Ico_inr_inl : Ico (inr b\u2081) (inl a\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Data.Sum.Order.toLex_le_toLex (L297-L300)\ntheorem toLex_le_toLex [LE \u03b1] [LE \u03b2] {a b : \u03b1 \u2295 \u03b2} :\n toLex a \u2264 toLex b \u2194 Lex (\u00b7 \u2264 \u00b7) (\u00b7 \u2264 \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inl_inr (L121-L123)\nlemma sumLexLift_inl_inr (a : \u03b1\u2081) (b : \u03b2\u2082) :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inl a) (inr b) = (g\u2081 a b).disjSum (g\u2082 a b) := rfl\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inl_inr (L242-L244)\ntheorem Icc_inl_inr : Icc (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Data.Sum.Interval.instLocallyFiniteOrderTop (L442-L453)\ninstance instLocallyFiniteOrderTop : LocallyFiniteOrderTop (\u03b1 \u2295\u2097 \u03b2) where\n finsetIci := Sum.elim\n(fun x => (Ici x).disjSum Finset.univ |>.map toLex.toEmbedding)\n (Ici \u00b7 |>.map (.trans .inr toLex.toEmbedding)) \u2218 ofLex\n finsetIoi := Sum.elim\n (fun x => (Ioi x).disjSum Finset.univ |>.map toLex.toEmbedding)\n (Ioi \u00b7 |>.map (.trans .inr toLex.toEmbedding)) \u2218 ofLex\n finset_mem_Ici := by simp\n finset_mem_Ioi := by simp\n\nvariable (a : \u03b1) (b : \u03b2)\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inr_inr (L128-L132)\nlemma sumLexLift_inr_inr (a : \u03b1\u2082) (b : \u03b2\u2082) :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inr a) (inr b) = (f\u2082 a b).map \u27e8_, inr_injective\u27e9 := rfl\nvariable {f\u2081 g\u2081 f\u2082 g\u2082 f\u2081' g\u2081' f\u2082' g\u2082'} {a : \u03b1\u2081 \u2295 \u03b1\u2082} {b : \u03b2\u2081 \u2295 \u03b2\u2082} {c : \u03b3\u2081 \u2295 \u03b3\u2082}\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Data.Sum.Interval.Icc_inr_inr (L273-L275)\ntheorem Icc_inr_inr : Icc (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Icc b\u2081 b\u2082).map Embedding.inr :=\nrfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inr_inr (L279-L281)\ntheorem Ioc_inr_inr : Ioc (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Ioc b\u2081 b\u2082).map Embedding.inr :=\nrfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Data.Sum.Order.lt_def (L121-L123)\ntheorem lt_def [LT \u03b1] [LT \u03b2] {a b : \u03b1 \u2295 \u03b2} : a < b \u2194 LiftRel (\u00b7 < \u00b7) (\u00b7 < \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inr_inr (L282-L289)\ntheorem Ioo_inr_inr : Ioo (inr b\u2081 : \u03b1 \u2295 \u03b2) (inr b\u2082) = (Ioo b\u2081 b\u2082).map Embedding.inr :=\nrfl\n\nend LocallyFiniteOrder\n\nsection LocallyFiniteOrderBot\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrderBot \u03b1] [LocallyFiniteOrderBot \u03b2]\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_inl_inl (L117-L119)\nlemma sumLexLift_inl_inl (a : \u03b1\u2081) (b : \u03b2\u2081) :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 (inl a) (inl b) = (f\u2081 a b).map Embedding.inl := rfl\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Data.Sum.Interval.mem_sumLexLift (L133-L159)\nlemma mem_sumLexLift :\n c \u2208 sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2194\n (\u2203 a\u2081 b\u2081 c\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c = inl c\u2081 \u2227 c\u2081 \u2208 f\u2081 a\u2081 b\u2081) \u2228\n (\u2203 a\u2081 b\u2082 c\u2081, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c = inl c\u2081 \u2227 c\u2081 \u2208 g\u2081 a\u2081 b\u2082) \u2228\n (\u2203 a\u2081 b\u2082 c\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c = inr c\u2082 \u2227 c\u2082 \u2208 g\u2082 a\u2081 b\u2082) \u2228\n \u2203 a\u2082 b\u2082 c\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c = inr c\u2082 \u2227 c\u2082 \u2208 f\u2082 a\u2082 b\u2082 := by\nconstructor\n \u00b7 obtain a | a := a <;> obtain b | b := b\n \u00b7 rw [sumLexLift, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9\n \u00b7 refine fun h \u21a6 (mem_disjSum.1 h).elim ?_ ?_\n \u00b7 rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr (Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr (Or.inr <| Or.inl \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 exact fun h \u21a6 (notMem_empty _ h).elim\n \u00b7 rw [sumLexLift, mem_map]\n rintro \u27e8c, hc, rfl\u27e9\n exact Or.inr (Or.inr <| Or.inr <| \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 rintro (\u27e8a, b, c, rfl, rfl, rfl, hc\u27e9 | \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9 |\n \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9 | \u27e8a, b, c, rfl, rfl, rfl, hc\u27e9)\n \u00b7 exact mem_map_of_mem _ hc\n \u00b7 exact inl_mem_disjSum.2 hc\n \u00b7 exact inr_mem_disjSum.2 hc\n \u00b7 exact mem_map_of_mem _ hc\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Data.Sum.Order.noMaxOrder (L197-L206)\ninstance noMaxOrder [LT \u03b1] [LT \u03b2] [NoMaxOrder \u03b1] [NoMaxOrder \u03b2] : NoMaxOrder (\u03b1 \u2295 \u03b2) :=\n\u27e8fun a =>\n match a with\n | inl a =>\n let \u27e8b, h\u27e9 := exists_gt a\n \u27e8inl b, inl_lt_inl_iff.2 h\u27e9\n | inr a =>\n let \u27e8b, h\u27e9 := exists_gt a\n \u27e8inr b, inr_lt_inr_iff.2 h\u27e9\u27e9\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Data.Sum.Order.denselyOrdered (L233-L243)\ninstance denselyOrdered [LT \u03b1] [LT \u03b2] [DenselyOrdered \u03b1] [DenselyOrdered \u03b2] :\n DenselyOrdered (\u03b1 \u2295 \u03b2) :=\n\u27e8fun a b h =>\n match a, b, h with\n | inl _, inl _, LiftRel.inl h =>\n let \u27e8c, ha, hb\u27e9 := exists_between h\n \u27e8toLex (inl c), LiftRel.inl ha, LiftRel.inl hb\u27e9\n | inr _, inr _, LiftRel.inr h =>\n let \u27e8c, ha, hb\u27e9 := exists_between h\n \u27e8toLex (inr c), LiftRel.inr ha, LiftRel.inr hb\u27e9\u27e9\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Data.Sum.Interval.Ioi_inr (L319-L332)\ntheorem Ioi_inr : Ioi (inr b : \u03b1 \u2295 \u03b2) = (Ioi b).map Embedding.inr := rfl\nend LocallyFiniteOrderTop\n\nend Disjoint\n\n/-! ### Lexicographical sum of orders -/\n\nnamespace Lex\n\nsection LocallyFiniteOrder\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrder \u03b1] [LocallyFiniteOrder \u03b2]\nvariable [LocallyFiniteOrderTop \u03b1] [LocallyFiniteOrderBot \u03b2]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Data.Sum.Order.inl_le_inl_iff (L125-L127)\ntheorem inl_le_inl_iff [LE \u03b1] [LE \u03b2] {a b : \u03b1} : (inl a : \u03b1 \u2295 \u03b2) \u2264 inl b \u2194 a \u2264 b :=\nliftRel_inl_inl\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Data.Sum.Order.instLTSum (L115-L117)\ninstance instLTSum [LT \u03b1] [LT \u03b2] : LT (\u03b1 \u2295 \u03b2) :=\n\u27e8LiftRel (\u00b7 < \u00b7) (\u00b7 < \u00b7)\u27e9\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inl_inr (L254-L256)\ntheorem Ioo_inl_inr : Ioo (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Data.Sum.Order.inr_strictMono (L179-L182)\ntheorem inr_strictMono : StrictMono (inr : \u03b2 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inr\nend Preorder\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Data.Sum.Interval.inl_mem_sumLift\u2082 (L60-L66)\ntheorem inl_mem_sumLift\u2082 {c\u2081 : \u03b3\u2081} :\n inl c\u2081 \u2208 sumLift\u2082 f g a b \u2194 \u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 c\u2081 \u2208 f a\u2081 b\u2081 := by\nrw [mem_sumLift\u2082, or_iff_left]\n \u00b7 simp only [inl.injEq, exists_and_left, exists_eq_left']\n rintro \u27e8_, _, c\u2082, _, _, h, _\u27e9\n exact inl_ne_inr h\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Data.Sum.Order.swap_le_swap_iff (L259-L261)\ntheorem swap_le_swap_iff [LE \u03b1] [LE \u03b2] {a b : \u03b1 \u2295 \u03b2} : a.swap \u2264 b.swap \u2194 a \u2264 b :=\nliftRel_swap_iff\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Data.Sum.Interval.instLocallyFiniteOrder (L217-L228)\ninstance instLocallyFiniteOrder : LocallyFiniteOrder (\u03b1 \u2295 \u03b2) where\n finsetIcc := sumLift\u2082 Icc Icc\nfinsetIco := sumLift\u2082 Ico Ico\n finsetIoc := sumLift\u2082 Ioc Ioc\n finsetIoo := sumLift\u2082 Ioo Ioo\n finset_mem_Icc := by simp\n finset_mem_Ico := by simp\n finset_mem_Ioc := by simp\n finset_mem_Ioo := by simp\n\nvariable (a\u2081 a\u2082 : \u03b1) (b\u2081 b\u2082 : \u03b2)\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLT_coe (L344-L346)\ntheorem toLexRelIsoLT_coe [LT \u03b1] [LT \u03b2] : \u21d1(toLexRelIsoLT (\u03b1 := \u03b1) (\u03b2 := \u03b2)) = toLex :=\nrfl\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Data.Sum.Interval.Iic_inr (L299-L299)\ntheorem Iic_inr : Iic (inr b : \u03b1 \u2295 \u03b2) = (Iic b).map Embedding.inr := rfl\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Data.Sum.Lattice.instLattice (L94-L96)\ninstance instLattice : Lattice (\u03b1 \u2295\u2097 \u03b2) := { instSemilatticeSup, instSemilatticeInf with }\n/-- `Sum.Lex.inl\u2097` as a lattice homomorphism. -/\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inl_inl (L232-L234)\ntheorem Ico_inl_inl : Ico (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Ico a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Data.Sum.Interval.locallyFiniteOrder (L333-L348)\ninstance locallyFiniteOrder : LocallyFiniteOrder (\u03b1 \u2295\u2097 \u03b2) where\n finsetIcc a b :=\n(sumLexLift Icc Icc (fun a _ => Ici a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finsetIco a b :=\n (sumLexLift Ico Ico (fun a _ => Ici a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finsetIoc a b :=\n (sumLexLift Ioc Ioc (fun a _ => Ioi a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finsetIoo a b :=\n (sumLexLift Ioo Ioo (fun a _ => Ioi a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding\n finset_mem_Icc := by simp\n finset_mem_Ico := by simp\n finset_mem_Ioc := by simp\n finset_mem_Ioo := by simp\n\nvariable (a a\u2081 a\u2082 : \u03b1) (b b\u2081 b\u2082 : \u03b2)\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Data.Sum.Order.instLESum (L112-L114)\ninstance instLESum [LE \u03b1] [LE \u03b2] : LE (\u03b1 \u2295 \u03b2) :=\n\u27e8LiftRel (\u00b7 \u2264 \u00b7) (\u00b7 \u2264 \u00b7)\u27e9\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Data.Sum.Interval.instLocallyFiniteOrderBot (L410-L421)\ninstance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (\u03b1 \u2295\u2097 \u03b2) where\n finsetIic := Sum.elim\n(Iic \u00b7 |>.map (.trans .inl toLex.toEmbedding))\n (fun x => Finset.univ.disjSum (Iic x) |>.map toLex.toEmbedding) \u2218 ofLex\n finsetIio := Sum.elim\n (Iio \u00b7 |>.map (.trans .inl toLex.toEmbedding))\n (fun x => Finset.univ.disjSum (Iio x) |>.map toLex.toEmbedding) \u2218 ofLex\n finset_mem_Iic := by simp\n finset_mem_Iio := by simp\n\nvariable (a : \u03b1) (b : \u03b2)\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_eq_empty (L179-L192)\nlemma sumLexLift_eq_empty :\n sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b = \u2205 \u2194\n (\u2200 a\u2081 b\u2081, a = inl a\u2081 \u2192 b = inl b\u2081 \u2192 f\u2081 a\u2081 b\u2081 = \u2205) \u2227\n (\u2200 a\u2081 b\u2082, a = inl a\u2081 \u2192 b = inr b\u2082 \u2192 g\u2081 a\u2081 b\u2082 = \u2205 \u2227 g\u2082 a\u2081 b\u2082 = \u2205) \u2227\n \u2200 a\u2082 b\u2082, a = inr a\u2082 \u2192 b = inr b\u2082 \u2192 f\u2082 a\u2082 b\u2082 = \u2205 := by\nrefine \u27e8fun h \u21a6 \u27e8?_, ?_, ?_\u27e9, fun h \u21a6 ?_\u27e9\n any_goals rintro a b rfl rfl; exact map_eq_empty.1 h\n \u00b7 rintro a b rfl rfl; exact disjSum_eq_empty.1 h\n cases a <;> cases b\n \u00b7 exact map_eq_empty.2 (h.1 _ _ rfl rfl)\n \u00b7 simp [h.2.1 _ _ rfl rfl]\n \u00b7 rfl\n \u00b7 exact map_eq_empty.2 (h.2.2 _ _ rfl rfl)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Data.Sum.Interval.Ioc_inl_inl (L235-L237)\ntheorem Ioc_inl_inl : Ioc (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Ioc a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Data.Sum.Interval.inr_mem_sumLexLift (L166-L171)\nlemma inr_mem_sumLexLift {c\u2082 : \u03b3\u2082} :\n inr c\u2082 \u2208 sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2194\n (\u2203 a\u2081 b\u2082, a = inl a\u2081 \u2227 b = inr b\u2082 \u2227 c\u2082 \u2208 g\u2082 a\u2081 b\u2082) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 c\u2082 \u2208 f\u2082 a\u2082 b\u2082 := by\nsimp [mem_sumLexLift]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Data.Sum.Interval.Ioo_inl_inl (L238-L240)\ntheorem Ioo_inl_inl : Ioo (inl a\u2081 : \u03b1 \u2295 \u03b2) (inl a\u2082) = (Ioo a\u2081 a\u2082).map Embedding.inl :=\nrfl\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Data.Sum.Interval.Iio_inr (L301-L307)\ntheorem Iio_inr : Iio (inr b : \u03b1 \u2295 \u03b2) = (Iio b).map Embedding.inr := rfl\nend LocallyFiniteOrderBot\n\nsection LocallyFiniteOrderTop\nvariable [Preorder \u03b1] [Preorder \u03b2] [LocallyFiniteOrderTop \u03b1] [LocallyFiniteOrderTop \u03b2]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Data.Sum.Interval.sumLexLift_mono (L172-L178)\nlemma sumLexLift_mono (hf\u2081 : \u2200 a b, f\u2081 a b \u2286 f\u2081' a b) (hf\u2082 : \u2200 a b, f\u2082 a b \u2286 f\u2082' a b)\n (hg\u2081 : \u2200 a b, g\u2081 a b \u2286 g\u2081' a b) (hg\u2082 : \u2200 a b, g\u2082 a b \u2286 g\u2082' a b) (a : \u03b1\u2081 \u2295 \u03b1\u2082)\n (b : \u03b2\u2081 \u2295 \u03b2\u2082) : sumLexLift f\u2081 f\u2082 g\u2081 g\u2082 a b \u2286 sumLexLift f\u2081' f\u2082' g\u2081' g\u2082' a b := by\ncases a <;> cases b\n exacts [map_subset_map.2 (hf\u2081 _ _), disjSum_mono (hg\u2081 _ _) (hg\u2082 _ _), Subset.rfl,\n map_subset_map.2 (hf\u2082 _ _)]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Data.Sum.Order.toLex_lt_toLex (L302-L305)\ntheorem toLex_lt_toLex [LT \u03b1] [LT \u03b2] {a b : \u03b1 \u2295 \u03b2} :\n toLex a < toLex b \u2194 Lex (\u00b7 < \u00b7) (\u00b7 < \u00b7) a b :=\nIff.rfl\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Data.Sum.Order.not_inl_le_inr (L141-L143)\ntheorem not_inl_le_inr [LE \u03b1] [LE \u03b2] {a : \u03b1} {b : \u03b2} : \u00acinl b \u2264 inr a :=\nnot_liftRel_inl_inr\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Data.Sum.Order.toLexRelIsoLT_symm_coe (L348-L351)\ntheorem toLexRelIsoLT_symm_coe [LT \u03b1] [LT \u03b2] : \u21d1(toLexRelIsoLT (\u03b1 := \u03b1) (\u03b2 := \u03b2)).symm = ofLex :=\nrfl\n\n/-- `toLex` promoted to a `RelIso` between `\u2264` relations. -/\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Data.Sum.Lattice.inlLatticeHom (L97-L102)\ndef inlLatticeHom : LatticeHom \u03b1 (\u03b1 \u2295\u2097 \u03b2) where\n toFun := inl\u2097\nmap_sup' _ _ := rfl\n map_inf' _ _ := rfl\n\n/-- `Sum.Lex.inr\u2097` as a lattice homomorphism. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Data.Sum.Interval.Ico_inl_inr (L246-L248)\ntheorem Ico_inl_inr : Ico (inl a\u2081) (inr b\u2082) = \u2205 :=\nrfl\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Data.Sum.Order.inr_mono (L175-L176)\ntheorem inr_mono : Monotone (inr : \u03b2 \u2192 \u03b1 \u2295 \u03b2) := fun _ _ => LiftRel.inr\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Sum/Basic.lean", "module": "Mathlib.Data.Sum.Basic", "declaration": "Mathlib.Data.Sum.Basic.elim_update_left", "span": "L152-L156", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Sum/Basic.lean#L152"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 13824, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 30667, "lean_code_chars": 27415, "natural_language_chars": 3252, "lean_code_ratio": 0.894, "line_count": 1027, "imports_count": 0, "declarations_count": 3444, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "5918a569423a78e0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.AdjoinRoot.liftAlgHom_of", "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.RingTheory.AdjoinRoot)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma liftAlgHom_of (i : R \u2192\u2090[S] T) (x : T) (h) (r : R) : liftAlgHom p i x h (of p r) = i r\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.AdjoinRoot (L62-L72)\ndef AdjoinRoot [CommRing R] (f : R[X]) : Type _ :=\nPolynomial R \u29f8 (span {f} : Ideal R[X])\n\nnamespace AdjoinRoot\n\nsection CommRing\n\nvariable [CommRing R] (f g : R[X])\n\nderiving instance CommRing, Inhabited for AdjoinRoot\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk (L83-L85)\ndef mk : R[X] \u2192+* AdjoinRoot f :=\nIdeal.Quotient.mk _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.induction_on (L87-L91)\ntheorem induction_on {C : AdjoinRoot f \u2192 Prop} (x : AdjoinRoot f) (ih : \u2200 p : R[X], C (mk f p)) :\n C x :=\nQuotient.inductionOn' x ih\n\n/-- Embedding of the original ring `R` into `AdjoinRoot f`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.of (L92-L94)\ndef of : R \u2192+* AdjoinRoot f :=\n(mk f).comp C\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.instSMulAdjoinRoot (L95-L97)\ninstance instSMulAdjoinRoot [DistribSMul S R] [IsScalarTower S R R] : SMul S (AdjoinRoot f) :=\ninferInstanceAs <| SMul S (_ \u29f8 _)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.smul_mk (L102-L105)\ntheorem smul_mk [DistribSMul S R] [IsScalarTower S R R] (a : S) (x : R[X]) :\n a \u2022 mk f x = mk f (a \u2022 x) :=\nrfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.smul_of (L106-L108)\ntheorem smul_of [DistribSMul S R] [IsScalarTower S R R] (a : S) (x : R) :\n a \u2022 of f x = of f (a \u2022 x) := by rw [of, RingHom.comp_apply, RingHom.comp_apply, smul_mk, smul_C]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.isScalarTower_right (L119-L122)\ninstance isScalarTower_right [DistribSMul S R] [IsScalarTower S R R] :\n IsScalarTower S (AdjoinRoot f) (AdjoinRoot f) :=\ninferInstanceAs <| IsScalarTower S (_ \u29f8 _) (_ \u29f8 _)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk\u2090 (L134-L136)\ndef mk\u2090 : R[X] \u2192\u2090[R] AdjoinRoot f :=\nIdeal.Quotient.mk\u2090 R _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algebraMap_eq (L142-L145)\ntheorem algebraMap_eq : algebraMap R (AdjoinRoot f) = of f :=\nrfl\n\nvariable (S) in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algebraMap_eq' (L146-L149)\ntheorem algebraMap_eq' [CommSemiring S] [Algebra S R] :\n algebraMap S (AdjoinRoot f) = (of f).comp (algebraMap S R) :=\nrfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.finiteType (L150-L153)\ninstance finiteType [CommSemiring S] [Algebra S R] [FiniteType S R] :\n FiniteType S (AdjoinRoot f) :=\ninferInstanceAs <| FiniteType S (_ \u29f8 (_ : Ideal R[X]))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.finitePresentation (L154-L158)\ninstance finitePresentation [CommRing S] [Algebra S R] [FinitePresentation S R] :\n FinitePresentation S (AdjoinRoot f) :=\n.quotient (Submodule.fg_span_singleton f)\n\n/-- The adjoined root. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.root (L159-L166)\ndef root : AdjoinRoot f :=\nmk f X\n\nsection Algebra\nvariable [CommSemiring S] [Semiring T] [Algebra S R] [Algebra S T] (p : R[X])\n\nvariable (S) in\n/-- Embedding of the original ring `R` into `AdjoinRoot p`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.ofAlgHom (L167-L168)\nabbrev ofAlgHom : R \u2192\u2090[S] AdjoinRoot p := Algebra.algHom S R <| AdjoinRoot p\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.ringHom_ext (L176-L182)\nlemma ringHom_ext {f g : AdjoinRoot p \u2192+* T} (hAlg : f.comp (of p) = g.comp (of p))\n (hRoot : f (root p) = g (root p)) : f = g := by\napply Ideal.Quotient.ringHom_ext\n ext x\n \u00b7 simpa using congr($(hAlg) x)\n \u00b7 simpa\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algHom_ext' (L184-L192)\nlemma algHom_ext' {f g : AdjoinRoot p \u2192\u2090[S] T}\n (hAlg : f.comp (ofAlgHom S p) = g.comp (ofAlgHom S p))\n (hRoot : f (root p) = g (root p)) : f = g := by\napply AlgHom.coe_ringHom_injective; exact ringHom_ext congr(($hAlg).toRingHom) hRoot\n\nend Algebra\n\nvariable {f g}\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.hasCoeT (L193-L197)\ninstance hasCoeT : CoeTC R (AdjoinRoot f) :=\n\u27e8of f\u27e9\n\n/-- Two `R`-`AlgHom` from `AdjoinRoot f` to the same `R`-algebra are the same iff\nthey agree on `root f`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algHom_ext (L199-L202)\ntheorem algHom_ext [Semiring S] [Algebra R S] {g\u2081 g\u2082 : AdjoinRoot f \u2192\u2090[R] S}\n (h : g\u2081 (root f) = g\u2082 (root f)) : g\u2081 = g\u2082 :=\nIdeal.Quotient.algHom_ext R <| Polynomial.algHom_ext h\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_eq_mk (L204-L206)\ntheorem mk_eq_mk {g h : R[X]} : mk f g = mk f h \u2194 f \u2223 g - h :=\nIdeal.Quotient.eq.trans Ideal.mem_span_singleton\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_eq_zero (L208-L210)\ntheorem mk_eq_zero {g : R[X]} : mk f g = 0 \u2194 f \u2223 g :=\nmk_eq_mk.trans <| by rw [sub_zero]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_self (L212-L214)\ntheorem mk_self : mk f f = 0 :=\nQuotient.sound' <| QuotientAddGroup.leftRel_apply.mpr (mem_span_singleton.2 <| by simp)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_C (L216-L218)\ntheorem mk_C (x : R) : mk f (C x) = x :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_X (L220-L222)\ntheorem mk_X : mk f X = root f :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_ne_zero_of_degree_lt (L223-L226)\ntheorem mk_ne_zero_of_degree_lt (hf : Monic f) {g : R[X]} (h0 : g \u2260 0) (hd : degree g < degree f) :\n mk f g \u2260 0 :=\nmk_eq_zero.not.2 <| hf.not_dvd_of_degree_lt h0 hd\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.RingTheory.AdjoinRoot).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma liftAlgHom_of (i : R \u2192\u2090[S] T) (x : T) (h) (r : R) : liftAlgHom p i x h (of p r) = i r\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.AdjoinRoot (L62-L72)\ndef AdjoinRoot [CommRing R] (f : R[X]) : Type _ :=\nPolynomial R \u29f8 (span {f} : Ideal R[X])\n\nnamespace AdjoinRoot\n\nsection CommRing\n\nvariable [CommRing R] (f g : R[X])\n\nderiving instance CommRing, Inhabited for AdjoinRoot\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk (L83-L85)\ndef mk : R[X] \u2192+* AdjoinRoot f :=\nIdeal.Quotient.mk _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.induction_on (L87-L91)\ntheorem induction_on {C : AdjoinRoot f \u2192 Prop} (x : AdjoinRoot f) (ih : \u2200 p : R[X], C (mk f p)) :\n C x :=\nQuotient.inductionOn' x ih\n\n/-- Embedding of the original ring `R` into `AdjoinRoot f`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.of (L92-L94)\ndef of : R \u2192+* AdjoinRoot f :=\n(mk f).comp C\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.instSMulAdjoinRoot (L95-L97)\ninstance instSMulAdjoinRoot [DistribSMul S R] [IsScalarTower S R R] : SMul S (AdjoinRoot f) :=\ninferInstanceAs <| SMul S (_ \u29f8 _)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.smul_mk (L102-L105)\ntheorem smul_mk [DistribSMul S R] [IsScalarTower S R R] (a : S) (x : R[X]) :\n a \u2022 mk f x = mk f (a \u2022 x) :=\nrfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.smul_of (L106-L108)\ntheorem smul_of [DistribSMul S R] [IsScalarTower S R R] (a : S) (x : R) :\n a \u2022 of f x = of f (a \u2022 x) := by rw [of, RingHom.comp_apply, RingHom.comp_apply, smul_mk, smul_C]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.isScalarTower_right (L119-L122)\ninstance isScalarTower_right [DistribSMul S R] [IsScalarTower S R R] :\n IsScalarTower S (AdjoinRoot f) (AdjoinRoot f) :=\ninferInstanceAs <| IsScalarTower S (_ \u29f8 _) (_ \u29f8 _)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk\u2090 (L134-L136)\ndef mk\u2090 : R[X] \u2192\u2090[R] AdjoinRoot f :=\nIdeal.Quotient.mk\u2090 R _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algebraMap_eq (L142-L145)\ntheorem algebraMap_eq : algebraMap R (AdjoinRoot f) = of f :=\nrfl\n\nvariable (S) in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algebraMap_eq' (L146-L149)\ntheorem algebraMap_eq' [CommSemiring S] [Algebra S R] :\n algebraMap S (AdjoinRoot f) = (of f).comp (algebraMap S R) :=\nrfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.finiteType (L150-L153)\ninstance finiteType [CommSemiring S] [Algebra S R] [FiniteType S R] :\n FiniteType S (AdjoinRoot f) :=\ninferInstanceAs <| FiniteType S (_ \u29f8 (_ : Ideal R[X]))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.finitePresentation (L154-L158)\ninstance finitePresentation [CommRing S] [Algebra S R] [FinitePresentation S R] :\n FinitePresentation S (AdjoinRoot f) :=\n.quotient (Submodule.fg_span_singleton f)\n\n/-- The adjoined root. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.root (L159-L166)\ndef root : AdjoinRoot f :=\nmk f X\n\nsection Algebra\nvariable [CommSemiring S] [Semiring T] [Algebra S R] [Algebra S T] (p : R[X])\n\nvariable (S) in\n/-- Embedding of the original ring `R` into `AdjoinRoot p`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.ofAlgHom (L167-L168)\nabbrev ofAlgHom : R \u2192\u2090[S] AdjoinRoot p := Algebra.algHom S R <| AdjoinRoot p\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.ringHom_ext (L176-L182)\nlemma ringHom_ext {f g : AdjoinRoot p \u2192+* T} (hAlg : f.comp (of p) = g.comp (of p))\n (hRoot : f (root p) = g (root p)) : f = g := by\napply Ideal.Quotient.ringHom_ext\n ext x\n \u00b7 simpa using congr($(hAlg) x)\n \u00b7 simpa\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algHom_ext' (L184-L192)\nlemma algHom_ext' {f g : AdjoinRoot p \u2192\u2090[S] T}\n (hAlg : f.comp (ofAlgHom S p) = g.comp (ofAlgHom S p))\n (hRoot : f (root p) = g (root p)) : f = g := by\napply AlgHom.coe_ringHom_injective; exact ringHom_ext congr(($hAlg).toRingHom) hRoot\n\nend Algebra\n\nvariable {f g}\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.hasCoeT (L193-L197)\ninstance hasCoeT : CoeTC R (AdjoinRoot f) :=\n\u27e8of f\u27e9\n\n/-- Two `R`-`AlgHom` from `AdjoinRoot f` to the same `R`-algebra are the same iff\nthey agree on `root f`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.algHom_ext (L199-L202)\ntheorem algHom_ext [Semiring S] [Algebra R S] {g\u2081 g\u2082 : AdjoinRoot f \u2192\u2090[R] S}\n (h : g\u2081 (root f) = g\u2082 (root f)) : g\u2081 = g\u2082 :=\nIdeal.Quotient.algHom_ext R <| Polynomial.algHom_ext h\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_eq_mk (L204-L206)\ntheorem mk_eq_mk {g h : R[X]} : mk f g = mk f h \u2194 f \u2223 g - h :=\nIdeal.Quotient.eq.trans Ideal.mem_span_singleton\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_eq_zero (L208-L210)\ntheorem mk_eq_zero {g : R[X]} : mk f g = 0 \u2194 f \u2223 g :=\nmk_eq_mk.trans <| by rw [sub_zero]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_self (L212-L214)\ntheorem mk_self : mk f f = 0 :=\nQuotient.sound' <| QuotientAddGroup.leftRel_apply.mpr (mem_span_singleton.2 <| by simp)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_C (L216-L218)\ntheorem mk_C (x : R) : mk f (C x) = x :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_X (L220-L222)\ntheorem mk_X : mk f X = root f :=\nrfl\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.AdjoinRoot.mk_ne_zero_of_degree_lt (L223-L226)\ntheorem mk_ne_zero_of_degree_lt (hf : Monic f) {g : R[X]} (h0 : g \u2260 0) (hd : degree g < degree f) :\n mk f g \u2260 0 :=\nmk_eq_zero.not.2 <| hf.not_dvd_of_degree_lt h0 hd\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/AdjoinRoot.lean", "module": "Mathlib.RingTheory.AdjoinRoot", "declaration": "Mathlib.RingTheory.AdjoinRoot.liftAlgHom_of", "span": "L313-L315", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/AdjoinRoot.lean#L313"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 2341, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 5995, "lean_code_chars": 4902, "natural_language_chars": 1093, "lean_code_ratio": 0.8177, "line_count": 222, "imports_count": 0, "declarations_count": 702, "diagnostics_count": 0, "retrieval_snippets_count": 25, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "ba62b8a75278ff3f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Category.Profinite.Nobeling.Successor.Linear_CC'\u2080", "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.Topology.Category.Profinite.Nobeling.Successor)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef Linear_CC'\u2080 : LocallyConstant C \u2124 \u2192\u2097[\u2124] LocallyConstant (C' C ho) \u2124\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C0 (L95-L97)\ndef C0 := C \u2229 {f | f (term I ho) = false}\n/-- The subset of `C` consisting of those elements whose `o`-th entry is `true`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C1 (L98-L100)\ndef C1 := C \u2229 {f | f (term I ho) = true}\ninclude hC in\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.isClosed_C0 (L101-L106)\ntheorem isClosed_C0 : IsClosed (C0 C ho) := by\nrefine hC.inter ?_\n have h : Continuous (fun (f : I \u2192 Bool) \u21a6 f (term I ho)) := continuous_apply (term I ho)\n exact IsClosed.preimage h (t := {false}) (isClosed_discrete _)\n\ninclude hC in\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.isClosed_C1 (L107-L111)\ntheorem isClosed_C1 : IsClosed (C1 C ho) := by\nrefine hC.inter ?_\n have h : Continuous (fun (f : I \u2192 Bool) \u21a6 f (term I ho)) := continuous_apply (term I ho)\n exact IsClosed.preimage h (t := {true}) (isClosed_discrete _)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.contained_C1 (L112-L114)\ntheorem contained_C1 : contained (\u03c0 (C1 C ho) (ord I \u00b7 < o)) o :=\ncontained_proj _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.union_C0C1_eq (L115-L123)\ntheorem union_C0C1_eq : (C0 C ho) \u222a (C1 C ho) = C := by\next x\n simp only [C0, C1, Set.mem_union, Set.mem_inter_iff, Set.mem_setOf_eq,\n \u2190 and_or_left, and_iff_left_iff_imp, Bool.dichotomy (x (term I ho)), implies_true]\n\n/--\nThe intersection of `C0` and the projection of `C1`. We will apply the inductive hypothesis to\nthis set.\n-/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C' (L124-L126)\ndef C' := C0 C ho \u2229 \u03c0 (C1 C ho) (ord I \u00b7 < o)\ninclude hC in\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.isClosed_C' (L127-L129)\ntheorem isClosed_C' : IsClosed (C' C ho) :=\nIsClosed.inter (isClosed_C0 _ hC _) (isClosed_proj _ _ (isClosed_C1 _ hC _))\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.contained_C' (L130-L135)\ntheorem contained_C' : contained (C' C ho) o := fun f hf i hi \u21a6 contained_C1 C ho f hf.2 i hi\nvariable (o)\n\n/-- Swapping the `o`-th coordinate to `true`. -/\nnoncomputable\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.SwapTrue (L136-L138)\ndef SwapTrue : (I \u2192 Bool) \u2192 I \u2192 Bool :=\nfun f i \u21a6 if ord I i = o then true else f i\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.continuous_swapTrue (L139-L149)\ntheorem continuous_swapTrue : Continuous (SwapTrue o : (I \u2192 Bool) \u2192 I \u2192 Bool) := by\ndsimp +unfoldPartialApp [SwapTrue]\n apply continuous_pi\n intro i\n apply Continuous.comp'\n \u00b7 apply continuous_bot\n \u00b7 apply continuous_apply\n\nvariable {o}\n\ninclude hsC in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.swapTrue_mem_C1 (L150-L165)\ntheorem swapTrue_mem_C1 (f : \u03c0 (C1 C ho) (ord I \u00b7 < o)) :\n SwapTrue o f.val \u2208 C1 C ho := by\nobtain \u27e8f, g, hg, rfl\u27e9 := f\n convert hg\n dsimp +unfoldPartialApp [SwapTrue]\n ext i\n split_ifs with h\n \u00b7 rw [ord_term ho] at h\n simpa only [\u2190 h] using hg.2.symm\n \u00b7 simp only [Proj, ite_eq_left_iff, not_lt, @eq_comm _ false, \u2190 Bool.not_eq_true]\n specialize hsC g hg.1 i\n intro h'\n contrapose! hsC\n exact \u27e8hsC, Order.succ_le_of_lt (h'.lt_of_ne' h)\u27e9\n\n/-- The first way to map `C'` into `C`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC'\u2080 (L166-L169)\ndef CC'\u2080 : C' C ho \u2192 C := fun g \u21a6 \u27e8g.val,g.prop.1.1\u27e9\n/-- The second way to map `C'` into `C`. -/\nnoncomputable\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC'\u2081 (L170-L172)\ndef CC'\u2081 : C' C ho \u2192 C :=\nfun g \u21a6 \u27e8SwapTrue o g.val, (swapTrue_mem_C1 C hsC ho \u27e8g.val,g.prop.2\u27e9).1\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.continuous_CC'\u2080 (L173-L174)\ntheorem continuous_CC'\u2080 : Continuous (CC'\u2080 C ho) := Continuous.subtype_mk continuous_subtype_val _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.continuous_CC'\u2081 (L175-L179)\ntheorem continuous_CC'\u2081 : Continuous (CC'\u2081 C hsC ho) :=\nContinuous.subtype_mk (Continuous.comp (continuous_swapTrue o) continuous_subtype_val) _\n\n/-- The `\u2124`-linear map induced by precomposing with `CC'\u2080` -/\nnoncomputable\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.Linear_CC'\u2081 (L185-L189)\ndef Linear_CC'\u2081 : LocallyConstant C \u2124 \u2192\u2097[\u2124] LocallyConstant (C' C ho) \u2124 :=\nLocallyConstant.comap\u2097 \u2124 \u27e8(CC'\u2081 C hsC ho), (continuous_CC'\u2081 C hsC ho)\u27e9\n\n/-- The difference between `Linear_CC'\u2081` and `Linear_CC'\u2080`. -/\nnoncomputable\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.Linear_CC' (L190-L192)\ndef Linear_CC' : LocallyConstant C \u2124 \u2192\u2097[\u2124] LocallyConstant (C' C ho) \u2124 :=\nLinear_CC'\u2081 C hsC ho - Linear_CC'\u2080 C ho\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC_comp_zero (L193-L206)\ntheorem CC_comp_zero : \u2200 y, (Linear_CC' C hsC ho) ((\u03c0s C o) y) = 0 := by\nintro y\n ext x\n dsimp [Linear_CC', Linear_CC'\u2080, Linear_CC'\u2081, LocallyConstant.sub_apply]\n simp only [sub_eq_zero]\n congr 1\n ext i\n dsimp [CC'\u2080, CC'\u2081, ProjRestrict, Proj]\n apply if_ctx_congr Iff.rfl _ (fun _ \u21a6 rfl)\n simp only [SwapTrue, ite_eq_right_iff]\n intro h\u2081 h\u2082\n exact (h\u2081.ne h\u2082).elim\n\ninclude hsC in\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C0_projOrd (L207-L220)\ntheorem C0_projOrd {x : I \u2192 Bool} (hx : x \u2208 C0 C ho) : Proj (ord I \u00b7 < o) x = x := by\next i\n simp only [Proj, ite_eq_left_iff, not_lt]\n intro hi\n rcases hi.lt_or_eq with hi | hi\n \u00b7 specialize hsC x hx.1 i\n rw [\u2190 not_imp_not] at hsC\n simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC\n exact (hsC hi).symm\n \u00b7 simp only [C0, Set.mem_inter_iff, Set.mem_setOf_eq] at hx\n rw [eq_comm, ord_term ho] at hi\n rw [\u2190 hx.2, hi]\n\ninclude hsC in\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C1_projOrd (L221-L236)\ntheorem C1_projOrd {x : I \u2192 Bool} (hx : x \u2208 C1 C ho) : SwapTrue o (Proj (ord I \u00b7 < o) x) = x := by\next i\n dsimp [SwapTrue, Proj]\n split_ifs with hi h\n \u00b7 rw [ord_term ho] at hi\n rw [\u2190 hx.2, hi]\n \u00b7 rfl\n \u00b7 simp only [not_lt] at h\n have h' : o < ord I i := lt_of_le_of_ne h (Ne.symm hi)\n specialize hsC x hx.1 i\n rw [\u2190 not_imp_not] at hsC\n simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC\n exact (hsC h').symm\n\ninclude hC in\nopen scoped Classical in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC_exact (L237-L271)\ntheorem CC_exact {f : LocallyConstant C \u2124} (hf : Linear_CC' C hsC ho f = 0) :\n \u2203 y, \u03c0s C o y = f := by\ndsimp [Linear_CC', Linear_CC'\u2080, Linear_CC'\u2081] at hf\n simp only [sub_eq_zero, \u2190 LocallyConstant.coe_inj] at hf\n let C\u2080C : C0 C ho \u2192 C := fun x \u21a6 \u27e8x.val, x.prop.1\u27e9\n have h\u2080 : Continuous C\u2080C := Continuous.subtype_mk continuous_induced_dom _\n let C\u2081C : \u03c0 (C1 C ho) (ord I \u00b7 < o) \u2192 C :=\n fun x \u21a6 \u27e8SwapTrue o x.val, (swapTrue_mem_C1 C hsC ho x).1\u27e9\n have h\u2081 : Continuous C\u2081C := Continuous.subtype_mk\n ((continuous_swapTrue o).comp continuous_subtype_val) _\n refine \u27e8LocallyConstant.piecewise' ?_ (isClosed_C0 C hC ho)\n (isClosed_proj _ o (isClosed_C1 C hC ho)) (f.comap \u27e8C\u2080C, h\u2080\u27e9) (f.comap \u27e8C\u2081C, h\u2081\u27e9) ?_, ?_\u27e9\n \u00b7 rintro _ \u27e8y, hyC, rfl\u27e9\n simp only [Set.mem_union]\n rw [\u2190 union_C0C1_eq C ho] at hyC\n refine hyC.imp (fun hyC \u21a6 ?_) (fun hyC \u21a6 \u27e8y, hyC, rfl\u27e9)\n rwa [C0_projOrd C hsC ho hyC]\n \u00b7 intro x hx\n simpa only [h\u2080, h\u2081, LocallyConstant.coe_comap] using (congrFun hf \u27e8x, hx\u27e9).symm\n \u00b7 ext \u27e8x, hx\u27e9\n rw [\u2190 union_C0C1_eq C ho] at hx\n rcases hx with hx\u2080 | hx\u2081\n \u00b7 have hx\u2080' : ProjRestrict C (ord I \u00b7 < o) \u27e8x, hx\u27e9 = x := by\n simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using C0_projOrd C hsC ho hx\u2080\n simp only [C\u2080C, \u03c0s_apply_apply, hx\u2080', hx\u2080, LocallyConstant.piecewise'_apply_left,\n LocallyConstant.coe_comap, ContinuousMap.coe_mk, Function.comp_apply]\n \u00b7 have hx\u2081' : (ProjRestrict C (ord I \u00b7 < o) \u27e8x, hx\u27e9).val \u2208 \u03c0 (C1 C ho) (ord I \u00b7 < o) := by\n simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using \u27e8x, hx\u2081, rfl\u27e9\n simp only [C\u2081C, \u03c0s_apply_apply, LocallyConstant.coe_comap,\n Function.comp_apply, hx\u2081', LocallyConstant.piecewise'_apply_right]\n congr\n simp only [ContinuousMap.coe_mk, Subtype.mk.injEq]\n exact C1_projOrd C hsC ho hx\u2081\n\nvariable (o) in\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.succ_mono (L272-L276)\ntheorem succ_mono : CategoryTheory.Mono (ModuleCat.ofHom (\u03c0s C o)) := by\nrw [ModuleCat.mono_iff_injective]\n exact injective_\u03c0s _ _\n\ninclude hC in\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.succ_exact (L277-L291)\ntheorem succ_exact :\n (ShortComplex.mk (ModuleCat.ofHom (\u03c0s C o)) (ModuleCat.ofHom (Linear_CC' C hsC ho))\n (by ext : 2; apply CC_comp_zero)).Exact := by\nrw [ShortComplex.moduleCat_exact_iff]\n intro f\n exact CC_exact C hC hsC ho\n\nend ExactSequence\n\nnamespace GoodProducts\n\n/--\nThe `GoodProducts` in `C` that contain `o` (they necessarily start with `o`, see\n`GoodProducts.head!_eq_o_of_maxProducts`)\n-/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.MaxProducts (L292-L294)\ndef MaxProducts : Set (Products I) := {l | l.isGood C \u2227 term I ho \u2208 l.val}\ninclude hsC in\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isClosedMap (L221-L224)\ntheorem isClosedMap {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) : IsClosedMap f := fun _ hC =>\n(hC.isCompact.image f.hom.hom.continuous).isClosed\n\n/-- Any continuous bijection of compact Hausdorff spaces is an isomorphism. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.Sigma (L161-L170)\nlemma Sigma.isOpenEmbedding_\u03b9 (a : \u03b1) :\n IsOpenEmbedding (Sigma.\u03b9 X a) := by\nrefine IsOpenEmbedding.of_comp _ (homeoOfIso ((colimit.isColimit _).coconePointUniqueUpToIso\n (finiteCoproduct.isColimit X))).isOpenEmbedding ?_\n convert finiteCoproduct.isOpenEmbedding_\u03b9 X a\n ext x\n change (Sigma.\u03b9 X a \u226b _) x = _\n simp\n\n/-- The functor to `TopCat` preserves finite coproducts if they exist. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.homeoOfIso (L256-L260)\ndef homeoOfIso {X Y : CompHausLike.{u} P} (f : X \u2245 Y) : X \u2243\u209c Y :=\nTopCat.homeoOfIso <| (compHausLikeToTop P).mapIso f\n\n/-- The equivalence between isomorphisms in `CompHaus` and homeomorphisms\nof topological spaces. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.ofHom (L67-L68)\nabbrev ofHom (f : C(X, Y)) : of X \u27f6 of Y := ConcreteCategory.ofHom f\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.coe_id (L123-L125)\ntheorem coe_id (X : CompHausLike P) : (\ud835\udfd9 X : X \u2192 X) = id :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.of (L114-L119)\nabbrev of : CompHausLike P where\n toTop := TopCat.of X\nis_compact := \u2039_\u203a\n is_hausdorff := \u2039_\u203a\n prop := HasProp.hasProp\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Category.Compactum.incl (L132-L134)\ndef incl (X : Compactum) : X \u2192 Ultrafilter X :=\n(\u03b2).\u03b7.app _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.hasPullbacksOfInclusions (L335-L350)\ntheorem hasPullbacksOfInclusions\n (hP' : \u2200 \u2983X Y B : CompHausLike.{u} P\u2984 (f : X \u27f6 B) (g : Y \u27f6 B)\n (_ : IsOpenEmbedding f), HasExplicitPullback f g) :\n HasExplicitPullbacksOfInclusions P :=\n{ hasProp := by\n intro _ _ _ f\n apply hP'\n exact Sigma.isOpenEmbedding_\u03b9 _ _ }\n\n/-- The functor to `TopCat` preserves pullbacks of inclusions if they exist. -/\nnoncomputable instance [HasExplicitPullbacksOfInclusions P] :\n PreservesPullbacksOfInclusions (compHausLikeToTop P) :=\n { preservesPullbackInl := by\n intro X Y Z f\n infer_instance }\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.isoOfHomeo (L86-L96)\ndef isoOfHomeo {X Y : CompactlyGenerated.{u, w}} (f : X \u2243\u209c Y) : X \u2245 Y where\n hom := ofHom \u27e8f, f.continuous\u27e9\ninv := ofHom \u27e8f.symm, f.symm.continuous\u27e9\n hom_inv_id := by\n ext x\n exact f.symm_apply_apply x\n inv_hom_id := by\n ext x\n exact f.apply_symm_apply x\n\n/-- Construct a homeomorphism from an isomorphism. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.toCompHausLike (L152-L158)\ndef toCompHausLike {P P' : TopCat \u2192 Prop} (h : \u2200 (X : CompHausLike P), P X.toTop \u2192 P' X.toTop) :\n CompHausLike P \u2964 CompHausLike P' where\n obj X :=\nhaveI : HasProp P' X := \u27e8(h _ X.prop)\u27e9\n CompHausLike.of _ X\n map {X Y} f := ConcreteCategory.ofHom f.hom.hom\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Category.Compactum.str_hom_commute (L142-L147)\ntheorem str_hom_commute (X Y : Compactum) (f : X \u27f6 Y) (xs : Ultrafilter X) :\n f (X.str xs) = Y.str (map f xs) := by\nchange (X.a \u226b f.f) _ = _\n rw [\u2190 f.h]\n rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.compHausLikeToCompHaus (L217-L218)\nabbrev compHausLikeToCompHaus (P : TopCat \u2192 Prop) : CompHausLike P \u2964 CompHaus :=\nCompHausLike.toCompHausLike (by simp only [implies_true])\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Category.Compactum.free (L101-L104)\ndef free : Type* \u2964 Compactum :=\nMonad.free _\n\n/-- The adjunction between `free` and `forget`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.homeoOfIso (L98-L107)\ndef homeoOfIso {X Y : CompactlyGenerated.{u, w}} (f : X \u2245 Y) : X \u2243\u209c Y where\n toFun := f.hom\ninvFun := f.inv\n left_inv := f.hom_inv_id_apply\n right_inv := f.inv_hom_id_apply\n continuous_toFun := f.hom.hom.hom.continuous\n continuous_invFun := f.inv.hom.hom.continuous\n\n/-- The equivalence between isomorphisms in `CompactlyGenerated` and homeomorphisms\nof topological spaces. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Category.CompHausLike.EffectiveEpi.effectiveEpiStruct (L36-L63)\ndef effectiveEpiStruct {B X : CompHausLike P} (\u03c0 : X \u27f6 B) (h\u03c0 : Function.Surjective \u03c0) :\n EffectiveEpiStruct \u03c0 where\n desc e h :=\nofHom _ ((IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).lift e.hom.hom\n fun a b hab \u21a6\n CategoryTheory.congr_fun (h\n (ofHom _ \u27e8fun _ \u21a6 a, continuous_const\u27e9)\n (ofHom _ \u27e8fun _ \u21a6 b, continuous_const\u27e9)\n (by ext; exact hab)) a)\n fac e h :=\n InducedCategory.hom_ext (TopCat.hom_ext\n ((IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).lift_comp _ _))\n uniq e h g hm := by\n suffices g = ofHom _\n ((IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).liftEquiv \u27e8e.hom.hom,\n fun a b hab \u21a6 CategoryTheory.congr_fun\n (h\n (ofHom _ \u27e8fun _ \u21a6 a, continuous_const\u27e9)\n (ofHom _ \u27e8fun _ \u21a6 b, continuous_const\u27e9)\n (by ext; exact hab))\n a\u27e9) by assumption\n apply ConcreteCategory.ext\n rw [hom_ofHom, \u2190 Equiv.symm_apply_eq\n (IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).liftEquiv]\n ext\n simp only [IsQuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, \u2190 hm]\n rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Category.Compactum.str_eq_of_le_nhds (L272-L341)\ntheorem str_eq_of_le_nhds {X : Compactum} (F : Ultrafilter X) (x : X) : \u2191F \u2264 \ud835\udcdd x \u2192 X.str F = x := by\n-- Notation to be used in this proof.\n let fsu := Finset (Set (Ultrafilter X))\n let ssu := Set (Set (Ultrafilter X))\n let \u03b9 : fsu \u2192 ssu := fun x \u21a6 \u2191x\n let T0 : ssu := { S | \u2203 A \u2208 F, S = basic A }\n let AA := X.str \u207b\u00b9' {x}\n let T1 := insert AA T0\n let T2 := finiteInterClosure T1\n intro cond\n -- If F contains a closed set A, then x is contained in A.\n have claim1 : \u2200 A : Set X, IsClosed A \u2192 A \u2208 F \u2192 x \u2208 A := by\n intro A hA h\n by_contra H\n rw [le_nhds_iff] at cond\n specialize cond A\u1d9c H hA.isOpen_compl\n rw [Ultrafilter.mem_coe, Ultrafilter.compl_mem_iff_notMem] at cond\n contradiction\n -- If A \u2208 F, then x \u2208 cl A.\n have claim2 : \u2200 A : Set X, A \u2208 F \u2192 x \u2208 cl A := by\n intro A hA\n exact claim1 (cl A) (isClosed_cl A) (mem_of_superset hA (subset_cl A))\n -- T0 is closed under intersections.\n have claim3 : \u2200 (S1) (_ : S1 \u2208 T0) (S2) (_ : S2 \u2208 T0), S1 \u2229 S2 \u2208 T0 := by\n rintro S1 \u27e8S1, hS1, rfl\u27e9 S2 \u27e8S2, hS2, rfl\u27e9\n exact \u27e8S1 \u2229 S2, inter_mem hS1 hS2, by simp [basic_inter]\u27e9\n -- For every S \u2208 T0, the intersection AA \u2229 S is nonempty.\n have claim4 : \u2200 S \u2208 T0, (AA \u2229 S).Nonempty := by\n rintro S \u27e8S, hS, rfl\u27e9\n rcases claim2 _ hS with \u27e8G, hG, hG2\u27e9\n exact \u27e8G, hG2, hG\u27e9\n -- Every element of T0 is nonempty.\n have claim5 : \u2200 S \u2208 T0, Set.Nonempty S := by\n rintro S \u27e8S, hS, rfl\u27e9\n exact \u27e8F, hS\u27e9\n -- Every element of T2 is nonempty.\n have claim6 : \u2200 S \u2208 T2, Set.Nonempty S := by\n suffices \u2200 S \u2208 T2, S \u2208 T0 \u2228 \u2203 Q \u2208 T0, S = AA \u2229 Q by\n intro S hS\n rcases this _ hS with h | h\n \u00b7 exact claim5 S h\n \u00b7 rcases h with \u27e8Q, hQ, rfl\u27e9\n exact claim4 Q hQ\n intro S hS\n apply finiteInterClosure_insert\n \u00b7 constructor\n \u00b7 use Set.univ\n refine \u27e8Filter.univ_sets _, ?_\u27e9\n ext\n refine \u27e8?_, by tauto\u27e9\n \u00b7 intro\n apply Filter.univ_sets\n \u00b7 exact claim3\n \u00b7 exact hS\n -- It suffices to show that the intersection of any finite subset of T1 is nonempty.\n suffices \u2200 F : fsu, \u2191F \u2286 T1 \u2192 (\u22c2\u2080 \u03b9 F).Nonempty by\n obtain \u27e8G, h1\u27e9 := Ultrafilter.exists_ultrafilter_of_finite_inter_nonempty _ this\n have c1 : X.join G = F := Ultrafilter.coe_le_coe.1 fun P hP => h1 (Or.inr \u27e8P, hP, rfl\u27e9)\n have c2 : G.map X.str = X.incl x := by\n refine Ultrafilter.coe_le_coe.1 fun P hP => ?_\n apply mem_of_superset (h1 (Or.inl rfl))\n rintro x \u27e8rfl\u27e9\n exact hP\n simp [\u2190 c1, c2]\n -- Finish...\n intro T hT\n refine claim6 _ (finiteInter_mem (.finiteInterClosure_finiteInter _) _ ?_)\n intro t ht\n exact finiteInterClosure.basic (@hT t ht)\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.productCone (L40-L47)\ndef productCone : BinaryFan X Y :=\nBinaryFan.mk (P := CompHausLike.of P (X \u00d7 Y))\n (ofHom _ { toFun := Prod.fst }) (ofHom _ { toFun := Prod.snd })\n\n/--\nWhen the predicate `P` is preserved under taking type-theoretic products, that product is a\ncategory-theoretic product in `CompHausLike P`.\n-/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isoOfHomeo (L251-L254)\ndef isoOfHomeo {X Y : CompHausLike.{u} P} (f : X \u2243\u209c Y) : X \u2245 Y :=\n(fullyFaithfulCompHausLikeToTop P).preimageIso (TopCat.isoOfHomeo f)\n\n/-- Construct a homeomorphism from an isomorphism. -/\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isoEquivHomeo (L262-L266)\ndef isoEquivHomeo {X Y : CompHausLike.{u} P} : (X \u2245 Y) \u2243 (X \u2243\u209c Y) where\n toFun := homeoOfIso\ninvFun := isoOfHomeo\n\n/-- A constant map as a morphism in `CompHausLike` -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.fullyFaithfulCompHausLikeToTop (L187-L189)\ndef fullyFaithfulCompHausLikeToTop : (compHausLikeToTop P).FullyFaithful :=\nfullyFaithfulInducedFunctor _\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.ofHom (L137-L138)\nabbrev ofHom (f : C(X, Y)) : of P X \u27f6 of P Y := ConcreteCategory.ofHom f\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isIso_of_bijective (L225-L238)\ntheorem isIso_of_bijective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) (bij : Function.Bijective f) :\n IsIso f := by\nlet E := Equiv.ofBijective _ bij\n have hE : Continuous E.symm := by\n rw [continuous_iff_isClosed]\n intro S hS\n rw [\u2190 E.image_eq_preimage_symm]\n exact isClosedMap f S hS\n refine \u27e8\u27e8ofHom _ \u27e8E.symm, hE\u27e9, ?_, ?_\u27e9\u27e9\n \u00b7 ext x\n apply E.symm_apply_apply\n \u00b7 ext x\n apply E.apply_symm_apply\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Topology.Category.Compactum.le_nhds_of_str_eq (L342-L345)\ntheorem le_nhds_of_str_eq {X : Compactum} (F : Ultrafilter X) (x : X) : X.str F = x \u2192 \u2191F \u2264 \ud835\udcdd x :=\nfun h => le_nhds_iff.mpr fun s hx hs => hs _ <| by rwa [h]\n\n-- All the hard work above boils down to this `T2Space` instance.\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Topology.Category.CompHausLike.EffectiveEpi.preregular (L64-L74)\ntheorem preregular [HasExplicitPullbacks P]\n (hs : \u2200 \u2983X Y : CompHausLike P\u2984 (f : X \u27f6 Y), EffectiveEpi f \u2192 Function.Surjective f) :\n Preregular (CompHausLike P) where\n exists_fac := by\nintro X Y Z f \u03c0 h\u03c0\n refine \u27e8pullback f \u03c0, pullback.fst f \u03c0, \u27e8\u27e8effectiveEpiStruct _ ?_\u27e9\u27e9, pullback.snd f \u03c0,\n (pullback.condition _ _).symm\u27e9\n intro y\n obtain \u27e8z, hz\u27e9 := hs \u03c0 h\u03c0 (f y)\n exact \u27e8\u27e8(y, z), hz.symm\u27e9, rfl\u27e9\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.finiteCoproduct (L63-L67)\ndef finiteCoproduct : CompHausLike P := CompHausLike.of P (\u03a3 (a : \u03b1), X a)\n/--\nThe inclusion of one of the factors into the explicit finite coproduct.\n-/\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Topology.Category.CompHausLike.SigmaComparison.sigmaComparison (L43-L46)\ndef sigmaComparison : X.obj \u27e8(of P ((a : \u03b1) \u00d7 \u03c3 a))\u27e9 \u27f6 ((a : \u03b1) \u2192 X.obj \u27e8of P (\u03c3 a)\u27e9) :=\nfun x a \u21a6 X.map (ofHom _ \u27e8Sigma.mk a, continuous_sigmaMk\u27e9).op x\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.HasExplicitPullback (L196-L203)\nabbrev HasExplicitPullback := HasProp P { xy : X \u00d7 Y | f xy.fst = g xy.snd }\nvariable [HasExplicitPullback f g] -- (hP : P (TopCat.of { xy : X \u00d7 Y | f xy.fst = g xy.snd }))\n\n/--\nThe pullback of two morphisms `f,g` in `CompHaus`, constructed explicitly as the set of\npairs `(x,y)` such that `f x = g y`, with the topology induced by the product.\n-/\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Topology.Category.CompHausLike.EffectiveEpi.precoherent (L75-L81)\ntheorem precoherent [HasExplicitPullbacks P] [HasExplicitFiniteCoproducts.{0} P]\n (hs : \u2200 \u2983X Y : CompHausLike P\u2984 (f : X \u27f6 Y), EffectiveEpi f \u2192 Function.Surjective f) :\n Precoherent (CompHausLike P) := by\nhave : Preregular (CompHausLike P) := preregular hs\n infer_instance\n\nend CompHausLike\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.finitaryExtensive (L354-L366)\ntheorem finitaryExtensive (hP' : \u2200 \u2983X Y B : CompHausLike.{u} P\u2984 (f : X \u27f6 B) (g : Y \u27f6 B)\n (_ : IsOpenEmbedding f), HasExplicitPullback f g) :\n FinitaryExtensive (CompHausLike P) :=\nhave := hasPullbacksOfInclusions hP'\n finitaryExtensive_of_preserves_and_reflects (compHausLikeToTop P)\n\nend FiniteCoproducts\n\nsection Terminal\n\nvariable {P : TopCat.{u} \u2192 Prop}\n\n/-- A one-element space is terminal in `CompHaus` -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.stoneCechObj (L79-L112)\ndef stoneCechObj (X : TopCat) : CompHaus :=\nCompHaus.of (StoneCech X)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- (Implementation) The bijection of homsets to establish the reflective adjunction of compact\nHausdorff spaces in topological spaces.\n-/\nnoncomputable def stoneCechEquivalence (X : TopCat.{u}) (Y : CompHaus.{u}) :\n (stoneCechObj X \u27f6 Y) \u2243 (X \u27f6 compHausToTop.obj Y) where\n toFun f := TopCat.ofHom\n { toFun := f \u2218 stoneCechUnit\n continuous_toFun := f.hom.hom.2.comp (@continuous_stoneCechUnit X _) }\n invFun f := CompHausLike.ofHom _\n { toFun := stoneCechExtend f.hom.2\n continuous_toFun := continuous_stoneCechExtend f.hom.2 }\n left_inv := by\n rintro \u27e8f : StoneCech X \u27f6 Y, hf : Continuous f\u27e9\n ext x\n refine congr_fun ?_ x\n apply Continuous.ext_on denseRange_stoneCechUnit (continuous_stoneCechExtend _) hf\n \u00b7 rintro _ \u27e8y, rfl\u27e9\n apply congr_fun (stoneCechExtend_extends (hf.comp _)) y\n apply continuous_stoneCechUnit\n right_inv := by\n rintro \u27e8f : (X : Type _) \u27f6 Y, hf : Continuous f\u27e9\n ext\n exact congr_fun (stoneCechExtend_extends hf) _\n\n/-- The Stone-Cech compactification functor from topological spaces to compact Hausdorff spaces,\nleft adjoint to the inclusion functor.\n-/\nnoncomputable def topToCompHaus : TopCat.{u} \u2964 CompHaus.{u} :=\n Adjunction.leftAdjointOfEquiv stoneCechEquivalence.{u} fun _ _ _ _ _ => rfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.coe_comp (L127-L130)\ntheorem coe_comp {X Y Z : CompHausLike P} (f : X \u27f6 Y) (g : Y \u27f6 Z) :\n (f \u226b g : X \u2192 Z) = g \u2218 f :=\nrfl\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.fullyFaithfulCompactlyGeneratedToTop (L77-L79)\ndef fullyFaithfulCompactlyGeneratedToTop : compactlyGeneratedToTop.{u, w}.FullyFaithful :=\nfullyFaithfulInducedFunctor _\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.epi_iff_surjective (L181-L216)\ntheorem epi_iff_surjective {X Y : CompHaus.{u}} (f : X \u27f6 Y) : Epi f \u2194 Function.Surjective f := by\nconstructor\n \u00b7 dsimp [Function.Surjective]\n contrapose!\n rintro \u27e8y, hy\u27e9 hf\n let C := Set.range f\n have hC : IsClosed C := (isCompact_range f.hom.hom.continuous).isClosed\n let D := ({y} : Set Y)\n have hD : IsClosed D := isClosed_singleton\n have hCD : Disjoint C D := by\n rw [Set.disjoint_singleton_right]\n rintro \u27e8y', hy'\u27e9\n exact hy y' hy'\n obtain \u27e8\u03c6, h\u03c60, h\u03c61, h\u03c601\u27e9 := exists_continuous_zero_one_of_isClosed hC hD hCD\n haveI : CompactSpace (ULift.{u} <| Set.Icc (0 : \u211d) 1) := Homeomorph.ulift.symm.compactSpace\n haveI : T2Space (ULift.{u} <| Set.Icc (0 : \u211d) 1) := Homeomorph.ulift.symm.t2Space\n let Z := of (ULift.{u} <| Set.Icc (0 : \u211d) 1)\n let g : Y \u27f6 Z := ofHom _\n \u27e8fun y' => \u27e8\u27e8\u03c6 y', h\u03c601 y'\u27e9\u27e9,\n continuous_uliftUp.comp (\u03c6.continuous.subtype_mk fun y' => h\u03c601 y')\u27e9\n let h : Y \u27f6 Z := ofHom _\n \u27e8fun _ => \u27e8\u27e80, Set.left_mem_Icc.mpr zero_le_one\u27e9\u27e9, continuous_const\u27e9\n have H : h = g := by\n rw [\u2190 cancel_epi f]\n ext x : 4\n simp [g, h, Z, h\u03c60 (Set.mem_range_self x)]\n apply_fun fun e => (e y).down.1 at H\n dsimp [g, h, Z] at H\n simp only [h\u03c61 (Set.mem_singleton y), Pi.one_apply] at H\n exact zero_ne_one H\n \u00b7 rw [\u2190 CategoryTheory.epi_iff_surjective]\n apply (forget CompHaus).epi_of_epi_map\n\nend CompHaus\n\n/-- Every `CompHausLike` admits a functor to `CompHaus`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.coproductIsColimit (L86-L94)\ndef coproductIsColimit : IsColimit (coproductCocone X Y) := by\nrefine BinaryCofan.isColimitMk (fun s \u21a6 ofHom _ { toFun := Sum.elim s.inl s.inr })\n (by rfl_cat) (by rfl_cat) fun _ _ h\u2081 h\u2082 \u21a6 ?_\n ext \u27e8\u27e9\n exacts [ConcreteCategory.congr_hom h\u2081 _, ConcreteCategory.congr_hom h\u2082 _]\n\nend Coproduct\n\nend CompHausLike\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.HasExplicitFiniteCoproduct (L55-L62)\nabbrev HasExplicitFiniteCoproduct := HasProp P (\u03a3 (a : \u03b1), X a)\nvariable [HasExplicitFiniteCoproduct X]\n\n/--\nThe coproduct of a finite family of objects in `CompHaus`, constructed as the disjoint\nunion with its usual topology.\n-/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Topology.Category.CompHaus.Projective.projective_ultrafilter (L41-L57)\ninstance projective_ultrafilter (X : Type*) : Projective (of <| Ultrafilter X) where\n factors {Y Z} f g hg := by\nrw [epi_iff_surjective] at hg\n obtain \u27e8g', hg'\u27e9 := hg.hasRightInverse\n let t : X \u2192 Y := g' \u2218 f \u2218 (pure : X \u2192 Ultrafilter X)\n let h : Ultrafilter X \u2192 Y := Ultrafilter.extend t\n have hh : Continuous h := continuous_ultrafilter_extend _\n use CompHausLike.ofHom _ \u27e8h, hh\u27e9\n apply ConcreteCategory.coe_ext\n have : g.hom \u2218 g' = id := hg'.comp_eq_id\n convert denseRange_pure.equalizer (g.hom.hom.continuous.comp hh) f.hom.hom.continuous _\n -- This used to be `rw`, but we need `rw; rfl` after https://github.com/leanprover/lean4/pull/2644\n rw [comp_assoc, ultrafilter_extend_extends, \u2190 comp_assoc, this, id_comp]\n rfl\n\n/-- For any compact Hausdorff space `X`,\n the natural map `Ultrafilter X \u2192 X` is a projective presentation. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Topology.Category.Compactum.str (L124-L127)\ndef str (X : Compactum) : Ultrafilter X \u2192 X :=\nX.a\n\n/-- The monadic join. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Topology.Category.CompHausLike.SigmaComparison.isIsoSigmaComparison (L69-L73)\ninstance isIsoSigmaComparison : IsIso <| sigmaComparison X \u03c3 := by\nrw [sigmaComparison_eq_comp_isos]\n infer_instance\n\nend CompHausLike\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.category (L92-L94)\ninstance category : Category (CompHausLike P) :=\ninferInstanceAs (Category (InducedCategory _ toTop))\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.compHausLikeToTop (L178-L182)\ndef compHausLikeToTop : CompHausLike.{u} P \u2964 TopCat.{u} :=\ninducedFunctor _\n-- The `Full, Faithful` instances should be constructed by a deriving handler.\n-- https://github.com/leanprover-community/mathlib4/issues/380\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.topToCompHaus_obj (L113-L124)\ntheorem topToCompHaus_obj (X : TopCat) : \u21a5(topToCompHaus.obj X) = StoneCech X :=\nrfl\n\n/-- The category of compact Hausdorff spaces is reflective in the category of topological spaces.\n-/\nnoncomputable instance compHausToTop.reflective : Reflective compHausToTop where\n L := topToCompHaus\n adj := Adjunction.adjunctionOfEquivLeft _ _\n\nnoncomputable instance compHausToTop.createsLimits : CreatesLimits compHausToTop :=\n monadicCreatesLimits _\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.coproductCocone (L79-L85)\ndef coproductCocone : BinaryCofan X Y := BinaryCofan.mk (P := CompHausLike.of P (X \u2295 Y))\n(ofHom _ { toFun := Sum.inl }) (ofHom _ { toFun := Sum.inr })\n\n/--\nWhen the predicate `P` is preserved under taking type-theoretic sums, that sum is a\ncategory-theoretic coproduct in `CompHausLike P`.\n-/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.const_comp (L271-L275)\nlemma const_comp {P : TopCat.{u} \u2192 Prop} {S T U : CompHausLike.{u} P}\n (s : S) (g : S \u27f6 U) : T.const s \u226b g = T.const (g s) :=\nrfl\n\nend CompHausLike\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Topology.Category.Compactum.forget (L91-L93)\ndef forget : Compactum \u2964 Type* :=\nMonad.forget _\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Topology.Category.Compactum.adj (L105-L107)\ndef adj : free \u22a3 forget :=\nMonad.adj _\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.of (L58-L61)\nabbrev of : CompactlyGenerated.{u, w} where\n toTop := TopCat.of X\nis_compactly_generated := \u2039_\u203a\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.limitConeIsLimit (L171-L180)\ndef limitConeIsLimit {J : Type v} [SmallCategory J] (F : J \u2964 CompHaus.{max v u}) :\n Limits.IsLimit.{v} (limitCone.{v, u} F) :=\nletI FF : J \u2964 TopCat := F \u22d9 compHausToTop\n { lift := fun S => InducedCategory.homMk\n ((TopCat.limitConeIsLimit FF).lift (compHausToTop.mapCone S))\n uniq := fun S m hm => InducedCategory.hom_ext\n ((TopCat.limitConeIsLimit FF).uniq (compHausToTop.mapCone S) _ (fun j \u21a6 by\n simp [\u2190 hm]\n rfl)) }\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Topology.Category.Compactum.isClosed_iff (L162-L175)\ntheorem isClosed_iff {X : Compactum} (S : Set X) :\n IsClosed S \u2194 \u2200 F : Ultrafilter X, S \u2208 F \u2192 X.str F \u2208 S := by\nrw [\u2190 isOpen_compl_iff]\n constructor\n \u00b7 intro cond F h\n by_contra c\n specialize cond F c\n rw [compl_mem_iff_notMem] at cond\n contradiction\n \u00b7 intro h1 F h2\n specialize h1 F\n rcases F.mem_or_compl_mem S with h | h\n exacts [absurd (h1 h) h2, h]\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Topology.Category.Compactum.str_incl (L136-L140)\ntheorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by\nchange ((\u03b2).\u03b7.app _ \u226b X.a) _ = _\n rw [Monad.Algebra.unit]\n rfl\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.forget_reflectsIsomorphisms (L239-L249)\ninstance forget_reflectsIsomorphisms :\n (forget (CompHausLike.{u} P)).ReflectsIsomorphisms :=\n\u27e8by intro A B f hf; rw [isIso_iff_bijective] at hf; exact isIso_of_bijective _ hf\u27e9\n\n/-- Any continuous bijection of compact Hausdorff spaces induces an isomorphism. -/\nnoncomputable def isoOfBijective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y)\n (bij : Function.Bijective f) : X \u2245 Y :=\n letI := isIso_of_bijective _ bij\n asIso f\n\n/-- Construct an isomorphism from a homeomorphism. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.limitCone (L135-L170)\ndef limitCone {J : Type v} [SmallCategory J] (F : J \u2964 CompHaus.{max v u}) : Limits.Cone F :=\nletI FF : J \u2964 TopCat := F \u22d9 compHausToTop\n { pt := {\n toTop := (TopCat.limitCone FF).pt\n is_compact := by\n change CompactSpace { u : \u2200 j, F.obj j | \u2200 {i j : J} (f : i \u27f6 j), (F.map f) (u i) = u j }\n rw [\u2190 isCompact_iff_compactSpace]\n apply IsClosed.isCompact\n have :\n { u : \u2200 j, F.obj j | \u2200 {i j : J} (f : i \u27f6 j), F.map f (u i) = u j } =\n \u22c2 (i : J) (j : J) (f : i \u27f6 j), { u | F.map f (u i) = u j } := by\n ext1\n simp only [Set.mem_iInter, Set.mem_setOf_eq]\n rw [this]\n apply isClosed_iInter\n intro i\n apply isClosed_iInter\n intro j\n apply isClosed_iInter\n intro f\n apply isClosed_eq\n \u00b7 exact ((F.map f).hom.hom.continuous).comp (continuous_apply i)\n \u00b7 exact continuous_apply j\n is_hausdorff :=\n show T2Space { u : \u2200 j, F.obj j | \u2200 {i j : J} (f : i \u27f6 j), (F.map f) (u i) = u j } from\n inferInstance\n prop := trivial }\n \u03c0 := {\n app := fun j => InducedCategory.homMk ((TopCat.limitCone FF).\u03c0.app j)\n naturality := by\n intro _ _ f\n ext \u27e8x, hx\u27e9\n simp only [Functor.const_obj_map]\n exact (hx f).symm } }\n\n/-- The limit cone `CompHaus.limitCone F` is indeed a limit cone. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.productIsLimit (L48-L61)\ndef productIsLimit : IsLimit (productCone X Y) := by\nrefine BinaryFan.isLimitMk (fun s \u21a6 ofHom _ { toFun x := (s.fst x, s.snd x) })\n (by rfl_cat) (by rfl_cat) fun _ _ h\u2081 h\u2082 \u21a6 ?_\n ext x\n exacts [ConcreteCategory.congr_hom h\u2081 _, ConcreteCategory.congr_hom h\u2082 _]\n\n/--\nWhen the predicate `P` is preserved under taking type-theoretic products and `PUnit` satisfies it,\nthen `CompHausLike P` is a cartesian monoidal category.\n\nThis could be an instance but that causes some slowness issues with typeclass search, therefore we\nkeep it as a def and turn it on as an instance for the explicit examples of `CompHausLike` as\nneeded.\n-/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.concreteCategory (L95-L97)\ninstance concreteCategory : ConcreteCategory (CompHausLike P) (C(\u00b7, \u00b7)) :=\nInducedCategory.concreteCategory toTop\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.mono_iff_injective (L209-L220)\ntheorem mono_iff_injective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) :\n Mono f \u2194 Function.Injective f := by\nconstructor\n \u00b7 intro hf x\u2081 x\u2082 h\n let g\u2081 : X \u27f6 X := ofHom _ \u27e8fun _ => x\u2081, continuous_const\u27e9\n let g\u2082 : X \u27f6 X := ofHom _ \u27e8fun _ => x\u2082, continuous_const\u27e9\n have : g\u2081 \u226b f = g\u2082 \u226b f := by ext; exact h\n exact CategoryTheory.congr_fun ((cancel_mono _).mp this) x\u2081\n \u00b7 rw [\u2190 CategoryTheory.mono_iff_injective]\n apply (forget (CompHausLike P)).mono_of_mono_map\n\n/-- Any continuous function on compact Hausdorff spaces is a closed map. -/\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.isoEquivHomeo (L109-L113)\ndef isoEquivHomeo {X Y : CompactlyGenerated.{u, w}} : (X \u2245 Y) \u2243 (X \u2243\u209c Y) where\n toFun := homeoOfIso\ninvFun := isoOfHomeo\n\nend CompactlyGenerated\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.pullback (L204-L213)\ndef pullback : CompHausLike P :=\nletI set := { xy : X \u00d7 Y | f xy.fst = g xy.snd }\n haveI : CompactSpace set :=\n isCompact_iff_compactSpace.mp (isClosed_eq (f.hom.hom.continuous.comp continuous_fst)\n (g.hom.hom.continuous.comp continuous_snd)).isCompact\n CompHausLike.of P set\n\n/--\nThe projection from the pullback to the first component.\n-/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.cartesianMonoidalCategory (L63-L78)\ndef cartesianMonoidalCategory [\u2200 (X Y : CompHausLike.{u} P), HasProp P (X \u00d7 Y)]\n [HasProp P PUnit.{u + 1}] : CartesianMonoidalCategory (CompHausLike.{u} P) :=\n.ofChosenFiniteProducts\n \u27e8_, CompHausLike.isTerminalPUnit\u27e9\n (fun X Y \u21a6 \u27e8productCone X Y, productIsLimit X Y\u27e9)\n\nend Product\n\nsection Coproduct\n\nvariable [HasProp P (X \u2295 Y)]\n\n/--\nExplicit binary cofan in `CompHausLike P`, given that the predicate `P` is preserved under taking\ntype-theoretic sums.\n-/\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.of (L67-L71)\nabbrev of : CompHaus := CompHausLike.of _ X\nend CompHaus\n\n/-- The fully faithful embedding of `CompHaus` in `TopCat`. -/\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.CompHaus (L44-L47)\nabbrev CompHaus := CompHausLike (fun _ \u21a6 True)\nnamespace CompHaus\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.compactlyGeneratedToTop (L73-L76)\ndef compactlyGeneratedToTop : CompactlyGenerated.{u, w} \u2964 TopCat.{w} :=\ninducedFunctor _\n\n/-- `compactlyGeneratedToTop` is fully faithful. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Topology.Category.CompHaus.EffectiveEpi.effectiveEpi_tfae (L39-L50)\ntheorem effectiveEpi_tfae\n {B X : CompHaus.{u}} (\u03c0 : X \u27f6 B) :\n TFAE\n [ EffectiveEpi \u03c0\n , Epi \u03c0\n , Function.Surjective \u03c0\n ] := by\ntfae_have 1 \u2192 2 := fun _ \u21a6 inferInstance\n tfae_have 2 \u2194 3 := epi_iff_surjective \u03c0\n tfae_have 3 \u2192 1 := fun h\u03c0 \u21a6 \u27e8\u27e8effectiveEpiStruct \u03c0 h\u03c0\u27e9\u27e9\n tfae_finish\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Topology.Category.Compactum.isClosed_cl (L267-L271)\ntheorem isClosed_cl {X : Compactum} (A : Set X) : IsClosed (cl A) := by\nrw [isClosed_iff]\n intro F hF\n exact cl_cl _ \u27e8F, hF, rfl\u27e9\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.const (L267-L270)\ndef const {P : TopCat.{u} \u2192 Prop}\n (T : CompHausLike.{u} P) {S : CompHausLike.{u} P} (s : S) : T \u27f6 S :=\nofHom _ (ContinuousMap.const _ s)\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.epi_of_surjective (L204-L208)\ntheorem epi_of_surjective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) (hf : Function.Surjective f) :\n Epi f := by\nrw [\u2190 CategoryTheory.epi_iff_surjective] at hf\n exact (forget (CompHausLike P)).epi_of_epi_map hf\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Topology.Category.Compactum.Compactum (L85-L90)\ndef Compactum :=\nMonad.Algebra \u03b2 deriving Category, Inhabited\n\nnamespace Compactum\n\n/-- The forgetful functor to Type* -/\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Topology.Category.CompHausLike.SigmaComparison.sigmaComparison_eq_comp_isos (L47-L68)\ntheorem sigmaComparison_eq_comp_isos : sigmaComparison X \u03c3 =\n (X.mapIso (opCoproductIsoProduct'\n (finiteCoproduct.isColimit.{u, u} (fun a \u21a6 of P (\u03c3 a)))\n (productIsProduct fun x \u21a6 Opposite.op (of P (\u03c3 x))))).hom \u226b\n (PreservesProduct.iso X fun a \u21a6 \u27e8of P (\u03c3 a)\u27e9).hom \u226b\n (Types.productIso.{u, max u w} fun a \u21a6 X.obj \u27e8of P (\u03c3 a)\u27e9).hom := by\next x a\n simp only [Cofan.mk_pt, Fan.mk_pt, Functor.mapIso_hom,\n PreservesProduct.iso_hom, types_comp_apply, Types.productIso_hom_comp_eval_apply]\n have := congrFun (piComparison_comp_\u03c0 X (fun a \u21a6 \u27e8of P (\u03c3 a)\u27e9) a)\n simp only [types_comp_apply] at this\n rw [this, \u2190 FunctorToTypes.map_comp_apply]\n simp only [sigmaComparison]\n apply congrFun\n congr 2\n rw [\u2190 opCoproductIsoProduct_inv_comp_\u03b9]\n simp only [Opposite.unop_op, unop_comp, Quiver.Hom.unop_op, Category.assoc]\n simp only [opCoproductIsoProduct, \u2190 unop_comp, opCoproductIsoProduct'_comp_self]\n erw [IsColimit.fac]\n rfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Topology.Category.CompHaus.EffectiveEpi.effectiveEpiFamily_of_jointly_surjective (L102-L109)\ntheorem effectiveEpiFamily_of_jointly_surjective\n {\u03b1 : Type} [Finite \u03b1] {B : CompHaus.{u}}\n (X : \u03b1 \u2192 CompHaus.{u}) (\u03c0 : (a : \u03b1) \u2192 (X a \u27f6 B))\n (surj : \u2200 b : B, \u2203 (a : \u03b1) (x : X a), \u03c0 a x = b) :\n EffectiveEpiFamily X \u03c0 :=\n((effectiveEpiFamily_tfae X \u03c0).out 2 0).mp surj\n\nend CompHaus\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Topology.Category.Compactum.join (L128-L131)\ndef join (X : Compactum) : Ultrafilter (Ultrafilter X) \u2192 Ultrafilter X :=\n(\u03b2).\u03bc.app _\n\n/-- The inclusion of `X` into `Ultrafilter X`. -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.hasForget\u2082 (L98-L106)\ninstance hasForget\u2082 : HasForget\u2082 (CompHausLike P) TopCat :=\nInducedCategory.hasForget\u2082 _\n\nvariable (X : Type u) [TopologicalSpace X] [CompactSpace X] [T2Space X]\n\n/-- This wraps the predicate `P : TopCat \u2192 Prop` in a typeclass. -/\nclass HasProp : Prop where\n hasProp : P (TopCat.of X)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Topology.Category.CompHaus.Limits.isTerminalPUnit (L35-L43)\nabbrev isTerminalPUnit : IsTerminal (CompHaus.of PUnit.{u + 1}) := CompHausLike.isTerminalPUnit\n/-- The isomorphism from an arbitrary terminal object of `CompHaus` to a one-element space. -/\nnoncomputable def terminalIsoPUnit : \u22a4_ CompHaus.{u} \u2245 CompHaus.of PUnit :=\n terminalIsTerminal.uniqueUpToIso CompHaus.isTerminalPUnit\n\nnoncomputable example : PreservesFiniteCoproducts compHausToTop := inferInstance\n\nend CompHaus\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.coe_of (L120-L121)\ntheorem coe_of : (CompHausLike.of P X : Type _) = X := rfl\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Topology.Category.CompHaus.Frm.topCatOpToFrm (L22-L26)\ndef topCatOpToFrm : TopCat\u1d52\u1d56 \u2964 Frm where\n obj X := Frm.of (Opens (unop X : TopCat))\nmap f := Frm.ofHom <| Opens.comap <| (Quiver.Hom.unop f).hom\n\n-- Note, `CompHaus` is too strong. We only need `T0Space`.\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.isTerminalPUnit (L367-L375)\ndef isTerminalPUnit [HasProp P PUnit.{u + 1}] :\n IsTerminal (CompHausLike.of P PUnit.{u + 1}) :=\nhaveI : \u2200 X, Unique (X \u27f6 CompHausLike.of P PUnit.{u + 1}) := fun _ \u21a6\n \u27e8\u27e8ofHom _ \u27e8fun _ \u21a6 PUnit.unit, continuous_const\u27e9\u27e9, fun _ \u21a6 rfl\u27e9\n Limits.IsTerminal.ofUnique _\n\nend Terminal\n\nend CompHausLike\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.compHausToTop (L72-L77)\nabbrev compHausToTop : CompHaus.{u} \u2964 TopCat.{u} :=\nCompHausLike.compHausLikeToTop _\n\n/-- (Implementation) The object part of the compactification functor from topological spaces to\ncompact Hausdorff spaces.\n-/\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Topology.Category.Compactum.join_distrib (L149-L154)\ntheorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) :\n X.str (X.join uux) = X.str (map X.str uux) := by\nchange ((\u03b2).\u03bc.app _ \u226b X.a) _ = _\n rw [Monad.Algebra.assoc]\n rfl\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Topology.Category.CompHaus.EffectiveEpi.effectiveEpiFamily_tfae (L59-L101)\ntheorem effectiveEpiFamily_tfae\n {\u03b1 : Type} [Finite \u03b1] {B : CompHaus.{u}}\n (X : \u03b1 \u2192 CompHaus.{u}) (\u03c0 : (a : \u03b1) \u2192 (X a \u27f6 B)) :\n TFAE\n [ EffectiveEpiFamily X \u03c0\n , Epi (Sigma.desc \u03c0)\n , \u2200 b : B, \u2203 (a : \u03b1) (x : X a), \u03c0 a x = b\n ] := by\ntfae_have 2 \u2192 1\n | _ => by\n simpa [\u2190 effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc \u03c0)).out 0 1]\n tfae_have 1 \u2192 2\n | _ => inferInstance\n tfae_have 3 \u2192 2\n | e => by\n rw [epi_iff_surjective]\n intro b\n obtain \u27e8t, x, h\u27e9 := e b\n refine \u27e8Sigma.\u03b9 X t x, ?_\u27e9\n change (Sigma.\u03b9 X t \u226b Sigma.desc \u03c0) x = _\n simpa using h\n tfae_have 2 \u2192 3\n | e => by\n rw [epi_iff_surjective] at e\n let i : \u2210 X \u2245 finiteCoproduct X :=\n (colimit.isColimit _).coconePointUniqueUpToIso (finiteCoproduct.isColimit _)\n intro b\n obtain \u27e8t, rfl\u27e9 := e b\n let q := i.hom t\n refine \u27e8q.1,q.2,?_\u27e9\n have : t = i.inv (i.hom t) := show t = (i.hom \u226b i.inv) t by simp only [i.hom_inv_id]; rfl\n rw [this]\n change _ = (i.inv \u226b Sigma.desc \u03c0) (i.hom t)\n suffices i.inv \u226b Sigma.desc \u03c0 = finiteCoproduct.desc X \u03c0 by\n rw [this]; rfl\n rw [Iso.inv_comp_eq]\n apply colimit.hom_ext\n rintro \u27e8a\u27e9\n simp only [i, Discrete.functor_obj, colimit.\u03b9_desc, Cofan.mk_pt, Cofan.mk_\u03b9_app,\n colimit.comp_coconePointUniqueUpToIso_hom_assoc]\n ext; rfl\n tfae_finish\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Topology.Category.Compactum.lim_eq_str (L352-L357)\ntheorem lim_eq_str {X : Compactum} (F : Ultrafilter X) : F.lim = X.str F := by\nrw [Ultrafilter.lim_eq_iff_le_nhds, le_nhds_iff]\n tauto\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.fullyFaithfulToCompHausLike (L165-L167)\ndef fullyFaithfulToCompHausLike : (toCompHausLike h).FullyFaithful where\n preimage f := ConcreteCategory.ofHom f.hom.hom\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Topology.Category.CompHaus.Projective.projectivePresentation (L58-L65)\ndef projectivePresentation (X : CompHaus) : ProjectivePresentation X where\n p := of <| Ultrafilter X\nf := CompHausLike.ofHom _ \u27e8_, continuous_ultrafilter_extend id\u27e9\n projective := CompHaus.projective_ultrafilter X\n epi :=\n ConcreteCategory.epi_of_surjective _ fun x =>\n \u27e8(pure x : Ultrafilter X), congr_fun (ultrafilter_extend_extends (\ud835\udfd9 X)) x\u27e9\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Topology.Category.CompHaus.Frm.CompHausOpToFrame (L27-L30)\ninstance CompHausOpToFrame.faithful : (compHausToTop.op \u22d9 topCatOpToFrm.{u}).Faithful :=\n\u27e8fun {X _ _ _} h => Quiver.Hom.unop_inj <| ConcreteCategory.ext <|\n Opens.comap_injective (\u03b2 := (unop X).toTop) <| FrameHom.ext <|\n CategoryTheory.congr_fun h\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.Topology.Category.Profinite.Nobeling.Successor).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef Linear_CC'\u2080 : LocallyConstant C \u2124 \u2192\u2097[\u2124] LocallyConstant (C' C ho) \u2124\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C0 (L95-L97)\ndef C0 := C \u2229 {f | f (term I ho) = false}\n/-- The subset of `C` consisting of those elements whose `o`-th entry is `true`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C1 (L98-L100)\ndef C1 := C \u2229 {f | f (term I ho) = true}\ninclude hC in\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.isClosed_C0 (L101-L106)\ntheorem isClosed_C0 : IsClosed (C0 C ho) := by\nrefine hC.inter ?_\n have h : Continuous (fun (f : I \u2192 Bool) \u21a6 f (term I ho)) := continuous_apply (term I ho)\n exact IsClosed.preimage h (t := {false}) (isClosed_discrete _)\n\ninclude hC in\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.isClosed_C1 (L107-L111)\ntheorem isClosed_C1 : IsClosed (C1 C ho) := by\nrefine hC.inter ?_\n have h : Continuous (fun (f : I \u2192 Bool) \u21a6 f (term I ho)) := continuous_apply (term I ho)\n exact IsClosed.preimage h (t := {true}) (isClosed_discrete _)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.contained_C1 (L112-L114)\ntheorem contained_C1 : contained (\u03c0 (C1 C ho) (ord I \u00b7 < o)) o :=\ncontained_proj _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.union_C0C1_eq (L115-L123)\ntheorem union_C0C1_eq : (C0 C ho) \u222a (C1 C ho) = C := by\next x\n simp only [C0, C1, Set.mem_union, Set.mem_inter_iff, Set.mem_setOf_eq,\n \u2190 and_or_left, and_iff_left_iff_imp, Bool.dichotomy (x (term I ho)), implies_true]\n\n/--\nThe intersection of `C0` and the projection of `C1`. We will apply the inductive hypothesis to\nthis set.\n-/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C' (L124-L126)\ndef C' := C0 C ho \u2229 \u03c0 (C1 C ho) (ord I \u00b7 < o)\ninclude hC in\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.isClosed_C' (L127-L129)\ntheorem isClosed_C' : IsClosed (C' C ho) :=\nIsClosed.inter (isClosed_C0 _ hC _) (isClosed_proj _ _ (isClosed_C1 _ hC _))\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.contained_C' (L130-L135)\ntheorem contained_C' : contained (C' C ho) o := fun f hf i hi \u21a6 contained_C1 C ho f hf.2 i hi\nvariable (o)\n\n/-- Swapping the `o`-th coordinate to `true`. -/\nnoncomputable\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.SwapTrue (L136-L138)\ndef SwapTrue : (I \u2192 Bool) \u2192 I \u2192 Bool :=\nfun f i \u21a6 if ord I i = o then true else f i\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.continuous_swapTrue (L139-L149)\ntheorem continuous_swapTrue : Continuous (SwapTrue o : (I \u2192 Bool) \u2192 I \u2192 Bool) := by\ndsimp +unfoldPartialApp [SwapTrue]\n apply continuous_pi\n intro i\n apply Continuous.comp'\n \u00b7 apply continuous_bot\n \u00b7 apply continuous_apply\n\nvariable {o}\n\ninclude hsC in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.swapTrue_mem_C1 (L150-L165)\ntheorem swapTrue_mem_C1 (f : \u03c0 (C1 C ho) (ord I \u00b7 < o)) :\n SwapTrue o f.val \u2208 C1 C ho := by\nobtain \u27e8f, g, hg, rfl\u27e9 := f\n convert hg\n dsimp +unfoldPartialApp [SwapTrue]\n ext i\n split_ifs with h\n \u00b7 rw [ord_term ho] at h\n simpa only [\u2190 h] using hg.2.symm\n \u00b7 simp only [Proj, ite_eq_left_iff, not_lt, @eq_comm _ false, \u2190 Bool.not_eq_true]\n specialize hsC g hg.1 i\n intro h'\n contrapose! hsC\n exact \u27e8hsC, Order.succ_le_of_lt (h'.lt_of_ne' h)\u27e9\n\n/-- The first way to map `C'` into `C`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC'\u2080 (L166-L169)\ndef CC'\u2080 : C' C ho \u2192 C := fun g \u21a6 \u27e8g.val,g.prop.1.1\u27e9\n/-- The second way to map `C'` into `C`. -/\nnoncomputable\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC'\u2081 (L170-L172)\ndef CC'\u2081 : C' C ho \u2192 C :=\nfun g \u21a6 \u27e8SwapTrue o g.val, (swapTrue_mem_C1 C hsC ho \u27e8g.val,g.prop.2\u27e9).1\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.continuous_CC'\u2080 (L173-L174)\ntheorem continuous_CC'\u2080 : Continuous (CC'\u2080 C ho) := Continuous.subtype_mk continuous_subtype_val _\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.continuous_CC'\u2081 (L175-L179)\ntheorem continuous_CC'\u2081 : Continuous (CC'\u2081 C hsC ho) :=\nContinuous.subtype_mk (Continuous.comp (continuous_swapTrue o) continuous_subtype_val) _\n\n/-- The `\u2124`-linear map induced by precomposing with `CC'\u2080` -/\nnoncomputable\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.Linear_CC'\u2081 (L185-L189)\ndef Linear_CC'\u2081 : LocallyConstant C \u2124 \u2192\u2097[\u2124] LocallyConstant (C' C ho) \u2124 :=\nLocallyConstant.comap\u2097 \u2124 \u27e8(CC'\u2081 C hsC ho), (continuous_CC'\u2081 C hsC ho)\u27e9\n\n/-- The difference between `Linear_CC'\u2081` and `Linear_CC'\u2080`. -/\nnoncomputable\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.Linear_CC' (L190-L192)\ndef Linear_CC' : LocallyConstant C \u2124 \u2192\u2097[\u2124] LocallyConstant (C' C ho) \u2124 :=\nLinear_CC'\u2081 C hsC ho - Linear_CC'\u2080 C ho\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC_comp_zero (L193-L206)\ntheorem CC_comp_zero : \u2200 y, (Linear_CC' C hsC ho) ((\u03c0s C o) y) = 0 := by\nintro y\n ext x\n dsimp [Linear_CC', Linear_CC'\u2080, Linear_CC'\u2081, LocallyConstant.sub_apply]\n simp only [sub_eq_zero]\n congr 1\n ext i\n dsimp [CC'\u2080, CC'\u2081, ProjRestrict, Proj]\n apply if_ctx_congr Iff.rfl _ (fun _ \u21a6 rfl)\n simp only [SwapTrue, ite_eq_right_iff]\n intro h\u2081 h\u2082\n exact (h\u2081.ne h\u2082).elim\n\ninclude hsC in\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C0_projOrd (L207-L220)\ntheorem C0_projOrd {x : I \u2192 Bool} (hx : x \u2208 C0 C ho) : Proj (ord I \u00b7 < o) x = x := by\next i\n simp only [Proj, ite_eq_left_iff, not_lt]\n intro hi\n rcases hi.lt_or_eq with hi | hi\n \u00b7 specialize hsC x hx.1 i\n rw [\u2190 not_imp_not] at hsC\n simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC\n exact (hsC hi).symm\n \u00b7 simp only [C0, Set.mem_inter_iff, Set.mem_setOf_eq] at hx\n rw [eq_comm, ord_term ho] at hi\n rw [\u2190 hx.2, hi]\n\ninclude hsC in\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.C1_projOrd (L221-L236)\ntheorem C1_projOrd {x : I \u2192 Bool} (hx : x \u2208 C1 C ho) : SwapTrue o (Proj (ord I \u00b7 < o) x) = x := by\next i\n dsimp [SwapTrue, Proj]\n split_ifs with hi h\n \u00b7 rw [ord_term ho] at hi\n rw [\u2190 hx.2, hi]\n \u00b7 rfl\n \u00b7 simp only [not_lt] at h\n have h' : o < ord I i := lt_of_le_of_ne h (Ne.symm hi)\n specialize hsC x hx.1 i\n rw [\u2190 not_imp_not] at hsC\n simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC\n exact (hsC h').symm\n\ninclude hC in\nopen scoped Classical in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.CC_exact (L237-L271)\ntheorem CC_exact {f : LocallyConstant C \u2124} (hf : Linear_CC' C hsC ho f = 0) :\n \u2203 y, \u03c0s C o y = f := by\ndsimp [Linear_CC', Linear_CC'\u2080, Linear_CC'\u2081] at hf\n simp only [sub_eq_zero, \u2190 LocallyConstant.coe_inj] at hf\n let C\u2080C : C0 C ho \u2192 C := fun x \u21a6 \u27e8x.val, x.prop.1\u27e9\n have h\u2080 : Continuous C\u2080C := Continuous.subtype_mk continuous_induced_dom _\n let C\u2081C : \u03c0 (C1 C ho) (ord I \u00b7 < o) \u2192 C :=\n fun x \u21a6 \u27e8SwapTrue o x.val, (swapTrue_mem_C1 C hsC ho x).1\u27e9\n have h\u2081 : Continuous C\u2081C := Continuous.subtype_mk\n ((continuous_swapTrue o).comp continuous_subtype_val) _\n refine \u27e8LocallyConstant.piecewise' ?_ (isClosed_C0 C hC ho)\n (isClosed_proj _ o (isClosed_C1 C hC ho)) (f.comap \u27e8C\u2080C, h\u2080\u27e9) (f.comap \u27e8C\u2081C, h\u2081\u27e9) ?_, ?_\u27e9\n \u00b7 rintro _ \u27e8y, hyC, rfl\u27e9\n simp only [Set.mem_union]\n rw [\u2190 union_C0C1_eq C ho] at hyC\n refine hyC.imp (fun hyC \u21a6 ?_) (fun hyC \u21a6 \u27e8y, hyC, rfl\u27e9)\n rwa [C0_projOrd C hsC ho hyC]\n \u00b7 intro x hx\n simpa only [h\u2080, h\u2081, LocallyConstant.coe_comap] using (congrFun hf \u27e8x, hx\u27e9).symm\n \u00b7 ext \u27e8x, hx\u27e9\n rw [\u2190 union_C0C1_eq C ho] at hx\n rcases hx with hx\u2080 | hx\u2081\n \u00b7 have hx\u2080' : ProjRestrict C (ord I \u00b7 < o) \u27e8x, hx\u27e9 = x := by\n simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using C0_projOrd C hsC ho hx\u2080\n simp only [C\u2080C, \u03c0s_apply_apply, hx\u2080', hx\u2080, LocallyConstant.piecewise'_apply_left,\n LocallyConstant.coe_comap, ContinuousMap.coe_mk, Function.comp_apply]\n \u00b7 have hx\u2081' : (ProjRestrict C (ord I \u00b7 < o) \u27e8x, hx\u27e9).val \u2208 \u03c0 (C1 C ho) (ord I \u00b7 < o) := by\n simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using \u27e8x, hx\u2081, rfl\u27e9\n simp only [C\u2081C, \u03c0s_apply_apply, LocallyConstant.coe_comap,\n Function.comp_apply, hx\u2081', LocallyConstant.piecewise'_apply_right]\n congr\n simp only [ContinuousMap.coe_mk, Subtype.mk.injEq]\n exact C1_projOrd C hsC ho hx\u2081\n\nvariable (o) in\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.succ_mono (L272-L276)\ntheorem succ_mono : CategoryTheory.Mono (ModuleCat.ofHom (\u03c0s C o)) := by\nrw [ModuleCat.mono_iff_injective]\n exact injective_\u03c0s _ _\n\ninclude hC in\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.succ_exact (L277-L291)\ntheorem succ_exact :\n (ShortComplex.mk (ModuleCat.ofHom (\u03c0s C o)) (ModuleCat.ofHom (Linear_CC' C hsC ho))\n (by ext : 2; apply CC_comp_zero)).Exact := by\nrw [ShortComplex.moduleCat_exact_iff]\n intro f\n exact CC_exact C hC hsC ho\n\nend ExactSequence\n\nnamespace GoodProducts\n\n/--\nThe `GoodProducts` in `C` that contain `o` (they necessarily start with `o`, see\n`GoodProducts.head!_eq_o_of_maxProducts`)\n-/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Category.Profinite.Nobeling.Successor.MaxProducts (L292-L294)\ndef MaxProducts : Set (Products I) := {l | l.isGood C \u2227 term I ho \u2208 l.val}\ninclude hsC in\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isClosedMap (L221-L224)\ntheorem isClosedMap {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) : IsClosedMap f := fun _ hC =>\n(hC.isCompact.image f.hom.hom.continuous).isClosed\n\n/-- Any continuous bijection of compact Hausdorff spaces is an isomorphism. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.Sigma (L161-L170)\nlemma Sigma.isOpenEmbedding_\u03b9 (a : \u03b1) :\n IsOpenEmbedding (Sigma.\u03b9 X a) := by\nrefine IsOpenEmbedding.of_comp _ (homeoOfIso ((colimit.isColimit _).coconePointUniqueUpToIso\n (finiteCoproduct.isColimit X))).isOpenEmbedding ?_\n convert finiteCoproduct.isOpenEmbedding_\u03b9 X a\n ext x\n change (Sigma.\u03b9 X a \u226b _) x = _\n simp\n\n/-- The functor to `TopCat` preserves finite coproducts if they exist. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.homeoOfIso (L256-L260)\ndef homeoOfIso {X Y : CompHausLike.{u} P} (f : X \u2245 Y) : X \u2243\u209c Y :=\nTopCat.homeoOfIso <| (compHausLikeToTop P).mapIso f\n\n/-- The equivalence between isomorphisms in `CompHaus` and homeomorphisms\nof topological spaces. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.ofHom (L67-L68)\nabbrev ofHom (f : C(X, Y)) : of X \u27f6 of Y := ConcreteCategory.ofHom f\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.coe_id (L123-L125)\ntheorem coe_id (X : CompHausLike P) : (\ud835\udfd9 X : X \u2192 X) = id :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.of (L114-L119)\nabbrev of : CompHausLike P where\n toTop := TopCat.of X\nis_compact := \u2039_\u203a\n is_hausdorff := \u2039_\u203a\n prop := HasProp.hasProp\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Category.Compactum.incl (L132-L134)\ndef incl (X : Compactum) : X \u2192 Ultrafilter X :=\n(\u03b2).\u03b7.app _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.hasPullbacksOfInclusions (L335-L350)\ntheorem hasPullbacksOfInclusions\n (hP' : \u2200 \u2983X Y B : CompHausLike.{u} P\u2984 (f : X \u27f6 B) (g : Y \u27f6 B)\n (_ : IsOpenEmbedding f), HasExplicitPullback f g) :\n HasExplicitPullbacksOfInclusions P :=\n{ hasProp := by\n intro _ _ _ f\n apply hP'\n exact Sigma.isOpenEmbedding_\u03b9 _ _ }\n\n/-- The functor to `TopCat` preserves pullbacks of inclusions if they exist. -/\nnoncomputable instance [HasExplicitPullbacksOfInclusions P] :\n PreservesPullbacksOfInclusions (compHausLikeToTop P) :=\n { preservesPullbackInl := by\n intro X Y Z f\n infer_instance }\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.isoOfHomeo (L86-L96)\ndef isoOfHomeo {X Y : CompactlyGenerated.{u, w}} (f : X \u2243\u209c Y) : X \u2245 Y where\n hom := ofHom \u27e8f, f.continuous\u27e9\ninv := ofHom \u27e8f.symm, f.symm.continuous\u27e9\n hom_inv_id := by\n ext x\n exact f.symm_apply_apply x\n inv_hom_id := by\n ext x\n exact f.apply_symm_apply x\n\n/-- Construct a homeomorphism from an isomorphism. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.toCompHausLike (L152-L158)\ndef toCompHausLike {P P' : TopCat \u2192 Prop} (h : \u2200 (X : CompHausLike P), P X.toTop \u2192 P' X.toTop) :\n CompHausLike P \u2964 CompHausLike P' where\n obj X :=\nhaveI : HasProp P' X := \u27e8(h _ X.prop)\u27e9\n CompHausLike.of _ X\n map {X Y} f := ConcreteCategory.ofHom f.hom.hom\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Category.Compactum.str_hom_commute (L142-L147)\ntheorem str_hom_commute (X Y : Compactum) (f : X \u27f6 Y) (xs : Ultrafilter X) :\n f (X.str xs) = Y.str (map f xs) := by\nchange (X.a \u226b f.f) _ = _\n rw [\u2190 f.h]\n rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.compHausLikeToCompHaus (L217-L218)\nabbrev compHausLikeToCompHaus (P : TopCat \u2192 Prop) : CompHausLike P \u2964 CompHaus :=\nCompHausLike.toCompHausLike (by simp only [implies_true])\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Category.Compactum.free (L101-L104)\ndef free : Type* \u2964 Compactum :=\nMonad.free _\n\n/-- The adjunction between `free` and `forget`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.homeoOfIso (L98-L107)\ndef homeoOfIso {X Y : CompactlyGenerated.{u, w}} (f : X \u2245 Y) : X \u2243\u209c Y where\n toFun := f.hom\ninvFun := f.inv\n left_inv := f.hom_inv_id_apply\n right_inv := f.inv_hom_id_apply\n continuous_toFun := f.hom.hom.hom.continuous\n continuous_invFun := f.inv.hom.hom.continuous\n\n/-- The equivalence between isomorphisms in `CompactlyGenerated` and homeomorphisms\nof topological spaces. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Category.CompHausLike.EffectiveEpi.effectiveEpiStruct (L36-L63)\ndef effectiveEpiStruct {B X : CompHausLike P} (\u03c0 : X \u27f6 B) (h\u03c0 : Function.Surjective \u03c0) :\n EffectiveEpiStruct \u03c0 where\n desc e h :=\nofHom _ ((IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).lift e.hom.hom\n fun a b hab \u21a6\n CategoryTheory.congr_fun (h\n (ofHom _ \u27e8fun _ \u21a6 a, continuous_const\u27e9)\n (ofHom _ \u27e8fun _ \u21a6 b, continuous_const\u27e9)\n (by ext; exact hab)) a)\n fac e h :=\n InducedCategory.hom_ext (TopCat.hom_ext\n ((IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).lift_comp _ _))\n uniq e h g hm := by\n suffices g = ofHom _\n ((IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).liftEquiv \u27e8e.hom.hom,\n fun a b hab \u21a6 CategoryTheory.congr_fun\n (h\n (ofHom _ \u27e8fun _ \u21a6 a, continuous_const\u27e9)\n (ofHom _ \u27e8fun _ \u21a6 b, continuous_const\u27e9)\n (by ext; exact hab))\n a\u27e9) by assumption\n apply ConcreteCategory.ext\n rw [hom_ofHom, \u2190 Equiv.symm_apply_eq\n (IsQuotientMap.of_surjective_continuous h\u03c0 \u03c0.hom.hom.continuous).liftEquiv]\n ext\n simp only [IsQuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, \u2190 hm]\n rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Category.Compactum.str_eq_of_le_nhds (L272-L341)\ntheorem str_eq_of_le_nhds {X : Compactum} (F : Ultrafilter X) (x : X) : \u2191F \u2264 \ud835\udcdd x \u2192 X.str F = x := by\n-- Notation to be used in this proof.\n let fsu := Finset (Set (Ultrafilter X))\n let ssu := Set (Set (Ultrafilter X))\n let \u03b9 : fsu \u2192 ssu := fun x \u21a6 \u2191x\n let T0 : ssu := { S | \u2203 A \u2208 F, S = basic A }\n let AA := X.str \u207b\u00b9' {x}\n let T1 := insert AA T0\n let T2 := finiteInterClosure T1\n intro cond\n -- If F contains a closed set A, then x is contained in A.\n have claim1 : \u2200 A : Set X, IsClosed A \u2192 A \u2208 F \u2192 x \u2208 A := by\n intro A hA h\n by_contra H\n rw [le_nhds_iff] at cond\n specialize cond A\u1d9c H hA.isOpen_compl\n rw [Ultrafilter.mem_coe, Ultrafilter.compl_mem_iff_notMem] at cond\n contradiction\n -- If A \u2208 F, then x \u2208 cl A.\n have claim2 : \u2200 A : Set X, A \u2208 F \u2192 x \u2208 cl A := by\n intro A hA\n exact claim1 (cl A) (isClosed_cl A) (mem_of_superset hA (subset_cl A))\n -- T0 is closed under intersections.\n have claim3 : \u2200 (S1) (_ : S1 \u2208 T0) (S2) (_ : S2 \u2208 T0), S1 \u2229 S2 \u2208 T0 := by\n rintro S1 \u27e8S1, hS1, rfl\u27e9 S2 \u27e8S2, hS2, rfl\u27e9\n exact \u27e8S1 \u2229 S2, inter_mem hS1 hS2, by simp [basic_inter]\u27e9\n -- For every S \u2208 T0, the intersection AA \u2229 S is nonempty.\n have claim4 : \u2200 S \u2208 T0, (AA \u2229 S).Nonempty := by\n rintro S \u27e8S, hS, rfl\u27e9\n rcases claim2 _ hS with \u27e8G, hG, hG2\u27e9\n exact \u27e8G, hG2, hG\u27e9\n -- Every element of T0 is nonempty.\n have claim5 : \u2200 S \u2208 T0, Set.Nonempty S := by\n rintro S \u27e8S, hS, rfl\u27e9\n exact \u27e8F, hS\u27e9\n -- Every element of T2 is nonempty.\n have claim6 : \u2200 S \u2208 T2, Set.Nonempty S := by\n suffices \u2200 S \u2208 T2, S \u2208 T0 \u2228 \u2203 Q \u2208 T0, S = AA \u2229 Q by\n intro S hS\n rcases this _ hS with h | h\n \u00b7 exact claim5 S h\n \u00b7 rcases h with \u27e8Q, hQ, rfl\u27e9\n exact claim4 Q hQ\n intro S hS\n apply finiteInterClosure_insert\n \u00b7 constructor\n \u00b7 use Set.univ\n refine \u27e8Filter.univ_sets _, ?_\u27e9\n ext\n refine \u27e8?_, by tauto\u27e9\n \u00b7 intro\n apply Filter.univ_sets\n \u00b7 exact claim3\n \u00b7 exact hS\n -- It suffices to show that the intersection of any finite subset of T1 is nonempty.\n suffices \u2200 F : fsu, \u2191F \u2286 T1 \u2192 (\u22c2\u2080 \u03b9 F).Nonempty by\n obtain \u27e8G, h1\u27e9 := Ultrafilter.exists_ultrafilter_of_finite_inter_nonempty _ this\n have c1 : X.join G = F := Ultrafilter.coe_le_coe.1 fun P hP => h1 (Or.inr \u27e8P, hP, rfl\u27e9)\n have c2 : G.map X.str = X.incl x := by\n refine Ultrafilter.coe_le_coe.1 fun P hP => ?_\n apply mem_of_superset (h1 (Or.inl rfl))\n rintro x \u27e8rfl\u27e9\n exact hP\n simp [\u2190 c1, c2]\n -- Finish...\n intro T hT\n refine claim6 _ (finiteInter_mem (.finiteInterClosure_finiteInter _) _ ?_)\n intro t ht\n exact finiteInterClosure.basic (@hT t ht)\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.productCone (L40-L47)\ndef productCone : BinaryFan X Y :=\nBinaryFan.mk (P := CompHausLike.of P (X \u00d7 Y))\n (ofHom _ { toFun := Prod.fst }) (ofHom _ { toFun := Prod.snd })\n\n/--\nWhen the predicate `P` is preserved under taking type-theoretic products, that product is a\ncategory-theoretic product in `CompHausLike P`.\n-/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isoOfHomeo (L251-L254)\ndef isoOfHomeo {X Y : CompHausLike.{u} P} (f : X \u2243\u209c Y) : X \u2245 Y :=\n(fullyFaithfulCompHausLikeToTop P).preimageIso (TopCat.isoOfHomeo f)\n\n/-- Construct a homeomorphism from an isomorphism. -/\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isoEquivHomeo (L262-L266)\ndef isoEquivHomeo {X Y : CompHausLike.{u} P} : (X \u2245 Y) \u2243 (X \u2243\u209c Y) where\n toFun := homeoOfIso\ninvFun := isoOfHomeo\n\n/-- A constant map as a morphism in `CompHausLike` -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.fullyFaithfulCompHausLikeToTop (L187-L189)\ndef fullyFaithfulCompHausLikeToTop : (compHausLikeToTop P).FullyFaithful :=\nfullyFaithfulInducedFunctor _\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.ofHom (L137-L138)\nabbrev ofHom (f : C(X, Y)) : of P X \u27f6 of P Y := ConcreteCategory.ofHom f\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.isIso_of_bijective (L225-L238)\ntheorem isIso_of_bijective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) (bij : Function.Bijective f) :\n IsIso f := by\nlet E := Equiv.ofBijective _ bij\n have hE : Continuous E.symm := by\n rw [continuous_iff_isClosed]\n intro S hS\n rw [\u2190 E.image_eq_preimage_symm]\n exact isClosedMap f S hS\n refine \u27e8\u27e8ofHom _ \u27e8E.symm, hE\u27e9, ?_, ?_\u27e9\u27e9\n \u00b7 ext x\n apply E.symm_apply_apply\n \u00b7 ext x\n apply E.apply_symm_apply\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Topology.Category.Compactum.le_nhds_of_str_eq (L342-L345)\ntheorem le_nhds_of_str_eq {X : Compactum} (F : Ultrafilter X) (x : X) : X.str F = x \u2192 \u2191F \u2264 \ud835\udcdd x :=\nfun h => le_nhds_iff.mpr fun s hx hs => hs _ <| by rwa [h]\n\n-- All the hard work above boils down to this `T2Space` instance.\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Topology.Category.CompHausLike.EffectiveEpi.preregular (L64-L74)\ntheorem preregular [HasExplicitPullbacks P]\n (hs : \u2200 \u2983X Y : CompHausLike P\u2984 (f : X \u27f6 Y), EffectiveEpi f \u2192 Function.Surjective f) :\n Preregular (CompHausLike P) where\n exists_fac := by\nintro X Y Z f \u03c0 h\u03c0\n refine \u27e8pullback f \u03c0, pullback.fst f \u03c0, \u27e8\u27e8effectiveEpiStruct _ ?_\u27e9\u27e9, pullback.snd f \u03c0,\n (pullback.condition _ _).symm\u27e9\n intro y\n obtain \u27e8z, hz\u27e9 := hs \u03c0 h\u03c0 (f y)\n exact \u27e8\u27e8(y, z), hz.symm\u27e9, rfl\u27e9\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.finiteCoproduct (L63-L67)\ndef finiteCoproduct : CompHausLike P := CompHausLike.of P (\u03a3 (a : \u03b1), X a)\n/--\nThe inclusion of one of the factors into the explicit finite coproduct.\n-/\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Topology.Category.CompHausLike.SigmaComparison.sigmaComparison (L43-L46)\ndef sigmaComparison : X.obj \u27e8(of P ((a : \u03b1) \u00d7 \u03c3 a))\u27e9 \u27f6 ((a : \u03b1) \u2192 X.obj \u27e8of P (\u03c3 a)\u27e9) :=\nfun x a \u21a6 X.map (ofHom _ \u27e8Sigma.mk a, continuous_sigmaMk\u27e9).op x\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.HasExplicitPullback (L196-L203)\nabbrev HasExplicitPullback := HasProp P { xy : X \u00d7 Y | f xy.fst = g xy.snd }\nvariable [HasExplicitPullback f g] -- (hP : P (TopCat.of { xy : X \u00d7 Y | f xy.fst = g xy.snd }))\n\n/--\nThe pullback of two morphisms `f,g` in `CompHaus`, constructed explicitly as the set of\npairs `(x,y)` such that `f x = g y`, with the topology induced by the product.\n-/\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Topology.Category.CompHausLike.EffectiveEpi.precoherent (L75-L81)\ntheorem precoherent [HasExplicitPullbacks P] [HasExplicitFiniteCoproducts.{0} P]\n (hs : \u2200 \u2983X Y : CompHausLike P\u2984 (f : X \u27f6 Y), EffectiveEpi f \u2192 Function.Surjective f) :\n Precoherent (CompHausLike P) := by\nhave : Preregular (CompHausLike P) := preregular hs\n infer_instance\n\nend CompHausLike\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.finitaryExtensive (L354-L366)\ntheorem finitaryExtensive (hP' : \u2200 \u2983X Y B : CompHausLike.{u} P\u2984 (f : X \u27f6 B) (g : Y \u27f6 B)\n (_ : IsOpenEmbedding f), HasExplicitPullback f g) :\n FinitaryExtensive (CompHausLike P) :=\nhave := hasPullbacksOfInclusions hP'\n finitaryExtensive_of_preserves_and_reflects (compHausLikeToTop P)\n\nend FiniteCoproducts\n\nsection Terminal\n\nvariable {P : TopCat.{u} \u2192 Prop}\n\n/-- A one-element space is terminal in `CompHaus` -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.stoneCechObj (L79-L112)\ndef stoneCechObj (X : TopCat) : CompHaus :=\nCompHaus.of (StoneCech X)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- (Implementation) The bijection of homsets to establish the reflective adjunction of compact\nHausdorff spaces in topological spaces.\n-/\nnoncomputable def stoneCechEquivalence (X : TopCat.{u}) (Y : CompHaus.{u}) :\n (stoneCechObj X \u27f6 Y) \u2243 (X \u27f6 compHausToTop.obj Y) where\n toFun f := TopCat.ofHom\n { toFun := f \u2218 stoneCechUnit\n continuous_toFun := f.hom.hom.2.comp (@continuous_stoneCechUnit X _) }\n invFun f := CompHausLike.ofHom _\n { toFun := stoneCechExtend f.hom.2\n continuous_toFun := continuous_stoneCechExtend f.hom.2 }\n left_inv := by\n rintro \u27e8f : StoneCech X \u27f6 Y, hf : Continuous f\u27e9\n ext x\n refine congr_fun ?_ x\n apply Continuous.ext_on denseRange_stoneCechUnit (continuous_stoneCechExtend _) hf\n \u00b7 rintro _ \u27e8y, rfl\u27e9\n apply congr_fun (stoneCechExtend_extends (hf.comp _)) y\n apply continuous_stoneCechUnit\n right_inv := by\n rintro \u27e8f : (X : Type _) \u27f6 Y, hf : Continuous f\u27e9\n ext\n exact congr_fun (stoneCechExtend_extends hf) _\n\n/-- The Stone-Cech compactification functor from topological spaces to compact Hausdorff spaces,\nleft adjoint to the inclusion functor.\n-/\nnoncomputable def topToCompHaus : TopCat.{u} \u2964 CompHaus.{u} :=\n Adjunction.leftAdjointOfEquiv stoneCechEquivalence.{u} fun _ _ _ _ _ => rfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.coe_comp (L127-L130)\ntheorem coe_comp {X Y Z : CompHausLike P} (f : X \u27f6 Y) (g : Y \u27f6 Z) :\n (f \u226b g : X \u2192 Z) = g \u2218 f :=\nrfl\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.fullyFaithfulCompactlyGeneratedToTop (L77-L79)\ndef fullyFaithfulCompactlyGeneratedToTop : compactlyGeneratedToTop.{u, w}.FullyFaithful :=\nfullyFaithfulInducedFunctor _\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.epi_iff_surjective (L181-L216)\ntheorem epi_iff_surjective {X Y : CompHaus.{u}} (f : X \u27f6 Y) : Epi f \u2194 Function.Surjective f := by\nconstructor\n \u00b7 dsimp [Function.Surjective]\n contrapose!\n rintro \u27e8y, hy\u27e9 hf\n let C := Set.range f\n have hC : IsClosed C := (isCompact_range f.hom.hom.continuous).isClosed\n let D := ({y} : Set Y)\n have hD : IsClosed D := isClosed_singleton\n have hCD : Disjoint C D := by\n rw [Set.disjoint_singleton_right]\n rintro \u27e8y', hy'\u27e9\n exact hy y' hy'\n obtain \u27e8\u03c6, h\u03c60, h\u03c61, h\u03c601\u27e9 := exists_continuous_zero_one_of_isClosed hC hD hCD\n haveI : CompactSpace (ULift.{u} <| Set.Icc (0 : \u211d) 1) := Homeomorph.ulift.symm.compactSpace\n haveI : T2Space (ULift.{u} <| Set.Icc (0 : \u211d) 1) := Homeomorph.ulift.symm.t2Space\n let Z := of (ULift.{u} <| Set.Icc (0 : \u211d) 1)\n let g : Y \u27f6 Z := ofHom _\n \u27e8fun y' => \u27e8\u27e8\u03c6 y', h\u03c601 y'\u27e9\u27e9,\n continuous_uliftUp.comp (\u03c6.continuous.subtype_mk fun y' => h\u03c601 y')\u27e9\n let h : Y \u27f6 Z := ofHom _\n \u27e8fun _ => \u27e8\u27e80, Set.left_mem_Icc.mpr zero_le_one\u27e9\u27e9, continuous_const\u27e9\n have H : h = g := by\n rw [\u2190 cancel_epi f]\n ext x : 4\n simp [g, h, Z, h\u03c60 (Set.mem_range_self x)]\n apply_fun fun e => (e y).down.1 at H\n dsimp [g, h, Z] at H\n simp only [h\u03c61 (Set.mem_singleton y), Pi.one_apply] at H\n exact zero_ne_one H\n \u00b7 rw [\u2190 CategoryTheory.epi_iff_surjective]\n apply (forget CompHaus).epi_of_epi_map\n\nend CompHaus\n\n/-- Every `CompHausLike` admits a functor to `CompHaus`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.coproductIsColimit (L86-L94)\ndef coproductIsColimit : IsColimit (coproductCocone X Y) := by\nrefine BinaryCofan.isColimitMk (fun s \u21a6 ofHom _ { toFun := Sum.elim s.inl s.inr })\n (by rfl_cat) (by rfl_cat) fun _ _ h\u2081 h\u2082 \u21a6 ?_\n ext \u27e8\u27e9\n exacts [ConcreteCategory.congr_hom h\u2081 _, ConcreteCategory.congr_hom h\u2082 _]\n\nend Coproduct\n\nend CompHausLike\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.HasExplicitFiniteCoproduct (L55-L62)\nabbrev HasExplicitFiniteCoproduct := HasProp P (\u03a3 (a : \u03b1), X a)\nvariable [HasExplicitFiniteCoproduct X]\n\n/--\nThe coproduct of a finite family of objects in `CompHaus`, constructed as the disjoint\nunion with its usual topology.\n-/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Topology.Category.CompHaus.Projective.projective_ultrafilter (L41-L57)\ninstance projective_ultrafilter (X : Type*) : Projective (of <| Ultrafilter X) where\n factors {Y Z} f g hg := by\nrw [epi_iff_surjective] at hg\n obtain \u27e8g', hg'\u27e9 := hg.hasRightInverse\n let t : X \u2192 Y := g' \u2218 f \u2218 (pure : X \u2192 Ultrafilter X)\n let h : Ultrafilter X \u2192 Y := Ultrafilter.extend t\n have hh : Continuous h := continuous_ultrafilter_extend _\n use CompHausLike.ofHom _ \u27e8h, hh\u27e9\n apply ConcreteCategory.coe_ext\n have : g.hom \u2218 g' = id := hg'.comp_eq_id\n convert denseRange_pure.equalizer (g.hom.hom.continuous.comp hh) f.hom.hom.continuous _\n -- This used to be `rw`, but we need `rw; rfl` after https://github.com/leanprover/lean4/pull/2644\n rw [comp_assoc, ultrafilter_extend_extends, \u2190 comp_assoc, this, id_comp]\n rfl\n\n/-- For any compact Hausdorff space `X`,\n the natural map `Ultrafilter X \u2192 X` is a projective presentation. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Topology.Category.Compactum.str (L124-L127)\ndef str (X : Compactum) : Ultrafilter X \u2192 X :=\nX.a\n\n/-- The monadic join. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Topology.Category.CompHausLike.SigmaComparison.isIsoSigmaComparison (L69-L73)\ninstance isIsoSigmaComparison : IsIso <| sigmaComparison X \u03c3 := by\nrw [sigmaComparison_eq_comp_isos]\n infer_instance\n\nend CompHausLike\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.category (L92-L94)\ninstance category : Category (CompHausLike P) :=\ninferInstanceAs (Category (InducedCategory _ toTop))\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.compHausLikeToTop (L178-L182)\ndef compHausLikeToTop : CompHausLike.{u} P \u2964 TopCat.{u} :=\ninducedFunctor _\n-- The `Full, Faithful` instances should be constructed by a deriving handler.\n-- https://github.com/leanprover-community/mathlib4/issues/380\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.topToCompHaus_obj (L113-L124)\ntheorem topToCompHaus_obj (X : TopCat) : \u21a5(topToCompHaus.obj X) = StoneCech X :=\nrfl\n\n/-- The category of compact Hausdorff spaces is reflective in the category of topological spaces.\n-/\nnoncomputable instance compHausToTop.reflective : Reflective compHausToTop where\n L := topToCompHaus\n adj := Adjunction.adjunctionOfEquivLeft _ _\n\nnoncomputable instance compHausToTop.createsLimits : CreatesLimits compHausToTop :=\n monadicCreatesLimits _\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.coproductCocone (L79-L85)\ndef coproductCocone : BinaryCofan X Y := BinaryCofan.mk (P := CompHausLike.of P (X \u2295 Y))\n(ofHom _ { toFun := Sum.inl }) (ofHom _ { toFun := Sum.inr })\n\n/--\nWhen the predicate `P` is preserved under taking type-theoretic sums, that sum is a\ncategory-theoretic coproduct in `CompHausLike P`.\n-/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.const_comp (L271-L275)\nlemma const_comp {P : TopCat.{u} \u2192 Prop} {S T U : CompHausLike.{u} P}\n (s : S) (g : S \u27f6 U) : T.const s \u226b g = T.const (g s) :=\nrfl\n\nend CompHausLike\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Topology.Category.Compactum.forget (L91-L93)\ndef forget : Compactum \u2964 Type* :=\nMonad.forget _\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Topology.Category.Compactum.adj (L105-L107)\ndef adj : free \u22a3 forget :=\nMonad.adj _\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.of (L58-L61)\nabbrev of : CompactlyGenerated.{u, w} where\n toTop := TopCat.of X\nis_compactly_generated := \u2039_\u203a\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.limitConeIsLimit (L171-L180)\ndef limitConeIsLimit {J : Type v} [SmallCategory J] (F : J \u2964 CompHaus.{max v u}) :\n Limits.IsLimit.{v} (limitCone.{v, u} F) :=\nletI FF : J \u2964 TopCat := F \u22d9 compHausToTop\n { lift := fun S => InducedCategory.homMk\n ((TopCat.limitConeIsLimit FF).lift (compHausToTop.mapCone S))\n uniq := fun S m hm => InducedCategory.hom_ext\n ((TopCat.limitConeIsLimit FF).uniq (compHausToTop.mapCone S) _ (fun j \u21a6 by\n simp [\u2190 hm]\n rfl)) }\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Topology.Category.Compactum.isClosed_iff (L162-L175)\ntheorem isClosed_iff {X : Compactum} (S : Set X) :\n IsClosed S \u2194 \u2200 F : Ultrafilter X, S \u2208 F \u2192 X.str F \u2208 S := by\nrw [\u2190 isOpen_compl_iff]\n constructor\n \u00b7 intro cond F h\n by_contra c\n specialize cond F c\n rw [compl_mem_iff_notMem] at cond\n contradiction\n \u00b7 intro h1 F h2\n specialize h1 F\n rcases F.mem_or_compl_mem S with h | h\n exacts [absurd (h1 h) h2, h]\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Topology.Category.Compactum.str_incl (L136-L140)\ntheorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by\nchange ((\u03b2).\u03b7.app _ \u226b X.a) _ = _\n rw [Monad.Algebra.unit]\n rfl\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.forget_reflectsIsomorphisms (L239-L249)\ninstance forget_reflectsIsomorphisms :\n (forget (CompHausLike.{u} P)).ReflectsIsomorphisms :=\n\u27e8by intro A B f hf; rw [isIso_iff_bijective] at hf; exact isIso_of_bijective _ hf\u27e9\n\n/-- Any continuous bijection of compact Hausdorff spaces induces an isomorphism. -/\nnoncomputable def isoOfBijective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y)\n (bij : Function.Bijective f) : X \u2245 Y :=\n letI := isIso_of_bijective _ bij\n asIso f\n\n/-- Construct an isomorphism from a homeomorphism. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.limitCone (L135-L170)\ndef limitCone {J : Type v} [SmallCategory J] (F : J \u2964 CompHaus.{max v u}) : Limits.Cone F :=\nletI FF : J \u2964 TopCat := F \u22d9 compHausToTop\n { pt := {\n toTop := (TopCat.limitCone FF).pt\n is_compact := by\n change CompactSpace { u : \u2200 j, F.obj j | \u2200 {i j : J} (f : i \u27f6 j), (F.map f) (u i) = u j }\n rw [\u2190 isCompact_iff_compactSpace]\n apply IsClosed.isCompact\n have :\n { u : \u2200 j, F.obj j | \u2200 {i j : J} (f : i \u27f6 j), F.map f (u i) = u j } =\n \u22c2 (i : J) (j : J) (f : i \u27f6 j), { u | F.map f (u i) = u j } := by\n ext1\n simp only [Set.mem_iInter, Set.mem_setOf_eq]\n rw [this]\n apply isClosed_iInter\n intro i\n apply isClosed_iInter\n intro j\n apply isClosed_iInter\n intro f\n apply isClosed_eq\n \u00b7 exact ((F.map f).hom.hom.continuous).comp (continuous_apply i)\n \u00b7 exact continuous_apply j\n is_hausdorff :=\n show T2Space { u : \u2200 j, F.obj j | \u2200 {i j : J} (f : i \u27f6 j), (F.map f) (u i) = u j } from\n inferInstance\n prop := trivial }\n \u03c0 := {\n app := fun j => InducedCategory.homMk ((TopCat.limitCone FF).\u03c0.app j)\n naturality := by\n intro _ _ f\n ext \u27e8x, hx\u27e9\n simp only [Functor.const_obj_map]\n exact (hx f).symm } }\n\n/-- The limit cone `CompHaus.limitCone F` is indeed a limit cone. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.productIsLimit (L48-L61)\ndef productIsLimit : IsLimit (productCone X Y) := by\nrefine BinaryFan.isLimitMk (fun s \u21a6 ofHom _ { toFun x := (s.fst x, s.snd x) })\n (by rfl_cat) (by rfl_cat) fun _ _ h\u2081 h\u2082 \u21a6 ?_\n ext x\n exacts [ConcreteCategory.congr_hom h\u2081 _, ConcreteCategory.congr_hom h\u2082 _]\n\n/--\nWhen the predicate `P` is preserved under taking type-theoretic products and `PUnit` satisfies it,\nthen `CompHausLike P` is a cartesian monoidal category.\n\nThis could be an instance but that causes some slowness issues with typeclass search, therefore we\nkeep it as a def and turn it on as an instance for the explicit examples of `CompHausLike` as\nneeded.\n-/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.concreteCategory (L95-L97)\ninstance concreteCategory : ConcreteCategory (CompHausLike P) (C(\u00b7, \u00b7)) :=\nInducedCategory.concreteCategory toTop\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.mono_iff_injective (L209-L220)\ntheorem mono_iff_injective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) :\n Mono f \u2194 Function.Injective f := by\nconstructor\n \u00b7 intro hf x\u2081 x\u2082 h\n let g\u2081 : X \u27f6 X := ofHom _ \u27e8fun _ => x\u2081, continuous_const\u27e9\n let g\u2082 : X \u27f6 X := ofHom _ \u27e8fun _ => x\u2082, continuous_const\u27e9\n have : g\u2081 \u226b f = g\u2082 \u226b f := by ext; exact h\n exact CategoryTheory.congr_fun ((cancel_mono _).mp this) x\u2081\n \u00b7 rw [\u2190 CategoryTheory.mono_iff_injective]\n apply (forget (CompHausLike P)).mono_of_mono_map\n\n/-- Any continuous function on compact Hausdorff spaces is a closed map. -/\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.isoEquivHomeo (L109-L113)\ndef isoEquivHomeo {X Y : CompactlyGenerated.{u, w}} : (X \u2245 Y) \u2243 (X \u2243\u209c Y) where\n toFun := homeoOfIso\ninvFun := isoOfHomeo\n\nend CompactlyGenerated\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.pullback (L204-L213)\ndef pullback : CompHausLike P :=\nletI set := { xy : X \u00d7 Y | f xy.fst = g xy.snd }\n haveI : CompactSpace set :=\n isCompact_iff_compactSpace.mp (isClosed_eq (f.hom.hom.continuous.comp continuous_fst)\n (g.hom.hom.continuous.comp continuous_snd)).isCompact\n CompHausLike.of P set\n\n/--\nThe projection from the pullback to the first component.\n-/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Cartesian.cartesianMonoidalCategory (L63-L78)\ndef cartesianMonoidalCategory [\u2200 (X Y : CompHausLike.{u} P), HasProp P (X \u00d7 Y)]\n [HasProp P PUnit.{u + 1}] : CartesianMonoidalCategory (CompHausLike.{u} P) :=\n.ofChosenFiniteProducts\n \u27e8_, CompHausLike.isTerminalPUnit\u27e9\n (fun X Y \u21a6 \u27e8productCone X Y, productIsLimit X Y\u27e9)\n\nend Product\n\nsection Coproduct\n\nvariable [HasProp P (X \u2295 Y)]\n\n/--\nExplicit binary cofan in `CompHausLike P`, given that the predicate `P` is preserved under taking\ntype-theoretic sums.\n-/\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.of (L67-L71)\nabbrev of : CompHaus := CompHausLike.of _ X\nend CompHaus\n\n/-- The fully faithful embedding of `CompHaus` in `TopCat`. -/\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.CompHaus (L44-L47)\nabbrev CompHaus := CompHausLike (fun _ \u21a6 True)\nnamespace CompHaus\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Topology.Category.CompactlyGenerated.compactlyGeneratedToTop (L73-L76)\ndef compactlyGeneratedToTop : CompactlyGenerated.{u, w} \u2964 TopCat.{w} :=\ninducedFunctor _\n\n/-- `compactlyGeneratedToTop` is fully faithful. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Topology.Category.CompHaus.EffectiveEpi.effectiveEpi_tfae (L39-L50)\ntheorem effectiveEpi_tfae\n {B X : CompHaus.{u}} (\u03c0 : X \u27f6 B) :\n TFAE\n [ EffectiveEpi \u03c0\n , Epi \u03c0\n , Function.Surjective \u03c0\n ] := by\ntfae_have 1 \u2192 2 := fun _ \u21a6 inferInstance\n tfae_have 2 \u2194 3 := epi_iff_surjective \u03c0\n tfae_have 3 \u2192 1 := fun h\u03c0 \u21a6 \u27e8\u27e8effectiveEpiStruct \u03c0 h\u03c0\u27e9\u27e9\n tfae_finish\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Topology.Category.Compactum.isClosed_cl (L267-L271)\ntheorem isClosed_cl {X : Compactum} (A : Set X) : IsClosed (cl A) := by\nrw [isClosed_iff]\n intro F hF\n exact cl_cl _ \u27e8F, hF, rfl\u27e9\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.const (L267-L270)\ndef const {P : TopCat.{u} \u2192 Prop}\n (T : CompHausLike.{u} P) {S : CompHausLike.{u} P} (s : S) : T \u27f6 S :=\nofHom _ (ContinuousMap.const _ s)\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.epi_of_surjective (L204-L208)\ntheorem epi_of_surjective {X Y : CompHausLike.{u} P} (f : X \u27f6 Y) (hf : Function.Surjective f) :\n Epi f := by\nrw [\u2190 CategoryTheory.epi_iff_surjective] at hf\n exact (forget (CompHausLike P)).epi_of_epi_map hf\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Topology.Category.Compactum.Compactum (L85-L90)\ndef Compactum :=\nMonad.Algebra \u03b2 deriving Category, Inhabited\n\nnamespace Compactum\n\n/-- The forgetful functor to Type* -/\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Topology.Category.CompHausLike.SigmaComparison.sigmaComparison_eq_comp_isos (L47-L68)\ntheorem sigmaComparison_eq_comp_isos : sigmaComparison X \u03c3 =\n (X.mapIso (opCoproductIsoProduct'\n (finiteCoproduct.isColimit.{u, u} (fun a \u21a6 of P (\u03c3 a)))\n (productIsProduct fun x \u21a6 Opposite.op (of P (\u03c3 x))))).hom \u226b\n (PreservesProduct.iso X fun a \u21a6 \u27e8of P (\u03c3 a)\u27e9).hom \u226b\n (Types.productIso.{u, max u w} fun a \u21a6 X.obj \u27e8of P (\u03c3 a)\u27e9).hom := by\next x a\n simp only [Cofan.mk_pt, Fan.mk_pt, Functor.mapIso_hom,\n PreservesProduct.iso_hom, types_comp_apply, Types.productIso_hom_comp_eval_apply]\n have := congrFun (piComparison_comp_\u03c0 X (fun a \u21a6 \u27e8of P (\u03c3 a)\u27e9) a)\n simp only [types_comp_apply] at this\n rw [this, \u2190 FunctorToTypes.map_comp_apply]\n simp only [sigmaComparison]\n apply congrFun\n congr 2\n rw [\u2190 opCoproductIsoProduct_inv_comp_\u03b9]\n simp only [Opposite.unop_op, unop_comp, Quiver.Hom.unop_op, Category.assoc]\n simp only [opCoproductIsoProduct, \u2190 unop_comp, opCoproductIsoProduct'_comp_self]\n erw [IsColimit.fac]\n rfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Topology.Category.CompHaus.EffectiveEpi.effectiveEpiFamily_of_jointly_surjective (L102-L109)\ntheorem effectiveEpiFamily_of_jointly_surjective\n {\u03b1 : Type} [Finite \u03b1] {B : CompHaus.{u}}\n (X : \u03b1 \u2192 CompHaus.{u}) (\u03c0 : (a : \u03b1) \u2192 (X a \u27f6 B))\n (surj : \u2200 b : B, \u2203 (a : \u03b1) (x : X a), \u03c0 a x = b) :\n EffectiveEpiFamily X \u03c0 :=\n((effectiveEpiFamily_tfae X \u03c0).out 2 0).mp surj\n\nend CompHaus\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Topology.Category.Compactum.join (L128-L131)\ndef join (X : Compactum) : Ultrafilter (Ultrafilter X) \u2192 Ultrafilter X :=\n(\u03b2).\u03bc.app _\n\n/-- The inclusion of `X` into `Ultrafilter X`. -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.hasForget\u2082 (L98-L106)\ninstance hasForget\u2082 : HasForget\u2082 (CompHausLike P) TopCat :=\nInducedCategory.hasForget\u2082 _\n\nvariable (X : Type u) [TopologicalSpace X] [CompactSpace X] [T2Space X]\n\n/-- This wraps the predicate `P : TopCat \u2192 Prop` in a typeclass. -/\nclass HasProp : Prop where\n hasProp : P (TopCat.of X)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Topology.Category.CompHaus.Limits.isTerminalPUnit (L35-L43)\nabbrev isTerminalPUnit : IsTerminal (CompHaus.of PUnit.{u + 1}) := CompHausLike.isTerminalPUnit\n/-- The isomorphism from an arbitrary terminal object of `CompHaus` to a one-element space. -/\nnoncomputable def terminalIsoPUnit : \u22a4_ CompHaus.{u} \u2245 CompHaus.of PUnit :=\n terminalIsTerminal.uniqueUpToIso CompHaus.isTerminalPUnit\n\nnoncomputable example : PreservesFiniteCoproducts compHausToTop := inferInstance\n\nend CompHaus\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.coe_of (L120-L121)\ntheorem coe_of : (CompHausLike.of P X : Type _) = X := rfl\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Topology.Category.CompHaus.Frm.topCatOpToFrm (L22-L26)\ndef topCatOpToFrm : TopCat\u1d52\u1d56 \u2964 Frm where\n obj X := Frm.of (Opens (unop X : TopCat))\nmap f := Frm.ofHom <| Opens.comap <| (Quiver.Hom.unop f).hom\n\n-- Note, `CompHaus` is too strong. We only need `T0Space`.\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Limits.isTerminalPUnit (L367-L375)\ndef isTerminalPUnit [HasProp P PUnit.{u + 1}] :\n IsTerminal (CompHausLike.of P PUnit.{u + 1}) :=\nhaveI : \u2200 X, Unique (X \u27f6 CompHausLike.of P PUnit.{u + 1}) := fun _ \u21a6\n \u27e8\u27e8ofHom _ \u27e8fun _ \u21a6 PUnit.unit, continuous_const\u27e9\u27e9, fun _ \u21a6 rfl\u27e9\n Limits.IsTerminal.ofUnique _\n\nend Terminal\n\nend CompHausLike\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Topology.Category.CompHaus.Basic.compHausToTop (L72-L77)\nabbrev compHausToTop : CompHaus.{u} \u2964 TopCat.{u} :=\nCompHausLike.compHausLikeToTop _\n\n/-- (Implementation) The object part of the compactification functor from topological spaces to\ncompact Hausdorff spaces.\n-/\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Topology.Category.Compactum.join_distrib (L149-L154)\ntheorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) :\n X.str (X.join uux) = X.str (map X.str uux) := by\nchange ((\u03b2).\u03bc.app _ \u226b X.a) _ = _\n rw [Monad.Algebra.assoc]\n rfl\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Topology.Category.CompHaus.EffectiveEpi.effectiveEpiFamily_tfae (L59-L101)\ntheorem effectiveEpiFamily_tfae\n {\u03b1 : Type} [Finite \u03b1] {B : CompHaus.{u}}\n (X : \u03b1 \u2192 CompHaus.{u}) (\u03c0 : (a : \u03b1) \u2192 (X a \u27f6 B)) :\n TFAE\n [ EffectiveEpiFamily X \u03c0\n , Epi (Sigma.desc \u03c0)\n , \u2200 b : B, \u2203 (a : \u03b1) (x : X a), \u03c0 a x = b\n ] := by\ntfae_have 2 \u2192 1\n | _ => by\n simpa [\u2190 effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc \u03c0)).out 0 1]\n tfae_have 1 \u2192 2\n | _ => inferInstance\n tfae_have 3 \u2192 2\n | e => by\n rw [epi_iff_surjective]\n intro b\n obtain \u27e8t, x, h\u27e9 := e b\n refine \u27e8Sigma.\u03b9 X t x, ?_\u27e9\n change (Sigma.\u03b9 X t \u226b Sigma.desc \u03c0) x = _\n simpa using h\n tfae_have 2 \u2192 3\n | e => by\n rw [epi_iff_surjective] at e\n let i : \u2210 X \u2245 finiteCoproduct X :=\n (colimit.isColimit _).coconePointUniqueUpToIso (finiteCoproduct.isColimit _)\n intro b\n obtain \u27e8t, rfl\u27e9 := e b\n let q := i.hom t\n refine \u27e8q.1,q.2,?_\u27e9\n have : t = i.inv (i.hom t) := show t = (i.hom \u226b i.inv) t by simp only [i.hom_inv_id]; rfl\n rw [this]\n change _ = (i.inv \u226b Sigma.desc \u03c0) (i.hom t)\n suffices i.inv \u226b Sigma.desc \u03c0 = finiteCoproduct.desc X \u03c0 by\n rw [this]; rfl\n rw [Iso.inv_comp_eq]\n apply colimit.hom_ext\n rintro \u27e8a\u27e9\n simp only [i, Discrete.functor_obj, colimit.\u03b9_desc, Cofan.mk_pt, Cofan.mk_\u03b9_app,\n colimit.comp_coconePointUniqueUpToIso_hom_assoc]\n ext; rfl\n tfae_finish\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Topology.Category.Compactum.lim_eq_str (L352-L357)\ntheorem lim_eq_str {X : Compactum} (F : Ultrafilter X) : F.lim = X.str F := by\nrw [Ultrafilter.lim_eq_iff_le_nhds, le_nhds_iff]\n tauto\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Topology.Category.CompHausLike.Basic.fullyFaithfulToCompHausLike (L165-L167)\ndef fullyFaithfulToCompHausLike : (toCompHausLike h).FullyFaithful where\n preimage f := ConcreteCategory.ofHom f.hom.hom\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Topology.Category.CompHaus.Projective.projectivePresentation (L58-L65)\ndef projectivePresentation (X : CompHaus) : ProjectivePresentation X where\n p := of <| Ultrafilter X\nf := CompHausLike.ofHom _ \u27e8_, continuous_ultrafilter_extend id\u27e9\n projective := CompHaus.projective_ultrafilter X\n epi :=\n ConcreteCategory.epi_of_surjective _ fun x =>\n \u27e8(pure x : Ultrafilter X), congr_fun (ultrafilter_extend_extends (\ud835\udfd9 X)) x\u27e9\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Topology.Category.CompHaus.Frm.CompHausOpToFrame (L27-L30)\ninstance CompHausOpToFrame.faithful : (compHausToTop.op \u22d9 topCatOpToFrm.{u}).Faithful :=\n\u27e8fun {X _ _ _} h => Quiver.Hom.unop_inj <| ConcreteCategory.ext <|\n Opens.comap_injective (\u03b2 := (unop X).toTop) <| FrameHom.ext <|\n CategoryTheory.congr_fun h\u27e9\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Category/Profinite/Nobeling/Successor.lean", "module": "Mathlib.Topology.Category.Profinite.Nobeling.Successor", "declaration": "Mathlib.Topology.Category.Profinite.Nobeling.Successor.Linear_CC'\u2080", "span": "L180-L184", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Category/Profinite/Nobeling/Successor.lean#L180"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 17200, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 46294, "lean_code_chars": 43010, "natural_language_chars": 3284, "lean_code_ratio": 0.9291, "line_count": 1433, "imports_count": 0, "declarations_count": 4953, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "b77594bc028651b1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Analysis.Calculus.FDeriv.Pow.HasFDerivAt", "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.Analysis.Calculus.FDeriv.Pow)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem HasFDerivAt.pow' (h : HasFDerivAt f f' x) (n : \u2115) :\n HasFDerivAt (f ^ n) (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasStrictFDerivAt (L48-L58)\ntheorem HasStrictFDerivAt.fun_pow' (h : HasStrictFDerivAt f f' x) (n : \u2115) :\n HasStrictFDerivAt (fun x \u21a6 f x ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) x :=\nmatch n with\n | 0 => by simpa using hasStrictFDerivAt_const 1 x\n | 1 => by simpa using h\n | n + 1 + 1 => by\n have := h.mul' (h.fun_pow' (n + 1))\n simp_rw [pow_succ' _ (n + 1)]\n refine this.congr_fderiv <| aux _ _ _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasStrictFDerivAt (L59-L62)\ntheorem HasStrictFDerivAt.pow' (h : HasStrictFDerivAt f f' x) (n : \u2115) :\n HasStrictFDerivAt (f ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) x := h.fun_pow' n\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.hasStrictFDerivAt_pow' (L63-L67)\ntheorem hasStrictFDerivAt_pow' (n : \u2115) {x : \ud835\udd38} :\n HasStrictFDerivAt (\ud835\udd5c := \ud835\udd5c) (fun x \u21a6 x ^ n)\n(\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> ContinuousLinearMap.id \ud835\udd5c _ <\u2022 x ^ i) x :=\n hasStrictFDerivAt_id _ |>.pow' n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasFDerivWithinAt (L68-L78)\ntheorem HasFDerivWithinAt.fun_pow' (h : HasFDerivWithinAt f f' s x) (n : \u2115) :\n HasFDerivWithinAt (fun x \u21a6 f x ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) s x :=\nmatch n with\n | 0 => by simpa using hasFDerivWithinAt_const 1 x s\n | 1 => by simpa using h\n | n + 1 + 1 => by\n have := h.mul' (h.fun_pow' (n + 1))\n simp_rw [pow_succ' _ (n + 1)]\n exact this.congr_fderiv <| aux _ _ _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasFDerivWithinAt (L79-L82)\ntheorem HasFDerivWithinAt.pow' (h : HasFDerivWithinAt f f' s x) (n : \u2115) :\n HasFDerivWithinAt (f ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) s x := h.fun_pow' n\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.hasFDerivWithinAt_pow' (L83-L87)\ntheorem hasFDerivWithinAt_pow' (n : \u2115) {x : \ud835\udd38} {s : Set \ud835\udd38} :\n HasFDerivWithinAt (\ud835\udd5c := \ud835\udd5c) (fun x \u21a6 x ^ n)\n(\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> ContinuousLinearMap.id \ud835\udd5c _ <\u2022 x ^ i) s x :=\n hasFDerivWithinAt_id _ _ |>.pow' n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.hasFDerivAt_pow' (L102-L106)\ntheorem hasFDerivAt_pow' (n : \u2115) {x : \ud835\udd38} :\n HasFDerivAt (\ud835\udd5c := \ud835\udd5c) (fun x \u21a6 x ^ n)\n(\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> ContinuousLinearMap.id \ud835\udd5c _ <\u2022 x ^ i) x :=\n hasFDerivAt_id _ |>.pow' n\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableWithinAt (L108-L111)\ntheorem DifferentiableWithinAt.fun_pow (hf : DifferentiableWithinAt \ud835\udd5c f s x) (n : \u2115) :\n DifferentiableWithinAt \ud835\udd5c (fun x => f x ^ n) s x :=\nlet \u27e8_, hf'\u27e9 := hf; \u27e8_, hf'.pow' n\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableWithinAt (L113-L116)\ntheorem DifferentiableWithinAt.pow (hf : DifferentiableWithinAt \ud835\udd5c f s x) :\n \u2200 n : \u2115, DifferentiableWithinAt \ud835\udd5c (f ^ n) s x :=\nhf.fun_pow\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiableWithinAt_pow (L117-L120)\ntheorem differentiableWithinAt_pow (n : \u2115) {x : \ud835\udd38} {s : Set \ud835\udd38} :\n DifferentiableWithinAt \ud835\udd5c (fun x : \ud835\udd38 => x ^ n) s x :=\ndifferentiableWithinAt_id.pow _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableAt (L122-L125)\ntheorem DifferentiableAt.fun_pow (hf : DifferentiableAt \ud835\udd5c f x) (n : \u2115) :\n DifferentiableAt \ud835\udd5c (fun x => f x ^ n) x :=\ndifferentiableWithinAt_univ.mp <| hf.differentiableWithinAt.pow n\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableAt (L127-L129)\ntheorem DifferentiableAt.pow (hf : DifferentiableAt \ud835\udd5c f x) (n : \u2115) :\n DifferentiableAt \ud835\udd5c (f ^ n) x := hf.fun_pow n\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiableAt_pow (L130-L132)\ntheorem differentiableAt_pow (n : \u2115) {x : \ud835\udd38} : DifferentiableAt \ud835\udd5c (fun x : \ud835\udd38 => x ^ n) x :=\ndifferentiableAt_id.pow _\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableOn (L134-L136)\ntheorem DifferentiableOn.fun_pow (hf : DifferentiableOn \ud835\udd5c f s) (n : \u2115) :\n DifferentiableOn \ud835\udd5c (fun x => f x ^ n) s := fun x h => (hf x h).pow n\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableOn (L138-L140)\ntheorem DifferentiableOn.pow (hf : DifferentiableOn \ud835\udd5c f s) (n : \u2115) :\n DifferentiableOn \ud835\udd5c (f ^ n) s := hf.fun_pow n\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiableOn_pow (L141-L143)\ntheorem differentiableOn_pow (n : \u2115) {s : Set \ud835\udd38} : DifferentiableOn \ud835\udd5c (fun x : \ud835\udd38 => x ^ n) s :=\ndifferentiableOn_id.pow n\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.Differentiable (L145-L148)\ntheorem Differentiable.fun_pow (hf : Differentiable \ud835\udd5c f) (n : \u2115) :\n Differentiable \ud835\udd5c fun x => f x ^ n :=\nfun x => (hf x).pow n\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.Differentiable (L150-L152)\ntheorem Differentiable.pow (hf : Differentiable \ud835\udd5c f) (n : \u2115) : Differentiable \ud835\udd5c (f ^ n) :=\nhf.fun_pow n\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiable_pow (L153-L155)\ntheorem differentiable_pow (n : \u2115) : Differentiable \ud835\udd5c fun x : \ud835\udd38 => x ^ n :=\ndifferentiable_id.pow _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderiv_fun_pow' (L156-L160)\ntheorem fderiv_fun_pow' (n : \u2115) (hf : DifferentiableAt \ud835\udd5c f x) :\n fderiv \ud835\udd5c (fun x \u21a6 f x ^ n) x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderiv \ud835\udd5c f x <\u2022 f x ^ i) :=\nhf.hasFDerivAt.pow' n |>.fderiv\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderiv_pow' (L161-L165)\ntheorem fderiv_pow' (n : \u2115) (hf : DifferentiableAt \ud835\udd5c f x) :\n fderiv \ud835\udd5c (f ^ n) x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderiv \ud835\udd5c f x <\u2022 f x ^ i) :=\nfderiv_fun_pow' n hf\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderiv_pow_ring' (L166-L170)\ntheorem fderiv_pow_ring' {x : \ud835\udd38} (n : \u2115) :\n fderiv \ud835\udd5c (fun x : \ud835\udd38 \u21a6 x ^ n) x\n = (\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> .id _ _ <\u2022 x ^ i) := by\nrw [fderiv_fun_pow' n differentiableAt_fun_id, fderiv_id']\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderivWithin_fun_pow' (L171-L176)\ntheorem fderivWithin_fun_pow' (hxs : UniqueDiffWithinAt \ud835\udd5c s x)\n (n : \u2115) (hf : DifferentiableWithinAt \ud835\udd5c f s x) :\n fderivWithin \ud835\udd5c (fun x \u21a6 f x ^ n) s x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderivWithin \ud835\udd5c f s x <\u2022 f x ^ i) :=\nhf.hasFDerivWithinAt.pow' n |>.fderivWithin hxs\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderivWithin_pow' (L177-L182)\ntheorem fderivWithin_pow' (hxs : UniqueDiffWithinAt \ud835\udd5c s x)\n (n : \u2115) (hf : DifferentiableWithinAt \ud835\udd5c f s x) :\n fderivWithin \ud835\udd5c (f ^ n) s x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderivWithin \ud835\udd5c f s x <\u2022 f x ^ i) :=\nfderivWithin_fun_pow' hxs n hf\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderivWithin_pow_ring' (L183-L203)\ntheorem fderivWithin_pow_ring' {s : Set \ud835\udd38} {x : \ud835\udd38} (n : \u2115) (hxs : UniqueDiffWithinAt \ud835\udd5c s x) :\n fderivWithin \ud835\udd5c (fun x : \ud835\udd38 \u21a6 x ^ n) s x\n = (\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> .id _ _ <\u2022 x ^ i) := by\nrw [fderivWithin_fun_pow' hxs n differentiableAt_fun_id.differentiableWithinAt,\n fderivWithin_id' hxs]\n\nend NormedRing\n\nsection NormedCommRing\nvariable [NontriviallyNormedField \ud835\udd5c] [NormedCommRing \ud835\udd38] [NormedAddCommGroup E]\nvariable [NormedAlgebra \ud835\udd5c \ud835\udd38] [NormedSpace \ud835\udd5c E] {f : E \u2192 \ud835\udd38} {f' : E \u2192L[\ud835\udd5c] \ud835\udd38} {x : E} {s : Set E}\n\nprivate theorem aux_sum_eq_pow (n : \u2115) :\n \u2211 i \u2208 Finset.range n, MulOpposite.op (f x ^ i) \u2022 f x ^ (n.pred - i) \u2022 f' =\n (n \u2022 f x ^ (n - 1)) \u2022 f' := by\n simp_rw [op_smul_eq_smul, smul_smul, \u2190 pow_add, \u2190 Finset.sum_smul]\n rw [Finset.sum_eq_card_nsmul, Finset.card_range, smul_assoc]\n intro a ha\n congr\n exact add_tsub_cancel_of_le (Nat.le_pred_of_lt <| Finset.mem_range.1 ha)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_normed (L68-L71)\ntheorem integral_normed : \u222b x, f.normed \u03bc x \u2202\u03bc = 1 := by\nsimp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), \u2190 smul_eq_mul, integral_smul]\n exact inv_mul_cancel\u2080 f.integral_pos.ne'\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_neg (L333-L339)\ntheorem y_neg (D : \u211d) (x : E) : y D (-x) = y D x := by\napply convolution_neg_of_neg_eq\n \u00b7 filter_upwards with x\n simp only [w_def, mul_inv_rev, smul_neg, u_neg, smul_eq_mul]\n \u00b7 filter_upwards with x\n simp only [\u03c6, indicator, mem_closedBall, dist_zero_right, norm_neg]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_le_div_measure_closedBall_rOut (L137-L152)\ntheorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure \u03bc] (K : \u211d) (h : f.rOut \u2264 K * f.rIn)\n (x : E) :\n f.normed \u03bc x \u2264 K ^ finrank \u211d E / \u03bc.real (closedBall c f.rOut) := by\nhave K_pos : 0 < K := by\n simpa [f.rIn_pos, not_lt.2 f.rIn_pos.le] using mul_pos_iff.1 (f.rOut_pos.trans_le h)\n have : f x / \u222b y, f y \u2202\u03bc \u2264 1 / \u222b y, f y \u2202\u03bc := by\n gcongr\n \u00b7 exact f.integral_pos.le\n \u00b7 exact f.le_one\n apply this.trans\n rw [div_le_div_iff\u2080 f.integral_pos, one_mul, \u2190 div_le_iff\u2080' (pow_pos K_pos _)]\n \u00b7 exact f.measure_closedBall_div_le_integral \u03bc K h\n \u00b7 exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rOut_pos).ne'\n measure_closedBall_lt_top.ne\n\nend ContDiffBump\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Calculus.AddTorsor.Coord.smooth_barycentric_coord (L22-L23)\ntheorem smooth_barycentric_coord (b : AffineBasis \u03b9 \ud835\udd5c E) (i : \u03b9) : ContDiff \ud835\udd5c \u22a4 (b.coord i) :=\n(\u27e8b.coord i, continuous_barycentric_coord b i\u27e9 : E \u2192\u1d2c[\ud835\udd5c] \ud835\udd5c).contDiff\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.rOut_pos (L104-L106)\ntheorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut :=\nf.rIn_pos.trans f.rIn_lt_rOut\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt (L43-L45)\ndef conformalFactorAt {f : E \u2192 F} {x : E} (h : ConformalAt f x) : \u211d :=\nClassical.choose (conformalAt_iff'.mp h)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.support_normed_eq (L72-L75)\ntheorem support_normed_eq : Function.support (f.normed \u03bc) = Metric.ball c f.rOut := by\nunfold ContDiffBump.normed\n rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.ContinuousMap (L55-L69)\ntheorem ContinuousMap.dense_setOf_contDiff : Dense {f : C(E, F) | ContDiff \u211d \u221e f} := by\nintro f\n rw [mem_closure_iff_nhds_basis\n (nhds_basis_uniformity uniformity_basis_dist.compactConvergenceUniformity)]\n simp only [Prod.forall, mem_setOf_eq, and_imp]\n intro K \u03b5 hK h\u03b5\n have : UniformContinuousOn f (cthickening 1 K) :=\n hK.cthickening.uniformContinuousOn_of_continuous <| by fun_prop\n rcases Metric.uniformContinuousOn_iff.mp this (\u03b5 / 2) (half_pos h\u03b5) with \u27e8\u03b4, h\u03b4, hf\u03b4\u27e9\n rcases (map_continuous f).exists_contDiff_dist_le_of_forall_mem_ball_dist_le\n (lt_min one_pos h\u03b4) with \u27e8g, hgc, hg\u27e9\n refine \u27e8\u27e8g, hgc.continuous\u27e9, hgc, fun x hx \u21a6 (hg _ _ fun y hy \u21a6 ?_).trans_lt (half_lt_self h\u03b5)\u27e9\n rw [mem_ball, lt_min_iff] at hy\n exact hf\u03b4 _ (mem_cthickening_of_dist_le _ x _ _ hx hy.1.le) _\n (self_subset_cthickening _ hx) hy.2 |>.le\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u (L245-L247)\ndef u (x : E) : \u211d :=\nClassical.choose (u_exists E) x\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt_inner_eq_mul_inner' (L49-L52)\ntheorem conformalFactorAt_inner_eq_mul_inner' {f : E \u2192 F} {x : E} (h : ConformalAt f x) (u v : E) :\n \u27ea(fderiv \u211d f x) u, (fderiv \u211d f x) v\u27eb = (conformalFactorAt h : \u211d) * \u27eau, v\u27eb :=\n(Classical.choose_spec <| conformalAt_iff'.mp h).2 u v\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.exists_contDiff_tsupport_subset (L45-L76)\ntheorem exists_contDiff_tsupport_subset {s : Set E} {x : E} {n : \u2115\u221e} (hs : s \u2208 \ud835\udcdd x) :\n \u2203 f : E \u2192 \u211d,\n tsupport f \u2286 s \u2227 HasCompactSupport f \u2227 ContDiff \u211d n f \u2227 range f \u2286 Icc 0 1 \u2227 f x = 1 := by\nobtain \u27e8d : \u211d, d_pos : 0 < d, hd : Euclidean.closedBall x d \u2286 s\u27e9 :=\n Euclidean.nhds_basis_closedBall.mem_iff.1 hs\n let c : ContDiffBump (toEuclidean x) :=\n { rIn := d / 2\n rOut := d\n rIn_pos := half_pos d_pos\n rIn_lt_rOut := half_lt_self d_pos }\n let f : E \u2192 \u211d := c \u2218 toEuclidean\n have f_supp : f.support \u2286 Euclidean.ball x d := by\n intro y hy\n have : toEuclidean y \u2208 Function.support c := by\n simpa only [Function.mem_support, Function.comp_apply, Ne] using hy\n rwa [c.support_eq] at this\n have f_tsupp : tsupport f \u2286 Euclidean.closedBall x d := by\n rw [tsupport, \u2190 Euclidean.closure_ball _ d_pos.ne']\n exact closure_mono f_supp\n refine \u27e8f, f_tsupp.trans hd, ?_, ?_, ?_, ?_\u27e9\n \u00b7 refine isCompact_of_isClosed_isBounded isClosed_closure ?_\n have : IsBounded (Euclidean.closedBall x d) := Euclidean.isCompact_closedBall.isBounded\n refine this.subset (Euclidean.isClosed_closedBall.closure_subset_iff.2 ?_)\n exact f_supp.trans Euclidean.ball_subset_closedBall\n \u00b7 apply c.contDiff.comp\n exact ContinuousLinearEquiv.contDiff _\n \u00b7 rintro t \u27e8y, rfl\u27e9\n exact \u27e8c.nonneg, c.le_one\u27e9\n \u00b7 apply c.one_of_mem_closedBall\n apply mem_closedBall_self\n exact (half_pos d_pos).le\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.MeasureTheory (L32-L40)\ntheorem MeasureTheory.LocallyIntegrable.exists_contDiff_dist_le_of_forall_mem_ball_dist_le\n [MeasurableSpace E] [BorelSpace E] {\u03bc : Measure E} [\u03bc.IsAddHaarMeasure]\n (hf : LocallyIntegrable f \u03bc) (h\u03b5 : 0 < \u03b5) :\n \u2203 g : E \u2192 F, ContDiff \u211d \u221e g \u2227 \u2200 a, \u2200 \u03b4, (\u2200 x \u2208 ball a \u03b5, dist (f x) (f a) \u2264 \u03b4) \u2192\n dist (g a) (f a) \u2264 \u03b4 := by\nset \u03c6 : ContDiffBump (0 : E) := \u27e8\u03b5 / 2, \u03b5, half_pos h\u03b5, half_lt_self h\u03b5\u27e9\n refine \u27e8_, ?_, fun a \u03b4 \u21a6 \u03c6.dist_normed_convolution_le hf.aestronglyMeasurable\u27e9\n exact \u03c6.hasCompactSupport_normed.contDiff_convolution_left _ \u03c6.contDiff_normed hf\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.nonneg (L142-L145)\ntheorem nonneg : 0 \u2264 f x :=\n(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).1\n\n/-- A version of `ContDiffBump.nonneg` with `x` explicit -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.nonneg' (L146-L147)\ntheorem nonneg' (x : E) : 0 \u2264 f x := f.nonneg\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_nonneg (L263-L265)\ntheorem u_nonneg (x : E) : 0 \u2264 u x :=\n((Classical.choose_spec (u_exists E)).2.1 x).1\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_eq_zero_of_notMem_ball (L358-L374)\ntheorem y_eq_zero_of_notMem_ball {D : \u211d} {x : E} (Dpos : 0 < D) (hx : x \u2209 ball (0 : E) (1 + D)) :\n y D x = 0 := by\nchange (w D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6) x = 0\n have B : \u2200 y, y \u2208 ball x D \u2192 \u03c6 y = 0 := by\n intro y hy\n simp only [\u03c6, indicator, mem_closedBall_zero_iff, ite_eq_right_iff, one_ne_zero]\n intro h'y\n have C : ball y D \u2286 ball 0 (1 + D) := by\n apply ball_subset_ball'\n rw [\u2190 dist_zero_right] at h'y\n linarith only [h'y]\n exact hx (C (mem_ball_comm.1 hy))\n have Bx : \u03c6 x = 0 := B _ (mem_ball_self Dpos)\n have B' : \u2200 y, y \u2208 ball x D \u2192 \u03c6 y = \u03c6 x := by rw [Bx]; exact B\n rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']\n simp only [lsmul_apply, smul_eq_mul, Bx, mul_zero, integral_const]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_pos_of_mem_ball (L390-L428)\ntheorem y_pos_of_mem_ball {D : \u211d} {x : E} (Dpos : 0 < D) (D_lt_one : D < 1)\n (hx : x \u2208 ball (0 : E) (1 + D)) : 0 < y D x := by\nsimp only [mem_ball_zero_iff] at hx\n refine (integral_pos_iff_support_of_nonneg (w_mul_\u03c6_nonneg D x) ?_).2 ?_\n \u00b7 have F_comp : HasCompactSupport (w D) := w_compact_support E Dpos\n have B : LocallyIntegrable (\u03c6 : E \u2192 \u211d) \u03bc :=\n (locallyIntegrable_const _).indicator measurableSet_closedBall\n have C : Continuous (w D : E \u2192 \u211d) :=\n continuous_const.mul ((u_continuous E).comp (by fun_prop))\n exact (F_comp.convolutionExists_left (lsmul \u211d \u211d : \u211d \u2192L[\u211d] \u211d \u2192L[\u211d] \u211d) C B x).integrable\n \u00b7 set z := (D / (1 + D)) \u2022 x with hz\n have B : 0 < 1 + D := by linarith\n have C : ball z (D * (1 + D - \u2016x\u2016) / (1 + D)) \u2286 support fun y : E => w D y * \u03c6 (x - y) := by\n intro y hy\n simp only [support_mul, w_support E Dpos]\n simp only [\u03c6, mem_inter_iff, mem_support, Ne, indicator_apply_eq_zero,\n mem_closedBall_zero_iff, one_ne_zero, not_forall, not_false_iff, exists_prop, and_true]\n constructor\n \u00b7 apply ball_subset_ball' _ hy\n simp only [hz, norm_smul, abs_of_nonneg Dpos.le, abs_of_nonneg B.le, dist_zero_right,\n Real.norm_eq_abs, abs_div]\n field_simp\n linarith only\n \u00b7 have ID : \u2016D / (1 + D) - 1\u2016 = 1 / (1 + D) := by\n rw [Real.norm_of_nonpos]\n \u00b7 field\n \u00b7 field_simp\n linarith only\n rw [\u2190 mem_closedBall_iff_norm']\n apply closedBall_subset_closedBall' _ (ball_subset_closedBall hy)\n rw [\u2190 one_smul \u211d x, dist_eq_norm, hz, \u2190 sub_smul, one_smul, norm_smul, ID]\n field_simp\n nlinarith only [hx, D_lt_one]\n apply lt_of_lt_of_le _ (measure_mono C)\n apply measure_ball_pos\n exact div_pos (mul_pos Dpos (by linarith only [hx])) B\n\nvariable (E)\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.zero_of_le_dist (L163-L168)\ntheorem zero_of_le_dist (hx : f.rOut \u2264 dist x c) : f x = 0 := by\nrwa [\u2190 notMem_support, support_eq, mem_ball, not_lt]\n\nprotected theorem hasCompactSupport [FiniteDimensional \u211d E] : HasCompactSupport f := by\n simp_rw [HasCompactSupport, f.tsupport_eq, isCompact_closedBall]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_compact_support (L257-L262)\ntheorem u_compact_support : HasCompactSupport (u : E \u2192 \u211d) := by\nrw [hasCompactSupport_def, u_support, closure_ball (0 : E) one_ne_zero]\n exact isCompact_closedBall _ _\n\nvariable {E}\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Analysis.Calculus.AddTorsor.AffineMap.contDiff (L31-L36)\ntheorem contDiff {n : WithTop \u2115\u221e} (f : V \u2192\u1d2c[\ud835\udd5c] W) : ContDiff \ud835\udd5c n f := by\nrw [f.decomp]\n apply f.contLinear.contDiff.add\n exact contDiff_const\n\nend ContinuousAffineMap\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.le_one (L148-L150)\ntheorem le_one : f x \u2264 1 :=\n(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).2\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_support (L456-L463)\ntheorem y_support {D : \u211d} (Dpos : 0 < D) (D_lt_one : D < 1) :\n support (y D : E \u2192 \u211d) = ball (0 : E) (1 + D) :=\nsupport_eq_iff.2\n \u27e8fun _ hx => (y_pos_of_mem_ball Dpos D_lt_one hx).ne', fun _ hx =>\n y_eq_zero_of_notMem_ball Dpos hx\u27e9\n\nend HelperDefinitions\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalAt_iff' (L31-L36)\ntheorem conformalAt_iff' {f : E \u2192 F} {x : E} : ConformalAt f x \u2194\n \u2203 c : \u211d, 0 < c \u2227 \u2200 u v : E, \u27eafderiv \u211d f x u, fderiv \u211d f x v\u27eb = c * \u27eau, v\u27eb := by\nrw [conformalAt_iff_isConformalMap_fderiv, isConformalMap_iff]\n\n/-- A real differentiable map `f` is conformal at point `x` if and only if its\ndifferential `f'` at that point scales every inner product by a positive scalar. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.dist_normed_convolution_le (L75-L97)\ntheorem dist_normed_convolution_le {x\u2080 : G} {\u03b5 : \u211d} (hmg : AEStronglyMeasurable g \u03bc)\n (hg : \u2200 x \u2208 ball x\u2080 \u03c6.rOut, dist (g x) (g x\u2080) \u2264 \u03b5) :\n dist ((\u03c6.normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g : G \u2192 E') x\u2080) (g x\u2080) \u2264 \u03b5 :=\ndist_convolution_le (by simp_rw [\u2190 dist_self (g x\u2080), hg x\u2080 (mem_ball_self \u03c6.rOut_pos)])\n \u03c6.support_normed_eq.subset \u03c6.nonneg_normed \u03c6.integral_normed hmg hg\n\n/-- `(\u03c6 i \u22c6 g i) (k i)` tends to `z\u2080` as `i` tends to some filter `l` if\n* `\u03c6` is a sequence of normed bump functions\n such that `(\u03c6 i).rOut` tends to `0` as `i` tends to `l`;\n* `g i` is `\u03bc`-a.e. strongly measurable as `i` tends to `l`;\n* `g i x` tends to `z\u2080` as `(i, x)` tends to `l \u00d7\u02e2 \ud835\udcdd x\u2080`;\n* `k i` tends to `x\u2080`. -/\nnonrec theorem convolution_tendsto_right {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump (0 : G)} {g : \u03b9 \u2192 G \u2192 E'}\n {k : \u03b9 \u2192 G} {x\u2080 : G} {z\u2080 : E'} {l : Filter \u03b9} (h\u03c6 : Tendsto (fun i => (\u03c6 i).rOut) l (\ud835\udcdd 0))\n (hig : \u2200\u1da0 i in l, AEStronglyMeasurable (g i) \u03bc) (hcg : Tendsto (uncurry g) (l \u00d7\u02e2 \ud835\udcdd x\u2080) (\ud835\udcdd z\u2080))\n (hk : Tendsto k l (\ud835\udcdd x\u2080)) :\n Tendsto (fun i => ((\u03c6 i).normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g i) (k i)) l (\ud835\udcdd z\u2080) :=\n convolution_tendsto_right (Eventually.of_forall fun i => (\u03c6 i).nonneg_normed)\n (Eventually.of_forall fun i => (\u03c6 i).integral_normed) (tendsto_support_normed_smallSets h\u03c6) hig\n hcg hk\n\n/-- Special case of `ContDiffBump.convolution_tendsto_right` where `g` is continuous,\n and the limit is taken only in the first function. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.\u03c6 (L204-L212)\ndef \u03c6 : E \u2192 \u211d :=\n(closedBall (0 : E) 1).indicator fun _ => (1 : \u211d)\n\nvariable [NormedSpace \u211d E] [FiniteDimensional \u211d E]\n\nsection HelperDefinitions\n\nvariable (E)\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.Continuous (L41-L47)\ntheorem Continuous.exists_contDiff_dist_le_of_forall_mem_ball_dist_le (hf : Continuous f)\n (h\u03b5 : 0 < \u03b5) :\n \u2203 g : E \u2192 F, ContDiff \u211d \u221e g \u2227 \u2200 a, \u2200 \u03b4, (\u2200 x \u2208 ball a \u03b5, dist (f x) (f a) \u2264 \u03b4) \u2192\n dist (g a) (f a) \u2264 \u03b4 := by\nborelize E\n exact (hf.locallyIntegrable (\u03bc := .addHaar)).exists_contDiff_dist_le_of_forall_mem_ball_dist_le h\u03b5\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_nonneg (L291-L297)\ntheorem w_nonneg (D : \u211d) (x : E) : 0 \u2264 w D x := by\napply mul_nonneg _ (u_nonneg _)\n apply inv_nonneg.2\n apply mul_nonneg (u_int_pos E).le\n norm_cast\n apply pow_nonneg (abs_nonneg D)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.eventuallyEq_one (L172-L195)\ntheorem eventuallyEq_one : f =\u1da0[\ud835\udcdd c] 1 :=\nf.eventuallyEq_one_of_mem_ball (mem_ball_self f.rIn_pos)\n\n/-- `ContDiffBump` is `\ud835\udc9e\u207f` in all its arguments. -/\nprotected theorem _root_.ContDiffWithinAt.contDiffBump {c g : X \u2192 E} {s : Set X}\n {f : \u2200 x, ContDiffBump (c x)} {x : X} (hc : ContDiffWithinAt \u211d n c s x)\n (hr : ContDiffWithinAt \u211d n (fun x => (f x).rIn) s x)\n (hR : ContDiffWithinAt \u211d n (fun x => (f x).rOut) s x)\n (hg : ContDiffWithinAt \u211d n g s x) :\n ContDiffWithinAt \u211d n (fun x => f x (g x)) s x := by\n change ContDiffWithinAt \u211d n (uncurry (someContDiffBumpBase E).toFun \u2218 fun x : X =>\n ((f x).rOut / (f x).rIn, (f x).rIn\u207b\u00b9 \u2022 (g x - c x))) s x\n refine (((someContDiffBumpBase E).smooth.contDiffAt ?_).of_le\n (mod_cast le_top)).comp_contDiffWithinAt x ?_\n \u00b7 exact prod_mem_nhds (Ioi_mem_nhds (f x).one_lt_rOut_div_rIn) univ_mem\n \u00b7 exact (hR.div hr (f x).rIn_pos.ne').prodMk ((hr.inv (f x).rIn_pos.ne').smul (hg.sub hc))\n\n/-- `ContDiffBump` is `\ud835\udc9e\u207f` in all its arguments. -/\nprotected nonrec theorem _root_.ContDiffAt.contDiffBump {c g : X \u2192 E} {f : \u2200 x, ContDiffBump (c x)}\n {x : X} (hc : ContDiffAt \u211d n c x) (hr : ContDiffAt \u211d n (fun x => (f x).rIn) x)\n (hR : ContDiffAt \u211d n (fun x => (f x).rOut) x) (hg : ContDiffAt \u211d n g x) :\n ContDiffAt \u211d n (fun x => f x (g x)) x :=\n hc.contDiffBump hr hR hg\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.measure_closedBall_le_integral (L102-L107)\ntheorem measure_closedBall_le_integral : \u03bc.real (closedBall c f.rIn) \u2264 \u222b x, f x \u2202\u03bc := by calc\n\u03bc.real (closedBall c f.rIn) = \u222b x in closedBall c f.rIn, 1 \u2202\u03bc := by simp\n _ = \u222b x in closedBall c f.rIn, f x \u2202\u03bc := setIntegral_congr_fun measurableSet_closedBall\n (fun x hx \u21a6 (one_of_mem_closedBall f hx).symm)\n _ \u2264 \u222b x, f x \u2202\u03bc := setIntegral_le_integral f.integrable (Eventually.of_forall (fun x \u21a6 f.nonneg))\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_le_one (L378-L389)\ntheorem y_le_one {D : \u211d} (x : E) (Dpos : 0 < D) : y D x \u2264 1 := by\nhave A : (w D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6) x \u2264 (w D \u22c6[lsmul \u211d \u211d, \u03bc] 1) x := by\n apply\n convolution_mono_right_of_nonneg _ (w_nonneg D) (indicator_le_self' fun x _ => zero_le_one)\n fun _ => zero_le_one\n refine ((w_compact_support E Dpos).convolutionExists_left _ ?_\n (locallyIntegrable_const (1 : \u211d)) x).integrable\n exact continuous_const.mul ((u_continuous E).comp (by fun_prop))\n have B : (w D \u22c6[lsmul \u211d \u211d, \u03bc] fun _ => (1 : \u211d)) x = 1 := by\n simp only [convolution, mul_one, lsmul_apply, smul_eq_mul, w_integral E Dpos]\n exact A.trans (le_of_eq B)\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.convolution_eq_right (L57-L64)\ntheorem convolution_eq_right [HasContDiffBump G] {x\u2080 : G} (hg : \u2200 x \u2208 ball x\u2080 \u03c6.rOut, g x = g x\u2080) :\n (\u03c6 \u22c6[lsmul \u211d \u211d, \u03bc] g : G \u2192 E') x\u2080 = integral \u03bc \u03c6 \u2022 g x\u2080 := by\nsimp_rw [convolution_eq_right' _ \u03c6.support_eq.subset hg, lsmul_apply, integral_smul_const]\n\nvariable [BorelSpace G] [FiniteDimensional \u211d G]\n\n/-- If `\u03c6` is a normed bump function, compute `\u03c6 \u22c6 g`\nif `g` is constant on `Metric.ball x\u2080 \u03c6.rOut`. -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.ae_convolution_tendsto_right_of_locallyIntegrable (L107-L137)\ntheorem ae_convolution_tendsto_right_of_locallyIntegrable\n {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump (0 : G)} {l : Filter \u03b9} {K : \u211d}\n (h\u03c6 : Tendsto (fun i \u21a6 (\u03c6 i).rOut) l (\ud835\udcdd 0))\n (h'\u03c6 : \u2200\u1da0 i in l, (\u03c6 i).rOut \u2264 K * (\u03c6 i).rIn) (hg : LocallyIntegrable g \u03bc) : \u2200\u1d50 x\u2080 \u2202\u03bc,\n Tendsto (fun i \u21a6 ((\u03c6 i).normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g) x\u2080) l (\ud835\udcdd (g x\u2080)) := by\n-- By Lebesgue differentiation theorem, the average of `g` on a small ball converges\n -- almost everywhere to the value of `g` as the radius shrinks to zero.\n -- We will see that this set of points satisfies the desired conclusion.\n filter_upwards [(Besicovitch.vitaliFamily \u03bc).ae_tendsto_average_norm_sub hg] with x\u2080 h\u2080\n simp only [convolution_eq_swap, lsmul_apply]\n have h\u03c6' : Tendsto (fun i \u21a6 (\u03c6 i).rOut) l (\ud835\udcdd[>] 0) :=\n tendsto_nhdsWithin_iff.2 \u27e8h\u03c6, Eventually.of_forall (fun i \u21a6 (\u03c6 i).rOut_pos)\u27e9\n have := (h\u2080.comp (Besicovitch.tendsto_filterAt \u03bc x\u2080)).comp h\u03c6'\n simp only at this\n apply tendsto_integral_smul_of_tendsto_average_norm_sub (K ^ (Module.finrank \u211d G)) this\n \u00b7 filter_upwards with i using\n hg.integrableOn_isCompact (isCompact_closedBall _ _)\n \u00b7 apply tendsto_const_nhds.congr (fun i \u21a6 ?_)\n rw [\u2190 integral_neg_eq_self]\n simp only [sub_neg_eq_add, integral_add_left_eq_self, integral_normed]\n \u00b7 filter_upwards with i\n change support ((ContDiffBump.normed (\u03c6 i) \u03bc) \u2218 (fun y \u21a6 x\u2080 - y)) \u2286 closedBall x\u2080 (\u03c6 i).rOut\n simp only [support_comp_eq_preimage, support_normed_eq]\n intro x hx\n simp only [mem_preimage, mem_ball, dist_zero_right] at hx\n simpa [dist_eq_norm_sub'] using hx.le\n \u00b7 filter_upwards [h'\u03c6] with i hi x\n rw [abs_of_nonneg (nonneg_normed _ _), addHaar_real_closedBall_center]\n exact (\u03c6 i).normed_le_div_measure_closedBall_rOut _ _ hi _\n\nend ContDiffBump\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_continuous (L251-L253)\ntheorem u_continuous : Continuous (u : E \u2192 \u211d) :=\n(u_smooth E).continuous\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.NormedSpace.ConformalAt (L58-L60)\ndef ConformalAt (f : X \u2192 Y) (x : X) :=\n\u2203 f' : X \u2192L[\u211d] Y, HasFDerivAt f f' x \u2227 IsConformalMap f'\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_def (L34-L36)\ntheorem normed_def {\u03bc : Measure E} (x : E) : f.normed \u03bc x = f x / \u222b x, f x \u2202\u03bc :=\nrfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.pos_of_mem_ball (L160-L162)\ntheorem pos_of_mem_ball (hx : x \u2208 ball c f.rOut) : 0 < f x :=\nf.nonneg.lt_of_ne' <| by rwa [\u2190 support_eq, mem_support] at hx\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_exists (L213-L244)\ntheorem u_exists :\n \u2203 u : E \u2192 \u211d,\n ContDiff \u211d \u221e u \u2227 (\u2200 x, u x \u2208 Icc (0 : \u211d) 1) \u2227 support u = ball 0 1 \u2227 \u2200 x, u (-x) = u x := by\nhave A : IsOpen (ball (0 : E) 1) := isOpen_ball\n obtain \u27e8f, f_support, f_smooth, f_range\u27e9 :\n \u2203 f : E \u2192 \u211d, f.support = ball (0 : E) 1 \u2227 ContDiff \u211d \u221e f \u2227 Set.range f \u2286 Set.Icc 0 1 :=\n A.exists_contDiff_support_eq\n have B : \u2200 x, f x \u2208 Icc (0 : \u211d) 1 := fun x => f_range (mem_range_self x)\n refine \u27e8fun x => (f x + f (-x)) / 2, ?_, ?_, ?_, ?_\u27e9\n \u00b7 exact (f_smooth.add (f_smooth.comp contDiff_neg)).div_const _\n \u00b7 intro x\n push _ \u2208 _\n constructor\n \u00b7 linarith [(B x).1, (B (-x)).1]\n \u00b7 linarith [(B x).2, (B (-x)).2]\n \u00b7 refine support_eq_iff.2 \u27e8fun x hx => ?_, fun x hx => ?_\u27e9\n \u00b7 apply ne_of_gt\n have : 0 < f x := by\n apply lt_of_le_of_ne (B x).1 (Ne.symm _)\n rwa [\u2190 f_support] at hx\n linarith [(B (-x)).1]\n \u00b7 have I1 : x \u2209 support f := by rwa [f_support]\n have I2 : -x \u2209 support f := by\n rw [f_support]\n simpa using hx\n simp only [mem_support, Classical.not_not] at I1 I2\n simp only [I1, I2, add_zero, zero_div]\n \u00b7 intro x; simp only [add_comm, neg_neg]\n\nvariable {E} in\n/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces,\nwhich is smooth, symmetric, and with support equal to the unit ball. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_eq_one_of_mem_closedBall (L340-L357)\ntheorem y_eq_one_of_mem_closedBall {D : \u211d} {x : E} (Dpos : 0 < D)\n (hx : x \u2208 closedBall (0 : E) (1 - D)) : y D x = 1 := by\nchange (w D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6) x = 1\n have B : \u2200 y : E, y \u2208 ball x D \u2192 \u03c6 y = 1 := by\n have C : ball x D \u2286 ball 0 1 := by\n apply ball_subset_ball'\n simp only [mem_closedBall] at hx\n linarith only [hx]\n intro y hy\n simp only [\u03c6, indicator, mem_closedBall, ite_eq_left_iff, not_le, zero_ne_one]\n intro h'y\n linarith only [mem_ball.1 (C hy), h'y]\n have Bx : \u03c6 x = 1 := B _ (mem_ball_self Dpos)\n have B' : \u2200 y, y \u2208 ball x D \u2192 \u03c6 y = \u03c6 x := by rw [Bx]; exact B\n rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']\n simp only [lsmul_apply, smul_eq_mul, integral_mul_const, w_integral E Dpos, Bx,\n one_mul]\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt_pos (L46-L48)\ntheorem conformalFactorAt_pos {f : E \u2192 F} {x : E} (h : ConformalAt f x) : 0 < conformalFactorAt h :=\n(Classical.choose_spec <| conformalAt_iff'.mp h).1\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w (L284-L286)\ndef w (D : \u211d) (x : E) : \u211d :=\n((\u222b x : E, u x \u2202\u03bc) * |D| ^ finrank \u211d E)\u207b\u00b9 \u2022 u (D\u207b\u00b9 \u2022 x)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y (L330-L332)\ndef y (D : \u211d) : E \u2192 \u211d :=\nw D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.one_of_mem_closedBall (L137-L141)\ntheorem one_of_mem_closedBall (hx : x \u2208 closedBall c f.rIn) : f x = 1 := by\napply ContDiffBumpBase.eq_one _ _ f.one_lt_rOut_div_rIn\n simpa only [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg f.rIn_pos.le, \u2190 div_eq_inv_mul,\n div_le_one f.rIn_pos] using mem_closedBall_iff_norm.1 hx\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_neg (L49-L59)\ntheorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed \u03bc (-x) = f.normed \u03bc x := by\nsimp_rw [f.normed_def, f.neg]\n\nvariable [BorelSpace E] [FiniteDimensional \u211d E] [IsLocallyFiniteMeasure \u03bc]\n\nprotected theorem integrable : Integrable f \u03bc :=\n f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport\n\nprotected theorem integrable_normed : Integrable (f.normed \u03bc) \u03bc :=\n f.integrable.div_const _\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.one_lt_rOut_div_rIn (L107-L110)\ntheorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn := by\nrw [one_lt_div f.rIn_pos]\n exact f.rIn_lt_rOut\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.tendsto_support_normed_smallSets (L82-L93)\ntheorem tendsto_support_normed_smallSets {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump c} {l : Filter \u03b9}\n (h\u03c6 : Tendsto (fun i => (\u03c6 i).rOut) l (\ud835\udcdd 0)) :\n Tendsto (fun i => Function.support fun x => (\u03c6 i).normed \u03bc x) l (\ud835\udcdd c).smallSets := by\nsimp_rw [NormedAddGroup.tendsto_nhds_zero, Real.norm_eq_abs,\n abs_eq_self.mpr (\u03c6 _).rOut_pos.le] at h\u03c6\n rw [nhds_basis_ball.smallSets.tendsto_right_iff]\n refine fun \u03b5 h\u03b5 \u21a6 (h\u03c6 \u03b5 h\u03b5).mono fun i hi \u21a6 ?_\n rw [(\u03c6 i).support_normed_eq]\n exact ball_subset_ball hi.le\n\nvariable (\u03bc)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.continuous_normed (L43-L45)\ntheorem continuous_normed : Continuous (f.normed \u03bc) :=\nf.continuous.div_const _\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.tsupport_eq (L157-L159)\ntheorem tsupport_eq : tsupport f = closedBall c f.rOut := by\nsimp_rw [tsupport, f.support_eq, closure_ball _ f.rOut_pos.ne']\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_normed_smul (L94-L97)\ntheorem integral_normed_smul {X} [NormedAddCommGroup X] [NormedSpace \u211d X]\n [CompleteSpace X] (z : X) : \u222b x, f.normed \u03bc x \u2022 z \u2202\u03bc = z := by\nsimp_rw [integral_smul_const, f.integral_normed (\u03bc := \u03bc), one_smul]\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_le_one (L266-L268)\ntheorem u_le_one (x : E) : u x \u2264 1 :=\n((Classical.choose_spec (u_exists E)).2.1 x).2\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.hasCompactSupport_normed (L79-L81)\ntheorem hasCompactSupport_normed : HasCompactSupport (f.normed \u03bc) := by\nsimp only [HasCompactSupport, f.tsupport_normed_eq (\u03bc := \u03bc), isCompact_closedBall]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_compact_support (L320-L329)\ntheorem w_compact_support {D : \u211d} (Dpos : 0 < D) : HasCompactSupport (w D : E \u2192 \u211d) := by\nrw [hasCompactSupport_def, w_support E Dpos, closure_ball (0 : E) Dpos.ne']\n exact isCompact_closedBall _ _\n\nvariable {E}\n\n/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces.\nIt is the convolution between a smooth function of integral `1` supported in the ball of radius `D`,\nwith the indicator function of the closed unit ball. Therefore, it is smooth, equal to `1` on the\nball of radius `1 - D`, with support equal to the ball of radius `1 + D`. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_mul_\u03c6_nonneg (L298-L304)\ntheorem w_mul_\u03c6_nonneg (D : \u211d) (x y : E) : 0 \u2264 w D y * \u03c6 (x - y) :=\nmul_nonneg (w_nonneg D y) (indicator_nonneg (by simp only [zero_le_one, imp_true_iff]) _)\n\nvariable (E)\n\n-- see https://github.com/leanprover-community/mathlib4/issues/29041\nset_option linter.unusedSimpArgs false in\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_def (L287-L290)\ntheorem w_def (D : \u211d) :\n (w D : E \u2192 \u211d) = fun x => ((\u222b x : E, u x \u2202\u03bc) * |D| ^ finrank \u211d E)\u207b\u00b9 \u2022 u (D\u207b\u00b9 \u2022 x) := by\next1 x; rfl\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.someContDiffBumpBase (L98-L103)\ndef someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace \u211d E]\n [hb : HasContDiffBump E] : ContDiffBumpBase E :=\nNonempty.some hb.out\n\nnamespace ContDiffBump\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.convolution_tendsto_right_of_continuous (L98-L106)\ntheorem convolution_tendsto_right_of_continuous {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump (0 : G)} {l : Filter \u03b9}\n (h\u03c6 : Tendsto (fun i => (\u03c6 i).rOut) l (\ud835\udcdd 0)) (hg : Continuous g) (x\u2080 : G) :\n Tendsto (fun i => ((\u03c6 i).normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g) x\u2080) l (\ud835\udcdd (g x\u2080)) :=\nconvolution_tendsto_right h\u03c6 (Eventually.of_forall fun _ => hg.aestronglyMeasurable)\n ((hg.tendsto x\u2080).comp tendsto_snd) tendsto_const_nhds\n\n/-- If a function `g` is locally integrable, then the convolution `\u03c6 i * g` converges almost\neverywhere to `g` if `\u03c6 i` is a sequence of bump functions with support tending to `0`, provided\nthat the ratio between the inner and outer radii of `\u03c6 i` remains bounded. -/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.eventuallyEq_one_of_mem_ball (L169-L171)\ntheorem eventuallyEq_one_of_mem_ball (h : x \u2208 ball c f.rIn) : f =\u1da0[\ud835\udcdd x] 1 :=\nmem_of_superset (closedBall_mem_nhds_of_mem h) fun _ \u21a6 f.one_of_mem_closedBall\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_sub (L46-L48)\ntheorem normed_sub (x : E) : f.normed \u03bc (c - x) = f.normed \u03bc (c + x) := by\nsimp_rw [f.normed_def, f.sub]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.contDiff_normed (L40-L42)\ntheorem contDiff_normed {n : \u2115\u221e} : ContDiff \u211d n (f.normed \u03bc) :=\nf.contDiff.div_const _\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_neg (L269-L276)\ntheorem u_neg (x : E) : u (-x) = u x :=\n(Classical.choose_spec (u_exists E)).2.2.2 x\n\nvariable [MeasurableSpace E] [BorelSpace E]\n\nlocal notation \"\u03bc\" => MeasureTheory.Measure.addHaar\n\nvariable (E) in\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_le_div_measure_closedBall_rIn (L108-L115)\ntheorem normed_le_div_measure_closedBall_rIn [\u03bc.IsOpenPosMeasure] (x : E) :\n f.normed \u03bc x \u2264 1 / \u03bc.real (closedBall c f.rIn) := by\nrw [normed_def]\n gcongr\n \u00b7 exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rIn_pos).ne' measure_closedBall_lt_top.ne\n \u00b7 exact f.le_one\n \u00b7 exact f.measure_closedBall_le_integral \u03bc\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalAt_iff (L37-L42)\ntheorem conformalAt_iff {f : E \u2192 F} {x : E} {f' : E \u2192L[\u211d] F} (h : HasFDerivAt f f' x) :\n ConformalAt f x \u2194 \u2203 c : \u211d, 0 < c \u2227 \u2200 u v : E, \u27eaf' u, f' v\u27eb = c * \u27eau, v\u27eb := by\nsimp only [conformalAt_iff', h.fderiv]\n\n/-- The conformal factor of a conformal map at some point `x`. Some authors refer to this function\nas the characteristic function of the conformal map. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_nonneg (L375-L377)\ntheorem y_nonneg (D : \u211d) (x : E) : 0 \u2264 y D x :=\nintegral_nonneg (w_mul_\u03c6_nonneg D x)\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_smooth (L429-L455)\ntheorem y_smooth : ContDiffOn \u211d \u221e (uncurry y) (Ioo (0 : \u211d) 1 \u00d7\u02e2 (univ : Set E)) := by\nhave hs : IsOpen (Ioo (0 : \u211d) (1 : \u211d)) := isOpen_Ioo\n have hk : IsCompact (closedBall (0 : E) 1) := ProperSpace.isCompact_closedBall _ _\n refine contDiffOn_convolution_left_with_param (lsmul \u211d \u211d) hs hk ?_ ?_ ?_\n \u00b7 rintro p x hp hx\n simp only [w, mul_inv_rev, smul_eq_mul, mul_eq_zero, inv_eq_zero]\n right\n contrapose! hx\n have : p\u207b\u00b9 \u2022 x \u2208 support u := mem_support.2 hx\n simp only [u_support, norm_smul, mem_ball_zero_iff, Real.norm_eq_abs, abs_inv,\n abs_of_nonneg hp.1.le, \u2190 div_eq_inv_mul, div_lt_one hp.1] at this\n rw [mem_closedBall_zero_iff]\n exact this.le.trans hp.2.le\n \u00b7 exact (locallyIntegrable_const _).indicator measurableSet_closedBall\n \u00b7 apply ContDiffOn.mul\n \u00b7 norm_cast\n refine\n (contDiffOn_const.mul ?_).inv fun x hx =>\n ne_of_gt (mul_pos (u_int_pos E) (pow_pos (abs_pos_of_pos hx.1.1) (finrank \u211d E)))\n apply ContDiffOn.pow\n simp_rw [\u2190 Real.norm_eq_abs]\n apply ContDiffOn.norm \u211d\n \u00b7 exact contDiffOn_fst\n \u00b7 intro x hx; exact ne_of_gt hx.1.1\n \u00b7 apply (u_smooth E).comp_contDiffOn\n exact ContDiffOn.smul (contDiffOn_fst.inv fun x hx => ne_of_gt hx.1.1) contDiffOn_snd\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_support (L254-L256)\ntheorem u_support : support (u : E \u2192 \u211d) = ball 0 1 :=\n(Classical.choose_spec (u_exists E)).2.2.1\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.NormedSpace.conformalAt_const_smul (L64-L66)\ntheorem conformalAt_const_smul {c : \u211d} (h : c \u2260 0) (x : X) : ConformalAt (fun x' : X => c \u2022 x') x :=\n\u27e8c \u2022 ContinuousLinearMap.id \u211d X, (hasFDerivAt_id x).const_smul c, isConformalMap_const_smul h\u27e9\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_int_pos (L277-L283)\ntheorem u_int_pos : 0 < \u222b x : E, u x \u2202\u03bc := by\nrefine (integral_pos_iff_support_of_nonneg u_nonneg ?_).mpr ?_\n \u00b7 exact (u_continuous E).integrable_of_hasCompactSupport (u_compact_support E)\n \u00b7 rw [u_support]; exact measure_ball_pos _ _ zero_lt_one\n\n/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces,\nwhich is smooth, symmetric, with support equal to the ball of radius `D` and integral `1`. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.NormedSpace.conformalAt_id (L61-L63)\ntheorem conformalAt_id (x : X) : ConformalAt _root_.id x :=\n\u27e8.id \u211d X, hasFDerivAt_id _, isConformalMap_id\u27e9\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.measure_closedBall_div_le_integral (L126-L136)\ntheorem measure_closedBall_div_le_integral [IsAddHaarMeasure \u03bc] (K : \u211d) (h : f.rOut \u2264 K * f.rIn) :\n \u03bc.real (closedBall c f.rOut) / K ^ finrank \u211d E \u2264 \u222b x, f x \u2202\u03bc := by\nhave K_pos : 0 < K := by\n simpa [f.rIn_pos, not_lt.2 f.rIn_pos.le] using mul_pos_iff.1 (f.rOut_pos.trans_le h)\n apply le_trans _ (f.measure_closedBall_le_integral \u03bc)\n rw [div_le_iff\u2080 (pow_pos K_pos _), addHaar_real_closedBall' _ _ f.rIn_pos.le,\n addHaar_real_closedBall' _ _ f.rOut_pos.le, mul_assoc, mul_comm _ (K ^ _), \u2190 mul_assoc,\n \u2190 mul_pow, mul_comm _ K]\n gcongr\n exact f.rOut_pos.le\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.nonneg_normed (L37-L39)\ntheorem nonneg_normed (x : E) : 0 \u2264 f.normed \u03bc x :=\ndiv_nonneg f.nonneg <| integral_nonneg f.nonneg'\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.UniformContinuous (L48-L54)\ntheorem UniformContinuous.exists_contDiff_dist_le (hf : UniformContinuous f) (h\u03b5 : 0 < \u03b5) :\n \u2203 g : E \u2192 F, ContDiff \u211d \u221e g \u2227 \u2200 a, dist (g a) (f a) < \u03b5 := by\nrcases Metric.uniformContinuous_iff.mp hf (\u03b5 / 2) (half_pos h\u03b5) with \u27e8\u03b4, h\u03b4, hf\u03b4\u27e9\n rcases hf.continuous.exists_contDiff_dist_le_of_forall_mem_ball_dist_le h\u03b4 with \u27e8g, hgc, hg\u27e9\n exact \u27e8g, hgc, fun a \u21a6 (hg a _ fun _ h \u21a6 (hf\u03b4 h).le).trans_lt (half_lt_self h\u03b5)\u27e9\n\n/-- Infinitely smooth functions are dense in the space of continuous functions. -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.support_eq (L151-L156)\ntheorem support_eq : Function.support f = Metric.ball c f.rOut := by\nsimp only [toFun, support_comp_eq_preimage, ContDiffBumpBase.support _ _ f.one_lt_rOut_div_rIn]\n ext x\n simp only [mem_ball_iff_norm, sub_zero, norm_smul, mem_preimage, Real.norm_eq_abs, abs_inv,\n abs_of_pos f.rIn_pos, \u2190 div_eq_inv_mul, div_lt_div_iff_of_pos_right f.rIn_pos]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_smooth (L248-L250)\ntheorem u_smooth : ContDiff \u211d \u221e (u : E \u2192 \u211d) :=\n(Classical.choose_spec (u_exists E)).1\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.tsupport_normed_eq (L76-L78)\ntheorem tsupport_normed_eq : tsupport (f.normed \u03bc) = Metric.closedBall c f.rOut := by\nrw [tsupport, f.support_normed_eq, closure_ball _ f.rOut_pos.ne']\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_le_measure_closedBall (L116-L125)\ntheorem integral_le_measure_closedBall : \u222b x, f x \u2202\u03bc \u2264 \u03bc.real (closedBall c f.rOut) := by calc\n\u222b x, f x \u2202\u03bc = \u222b x in closedBall c f.rOut, f x \u2202\u03bc := by\n apply (setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx \u21a6 ?_)).symm\n apply f.zero_of_le_dist (le_of_lt _)\n simpa using hx\n _ \u2264 \u222b x in closedBall c f.rOut, 1 \u2202\u03bc := by\n apply setIntegral_mono f.integrable.integrableOn _ (fun x \u21a6 f.le_one)\n simp [measure_closedBall_lt_top]\n _ = \u03bc.real (closedBall c f.rOut) := by simp\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_integral (L305-L309)\ntheorem w_integral {D : \u211d} (Dpos : 0 < D) : \u222b x : E, w D x \u2202\u03bc = 1 := by\nsimp_rw [w, integral_smul]\n rw [integral_comp_inv_smul_of_nonneg \u03bc (u : E \u2192 \u211d) Dpos.le, abs_of_nonneg Dpos.le, mul_comm]\n simp [field, (u_int_pos E).ne']\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.normed_convolution_eq_right (L65-L74)\ntheorem normed_convolution_eq_right [IsLocallyFiniteMeasure \u03bc] [\u03bc.IsOpenPosMeasure] {x\u2080 : G}\n (hg : \u2200 x \u2208 ball x\u2080 \u03c6.rOut, g x = g x\u2080) :\n (\u03c6.normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g : G \u2192 E') x\u2080 = g x\u2080 := by\nrw [convolution_eq_right' _ \u03c6.support_normed_eq.subset hg]\n exact integral_normed_smul \u03c6 \u03bc (g x\u2080)\n\nvariable [\u03bc.IsAddHaarMeasure]\n\n/-- If `\u03c6` is a normed bump function, approximate `(\u03c6 \u22c6 g) x\u2080`\nif `g` is near `g x\u2080` on a ball with radius `\u03c6.rOut` around `x\u2080`. -/\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_support (L310-L319)\ntheorem w_support {D : \u211d} (Dpos : 0 < D) : support (w D : E \u2192 \u211d) = ball 0 D := by\nhave B : D \u2022 ball (0 : E) 1 = ball 0 D := by\n rw [smul_unitBall Dpos.ne', Real.norm_of_nonneg Dpos.le]\n have C : D ^ finrank \u211d E \u2260 0 := by\n norm_cast\n exact pow_ne_zero _ Dpos.ne'\n simp only [w_def, smul_eq_mul, support_mul, support_inv, univ_inter,\n support_comp_inv_smul\u2080 Dpos.ne', u_support, B, support_const (u_int_pos E).ne', support_const C,\n abs_of_nonneg Dpos.le]\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.IsOpen (L82-L192)\ntheorem IsOpen.exists_contDiff_support_eq {n : \u2115\u221e} {s : Set E} (hs : IsOpen s) :\n \u2203 f : E \u2192 \u211d, f.support = s \u2227 ContDiff \u211d n f \u2227 Set.range f \u2286 Set.Icc 0 1 := by\n/- For any given point `x` in `s`, one can construct a smooth function with support in `s` and\n nonzero at `x`. By second-countability, it follows that we may cover `s` with the supports of\n countably many such functions, say `g i`.\n Then `\u2211 i, r i \u2022 g i` will be the desired function if `r i` is a sequence of positive numbers\n tending quickly enough to zero. Indeed, this ensures that, for any `k \u2264 i`, the `k`-th\n derivative of `r i \u2022 g i` is bounded by a prescribed (summable) sequence `u i`. From this, the\n summability of the series and of its successive derivatives follows. -/\n rcases eq_empty_or_nonempty s with (rfl | h's)\n \u00b7 exact\n \u27e8fun _ => 0, Function.support_zero, contDiff_const, by\n simp only [range_const, singleton_subset_iff, left_mem_Icc, zero_le_one]\u27e9\n let \u03b9 := { f : E \u2192 \u211d // f.support \u2286 s \u2227 HasCompactSupport f \u2227 ContDiff \u211d \u221e f \u2227 range f \u2286 Icc 0 1 }\n obtain \u27e8T, T_count, hT\u27e9 : \u2203 T : Set \u03b9, T.Countable \u2227 \u22c3 f \u2208 T, support (f : E \u2192 \u211d) = s := by\n have : \u22c3 f : \u03b9, (f : E \u2192 \u211d).support = s := by\n refine Subset.antisymm (iUnion_subset fun f => f.2.1) ?_\n intro x hx\n rcases exists_contDiff_tsupport_subset (hs.mem_nhds hx) with \u27e8f, hf\u27e9\n let g : \u03b9 := \u27e8f, (subset_tsupport f).trans hf.1, hf.2.1, hf.2.2.1, hf.2.2.2.1\u27e9\n have : x \u2208 support (g : E \u2192 \u211d) := by\n simp only [g, hf.2.2.2.2, mem_support, Ne, one_ne_zero, not_false_iff]\n exact mem_iUnion_of_mem _ this\n simp_rw [\u2190 this]\n apply isOpen_iUnion_countable\n rintro \u27e8f, hf\u27e9\n exact hf.2.2.1.continuous.isOpen_support\n obtain \u27e8g0, hg\u27e9 : \u2203 g0 : \u2115 \u2192 \u03b9, T = range g0 := by\n apply Countable.exists_eq_range T_count\n rcases eq_empty_or_nonempty T with (rfl | hT)\n \u00b7 simp only [\u2190 hT, mem_empty_iff_false, iUnion_of_empty, iUnion_empty, Set.not_nonempty_empty]\n at h's\n \u00b7 exact hT\n let g : \u2115 \u2192 E \u2192 \u211d := fun n => (g0 n).1\n have g_s : \u2200 n, support (g n) \u2286 s := fun n => (g0 n).2.1\n have s_g : \u2200 x \u2208 s, \u2203 n, x \u2208 support (g n) := fun x hx \u21a6 by\n rw [\u2190 hT] at hx\n obtain \u27e8i, iT, hi\u27e9 : \u2203 i \u2208 T, x \u2208 support (i : E \u2192 \u211d) := by\n simpa only [mem_iUnion, exists_prop] using hx\n grind\n have g_smooth : \u2200 n, ContDiff \u211d \u221e (g n) := fun n => (g0 n).2.2.2.1\n have g_comp_supp : \u2200 n, HasCompactSupport (g n) := fun n => (g0 n).2.2.1\n have g_nonneg : \u2200 n x, 0 \u2264 g n x := fun n x => ((g0 n).2.2.2.2 (mem_range_self x)).1\n obtain \u27e8\u03b4, \u03b4pos, c, \u03b4c, c_lt\u27e9 :\n \u2203 \u03b4 : \u2115 \u2192 \u211d\u22650, (\u2200 i : \u2115, 0 < \u03b4 i) \u2227 \u2203 c : NNReal, HasSum \u03b4 c \u2227 c < 1 :=\n NNReal.exists_pos_sum_of_countable one_ne_zero \u2115\n have : \u2200 n : \u2115, \u2203 r : \u211d, 0 < r \u2227 \u2200 i \u2264 n, \u2200 x, \u2016iteratedFDeriv \u211d i (r \u2022 g n) x\u2016 \u2264 \u03b4 n := by\n intro n\n have : \u2200 i, \u2203 R, \u2200 x, \u2016iteratedFDeriv \u211d i (fun x => g n x) x\u2016 \u2264 R := by\n intro i\n have : BddAbove (range fun x => \u2016iteratedFDeriv \u211d i (fun x : E => g n x) x\u2016) := by\n apply ((g_smooth n).continuous_iteratedFDeriv\n (mod_cast le_top)).norm.bddAbove_range_of_hasCompactSupport\n apply HasCompactSupport.comp_left _ norm_zero\n apply (g_comp_supp n).iteratedFDeriv\n rcases this with \u27e8R, hR\u27e9\n exact \u27e8R, fun x => hR (mem_range_self _)\u27e9\n choose R hR using this\n let M := max (((Finset.range (n + 1)).image R).max' (by simp)) 1\n have \u03b4npos : 0 < \u03b4 n := \u03b4pos n\n have IR : \u2200 i \u2264 n, R i \u2264 M := by\n intro i hi\n refine le_trans ?_ (le_max_left _ _)\n apply Finset.le_max'\n apply Finset.mem_image_of_mem\n simp only [Finset.mem_range]\n lia\n refine \u27e8M\u207b\u00b9 * \u03b4 n, by positivity, fun i hi x => ?_\u27e9\n calc\n \u2016iteratedFDeriv \u211d i ((M\u207b\u00b9 * \u03b4 n) \u2022 g n) x\u2016 = \u2016(M\u207b\u00b9 * \u03b4 n) \u2022 iteratedFDeriv \u211d i (g n) x\u2016 := by\n rw [iteratedFDeriv_const_smul_apply]\n exact (g_smooth n).contDiffAt.of_le (mod_cast le_top)\n _ = M\u207b\u00b9 * \u03b4 n * \u2016iteratedFDeriv \u211d i (g n) x\u2016 := by\n rw [norm_smul _ (iteratedFDeriv \u211d i (g n) x), Real.norm_of_nonneg]; positivity\n _ \u2264 M\u207b\u00b9 * \u03b4 n * M := by gcongr; exact (hR i x).trans (IR i hi)\n _ = \u03b4 n := by simp [field]\n choose r rpos hr using this\n have S : \u2200 x, Summable fun n => (r n \u2022 g n) x := fun x \u21a6 by\n refine .of_nnnorm_bounded \u03b4c.summable fun n => ?_\n rw [\u2190 NNReal.coe_le_coe, coe_nnnorm]\n simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) x\n refine \u27e8fun x => \u2211' n, (r n \u2022 g n) x, ?_, ?_, ?_\u27e9\n \u00b7 apply Subset.antisymm\n \u00b7 intro x hx\n simp only [Pi.smul_apply, smul_eq_mul, mem_support, Ne] at hx\n contrapose! hx\n have : \u2200 n, g n x = 0 := by\n intro n\n contrapose! hx\n exact g_s n hx\n simp only [this, mul_zero, tsum_zero]\n \u00b7 intro x hx\n obtain \u27e8n, hn\u27e9 : \u2203 n, x \u2208 support (g n) := s_g x hx\n have I : 0 < r n * g n x := mul_pos (rpos n) (lt_of_le_of_ne (g_nonneg n x) (Ne.symm hn))\n exact ne_of_gt ((S x).tsum_pos (fun i => mul_nonneg (rpos i).le (g_nonneg i x)) n I)\n \u00b7 apply ContDiff.of_le _ (show (n : WithTop \u2115\u221e) \u2264 \u221e from mod_cast le_top)\n refine\n contDiff_tsum_of_eventually (fun k => (g_smooth k).const_smul (r k))\n (fun k _ => (NNReal.hasSum_coe.2 \u03b4c).summable) ?_\n intro i _\n simp only [Nat.cofinite_eq_atTop, Filter.eventually_atTop]\n exact \u27e8i, fun n hn x => hr _ _ hn _\u27e9\n \u00b7 rintro - \u27e8y, rfl\u27e9\n refine \u27e8tsum_nonneg fun n => mul_nonneg (rpos n).le (g_nonneg n y), le_trans ?_ c_lt.le\u27e9\n have A : HasSum (fun n => (\u03b4 n : \u211d)) c := NNReal.hasSum_coe.2 \u03b4c\n simp only [Pi.smul_apply, smul_eq_mul, NNReal.val_eq_coe, \u2190 A.tsum_eq]\n apply Summable.tsum_le_tsum _ (S y) A.summable\n intro n\n apply (le_abs_self _).trans\n simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) y\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt_inner_eq_mul_inner (L53-L56)\ntheorem conformalFactorAt_inner_eq_mul_inner {f : E \u2192 F} {x : E} {f' : E \u2192L[\u211d] F}\n (h : HasFDerivAt f f' x) (H : ConformalAt f x) (u v : E) :\n \u27eaf' u, f' v\u27eb = (conformalFactorAt H : \u211d) * \u27eau, v\u27eb :=\nH.differentiableAt.hasFDerivAt.unique h \u25b8 conformalFactorAt_inner_eq_mul_inner' H u v\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_pos (L63-L67)\ntheorem integral_pos : 0 < \u222b x, f x \u2202\u03bc := by\nrefine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_\n rw [f.support_eq]\n exact measure_ball_pos \u03bc c f.rOut_pos\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.Analysis.Calculus.FDeriv.Pow).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem HasFDerivAt.pow' (h : HasFDerivAt f f' x) (n : \u2115) :\n HasFDerivAt (f ^ n) (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasStrictFDerivAt (L48-L58)\ntheorem HasStrictFDerivAt.fun_pow' (h : HasStrictFDerivAt f f' x) (n : \u2115) :\n HasStrictFDerivAt (fun x \u21a6 f x ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) x :=\nmatch n with\n | 0 => by simpa using hasStrictFDerivAt_const 1 x\n | 1 => by simpa using h\n | n + 1 + 1 => by\n have := h.mul' (h.fun_pow' (n + 1))\n simp_rw [pow_succ' _ (n + 1)]\n refine this.congr_fderiv <| aux _ _ _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasStrictFDerivAt (L59-L62)\ntheorem HasStrictFDerivAt.pow' (h : HasStrictFDerivAt f f' x) (n : \u2115) :\n HasStrictFDerivAt (f ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) x := h.fun_pow' n\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.hasStrictFDerivAt_pow' (L63-L67)\ntheorem hasStrictFDerivAt_pow' (n : \u2115) {x : \ud835\udd38} :\n HasStrictFDerivAt (\ud835\udd5c := \ud835\udd5c) (fun x \u21a6 x ^ n)\n(\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> ContinuousLinearMap.id \ud835\udd5c _ <\u2022 x ^ i) x :=\n hasStrictFDerivAt_id _ |>.pow' n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasFDerivWithinAt (L68-L78)\ntheorem HasFDerivWithinAt.fun_pow' (h : HasFDerivWithinAt f f' s x) (n : \u2115) :\n HasFDerivWithinAt (fun x \u21a6 f x ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) s x :=\nmatch n with\n | 0 => by simpa using hasFDerivWithinAt_const 1 x s\n | 1 => by simpa using h\n | n + 1 + 1 => by\n have := h.mul' (h.fun_pow' (n + 1))\n simp_rw [pow_succ' _ (n + 1)]\n exact this.congr_fderiv <| aux _ _ _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.HasFDerivWithinAt (L79-L82)\ntheorem HasFDerivWithinAt.pow' (h : HasFDerivWithinAt f f' s x) (n : \u2115) :\n HasFDerivWithinAt (f ^ n)\n (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> f' <\u2022 f x ^ i) s x := h.fun_pow' n\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.hasFDerivWithinAt_pow' (L83-L87)\ntheorem hasFDerivWithinAt_pow' (n : \u2115) {x : \ud835\udd38} {s : Set \ud835\udd38} :\n HasFDerivWithinAt (\ud835\udd5c := \ud835\udd5c) (fun x \u21a6 x ^ n)\n(\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> ContinuousLinearMap.id \ud835\udd5c _ <\u2022 x ^ i) s x :=\n hasFDerivWithinAt_id _ _ |>.pow' n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.hasFDerivAt_pow' (L102-L106)\ntheorem hasFDerivAt_pow' (n : \u2115) {x : \ud835\udd38} :\n HasFDerivAt (\ud835\udd5c := \ud835\udd5c) (fun x \u21a6 x ^ n)\n(\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> ContinuousLinearMap.id \ud835\udd5c _ <\u2022 x ^ i) x :=\n hasFDerivAt_id _ |>.pow' n\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableWithinAt (L108-L111)\ntheorem DifferentiableWithinAt.fun_pow (hf : DifferentiableWithinAt \ud835\udd5c f s x) (n : \u2115) :\n DifferentiableWithinAt \ud835\udd5c (fun x => f x ^ n) s x :=\nlet \u27e8_, hf'\u27e9 := hf; \u27e8_, hf'.pow' n\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableWithinAt (L113-L116)\ntheorem DifferentiableWithinAt.pow (hf : DifferentiableWithinAt \ud835\udd5c f s x) :\n \u2200 n : \u2115, DifferentiableWithinAt \ud835\udd5c (f ^ n) s x :=\nhf.fun_pow\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiableWithinAt_pow (L117-L120)\ntheorem differentiableWithinAt_pow (n : \u2115) {x : \ud835\udd38} {s : Set \ud835\udd38} :\n DifferentiableWithinAt \ud835\udd5c (fun x : \ud835\udd38 => x ^ n) s x :=\ndifferentiableWithinAt_id.pow _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableAt (L122-L125)\ntheorem DifferentiableAt.fun_pow (hf : DifferentiableAt \ud835\udd5c f x) (n : \u2115) :\n DifferentiableAt \ud835\udd5c (fun x => f x ^ n) x :=\ndifferentiableWithinAt_univ.mp <| hf.differentiableWithinAt.pow n\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableAt (L127-L129)\ntheorem DifferentiableAt.pow (hf : DifferentiableAt \ud835\udd5c f x) (n : \u2115) :\n DifferentiableAt \ud835\udd5c (f ^ n) x := hf.fun_pow n\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiableAt_pow (L130-L132)\ntheorem differentiableAt_pow (n : \u2115) {x : \ud835\udd38} : DifferentiableAt \ud835\udd5c (fun x : \ud835\udd38 => x ^ n) x :=\ndifferentiableAt_id.pow _\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableOn (L134-L136)\ntheorem DifferentiableOn.fun_pow (hf : DifferentiableOn \ud835\udd5c f s) (n : \u2115) :\n DifferentiableOn \ud835\udd5c (fun x => f x ^ n) s := fun x h => (hf x h).pow n\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.DifferentiableOn (L138-L140)\ntheorem DifferentiableOn.pow (hf : DifferentiableOn \ud835\udd5c f s) (n : \u2115) :\n DifferentiableOn \ud835\udd5c (f ^ n) s := hf.fun_pow n\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiableOn_pow (L141-L143)\ntheorem differentiableOn_pow (n : \u2115) {s : Set \ud835\udd38} : DifferentiableOn \ud835\udd5c (fun x : \ud835\udd38 => x ^ n) s :=\ndifferentiableOn_id.pow n\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.Differentiable (L145-L148)\ntheorem Differentiable.fun_pow (hf : Differentiable \ud835\udd5c f) (n : \u2115) :\n Differentiable \ud835\udd5c fun x => f x ^ n :=\nfun x => (hf x).pow n\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.Differentiable (L150-L152)\ntheorem Differentiable.pow (hf : Differentiable \ud835\udd5c f) (n : \u2115) : Differentiable \ud835\udd5c (f ^ n) :=\nhf.fun_pow n\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.differentiable_pow (L153-L155)\ntheorem differentiable_pow (n : \u2115) : Differentiable \ud835\udd5c fun x : \ud835\udd38 => x ^ n :=\ndifferentiable_id.pow _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderiv_fun_pow' (L156-L160)\ntheorem fderiv_fun_pow' (n : \u2115) (hf : DifferentiableAt \ud835\udd5c f x) :\n fderiv \ud835\udd5c (fun x \u21a6 f x ^ n) x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderiv \ud835\udd5c f x <\u2022 f x ^ i) :=\nhf.hasFDerivAt.pow' n |>.fderiv\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderiv_pow' (L161-L165)\ntheorem fderiv_pow' (n : \u2115) (hf : DifferentiableAt \ud835\udd5c f x) :\n fderiv \ud835\udd5c (f ^ n) x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderiv \ud835\udd5c f x <\u2022 f x ^ i) :=\nfderiv_fun_pow' n hf\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderiv_pow_ring' (L166-L170)\ntheorem fderiv_pow_ring' {x : \ud835\udd38} (n : \u2115) :\n fderiv \ud835\udd5c (fun x : \ud835\udd38 \u21a6 x ^ n) x\n = (\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> .id _ _ <\u2022 x ^ i) := by\nrw [fderiv_fun_pow' n differentiableAt_fun_id, fderiv_id']\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderivWithin_fun_pow' (L171-L176)\ntheorem fderivWithin_fun_pow' (hxs : UniqueDiffWithinAt \ud835\udd5c s x)\n (n : \u2115) (hf : DifferentiableWithinAt \ud835\udd5c f s x) :\n fderivWithin \ud835\udd5c (fun x \u21a6 f x ^ n) s x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderivWithin \ud835\udd5c f s x <\u2022 f x ^ i) :=\nhf.hasFDerivWithinAt.pow' n |>.fderivWithin hxs\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderivWithin_pow' (L177-L182)\ntheorem fderivWithin_pow' (hxs : UniqueDiffWithinAt \ud835\udd5c s x)\n (n : \u2115) (hf : DifferentiableWithinAt \ud835\udd5c f s x) :\n fderivWithin \ud835\udd5c (f ^ n) s x\n = (\u2211 i \u2208 Finset.range n, f x ^ (n.pred - i) \u2022> fderivWithin \ud835\udd5c f s x <\u2022 f x ^ i) :=\nfderivWithin_fun_pow' hxs n hf\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Calculus.FDeriv.Pow.fderivWithin_pow_ring' (L183-L203)\ntheorem fderivWithin_pow_ring' {s : Set \ud835\udd38} {x : \ud835\udd38} (n : \u2115) (hxs : UniqueDiffWithinAt \ud835\udd5c s x) :\n fderivWithin \ud835\udd5c (fun x : \ud835\udd38 \u21a6 x ^ n) s x\n = (\u2211 i \u2208 Finset.range n, x ^ (n.pred - i) \u2022> .id _ _ <\u2022 x ^ i) := by\nrw [fderivWithin_fun_pow' hxs n differentiableAt_fun_id.differentiableWithinAt,\n fderivWithin_id' hxs]\n\nend NormedRing\n\nsection NormedCommRing\nvariable [NontriviallyNormedField \ud835\udd5c] [NormedCommRing \ud835\udd38] [NormedAddCommGroup E]\nvariable [NormedAlgebra \ud835\udd5c \ud835\udd38] [NormedSpace \ud835\udd5c E] {f : E \u2192 \ud835\udd38} {f' : E \u2192L[\ud835\udd5c] \ud835\udd38} {x : E} {s : Set E}\n\nprivate theorem aux_sum_eq_pow (n : \u2115) :\n \u2211 i \u2208 Finset.range n, MulOpposite.op (f x ^ i) \u2022 f x ^ (n.pred - i) \u2022 f' =\n (n \u2022 f x ^ (n - 1)) \u2022 f' := by\n simp_rw [op_smul_eq_smul, smul_smul, \u2190 pow_add, \u2190 Finset.sum_smul]\n rw [Finset.sum_eq_card_nsmul, Finset.card_range, smul_assoc]\n intro a ha\n congr\n exact add_tsub_cancel_of_le (Nat.le_pred_of_lt <| Finset.mem_range.1 ha)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_normed (L68-L71)\ntheorem integral_normed : \u222b x, f.normed \u03bc x \u2202\u03bc = 1 := by\nsimp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), \u2190 smul_eq_mul, integral_smul]\n exact inv_mul_cancel\u2080 f.integral_pos.ne'\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_neg (L333-L339)\ntheorem y_neg (D : \u211d) (x : E) : y D (-x) = y D x := by\napply convolution_neg_of_neg_eq\n \u00b7 filter_upwards with x\n simp only [w_def, mul_inv_rev, smul_neg, u_neg, smul_eq_mul]\n \u00b7 filter_upwards with x\n simp only [\u03c6, indicator, mem_closedBall, dist_zero_right, norm_neg]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_le_div_measure_closedBall_rOut (L137-L152)\ntheorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure \u03bc] (K : \u211d) (h : f.rOut \u2264 K * f.rIn)\n (x : E) :\n f.normed \u03bc x \u2264 K ^ finrank \u211d E / \u03bc.real (closedBall c f.rOut) := by\nhave K_pos : 0 < K := by\n simpa [f.rIn_pos, not_lt.2 f.rIn_pos.le] using mul_pos_iff.1 (f.rOut_pos.trans_le h)\n have : f x / \u222b y, f y \u2202\u03bc \u2264 1 / \u222b y, f y \u2202\u03bc := by\n gcongr\n \u00b7 exact f.integral_pos.le\n \u00b7 exact f.le_one\n apply this.trans\n rw [div_le_div_iff\u2080 f.integral_pos, one_mul, \u2190 div_le_iff\u2080' (pow_pos K_pos _)]\n \u00b7 exact f.measure_closedBall_div_le_integral \u03bc K h\n \u00b7 exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rOut_pos).ne'\n measure_closedBall_lt_top.ne\n\nend ContDiffBump\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Calculus.AddTorsor.Coord.smooth_barycentric_coord (L22-L23)\ntheorem smooth_barycentric_coord (b : AffineBasis \u03b9 \ud835\udd5c E) (i : \u03b9) : ContDiff \ud835\udd5c \u22a4 (b.coord i) :=\n(\u27e8b.coord i, continuous_barycentric_coord b i\u27e9 : E \u2192\u1d2c[\ud835\udd5c] \ud835\udd5c).contDiff\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.rOut_pos (L104-L106)\ntheorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut :=\nf.rIn_pos.trans f.rIn_lt_rOut\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt (L43-L45)\ndef conformalFactorAt {f : E \u2192 F} {x : E} (h : ConformalAt f x) : \u211d :=\nClassical.choose (conformalAt_iff'.mp h)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.support_normed_eq (L72-L75)\ntheorem support_normed_eq : Function.support (f.normed \u03bc) = Metric.ball c f.rOut := by\nunfold ContDiffBump.normed\n rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.ContinuousMap (L55-L69)\ntheorem ContinuousMap.dense_setOf_contDiff : Dense {f : C(E, F) | ContDiff \u211d \u221e f} := by\nintro f\n rw [mem_closure_iff_nhds_basis\n (nhds_basis_uniformity uniformity_basis_dist.compactConvergenceUniformity)]\n simp only [Prod.forall, mem_setOf_eq, and_imp]\n intro K \u03b5 hK h\u03b5\n have : UniformContinuousOn f (cthickening 1 K) :=\n hK.cthickening.uniformContinuousOn_of_continuous <| by fun_prop\n rcases Metric.uniformContinuousOn_iff.mp this (\u03b5 / 2) (half_pos h\u03b5) with \u27e8\u03b4, h\u03b4, hf\u03b4\u27e9\n rcases (map_continuous f).exists_contDiff_dist_le_of_forall_mem_ball_dist_le\n (lt_min one_pos h\u03b4) with \u27e8g, hgc, hg\u27e9\n refine \u27e8\u27e8g, hgc.continuous\u27e9, hgc, fun x hx \u21a6 (hg _ _ fun y hy \u21a6 ?_).trans_lt (half_lt_self h\u03b5)\u27e9\n rw [mem_ball, lt_min_iff] at hy\n exact hf\u03b4 _ (mem_cthickening_of_dist_le _ x _ _ hx hy.1.le) _\n (self_subset_cthickening _ hx) hy.2 |>.le\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u (L245-L247)\ndef u (x : E) : \u211d :=\nClassical.choose (u_exists E) x\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt_inner_eq_mul_inner' (L49-L52)\ntheorem conformalFactorAt_inner_eq_mul_inner' {f : E \u2192 F} {x : E} (h : ConformalAt f x) (u v : E) :\n \u27ea(fderiv \u211d f x) u, (fderiv \u211d f x) v\u27eb = (conformalFactorAt h : \u211d) * \u27eau, v\u27eb :=\n(Classical.choose_spec <| conformalAt_iff'.mp h).2 u v\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.exists_contDiff_tsupport_subset (L45-L76)\ntheorem exists_contDiff_tsupport_subset {s : Set E} {x : E} {n : \u2115\u221e} (hs : s \u2208 \ud835\udcdd x) :\n \u2203 f : E \u2192 \u211d,\n tsupport f \u2286 s \u2227 HasCompactSupport f \u2227 ContDiff \u211d n f \u2227 range f \u2286 Icc 0 1 \u2227 f x = 1 := by\nobtain \u27e8d : \u211d, d_pos : 0 < d, hd : Euclidean.closedBall x d \u2286 s\u27e9 :=\n Euclidean.nhds_basis_closedBall.mem_iff.1 hs\n let c : ContDiffBump (toEuclidean x) :=\n { rIn := d / 2\n rOut := d\n rIn_pos := half_pos d_pos\n rIn_lt_rOut := half_lt_self d_pos }\n let f : E \u2192 \u211d := c \u2218 toEuclidean\n have f_supp : f.support \u2286 Euclidean.ball x d := by\n intro y hy\n have : toEuclidean y \u2208 Function.support c := by\n simpa only [Function.mem_support, Function.comp_apply, Ne] using hy\n rwa [c.support_eq] at this\n have f_tsupp : tsupport f \u2286 Euclidean.closedBall x d := by\n rw [tsupport, \u2190 Euclidean.closure_ball _ d_pos.ne']\n exact closure_mono f_supp\n refine \u27e8f, f_tsupp.trans hd, ?_, ?_, ?_, ?_\u27e9\n \u00b7 refine isCompact_of_isClosed_isBounded isClosed_closure ?_\n have : IsBounded (Euclidean.closedBall x d) := Euclidean.isCompact_closedBall.isBounded\n refine this.subset (Euclidean.isClosed_closedBall.closure_subset_iff.2 ?_)\n exact f_supp.trans Euclidean.ball_subset_closedBall\n \u00b7 apply c.contDiff.comp\n exact ContinuousLinearEquiv.contDiff _\n \u00b7 rintro t \u27e8y, rfl\u27e9\n exact \u27e8c.nonneg, c.le_one\u27e9\n \u00b7 apply c.one_of_mem_closedBall\n apply mem_closedBall_self\n exact (half_pos d_pos).le\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.MeasureTheory (L32-L40)\ntheorem MeasureTheory.LocallyIntegrable.exists_contDiff_dist_le_of_forall_mem_ball_dist_le\n [MeasurableSpace E] [BorelSpace E] {\u03bc : Measure E} [\u03bc.IsAddHaarMeasure]\n (hf : LocallyIntegrable f \u03bc) (h\u03b5 : 0 < \u03b5) :\n \u2203 g : E \u2192 F, ContDiff \u211d \u221e g \u2227 \u2200 a, \u2200 \u03b4, (\u2200 x \u2208 ball a \u03b5, dist (f x) (f a) \u2264 \u03b4) \u2192\n dist (g a) (f a) \u2264 \u03b4 := by\nset \u03c6 : ContDiffBump (0 : E) := \u27e8\u03b5 / 2, \u03b5, half_pos h\u03b5, half_lt_self h\u03b5\u27e9\n refine \u27e8_, ?_, fun a \u03b4 \u21a6 \u03c6.dist_normed_convolution_le hf.aestronglyMeasurable\u27e9\n exact \u03c6.hasCompactSupport_normed.contDiff_convolution_left _ \u03c6.contDiff_normed hf\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.nonneg (L142-L145)\ntheorem nonneg : 0 \u2264 f x :=\n(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).1\n\n/-- A version of `ContDiffBump.nonneg` with `x` explicit -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.nonneg' (L146-L147)\ntheorem nonneg' (x : E) : 0 \u2264 f x := f.nonneg\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_nonneg (L263-L265)\ntheorem u_nonneg (x : E) : 0 \u2264 u x :=\n((Classical.choose_spec (u_exists E)).2.1 x).1\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_eq_zero_of_notMem_ball (L358-L374)\ntheorem y_eq_zero_of_notMem_ball {D : \u211d} {x : E} (Dpos : 0 < D) (hx : x \u2209 ball (0 : E) (1 + D)) :\n y D x = 0 := by\nchange (w D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6) x = 0\n have B : \u2200 y, y \u2208 ball x D \u2192 \u03c6 y = 0 := by\n intro y hy\n simp only [\u03c6, indicator, mem_closedBall_zero_iff, ite_eq_right_iff, one_ne_zero]\n intro h'y\n have C : ball y D \u2286 ball 0 (1 + D) := by\n apply ball_subset_ball'\n rw [\u2190 dist_zero_right] at h'y\n linarith only [h'y]\n exact hx (C (mem_ball_comm.1 hy))\n have Bx : \u03c6 x = 0 := B _ (mem_ball_self Dpos)\n have B' : \u2200 y, y \u2208 ball x D \u2192 \u03c6 y = \u03c6 x := by rw [Bx]; exact B\n rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']\n simp only [lsmul_apply, smul_eq_mul, Bx, mul_zero, integral_const]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_pos_of_mem_ball (L390-L428)\ntheorem y_pos_of_mem_ball {D : \u211d} {x : E} (Dpos : 0 < D) (D_lt_one : D < 1)\n (hx : x \u2208 ball (0 : E) (1 + D)) : 0 < y D x := by\nsimp only [mem_ball_zero_iff] at hx\n refine (integral_pos_iff_support_of_nonneg (w_mul_\u03c6_nonneg D x) ?_).2 ?_\n \u00b7 have F_comp : HasCompactSupport (w D) := w_compact_support E Dpos\n have B : LocallyIntegrable (\u03c6 : E \u2192 \u211d) \u03bc :=\n (locallyIntegrable_const _).indicator measurableSet_closedBall\n have C : Continuous (w D : E \u2192 \u211d) :=\n continuous_const.mul ((u_continuous E).comp (by fun_prop))\n exact (F_comp.convolutionExists_left (lsmul \u211d \u211d : \u211d \u2192L[\u211d] \u211d \u2192L[\u211d] \u211d) C B x).integrable\n \u00b7 set z := (D / (1 + D)) \u2022 x with hz\n have B : 0 < 1 + D := by linarith\n have C : ball z (D * (1 + D - \u2016x\u2016) / (1 + D)) \u2286 support fun y : E => w D y * \u03c6 (x - y) := by\n intro y hy\n simp only [support_mul, w_support E Dpos]\n simp only [\u03c6, mem_inter_iff, mem_support, Ne, indicator_apply_eq_zero,\n mem_closedBall_zero_iff, one_ne_zero, not_forall, not_false_iff, exists_prop, and_true]\n constructor\n \u00b7 apply ball_subset_ball' _ hy\n simp only [hz, norm_smul, abs_of_nonneg Dpos.le, abs_of_nonneg B.le, dist_zero_right,\n Real.norm_eq_abs, abs_div]\n field_simp\n linarith only\n \u00b7 have ID : \u2016D / (1 + D) - 1\u2016 = 1 / (1 + D) := by\n rw [Real.norm_of_nonpos]\n \u00b7 field\n \u00b7 field_simp\n linarith only\n rw [\u2190 mem_closedBall_iff_norm']\n apply closedBall_subset_closedBall' _ (ball_subset_closedBall hy)\n rw [\u2190 one_smul \u211d x, dist_eq_norm, hz, \u2190 sub_smul, one_smul, norm_smul, ID]\n field_simp\n nlinarith only [hx, D_lt_one]\n apply lt_of_lt_of_le _ (measure_mono C)\n apply measure_ball_pos\n exact div_pos (mul_pos Dpos (by linarith only [hx])) B\n\nvariable (E)\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.zero_of_le_dist (L163-L168)\ntheorem zero_of_le_dist (hx : f.rOut \u2264 dist x c) : f x = 0 := by\nrwa [\u2190 notMem_support, support_eq, mem_ball, not_lt]\n\nprotected theorem hasCompactSupport [FiniteDimensional \u211d E] : HasCompactSupport f := by\n simp_rw [HasCompactSupport, f.tsupport_eq, isCompact_closedBall]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_compact_support (L257-L262)\ntheorem u_compact_support : HasCompactSupport (u : E \u2192 \u211d) := by\nrw [hasCompactSupport_def, u_support, closure_ball (0 : E) one_ne_zero]\n exact isCompact_closedBall _ _\n\nvariable {E}\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Analysis.Calculus.AddTorsor.AffineMap.contDiff (L31-L36)\ntheorem contDiff {n : WithTop \u2115\u221e} (f : V \u2192\u1d2c[\ud835\udd5c] W) : ContDiff \ud835\udd5c n f := by\nrw [f.decomp]\n apply f.contLinear.contDiff.add\n exact contDiff_const\n\nend ContinuousAffineMap\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.le_one (L148-L150)\ntheorem le_one : f x \u2264 1 :=\n(ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).2\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_support (L456-L463)\ntheorem y_support {D : \u211d} (Dpos : 0 < D) (D_lt_one : D < 1) :\n support (y D : E \u2192 \u211d) = ball (0 : E) (1 + D) :=\nsupport_eq_iff.2\n \u27e8fun _ hx => (y_pos_of_mem_ball Dpos D_lt_one hx).ne', fun _ hx =>\n y_eq_zero_of_notMem_ball Dpos hx\u27e9\n\nend HelperDefinitions\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalAt_iff' (L31-L36)\ntheorem conformalAt_iff' {f : E \u2192 F} {x : E} : ConformalAt f x \u2194\n \u2203 c : \u211d, 0 < c \u2227 \u2200 u v : E, \u27eafderiv \u211d f x u, fderiv \u211d f x v\u27eb = c * \u27eau, v\u27eb := by\nrw [conformalAt_iff_isConformalMap_fderiv, isConformalMap_iff]\n\n/-- A real differentiable map `f` is conformal at point `x` if and only if its\ndifferential `f'` at that point scales every inner product by a positive scalar. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.dist_normed_convolution_le (L75-L97)\ntheorem dist_normed_convolution_le {x\u2080 : G} {\u03b5 : \u211d} (hmg : AEStronglyMeasurable g \u03bc)\n (hg : \u2200 x \u2208 ball x\u2080 \u03c6.rOut, dist (g x) (g x\u2080) \u2264 \u03b5) :\n dist ((\u03c6.normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g : G \u2192 E') x\u2080) (g x\u2080) \u2264 \u03b5 :=\ndist_convolution_le (by simp_rw [\u2190 dist_self (g x\u2080), hg x\u2080 (mem_ball_self \u03c6.rOut_pos)])\n \u03c6.support_normed_eq.subset \u03c6.nonneg_normed \u03c6.integral_normed hmg hg\n\n/-- `(\u03c6 i \u22c6 g i) (k i)` tends to `z\u2080` as `i` tends to some filter `l` if\n* `\u03c6` is a sequence of normed bump functions\n such that `(\u03c6 i).rOut` tends to `0` as `i` tends to `l`;\n* `g i` is `\u03bc`-a.e. strongly measurable as `i` tends to `l`;\n* `g i x` tends to `z\u2080` as `(i, x)` tends to `l \u00d7\u02e2 \ud835\udcdd x\u2080`;\n* `k i` tends to `x\u2080`. -/\nnonrec theorem convolution_tendsto_right {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump (0 : G)} {g : \u03b9 \u2192 G \u2192 E'}\n {k : \u03b9 \u2192 G} {x\u2080 : G} {z\u2080 : E'} {l : Filter \u03b9} (h\u03c6 : Tendsto (fun i => (\u03c6 i).rOut) l (\ud835\udcdd 0))\n (hig : \u2200\u1da0 i in l, AEStronglyMeasurable (g i) \u03bc) (hcg : Tendsto (uncurry g) (l \u00d7\u02e2 \ud835\udcdd x\u2080) (\ud835\udcdd z\u2080))\n (hk : Tendsto k l (\ud835\udcdd x\u2080)) :\n Tendsto (fun i => ((\u03c6 i).normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g i) (k i)) l (\ud835\udcdd z\u2080) :=\n convolution_tendsto_right (Eventually.of_forall fun i => (\u03c6 i).nonneg_normed)\n (Eventually.of_forall fun i => (\u03c6 i).integral_normed) (tendsto_support_normed_smallSets h\u03c6) hig\n hcg hk\n\n/-- Special case of `ContDiffBump.convolution_tendsto_right` where `g` is continuous,\n and the limit is taken only in the first function. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.\u03c6 (L204-L212)\ndef \u03c6 : E \u2192 \u211d :=\n(closedBall (0 : E) 1).indicator fun _ => (1 : \u211d)\n\nvariable [NormedSpace \u211d E] [FiniteDimensional \u211d E]\n\nsection HelperDefinitions\n\nvariable (E)\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.Continuous (L41-L47)\ntheorem Continuous.exists_contDiff_dist_le_of_forall_mem_ball_dist_le (hf : Continuous f)\n (h\u03b5 : 0 < \u03b5) :\n \u2203 g : E \u2192 F, ContDiff \u211d \u221e g \u2227 \u2200 a, \u2200 \u03b4, (\u2200 x \u2208 ball a \u03b5, dist (f x) (f a) \u2264 \u03b4) \u2192\n dist (g a) (f a) \u2264 \u03b4 := by\nborelize E\n exact (hf.locallyIntegrable (\u03bc := .addHaar)).exists_contDiff_dist_le_of_forall_mem_ball_dist_le h\u03b5\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_nonneg (L291-L297)\ntheorem w_nonneg (D : \u211d) (x : E) : 0 \u2264 w D x := by\napply mul_nonneg _ (u_nonneg _)\n apply inv_nonneg.2\n apply mul_nonneg (u_int_pos E).le\n norm_cast\n apply pow_nonneg (abs_nonneg D)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.eventuallyEq_one (L172-L195)\ntheorem eventuallyEq_one : f =\u1da0[\ud835\udcdd c] 1 :=\nf.eventuallyEq_one_of_mem_ball (mem_ball_self f.rIn_pos)\n\n/-- `ContDiffBump` is `\ud835\udc9e\u207f` in all its arguments. -/\nprotected theorem _root_.ContDiffWithinAt.contDiffBump {c g : X \u2192 E} {s : Set X}\n {f : \u2200 x, ContDiffBump (c x)} {x : X} (hc : ContDiffWithinAt \u211d n c s x)\n (hr : ContDiffWithinAt \u211d n (fun x => (f x).rIn) s x)\n (hR : ContDiffWithinAt \u211d n (fun x => (f x).rOut) s x)\n (hg : ContDiffWithinAt \u211d n g s x) :\n ContDiffWithinAt \u211d n (fun x => f x (g x)) s x := by\n change ContDiffWithinAt \u211d n (uncurry (someContDiffBumpBase E).toFun \u2218 fun x : X =>\n ((f x).rOut / (f x).rIn, (f x).rIn\u207b\u00b9 \u2022 (g x - c x))) s x\n refine (((someContDiffBumpBase E).smooth.contDiffAt ?_).of_le\n (mod_cast le_top)).comp_contDiffWithinAt x ?_\n \u00b7 exact prod_mem_nhds (Ioi_mem_nhds (f x).one_lt_rOut_div_rIn) univ_mem\n \u00b7 exact (hR.div hr (f x).rIn_pos.ne').prodMk ((hr.inv (f x).rIn_pos.ne').smul (hg.sub hc))\n\n/-- `ContDiffBump` is `\ud835\udc9e\u207f` in all its arguments. -/\nprotected nonrec theorem _root_.ContDiffAt.contDiffBump {c g : X \u2192 E} {f : \u2200 x, ContDiffBump (c x)}\n {x : X} (hc : ContDiffAt \u211d n c x) (hr : ContDiffAt \u211d n (fun x => (f x).rIn) x)\n (hR : ContDiffAt \u211d n (fun x => (f x).rOut) x) (hg : ContDiffAt \u211d n g x) :\n ContDiffAt \u211d n (fun x => f x (g x)) x :=\n hc.contDiffBump hr hR hg\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.measure_closedBall_le_integral (L102-L107)\ntheorem measure_closedBall_le_integral : \u03bc.real (closedBall c f.rIn) \u2264 \u222b x, f x \u2202\u03bc := by calc\n\u03bc.real (closedBall c f.rIn) = \u222b x in closedBall c f.rIn, 1 \u2202\u03bc := by simp\n _ = \u222b x in closedBall c f.rIn, f x \u2202\u03bc := setIntegral_congr_fun measurableSet_closedBall\n (fun x hx \u21a6 (one_of_mem_closedBall f hx).symm)\n _ \u2264 \u222b x, f x \u2202\u03bc := setIntegral_le_integral f.integrable (Eventually.of_forall (fun x \u21a6 f.nonneg))\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_le_one (L378-L389)\ntheorem y_le_one {D : \u211d} (x : E) (Dpos : 0 < D) : y D x \u2264 1 := by\nhave A : (w D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6) x \u2264 (w D \u22c6[lsmul \u211d \u211d, \u03bc] 1) x := by\n apply\n convolution_mono_right_of_nonneg _ (w_nonneg D) (indicator_le_self' fun x _ => zero_le_one)\n fun _ => zero_le_one\n refine ((w_compact_support E Dpos).convolutionExists_left _ ?_\n (locallyIntegrable_const (1 : \u211d)) x).integrable\n exact continuous_const.mul ((u_continuous E).comp (by fun_prop))\n have B : (w D \u22c6[lsmul \u211d \u211d, \u03bc] fun _ => (1 : \u211d)) x = 1 := by\n simp only [convolution, mul_one, lsmul_apply, smul_eq_mul, w_integral E Dpos]\n exact A.trans (le_of_eq B)\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.convolution_eq_right (L57-L64)\ntheorem convolution_eq_right [HasContDiffBump G] {x\u2080 : G} (hg : \u2200 x \u2208 ball x\u2080 \u03c6.rOut, g x = g x\u2080) :\n (\u03c6 \u22c6[lsmul \u211d \u211d, \u03bc] g : G \u2192 E') x\u2080 = integral \u03bc \u03c6 \u2022 g x\u2080 := by\nsimp_rw [convolution_eq_right' _ \u03c6.support_eq.subset hg, lsmul_apply, integral_smul_const]\n\nvariable [BorelSpace G] [FiniteDimensional \u211d G]\n\n/-- If `\u03c6` is a normed bump function, compute `\u03c6 \u22c6 g`\nif `g` is constant on `Metric.ball x\u2080 \u03c6.rOut`. -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.ae_convolution_tendsto_right_of_locallyIntegrable (L107-L137)\ntheorem ae_convolution_tendsto_right_of_locallyIntegrable\n {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump (0 : G)} {l : Filter \u03b9} {K : \u211d}\n (h\u03c6 : Tendsto (fun i \u21a6 (\u03c6 i).rOut) l (\ud835\udcdd 0))\n (h'\u03c6 : \u2200\u1da0 i in l, (\u03c6 i).rOut \u2264 K * (\u03c6 i).rIn) (hg : LocallyIntegrable g \u03bc) : \u2200\u1d50 x\u2080 \u2202\u03bc,\n Tendsto (fun i \u21a6 ((\u03c6 i).normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g) x\u2080) l (\ud835\udcdd (g x\u2080)) := by\n-- By Lebesgue differentiation theorem, the average of `g` on a small ball converges\n -- almost everywhere to the value of `g` as the radius shrinks to zero.\n -- We will see that this set of points satisfies the desired conclusion.\n filter_upwards [(Besicovitch.vitaliFamily \u03bc).ae_tendsto_average_norm_sub hg] with x\u2080 h\u2080\n simp only [convolution_eq_swap, lsmul_apply]\n have h\u03c6' : Tendsto (fun i \u21a6 (\u03c6 i).rOut) l (\ud835\udcdd[>] 0) :=\n tendsto_nhdsWithin_iff.2 \u27e8h\u03c6, Eventually.of_forall (fun i \u21a6 (\u03c6 i).rOut_pos)\u27e9\n have := (h\u2080.comp (Besicovitch.tendsto_filterAt \u03bc x\u2080)).comp h\u03c6'\n simp only at this\n apply tendsto_integral_smul_of_tendsto_average_norm_sub (K ^ (Module.finrank \u211d G)) this\n \u00b7 filter_upwards with i using\n hg.integrableOn_isCompact (isCompact_closedBall _ _)\n \u00b7 apply tendsto_const_nhds.congr (fun i \u21a6 ?_)\n rw [\u2190 integral_neg_eq_self]\n simp only [sub_neg_eq_add, integral_add_left_eq_self, integral_normed]\n \u00b7 filter_upwards with i\n change support ((ContDiffBump.normed (\u03c6 i) \u03bc) \u2218 (fun y \u21a6 x\u2080 - y)) \u2286 closedBall x\u2080 (\u03c6 i).rOut\n simp only [support_comp_eq_preimage, support_normed_eq]\n intro x hx\n simp only [mem_preimage, mem_ball, dist_zero_right] at hx\n simpa [dist_eq_norm_sub'] using hx.le\n \u00b7 filter_upwards [h'\u03c6] with i hi x\n rw [abs_of_nonneg (nonneg_normed _ _), addHaar_real_closedBall_center]\n exact (\u03c6 i).normed_le_div_measure_closedBall_rOut _ _ hi _\n\nend ContDiffBump\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_continuous (L251-L253)\ntheorem u_continuous : Continuous (u : E \u2192 \u211d) :=\n(u_smooth E).continuous\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.NormedSpace.ConformalAt (L58-L60)\ndef ConformalAt (f : X \u2192 Y) (x : X) :=\n\u2203 f' : X \u2192L[\u211d] Y, HasFDerivAt f f' x \u2227 IsConformalMap f'\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_def (L34-L36)\ntheorem normed_def {\u03bc : Measure E} (x : E) : f.normed \u03bc x = f x / \u222b x, f x \u2202\u03bc :=\nrfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.pos_of_mem_ball (L160-L162)\ntheorem pos_of_mem_ball (hx : x \u2208 ball c f.rOut) : 0 < f x :=\nf.nonneg.lt_of_ne' <| by rwa [\u2190 support_eq, mem_support] at hx\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_exists (L213-L244)\ntheorem u_exists :\n \u2203 u : E \u2192 \u211d,\n ContDiff \u211d \u221e u \u2227 (\u2200 x, u x \u2208 Icc (0 : \u211d) 1) \u2227 support u = ball 0 1 \u2227 \u2200 x, u (-x) = u x := by\nhave A : IsOpen (ball (0 : E) 1) := isOpen_ball\n obtain \u27e8f, f_support, f_smooth, f_range\u27e9 :\n \u2203 f : E \u2192 \u211d, f.support = ball (0 : E) 1 \u2227 ContDiff \u211d \u221e f \u2227 Set.range f \u2286 Set.Icc 0 1 :=\n A.exists_contDiff_support_eq\n have B : \u2200 x, f x \u2208 Icc (0 : \u211d) 1 := fun x => f_range (mem_range_self x)\n refine \u27e8fun x => (f x + f (-x)) / 2, ?_, ?_, ?_, ?_\u27e9\n \u00b7 exact (f_smooth.add (f_smooth.comp contDiff_neg)).div_const _\n \u00b7 intro x\n push _ \u2208 _\n constructor\n \u00b7 linarith [(B x).1, (B (-x)).1]\n \u00b7 linarith [(B x).2, (B (-x)).2]\n \u00b7 refine support_eq_iff.2 \u27e8fun x hx => ?_, fun x hx => ?_\u27e9\n \u00b7 apply ne_of_gt\n have : 0 < f x := by\n apply lt_of_le_of_ne (B x).1 (Ne.symm _)\n rwa [\u2190 f_support] at hx\n linarith [(B (-x)).1]\n \u00b7 have I1 : x \u2209 support f := by rwa [f_support]\n have I2 : -x \u2209 support f := by\n rw [f_support]\n simpa using hx\n simp only [mem_support, Classical.not_not] at I1 I2\n simp only [I1, I2, add_zero, zero_div]\n \u00b7 intro x; simp only [add_comm, neg_neg]\n\nvariable {E} in\n/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces,\nwhich is smooth, symmetric, and with support equal to the unit ball. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_eq_one_of_mem_closedBall (L340-L357)\ntheorem y_eq_one_of_mem_closedBall {D : \u211d} {x : E} (Dpos : 0 < D)\n (hx : x \u2208 closedBall (0 : E) (1 - D)) : y D x = 1 := by\nchange (w D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6) x = 1\n have B : \u2200 y : E, y \u2208 ball x D \u2192 \u03c6 y = 1 := by\n have C : ball x D \u2286 ball 0 1 := by\n apply ball_subset_ball'\n simp only [mem_closedBall] at hx\n linarith only [hx]\n intro y hy\n simp only [\u03c6, indicator, mem_closedBall, ite_eq_left_iff, not_le, zero_ne_one]\n intro h'y\n linarith only [mem_ball.1 (C hy), h'y]\n have Bx : \u03c6 x = 1 := B _ (mem_ball_self Dpos)\n have B' : \u2200 y, y \u2208 ball x D \u2192 \u03c6 y = \u03c6 x := by rw [Bx]; exact B\n rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']\n simp only [lsmul_apply, smul_eq_mul, integral_mul_const, w_integral E Dpos, Bx,\n one_mul]\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt_pos (L46-L48)\ntheorem conformalFactorAt_pos {f : E \u2192 F} {x : E} (h : ConformalAt f x) : 0 < conformalFactorAt h :=\n(Classical.choose_spec <| conformalAt_iff'.mp h).1\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w (L284-L286)\ndef w (D : \u211d) (x : E) : \u211d :=\n((\u222b x : E, u x \u2202\u03bc) * |D| ^ finrank \u211d E)\u207b\u00b9 \u2022 u (D\u207b\u00b9 \u2022 x)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y (L330-L332)\ndef y (D : \u211d) : E \u2192 \u211d :=\nw D \u22c6[lsmul \u211d \u211d, \u03bc] \u03c6\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.one_of_mem_closedBall (L137-L141)\ntheorem one_of_mem_closedBall (hx : x \u2208 closedBall c f.rIn) : f x = 1 := by\napply ContDiffBumpBase.eq_one _ _ f.one_lt_rOut_div_rIn\n simpa only [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg f.rIn_pos.le, \u2190 div_eq_inv_mul,\n div_le_one f.rIn_pos] using mem_closedBall_iff_norm.1 hx\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_neg (L49-L59)\ntheorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed \u03bc (-x) = f.normed \u03bc x := by\nsimp_rw [f.normed_def, f.neg]\n\nvariable [BorelSpace E] [FiniteDimensional \u211d E] [IsLocallyFiniteMeasure \u03bc]\n\nprotected theorem integrable : Integrable f \u03bc :=\n f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport\n\nprotected theorem integrable_normed : Integrable (f.normed \u03bc) \u03bc :=\n f.integrable.div_const _\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.one_lt_rOut_div_rIn (L107-L110)\ntheorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn := by\nrw [one_lt_div f.rIn_pos]\n exact f.rIn_lt_rOut\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.tendsto_support_normed_smallSets (L82-L93)\ntheorem tendsto_support_normed_smallSets {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump c} {l : Filter \u03b9}\n (h\u03c6 : Tendsto (fun i => (\u03c6 i).rOut) l (\ud835\udcdd 0)) :\n Tendsto (fun i => Function.support fun x => (\u03c6 i).normed \u03bc x) l (\ud835\udcdd c).smallSets := by\nsimp_rw [NormedAddGroup.tendsto_nhds_zero, Real.norm_eq_abs,\n abs_eq_self.mpr (\u03c6 _).rOut_pos.le] at h\u03c6\n rw [nhds_basis_ball.smallSets.tendsto_right_iff]\n refine fun \u03b5 h\u03b5 \u21a6 (h\u03c6 \u03b5 h\u03b5).mono fun i hi \u21a6 ?_\n rw [(\u03c6 i).support_normed_eq]\n exact ball_subset_ball hi.le\n\nvariable (\u03bc)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.continuous_normed (L43-L45)\ntheorem continuous_normed : Continuous (f.normed \u03bc) :=\nf.continuous.div_const _\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.tsupport_eq (L157-L159)\ntheorem tsupport_eq : tsupport f = closedBall c f.rOut := by\nsimp_rw [tsupport, f.support_eq, closure_ball _ f.rOut_pos.ne']\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_normed_smul (L94-L97)\ntheorem integral_normed_smul {X} [NormedAddCommGroup X] [NormedSpace \u211d X]\n [CompleteSpace X] (z : X) : \u222b x, f.normed \u03bc x \u2022 z \u2202\u03bc = z := by\nsimp_rw [integral_smul_const, f.integral_normed (\u03bc := \u03bc), one_smul]\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_le_one (L266-L268)\ntheorem u_le_one (x : E) : u x \u2264 1 :=\n((Classical.choose_spec (u_exists E)).2.1 x).2\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.hasCompactSupport_normed (L79-L81)\ntheorem hasCompactSupport_normed : HasCompactSupport (f.normed \u03bc) := by\nsimp only [HasCompactSupport, f.tsupport_normed_eq (\u03bc := \u03bc), isCompact_closedBall]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_compact_support (L320-L329)\ntheorem w_compact_support {D : \u211d} (Dpos : 0 < D) : HasCompactSupport (w D : E \u2192 \u211d) := by\nrw [hasCompactSupport_def, w_support E Dpos, closure_ball (0 : E) Dpos.ne']\n exact isCompact_closedBall _ _\n\nvariable {E}\n\n/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces.\nIt is the convolution between a smooth function of integral `1` supported in the ball of radius `D`,\nwith the indicator function of the closed unit ball. Therefore, it is smooth, equal to `1` on the\nball of radius `1 - D`, with support equal to the ball of radius `1 + D`. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_mul_\u03c6_nonneg (L298-L304)\ntheorem w_mul_\u03c6_nonneg (D : \u211d) (x y : E) : 0 \u2264 w D y * \u03c6 (x - y) :=\nmul_nonneg (w_nonneg D y) (indicator_nonneg (by simp only [zero_le_one, imp_true_iff]) _)\n\nvariable (E)\n\n-- see https://github.com/leanprover-community/mathlib4/issues/29041\nset_option linter.unusedSimpArgs false in\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_def (L287-L290)\ntheorem w_def (D : \u211d) :\n (w D : E \u2192 \u211d) = fun x => ((\u222b x : E, u x \u2202\u03bc) * |D| ^ finrank \u211d E)\u207b\u00b9 \u2022 u (D\u207b\u00b9 \u2022 x) := by\next1 x; rfl\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.someContDiffBumpBase (L98-L103)\ndef someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace \u211d E]\n [hb : HasContDiffBump E] : ContDiffBumpBase E :=\nNonempty.some hb.out\n\nnamespace ContDiffBump\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.convolution_tendsto_right_of_continuous (L98-L106)\ntheorem convolution_tendsto_right_of_continuous {\u03b9} {\u03c6 : \u03b9 \u2192 ContDiffBump (0 : G)} {l : Filter \u03b9}\n (h\u03c6 : Tendsto (fun i => (\u03c6 i).rOut) l (\ud835\udcdd 0)) (hg : Continuous g) (x\u2080 : G) :\n Tendsto (fun i => ((\u03c6 i).normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g) x\u2080) l (\ud835\udcdd (g x\u2080)) :=\nconvolution_tendsto_right h\u03c6 (Eventually.of_forall fun _ => hg.aestronglyMeasurable)\n ((hg.tendsto x\u2080).comp tendsto_snd) tendsto_const_nhds\n\n/-- If a function `g` is locally integrable, then the convolution `\u03c6 i * g` converges almost\neverywhere to `g` if `\u03c6 i` is a sequence of bump functions with support tending to `0`, provided\nthat the ratio between the inner and outer radii of `\u03c6 i` remains bounded. -/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.eventuallyEq_one_of_mem_ball (L169-L171)\ntheorem eventuallyEq_one_of_mem_ball (h : x \u2208 ball c f.rIn) : f =\u1da0[\ud835\udcdd x] 1 :=\nmem_of_superset (closedBall_mem_nhds_of_mem h) fun _ \u21a6 f.one_of_mem_closedBall\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_sub (L46-L48)\ntheorem normed_sub (x : E) : f.normed \u03bc (c - x) = f.normed \u03bc (c + x) := by\nsimp_rw [f.normed_def, f.sub]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.contDiff_normed (L40-L42)\ntheorem contDiff_normed {n : \u2115\u221e} : ContDiff \u211d n (f.normed \u03bc) :=\nf.contDiff.div_const _\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_neg (L269-L276)\ntheorem u_neg (x : E) : u (-x) = u x :=\n(Classical.choose_spec (u_exists E)).2.2.2 x\n\nvariable [MeasurableSpace E] [BorelSpace E]\n\nlocal notation \"\u03bc\" => MeasureTheory.Measure.addHaar\n\nvariable (E) in\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_le_div_measure_closedBall_rIn (L108-L115)\ntheorem normed_le_div_measure_closedBall_rIn [\u03bc.IsOpenPosMeasure] (x : E) :\n f.normed \u03bc x \u2264 1 / \u03bc.real (closedBall c f.rIn) := by\nrw [normed_def]\n gcongr\n \u00b7 exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rIn_pos).ne' measure_closedBall_lt_top.ne\n \u00b7 exact f.le_one\n \u00b7 exact f.measure_closedBall_le_integral \u03bc\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalAt_iff (L37-L42)\ntheorem conformalAt_iff {f : E \u2192 F} {x : E} {f' : E \u2192L[\u211d] F} (h : HasFDerivAt f f' x) :\n ConformalAt f x \u2194 \u2203 c : \u211d, 0 < c \u2227 \u2200 u v : E, \u27eaf' u, f' v\u27eb = c * \u27eau, v\u27eb := by\nsimp only [conformalAt_iff', h.fderiv]\n\n/-- The conformal factor of a conformal map at some point `x`. Some authors refer to this function\nas the characteristic function of the conformal map. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_nonneg (L375-L377)\ntheorem y_nonneg (D : \u211d) (x : E) : 0 \u2264 y D x :=\nintegral_nonneg (w_mul_\u03c6_nonneg D x)\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.y_smooth (L429-L455)\ntheorem y_smooth : ContDiffOn \u211d \u221e (uncurry y) (Ioo (0 : \u211d) 1 \u00d7\u02e2 (univ : Set E)) := by\nhave hs : IsOpen (Ioo (0 : \u211d) (1 : \u211d)) := isOpen_Ioo\n have hk : IsCompact (closedBall (0 : E) 1) := ProperSpace.isCompact_closedBall _ _\n refine contDiffOn_convolution_left_with_param (lsmul \u211d \u211d) hs hk ?_ ?_ ?_\n \u00b7 rintro p x hp hx\n simp only [w, mul_inv_rev, smul_eq_mul, mul_eq_zero, inv_eq_zero]\n right\n contrapose! hx\n have : p\u207b\u00b9 \u2022 x \u2208 support u := mem_support.2 hx\n simp only [u_support, norm_smul, mem_ball_zero_iff, Real.norm_eq_abs, abs_inv,\n abs_of_nonneg hp.1.le, \u2190 div_eq_inv_mul, div_lt_one hp.1] at this\n rw [mem_closedBall_zero_iff]\n exact this.le.trans hp.2.le\n \u00b7 exact (locallyIntegrable_const _).indicator measurableSet_closedBall\n \u00b7 apply ContDiffOn.mul\n \u00b7 norm_cast\n refine\n (contDiffOn_const.mul ?_).inv fun x hx =>\n ne_of_gt (mul_pos (u_int_pos E) (pow_pos (abs_pos_of_pos hx.1.1) (finrank \u211d E)))\n apply ContDiffOn.pow\n simp_rw [\u2190 Real.norm_eq_abs]\n apply ContDiffOn.norm \u211d\n \u00b7 exact contDiffOn_fst\n \u00b7 intro x hx; exact ne_of_gt hx.1.1\n \u00b7 apply (u_smooth E).comp_contDiffOn\n exact ContDiffOn.smul (contDiffOn_fst.inv fun x hx => ne_of_gt hx.1.1) contDiffOn_snd\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_support (L254-L256)\ntheorem u_support : support (u : E \u2192 \u211d) = ball 0 1 :=\n(Classical.choose_spec (u_exists E)).2.2.1\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.NormedSpace.conformalAt_const_smul (L64-L66)\ntheorem conformalAt_const_smul {c : \u211d} (h : c \u2260 0) (x : X) : ConformalAt (fun x' : X => c \u2022 x') x :=\n\u27e8c \u2022 ContinuousLinearMap.id \u211d X, (hasFDerivAt_id x).const_smul c, isConformalMap_const_smul h\u27e9\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_int_pos (L277-L283)\ntheorem u_int_pos : 0 < \u222b x : E, u x \u2202\u03bc := by\nrefine (integral_pos_iff_support_of_nonneg u_nonneg ?_).mpr ?_\n \u00b7 exact (u_continuous E).integrable_of_hasCompactSupport (u_compact_support E)\n \u00b7 rw [u_support]; exact measure_ball_pos _ _ zero_lt_one\n\n/-- An auxiliary function to construct partitions of unity on finite-dimensional real vector spaces,\nwhich is smooth, symmetric, with support equal to the ball of radius `D` and integral `1`. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.NormedSpace.conformalAt_id (L61-L63)\ntheorem conformalAt_id (x : X) : ConformalAt _root_.id x :=\n\u27e8.id \u211d X, hasFDerivAt_id _, isConformalMap_id\u27e9\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.measure_closedBall_div_le_integral (L126-L136)\ntheorem measure_closedBall_div_le_integral [IsAddHaarMeasure \u03bc] (K : \u211d) (h : f.rOut \u2264 K * f.rIn) :\n \u03bc.real (closedBall c f.rOut) / K ^ finrank \u211d E \u2264 \u222b x, f x \u2202\u03bc := by\nhave K_pos : 0 < K := by\n simpa [f.rIn_pos, not_lt.2 f.rIn_pos.le] using mul_pos_iff.1 (f.rOut_pos.trans_le h)\n apply le_trans _ (f.measure_closedBall_le_integral \u03bc)\n rw [div_le_iff\u2080 (pow_pos K_pos _), addHaar_real_closedBall' _ _ f.rIn_pos.le,\n addHaar_real_closedBall' _ _ f.rOut_pos.le, mul_assoc, mul_comm _ (K ^ _), \u2190 mul_assoc,\n \u2190 mul_pow, mul_comm _ K]\n gcongr\n exact f.rOut_pos.le\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.nonneg_normed (L37-L39)\ntheorem nonneg_normed (x : E) : 0 \u2264 f.normed \u03bc x :=\ndiv_nonneg f.nonneg <| integral_nonneg f.nonneg'\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox.UniformContinuous (L48-L54)\ntheorem UniformContinuous.exists_contDiff_dist_le (hf : UniformContinuous f) (h\u03b5 : 0 < \u03b5) :\n \u2203 g : E \u2192 F, ContDiff \u211d \u221e g \u2227 \u2200 a, dist (g a) (f a) < \u03b5 := by\nrcases Metric.uniformContinuous_iff.mp hf (\u03b5 / 2) (half_pos h\u03b5) with \u27e8\u03b4, h\u03b4, hf\u03b4\u27e9\n rcases hf.continuous.exists_contDiff_dist_le_of_forall_mem_ball_dist_le h\u03b4 with \u27e8g, hgc, hg\u27e9\n exact \u27e8g, hgc, fun a \u21a6 (hg a _ fun _ h \u21a6 (hf\u03b4 h).le).trans_lt (half_lt_self h\u03b5)\u27e9\n\n/-- Infinitely smooth functions are dense in the space of continuous functions. -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Basic.support_eq (L151-L156)\ntheorem support_eq : Function.support f = Metric.ball c f.rOut := by\nsimp only [toFun, support_comp_eq_preimage, ContDiffBumpBase.support _ _ f.one_lt_rOut_div_rIn]\n ext x\n simp only [mem_ball_iff_norm, sub_zero, norm_smul, mem_preimage, Real.norm_eq_abs, abs_inv,\n abs_of_pos f.rIn_pos, \u2190 div_eq_inv_mul, div_lt_div_iff_of_pos_right f.rIn_pos]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.u_smooth (L248-L250)\ntheorem u_smooth : ContDiff \u211d \u221e (u : E \u2192 \u211d) :=\n(Classical.choose_spec (u_exists E)).1\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.tsupport_normed_eq (L76-L78)\ntheorem tsupport_normed_eq : tsupport (f.normed \u03bc) = Metric.closedBall c f.rOut := by\nrw [tsupport, f.support_normed_eq, closure_ball _ f.rOut_pos.ne']\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_le_measure_closedBall (L116-L125)\ntheorem integral_le_measure_closedBall : \u222b x, f x \u2202\u03bc \u2264 \u03bc.real (closedBall c f.rOut) := by calc\n\u222b x, f x \u2202\u03bc = \u222b x in closedBall c f.rOut, f x \u2202\u03bc := by\n apply (setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx \u21a6 ?_)).symm\n apply f.zero_of_le_dist (le_of_lt _)\n simpa using hx\n _ \u2264 \u222b x in closedBall c f.rOut, 1 \u2202\u03bc := by\n apply setIntegral_mono f.integrable.integrableOn _ (fun x \u21a6 f.le_one)\n simp [measure_closedBall_lt_top]\n _ = \u03bc.real (closedBall c f.rOut) := by simp\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_integral (L305-L309)\ntheorem w_integral {D : \u211d} (Dpos : 0 < D) : \u222b x : E, w D x \u2202\u03bc = 1 := by\nsimp_rw [w, integral_smul]\n rw [integral_comp_inv_smul_of_nonneg \u03bc (u : E \u2192 \u211d) Dpos.le, abs_of_nonneg Dpos.le, mul_comm]\n simp [field, (u_int_pos E).ne']\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Convolution.normed_convolution_eq_right (L65-L74)\ntheorem normed_convolution_eq_right [IsLocallyFiniteMeasure \u03bc] [\u03bc.IsOpenPosMeasure] {x\u2080 : G}\n (hg : \u2200 x \u2208 ball x\u2080 \u03c6.rOut, g x = g x\u2080) :\n (\u03c6.normed \u03bc \u22c6[lsmul \u211d \u211d, \u03bc] g : G \u2192 E') x\u2080 = g x\u2080 := by\nrw [convolution_eq_right' _ \u03c6.support_normed_eq.subset hg]\n exact integral_normed_smul \u03c6 \u03bc (g x\u2080)\n\nvariable [\u03bc.IsAddHaarMeasure]\n\n/-- If `\u03c6` is a normed bump function, approximate `(\u03c6 \u22c6 g) x\u2080`\nif `g` is near `g x\u2080` on a ball with radius `\u03c6.rOut` around `x\u2080`. -/\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.w_support (L310-L319)\ntheorem w_support {D : \u211d} (Dpos : 0 < D) : support (w D : E \u2192 \u211d) = ball 0 D := by\nhave B : D \u2022 ball (0 : E) 1 = ball 0 D := by\n rw [smul_unitBall Dpos.ne', Real.norm_of_nonneg Dpos.le]\n have C : D ^ finrank \u211d E \u2260 0 := by\n norm_cast\n exact pow_ne_zero _ Dpos.ne'\n simp only [w_def, smul_eq_mul, support_mul, support_inv, univ_inter,\n support_comp_inv_smul\u2080 Dpos.ne', u_support, B, support_const (u_int_pos E).ne', support_const C,\n abs_of_nonneg Dpos.le]\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension.IsOpen (L82-L192)\ntheorem IsOpen.exists_contDiff_support_eq {n : \u2115\u221e} {s : Set E} (hs : IsOpen s) :\n \u2203 f : E \u2192 \u211d, f.support = s \u2227 ContDiff \u211d n f \u2227 Set.range f \u2286 Set.Icc 0 1 := by\n/- For any given point `x` in `s`, one can construct a smooth function with support in `s` and\n nonzero at `x`. By second-countability, it follows that we may cover `s` with the supports of\n countably many such functions, say `g i`.\n Then `\u2211 i, r i \u2022 g i` will be the desired function if `r i` is a sequence of positive numbers\n tending quickly enough to zero. Indeed, this ensures that, for any `k \u2264 i`, the `k`-th\n derivative of `r i \u2022 g i` is bounded by a prescribed (summable) sequence `u i`. From this, the\n summability of the series and of its successive derivatives follows. -/\n rcases eq_empty_or_nonempty s with (rfl | h's)\n \u00b7 exact\n \u27e8fun _ => 0, Function.support_zero, contDiff_const, by\n simp only [range_const, singleton_subset_iff, left_mem_Icc, zero_le_one]\u27e9\n let \u03b9 := { f : E \u2192 \u211d // f.support \u2286 s \u2227 HasCompactSupport f \u2227 ContDiff \u211d \u221e f \u2227 range f \u2286 Icc 0 1 }\n obtain \u27e8T, T_count, hT\u27e9 : \u2203 T : Set \u03b9, T.Countable \u2227 \u22c3 f \u2208 T, support (f : E \u2192 \u211d) = s := by\n have : \u22c3 f : \u03b9, (f : E \u2192 \u211d).support = s := by\n refine Subset.antisymm (iUnion_subset fun f => f.2.1) ?_\n intro x hx\n rcases exists_contDiff_tsupport_subset (hs.mem_nhds hx) with \u27e8f, hf\u27e9\n let g : \u03b9 := \u27e8f, (subset_tsupport f).trans hf.1, hf.2.1, hf.2.2.1, hf.2.2.2.1\u27e9\n have : x \u2208 support (g : E \u2192 \u211d) := by\n simp only [g, hf.2.2.2.2, mem_support, Ne, one_ne_zero, not_false_iff]\n exact mem_iUnion_of_mem _ this\n simp_rw [\u2190 this]\n apply isOpen_iUnion_countable\n rintro \u27e8f, hf\u27e9\n exact hf.2.2.1.continuous.isOpen_support\n obtain \u27e8g0, hg\u27e9 : \u2203 g0 : \u2115 \u2192 \u03b9, T = range g0 := by\n apply Countable.exists_eq_range T_count\n rcases eq_empty_or_nonempty T with (rfl | hT)\n \u00b7 simp only [\u2190 hT, mem_empty_iff_false, iUnion_of_empty, iUnion_empty, Set.not_nonempty_empty]\n at h's\n \u00b7 exact hT\n let g : \u2115 \u2192 E \u2192 \u211d := fun n => (g0 n).1\n have g_s : \u2200 n, support (g n) \u2286 s := fun n => (g0 n).2.1\n have s_g : \u2200 x \u2208 s, \u2203 n, x \u2208 support (g n) := fun x hx \u21a6 by\n rw [\u2190 hT] at hx\n obtain \u27e8i, iT, hi\u27e9 : \u2203 i \u2208 T, x \u2208 support (i : E \u2192 \u211d) := by\n simpa only [mem_iUnion, exists_prop] using hx\n grind\n have g_smooth : \u2200 n, ContDiff \u211d \u221e (g n) := fun n => (g0 n).2.2.2.1\n have g_comp_supp : \u2200 n, HasCompactSupport (g n) := fun n => (g0 n).2.2.1\n have g_nonneg : \u2200 n x, 0 \u2264 g n x := fun n x => ((g0 n).2.2.2.2 (mem_range_self x)).1\n obtain \u27e8\u03b4, \u03b4pos, c, \u03b4c, c_lt\u27e9 :\n \u2203 \u03b4 : \u2115 \u2192 \u211d\u22650, (\u2200 i : \u2115, 0 < \u03b4 i) \u2227 \u2203 c : NNReal, HasSum \u03b4 c \u2227 c < 1 :=\n NNReal.exists_pos_sum_of_countable one_ne_zero \u2115\n have : \u2200 n : \u2115, \u2203 r : \u211d, 0 < r \u2227 \u2200 i \u2264 n, \u2200 x, \u2016iteratedFDeriv \u211d i (r \u2022 g n) x\u2016 \u2264 \u03b4 n := by\n intro n\n have : \u2200 i, \u2203 R, \u2200 x, \u2016iteratedFDeriv \u211d i (fun x => g n x) x\u2016 \u2264 R := by\n intro i\n have : BddAbove (range fun x => \u2016iteratedFDeriv \u211d i (fun x : E => g n x) x\u2016) := by\n apply ((g_smooth n).continuous_iteratedFDeriv\n (mod_cast le_top)).norm.bddAbove_range_of_hasCompactSupport\n apply HasCompactSupport.comp_left _ norm_zero\n apply (g_comp_supp n).iteratedFDeriv\n rcases this with \u27e8R, hR\u27e9\n exact \u27e8R, fun x => hR (mem_range_self _)\u27e9\n choose R hR using this\n let M := max (((Finset.range (n + 1)).image R).max' (by simp)) 1\n have \u03b4npos : 0 < \u03b4 n := \u03b4pos n\n have IR : \u2200 i \u2264 n, R i \u2264 M := by\n intro i hi\n refine le_trans ?_ (le_max_left _ _)\n apply Finset.le_max'\n apply Finset.mem_image_of_mem\n simp only [Finset.mem_range]\n lia\n refine \u27e8M\u207b\u00b9 * \u03b4 n, by positivity, fun i hi x => ?_\u27e9\n calc\n \u2016iteratedFDeriv \u211d i ((M\u207b\u00b9 * \u03b4 n) \u2022 g n) x\u2016 = \u2016(M\u207b\u00b9 * \u03b4 n) \u2022 iteratedFDeriv \u211d i (g n) x\u2016 := by\n rw [iteratedFDeriv_const_smul_apply]\n exact (g_smooth n).contDiffAt.of_le (mod_cast le_top)\n _ = M\u207b\u00b9 * \u03b4 n * \u2016iteratedFDeriv \u211d i (g n) x\u2016 := by\n rw [norm_smul _ (iteratedFDeriv \u211d i (g n) x), Real.norm_of_nonneg]; positivity\n _ \u2264 M\u207b\u00b9 * \u03b4 n * M := by gcongr; exact (hR i x).trans (IR i hi)\n _ = \u03b4 n := by simp [field]\n choose r rpos hr using this\n have S : \u2200 x, Summable fun n => (r n \u2022 g n) x := fun x \u21a6 by\n refine .of_nnnorm_bounded \u03b4c.summable fun n => ?_\n rw [\u2190 NNReal.coe_le_coe, coe_nnnorm]\n simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) x\n refine \u27e8fun x => \u2211' n, (r n \u2022 g n) x, ?_, ?_, ?_\u27e9\n \u00b7 apply Subset.antisymm\n \u00b7 intro x hx\n simp only [Pi.smul_apply, smul_eq_mul, mem_support, Ne] at hx\n contrapose! hx\n have : \u2200 n, g n x = 0 := by\n intro n\n contrapose! hx\n exact g_s n hx\n simp only [this, mul_zero, tsum_zero]\n \u00b7 intro x hx\n obtain \u27e8n, hn\u27e9 : \u2203 n, x \u2208 support (g n) := s_g x hx\n have I : 0 < r n * g n x := mul_pos (rpos n) (lt_of_le_of_ne (g_nonneg n x) (Ne.symm hn))\n exact ne_of_gt ((S x).tsum_pos (fun i => mul_nonneg (rpos i).le (g_nonneg i x)) n I)\n \u00b7 apply ContDiff.of_le _ (show (n : WithTop \u2115\u221e) \u2264 \u221e from mod_cast le_top)\n refine\n contDiff_tsum_of_eventually (fun k => (g_smooth k).const_smul (r k))\n (fun k _ => (NNReal.hasSum_coe.2 \u03b4c).summable) ?_\n intro i _\n simp only [Nat.cofinite_eq_atTop, Filter.eventually_atTop]\n exact \u27e8i, fun n hn x => hr _ _ hn _\u27e9\n \u00b7 rintro - \u27e8y, rfl\u27e9\n refine \u27e8tsum_nonneg fun n => mul_nonneg (rpos n).le (g_nonneg n y), le_trans ?_ c_lt.le\u27e9\n have A : HasSum (fun n => (\u03b4 n : \u211d)) c := NNReal.hasSum_coe.2 \u03b4c\n simp only [Pi.smul_apply, smul_eq_mul, NNReal.val_eq_coe, \u2190 A.tsum_eq]\n apply Summable.tsum_le_tsum _ (S y) A.summable\n intro n\n apply (le_abs_self _).trans\n simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) y\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Analysis.Calculus.Conformal.InnerProduct.conformalFactorAt_inner_eq_mul_inner (L53-L56)\ntheorem conformalFactorAt_inner_eq_mul_inner {f : E \u2192 F} {x : E} {f' : E \u2192L[\u211d] F}\n (h : HasFDerivAt f f' x) (H : ConformalAt f x) (u v : E) :\n \u27eaf' u, f' v\u27eb = (conformalFactorAt H : \u211d) * \u27eau, v\u27eb :=\nH.differentiableAt.hasFDerivAt.unique h \u25b8 conformalFactorAt_inner_eq_mul_inner' H u v\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Analysis.Calculus.BumpFunction.Normed.integral_pos (L63-L67)\ntheorem integral_pos : 0 < \u222b x, f x \u2202\u03bc := by\nrefine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_\n rw [f.support_eq]\n exact measure_ball_pos \u03bc c f.rOut_pos\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Calculus/FDeriv/Pow.lean", "module": "Mathlib.Analysis.Calculus.FDeriv.Pow", "declaration": "Mathlib.Analysis.Calculus.FDeriv.Pow.HasFDerivAt", "span": "L98-L101", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/FDeriv/Pow.lean#L98"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 20899, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 52622, "lean_code_chars": 49356, "natural_language_chars": 3266, "lean_code_ratio": 0.9379, "line_count": 1330, "imports_count": 0, "declarations_count": 5503, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "bc1f643b0b04d5c3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.Ideal.Operations.prod_eq_iInf_of_pairwise_isCoprime", "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.RingTheory.Ideal.Operations)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem prod_eq_iInf_of_pairwise_isCoprime {s : Finset \u03b9} {J : \u03b9 \u2192 Ideal R}\n (hp : (s : Set \u03b9).Pairwise (IsCoprime on J)) :\n \u220f i \u2208 s, J i = \u2a05 i \u2208 s, J i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.coe_span_smul (L33-L50)\nlemma coe_span_smul {R' M' : Type*} [CommSemiring R'] [AddCommMonoid M'] [Module R' M']\n (s : Set R') (N : Submodule R' M') :\n (Ideal.span s : Set R') \u2022 N = s \u2022 N :=\nset_smul_eq_of_le _ _ _\n (by rintro r n hr hn\n induction hr using Submodule.span_induction with\n | mem _ h => exact mem_set_smul_of_mem_mem h hn\n | zero => rw [zero_smul]; exact Submodule.zero_mem _\n | add _ _ _ _ ihr ihs => rw [add_smul]; exact Submodule.add_mem _ ihr ihs\n | smul _ _ hr =>\n rw [mem_span_set] at hr\n obtain \u27e8c, hc, rfl\u27e9 := hr\n rw [Finsupp.sum, Finset.smul_sum, Finset.sum_smul]\n refine Submodule.sum_mem _ fun i hi => ?_\n rw [\u2190 mul_smul, smul_eq_mul, mul_comm, mul_smul]\n exact mem_set_smul_of_mem_mem (hc hi) <| Submodule.smul_mem _ _ hn) <|\n set_smul_mono_left _ Submodule.subset_span\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.span_singleton_toAddSubgroup_eq_zmultiples (L51-L55)\nlemma span_singleton_toAddSubgroup_eq_zmultiples (a : \u2124) :\n (span \u2124 {a}).toAddSubgroup = AddSubgroup.zmultiples a := by\next i\n simp [Ideal.mem_span_singleton', AddSubgroup.mem_zmultiples_iff]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.smul_le_right (L73-L75)\ntheorem smul_le_right : I \u2022 N \u2264 N :=\nsmul_le.2 fun r _ _ \u21a6 N.smul_mem r\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.map_le_smul_top (L76-L83)\ntheorem map_le_smul_top (I : Ideal R) (f : R \u2192\u2097[R] M) :\n Submodule.map f I \u2264 I \u2022 (\u22a4 : Submodule R M) := by\nrintro _ \u27e8y, hy, rfl\u27e9\n rw [\u2190 mul_one y, \u2190 smul_eq_mul, f.map_smul]\n exact smul_mem_smul hy mem_top\n\nvariable (I J N)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.top_smul (L85-L90)\ntheorem top_smul : (\u22a4 : Ideal R) \u2022 N = N :=\nle_antisymm smul_le_right fun r hri => one_smul R r \u25b8 smul_mem_smul mem_top hri\n\nprotected theorem mul_smul : (I * J) \u2022 N = I \u2022 J \u2022 N :=\n Submodule.smul_assoc _ _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_of_span_top_of_smul_mem (L91-L100)\ntheorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = \u22a4) (x : M)\n (H : \u2200 r : s, (r : R) \u2022 x \u2208 M') : x \u2208 M' := by\nsuffices LinearMap.range (LinearMap.toSpanSingleton R M x) \u2264 M' by\n rw [\u2190 LinearMap.toSpanSingleton_apply_one R M x]\n exact this (LinearMap.mem_range_self _ 1)\n rw [LinearMap.range_eq_map, \u2190 hs, map_le_iff_le_comap, Ideal.span, span_le]\n exact fun r hr \u21a6 H \u27e8r, hr\u27e9\n\nvariable {M' : Type w} [AddCommMonoid M'] [Module R M']\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.map_smul'' (L102-L111)\ntheorem map_smul'' (f : M \u2192\u2097[R] M') : (I \u2022 N).map f = I \u2022 N.map f :=\nle_antisymm\n (map_le_iff_le_comap.2 <|\n smul_le.2 fun r hr n hn =>\n show f (r \u2022 n) \u2208 I \u2022 N.map f from\n (f.map_smul r n).symm \u25b8 smul_mem_smul hr (mem_map_of_mem hn)) <|\n smul_le.2 fun r hr _ hn =>\n let \u27e8p, hp, hfp\u27e9 := mem_map.1 hn\n hfp \u25b8 f.map_smul r p \u25b8 mem_map_of_mem (smul_mem_smul hr hp)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_smul_top_iff (L112-L117)\ntheorem mem_smul_top_iff (N : Submodule R M) (x : N) :\n x \u2208 I \u2022 (\u22a4 : Submodule R N) \u2194 (x : M) \u2208 I \u2022 N := by\nhave : Submodule.map N.subtype (I \u2022 \u22a4) = I \u2022 N := by\n rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]\n simp [\u2190 this, -map_smul'']\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.smul_comap_le_comap_smul (L119-L125)\ntheorem smul_comap_le_comap_smul (f : M \u2192\u2097[R] M') (S : Submodule R M') (I : Ideal R) :\n I \u2022 S.comap f \u2264 (I \u2022 S).comap f := by\nrefine Submodule.smul_le.mpr fun r hr x hx => ?_\n rw [Submodule.mem_comap] at hx \u22a2\n rw [f.map_smul]\n exact Submodule.smul_mem_smul hr hx\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.comap_smul'' (L126-L134)\nlemma comap_smul'' {f : M \u2192\u2097[R] M'} (hf : Function.Injective f) {p : Submodule R M'}\n (hp : p \u2264 LinearMap.range f) {I : Ideal R} :\n Submodule.comap f (I \u2022 p) = I \u2022 Submodule.comap f p := by\nrefine le_antisymm ?_ (by simp)\n conv_lhs => rw [\u2190 Submodule.map_comap_eq_self hp, \u2190 Submodule.map_smul'']\n rw [Submodule.comap_map_eq_of_injective hf]\n\nvariable {I}\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_smul_span_singleton (L135-L147)\ntheorem mem_smul_span_singleton [I.IsTwoSided] {m : M} {x : M} :\n x \u2208 I \u2022 span R ({m} : Set M) \u2194 \u2203 y \u2208 I, y \u2022 m = x :=\n\u27e8fun hx =>\n smul_induction_on hx\n (fun r hri _ hnm =>\n let \u27e8s, hs\u27e9 := mem_span_singleton.1 hnm\n \u27e8r * s, I.mul_mem_right _ hri, hs \u25b8 mul_smul r s m\u27e9)\n fun m1 m2 \u27e8y1, hyi1, hy1\u27e9 \u27e8y2, hyi2, hy2\u27e9 =>\n \u27e8y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]\u27e9,\n fun \u27e8_, hyi, hy\u27e9 => hy \u25b8 smul_mem_smul hyi (subset_span <| Set.mem_singleton m)\u27e9\n\nvariable (S : Set R) (T : Set M)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.span_smul_span (L148-L165)\ntheorem span_smul_span [(Ideal.span S).IsTwoSided] :\n Ideal.span S \u2022 span R T = span R (S \u2022 T) :=\nle_antisymm (smul_le.mpr fun r hr m hm \u21a6 by\n revert r\n refine span_induction (fun m hm r hr \u21a6 span_induction\n (fun r hr \u21a6 subset_span \u27e8r, hr, m, hm, rfl\u27e9)\n (by rw [zero_smul]; exact zero_mem _)\n (fun _ _ _ _ h\u2081 h\u2082 \u21a6 by rw [add_smul]; exact add_mem h\u2081 h\u2082)\n (fun _ _ _ h \u21a6 by rw [smul_assoc]; exact smul_mem _ _ h) hr)\n (fun _ _ \u21a6 by rw [smul_zero]; exact zero_mem _)\n (fun _ _ _ _ h\u2081 h\u2082 r hr \u21a6 by rw [smul_add]; exact add_mem (h\u2081 r hr) (h\u2082 r hr))\n (fun r' m hm mem r hr \u21a6 by rw [\u2190 mul_smul]; exact mem _ (Ideal.mul_mem_right _ _ hr)) hm) <|\n span_le.mpr fun m \u21a6 by\n rintro \u27e8s, hs, t, ht, rfl\u27e9\n exact smul_mem_smul (subset_span hs) (subset_span ht)\n\nvariable [I.IsTwoSided]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_smul_span (L166-L174)\ntheorem mem_smul_span {s : Set M} {x : M} :\n x \u2208 I \u2022 Submodule.span R s \u2194 x \u2208 Submodule.span R ((I : Set R) \u2022 s) := by\nrw [\u2190 I.span_eq] at *\n rw [Submodule.span_smul_span, I.span_eq]\n\nvariable (I)\n\n/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,\nthen we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_ideal_smul_span_iff_exists_sum (L175-L198)\ntheorem mem_ideal_smul_span_iff_exists_sum {\u03b9 : Type*} (f : \u03b9 \u2192 M) (x : M) :\n x \u2208 I \u2022 span R (Set.range f) \u2194\n \u2203 (a : \u03b9 \u2192\u2080 R) (_ : \u2200 i, a i \u2208 I), (a.sum fun i c => c \u2022 f i) = x := by\nconstructor; swap\n \u00b7 rintro \u27e8a, ha, rfl\u27e9\n exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _\n refine fun hx => span_induction ?_ ?_ ?_ ?_ (mem_smul_span.mp hx)\n \u00b7 rintro x \u27e8y, hy, x, \u27e8i, rfl\u27e9, rfl\u27e9\n refine \u27e8Finsupp.single i y, fun j => ?_, ?_\u27e9\n \u00b7 letI := Classical.decEq \u03b9\n rw [Finsupp.single_apply]\n split_ifs\n \u00b7 assumption\n \u00b7 exact I.zero_mem\n refine @Finsupp.sum_single_index \u03b9 R M _ _ i _ (fun i y => y \u2022 f i) ?_\n simp\n \u00b7 exact \u27e80, fun _ => I.zero_mem, Finsupp.sum_zero_index\u27e9\n \u00b7 rintro x y - - \u27e8ax, hax, rfl\u27e9 \u27e8ay, hay, rfl\u27e9\n refine \u27e8ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' ?_ ?_\u27e9 <;>\n intros <;> simp only [zero_smul, add_smul]\n \u00b7 rintro c x - \u27e8a, ha, rfl\u27e9\n refine \u27e8c \u2022 a, fun i => I.mul_mem_left c (ha i), ?_\u27e9\n rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_ideal_smul_span_iff_exists_sum' (L199-L213)\ntheorem mem_ideal_smul_span_iff_exists_sum' {\u03b9 : Type*} (s : Set \u03b9) (f : \u03b9 \u2192 M) (x : M) :\n x \u2208 I \u2022 span R (f '' s) \u2194\n \u2203 (a : s \u2192\u2080 R) (_ : \u2200 i, a i \u2208 I), (a.sum fun i c => c \u2022 f i) = x := by\nrw [\u2190 Submodule.mem_ideal_smul_span_iff_exists_sum, \u2190 Set.image_eq_range]\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']\n\nopen Pointwise\n\nvariable {I : Ideal R} {N : Submodule R M}\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.smul_eq_map\u2082 (L214-L219)\ntheorem smul_eq_map\u2082 : I \u2022 N = Submodule.map\u2082 (LinearMap.lsmul R M) I N :=\nle_antisymm (smul_le.mpr fun _m hm _n \u21a6 Submodule.apply_mem_map\u2082 _ hm)\n (map\u2082_le.mpr fun _m hm _n \u21a6 smul_mem_smul hm)\n\nvariable (S : Set R) (T : Set M)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.ideal_span_singleton_smul (L220-L226)\ntheorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :\n (Ideal.span {r} : Ideal R) \u2022 N = r \u2022 N := by\nconv_lhs => rw [\u2190 span_eq N, span_smul_span]\n simpa using span_eq (r \u2022 N)\n\n/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a\nsubmodule `M'` of `x`, we only need to show that `r ^ n \u2022 x \u2208 M'` for some `n` for each `r : s`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_of_span_eq_top_of_smul_pow_mem (L227-L234)\ntheorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = \u22a4)\n (x : M) (H : \u2200 r : s, \u2203 n : \u2115, ((r : R) ^ n : R) \u2022 x \u2208 M') : x \u2208 M' := by\nchoose f hf using H\n apply M'.mem_of_span_top_of_smul_mem _ (Ideal.span_range_pow_eq_top s hs f)\n rintro \u27e8_, r, hr, rfl\u27e9\n exact hf r\n\nopen Pointwise in\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.map_pointwise_smul (L236-L249)\ntheorem map_pointwise_smul (r : R) (N : Submodule R M) (f : M \u2192\u2097[R] M') :\n (r \u2022 N).map f = r \u2022 N.map f := by\nsimp_rw [\u2190 ideal_span_singleton_smul, map_smul'']\n\nend CommSemiring\n\nend Submodule\n\nnamespace Ideal\n\nsection Add\n\nvariable {R : Type u} [Semiring R]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.add_eq_sup (L251-L253)\ntheorem add_eq_sup {I J : Ideal R} : I + J = I \u2294 J :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.zero_eq_bot (L255-L257)\ntheorem zero_eq_bot : (0 : Ideal R) = \u22a5 :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.sum_eq_sup (L259-L267)\ntheorem sum_eq_sup {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Ideal R) : s.sum f = s.sup f :=\nrfl\n\nend Add\n\nsection Semiring\n\nvariable {R : Type u} [Semiring R] {I J K L : Ideal R}\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.one_eq_top (L269-L271)\ntheorem one_eq_top : (1 : Ideal R) = \u22a4 := by\nrw [Submodule.one_eq_span, \u2190 Ideal.span, Ideal.span_singleton_one]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.add_eq_one_iff (L272-L274)\ntheorem add_eq_one_iff : I + J = 1 \u2194 \u2203 i \u2208 I, \u2203 j \u2208 J, i + j = 1 := by\nrw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mul_mem_mul (L275-L277)\ntheorem mul_mem_mul {r s} (hr : r \u2208 I) (hs : s \u2208 J) : r * s \u2208 I * J :=\nSubmodule.smul_mem_smul hr hs\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.Cotangent (L41-L49)\ndef Cotangent : Type _ := I \u29f8 (I \u2022 \u22a4 : Submodule R I)\nderiving Inhabited, AddCommGroup, Module (R \u29f8 I)\n\nderiving instance Module S, IsScalarTower S S' for Cotangent I\n\nvariable [IsNoetherian R I] in\nderiving instance IsNoetherian R for Cotangent I\n\n/-- The quotient map from `I` to `I \u29f8 I ^ 2`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Ideal (L170-L179)\ntheorem Ideal.IsMaximal.mem_associatedPrimes_of_isFractionRing [IsFractionRing A A]\n (I : Ideal A) [hI : I.IsMaximal] : I \u2208 associatedPrimes A A :=\nhave fin := associatedPrimes.finite A A\n have \u27e8P, hP\u27e9 := (I.subset_union_prime_finite fin (f := id) 0 0 fun _ h _ _ \u21a6 h.isPrime).1 <| by\n simp_rw [id, biUnion_associatedPrimes_eq_compl_nonZeroDivisors]\n exact fun x hx h \u21a6 hI.ne_top <| I.eq_top_of_isUnit_mem hx\n (IsFractionRing.self_iff_nonZeroDivisors_le_isUnit.mp \u2039_\u203a h)\n hI.eq_of_le hP.1.isPrime.ne_top hP.2 \u25b8 hP.1\n\n/-- A commutative Noetherian total ring of fractions is semilocal. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.ne_bot_of_isMaximal_of_not_isField (L303-L314)\ntheorem ne_bot_of_isMaximal_of_not_isField [Nontrivial R] {M : Ideal R} (max : M.IsMaximal)\n (not_field : \u00acIsField R) : M \u2260 \u22a5 := by\nrintro rfl\n obtain \u27e8I, hIbot, hItop\u27e9 := not_isField_iff_exists_ideal_bot_lt_and_lt_top.mp not_field\n exact hIbot.ne (max.eq_of_le hItop.ne bot_le)\n\nend Ring\n\nnamespace Ideal\n\nvariable {R : Type*} [CommSemiring R] [Nontrivial R]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.constr_basisSpanSingleton (L46-L54)\ntheorem constr_basisSpanSingleton {N : Type*} [Semiring N] [Module N S] [SMulCommClass R N S]\n (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) :\n (b.constr N).toFun (((\u2191) : _ \u2192 S) \u2218 (basisSpanSingleton b hx)) = Algebra.lmul R S x :=\nb.ext fun i => by simp\n\nend Ideal\n\n/-- If `I : Ideal S` has a basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_prime (L282-L291)\ntheorem not_isField_iff_exists_prime [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsPrime := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot h_top.ne_top\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, hI, hIm.isPrime\u27e9\n\n/-- Also see `Ideal.isSimpleOrder` for the forward direction as an instance when `R` is a\ndivision (semi)ring.\n\nThis result actually holds for all division semirings, but we lack the predicate to state it. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_union (L106-L108)\nlemma colon_union : N.colon (S\u2081 \u222a S\u2082) = N.colon S\u2081 \u2293 N.colon S\u2082 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_span_singleton (L154-L156)\ntheorem mem_colon_span_singleton {x : M} {r : R} : r \u2208 N.colon (span R {x}) \u2194 r \u2022 x \u2208 N := by\nsimp\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.sum_pow_mem_span_pow (L155-L160)\ntheorem sum_pow_mem_span_pow {\u03b9} (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) (n : \u2115) :\n (\u2211 i \u2208 s, f i) ^ (s.card * n + 1) \u2208 span ((fun i => f i ^ (n + 1)) '' s) := by\nclassical\n simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,\n Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon (L93-L95)\nlemma iInf_colon {\u03b9 : Sort*} (f : \u03b9 \u2192 Submodule R M) : (\u2a05 i, f i).colon S = \u2a05 i, (f i).colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.top_colon (L102-L104)\nlemma top_colon : (\u22a4 : Submodule R M).colon S = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 42\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_iff_le (L134-L137)\ntheorem mem_colon_iff_le {r} : r \u2208 N.colon N' \u2194 r \u2022 N' \u2264 N := by\naesop (add simp SetLike.coe_subset_coe)\n\n/-- A variant for arbitrary sets in commutative semirings -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass\n```\n\n-- snippet 44\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_singleton_zero (L117-L119)\nlemma colon_singleton_zero : N.colon {0} = \u22a4 := by\nsimp\n```\n\n-- snippet 45\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.bot_lt_of_maximal (L315-L318)\ntheorem bot_lt_of_maximal (M : Ideal R) [hm : M.IsMaximal] (non_field : \u00acIsField R) : \u22a5 < M :=\n(Ring.ne_bot_of_isMaximal_of_not_isField hm non_field).bot_lt\n\nend Ideal\n```\n\n-- snippet 46\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_not_isUnit_of_not_isField (L250-L258)\ntheorem exists_not_isUnit_of_not_isField [Nontrivial R] (hf : \u00acIsField R) :\n \u2203 (x : R) (_hx : x \u2260 (0 : R)), \u00acIsUnit x := by\nhave : \u00ac_ := fun h => hf \u27e8exists_pair_ne R, mul_comm, h\u27e9\n simp_rw [isUnit_iff_exists_inv]\n push Not at this \u22a2\n obtain \u27e8x, hx, not_unit\u27e9 := this\n exact \u27e8x, hx, not_unit\u27e9\n\nopen Ideal in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff\n```\n\n-- snippet 48\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_range_pow_eq_top (L186-L195)\ntheorem span_range_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : s \u2192 \u2115) :\n span (Set.range fun x \u21a6 x.1 ^ n x) = \u22a4 := by\nhave \u27e8t, hts, mem\u27e9 := Submodule.mem_span_finite_of_mem_span ((eq_top_iff_one _).mp hs)\n refine top_unique ((span_pow_eq_top _ ((eq_top_iff_one _).mpr mem) <|\n t.attach.sup fun x \u21a6 n \u27e8x, hts x.2\u27e9).ge.trans <| span_le.mpr ?_)\n rintro _ \u27e8x, hxt, rfl\u27e9\n rw [\u2190 Nat.sub_add_cancel (Finset.le_sup <| t.mem_attach \u27e8x, hxt\u27e9)]\n simp_rw [pow_add]\n exact mul_mem_left _ _ (subset_span \u27e8_, rfl\u27e9)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.mem_toCotangent_ker (L58-L61)\ntheorem mem_toCotangent_ker {x : I} : x \u2208 LinearMap.ker I.toCotangent \u2194 (x : R) \u2208 I ^ 2 := by\nrw [\u2190 I.map_toCotangent_ker]\n simp\n```\n\n-- snippet 52\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_maximal_of_not_isField (L265-L270)\ntheorem exists_maximal_of_not_isField [Nontrivial R] (h : \u00ac IsField R) :\n \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsMaximal := by\ncontrapose! h\n simp only [\u2190 bot_lt_iff_ne_bot] at h\n refine isField_iff_maximal_bot.mpr \u27e8\u27e8bot_ne_top, Ideal.maximal_of_no_maximal h\u27e9\u27e9\n```\n\n-- snippet 54\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon (L45-L46)\ntheorem mem_colon {r} : r \u2208 N.colon S \u2194 \u2200 s \u2208 S, r \u2022 s \u2208 N := Set.smul_set_subset_iff\n```\n\n-- snippet 55\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq (L62-L65)\ntheorem toCotangent_eq {x y : I} : I.toCotangent x = I.toCotangent y \u2194 (x - y : R) \u2208 I ^ 2 := by\nrw [\u2190 sub_eq_zero]\n exact I.mem_toCotangent_ker\n```\n\n-- snippet 56\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in\n```\n\n-- snippet 57\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_eq_top_iff_subset (L85-L87)\nlemma colon_eq_top_iff_subset (S : Set M) : N.colon S = \u22a4 \u2194 S \u2286 N := by\naesop (add simp [mem_colon, Ideal.eq_top_iff_one])\n```\n\n-- snippet 58\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_bot (L120-L129)\nlemma colon_bot : N.colon ((\u22a5 : Submodule R M) : Set M) = \u22a4 := by\nsimp\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M]\nvariable {N N' : Submodule R M} {S : Set M}\n```\n\n-- snippet 59\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon_iUnion (L74-L77)\ntheorem iInf_colon_iUnion (\u03b9\u2081 : Sort*) (f : \u03b9\u2081 \u2192 Submodule R M) (\u03b9\u2082 : Sort*) (g : \u03b9\u2082 \u2192 Set M) :\n (\u2a05 i, f i).colon (\u22c3 j, g j) = \u2a05 (i) (j), (f i).colon (g j) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 60\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_pow_eq_top (L161-L185)\ntheorem span_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : \u2115) :\n span ((fun (x : \u03b1) => x ^ n) '' s) = \u22a4 := by\nrw [eq_top_iff_one]\n rcases n with - | n\n \u00b7 obtain rfl | \u27e8x, hx\u27e9 := eq_empty_or_nonempty s\n \u00b7 rw [Set.image_empty, hs]\n trivial\n \u00b7 exact subset_span \u27e8_, hx, pow_zero _\u27e9\n rw [eq_top_iff_one, span, Finsupp.mem_span_iff_linearCombination] at hs\n rcases hs with \u27e8f, hf\u27e9\n simp only [Finsupp.linearCombination, Finsupp.coe_lsum, Finsupp.sum, LinearMap.coe_smulRight,\n LinearMap.id_coe, id_eq, smul_eq_mul] at hf\n have := sum_pow_mem_span_pow f.support (fun a => f a * a) n\n rw [hf, one_pow] at this\n refine span_le.mpr ?_ this\n rintro _ hx\n simp_rw [Set.mem_image] at hx\n rcases hx with \u27e8x, _, rfl\u27e9\n have : span ({(x : \u03b1) ^ (n + 1)} : Set \u03b1) \u2264 span ((fun x : \u03b1 => x ^ (n + 1)) '' s) := by\n rw [span_le, Set.singleton_subset_iff]\n exact subset_span \u27e8x, x.prop, rfl\u27e9\n refine this ?_\n rw [mul_pow, mem_span_singleton]\n exact \u27e8f x ^ (n + 1), mul_comm _ _\u27e9\n```\n\n-- snippet 61\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon' (L131-L133)\ntheorem mem_colon' {r} : r \u2208 N.colon S \u2194 S \u2264 comap (r \u2022 (LinearMap.id : M \u2192\u2097[R] M)) N :=\nmem_colon\n```\n\n-- snippet 62\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes\n```\n\n-- snippet 63\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in\n```\n\n-- snippet 64\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_single_eq_top (L203-L232)\nlemma span_single_eq_top {\u03b9 : Type*} [DecidableEq \u03b9] [Finite \u03b9] (R : \u03b9 \u2192 Type*)\n [\u2200 i, Semiring (R i)] : Ideal.span (Set.range fun i \u21a6 (Pi.single i 1 : \u03a0 i, R i)) = \u22a4 := by\nrw [_root_.eq_top_iff]\n rintro x -\n induction x using Pi.single_induction with\n | zero => simp\n | add f g hf hg => exact Ideal.add_mem _ hf hg\n | single i r =>\n rw [show Pi.single i r = Pi.single i r * Pi.single i 1 by simp [\u2190 Pi.single_mul_left]]\n exact Ideal.mul_mem_left _ _ (Ideal.subset_span \u27e8i, rfl\u27e9)\n\nend Ideal\n\nend CommSemiring\n\nsection DivisionSemiring\n\nvariable {K : Type*} [DivisionSemiring K] (I : Ideal K)\n\nnamespace Ideal\n\nvariable (K) in\n/-- A bijection between (left) ideals of a division ring and `{0, 1}`, sending `\u22a5` to `0`\nand `\u22a4` to `1`. -/\nnoncomputable def equivFinTwo : Ideal K \u2243 Fin 2 where\n toFun := fun I \u21a6 if I = \u22a5 then 0 else 1\n invFun := ![\u22a5, \u22a4]\n left_inv := fun I \u21a6 by rcases eq_bot_or_top I with rfl | rfl <;> simp\n right_inv := fun i \u21a6 by fin_cases i <;> simp\n```\n\n-- snippet 65\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_iUnion (L110-L112)\nlemma colon_iUnion {\u03b9 : Sort*} (f : \u03b9 \u2192 Set M) : N.colon (\u22c3 i, f i) = \u2a05 i, N.colon (f i) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem_of_commute (L97-L117)\ntheorem add_pow_add_pred_mem_of_pow_mem_of_commute {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hab : Commute a b) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb (by rw [\u2190 Nat.sub_le_iff_le_add]) hab\n\nend Commute\n\nend Ideal\n\nend Semiring\n\nsection CommSemiring\n\nvariable {a b : \u03b1}\n\n-- A separate namespace definition is needed because the variables were historically in a different\n-- order.\nnamespace Ideal\n\nvariable [CommSemiring \u03b1] (I : Ideal \u03b1)\n```\n\n-- snippet 67\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent (L51-L53)\ndef toCotangent : I \u2192\u2097[R] I.Cotangent := Submodule.mkQ _\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 68\n```lean\n-- Mathlib.RingTheory.Ideal.BigOperators.sum_mem (L29-L33)\ntheorem sum_mem (I : Ideal \u03b1) {\u03b9 : Type*} {t : Finset \u03b9} {f : \u03b9 \u2192 \u03b1} :\n (\u2200 c \u2208 t, f c \u2208 I) \u2192 (\u2211 i \u2208 t, f i) \u2208 I :=\nSubmodule.sum_mem I\n\nend Ideal\n```\n\n-- snippet 69\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/\n```\n\n-- snippet 70\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_quotient (L175-L181)\ntheorem annihilator_quotient : Module.annihilator R (M \u29f8 N) = N.colon Set.univ := by\next r\n have htop : (\u22a4 : Submodule R (M \u29f8 N)) = (\u22a4 : Submodule R M).map N.mkQ := by\n simpa [map_top] using (LinearMap.range_eq_top.mpr (mkQ_surjective N)).symm\n rw [\u2190 annihilator_top (R := R) (M := M \u29f8 N), htop,\n annihilator_map_mkQ_eq_colon (N := N) (P := \u22a4), Submodule.top_coe]\n```\n\n-- snippet 71\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_mono (L68-L70)\ntheorem colon_mono (hn : N\u2081 \u2264 N\u2082) (hs : S\u2081 \u2286 S\u2082) : N\u2081.colon S\u2082 \u2264 N\u2082.colon S\u2081 :=\nfun _ hrns \u21a6 mem_colon.mpr fun s\u2081 hs\u2081 \u21a6 hn <| mem_colon.mp hrns s\u2081 <| hs hs\u2081\n```\n\n-- snippet 72\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_ideal_bot_lt_and_lt_top (L276-L281)\ntheorem not_isField_iff_exists_ideal_bot_lt_and_lt_top [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 I : Ideal R, \u22a5 < I \u2227 I < \u22a4 := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot.ne' h_top.ne\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, bot_lt_iff_ne_bot.mpr hI, lt_top_iff_ne_top.mpr hIm.ne_top\u27e9\n```\n\n-- snippet 73\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl\n```\n\n-- snippet 75\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon' (L138-L140)\ntheorem bot_colon' : (\u22a5 : Submodule R M).colon S = (span R S).annihilator := by\naesop (add simp [mem_colon, mem_annihilator_span])\n```\n\n-- snippet 76\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))\n```\n\n-- snippet 77\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_span (L142-L149)\ntheorem colon_span : N.colon (span R S) = N.colon S := by\nrefine (colon_mono le_rfl subset_span).antisymm fun r h \u21a6 mem_colon.mpr fun s hs \u21a6 ?_\n induction hs using Submodule.span_induction with\n | mem => aesop (add simp mem_colon)\n | zero => simp\n | add => aesop\n | smul => simp_all [smul_mem, smul_comm r]\n```\n\n-- snippet 78\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')\n```\n\n-- snippet 79\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq_zero (L66-L67)\ntheorem toCotangent_eq_zero (x : I) : I.toCotangent x = 0 \u2194 (x : R) \u2208 I ^ 2 := I.mem_toCotangent_ker\n```\n\n-- snippet 80\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.prod_mem (L196-L202)\ntheorem prod_mem {\u03b9 : Type*} {f : \u03b9 \u2192 \u03b1} {s : Finset \u03b9}\n (I : Ideal \u03b1) {i : \u03b9} (hi : i \u2208 s) (hfi : f i \u2208 I) :\n \u220f i \u2208 s, f i \u2208 I := by\nclassical\n rw [Finset.prod_eq_prod_diff_singleton_mul hi]\n exact Ideal.mul_mem_left _ _ hfi\n```\n\n-- snippet 81\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isSimpleOrder (L237-L249)\ninstance isSimpleOrder : IsSimpleOrder (Ideal K) :=\n\u27e8eq_bot_or_top\u27e9\n\nend Ideal\n\nend DivisionSemiring\n\n-- TODO: consider moving the lemmas below out of the `Ring` namespace since they are\n-- about `CommSemiring`s.\nnamespace Ring\n\nvariable {R : Type*} [CommSemiring R]\n```\n\n-- snippet 82\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_of_ne_of_ne (L271-L275)\ntheorem not_isField_of_ne_of_ne [Nontrivial R] {I : Ideal R} (h_bot : I \u2260 \u22a5) (h_top : I \u2260 \u22a4) :\n \u00ac IsField R := by\ncontrapose! h_bot\n exact ((isField_iff_maximal_bot.mp h_bot).eq_of_le h_top bot_le).symm\n```\n\n-- snippet 83\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le_of_commute (L83-L96)\ntheorem add_pow_mem_of_pow_mem_of_le_of_commute {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1)\n (hab : Commute a b) :\n (a + b) ^ k \u2208 I := by\nsimp_rw [hab.add_pow, \u2190 Nat.cast_comm]\n apply I.sum_mem\n intro c _\n apply mul_mem_left\n by_cases h : m \u2264 c\n \u00b7 rw [hab.pow_pow]\n exact I.mul_mem_left _ (I.pow_mem_of_pow_mem ha h)\n \u00b7 refine I.mul_mem_left _ (I.pow_mem_of_pow_mem hb ?_)\n lia\n```\n\n-- snippet 84\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.basisSpanSingleton_apply (L39-L44)\ntheorem basisSpanSingleton_apply (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) (i : \u03b9) :\n (basisSpanSingleton b hx i : S) = x * b i := by\nsimp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,\n Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,\n LinearEquiv.restrictScalars_apply, LinearMap.mulLeft_apply]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl\n```\n\n-- snippet 86\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_finsetInf (L97-L100)\nlemma colon_finsetInf {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Submodule R M) :\n (s.inf f).colon S = s.inf (fun i \u21a6 (f i).colon S) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 87\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/\n```\n\n-- snippet 88\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_maximal_bot (L259-L264)\ntheorem isField_iff_maximal_bot [Nontrivial R] : IsField R \u2194 (\u22a5 : Ideal R).IsMaximal := by\nrefine \u27e8fun h \u21a6 let := h.toSemifield; bot_isMaximal, fun hmax \u21a6 ?_\u27e9\n by_contra hf\n obtain \u27e8x, hx0, hxu\u27e9 := exists_not_isUnit_of_not_isField hf\n exact hx0 <| span_singleton_eq_bot.mp (hmax.eq_of_le (span_singleton_ne_top hxu) bot_le).symm\n```\n\n-- snippet 89\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_singleton (L48-L50)\ntheorem mem_colon_singleton {x : M} {r : R} : r \u2208 N.colon {x} \u2194 r \u2022 x \u2208 N := by\nsimp [mem_colon, forall_eq]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}\n```\n\n-- snippet 91\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.inf_colon (L89-L91)\nlemma inf_colon : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S \u2293 N\u2082.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 92\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pow_multiset_sum_mem_span_pow (L128-L154)\ntheorem pow_multiset_sum_mem_span_pow [DecidableEq \u03b1] (s : Multiset \u03b1) (n : \u2115) :\n s.sum ^ (Multiset.card s * n + 1) \u2208\n span ((s.map fun (x : \u03b1) \u21a6 x ^ (n + 1)).toFinset : Set \u03b1) := by\ninduction s using Multiset.induction_on with\n | empty => simp\n | cons a s hs => ?_\n simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,\n Multiset.card_cons, add_pow]\n refine Submodule.sum_mem _ ?_\n intro c _hc\n rw [mem_span_insert]\n by_cases! h : n + 1 \u2264 c\n \u00b7 refine \u27e8a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *\n ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, ?_\u27e9\n rw [mul_comm _ (a ^ (n + 1))]\n simp_rw [\u2190 mul_assoc]\n rw [\u2190 pow_add, add_zero, add_tsub_cancel_of_le h]\n \u00b7 use 0\n simp_rw [zero_mul, zero_add]\n refine \u27e8_, ?_, rfl\u27e9\n replace h : c \u2264 n := Nat.lt_succ_iff.mp h\n have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by\n rw [add_mul, one_mul, add_assoc, add_comm n 1, \u2190 add_assoc, add_tsub_assoc_of_le h]\n rw [this, pow_add]\n simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), \u2190 mul_assoc]\n exact mul_mem_left _ _ hs\n```\n\n-- snippet 94\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem (L123-L127)\ntheorem add_pow_add_pred_mem_of_pow_mem {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_add_pred_mem_of_pow_mem_of_commute ha hb (Commute.all ..)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon (L35-L44)\ndef colon (N : Submodule R M) (S : Set M) : Ideal R where\n carrier := {r : R | (r \u2022 S : Set M) \u2286 N}\nadd_mem' ha hb :=\n (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp))\n zero_mem' := (Set.zero_smul_set_subset S).trans (by simp)\n smul_mem' r := by\n simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff]\n intro x hx y hy\n exact N.smul_mem _ (hx hy)\n```\n\n-- snippet 96\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon (L64-L67)\ntheorem bot_colon : colon (\u22a5 : Submodule R M) (N : Set M) = N.annihilator := by\next x\n simp [mem_colon, mem_annihilator]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.Basis (L55-L61)\ntheorem Basis.mem_ideal_iff {\u03b9 R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]\n {I : Ideal S} (b : Basis \u03b9 R I) {x : S} :\n x \u2208 I \u2194 \u2203 c : \u03b9 \u2192\u2080 R, x = Finsupp.sum c fun i x => x \u2022 (b i : S) :=\n(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff\n\n/-- If `I : Ideal S` has a finite basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 98\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_map_mkQ_eq_colon (L169-L174)\nlemma annihilator_map_mkQ_eq_colon : annihilator (P.map N.mkQ) = N.colon (P : Set M) := by\next\n rw [mem_annihilator, mem_colon]\n exact \u27e8fun H p hp \u21a6 (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),\n fun H _ \u27e8p, hp, hpm\u27e9 \u21a6 hpm \u25b8 ((Quotient.mk_eq_zero N).2 <| H p hp)\u27e9\n```\n\n-- snippet 99\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_inf_eq_left_of_subset (L81-L83)\nlemma colon_inf_eq_left_of_subset (h : S \u2286 (N\u2082 : Set M)) : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 100\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le (L118-L122)\ntheorem add_pow_mem_of_pow_mem_of_le {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1) :\n (a + b) ^ k \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb hk (Commute.all ..)\n```\n\n-- snippet 101\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_empty (L114-L116)\nlemma colon_empty : N.colon (\u2205 : Set M) = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 102\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_univ (L57-L60)\ntheorem colon_univ {I : Ideal R} [I.IsTwoSided] : I.colon Set.univ = I := by\nsimp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]\n exact fun x \u21a6 \u27e8fun h \u21a6 mul_one x \u25b8 h 1 trivial, fun h _ _ \u21a6 I.mul_mem_right _ h\u27e9\n```\n\n-- snippet 103\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_isSimpleOrder_ideal (L292-L302)\ntheorem isField_iff_isSimpleOrder_ideal : IsField R \u2194 IsSimpleOrder (Ideal R) := by\ncases subsingleton_or_nontrivial R\n \u00b7 exact\n \u27e8fun h => (not_isField_of_subsingleton _ h).elim, fun h =>\n (false_of_nontrivial_of_subsingleton <| Ideal R).elim\u27e9\n rw [\u2190 not_iff_not, Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top]\n contrapose! +distrib\n simp_rw [not_lt_top_iff, not_bot_lt_iff]\n exact \u27e8fun h => \u27e8h\u27e9, fun h => h.2\u27e9\n\n/-- When a ring is not a field, the maximal ideals are nontrivial. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.map_toCotangent_ker (L54-L57)\ntheorem map_toCotangent_ker : (LinearMap.ker I.toCotangent).map I.subtype = I ^ 2 := by\nrw [Ideal.toCotangent, Submodule.ker_mkQ, pow_two, Submodule.map_smul'' I \u22a4 (Submodule.subtype I),\n smul_eq_mul, Submodule.map_subtype_top]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in\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.RingTheory.Ideal.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem prod_eq_iInf_of_pairwise_isCoprime {s : Finset \u03b9} {J : \u03b9 \u2192 Ideal R}\n (hp : (s : Set \u03b9).Pairwise (IsCoprime on J)) :\n \u220f i \u2208 s, J i = \u2a05 i \u2208 s, J i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.coe_span_smul (L33-L50)\nlemma coe_span_smul {R' M' : Type*} [CommSemiring R'] [AddCommMonoid M'] [Module R' M']\n (s : Set R') (N : Submodule R' M') :\n (Ideal.span s : Set R') \u2022 N = s \u2022 N :=\nset_smul_eq_of_le _ _ _\n (by rintro r n hr hn\n induction hr using Submodule.span_induction with\n | mem _ h => exact mem_set_smul_of_mem_mem h hn\n | zero => rw [zero_smul]; exact Submodule.zero_mem _\n | add _ _ _ _ ihr ihs => rw [add_smul]; exact Submodule.add_mem _ ihr ihs\n | smul _ _ hr =>\n rw [mem_span_set] at hr\n obtain \u27e8c, hc, rfl\u27e9 := hr\n rw [Finsupp.sum, Finset.smul_sum, Finset.sum_smul]\n refine Submodule.sum_mem _ fun i hi => ?_\n rw [\u2190 mul_smul, smul_eq_mul, mul_comm, mul_smul]\n exact mem_set_smul_of_mem_mem (hc hi) <| Submodule.smul_mem _ _ hn) <|\n set_smul_mono_left _ Submodule.subset_span\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.span_singleton_toAddSubgroup_eq_zmultiples (L51-L55)\nlemma span_singleton_toAddSubgroup_eq_zmultiples (a : \u2124) :\n (span \u2124 {a}).toAddSubgroup = AddSubgroup.zmultiples a := by\next i\n simp [Ideal.mem_span_singleton', AddSubgroup.mem_zmultiples_iff]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.smul_le_right (L73-L75)\ntheorem smul_le_right : I \u2022 N \u2264 N :=\nsmul_le.2 fun r _ _ \u21a6 N.smul_mem r\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.map_le_smul_top (L76-L83)\ntheorem map_le_smul_top (I : Ideal R) (f : R \u2192\u2097[R] M) :\n Submodule.map f I \u2264 I \u2022 (\u22a4 : Submodule R M) := by\nrintro _ \u27e8y, hy, rfl\u27e9\n rw [\u2190 mul_one y, \u2190 smul_eq_mul, f.map_smul]\n exact smul_mem_smul hy mem_top\n\nvariable (I J N)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.top_smul (L85-L90)\ntheorem top_smul : (\u22a4 : Ideal R) \u2022 N = N :=\nle_antisymm smul_le_right fun r hri => one_smul R r \u25b8 smul_mem_smul mem_top hri\n\nprotected theorem mul_smul : (I * J) \u2022 N = I \u2022 J \u2022 N :=\n Submodule.smul_assoc _ _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_of_span_top_of_smul_mem (L91-L100)\ntheorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = \u22a4) (x : M)\n (H : \u2200 r : s, (r : R) \u2022 x \u2208 M') : x \u2208 M' := by\nsuffices LinearMap.range (LinearMap.toSpanSingleton R M x) \u2264 M' by\n rw [\u2190 LinearMap.toSpanSingleton_apply_one R M x]\n exact this (LinearMap.mem_range_self _ 1)\n rw [LinearMap.range_eq_map, \u2190 hs, map_le_iff_le_comap, Ideal.span, span_le]\n exact fun r hr \u21a6 H \u27e8r, hr\u27e9\n\nvariable {M' : Type w} [AddCommMonoid M'] [Module R M']\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.map_smul'' (L102-L111)\ntheorem map_smul'' (f : M \u2192\u2097[R] M') : (I \u2022 N).map f = I \u2022 N.map f :=\nle_antisymm\n (map_le_iff_le_comap.2 <|\n smul_le.2 fun r hr n hn =>\n show f (r \u2022 n) \u2208 I \u2022 N.map f from\n (f.map_smul r n).symm \u25b8 smul_mem_smul hr (mem_map_of_mem hn)) <|\n smul_le.2 fun r hr _ hn =>\n let \u27e8p, hp, hfp\u27e9 := mem_map.1 hn\n hfp \u25b8 f.map_smul r p \u25b8 mem_map_of_mem (smul_mem_smul hr hp)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_smul_top_iff (L112-L117)\ntheorem mem_smul_top_iff (N : Submodule R M) (x : N) :\n x \u2208 I \u2022 (\u22a4 : Submodule R N) \u2194 (x : M) \u2208 I \u2022 N := by\nhave : Submodule.map N.subtype (I \u2022 \u22a4) = I \u2022 N := by\n rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]\n simp [\u2190 this, -map_smul'']\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.smul_comap_le_comap_smul (L119-L125)\ntheorem smul_comap_le_comap_smul (f : M \u2192\u2097[R] M') (S : Submodule R M') (I : Ideal R) :\n I \u2022 S.comap f \u2264 (I \u2022 S).comap f := by\nrefine Submodule.smul_le.mpr fun r hr x hx => ?_\n rw [Submodule.mem_comap] at hx \u22a2\n rw [f.map_smul]\n exact Submodule.smul_mem_smul hr hx\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.comap_smul'' (L126-L134)\nlemma comap_smul'' {f : M \u2192\u2097[R] M'} (hf : Function.Injective f) {p : Submodule R M'}\n (hp : p \u2264 LinearMap.range f) {I : Ideal R} :\n Submodule.comap f (I \u2022 p) = I \u2022 Submodule.comap f p := by\nrefine le_antisymm ?_ (by simp)\n conv_lhs => rw [\u2190 Submodule.map_comap_eq_self hp, \u2190 Submodule.map_smul'']\n rw [Submodule.comap_map_eq_of_injective hf]\n\nvariable {I}\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_smul_span_singleton (L135-L147)\ntheorem mem_smul_span_singleton [I.IsTwoSided] {m : M} {x : M} :\n x \u2208 I \u2022 span R ({m} : Set M) \u2194 \u2203 y \u2208 I, y \u2022 m = x :=\n\u27e8fun hx =>\n smul_induction_on hx\n (fun r hri _ hnm =>\n let \u27e8s, hs\u27e9 := mem_span_singleton.1 hnm\n \u27e8r * s, I.mul_mem_right _ hri, hs \u25b8 mul_smul r s m\u27e9)\n fun m1 m2 \u27e8y1, hyi1, hy1\u27e9 \u27e8y2, hyi2, hy2\u27e9 =>\n \u27e8y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]\u27e9,\n fun \u27e8_, hyi, hy\u27e9 => hy \u25b8 smul_mem_smul hyi (subset_span <| Set.mem_singleton m)\u27e9\n\nvariable (S : Set R) (T : Set M)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.span_smul_span (L148-L165)\ntheorem span_smul_span [(Ideal.span S).IsTwoSided] :\n Ideal.span S \u2022 span R T = span R (S \u2022 T) :=\nle_antisymm (smul_le.mpr fun r hr m hm \u21a6 by\n revert r\n refine span_induction (fun m hm r hr \u21a6 span_induction\n (fun r hr \u21a6 subset_span \u27e8r, hr, m, hm, rfl\u27e9)\n (by rw [zero_smul]; exact zero_mem _)\n (fun _ _ _ _ h\u2081 h\u2082 \u21a6 by rw [add_smul]; exact add_mem h\u2081 h\u2082)\n (fun _ _ _ h \u21a6 by rw [smul_assoc]; exact smul_mem _ _ h) hr)\n (fun _ _ \u21a6 by rw [smul_zero]; exact zero_mem _)\n (fun _ _ _ _ h\u2081 h\u2082 r hr \u21a6 by rw [smul_add]; exact add_mem (h\u2081 r hr) (h\u2082 r hr))\n (fun r' m hm mem r hr \u21a6 by rw [\u2190 mul_smul]; exact mem _ (Ideal.mul_mem_right _ _ hr)) hm) <|\n span_le.mpr fun m \u21a6 by\n rintro \u27e8s, hs, t, ht, rfl\u27e9\n exact smul_mem_smul (subset_span hs) (subset_span ht)\n\nvariable [I.IsTwoSided]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_smul_span (L166-L174)\ntheorem mem_smul_span {s : Set M} {x : M} :\n x \u2208 I \u2022 Submodule.span R s \u2194 x \u2208 Submodule.span R ((I : Set R) \u2022 s) := by\nrw [\u2190 I.span_eq] at *\n rw [Submodule.span_smul_span, I.span_eq]\n\nvariable (I)\n\n/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,\nthen we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_ideal_smul_span_iff_exists_sum (L175-L198)\ntheorem mem_ideal_smul_span_iff_exists_sum {\u03b9 : Type*} (f : \u03b9 \u2192 M) (x : M) :\n x \u2208 I \u2022 span R (Set.range f) \u2194\n \u2203 (a : \u03b9 \u2192\u2080 R) (_ : \u2200 i, a i \u2208 I), (a.sum fun i c => c \u2022 f i) = x := by\nconstructor; swap\n \u00b7 rintro \u27e8a, ha, rfl\u27e9\n exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _\n refine fun hx => span_induction ?_ ?_ ?_ ?_ (mem_smul_span.mp hx)\n \u00b7 rintro x \u27e8y, hy, x, \u27e8i, rfl\u27e9, rfl\u27e9\n refine \u27e8Finsupp.single i y, fun j => ?_, ?_\u27e9\n \u00b7 letI := Classical.decEq \u03b9\n rw [Finsupp.single_apply]\n split_ifs\n \u00b7 assumption\n \u00b7 exact I.zero_mem\n refine @Finsupp.sum_single_index \u03b9 R M _ _ i _ (fun i y => y \u2022 f i) ?_\n simp\n \u00b7 exact \u27e80, fun _ => I.zero_mem, Finsupp.sum_zero_index\u27e9\n \u00b7 rintro x y - - \u27e8ax, hax, rfl\u27e9 \u27e8ay, hay, rfl\u27e9\n refine \u27e8ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' ?_ ?_\u27e9 <;>\n intros <;> simp only [zero_smul, add_smul]\n \u00b7 rintro c x - \u27e8a, ha, rfl\u27e9\n refine \u27e8c \u2022 a, fun i => I.mul_mem_left c (ha i), ?_\u27e9\n rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_ideal_smul_span_iff_exists_sum' (L199-L213)\ntheorem mem_ideal_smul_span_iff_exists_sum' {\u03b9 : Type*} (s : Set \u03b9) (f : \u03b9 \u2192 M) (x : M) :\n x \u2208 I \u2022 span R (f '' s) \u2194\n \u2203 (a : s \u2192\u2080 R) (_ : \u2200 i, a i \u2208 I), (a.sum fun i c => c \u2022 f i) = x := by\nrw [\u2190 Submodule.mem_ideal_smul_span_iff_exists_sum, \u2190 Set.image_eq_range]\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']\n\nopen Pointwise\n\nvariable {I : Ideal R} {N : Submodule R M}\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.smul_eq_map\u2082 (L214-L219)\ntheorem smul_eq_map\u2082 : I \u2022 N = Submodule.map\u2082 (LinearMap.lsmul R M) I N :=\nle_antisymm (smul_le.mpr fun _m hm _n \u21a6 Submodule.apply_mem_map\u2082 _ hm)\n (map\u2082_le.mpr fun _m hm _n \u21a6 smul_mem_smul hm)\n\nvariable (S : Set R) (T : Set M)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.ideal_span_singleton_smul (L220-L226)\ntheorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :\n (Ideal.span {r} : Ideal R) \u2022 N = r \u2022 N := by\nconv_lhs => rw [\u2190 span_eq N, span_smul_span]\n simpa using span_eq (r \u2022 N)\n\n/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a\nsubmodule `M'` of `x`, we only need to show that `r ^ n \u2022 x \u2208 M'` for some `n` for each `r : s`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mem_of_span_eq_top_of_smul_pow_mem (L227-L234)\ntheorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = \u22a4)\n (x : M) (H : \u2200 r : s, \u2203 n : \u2115, ((r : R) ^ n : R) \u2022 x \u2208 M') : x \u2208 M' := by\nchoose f hf using H\n apply M'.mem_of_span_top_of_smul_mem _ (Ideal.span_range_pow_eq_top s hs f)\n rintro \u27e8_, r, hr, rfl\u27e9\n exact hf r\n\nopen Pointwise in\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.map_pointwise_smul (L236-L249)\ntheorem map_pointwise_smul (r : R) (N : Submodule R M) (f : M \u2192\u2097[R] M') :\n (r \u2022 N).map f = r \u2022 N.map f := by\nsimp_rw [\u2190 ideal_span_singleton_smul, map_smul'']\n\nend CommSemiring\n\nend Submodule\n\nnamespace Ideal\n\nsection Add\n\nvariable {R : Type u} [Semiring R]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.add_eq_sup (L251-L253)\ntheorem add_eq_sup {I J : Ideal R} : I + J = I \u2294 J :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.zero_eq_bot (L255-L257)\ntheorem zero_eq_bot : (0 : Ideal R) = \u22a5 :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.sum_eq_sup (L259-L267)\ntheorem sum_eq_sup {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Ideal R) : s.sum f = s.sup f :=\nrfl\n\nend Add\n\nsection Semiring\n\nvariable {R : Type u} [Semiring R] {I J K L : Ideal R}\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.one_eq_top (L269-L271)\ntheorem one_eq_top : (1 : Ideal R) = \u22a4 := by\nrw [Submodule.one_eq_span, \u2190 Ideal.span, Ideal.span_singleton_one]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.add_eq_one_iff (L272-L274)\ntheorem add_eq_one_iff : I + J = 1 \u2194 \u2203 i \u2208 I, \u2203 j \u2208 J, i + j = 1 := by\nrw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Ideal.Operations.mul_mem_mul (L275-L277)\ntheorem mul_mem_mul {r s} (hr : r \u2208 I) (hs : s \u2208 J) : r * s \u2208 I * J :=\nSubmodule.smul_mem_smul hr hs\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.Cotangent (L41-L49)\ndef Cotangent : Type _ := I \u29f8 (I \u2022 \u22a4 : Submodule R I)\nderiving Inhabited, AddCommGroup, Module (R \u29f8 I)\n\nderiving instance Module S, IsScalarTower S S' for Cotangent I\n\nvariable [IsNoetherian R I] in\nderiving instance IsNoetherian R for Cotangent I\n\n/-- The quotient map from `I` to `I \u29f8 I ^ 2`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Ideal (L170-L179)\ntheorem Ideal.IsMaximal.mem_associatedPrimes_of_isFractionRing [IsFractionRing A A]\n (I : Ideal A) [hI : I.IsMaximal] : I \u2208 associatedPrimes A A :=\nhave fin := associatedPrimes.finite A A\n have \u27e8P, hP\u27e9 := (I.subset_union_prime_finite fin (f := id) 0 0 fun _ h _ _ \u21a6 h.isPrime).1 <| by\n simp_rw [id, biUnion_associatedPrimes_eq_compl_nonZeroDivisors]\n exact fun x hx h \u21a6 hI.ne_top <| I.eq_top_of_isUnit_mem hx\n (IsFractionRing.self_iff_nonZeroDivisors_le_isUnit.mp \u2039_\u203a h)\n hI.eq_of_le hP.1.isPrime.ne_top hP.2 \u25b8 hP.1\n\n/-- A commutative Noetherian total ring of fractions is semilocal. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.ne_bot_of_isMaximal_of_not_isField (L303-L314)\ntheorem ne_bot_of_isMaximal_of_not_isField [Nontrivial R] {M : Ideal R} (max : M.IsMaximal)\n (not_field : \u00acIsField R) : M \u2260 \u22a5 := by\nrintro rfl\n obtain \u27e8I, hIbot, hItop\u27e9 := not_isField_iff_exists_ideal_bot_lt_and_lt_top.mp not_field\n exact hIbot.ne (max.eq_of_le hItop.ne bot_le)\n\nend Ring\n\nnamespace Ideal\n\nvariable {R : Type*} [CommSemiring R] [Nontrivial R]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.constr_basisSpanSingleton (L46-L54)\ntheorem constr_basisSpanSingleton {N : Type*} [Semiring N] [Module N S] [SMulCommClass R N S]\n (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) :\n (b.constr N).toFun (((\u2191) : _ \u2192 S) \u2218 (basisSpanSingleton b hx)) = Algebra.lmul R S x :=\nb.ext fun i => by simp\n\nend Ideal\n\n/-- If `I : Ideal S` has a basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_prime (L282-L291)\ntheorem not_isField_iff_exists_prime [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsPrime := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot h_top.ne_top\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, hI, hIm.isPrime\u27e9\n\n/-- Also see `Ideal.isSimpleOrder` for the forward direction as an instance when `R` is a\ndivision (semi)ring.\n\nThis result actually holds for all division semirings, but we lack the predicate to state it. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_union (L106-L108)\nlemma colon_union : N.colon (S\u2081 \u222a S\u2082) = N.colon S\u2081 \u2293 N.colon S\u2082 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_span_singleton (L154-L156)\ntheorem mem_colon_span_singleton {x : M} {r : R} : r \u2208 N.colon (span R {x}) \u2194 r \u2022 x \u2208 N := by\nsimp\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.sum_pow_mem_span_pow (L155-L160)\ntheorem sum_pow_mem_span_pow {\u03b9} (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) (n : \u2115) :\n (\u2211 i \u2208 s, f i) ^ (s.card * n + 1) \u2208 span ((fun i => f i ^ (n + 1)) '' s) := by\nclassical\n simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,\n Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon (L93-L95)\nlemma iInf_colon {\u03b9 : Sort*} (f : \u03b9 \u2192 Submodule R M) : (\u2a05 i, f i).colon S = \u2a05 i, (f i).colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.top_colon (L102-L104)\nlemma top_colon : (\u22a4 : Submodule R M).colon S = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 42\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_iff_le (L134-L137)\ntheorem mem_colon_iff_le {r} : r \u2208 N.colon N' \u2194 r \u2022 N' \u2264 N := by\naesop (add simp SetLike.coe_subset_coe)\n\n/-- A variant for arbitrary sets in commutative semirings -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass\n```\n\n-- snippet 44\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_singleton_zero (L117-L119)\nlemma colon_singleton_zero : N.colon {0} = \u22a4 := by\nsimp\n```\n\n-- snippet 45\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.bot_lt_of_maximal (L315-L318)\ntheorem bot_lt_of_maximal (M : Ideal R) [hm : M.IsMaximal] (non_field : \u00acIsField R) : \u22a5 < M :=\n(Ring.ne_bot_of_isMaximal_of_not_isField hm non_field).bot_lt\n\nend Ideal\n```\n\n-- snippet 46\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_not_isUnit_of_not_isField (L250-L258)\ntheorem exists_not_isUnit_of_not_isField [Nontrivial R] (hf : \u00acIsField R) :\n \u2203 (x : R) (_hx : x \u2260 (0 : R)), \u00acIsUnit x := by\nhave : \u00ac_ := fun h => hf \u27e8exists_pair_ne R, mul_comm, h\u27e9\n simp_rw [isUnit_iff_exists_inv]\n push Not at this \u22a2\n obtain \u27e8x, hx, not_unit\u27e9 := this\n exact \u27e8x, hx, not_unit\u27e9\n\nopen Ideal in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff\n```\n\n-- snippet 48\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_range_pow_eq_top (L186-L195)\ntheorem span_range_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : s \u2192 \u2115) :\n span (Set.range fun x \u21a6 x.1 ^ n x) = \u22a4 := by\nhave \u27e8t, hts, mem\u27e9 := Submodule.mem_span_finite_of_mem_span ((eq_top_iff_one _).mp hs)\n refine top_unique ((span_pow_eq_top _ ((eq_top_iff_one _).mpr mem) <|\n t.attach.sup fun x \u21a6 n \u27e8x, hts x.2\u27e9).ge.trans <| span_le.mpr ?_)\n rintro _ \u27e8x, hxt, rfl\u27e9\n rw [\u2190 Nat.sub_add_cancel (Finset.le_sup <| t.mem_attach \u27e8x, hxt\u27e9)]\n simp_rw [pow_add]\n exact mul_mem_left _ _ (subset_span \u27e8_, rfl\u27e9)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.mem_toCotangent_ker (L58-L61)\ntheorem mem_toCotangent_ker {x : I} : x \u2208 LinearMap.ker I.toCotangent \u2194 (x : R) \u2208 I ^ 2 := by\nrw [\u2190 I.map_toCotangent_ker]\n simp\n```\n\n-- snippet 52\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_maximal_of_not_isField (L265-L270)\ntheorem exists_maximal_of_not_isField [Nontrivial R] (h : \u00ac IsField R) :\n \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsMaximal := by\ncontrapose! h\n simp only [\u2190 bot_lt_iff_ne_bot] at h\n refine isField_iff_maximal_bot.mpr \u27e8\u27e8bot_ne_top, Ideal.maximal_of_no_maximal h\u27e9\u27e9\n```\n\n-- snippet 54\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon (L45-L46)\ntheorem mem_colon {r} : r \u2208 N.colon S \u2194 \u2200 s \u2208 S, r \u2022 s \u2208 N := Set.smul_set_subset_iff\n```\n\n-- snippet 55\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq (L62-L65)\ntheorem toCotangent_eq {x y : I} : I.toCotangent x = I.toCotangent y \u2194 (x - y : R) \u2208 I ^ 2 := by\nrw [\u2190 sub_eq_zero]\n exact I.mem_toCotangent_ker\n```\n\n-- snippet 56\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in\n```\n\n-- snippet 57\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_eq_top_iff_subset (L85-L87)\nlemma colon_eq_top_iff_subset (S : Set M) : N.colon S = \u22a4 \u2194 S \u2286 N := by\naesop (add simp [mem_colon, Ideal.eq_top_iff_one])\n```\n\n-- snippet 58\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_bot (L120-L129)\nlemma colon_bot : N.colon ((\u22a5 : Submodule R M) : Set M) = \u22a4 := by\nsimp\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M]\nvariable {N N' : Submodule R M} {S : Set M}\n```\n\n-- snippet 59\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon_iUnion (L74-L77)\ntheorem iInf_colon_iUnion (\u03b9\u2081 : Sort*) (f : \u03b9\u2081 \u2192 Submodule R M) (\u03b9\u2082 : Sort*) (g : \u03b9\u2082 \u2192 Set M) :\n (\u2a05 i, f i).colon (\u22c3 j, g j) = \u2a05 (i) (j), (f i).colon (g j) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 60\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_pow_eq_top (L161-L185)\ntheorem span_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : \u2115) :\n span ((fun (x : \u03b1) => x ^ n) '' s) = \u22a4 := by\nrw [eq_top_iff_one]\n rcases n with - | n\n \u00b7 obtain rfl | \u27e8x, hx\u27e9 := eq_empty_or_nonempty s\n \u00b7 rw [Set.image_empty, hs]\n trivial\n \u00b7 exact subset_span \u27e8_, hx, pow_zero _\u27e9\n rw [eq_top_iff_one, span, Finsupp.mem_span_iff_linearCombination] at hs\n rcases hs with \u27e8f, hf\u27e9\n simp only [Finsupp.linearCombination, Finsupp.coe_lsum, Finsupp.sum, LinearMap.coe_smulRight,\n LinearMap.id_coe, id_eq, smul_eq_mul] at hf\n have := sum_pow_mem_span_pow f.support (fun a => f a * a) n\n rw [hf, one_pow] at this\n refine span_le.mpr ?_ this\n rintro _ hx\n simp_rw [Set.mem_image] at hx\n rcases hx with \u27e8x, _, rfl\u27e9\n have : span ({(x : \u03b1) ^ (n + 1)} : Set \u03b1) \u2264 span ((fun x : \u03b1 => x ^ (n + 1)) '' s) := by\n rw [span_le, Set.singleton_subset_iff]\n exact subset_span \u27e8x, x.prop, rfl\u27e9\n refine this ?_\n rw [mul_pow, mem_span_singleton]\n exact \u27e8f x ^ (n + 1), mul_comm _ _\u27e9\n```\n\n-- snippet 61\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon' (L131-L133)\ntheorem mem_colon' {r} : r \u2208 N.colon S \u2194 S \u2264 comap (r \u2022 (LinearMap.id : M \u2192\u2097[R] M)) N :=\nmem_colon\n```\n\n-- snippet 62\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes\n```\n\n-- snippet 63\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in\n```\n\n-- snippet 64\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_single_eq_top (L203-L232)\nlemma span_single_eq_top {\u03b9 : Type*} [DecidableEq \u03b9] [Finite \u03b9] (R : \u03b9 \u2192 Type*)\n [\u2200 i, Semiring (R i)] : Ideal.span (Set.range fun i \u21a6 (Pi.single i 1 : \u03a0 i, R i)) = \u22a4 := by\nrw [_root_.eq_top_iff]\n rintro x -\n induction x using Pi.single_induction with\n | zero => simp\n | add f g hf hg => exact Ideal.add_mem _ hf hg\n | single i r =>\n rw [show Pi.single i r = Pi.single i r * Pi.single i 1 by simp [\u2190 Pi.single_mul_left]]\n exact Ideal.mul_mem_left _ _ (Ideal.subset_span \u27e8i, rfl\u27e9)\n\nend Ideal\n\nend CommSemiring\n\nsection DivisionSemiring\n\nvariable {K : Type*} [DivisionSemiring K] (I : Ideal K)\n\nnamespace Ideal\n\nvariable (K) in\n/-- A bijection between (left) ideals of a division ring and `{0, 1}`, sending `\u22a5` to `0`\nand `\u22a4` to `1`. -/\nnoncomputable def equivFinTwo : Ideal K \u2243 Fin 2 where\n toFun := fun I \u21a6 if I = \u22a5 then 0 else 1\n invFun := ![\u22a5, \u22a4]\n left_inv := fun I \u21a6 by rcases eq_bot_or_top I with rfl | rfl <;> simp\n right_inv := fun i \u21a6 by fin_cases i <;> simp\n```\n\n-- snippet 65\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_iUnion (L110-L112)\nlemma colon_iUnion {\u03b9 : Sort*} (f : \u03b9 \u2192 Set M) : N.colon (\u22c3 i, f i) = \u2a05 i, N.colon (f i) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem_of_commute (L97-L117)\ntheorem add_pow_add_pred_mem_of_pow_mem_of_commute {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hab : Commute a b) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb (by rw [\u2190 Nat.sub_le_iff_le_add]) hab\n\nend Commute\n\nend Ideal\n\nend Semiring\n\nsection CommSemiring\n\nvariable {a b : \u03b1}\n\n-- A separate namespace definition is needed because the variables were historically in a different\n-- order.\nnamespace Ideal\n\nvariable [CommSemiring \u03b1] (I : Ideal \u03b1)\n```\n\n-- snippet 67\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent (L51-L53)\ndef toCotangent : I \u2192\u2097[R] I.Cotangent := Submodule.mkQ _\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 68\n```lean\n-- Mathlib.RingTheory.Ideal.BigOperators.sum_mem (L29-L33)\ntheorem sum_mem (I : Ideal \u03b1) {\u03b9 : Type*} {t : Finset \u03b9} {f : \u03b9 \u2192 \u03b1} :\n (\u2200 c \u2208 t, f c \u2208 I) \u2192 (\u2211 i \u2208 t, f i) \u2208 I :=\nSubmodule.sum_mem I\n\nend Ideal\n```\n\n-- snippet 69\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/\n```\n\n-- snippet 70\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_quotient (L175-L181)\ntheorem annihilator_quotient : Module.annihilator R (M \u29f8 N) = N.colon Set.univ := by\next r\n have htop : (\u22a4 : Submodule R (M \u29f8 N)) = (\u22a4 : Submodule R M).map N.mkQ := by\n simpa [map_top] using (LinearMap.range_eq_top.mpr (mkQ_surjective N)).symm\n rw [\u2190 annihilator_top (R := R) (M := M \u29f8 N), htop,\n annihilator_map_mkQ_eq_colon (N := N) (P := \u22a4), Submodule.top_coe]\n```\n\n-- snippet 71\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_mono (L68-L70)\ntheorem colon_mono (hn : N\u2081 \u2264 N\u2082) (hs : S\u2081 \u2286 S\u2082) : N\u2081.colon S\u2082 \u2264 N\u2082.colon S\u2081 :=\nfun _ hrns \u21a6 mem_colon.mpr fun s\u2081 hs\u2081 \u21a6 hn <| mem_colon.mp hrns s\u2081 <| hs hs\u2081\n```\n\n-- snippet 72\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_ideal_bot_lt_and_lt_top (L276-L281)\ntheorem not_isField_iff_exists_ideal_bot_lt_and_lt_top [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 I : Ideal R, \u22a5 < I \u2227 I < \u22a4 := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot.ne' h_top.ne\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, bot_lt_iff_ne_bot.mpr hI, lt_top_iff_ne_top.mpr hIm.ne_top\u27e9\n```\n\n-- snippet 73\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl\n```\n\n-- snippet 75\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon' (L138-L140)\ntheorem bot_colon' : (\u22a5 : Submodule R M).colon S = (span R S).annihilator := by\naesop (add simp [mem_colon, mem_annihilator_span])\n```\n\n-- snippet 76\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))\n```\n\n-- snippet 77\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_span (L142-L149)\ntheorem colon_span : N.colon (span R S) = N.colon S := by\nrefine (colon_mono le_rfl subset_span).antisymm fun r h \u21a6 mem_colon.mpr fun s hs \u21a6 ?_\n induction hs using Submodule.span_induction with\n | mem => aesop (add simp mem_colon)\n | zero => simp\n | add => aesop\n | smul => simp_all [smul_mem, smul_comm r]\n```\n\n-- snippet 78\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')\n```\n\n-- snippet 79\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq_zero (L66-L67)\ntheorem toCotangent_eq_zero (x : I) : I.toCotangent x = 0 \u2194 (x : R) \u2208 I ^ 2 := I.mem_toCotangent_ker\n```\n\n-- snippet 80\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.prod_mem (L196-L202)\ntheorem prod_mem {\u03b9 : Type*} {f : \u03b9 \u2192 \u03b1} {s : Finset \u03b9}\n (I : Ideal \u03b1) {i : \u03b9} (hi : i \u2208 s) (hfi : f i \u2208 I) :\n \u220f i \u2208 s, f i \u2208 I := by\nclassical\n rw [Finset.prod_eq_prod_diff_singleton_mul hi]\n exact Ideal.mul_mem_left _ _ hfi\n```\n\n-- snippet 81\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isSimpleOrder (L237-L249)\ninstance isSimpleOrder : IsSimpleOrder (Ideal K) :=\n\u27e8eq_bot_or_top\u27e9\n\nend Ideal\n\nend DivisionSemiring\n\n-- TODO: consider moving the lemmas below out of the `Ring` namespace since they are\n-- about `CommSemiring`s.\nnamespace Ring\n\nvariable {R : Type*} [CommSemiring R]\n```\n\n-- snippet 82\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_of_ne_of_ne (L271-L275)\ntheorem not_isField_of_ne_of_ne [Nontrivial R] {I : Ideal R} (h_bot : I \u2260 \u22a5) (h_top : I \u2260 \u22a4) :\n \u00ac IsField R := by\ncontrapose! h_bot\n exact ((isField_iff_maximal_bot.mp h_bot).eq_of_le h_top bot_le).symm\n```\n\n-- snippet 83\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le_of_commute (L83-L96)\ntheorem add_pow_mem_of_pow_mem_of_le_of_commute {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1)\n (hab : Commute a b) :\n (a + b) ^ k \u2208 I := by\nsimp_rw [hab.add_pow, \u2190 Nat.cast_comm]\n apply I.sum_mem\n intro c _\n apply mul_mem_left\n by_cases h : m \u2264 c\n \u00b7 rw [hab.pow_pow]\n exact I.mul_mem_left _ (I.pow_mem_of_pow_mem ha h)\n \u00b7 refine I.mul_mem_left _ (I.pow_mem_of_pow_mem hb ?_)\n lia\n```\n\n-- snippet 84\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.basisSpanSingleton_apply (L39-L44)\ntheorem basisSpanSingleton_apply (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) (i : \u03b9) :\n (basisSpanSingleton b hx i : S) = x * b i := by\nsimp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,\n Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,\n LinearEquiv.restrictScalars_apply, LinearMap.mulLeft_apply]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl\n```\n\n-- snippet 86\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_finsetInf (L97-L100)\nlemma colon_finsetInf {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Submodule R M) :\n (s.inf f).colon S = s.inf (fun i \u21a6 (f i).colon S) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 87\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/\n```\n\n-- snippet 88\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_maximal_bot (L259-L264)\ntheorem isField_iff_maximal_bot [Nontrivial R] : IsField R \u2194 (\u22a5 : Ideal R).IsMaximal := by\nrefine \u27e8fun h \u21a6 let := h.toSemifield; bot_isMaximal, fun hmax \u21a6 ?_\u27e9\n by_contra hf\n obtain \u27e8x, hx0, hxu\u27e9 := exists_not_isUnit_of_not_isField hf\n exact hx0 <| span_singleton_eq_bot.mp (hmax.eq_of_le (span_singleton_ne_top hxu) bot_le).symm\n```\n\n-- snippet 89\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_singleton (L48-L50)\ntheorem mem_colon_singleton {x : M} {r : R} : r \u2208 N.colon {x} \u2194 r \u2022 x \u2208 N := by\nsimp [mem_colon, forall_eq]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}\n```\n\n-- snippet 91\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.inf_colon (L89-L91)\nlemma inf_colon : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S \u2293 N\u2082.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 92\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pow_multiset_sum_mem_span_pow (L128-L154)\ntheorem pow_multiset_sum_mem_span_pow [DecidableEq \u03b1] (s : Multiset \u03b1) (n : \u2115) :\n s.sum ^ (Multiset.card s * n + 1) \u2208\n span ((s.map fun (x : \u03b1) \u21a6 x ^ (n + 1)).toFinset : Set \u03b1) := by\ninduction s using Multiset.induction_on with\n | empty => simp\n | cons a s hs => ?_\n simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,\n Multiset.card_cons, add_pow]\n refine Submodule.sum_mem _ ?_\n intro c _hc\n rw [mem_span_insert]\n by_cases! h : n + 1 \u2264 c\n \u00b7 refine \u27e8a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *\n ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, ?_\u27e9\n rw [mul_comm _ (a ^ (n + 1))]\n simp_rw [\u2190 mul_assoc]\n rw [\u2190 pow_add, add_zero, add_tsub_cancel_of_le h]\n \u00b7 use 0\n simp_rw [zero_mul, zero_add]\n refine \u27e8_, ?_, rfl\u27e9\n replace h : c \u2264 n := Nat.lt_succ_iff.mp h\n have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by\n rw [add_mul, one_mul, add_assoc, add_comm n 1, \u2190 add_assoc, add_tsub_assoc_of_le h]\n rw [this, pow_add]\n simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), \u2190 mul_assoc]\n exact mul_mem_left _ _ hs\n```\n\n-- snippet 94\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem (L123-L127)\ntheorem add_pow_add_pred_mem_of_pow_mem {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_add_pred_mem_of_pow_mem_of_commute ha hb (Commute.all ..)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon (L35-L44)\ndef colon (N : Submodule R M) (S : Set M) : Ideal R where\n carrier := {r : R | (r \u2022 S : Set M) \u2286 N}\nadd_mem' ha hb :=\n (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp))\n zero_mem' := (Set.zero_smul_set_subset S).trans (by simp)\n smul_mem' r := by\n simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff]\n intro x hx y hy\n exact N.smul_mem _ (hx hy)\n```\n\n-- snippet 96\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon (L64-L67)\ntheorem bot_colon : colon (\u22a5 : Submodule R M) (N : Set M) = N.annihilator := by\next x\n simp [mem_colon, mem_annihilator]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.Basis (L55-L61)\ntheorem Basis.mem_ideal_iff {\u03b9 R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]\n {I : Ideal S} (b : Basis \u03b9 R I) {x : S} :\n x \u2208 I \u2194 \u2203 c : \u03b9 \u2192\u2080 R, x = Finsupp.sum c fun i x => x \u2022 (b i : S) :=\n(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff\n\n/-- If `I : Ideal S` has a finite basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 98\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_map_mkQ_eq_colon (L169-L174)\nlemma annihilator_map_mkQ_eq_colon : annihilator (P.map N.mkQ) = N.colon (P : Set M) := by\next\n rw [mem_annihilator, mem_colon]\n exact \u27e8fun H p hp \u21a6 (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),\n fun H _ \u27e8p, hp, hpm\u27e9 \u21a6 hpm \u25b8 ((Quotient.mk_eq_zero N).2 <| H p hp)\u27e9\n```\n\n-- snippet 99\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_inf_eq_left_of_subset (L81-L83)\nlemma colon_inf_eq_left_of_subset (h : S \u2286 (N\u2082 : Set M)) : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 100\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le (L118-L122)\ntheorem add_pow_mem_of_pow_mem_of_le {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1) :\n (a + b) ^ k \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb hk (Commute.all ..)\n```\n\n-- snippet 101\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_empty (L114-L116)\nlemma colon_empty : N.colon (\u2205 : Set M) = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 102\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_univ (L57-L60)\ntheorem colon_univ {I : Ideal R} [I.IsTwoSided] : I.colon Set.univ = I := by\nsimp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]\n exact fun x \u21a6 \u27e8fun h \u21a6 mul_one x \u25b8 h 1 trivial, fun h _ _ \u21a6 I.mul_mem_right _ h\u27e9\n```\n\n-- snippet 103\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_isSimpleOrder_ideal (L292-L302)\ntheorem isField_iff_isSimpleOrder_ideal : IsField R \u2194 IsSimpleOrder (Ideal R) := by\ncases subsingleton_or_nontrivial R\n \u00b7 exact\n \u27e8fun h => (not_isField_of_subsingleton _ h).elim, fun h =>\n (false_of_nontrivial_of_subsingleton <| Ideal R).elim\u27e9\n rw [\u2190 not_iff_not, Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top]\n contrapose! +distrib\n simp_rw [not_lt_top_iff, not_bot_lt_iff]\n exact \u27e8fun h => \u27e8h\u27e9, fun h => h.2\u27e9\n\n/-- When a ring is not a field, the maximal ideals are nontrivial. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.map_toCotangent_ker (L54-L57)\ntheorem map_toCotangent_ker : (LinearMap.ker I.toCotangent).map I.subtype = I ^ 2 := by\nrw [Ideal.toCotangent, Submodule.ker_mkQ, pow_two, Submodule.map_smul'' I \u22a4 (Submodule.subtype I),\n smul_eq_mul, Submodule.map_subtype_top]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Ideal/Operations.lean", "module": "Mathlib.RingTheory.Ideal.Operations", "declaration": "Mathlib.RingTheory.Ideal.Operations.prod_eq_iInf_of_pairwise_isCoprime", "span": "L787-L799", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Operations.lean#L787"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 19256, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 49070, "lean_code_chars": 45805, "natural_language_chars": 3265, "lean_code_ratio": 0.9335, "line_count": 1360, "imports_count": 0, "declarations_count": 5368, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "ccd151a599374394", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.NumberTheory.TsumDivisorsAntidiagonal.sigmaAntidiagonalEquivProd_symm_apply_snd", "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.NumberTheory.TsumDivisorsAntidiagonal)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma sigmaAntidiagonalEquivProd_symm_apply_snd (x : \u2115+ \u00d7 \u2115+) :\n (sigmaAntidiagonalEquivProd.symm x).2 = (x.1.1, x.2.1)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.divisorsAntidiagonalFactors (L31-L35)\ndef divisorsAntidiagonalFactors (n : \u2115+) : Nat.divisorsAntidiagonal n \u2192 \u2115+ \u00d7 \u2115+ := fun x \u21a6\n\u27e8\u27e8x.1.1, Nat.pos_of_mem_divisors (Nat.fst_mem_divisors_of_mem_antidiagonal x.2)\u27e9,\n (\u27e8x.1.2, Nat.pos_of_mem_divisors (Nat.snd_mem_divisors_of_mem_antidiagonal x.2)\u27e9 : \u2115+),\n Nat.pos_of_mem_divisors (Nat.snd_mem_divisors_of_mem_antidiagonal x.2)\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.divisorsAntidiagonalFactors_eq (L36-L39)\nlemma divisorsAntidiagonalFactors_eq {n : \u2115+} (x : Nat.divisorsAntidiagonal n) :\n (divisorsAntidiagonalFactors n x).1.1 * (divisorsAntidiagonalFactors n x).2.1 = n := by\nsimp [divisorsAntidiagonalFactors, (Nat.mem_divisorsAntidiagonal.mp x.2).1]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.divisorsAntidiagonalFactors_one (L40-L47)\nlemma divisorsAntidiagonalFactors_one (x : Nat.divisorsAntidiagonal 1) :\n (divisorsAntidiagonalFactors 1 x) = (1, 1) := by\nhave h := Nat.mem_divisorsAntidiagonal.mp x.2\n simp only [mul_eq_one, ne_eq, one_ne_zero, not_false_eq_true, and_true] at h\n simp [divisorsAntidiagonalFactors, h.1, h.2]\n\n/-- The equivalence from the union over `n` of `Nat.divisorsAntidiagonal n` to `\u2115+ \u00d7 \u2115+`\ngiven by sending `n = a * b` to `(a, b)`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.sigmaAntidiagonalEquivProd (L48-L57)\ndef sigmaAntidiagonalEquivProd : (\u03a3 n : \u2115+, Nat.divisorsAntidiagonal n) \u2243 \u2115+ \u00d7 \u2115+ where\n toFun x := divisorsAntidiagonalFactors x.1 x.2\ninvFun x :=\n \u27e8\u27e8x.1.val * x.2.val, mul_pos x.1.2 x.2.2\u27e9, \u27e8x.1, x.2\u27e9, by simp [Nat.mem_divisorsAntidiagonal]\u27e9\n left_inv := by\n rintro \u27e8n, \u27e8k, l\u27e9, h\u27e9\n rw [Nat.mem_divisorsAntidiagonal] at h\n ext <;> simp [divisorsAntidiagonalFactors, \u2190 PNat.coe_injective.eq_iff, h.1]\n right_inv _ := rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.sigmaAntidiagonalEquivProd_symm_apply_fst (L58-L60)\nlemma sigmaAntidiagonalEquivProd_symm_apply_fst (x : \u2115+ \u00d7 \u2115+) :\n (sigmaAntidiagonalEquivProd.symm x).1 = x.1.1 * x.2.1 := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.summable_norm_pow_mul_geometric_div_one_sub (L69-L98)\nlemma summable_norm_pow_mul_geometric_div_one_sub (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Summable fun n : \u2115 \u21a6 n ^ k * r ^ n / (1 - r ^ n) := by\nsimp only [div_eq_mul_one_div (_ * _ ^ _)]\n apply Summable.mul_tendsto_const (c := 1 / (1 - 0))\n (by simpa using summable_norm_pow_mul_geometric_of_norm_lt_one k hr)\n simpa only [Nat.cofinite_eq_atTop] using\n tendsto_const_nhds.div ((tendsto_pow_atTop_nhds_zero_of_norm_lt_one hr).const_sub 1) (by simp)\n\nprivate lemma summable_divisorsAntidiagonal_aux (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Summable fun c : (n : \u2115+) \u00d7 {x // x \u2208 (n : \u2115).divisorsAntidiagonal} \u21a6\n (c.2.1.2) ^ k * (r ^ (c.2.1.1 * c.2.1.2)) := by\n apply Summable.of_norm\n rw [summable_sigma_of_nonneg (fun a \u21a6 by positivity)]\n constructor\n \u00b7 exact fun n \u21a6 (hasSum_fintype _).summable\n \u00b7 simp only [norm_mul, norm_pow, tsum_fintype, Finset.univ_eq_attach]\n apply Summable.of_nonneg_of_le (f := fun c : \u2115+ \u21a6 \u2016(c : \ud835\udd5c) ^ (k + 1) * r ^ (c : \u2115)\u2016)\n (fun b \u21a6 Finset.sum_nonneg (fun _ _ \u21a6 mul_nonneg (by simp) (by simp))) (fun b \u21a6 ?_)\n (by apply (summable_norm_pow_mul_geometric_of_norm_lt_one (k + 1) hr).subtype)\n transitivity \u2211 _ \u2208 (b : \u2115).divisors, \u2016(b : \ud835\udd5c)\u2016 ^ k * \u2016r ^ (b : \u2115)\u2016\n \u00b7 rw [(b : \u2115).divisorsAntidiagonal.sum_attach (fun x \u21a6 \u2016(x.2 : \ud835\udd5c)\u2016 ^ _ * _ ^ (x.1 * x.2)),\n sum_divisorsAntidiagonal ((fun x y \u21a6 \u2016(y : \ud835\udd5c)\u2016 ^ k * _ ^ (x * y)))]\n gcongr with i hi\n \u00b7 simpa using le_of_dvd b.2 (div_dvd_of_dvd (dvd_of_mem_divisors hi))\n \u00b7 rw [norm_pow, mul_comm, Nat.div_mul_cancel (dvd_of_mem_divisors hi)]\n \u00b7 simp only [norm_pow, Finset.sum_const, nsmul_eq_mul, \u2190 mul_assoc, add_comm k 1, pow_add,\n pow_one, norm_mul]\n gcongr\n simpa using Nat.card_divisors_le_self b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.summable_prod_mul_pow (L99-L105)\ntheorem summable_prod_mul_pow (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Summable fun c : (\u2115+ \u00d7 \u2115+) \u21a6 c.2 ^ k * (r ^ (c.1 * c.2 : \u2115)) := by\nsimpa [sigmaAntidiagonalEquivProd.summable_iff.symm] using summable_divisorsAntidiagonal_aux k hr\n\n-- access notation `\u03c3`\nopen scoped sigma\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.tsum_prod_pow_eq_tsum_sigma (L106-L118)\ntheorem tsum_prod_pow_eq_tsum_sigma (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n \u2211' d : \u2115+, \u2211' c : \u2115+, c ^ k * r ^ (d * c : \u2115) = \u2211' e : \u2115+, \u03c3 k e * r ^ (e : \u2115) := by\nsuffices \u2211' c : \u2115+ \u00d7 \u2115+, c.2 ^ k * r ^ (c.1 * c.2 : \u2115) =\n \u2211' e : \u2115+, \u03c3 k e * r ^ (e : \u2115) by rwa [\u2190 (summable_prod_mul_pow k hr).tsum_prod]\n simp only [\u2190 sigmaAntidiagonalEquivProd.tsum_eq, sigmaAntidiagonalEquivProd,\n divisorsAntidiagonalFactors, PNat.mk_coe, Equiv.coe_fn_mk, sigma_eq_sum_div, cast_sum,\n cast_pow, Summable.tsum_sigma (summable_divisorsAntidiagonal_aux k hr)]\n refine tsum_congr fun n \u21a6 ?_\n simpa [tsum_fintype, Finset.sum_mul,\n (n : \u2115).divisorsAntidiagonal.sum_attach fun x : \u2115 \u00d7 \u2115 \u21a6 x.2 ^ k * r ^ (x.1 * x.2),\n sum_divisorsAntidiagonal fun x y \u21a6 y ^ k * r ^ (x * y)]\n using Finset.sum_congr rfl fun i hi \u21a6 by rw [Nat.mul_div_cancel' (dvd_of_mem_divisors hi)]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.tsum_pow_div_one_sub_eq_tsum_sigma (L119-L130)\nlemma tsum_pow_div_one_sub_eq_tsum_sigma {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) (k : \u2115) :\n \u2211' n : \u2115+, n ^ k * r ^ (n : \u2115) / (1 - r ^ (n : \u2115)) = \u2211' n : \u2115+, \u03c3 k n * r ^ (n : \u2115) := by\nhave (m : \u2115) [NeZero m] := tsum_geometric_of_norm_lt_one (\u03be := r ^ m)\n (by simpa using pow_lt_one\u2080 (by simp) hr (NeZero.ne _))\n simp only [div_eq_mul_inv, \u2190 this, \u2190 tsum_mul_left, mul_assoc, \u2190 _root_.pow_succ',\n \u2190 fun (n : \u2115) \u21a6 tsum_pnat_eq_tsum_succ (f := fun m \u21a6 n ^ k * (r ^ n) ^ m)]\n have h00 := tsum_prod_pow_eq_tsum_sigma k hr\n rw [Summable.tsum_comm (by apply (summable_prod_mul_pow k hr).prod_symm)] at h00\n rw [\u2190 h00]\n exact tsum_congr\u2082 <| fun b c \u21a6 by simp [mul_comm c.val b.val, pow_mul]\n\nomit [CompleteSpace \ud835\udd5c] [NormSMulClass \u2124 \ud835\udd5c] in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.tendsto_zero_geometric_tsum_pnat (L131-L143)\nlemma tendsto_zero_geometric_tsum_pnat {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Tendsto (fun m : \u2115+ \u21a6 \u2211' n : \u2115+, r ^ (n * m : \u2115)) atTop (\ud835\udcdd 0) := by\nhave h1 (m : \u2115+) : \u2016r ^ (m : \u2115)\u2016 < 1 := by\n rwa [norm_pow, pow_lt_one_iff_of_nonneg (norm_nonneg _) (NeZero.ne _)]\n have h2 (m : \u2115+) : \u2211' n : \u2115+, r ^ (n * m : \u2115) = (1 - r ^ (m : \u2115))\u207b\u00b9 - 1 := by\n have := tsum_geometric_of_norm_lt_one (h1 m)\n rw [\u2190 tsum_zero_pnat_eq_tsum_nat (summable_geometric_of_norm_lt_one (h1 m))] at this\n simp_rw [\u2190 this, pow_zero, add_sub_cancel_left, mul_comm, pow_mul]\n rw [funext h2, (by simp : \ud835\udcdd (0 : \ud835\udd5c) = \ud835\udcdd ((1 - 0)\u207b\u00b9 - 1)), tendsto_sub_const_iff,\n tendsto_inv_iff\u2080 (by simp), tendsto_const_sub_iff]\n exact (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hr).comp <| tendsto_PNat_val_atTop_atTop\n\nend tsum\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.NumberTheory.TsumDivisorsAntidiagonal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma sigmaAntidiagonalEquivProd_symm_apply_snd (x : \u2115+ \u00d7 \u2115+) :\n (sigmaAntidiagonalEquivProd.symm x).2 = (x.1.1, x.2.1)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.divisorsAntidiagonalFactors (L31-L35)\ndef divisorsAntidiagonalFactors (n : \u2115+) : Nat.divisorsAntidiagonal n \u2192 \u2115+ \u00d7 \u2115+ := fun x \u21a6\n\u27e8\u27e8x.1.1, Nat.pos_of_mem_divisors (Nat.fst_mem_divisors_of_mem_antidiagonal x.2)\u27e9,\n (\u27e8x.1.2, Nat.pos_of_mem_divisors (Nat.snd_mem_divisors_of_mem_antidiagonal x.2)\u27e9 : \u2115+),\n Nat.pos_of_mem_divisors (Nat.snd_mem_divisors_of_mem_antidiagonal x.2)\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.divisorsAntidiagonalFactors_eq (L36-L39)\nlemma divisorsAntidiagonalFactors_eq {n : \u2115+} (x : Nat.divisorsAntidiagonal n) :\n (divisorsAntidiagonalFactors n x).1.1 * (divisorsAntidiagonalFactors n x).2.1 = n := by\nsimp [divisorsAntidiagonalFactors, (Nat.mem_divisorsAntidiagonal.mp x.2).1]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.divisorsAntidiagonalFactors_one (L40-L47)\nlemma divisorsAntidiagonalFactors_one (x : Nat.divisorsAntidiagonal 1) :\n (divisorsAntidiagonalFactors 1 x) = (1, 1) := by\nhave h := Nat.mem_divisorsAntidiagonal.mp x.2\n simp only [mul_eq_one, ne_eq, one_ne_zero, not_false_eq_true, and_true] at h\n simp [divisorsAntidiagonalFactors, h.1, h.2]\n\n/-- The equivalence from the union over `n` of `Nat.divisorsAntidiagonal n` to `\u2115+ \u00d7 \u2115+`\ngiven by sending `n = a * b` to `(a, b)`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.sigmaAntidiagonalEquivProd (L48-L57)\ndef sigmaAntidiagonalEquivProd : (\u03a3 n : \u2115+, Nat.divisorsAntidiagonal n) \u2243 \u2115+ \u00d7 \u2115+ where\n toFun x := divisorsAntidiagonalFactors x.1 x.2\ninvFun x :=\n \u27e8\u27e8x.1.val * x.2.val, mul_pos x.1.2 x.2.2\u27e9, \u27e8x.1, x.2\u27e9, by simp [Nat.mem_divisorsAntidiagonal]\u27e9\n left_inv := by\n rintro \u27e8n, \u27e8k, l\u27e9, h\u27e9\n rw [Nat.mem_divisorsAntidiagonal] at h\n ext <;> simp [divisorsAntidiagonalFactors, \u2190 PNat.coe_injective.eq_iff, h.1]\n right_inv _ := rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.sigmaAntidiagonalEquivProd_symm_apply_fst (L58-L60)\nlemma sigmaAntidiagonalEquivProd_symm_apply_fst (x : \u2115+ \u00d7 \u2115+) :\n (sigmaAntidiagonalEquivProd.symm x).1 = x.1.1 * x.2.1 := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.summable_norm_pow_mul_geometric_div_one_sub (L69-L98)\nlemma summable_norm_pow_mul_geometric_div_one_sub (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Summable fun n : \u2115 \u21a6 n ^ k * r ^ n / (1 - r ^ n) := by\nsimp only [div_eq_mul_one_div (_ * _ ^ _)]\n apply Summable.mul_tendsto_const (c := 1 / (1 - 0))\n (by simpa using summable_norm_pow_mul_geometric_of_norm_lt_one k hr)\n simpa only [Nat.cofinite_eq_atTop] using\n tendsto_const_nhds.div ((tendsto_pow_atTop_nhds_zero_of_norm_lt_one hr).const_sub 1) (by simp)\n\nprivate lemma summable_divisorsAntidiagonal_aux (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Summable fun c : (n : \u2115+) \u00d7 {x // x \u2208 (n : \u2115).divisorsAntidiagonal} \u21a6\n (c.2.1.2) ^ k * (r ^ (c.2.1.1 * c.2.1.2)) := by\n apply Summable.of_norm\n rw [summable_sigma_of_nonneg (fun a \u21a6 by positivity)]\n constructor\n \u00b7 exact fun n \u21a6 (hasSum_fintype _).summable\n \u00b7 simp only [norm_mul, norm_pow, tsum_fintype, Finset.univ_eq_attach]\n apply Summable.of_nonneg_of_le (f := fun c : \u2115+ \u21a6 \u2016(c : \ud835\udd5c) ^ (k + 1) * r ^ (c : \u2115)\u2016)\n (fun b \u21a6 Finset.sum_nonneg (fun _ _ \u21a6 mul_nonneg (by simp) (by simp))) (fun b \u21a6 ?_)\n (by apply (summable_norm_pow_mul_geometric_of_norm_lt_one (k + 1) hr).subtype)\n transitivity \u2211 _ \u2208 (b : \u2115).divisors, \u2016(b : \ud835\udd5c)\u2016 ^ k * \u2016r ^ (b : \u2115)\u2016\n \u00b7 rw [(b : \u2115).divisorsAntidiagonal.sum_attach (fun x \u21a6 \u2016(x.2 : \ud835\udd5c)\u2016 ^ _ * _ ^ (x.1 * x.2)),\n sum_divisorsAntidiagonal ((fun x y \u21a6 \u2016(y : \ud835\udd5c)\u2016 ^ k * _ ^ (x * y)))]\n gcongr with i hi\n \u00b7 simpa using le_of_dvd b.2 (div_dvd_of_dvd (dvd_of_mem_divisors hi))\n \u00b7 rw [norm_pow, mul_comm, Nat.div_mul_cancel (dvd_of_mem_divisors hi)]\n \u00b7 simp only [norm_pow, Finset.sum_const, nsmul_eq_mul, \u2190 mul_assoc, add_comm k 1, pow_add,\n pow_one, norm_mul]\n gcongr\n simpa using Nat.card_divisors_le_self b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.summable_prod_mul_pow (L99-L105)\ntheorem summable_prod_mul_pow (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Summable fun c : (\u2115+ \u00d7 \u2115+) \u21a6 c.2 ^ k * (r ^ (c.1 * c.2 : \u2115)) := by\nsimpa [sigmaAntidiagonalEquivProd.summable_iff.symm] using summable_divisorsAntidiagonal_aux k hr\n\n-- access notation `\u03c3`\nopen scoped sigma\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.tsum_prod_pow_eq_tsum_sigma (L106-L118)\ntheorem tsum_prod_pow_eq_tsum_sigma (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n \u2211' d : \u2115+, \u2211' c : \u2115+, c ^ k * r ^ (d * c : \u2115) = \u2211' e : \u2115+, \u03c3 k e * r ^ (e : \u2115) := by\nsuffices \u2211' c : \u2115+ \u00d7 \u2115+, c.2 ^ k * r ^ (c.1 * c.2 : \u2115) =\n \u2211' e : \u2115+, \u03c3 k e * r ^ (e : \u2115) by rwa [\u2190 (summable_prod_mul_pow k hr).tsum_prod]\n simp only [\u2190 sigmaAntidiagonalEquivProd.tsum_eq, sigmaAntidiagonalEquivProd,\n divisorsAntidiagonalFactors, PNat.mk_coe, Equiv.coe_fn_mk, sigma_eq_sum_div, cast_sum,\n cast_pow, Summable.tsum_sigma (summable_divisorsAntidiagonal_aux k hr)]\n refine tsum_congr fun n \u21a6 ?_\n simpa [tsum_fintype, Finset.sum_mul,\n (n : \u2115).divisorsAntidiagonal.sum_attach fun x : \u2115 \u00d7 \u2115 \u21a6 x.2 ^ k * r ^ (x.1 * x.2),\n sum_divisorsAntidiagonal fun x y \u21a6 y ^ k * r ^ (x * y)]\n using Finset.sum_congr rfl fun i hi \u21a6 by rw [Nat.mul_div_cancel' (dvd_of_mem_divisors hi)]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.tsum_pow_div_one_sub_eq_tsum_sigma (L119-L130)\nlemma tsum_pow_div_one_sub_eq_tsum_sigma {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) (k : \u2115) :\n \u2211' n : \u2115+, n ^ k * r ^ (n : \u2115) / (1 - r ^ (n : \u2115)) = \u2211' n : \u2115+, \u03c3 k n * r ^ (n : \u2115) := by\nhave (m : \u2115) [NeZero m] := tsum_geometric_of_norm_lt_one (\u03be := r ^ m)\n (by simpa using pow_lt_one\u2080 (by simp) hr (NeZero.ne _))\n simp only [div_eq_mul_inv, \u2190 this, \u2190 tsum_mul_left, mul_assoc, \u2190 _root_.pow_succ',\n \u2190 fun (n : \u2115) \u21a6 tsum_pnat_eq_tsum_succ (f := fun m \u21a6 n ^ k * (r ^ n) ^ m)]\n have h00 := tsum_prod_pow_eq_tsum_sigma k hr\n rw [Summable.tsum_comm (by apply (summable_prod_mul_pow k hr).prod_symm)] at h00\n rw [\u2190 h00]\n exact tsum_congr\u2082 <| fun b c \u21a6 by simp [mul_comm c.val b.val, pow_mul]\n\nomit [CompleteSpace \ud835\udd5c] [NormSMulClass \u2124 \ud835\udd5c] in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.NumberTheory.TsumDivisorsAntidiagonal.tendsto_zero_geometric_tsum_pnat (L131-L143)\nlemma tendsto_zero_geometric_tsum_pnat {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n Tendsto (fun m : \u2115+ \u21a6 \u2211' n : \u2115+, r ^ (n * m : \u2115)) atTop (\ud835\udcdd 0) := by\nhave h1 (m : \u2115+) : \u2016r ^ (m : \u2115)\u2016 < 1 := by\n rwa [norm_pow, pow_lt_one_iff_of_nonneg (norm_nonneg _) (NeZero.ne _)]\n have h2 (m : \u2115+) : \u2211' n : \u2115+, r ^ (n * m : \u2115) = (1 - r ^ (m : \u2115))\u207b\u00b9 - 1 := by\n have := tsum_geometric_of_norm_lt_one (h1 m)\n rw [\u2190 tsum_zero_pnat_eq_tsum_nat (summable_geometric_of_norm_lt_one (h1 m))] at this\n simp_rw [\u2190 this, pow_zero, add_sub_cancel_left, mul_comm, pow_mul]\n rw [funext h2, (by simp : \ud835\udcdd (0 : \ud835\udd5c) = \ud835\udcdd ((1 - 0)\u207b\u00b9 - 1)), tendsto_sub_const_iff,\n tendsto_inv_iff\u2080 (by simp), tendsto_const_sub_iff]\n exact (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hr).comp <| tendsto_PNat_val_atTop_atTop\n\nend tsum\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/TsumDivisorsAntidiagonal.lean", "module": "Mathlib.NumberTheory.TsumDivisorsAntidiagonal", "declaration": "Mathlib.NumberTheory.TsumDivisorsAntidiagonal.sigmaAntidiagonalEquivProd_symm_apply_snd", "span": "L61-L68", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/TsumDivisorsAntidiagonal.lean#L61"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3253, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 7716, "lean_code_chars": 7012, "natural_language_chars": 704, "lean_code_ratio": 0.9088, "line_count": 156, "imports_count": 0, "declarations_count": 676, "diagnostics_count": 0, "retrieval_snippets_count": 10, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "bca8ac10105ba4ab", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Baire.BaireMeasurable.MeasurableSet", "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.Topology.Baire.BaireMeasurable)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem MeasurableSet.residualEq_isOpen [MeasurableSpace \u03b1] [BorelSpace \u03b1] (h : MeasurableSet s) :\n \u2203 u : Set \u03b1, IsOpen u \u2227 s =\u1d47 u\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.coborder_mem_residual (L50-L52)\ntheorem coborder_mem_residual {s : Set \u03b1} (hs : IsLocallyClosed s) : coborder s \u2208 residual \u03b1 :=\nresidual_of_dense_open hs.isOpen_coborder dense_coborder\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.closure_residualEq (L53-L63)\ntheorem closure_residualEq {s : Set \u03b1} (hs : IsLocallyClosed s) : closure s =\u1d47 s := by\nrw [Filter.eventuallyEq_set]\n filter_upwards [coborder_mem_residual hs] with x hx\n nth_rewrite 2 [\u2190 closure_inter_coborder (s := s)]\n simp [hx]\n\n/-- We say a set is a `BaireMeasurableSet` if it differs from some Borel set by\na meager set. This forms a \u03c3-algebra.\n\nIt is equivalent, and a more standard definition, to say that the set differs from\nsome *open* set by a meager set. See `BaireMeasurableSet.iff_residualEq_isOpen` -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L64-L70)\ndef BaireMeasurableSet (s : Set \u03b1) : Prop :=\n@MeasurableSet _ (eventuallyMeasurableSpace (borel _) (residual _)) s\n\nvariable {s t : Set \u03b1}\n\nnamespace BaireMeasurableSet\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.of_mem_residual (L71-L73)\ntheorem of_mem_residual (h : s \u2208 residual _) : BaireMeasurableSet s :=\neventuallyMeasurableSet_of_mem_filter (\u03b1 := \u03b1) h\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.compl (L83-L84)\ntheorem compl (h : BaireMeasurableSet s) : BaireMeasurableSet s\u1d9c := MeasurableSet.compl h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.of_compl (L85-L86)\ntheorem of_compl (h : BaireMeasurableSet s\u1d9c) : BaireMeasurableSet s := MeasurableSet.of_compl h\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.iUnion (L90-L93)\ntheorem iUnion {\u03b9 : Sort*} [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1}\n (h : \u2200 i, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c3 i, s i) :=\nMeasurableSet.iUnion h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.biUnion (L94-L97)\ntheorem biUnion {\u03b9 : Type*} {s : \u03b9 \u2192 Set \u03b1} {t : Set \u03b9} (ht : t.Countable)\n (h : \u2200 i \u2208 t, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c3 i \u2208 t, s i) :=\nMeasurableSet.biUnion ht h\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.sUnion (L98-L101)\ntheorem sUnion {s : Set (Set \u03b1)} (hs : s.Countable)\n (h : \u2200 t \u2208 s, BaireMeasurableSet t) : BaireMeasurableSet (\u22c3\u2080 s) :=\nMeasurableSet.sUnion hs h\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.iInter (L102-L105)\ntheorem iInter {\u03b9 : Sort*} [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1}\n (h : \u2200 i, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c2 i, s i) :=\nMeasurableSet.iInter h\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.biInter (L106-L109)\ntheorem biInter {\u03b9 : Type*} {s : \u03b9 \u2192 Set \u03b1} {t : Set \u03b9} (ht : t.Countable)\n (h : \u2200 i \u2208 t, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c2 i \u2208 t, s i) :=\nMeasurableSet.biInter ht h\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.sInter (L110-L113)\ntheorem sInter {s : Set (Set \u03b1)} (hs : s.Countable)\n (h : \u2200 t \u2208 s, BaireMeasurableSet t) : BaireMeasurableSet (\u22c2\u2080 s) :=\nMeasurableSet.sInter hs h\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.union (L114-L117)\ntheorem union (hs : BaireMeasurableSet s) (ht : BaireMeasurableSet t) :\n BaireMeasurableSet (s \u222a t) :=\nMeasurableSet.union hs ht\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.inter (L118-L121)\ntheorem inter (hs : BaireMeasurableSet s) (ht : BaireMeasurableSet t) :\n BaireMeasurableSet (s \u2229 t) :=\nMeasurableSet.inter hs ht\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.diff (L122-L125)\ntheorem diff (hs : BaireMeasurableSet s) (ht : BaireMeasurableSet t) :\n BaireMeasurableSet (s \\ t) :=\nMeasurableSet.diff hs ht\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.congr (L126-L133)\ntheorem congr (hs : BaireMeasurableSet s) (h : s =\u1d47 t) : BaireMeasurableSet t :=\nEventuallyMeasurableSet.congr (\u03b1 := \u03b1) hs h.symm\n\nend BaireMeasurableSet\n\nopen Filter\n\n/-- Any Borel set differs from some open set by a meager set. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L147-L154)\ntheorem BaireMeasurableSet.residualEq_isOpen (h : BaireMeasurableSet s) :\n \u2203 u : Set \u03b1, (IsOpen u) \u2227 s =\u1d47 u := by\nborelize \u03b1\n rcases h with \u27e8t, ht, hst\u27e9\n rcases ht.residualEq_isOpen with \u27e8u, hu, htu\u27e9\n exact \u27e8u, hu, hst.trans htu\u27e9\n\n/-- A set is Baire measurable if and only if it differs from some open set by a meager set. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L155-L164)\ntheorem BaireMeasurableSet.iff_residualEq_isOpen :\n BaireMeasurableSet s \u2194 \u2203 u : Set \u03b1, (IsOpen u) \u2227 s =\u1d47 u :=\n\u27e8fun h => h.residualEq_isOpen, fun \u27e8_, uo, ueq\u27e9 => uo.baireMeasurableSet.congr ueq.symm\u27e9\n\nsection Map\n\nopen Set\n\nvariable {f : \u03b1 \u2192 \u03b2}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.tendsto_residual_of_isOpenMap (L165-L171)\ntheorem tendsto_residual_of_isOpenMap (hc : Continuous f) (ho : IsOpenMap f) :\n Tendsto f (residual \u03b1) (residual \u03b2) := by\napply le_countableGenerate_iff_of_countableInterFilter.mpr\n rintro t \u27e8ht, htd\u27e9\n exact residual_of_dense_open (ht.preimage hc) (htd.preimage ho)\n\n/-- The preimage of a meager set under a continuous open map is meager. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.IsMeagre (L172-L176)\ntheorem IsMeagre.preimage_of_isOpenMap (hc : Continuous f) (ho : IsOpenMap f)\n {s : Set \u03b2} (h : IsMeagre s) : IsMeagre (f \u207b\u00b9' s) :=\ntendsto_residual_of_isOpenMap hc ho h\n\n/-- The preimage of a `BaireMeasurableSet` under a continuous open map is Baire measurable. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L177-L183)\ntheorem BaireMeasurableSet.preimage (hc : Continuous f) (ho : IsOpenMap f)\n {s : Set \u03b2} (h : BaireMeasurableSet s) : BaireMeasurableSet (f \u207b\u00b9' s) := by\nrcases h with \u27e8u, hu, hsu\u27e9\n refine \u27e8f \u207b\u00b9' u, ?_, hsu.filter_mono <| tendsto_residual_of_isOpenMap hc ho\u27e9\n borelize \u03b1 \u03b2\n exact hc.measurable hu\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.Homeomorph (L184-L189)\ntheorem Homeomorph.residual_map_eq (h : \u03b1 \u2243\u209c \u03b2) : (residual \u03b1).map h = residual \u03b2 := by\nrefine le_antisymm (tendsto_residual_of_isOpenMap h.continuous h.isOpenMap) (le_map ?_)\n simp_rw [\u2190 preimage_symm]\n exact tendsto_residual_of_isOpenMap h.symm.continuous h.symm.isOpenMap\n\nend Map\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_sInter_of_G\u03b4 (L165-L171)\ntheorem dense_sInter_of_G\u03b4 {S : Set (Set X)} (ho : \u2200 s \u2208 S, IsG\u03b4 s) (hS : S.Countable)\n (hd : \u2200 s \u2208 S, Dense s) : Dense (\u22c2\u2080 S) :=\ndense_of_mem_residual ((countable_sInter_mem hS).mpr\n (fun _ hs => residual_of_dense_G\u03b4 (ho _ hs) (hd _ hs)))\n\n/-- Baire theorem: a countable intersection of dense G\u03b4 sets is dense. Formulated here with\nan index set which is a countable type. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Baire.Lemmas.Set (L48-L57)\ntheorem Set.Finite.dense_sInter {s : Set (Set X)} (hs : s.Finite)\n (ho : \u2200 t \u2208 s, IsOpen t) (hd : \u2200 t \u2208 s, Dense t) : Dense (\u22c2\u2080 s) := by\ninduction s, hs using Set.Finite.induction_on with\n | empty => simp [sInter_empty]\n | insert ha hsf ih =>\n simp only [sInter_insert, forall_mem_insert] at hd \u22a2\n refine hd.1.inter_of_isOpen_right ?_ (hsf.isOpen_sInter (fun y hy => ho y (Or.inr hy)))\n exact ih ((fun y hy => ho y (Or.inr hy))) (fun y hy => hd.2 y hy)\n\n/-- A finite set is Baire. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Baire.Lemmas.IsG\u03b4 (L69-L80)\ntheorem IsG\u03b4.baireSpace_of_dense {s : Set X} (hG : IsG\u03b4 s) (hd : Dense s) : BaireSpace s := by\nconstructor\n intro f hof hdf\n obtain \u27e8V, hV\u27e9 : \u2203 V : \u2115 \u2192 Set X, (\u2200 n, IsOpen (V n)) \u2227 s = \u22c2 n, V n := eq_iInter_nat hG\n choose g hg1 hg2 hg3 using fun n => exists_open_dense_of_open_dense_subtype hd (hof n) (hdf n)\n have h_inter_dense : Dense (\u22c2 n, g n \u2229 V n) := BaireSpace.baire_property (fun n \u21a6 g n \u2229 V n)\n (fun n => (hg1 n).inter (hV.1 n))\n (fun n => (hg2 n).inter_of_isOpen_left (hd.mono (by simp [hV.2, iInter_subset])) (hg1 n))\n have h_inter_eq : \u22c2 n, g n \u2229 V n = \u22c2 n, f n := by ext; simp_all; grind\n exact Subtype.dense_iff.mpr fun a _ \u21a6 h_inter_eq \u25b8 h_inter_dense a\n\n/-- If `p : Y \u2192 X` is an open embedding and `X` is a Baire space, then `Y` is a Baire space. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Baire.Lemmas.eventually_residual (L145-L149)\ntheorem eventually_residual {p : X \u2192 Prop} :\n (\u2200\u1da0 x in residual X, p x) \u2194 \u2203 t : Set X, IsG\u03b4 t \u2227 Dense t \u2227 \u2200 x \u2208 t, p x := by\nsimp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]\n tauto\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iInter_of_isOpen_nat (L64-L68)\ntheorem dense_iInter_of_isOpen_nat {f : \u2115 \u2192 Set X} (ho : \u2200 n, IsOpen (f n))\n (hd : \u2200 n, Dense (f n)) : Dense (\u22c2 n, f n) :=\nBaireSpace.baire_property f ho hd\n\n/-- A dense G\u03b4 subset of a Baire space is Baire. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iInter_of_isOpen (L130-L134)\ntheorem dense_iInter_of_isOpen [Countable \u03b9] {f : \u03b9 \u2192 Set X} (ho : \u2200 i, IsOpen (f i))\n (hd : \u2200 i, Dense (f i)) : Dense (\u22c2 s, f s) :=\ndense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd)\n\n/-- A set is residual (comeagre) if and only if it includes a dense `G\u03b4` set. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_of_mem_residual (L150-L157)\ntheorem dense_of_mem_residual {s : Set X} (hs : s \u2208 residual X) : Dense s :=\nlet \u27e8_, hts, _, hd\u27e9 := mem_residual.1 hs\n hd.mono hts\n\n/--\nIn a Baire space, every nonempty open set is non\u2010meagre,\nthat is, it cannot be written as a countable union of nowhere\u2010dense sets.\n-/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_biInter_of_isOpen (L123-L129)\ntheorem dense_biInter_of_isOpen {S : Set \u03b1} {f : \u03b1 \u2192 Set X} (ho : \u2200 s \u2208 S, IsOpen (f s))\n (hS : S.Countable) (hd : \u2200 s \u2208 S, Dense (f s)) : Dense (\u22c2 s \u2208 S, f s) := by\nrw [\u2190 sInter_image]\n refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable type. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iInter_of_G\u03b4 (L172-L177)\ntheorem dense_iInter_of_G\u03b4 [Countable \u03b9] {f : \u03b9 \u2192 Set X} (ho : \u2200 s, IsG\u03b4 (f s))\n (hd : \u2200 s, Dense (f s)) : Dense (\u22c2 s, f s) :=\ndense_sInter_of_G\u03b4 (forall_mem_range.2 \u2039_\u203a) (countable_range _) (forall_mem_range.2 \u2039_\u203a)\n\n/-- Baire theorem: a countable intersection of dense G\u03b4 sets is dense. Formulated here with\nan index set which is a countable set in any type. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Baire.Lemmas.baire_of_finite (L58-L63)\ntheorem baire_of_finite [Finite X] : BaireSpace X where\n baire_property f _ _ := sInter_range f \u25b8 (toFinite (range f)).dense_sInter (by grind) (by grind)\nvariable [BaireSpace X]\n\n/-- Definition of a Baire space. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_biUnion_interior_of_closed (L225-L230)\ntheorem dense_biUnion_interior_of_closed {S : Set \u03b1} {f : \u03b1 \u2192 Set X} (hc : \u2200 s \u2208 S, IsClosed (f s))\n (hS : S.Countable) (hU : \u22c3 s \u2208 S, f s = univ) : Dense (\u22c3 s \u2208 S, interior (f s)) :=\nIsG\u03b4.univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge\n\n/-- Baire theorem: if countably many closed sets cover the whole space, then their interiors\nare dense. Formulated here with `\u22c3\u2080`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Baire.Lemmas.not_isMeagre_of_isOpen (L158-L164)\ntheorem not_isMeagre_of_isOpen {s : Set X} (hs : IsOpen s) (hne : s.Nonempty) : \u00ac IsMeagre s := by\nintro h\n obtain \u27e8x, hx, hxc\u27e9 :=\n (dense_of_mem_residual (by rwa [IsMeagre] at h)).inter_open_nonempty s hs hne\n exact hxc hx\n\n/-- Baire theorem: a countable intersection of dense G\u03b4 sets is dense. Formulated here with \u22c2\u2080. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_biInter_of_G\u03b4 (L178-L184)\ntheorem dense_biInter_of_G\u03b4 {S : Set \u03b1} {f : \u2200 x \u2208 S, Set X} (ho : \u2200 s (H : s \u2208 S), IsG\u03b4 (f s H))\n (hS : S.Countable) (hd : \u2200 s (H : s \u2208 S), Dense (f s H)) : Dense (\u22c2 s \u2208 S, f s \u2039_\u203a) := by\nrw [biInter_eq_iInter]\n haveI := hS.to_subtype\n exact dense_iInter_of_G\u03b4 (fun s => ho s s.2) fun s => hd s s.2\n\n/-- Baire theorem: the intersection of two dense G\u03b4 sets is dense. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Baire.Lemmas.not_isMeagre_of_mem_residual (L258-L264)\ntheorem not_isMeagre_of_mem_residual {s : Set X} (hs : s \u2208 residual X) :\n \u00ac IsMeagre s := by\nrcases (mem_residual (X := X)).1 hs with \u27e8t, ht_sub, htG\u03b4, ht_dense\u27e9\n intro hs_meagre\n exact not_isMeagre_of_isG\u03b4_of_dense (X := X) htG\u03b4 ht_dense (hs_meagre.mono ht_sub)\n\nend BaireTheorem\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iUnion_interior_of_closed (L237-L244)\ntheorem dense_iUnion_interior_of_closed [Countable \u03b9] {f : \u03b9 \u2192 Set X} (hc : \u2200 i, IsClosed (f i))\n (hU : \u22c3 i, f i = univ) : Dense (\u22c3 i, interior (f i)) :=\nIsG\u03b4.univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge\n\nvariable [Nonempty X]\n\n/-- One of the most useful consequences of Baire theorem: if a countable union of closed sets\ncovers the space, then one of the sets has nonempty interior. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_sInter_of_isOpen (L114-L122)\ntheorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : \u2200 s \u2208 S, IsOpen s) (hS : S.Countable)\n (hd : \u2200 s \u2208 S, Dense s) : Dense (\u22c2\u2080 S) := by\nrcases S.eq_empty_or_nonempty with h | h\n \u00b7 simp [h]\n \u00b7 rcases hS.exists_eq_range h with \u27e8f, rfl\u27e9\n exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd)\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable set in any type. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_sUnion_interior_of_closed (L231-L236)\ntheorem dense_sUnion_interior_of_closed {S : Set (Set X)} (hc : \u2200 s \u2208 S, IsClosed s)\n (hS : S.Countable) (hU : \u22c3\u2080 S = univ) : Dense (\u22c3 s \u2208 S, interior s) :=\nIsG\u03b4.univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge\n\n/-- Baire theorem: if countably many closed sets cover the whole space, then their interiors\nare dense. Formulated here with an index set which is a countable type. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Baire.Lemmas.mem_residual (L135-L144)\ntheorem mem_residual {s : Set X} : s \u2208 residual X \u2194 \u2203 t \u2286 s, IsG\u03b4 t \u2227 Dense t := by\nconstructor\n \u00b7 rw [mem_residual_iff]\n rintro \u27e8S, hSo, hSd, Sct, Ss\u27e9\n refine \u27e8_, Ss, \u27e8_, fun t ht => hSo _ ht, Sct, rfl\u27e9, ?_\u27e9\n exact dense_sInter_of_isOpen hSo Sct hSd\n rintro \u27e8t, ts, ho, hd\u27e9\n exact mem_of_superset (residual_of_dense_G\u03b4 ho hd) ts\n\n/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `G\u03b4` set. -/\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Baire.Lemmas.not_isMeagre_of_isG\u03b4_of_dense (L250-L257)\ntheorem not_isMeagre_of_isG\u03b4_of_dense {s : Set X} (hs : IsG\u03b4 s) (hd : Dense s) :\n \u00ac IsMeagre s := by\nintro h\n rcases mem_residual.1 h with \u27e8t, hts, htG, hd'\u27e9\n rcases (hd.inter_of_G\u03b4 hs htG hd').nonempty with \u27e8x, hx\u2081, hx\u2082\u27e9\n exact hts hx\u2082 hx\u2081\n\n/-- In a nonempty Baire space, a residual set is not meagre. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Baire.LocallyCompactRegular.IsG\u03b4 (L62-L72)\ntheorem IsG\u03b4.of_t2Space_locallyCompactSpace (hG : IsG\u03b4 s) : BaireSpace s := by\nhave : BaireSpace (closure s) := by\n convert BaireSpace.of_t2Space_locallyCompactSpace using 1\n \u00b7 infer_instance\n \u00b7 exact isClosed_closure.locallyCompactSpace\n have : BaireSpace ((\u2191) \u207b\u00b9' s : Set (closure s)) :=\n (isG\u03b4_induced continuous_subtype_val hG).baireSpace_of_dense\n (by simp [Subtype.dense_iff, inter_eq_right.mpr subset_closure])\n have h_homeo : Homeomorph ((\u2191) \u207b\u00b9' s : Set (closure s)) s := \u27e8\u27e8fun x => \u27e8x, x.2\u27e9,\n fun x => \u27e8\u27e8x, subset_closure x.2\u27e9, x.2\u27e9, by grind, by grind\u27e9, by fun_prop, by fun_prop\u27e9\n exact h_homeo.baireSpace\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Baire.Lemmas.IsOpen (L110-L113)\ntheorem IsOpen.baireSpace {s : Set X} (hO : IsOpen s) : BaireSpace s :=\nhO.isOpenEmbedding_subtypeVal.baireSpace\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with \u22c2\u2080. -/\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Baire.Lemmas.Dense (L185-L191)\ntheorem Dense.inter_of_G\u03b4 {s t : Set X} (hs : IsG\u03b4 s) (ht : IsG\u03b4 t) (hsc : Dense s)\n (htc : Dense t) : Dense (s \u2229 t) := by\nrw [inter_eq_iInter]\n apply dense_iInter_of_G\u03b4 <;> simp [Bool.forall_bool, *]\n\n/-- If a countable family of closed sets cover a dense `G\u03b4` set, then the union of their interiors\nis dense. Formulated here with `\u22c3`. -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Baire.Lemmas.nonempty_interior_of_iUnion_of_closed (L245-L249)\ntheorem nonempty_interior_of_iUnion_of_closed [Countable \u03b9] {f : \u03b9 \u2192 Set X}\n (hc : \u2200 i, IsClosed (f i)) (hU : \u22c3 i, f i = univ) : \u2203 i, (interior <| f i).Nonempty := by\nsimpa using (dense_iUnion_interior_of_closed hc hU).nonempty\n\n/-- In a nonempty Baire space, any dense `G\u03b4` set is not meagre. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Baire.Lemmas.Topology (L81-L109)\ntheorem Topology.IsOpenEmbedding.baireSpace {Y : Type*} [TopologicalSpace Y] {p : Y \u2192 X}\n (hp : Topology.IsOpenEmbedding p) : BaireSpace Y := by\nconstructor\n intro f hof hdf\n let s := range p\n let c := fun n : \u2115 => p '' f n \u222a (closure s)\u1d9c\n have c_open (n : \u2115) : IsOpen (c n) := IsOpen.union (hp.isOpenMap (f n) (hof n))\n isClosed_closure.isOpen_compl\n have c_dense (n : \u2115) : Dense (c n) := by\n rw [dense_iff_closure_eq, subset_antisymm_iff]\n have : univ \u2286 closure (c n) := calc\n _ \u2286 (interior (closure s)) \u222a (interior (closure s))\u1d9c := by grind\n _ \u2286 closure s \u222a (interior (closure s))\u1d9c := by gcongr; exact interior_subset\n _ \u2286 closure (p '' f n) \u222a (interior (closure s))\u1d9c := union_subset_union\n (closure_minimal (hp.continuous.range_subset_closure_image_dense (hdf n))\n isClosed_closure) (subset_refl (interior (closure s))\u1d9c)\n _ \u2286 closure (p '' f n) \u222a closure ((closure s)\u1d9c) := union_subset_union (by simp) (by simp)\n _ = closure (c n) := closure_union.symm\n grind\n have c_inter_dense : Dense (\u22c2 n, c n) := dense_iInter_of_isOpen_nat c_open c_dense\n have c_inter_eq : \u22c2 n, f n = p \u207b\u00b9' (\u22c2 n, c n) := by\n ext x\n simp only [mem_iInter, mem_preimage, mem_union, mem_compl_iff, c]\n refine \u27e8fun h i => by grind, fun h i => ?_\u27e9\n exact hp.injective.mem_set_image.mp (imp_iff_or_not.mpr (h i)\n (subset_closure (mem_range_self x)))\n exact c_inter_eq \u25b8 Dense.preimage c_inter_dense hp.isOpenMap\n\n/-- An open subset of a Baire space is Baire. -/\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.Topology.Baire.BaireMeasurable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem MeasurableSet.residualEq_isOpen [MeasurableSpace \u03b1] [BorelSpace \u03b1] (h : MeasurableSet s) :\n \u2203 u : Set \u03b1, IsOpen u \u2227 s =\u1d47 u\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.coborder_mem_residual (L50-L52)\ntheorem coborder_mem_residual {s : Set \u03b1} (hs : IsLocallyClosed s) : coborder s \u2208 residual \u03b1 :=\nresidual_of_dense_open hs.isOpen_coborder dense_coborder\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.closure_residualEq (L53-L63)\ntheorem closure_residualEq {s : Set \u03b1} (hs : IsLocallyClosed s) : closure s =\u1d47 s := by\nrw [Filter.eventuallyEq_set]\n filter_upwards [coborder_mem_residual hs] with x hx\n nth_rewrite 2 [\u2190 closure_inter_coborder (s := s)]\n simp [hx]\n\n/-- We say a set is a `BaireMeasurableSet` if it differs from some Borel set by\na meager set. This forms a \u03c3-algebra.\n\nIt is equivalent, and a more standard definition, to say that the set differs from\nsome *open* set by a meager set. See `BaireMeasurableSet.iff_residualEq_isOpen` -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L64-L70)\ndef BaireMeasurableSet (s : Set \u03b1) : Prop :=\n@MeasurableSet _ (eventuallyMeasurableSpace (borel _) (residual _)) s\n\nvariable {s t : Set \u03b1}\n\nnamespace BaireMeasurableSet\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.of_mem_residual (L71-L73)\ntheorem of_mem_residual (h : s \u2208 residual _) : BaireMeasurableSet s :=\neventuallyMeasurableSet_of_mem_filter (\u03b1 := \u03b1) h\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.compl (L83-L84)\ntheorem compl (h : BaireMeasurableSet s) : BaireMeasurableSet s\u1d9c := MeasurableSet.compl h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.of_compl (L85-L86)\ntheorem of_compl (h : BaireMeasurableSet s\u1d9c) : BaireMeasurableSet s := MeasurableSet.of_compl h\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.iUnion (L90-L93)\ntheorem iUnion {\u03b9 : Sort*} [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1}\n (h : \u2200 i, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c3 i, s i) :=\nMeasurableSet.iUnion h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.biUnion (L94-L97)\ntheorem biUnion {\u03b9 : Type*} {s : \u03b9 \u2192 Set \u03b1} {t : Set \u03b9} (ht : t.Countable)\n (h : \u2200 i \u2208 t, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c3 i \u2208 t, s i) :=\nMeasurableSet.biUnion ht h\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.sUnion (L98-L101)\ntheorem sUnion {s : Set (Set \u03b1)} (hs : s.Countable)\n (h : \u2200 t \u2208 s, BaireMeasurableSet t) : BaireMeasurableSet (\u22c3\u2080 s) :=\nMeasurableSet.sUnion hs h\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.iInter (L102-L105)\ntheorem iInter {\u03b9 : Sort*} [Countable \u03b9] {s : \u03b9 \u2192 Set \u03b1}\n (h : \u2200 i, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c2 i, s i) :=\nMeasurableSet.iInter h\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.biInter (L106-L109)\ntheorem biInter {\u03b9 : Type*} {s : \u03b9 \u2192 Set \u03b1} {t : Set \u03b9} (ht : t.Countable)\n (h : \u2200 i \u2208 t, BaireMeasurableSet (s i)) : BaireMeasurableSet (\u22c2 i \u2208 t, s i) :=\nMeasurableSet.biInter ht h\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.sInter (L110-L113)\ntheorem sInter {s : Set (Set \u03b1)} (hs : s.Countable)\n (h : \u2200 t \u2208 s, BaireMeasurableSet t) : BaireMeasurableSet (\u22c2\u2080 s) :=\nMeasurableSet.sInter hs h\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.union (L114-L117)\ntheorem union (hs : BaireMeasurableSet s) (ht : BaireMeasurableSet t) :\n BaireMeasurableSet (s \u222a t) :=\nMeasurableSet.union hs ht\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.inter (L118-L121)\ntheorem inter (hs : BaireMeasurableSet s) (ht : BaireMeasurableSet t) :\n BaireMeasurableSet (s \u2229 t) :=\nMeasurableSet.inter hs ht\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.diff (L122-L125)\ntheorem diff (hs : BaireMeasurableSet s) (ht : BaireMeasurableSet t) :\n BaireMeasurableSet (s \\ t) :=\nMeasurableSet.diff hs ht\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.congr (L126-L133)\ntheorem congr (hs : BaireMeasurableSet s) (h : s =\u1d47 t) : BaireMeasurableSet t :=\nEventuallyMeasurableSet.congr (\u03b1 := \u03b1) hs h.symm\n\nend BaireMeasurableSet\n\nopen Filter\n\n/-- Any Borel set differs from some open set by a meager set. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L147-L154)\ntheorem BaireMeasurableSet.residualEq_isOpen (h : BaireMeasurableSet s) :\n \u2203 u : Set \u03b1, (IsOpen u) \u2227 s =\u1d47 u := by\nborelize \u03b1\n rcases h with \u27e8t, ht, hst\u27e9\n rcases ht.residualEq_isOpen with \u27e8u, hu, htu\u27e9\n exact \u27e8u, hu, hst.trans htu\u27e9\n\n/-- A set is Baire measurable if and only if it differs from some open set by a meager set. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L155-L164)\ntheorem BaireMeasurableSet.iff_residualEq_isOpen :\n BaireMeasurableSet s \u2194 \u2203 u : Set \u03b1, (IsOpen u) \u2227 s =\u1d47 u :=\n\u27e8fun h => h.residualEq_isOpen, fun \u27e8_, uo, ueq\u27e9 => uo.baireMeasurableSet.congr ueq.symm\u27e9\n\nsection Map\n\nopen Set\n\nvariable {f : \u03b1 \u2192 \u03b2}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.tendsto_residual_of_isOpenMap (L165-L171)\ntheorem tendsto_residual_of_isOpenMap (hc : Continuous f) (ho : IsOpenMap f) :\n Tendsto f (residual \u03b1) (residual \u03b2) := by\napply le_countableGenerate_iff_of_countableInterFilter.mpr\n rintro t \u27e8ht, htd\u27e9\n exact residual_of_dense_open (ht.preimage hc) (htd.preimage ho)\n\n/-- The preimage of a meager set under a continuous open map is meager. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.IsMeagre (L172-L176)\ntheorem IsMeagre.preimage_of_isOpenMap (hc : Continuous f) (ho : IsOpenMap f)\n {s : Set \u03b2} (h : IsMeagre s) : IsMeagre (f \u207b\u00b9' s) :=\ntendsto_residual_of_isOpenMap hc ho h\n\n/-- The preimage of a `BaireMeasurableSet` under a continuous open map is Baire measurable. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.BaireMeasurableSet (L177-L183)\ntheorem BaireMeasurableSet.preimage (hc : Continuous f) (ho : IsOpenMap f)\n {s : Set \u03b2} (h : BaireMeasurableSet s) : BaireMeasurableSet (f \u207b\u00b9' s) := by\nrcases h with \u27e8u, hu, hsu\u27e9\n refine \u27e8f \u207b\u00b9' u, ?_, hsu.filter_mono <| tendsto_residual_of_isOpenMap hc ho\u27e9\n borelize \u03b1 \u03b2\n exact hc.measurable hu\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Baire.BaireMeasurable.Homeomorph (L184-L189)\ntheorem Homeomorph.residual_map_eq (h : \u03b1 \u2243\u209c \u03b2) : (residual \u03b1).map h = residual \u03b2 := by\nrefine le_antisymm (tendsto_residual_of_isOpenMap h.continuous h.isOpenMap) (le_map ?_)\n simp_rw [\u2190 preimage_symm]\n exact tendsto_residual_of_isOpenMap h.symm.continuous h.symm.isOpenMap\n\nend Map\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_sInter_of_G\u03b4 (L165-L171)\ntheorem dense_sInter_of_G\u03b4 {S : Set (Set X)} (ho : \u2200 s \u2208 S, IsG\u03b4 s) (hS : S.Countable)\n (hd : \u2200 s \u2208 S, Dense s) : Dense (\u22c2\u2080 S) :=\ndense_of_mem_residual ((countable_sInter_mem hS).mpr\n (fun _ hs => residual_of_dense_G\u03b4 (ho _ hs) (hd _ hs)))\n\n/-- Baire theorem: a countable intersection of dense G\u03b4 sets is dense. Formulated here with\nan index set which is a countable type. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Baire.Lemmas.Set (L48-L57)\ntheorem Set.Finite.dense_sInter {s : Set (Set X)} (hs : s.Finite)\n (ho : \u2200 t \u2208 s, IsOpen t) (hd : \u2200 t \u2208 s, Dense t) : Dense (\u22c2\u2080 s) := by\ninduction s, hs using Set.Finite.induction_on with\n | empty => simp [sInter_empty]\n | insert ha hsf ih =>\n simp only [sInter_insert, forall_mem_insert] at hd \u22a2\n refine hd.1.inter_of_isOpen_right ?_ (hsf.isOpen_sInter (fun y hy => ho y (Or.inr hy)))\n exact ih ((fun y hy => ho y (Or.inr hy))) (fun y hy => hd.2 y hy)\n\n/-- A finite set is Baire. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Baire.Lemmas.IsG\u03b4 (L69-L80)\ntheorem IsG\u03b4.baireSpace_of_dense {s : Set X} (hG : IsG\u03b4 s) (hd : Dense s) : BaireSpace s := by\nconstructor\n intro f hof hdf\n obtain \u27e8V, hV\u27e9 : \u2203 V : \u2115 \u2192 Set X, (\u2200 n, IsOpen (V n)) \u2227 s = \u22c2 n, V n := eq_iInter_nat hG\n choose g hg1 hg2 hg3 using fun n => exists_open_dense_of_open_dense_subtype hd (hof n) (hdf n)\n have h_inter_dense : Dense (\u22c2 n, g n \u2229 V n) := BaireSpace.baire_property (fun n \u21a6 g n \u2229 V n)\n (fun n => (hg1 n).inter (hV.1 n))\n (fun n => (hg2 n).inter_of_isOpen_left (hd.mono (by simp [hV.2, iInter_subset])) (hg1 n))\n have h_inter_eq : \u22c2 n, g n \u2229 V n = \u22c2 n, f n := by ext; simp_all; grind\n exact Subtype.dense_iff.mpr fun a _ \u21a6 h_inter_eq \u25b8 h_inter_dense a\n\n/-- If `p : Y \u2192 X` is an open embedding and `X` is a Baire space, then `Y` is a Baire space. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Baire.Lemmas.eventually_residual (L145-L149)\ntheorem eventually_residual {p : X \u2192 Prop} :\n (\u2200\u1da0 x in residual X, p x) \u2194 \u2203 t : Set X, IsG\u03b4 t \u2227 Dense t \u2227 \u2200 x \u2208 t, p x := by\nsimp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]\n tauto\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iInter_of_isOpen_nat (L64-L68)\ntheorem dense_iInter_of_isOpen_nat {f : \u2115 \u2192 Set X} (ho : \u2200 n, IsOpen (f n))\n (hd : \u2200 n, Dense (f n)) : Dense (\u22c2 n, f n) :=\nBaireSpace.baire_property f ho hd\n\n/-- A dense G\u03b4 subset of a Baire space is Baire. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iInter_of_isOpen (L130-L134)\ntheorem dense_iInter_of_isOpen [Countable \u03b9] {f : \u03b9 \u2192 Set X} (ho : \u2200 i, IsOpen (f i))\n (hd : \u2200 i, Dense (f i)) : Dense (\u22c2 s, f s) :=\ndense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd)\n\n/-- A set is residual (comeagre) if and only if it includes a dense `G\u03b4` set. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_of_mem_residual (L150-L157)\ntheorem dense_of_mem_residual {s : Set X} (hs : s \u2208 residual X) : Dense s :=\nlet \u27e8_, hts, _, hd\u27e9 := mem_residual.1 hs\n hd.mono hts\n\n/--\nIn a Baire space, every nonempty open set is non\u2010meagre,\nthat is, it cannot be written as a countable union of nowhere\u2010dense sets.\n-/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_biInter_of_isOpen (L123-L129)\ntheorem dense_biInter_of_isOpen {S : Set \u03b1} {f : \u03b1 \u2192 Set X} (ho : \u2200 s \u2208 S, IsOpen (f s))\n (hS : S.Countable) (hd : \u2200 s \u2208 S, Dense (f s)) : Dense (\u22c2 s \u2208 S, f s) := by\nrw [\u2190 sInter_image]\n refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable type. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iInter_of_G\u03b4 (L172-L177)\ntheorem dense_iInter_of_G\u03b4 [Countable \u03b9] {f : \u03b9 \u2192 Set X} (ho : \u2200 s, IsG\u03b4 (f s))\n (hd : \u2200 s, Dense (f s)) : Dense (\u22c2 s, f s) :=\ndense_sInter_of_G\u03b4 (forall_mem_range.2 \u2039_\u203a) (countable_range _) (forall_mem_range.2 \u2039_\u203a)\n\n/-- Baire theorem: a countable intersection of dense G\u03b4 sets is dense. Formulated here with\nan index set which is a countable set in any type. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Baire.Lemmas.baire_of_finite (L58-L63)\ntheorem baire_of_finite [Finite X] : BaireSpace X where\n baire_property f _ _ := sInter_range f \u25b8 (toFinite (range f)).dense_sInter (by grind) (by grind)\nvariable [BaireSpace X]\n\n/-- Definition of a Baire space. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_biUnion_interior_of_closed (L225-L230)\ntheorem dense_biUnion_interior_of_closed {S : Set \u03b1} {f : \u03b1 \u2192 Set X} (hc : \u2200 s \u2208 S, IsClosed (f s))\n (hS : S.Countable) (hU : \u22c3 s \u2208 S, f s = univ) : Dense (\u22c3 s \u2208 S, interior (f s)) :=\nIsG\u03b4.univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge\n\n/-- Baire theorem: if countably many closed sets cover the whole space, then their interiors\nare dense. Formulated here with `\u22c3\u2080`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Baire.Lemmas.not_isMeagre_of_isOpen (L158-L164)\ntheorem not_isMeagre_of_isOpen {s : Set X} (hs : IsOpen s) (hne : s.Nonempty) : \u00ac IsMeagre s := by\nintro h\n obtain \u27e8x, hx, hxc\u27e9 :=\n (dense_of_mem_residual (by rwa [IsMeagre] at h)).inter_open_nonempty s hs hne\n exact hxc hx\n\n/-- Baire theorem: a countable intersection of dense G\u03b4 sets is dense. Formulated here with \u22c2\u2080. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_biInter_of_G\u03b4 (L178-L184)\ntheorem dense_biInter_of_G\u03b4 {S : Set \u03b1} {f : \u2200 x \u2208 S, Set X} (ho : \u2200 s (H : s \u2208 S), IsG\u03b4 (f s H))\n (hS : S.Countable) (hd : \u2200 s (H : s \u2208 S), Dense (f s H)) : Dense (\u22c2 s \u2208 S, f s \u2039_\u203a) := by\nrw [biInter_eq_iInter]\n haveI := hS.to_subtype\n exact dense_iInter_of_G\u03b4 (fun s => ho s s.2) fun s => hd s s.2\n\n/-- Baire theorem: the intersection of two dense G\u03b4 sets is dense. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Baire.Lemmas.not_isMeagre_of_mem_residual (L258-L264)\ntheorem not_isMeagre_of_mem_residual {s : Set X} (hs : s \u2208 residual X) :\n \u00ac IsMeagre s := by\nrcases (mem_residual (X := X)).1 hs with \u27e8t, ht_sub, htG\u03b4, ht_dense\u27e9\n intro hs_meagre\n exact not_isMeagre_of_isG\u03b4_of_dense (X := X) htG\u03b4 ht_dense (hs_meagre.mono ht_sub)\n\nend BaireTheorem\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_iUnion_interior_of_closed (L237-L244)\ntheorem dense_iUnion_interior_of_closed [Countable \u03b9] {f : \u03b9 \u2192 Set X} (hc : \u2200 i, IsClosed (f i))\n (hU : \u22c3 i, f i = univ) : Dense (\u22c3 i, interior (f i)) :=\nIsG\u03b4.univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge\n\nvariable [Nonempty X]\n\n/-- One of the most useful consequences of Baire theorem: if a countable union of closed sets\ncovers the space, then one of the sets has nonempty interior. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_sInter_of_isOpen (L114-L122)\ntheorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : \u2200 s \u2208 S, IsOpen s) (hS : S.Countable)\n (hd : \u2200 s \u2208 S, Dense s) : Dense (\u22c2\u2080 S) := by\nrcases S.eq_empty_or_nonempty with h | h\n \u00b7 simp [h]\n \u00b7 rcases hS.exists_eq_range h with \u27e8f, rfl\u27e9\n exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd)\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with\nan index set which is a countable set in any type. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Baire.Lemmas.dense_sUnion_interior_of_closed (L231-L236)\ntheorem dense_sUnion_interior_of_closed {S : Set (Set X)} (hc : \u2200 s \u2208 S, IsClosed s)\n (hS : S.Countable) (hU : \u22c3\u2080 S = univ) : Dense (\u22c3 s \u2208 S, interior s) :=\nIsG\u03b4.univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge\n\n/-- Baire theorem: if countably many closed sets cover the whole space, then their interiors\nare dense. Formulated here with an index set which is a countable type. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Baire.Lemmas.mem_residual (L135-L144)\ntheorem mem_residual {s : Set X} : s \u2208 residual X \u2194 \u2203 t \u2286 s, IsG\u03b4 t \u2227 Dense t := by\nconstructor\n \u00b7 rw [mem_residual_iff]\n rintro \u27e8S, hSo, hSd, Sct, Ss\u27e9\n refine \u27e8_, Ss, \u27e8_, fun t ht => hSo _ ht, Sct, rfl\u27e9, ?_\u27e9\n exact dense_sInter_of_isOpen hSo Sct hSd\n rintro \u27e8t, ts, ho, hd\u27e9\n exact mem_of_superset (residual_of_dense_G\u03b4 ho hd) ts\n\n/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `G\u03b4` set. -/\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Baire.Lemmas.not_isMeagre_of_isG\u03b4_of_dense (L250-L257)\ntheorem not_isMeagre_of_isG\u03b4_of_dense {s : Set X} (hs : IsG\u03b4 s) (hd : Dense s) :\n \u00ac IsMeagre s := by\nintro h\n rcases mem_residual.1 h with \u27e8t, hts, htG, hd'\u27e9\n rcases (hd.inter_of_G\u03b4 hs htG hd').nonempty with \u27e8x, hx\u2081, hx\u2082\u27e9\n exact hts hx\u2082 hx\u2081\n\n/-- In a nonempty Baire space, a residual set is not meagre. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Baire.LocallyCompactRegular.IsG\u03b4 (L62-L72)\ntheorem IsG\u03b4.of_t2Space_locallyCompactSpace (hG : IsG\u03b4 s) : BaireSpace s := by\nhave : BaireSpace (closure s) := by\n convert BaireSpace.of_t2Space_locallyCompactSpace using 1\n \u00b7 infer_instance\n \u00b7 exact isClosed_closure.locallyCompactSpace\n have : BaireSpace ((\u2191) \u207b\u00b9' s : Set (closure s)) :=\n (isG\u03b4_induced continuous_subtype_val hG).baireSpace_of_dense\n (by simp [Subtype.dense_iff, inter_eq_right.mpr subset_closure])\n have h_homeo : Homeomorph ((\u2191) \u207b\u00b9' s : Set (closure s)) s := \u27e8\u27e8fun x => \u27e8x, x.2\u27e9,\n fun x => \u27e8\u27e8x, subset_closure x.2\u27e9, x.2\u27e9, by grind, by grind\u27e9, by fun_prop, by fun_prop\u27e9\n exact h_homeo.baireSpace\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Baire.Lemmas.IsOpen (L110-L113)\ntheorem IsOpen.baireSpace {s : Set X} (hO : IsOpen s) : BaireSpace s :=\nhO.isOpenEmbedding_subtypeVal.baireSpace\n\n/-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with \u22c2\u2080. -/\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Baire.Lemmas.Dense (L185-L191)\ntheorem Dense.inter_of_G\u03b4 {s t : Set X} (hs : IsG\u03b4 s) (ht : IsG\u03b4 t) (hsc : Dense s)\n (htc : Dense t) : Dense (s \u2229 t) := by\nrw [inter_eq_iInter]\n apply dense_iInter_of_G\u03b4 <;> simp [Bool.forall_bool, *]\n\n/-- If a countable family of closed sets cover a dense `G\u03b4` set, then the union of their interiors\nis dense. Formulated here with `\u22c3`. -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Baire.Lemmas.nonempty_interior_of_iUnion_of_closed (L245-L249)\ntheorem nonempty_interior_of_iUnion_of_closed [Countable \u03b9] {f : \u03b9 \u2192 Set X}\n (hc : \u2200 i, IsClosed (f i)) (hU : \u22c3 i, f i = univ) : \u2203 i, (interior <| f i).Nonempty := by\nsimpa using (dense_iUnion_interior_of_closed hc hU).nonempty\n\n/-- In a nonempty Baire space, any dense `G\u03b4` set is not meagre. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Baire.Lemmas.Topology (L81-L109)\ntheorem Topology.IsOpenEmbedding.baireSpace {Y : Type*} [TopologicalSpace Y] {p : Y \u2192 X}\n (hp : Topology.IsOpenEmbedding p) : BaireSpace Y := by\nconstructor\n intro f hof hdf\n let s := range p\n let c := fun n : \u2115 => p '' f n \u222a (closure s)\u1d9c\n have c_open (n : \u2115) : IsOpen (c n) := IsOpen.union (hp.isOpenMap (f n) (hof n))\n isClosed_closure.isOpen_compl\n have c_dense (n : \u2115) : Dense (c n) := by\n rw [dense_iff_closure_eq, subset_antisymm_iff]\n have : univ \u2286 closure (c n) := calc\n _ \u2286 (interior (closure s)) \u222a (interior (closure s))\u1d9c := by grind\n _ \u2286 closure s \u222a (interior (closure s))\u1d9c := by gcongr; exact interior_subset\n _ \u2286 closure (p '' f n) \u222a (interior (closure s))\u1d9c := union_subset_union\n (closure_minimal (hp.continuous.range_subset_closure_image_dense (hdf n))\n isClosed_closure) (subset_refl (interior (closure s))\u1d9c)\n _ \u2286 closure (p '' f n) \u222a closure ((closure s)\u1d9c) := union_subset_union (by simp) (by simp)\n _ = closure (c n) := closure_union.symm\n grind\n have c_inter_dense : Dense (\u22c2 n, c n) := dense_iInter_of_isOpen_nat c_open c_dense\n have c_inter_eq : \u22c2 n, f n = p \u207b\u00b9' (\u22c2 n, c n) := by\n ext x\n simp only [mem_iInter, mem_preimage, mem_union, mem_compl_iff, c]\n refine \u27e8fun h i => by grind, fun h i => ?_\u27e9\n exact hp.injective.mem_set_image.mp (imp_iff_or_not.mpr (h i)\n (subset_closure (mem_range_self x)))\n exact c_inter_eq \u25b8 Dense.preimage c_inter_dense hp.isOpenMap\n\n/-- An open subset of a Baire space is Baire. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Baire/BaireMeasurable.lean", "module": "Mathlib.Topology.Baire.BaireMeasurable", "declaration": "Mathlib.Topology.Baire.BaireMeasurable.MeasurableSet", "span": "L134-L146", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Baire/BaireMeasurable.lean#L134"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 7333, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 19402, "lean_code_chars": 17733, "natural_language_chars": 1669, "lean_code_ratio": 0.914, "line_count": 530, "imports_count": 0, "declarations_count": 2204, "diagnostics_count": 0, "retrieval_snippets_count": 46, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "fc65bb914f714443", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Order.Closure.closure_sup_closure", "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.Order.Closure)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem closure_sup_closure (x y : \u03b1) : u (l (u (l x) \u2294 u (l y))) = u (l (x \u2294 y))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Closure.conjBy (L87-L97)\ndef conjBy {\u03b1 \u03b2} [Preorder \u03b1] [Preorder \u03b2] (c : ClosureOperator \u03b1)\n (e : \u03b1 \u2243o \u03b2) : ClosureOperator \u03b2 where\n toFun := e.conj c\nIsClosed b := c.IsClosed (e.symm b)\n monotone' _ _ h :=\n (map_le_map_iff e).mpr <| c.monotone <| (map_le_map_iff e.symm).mpr h\n le_closure' _ := e.symm_apply_le.mp (c.le_closure' _)\n idempotent' _ :=\n congrArg e <| Eq.trans (congrArg c (e.symm_apply_apply _)) (c.idempotent' _)\n isClosed_iff := Iff.trans c.isClosed_iff e.eq_symm_apply\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Closure.conjBy_refl (L98-L100)\nlemma conjBy_refl {\u03b1} [Preorder \u03b1] (c : ClosureOperator \u03b1) :\n c.conjBy (OrderIso.refl \u03b1) = c := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Closure.conjBy_trans (L101-L109)\nlemma conjBy_trans {\u03b1 \u03b2 \u03b3} [Preorder \u03b1] [Preorder \u03b2] [Preorder \u03b3]\n (e\u2081 : \u03b1 \u2243o \u03b2) (e\u2082 : \u03b2 \u2243o \u03b3) (c : ClosureOperator \u03b1) :\n c.conjBy (e\u2081.trans e\u2082) = (c.conjBy e\u2081).conjBy e\u2082 := rfl\nsection PartialOrder\n\nvariable [PartialOrder \u03b1]\n\n/-- The identity function as a closure operator. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Closure.id (L111-L116)\ndef id : ClosureOperator \u03b1 where\n toOrderHom := OrderHom.id\nle_closure' _ := le_rfl\n idempotent' _ := rfl\n IsClosed _ := True\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Closure.ext (L124-L127)\ntheorem ext : \u2200 c\u2081 c\u2082 : ClosureOperator \u03b1, (\u2200 x, c\u2081 x = c\u2082 x) \u2192 c\u2081 = c\u2082 :=\nDFunLike.ext\n\n/-- Constructor for a closure operator using the weaker idempotency axiom: `f (f x) \u2264 f x`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Closure.mk' (L129-L137)\ndef mk' (f : \u03b1 \u2192 \u03b1) (hf\u2081 : Monotone f) (hf\u2082 : \u2200 x, x \u2264 f x) (hf\u2083 : \u2200 x, f (f x) \u2264 f x) :\n ClosureOperator \u03b1 where\n toFun := f\nmonotone' := hf\u2081\n le_closure' := hf\u2082\n idempotent' x := (hf\u2083 x).antisymm (hf\u2081 (hf\u2082 x))\n\n/-- Convenience constructor for a closure operator using the weaker minimality axiom:\n`x \u2264 f y \u2192 f x \u2264 f y`, which is sometimes easier to prove in practice. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Closure.mk\u2082 (L139-L147)\ndef mk\u2082 (f : \u03b1 \u2192 \u03b1) (hf : \u2200 x, x \u2264 f x) (hmin : \u2200 \u2983x y\u2984, x \u2264 f y \u2192 f x \u2264 f y) :\n ClosureOperator \u03b1 where\n toFun := f\nmonotone' _ y hxy := hmin (hxy.trans (hf y))\n le_closure' := hf\n idempotent' _ := (hmin le_rfl).antisymm (hf _)\n\n/-- Construct a closure operator from an inflationary function `f` and a \"closedness\" predicate `p`\nwitnessing minimality of `f x` among closed elements greater than `x`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Closure.ofPred (L149-L154)\ndef ofPred (f : \u03b1 \u2192 \u03b1) (p : \u03b1 \u2192 Prop) (hf : \u2200 x, x \u2264 f x) (hfp : \u2200 x, p (f x))\n (hmin : \u2200 \u2983x y\u2984, x \u2264 y \u2192 p y \u2192 f x \u2264 y) : ClosureOperator \u03b1 where\n __ := mk\u2082 f hf fun _ y hxy => hmin hxy (hfp y)\nIsClosed := p\n isClosed_iff := \u27e8fun hx \u21a6 (hmin le_rfl hx).antisymm <| hf _, fun hx \u21a6 hx \u25b8 hfp _\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Closure.monotone (L156-L160)\ntheorem monotone : Monotone c :=\nc.monotone'\n\n/-- Every element is less than its closure. This property is sometimes referred to as extensivity or\ninflationarity. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Closure.le_closure (L161-L163)\ntheorem le_closure (x : \u03b1) : x \u2264 c x :=\nc.le_closure' x\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Closure.idempotent (L165-L167)\ntheorem idempotent (x : \u03b1) : c (c x) = c x :=\nc.idempotent' x\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Closure.Closeds (L171-L173)\nabbrev Closeds := {x // c.IsClosed x}\n/-- Send an element to a closed element (by taking the closure). -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Closure.toCloseds (L174-L177)\ndef toCloseds (x : \u03b1) : c.Closeds := \u27e8c x, c.isClosed_closure x\u27e9\nvariable {c} {x y : \u03b1}\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Closure.IsClosed (L178-L179)\ntheorem IsClosed.closure_eq : c.IsClosed x \u2192 c x = x := c.isClosed_iff.1\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.Closure.isClosed_iff_closure_le (L180-L183)\ntheorem isClosed_iff_closure_le : c.IsClosed x \u2194 c x \u2264 x :=\n\u27e8fun h \u21a6 h.closure_eq.le, fun h \u21a6 c.isClosed_iff.2 <| h.antisymm <| c.le_closure x\u27e9\n\n/-- The set of closed elements for `c` is exactly its range. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.Closure.setOf_isClosed_eq_range_closure (L184-L186)\ntheorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by\next x; exact \u27e8fun hx \u21a6 \u27e8x, hx.closure_eq\u27e9, by rintro \u27e8y, rfl\u27e9; exact c.isClosed_closure _\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.Closure.le_closure_iff (L187-L189)\ntheorem le_closure_iff : x \u2264 c y \u2194 c x \u2264 c y :=\n\u27e8fun h \u21a6 c.idempotent y \u25b8 c.monotone h, (c.le_closure x).trans\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.Closure.IsClosed (L191-L193)\ntheorem IsClosed.closure_le_iff (hy : c.IsClosed y) : c x \u2264 y \u2194 x \u2264 y := by\nrw [\u2190 hy.closure_eq, \u2190 le_closure_iff]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.Closure.closure_min (L194-L195)\nlemma closure_min (hxy : x \u2264 y) (hy : c.IsClosed y) : c x \u2264 y := hy.closure_le_iff.2 hxy\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.Closure.closure_isGLB (L196-L199)\nlemma closure_isGLB (x : \u03b1) : IsGLB { y | x \u2264 y \u2227 c.IsClosed y } (c x) where\n left _ := and_imp.mpr closure_min\nright _ h := h \u27e8c.le_closure x, c.isClosed_closure x\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.Closure.ext_isClosed (L200-L205)\ntheorem ext_isClosed (c\u2081 c\u2082 : ClosureOperator \u03b1)\n (h : \u2200 x, c\u2081.IsClosed x \u2194 c\u2082.IsClosed x) : c\u2081 = c\u2082 :=\next c\u2081 c\u2082 <| fun x => IsGLB.unique (c\u2081.closure_isGLB x) <| by simpa [h] using c\u2082.closure_isGLB x\n\n/-- A closure operator is equal to the closure operator obtained by feeding `c.closed` into the\n`ofPred` constructor. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.Closure.eq_ofPred_closed (L206-L218)\ntheorem eq_ofPred_closed (c : ClosureOperator \u03b1) :\n c = ofPred c c.IsClosed c.le_closure c.isClosed_closure fun _ _ \u21a6 closure_min := by\next\n simp\n\nend PartialOrder\n\nvariable {\u03b1}\n\nsection OrderTop\n\nvariable [PartialOrder \u03b1] [OrderTop \u03b1] (c : ClosureOperator \u03b1)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.Closure.closure_top (L220-L222)\ntheorem closure_top : c \u22a4 = \u22a4 :=\nle_top.antisymm (c.le_closure _)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.Closure.closure_inf_le (L227-L234)\ntheorem closure_inf_le [SemilatticeInf \u03b1] (c : ClosureOperator \u03b1) (x y : \u03b1) :\n c (x \u2293 y) \u2264 c x \u2293 c y :=\nc.monotone.map_inf_le _ _\n\nsection SemilatticeSup\n\nvariable [SemilatticeSup \u03b1] (c : ClosureOperator \u03b1)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.Closure.closure_sup_closure_le (L235-L237)\ntheorem closure_sup_closure_le (x y : \u03b1) : c x \u2294 c y \u2264 c (x \u2294 y) :=\nc.monotone.le_map_sup _ _\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.Order.Closure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem closure_sup_closure (x y : \u03b1) : u (l (u (l x) \u2294 u (l y))) = u (l (x \u2294 y))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Closure.conjBy (L87-L97)\ndef conjBy {\u03b1 \u03b2} [Preorder \u03b1] [Preorder \u03b2] (c : ClosureOperator \u03b1)\n (e : \u03b1 \u2243o \u03b2) : ClosureOperator \u03b2 where\n toFun := e.conj c\nIsClosed b := c.IsClosed (e.symm b)\n monotone' _ _ h :=\n (map_le_map_iff e).mpr <| c.monotone <| (map_le_map_iff e.symm).mpr h\n le_closure' _ := e.symm_apply_le.mp (c.le_closure' _)\n idempotent' _ :=\n congrArg e <| Eq.trans (congrArg c (e.symm_apply_apply _)) (c.idempotent' _)\n isClosed_iff := Iff.trans c.isClosed_iff e.eq_symm_apply\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Closure.conjBy_refl (L98-L100)\nlemma conjBy_refl {\u03b1} [Preorder \u03b1] (c : ClosureOperator \u03b1) :\n c.conjBy (OrderIso.refl \u03b1) = c := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Closure.conjBy_trans (L101-L109)\nlemma conjBy_trans {\u03b1 \u03b2 \u03b3} [Preorder \u03b1] [Preorder \u03b2] [Preorder \u03b3]\n (e\u2081 : \u03b1 \u2243o \u03b2) (e\u2082 : \u03b2 \u2243o \u03b3) (c : ClosureOperator \u03b1) :\n c.conjBy (e\u2081.trans e\u2082) = (c.conjBy e\u2081).conjBy e\u2082 := rfl\nsection PartialOrder\n\nvariable [PartialOrder \u03b1]\n\n/-- The identity function as a closure operator. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Closure.id (L111-L116)\ndef id : ClosureOperator \u03b1 where\n toOrderHom := OrderHom.id\nle_closure' _ := le_rfl\n idempotent' _ := rfl\n IsClosed _ := True\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Closure.ext (L124-L127)\ntheorem ext : \u2200 c\u2081 c\u2082 : ClosureOperator \u03b1, (\u2200 x, c\u2081 x = c\u2082 x) \u2192 c\u2081 = c\u2082 :=\nDFunLike.ext\n\n/-- Constructor for a closure operator using the weaker idempotency axiom: `f (f x) \u2264 f x`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Closure.mk' (L129-L137)\ndef mk' (f : \u03b1 \u2192 \u03b1) (hf\u2081 : Monotone f) (hf\u2082 : \u2200 x, x \u2264 f x) (hf\u2083 : \u2200 x, f (f x) \u2264 f x) :\n ClosureOperator \u03b1 where\n toFun := f\nmonotone' := hf\u2081\n le_closure' := hf\u2082\n idempotent' x := (hf\u2083 x).antisymm (hf\u2081 (hf\u2082 x))\n\n/-- Convenience constructor for a closure operator using the weaker minimality axiom:\n`x \u2264 f y \u2192 f x \u2264 f y`, which is sometimes easier to prove in practice. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Closure.mk\u2082 (L139-L147)\ndef mk\u2082 (f : \u03b1 \u2192 \u03b1) (hf : \u2200 x, x \u2264 f x) (hmin : \u2200 \u2983x y\u2984, x \u2264 f y \u2192 f x \u2264 f y) :\n ClosureOperator \u03b1 where\n toFun := f\nmonotone' _ y hxy := hmin (hxy.trans (hf y))\n le_closure' := hf\n idempotent' _ := (hmin le_rfl).antisymm (hf _)\n\n/-- Construct a closure operator from an inflationary function `f` and a \"closedness\" predicate `p`\nwitnessing minimality of `f x` among closed elements greater than `x`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Closure.ofPred (L149-L154)\ndef ofPred (f : \u03b1 \u2192 \u03b1) (p : \u03b1 \u2192 Prop) (hf : \u2200 x, x \u2264 f x) (hfp : \u2200 x, p (f x))\n (hmin : \u2200 \u2983x y\u2984, x \u2264 y \u2192 p y \u2192 f x \u2264 y) : ClosureOperator \u03b1 where\n __ := mk\u2082 f hf fun _ y hxy => hmin hxy (hfp y)\nIsClosed := p\n isClosed_iff := \u27e8fun hx \u21a6 (hmin le_rfl hx).antisymm <| hf _, fun hx \u21a6 hx \u25b8 hfp _\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Order.Closure.monotone (L156-L160)\ntheorem monotone : Monotone c :=\nc.monotone'\n\n/-- Every element is less than its closure. This property is sometimes referred to as extensivity or\ninflationarity. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Order.Closure.le_closure (L161-L163)\ntheorem le_closure (x : \u03b1) : x \u2264 c x :=\nc.le_closure' x\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Order.Closure.idempotent (L165-L167)\ntheorem idempotent (x : \u03b1) : c (c x) = c x :=\nc.idempotent' x\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Order.Closure.Closeds (L171-L173)\nabbrev Closeds := {x // c.IsClosed x}\n/-- Send an element to a closed element (by taking the closure). -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Order.Closure.toCloseds (L174-L177)\ndef toCloseds (x : \u03b1) : c.Closeds := \u27e8c x, c.isClosed_closure x\u27e9\nvariable {c} {x y : \u03b1}\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Order.Closure.IsClosed (L178-L179)\ntheorem IsClosed.closure_eq : c.IsClosed x \u2192 c x = x := c.isClosed_iff.1\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Order.Closure.isClosed_iff_closure_le (L180-L183)\ntheorem isClosed_iff_closure_le : c.IsClosed x \u2194 c x \u2264 x :=\n\u27e8fun h \u21a6 h.closure_eq.le, fun h \u21a6 c.isClosed_iff.2 <| h.antisymm <| c.le_closure x\u27e9\n\n/-- The set of closed elements for `c` is exactly its range. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Order.Closure.setOf_isClosed_eq_range_closure (L184-L186)\ntheorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by\next x; exact \u27e8fun hx \u21a6 \u27e8x, hx.closure_eq\u27e9, by rintro \u27e8y, rfl\u27e9; exact c.isClosed_closure _\u27e9\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Order.Closure.le_closure_iff (L187-L189)\ntheorem le_closure_iff : x \u2264 c y \u2194 c x \u2264 c y :=\n\u27e8fun h \u21a6 c.idempotent y \u25b8 c.monotone h, (c.le_closure x).trans\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Order.Closure.IsClosed (L191-L193)\ntheorem IsClosed.closure_le_iff (hy : c.IsClosed y) : c x \u2264 y \u2194 x \u2264 y := by\nrw [\u2190 hy.closure_eq, \u2190 le_closure_iff]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Order.Closure.closure_min (L194-L195)\nlemma closure_min (hxy : x \u2264 y) (hy : c.IsClosed y) : c x \u2264 y := hy.closure_le_iff.2 hxy\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Order.Closure.closure_isGLB (L196-L199)\nlemma closure_isGLB (x : \u03b1) : IsGLB { y | x \u2264 y \u2227 c.IsClosed y } (c x) where\n left _ := and_imp.mpr closure_min\nright _ h := h \u27e8c.le_closure x, c.isClosed_closure x\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Order.Closure.ext_isClosed (L200-L205)\ntheorem ext_isClosed (c\u2081 c\u2082 : ClosureOperator \u03b1)\n (h : \u2200 x, c\u2081.IsClosed x \u2194 c\u2082.IsClosed x) : c\u2081 = c\u2082 :=\next c\u2081 c\u2082 <| fun x => IsGLB.unique (c\u2081.closure_isGLB x) <| by simpa [h] using c\u2082.closure_isGLB x\n\n/-- A closure operator is equal to the closure operator obtained by feeding `c.closed` into the\n`ofPred` constructor. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Order.Closure.eq_ofPred_closed (L206-L218)\ntheorem eq_ofPred_closed (c : ClosureOperator \u03b1) :\n c = ofPred c c.IsClosed c.le_closure c.isClosed_closure fun _ _ \u21a6 closure_min := by\next\n simp\n\nend PartialOrder\n\nvariable {\u03b1}\n\nsection OrderTop\n\nvariable [PartialOrder \u03b1] [OrderTop \u03b1] (c : ClosureOperator \u03b1)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Order.Closure.closure_top (L220-L222)\ntheorem closure_top : c \u22a4 = \u22a4 :=\nle_top.antisymm (c.le_closure _)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Order.Closure.closure_inf_le (L227-L234)\ntheorem closure_inf_le [SemilatticeInf \u03b1] (c : ClosureOperator \u03b1) (x y : \u03b1) :\n c (x \u2293 y) \u2264 c x \u2293 c y :=\nc.monotone.map_inf_le _ _\n\nsection SemilatticeSup\n\nvariable [SemilatticeSup \u03b1] (c : ClosureOperator \u03b1)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Order.Closure.closure_sup_closure_le (L235-L237)\ntheorem closure_sup_closure_le (x y : \u03b1) : c x \u2294 c y \u2264 c (x \u2294 y) :=\nc.monotone.le_map_sup _ _\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Closure.lean", "module": "Mathlib.Order.Closure", "declaration": "Mathlib.Order.Closure.closure_sup_closure", "span": "L432-L440", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Closure.lean#L432"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 2766, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 7024, "lean_code_chars": 5939, "natural_language_chars": 1085, "lean_code_ratio": 0.8455, "line_count": 241, "imports_count": 0, "declarations_count": 812, "diagnostics_count": 0, "retrieval_snippets_count": 25, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "c3088ac534217950", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_le", "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.Topology.Algebra.Group.GroupTopology)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem toTopologicalSpace_le {x y : GroupTopology \u03b1} :\n x.toTopologicalSpace \u2264 y.toTopologicalSpace \u2194 x \u2264 y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.continuous_mul' (L50-L57)\ntheorem continuous_mul' (g : GroupTopology \u03b1) :\n haveI := g.toTopologicalSpace\nContinuous fun p : \u03b1 \u00d7 \u03b1 => p.1 * p.2 := by\n letI := g.toTopologicalSpace\n haveI := g.toIsTopologicalGroup\n exact continuous_mul\n\n/-- A version of the global `continuous_inv` suitable for dot notation. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.continuous_inv' (L59-L65)\ntheorem continuous_inv' (g : GroupTopology \u03b1) :\n haveI := g.toTopologicalSpace\nContinuous (Inv.inv : \u03b1 \u2192 \u03b1) := by\n letI := g.toTopologicalSpace\n haveI := g.toIsTopologicalGroup\n exact continuous_inv\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_injective (L67-L73)\ntheorem toTopologicalSpace_injective :\n Function.Injective (toTopologicalSpace : GroupTopology \u03b1 \u2192 TopologicalSpace \u03b1) :=\nfun f g h => by\n cases f\n cases g\n congr\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.ext' (L75-L79)\ntheorem ext' {f g : GroupTopology \u03b1} (h : f.IsOpen = g.IsOpen) : f = g :=\ntoTopologicalSpace_injective <| TopologicalSpace.ext h\n\n/-- The ordering on group topologies on the group `\u03b3`. `t \u2264 s` if every set open in `s` is also open\nin `t` (`t` is finer than `s`). -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_top (L98-L100)\ntheorem toTopologicalSpace_top : (\u22a4 : GroupTopology \u03b1).toTopologicalSpace = \u22a4 :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_bot (L110-L113)\ntheorem toTopologicalSpace_bot : (\u22a5 : GroupTopology \u03b1).toTopologicalSpace = \u22a5 :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_inf (L123-L126)\ntheorem toTopologicalSpace_inf (x y : GroupTopology \u03b1) :\n (x \u2293 y).toTopologicalSpace = x.toTopologicalSpace \u2293 y.toTopologicalSpace :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_sInf (L142-L144)\ntheorem toTopologicalSpace_sInf (s : Set (GroupTopology \u03b1)) :\n (sInf s).toTopologicalSpace = sInf (toTopologicalSpace '' s) := rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_iInf (L146-L157)\ntheorem toTopologicalSpace_iInf {\u03b9} (s : \u03b9 \u2192 GroupTopology \u03b1) :\n (\u2a05 i, s i).toTopologicalSpace = \u2a05 i, (s i).toTopologicalSpace :=\ncongr_arg sInf (range_comp _ _).symm\n\n/-- Group topologies on `\u03b3` form a complete lattice, with `\u22a5` the discrete topology and `\u22a4` the\nindiscrete topology.\n\nThe infimum of a collection of group topologies is the topology generated by all their open sets\n(which is a group topology).\n\nThe supremum of two group topologies `s` and `t` is the infimum of the family of all group\ntopologies contained in the intersection of `s` and `t`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.coinduced (L184-L187)\ndef coinduced {\u03b1 \u03b2 : Type*} [t : TopologicalSpace \u03b1] [Group \u03b2] (f : \u03b1 \u2192 \u03b2) : GroupTopology \u03b2 :=\nsInf { b : GroupTopology \u03b2 | TopologicalSpace.coinduced f t \u2264 b.toTopologicalSpace }\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.coinduced_continuous (L189-L195)\ntheorem coinduced_continuous {\u03b1 \u03b2 : Type*} [t : TopologicalSpace \u03b1] [Group \u03b2] (f : \u03b1 \u2192 \u03b2) :\n Continuous[t, (coinduced f).toTopologicalSpace] f := by\nrw [continuous_sInf_rng]\n rintro _ \u27e8t', ht', rfl\u27e9\n exact continuous_iff_coinduced_le.2 ht'\n\nend GroupTopology\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.surjective (L348-L353)\ntheorem surjective (e : A \u2243A[R] B) : Function.Surjective e := e.toAlgEquiv.surjective\n/-- `Equiv.cast (congrArg _ h)` as a continuous algebra equiv.\n\nNote that unlike `Equiv.cast`, this takes an equality of indices rather than an equality of types,\nto avoid having to deal with an equality of the algebraic structure itself. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.map_eq_zero_iff (L164-L166)\ntheorem map_eq_zero_iff (e : A \u2243A[R] B) {a : A} : e a = 0 \u2194 a = 0 :=\ne.toAlgEquiv.toLinearEquiv.map_eq_zero_iff\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_toAlgEquiv (L242-L243)\ntheorem symm_toAlgEquiv (e : A \u2243A[R] B) : e.symm.toAlgEquiv = e.toAlgEquiv.symm := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_map_nhds_eq (L251-L254)\ntheorem symm_map_nhds_eq (e : A \u2243A[R] B) (a : A) : Filter.map e.symm (\ud835\udcdd (e a)) = \ud835\udcdd a :=\ne.toHomeomorph.symm_map_nhds_eq a\n\n/-- The composition of two continuous algebra equivalences. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.comp_continuous_iff (L183-L186)\ntheorem comp_continuous_iff {\u03b1 : Type*} [TopologicalSpace \u03b1] (e : A \u2243A[R] B) {f : \u03b1 \u2192 A} :\n Continuous (e \u2218 f) \u2194 Continuous f :=\ne.toHomeomorph.comp_continuous_iff\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_bijective (L306-L308)\ntheorem symm_bijective : Function.Bijective (symm : (A \u2243A[R] B) \u2192 _) :=\nFunction.bijective_iff_has_inverse.mpr \u27e8_, symm_symm, symm_symm\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousWithinAt (L179-L182)\ntheorem continuousWithinAt (e : A \u2243A[R] B) {S : Set A} {a : A} :\n ContinuousWithinAt e S a :=\ne.continuous.continuousWithinAt\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans_toAlgEquiv (L262-L265)\ntheorem trans_toAlgEquiv (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) :\n (e\u2081.trans e\u2082).toAlgEquiv = e\u2081.toAlgEquiv.trans e\u2082.toAlgEquiv :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.preimage_symm_preimage (L331-L333)\ntheorem preimage_symm_preimage (e : A \u2243A[R] B) (S : Set A) : e \u207b\u00b9' (e.symm \u207b\u00b9' S) = S :=\ne.symm.symm_preimage_preimage S\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.map_nhds_eq (L161-L163)\ntheorem map_nhds_eq (e : A \u2243A[R] B) (a : A) : Filter.map e (\ud835\udcdd a) = \ud835\udcdd (e a) :=\ne.toHomeomorph.map_nhds_eq a\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAt (L176-L178)\ntheorem continuousAt (e : A \u2243A[R] B) {a : A} : ContinuousAt e a :=\ne.continuous.continuousAt\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.self_comp_symm (L300-L302)\ntheorem self_comp_symm (e : A \u2243A[R] B) : (e : A \u2192 B) \u2218 e.symm = id :=\nfunext <| e.apply_symm_apply\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_image_image (L234-L236)\ntheorem symm_image_image (e : A \u2243A[R] B) (S : Set A) : e.symm '' (e '' S) = S :=\ne.toEquiv.symm_image_image S\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_symm_apply (L312-L313)\ntheorem symm_symm_apply (e : A \u2243A[R] B) (a : A) : e.symm.symm a = e a := rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl (L195-L199)\ndef refl : A \u2243A[R] A where\n __ := AlgEquiv.refl\ncontinuous_toFun := continuous_id\n continuous_invFun := continuous_id\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_apply_apply (L230-L232)\ntheorem symm_apply_apply (e : A \u2243A[R] B) (a : A) : e.symm (e a) = a :=\ne.1.left_inv a\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_symm_eq_preimage (L323-L325)\ntheorem image_symm_eq_preimage (e : A \u2243A[R] B) (S : Set B) : e.symm '' S = e \u207b\u00b9' S := by\nrw [e.symm.image_eq_preimage_symm, e.symm_symm]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.eq_symm_apply (L317-L319)\ntheorem eq_symm_apply (e : A \u2243A[R] B) {a : A} {b : B} : a = e.symm b \u2194 e a = b :=\ne.toEquiv.eq_symm_apply\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Algebra.Algebra.continuous_algebraMap (L48-L51)\ntheorem continuous_algebraMap [ContinuousSMul R A] : Continuous (algebraMap R A) := by\nrw [algebraMap_eq_smul_one']\n fun_prop\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_toHomeomorph (L245-L246)\ntheorem symm_toHomeomorph (e : A \u2243A[R] B) : e.symm.toHomeomorph = e.toHomeomorph.symm := rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_symm_comp_coe (L291-L294)\ntheorem coe_symm_comp_coe (e : A \u2243A[R] B) :\n e.symm.toContinuousAlgHom.comp e = ContinuousAlgHom.id R A :=\nContinuousAlgHom.ext e.symm_apply_apply\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuous (L171-L172)\ntheorem continuous (e : A \u2243A[R] B) : Continuous e := e.continuous_toFun\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm (L220-L224)\ndef symm (e : A \u2243A[R] B) : B \u2243A[R] A where\n __ := e.toAlgEquiv.symm\ncontinuous_toFun := e.continuous_invFun\n continuous_invFun := e.continuous_toFun\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coeCLE_refl (L207-L208)\ntheorem coeCLE_refl : (refl R A).toContinuousLinearEquiv = ContinuousLinearEquiv.refl R A := rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.cast (L354-L360)\ndef cast {\u03b9 : Type*} {A : \u03b9 \u2192 Type*} [(i : \u03b9) \u2192 Semiring (A i)] [(i : \u03b9) \u2192 Algebra R (A i)]\n [(i : \u03b9) \u2192 TopologicalSpace (A i)] {i j : \u03b9} (h : i = j) :\n A i \u2243A[R] A j where\n __ := AlgEquiv.cast h\ncontinuous_toFun := by cases h; exact continuous_id\n continuous_invFun := by cases h; exact continuous_id\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.cast_symm_apply (L367-L371)\ntheorem cast_symm_apply {\u03b9 : Type*} {A : \u03b9 \u2192 Type*} [(i : \u03b9) \u2192 Semiring (A i)]\n [(i : \u03b9) \u2192 Algebra R (A i)] [(i : \u03b9) \u2192 TopologicalSpace (A i)] {i j : \u03b9} (h : i = j)\n (x : A j) : (cast (R := R) h).symm x = Equiv.cast (congrArg A h.symm) x := rfl\nend ContinuousAlgEquiv\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans_apply (L272-L275)\ntheorem trans_apply (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) (a : A) :\n (e\u2081.trans e\u2082) a = e\u2082 (e\u2081 a) :=\nrfl\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans (L256-L260)\ndef trans (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) : A \u2243A[R] C where\n __ := e\u2081.toAlgEquiv.trans e\u2082.toAlgEquiv\ncontinuous_toFun := e\u2082.continuous_toFun.comp e\u2081.continuous_toFun\n continuous_invFun := e\u2081.continuous_invFun.comp e\u2082.continuous_invFun\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.apply_symm_apply (L226-L228)\ntheorem apply_symm_apply (e : A \u2243A[R] B) (b : B) : e (e.symm b) = b :=\ne.1.right_inv b\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_trans_apply (L277-L280)\ntheorem symm_trans_apply (e\u2081 : B \u2243A[R] A) (e\u2082 : C \u2243A[R] B) (a : A) :\n (e\u2082.trans e\u2081).symm a = e\u2082.symm (e\u2081.symm a) :=\nrfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_preimage_preimage (L327-L329)\ntheorem symm_preimage_preimage (e : A \u2243A[R] B) (S : Set B) : e.symm \u207b\u00b9' (e \u207b\u00b9' S) = S :=\ne.toEquiv.symm_preimage_preimage S\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.comp_continuous_iff' (L187-L193)\ntheorem comp_continuous_iff' {\u03b2 : Type*} [TopologicalSpace \u03b2] (e : A \u2243A[R] B) {g : B \u2192 \u03b2} :\n Continuous (g \u2218 e) \u2194 Continuous g :=\ne.toHomeomorph.comp_continuous_iff'\n\nvariable (R A)\n\n/-- The identity isomorphism as a continuous `R`-algebra equivalence. -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousOn (L173-L175)\ntheorem continuousOn (e : A \u2243A[R] B) {S : Set A} : ContinuousOn e S :=\ne.continuous.continuousOn\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_symm_image (L238-L240)\ntheorem image_symm_image (e : A \u2243A[R] B) (S : Set B) : e '' (e.symm '' S) = S :=\ne.symm.symm_image_image S\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Rat.DivisionRing (L26-L30)\ninstance DivisionRing.continuousConstSMul_rat {A} [DivisionRing A] [TopologicalSpace A]\n [SeparatelyContinuousMul A] [CharZero A] : ContinuousConstSMul \u211a A :=\n\u27e8fun r => by simpa only [Algebra.smul_def] using continuous_id.const_mul _\u27e9\n\nend DivisionRing\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_refl' (L210-L211)\ntheorem coe_refl' : \u21d1(refl R A) = id := rfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Topology.Algebra.Algebra.continuous_algebraMap_iff_smul (L52-L57)\ntheorem continuous_algebraMap_iff_smul [ContinuousMul A] :\n Continuous (algebraMap R A) \u2194 Continuous fun p : R \u00d7 A => p.1 \u2022 p.2 := by\nrefine \u27e8fun h => ?_, fun h => have : ContinuousSMul R A := \u27e8h\u27e9; continuous_algebraMap _ _\u27e9\n simp only [Algebra.smul_def]\n exact (h.comp continuous_fst).mul continuous_snd\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_eq_preimage_symm (L320-L322)\ntheorem image_eq_preimage_symm (e : A \u2243A[R] B) (S : Set A) : e '' S = e.symm \u207b\u00b9' S :=\ne.toEquiv.image_eq_preimage_symm S\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_apply_eq (L314-L316)\ntheorem symm_apply_eq (e : A \u2243A[R] B) {a : A} {b : B} : e.symm b = a \u2194 b = e a :=\ne.toEquiv.symm_apply_eq\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_comp_self (L296-L298)\ntheorem symm_comp_self (e : A \u2243A[R] B) : (e.symm : B \u2192 A) \u2218 e = id := by\nexact funext <| e.symm_apply_apply\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_refl (L204-L205)\ntheorem coe_refl : refl R A = ContinuousAlgHom.id R A := rfl\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isUniformEmbedding (L334-L339)\ntheorem isUniformEmbedding {E\u2081 E\u2082 : Type*} [UniformSpace E\u2081] [UniformSpace E\u2082] [Ring E\u2081]\n [IsUniformAddGroup E\u2081] [Algebra R E\u2081] [Ring E\u2082] [IsUniformAddGroup E\u2082] [Algebra R E\u2082]\n (e : E\u2081 \u2243A[R] E\u2082) : IsUniformEmbedding e :=\ne.toAlgEquiv.isUniformEmbedding e.toContinuousAlgHom.uniformContinuous\n e.symm.toContinuousAlgHom.uniformContinuous\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_symm (L304-L305)\ntheorem symm_symm (e : A \u2243A[R] B) : e.symm.symm = e := rfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl_toContinuousLinearEquiv (L213-L218)\ntheorem refl_toContinuousLinearEquiv :\n (refl R A).toContinuousLinearEquiv = .refl R A := rfl\nvariable {R A}\n\n/-- The inverse of a continuous algebra equivalence. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans_toContinuousLinearEquiv (L267-L270)\ntheorem trans_toContinuousLinearEquiv (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) :\n (e\u2081.trans e\u2082).toContinuousLinearEquiv\n = e\u2081.toContinuousLinearEquiv.trans e\u2082.toContinuousLinearEquiv := rfl\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_symm (L248-L250)\ntheorem toContinuousLinearEquiv_symm (e : A \u2243A[R] B) :\n e.symm.toContinuousLinearEquiv = e.toContinuousLinearEquiv.symm := rfl\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Subalgebra (L62-L65)\ninstance Subalgebra.continuousSMul (S : Subalgebra R A) (X) [TopologicalSpace X] [MulAction A X]\n [ContinuousSMul A X] : ContinuousSMul S X :=\nSubsemiring.continuousSMul S.toSubsemiring X\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Topology.Algebra.Algebra.continuousSMul_of_algebraMap (L58-L61)\ntheorem continuousSMul_of_algebraMap [ContinuousMul A] (h : Continuous (algebraMap R A)) :\n ContinuousSMul R A :=\n\u27e8(continuous_algebraMap_iff_smul R A).1 h\u27e9\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.comp_coe (L281-L284)\ntheorem comp_coe (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) :\n e\u2082.toAlgHom.comp e\u2081.toAlgHom = e\u2081.trans e\u2082 := by\nrfl\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_comp_coe_symm (L286-L289)\ntheorem coe_comp_coe_symm (e : A \u2243A[R] B) :\n e.toContinuousAlgHom.comp e.symm = ContinuousAlgHom.id R B :=\nContinuousAlgHom.ext e.apply_symm_apply\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.preimage_closure (L154-L156)\ntheorem preimage_closure (e : A \u2243A[R] B) (S : Set B) : e \u207b\u00b9' closure S = closure (e \u207b\u00b9' S) :=\ne.toHomeomorph.preimage_closure S\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isClosed_image (L158-L160)\ntheorem isClosed_image (e : A \u2243A[R] B) {S : Set A} : IsClosed (e '' S) \u2194 IsClosed S :=\ne.toHomeomorph.isClosed_image\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl_symm (L310-L311)\ntheorem refl_symm : (refl R A).symm = refl R A := rfl\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.cast_apply (L362-L365)\ntheorem cast_apply {\u03b9 : Type*} {A : \u03b9 \u2192 Type*} [(i : \u03b9) \u2192 Semiring (A i)]\n [(i : \u03b9) \u2192 Algebra R (A i)] [(i : \u03b9) \u2192 TopologicalSpace (A i)] {i j : \u03b9} (h : i = j) (x : A i) :\n cast (R := R) h x = Equiv.cast (congrArg A h) x := rfl\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl_apply (L201-L202)\ntheorem refl_apply (a : A) : refl R A a = a := rfl\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.Topology.Algebra.Group.GroupTopology).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem toTopologicalSpace_le {x y : GroupTopology \u03b1} :\n x.toTopologicalSpace \u2264 y.toTopologicalSpace \u2194 x \u2264 y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.continuous_mul' (L50-L57)\ntheorem continuous_mul' (g : GroupTopology \u03b1) :\n haveI := g.toTopologicalSpace\nContinuous fun p : \u03b1 \u00d7 \u03b1 => p.1 * p.2 := by\n letI := g.toTopologicalSpace\n haveI := g.toIsTopologicalGroup\n exact continuous_mul\n\n/-- A version of the global `continuous_inv` suitable for dot notation. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.continuous_inv' (L59-L65)\ntheorem continuous_inv' (g : GroupTopology \u03b1) :\n haveI := g.toTopologicalSpace\nContinuous (Inv.inv : \u03b1 \u2192 \u03b1) := by\n letI := g.toTopologicalSpace\n haveI := g.toIsTopologicalGroup\n exact continuous_inv\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_injective (L67-L73)\ntheorem toTopologicalSpace_injective :\n Function.Injective (toTopologicalSpace : GroupTopology \u03b1 \u2192 TopologicalSpace \u03b1) :=\nfun f g h => by\n cases f\n cases g\n congr\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.ext' (L75-L79)\ntheorem ext' {f g : GroupTopology \u03b1} (h : f.IsOpen = g.IsOpen) : f = g :=\ntoTopologicalSpace_injective <| TopologicalSpace.ext h\n\n/-- The ordering on group topologies on the group `\u03b3`. `t \u2264 s` if every set open in `s` is also open\nin `t` (`t` is finer than `s`). -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_top (L98-L100)\ntheorem toTopologicalSpace_top : (\u22a4 : GroupTopology \u03b1).toTopologicalSpace = \u22a4 :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_bot (L110-L113)\ntheorem toTopologicalSpace_bot : (\u22a5 : GroupTopology \u03b1).toTopologicalSpace = \u22a5 :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_inf (L123-L126)\ntheorem toTopologicalSpace_inf (x y : GroupTopology \u03b1) :\n (x \u2293 y).toTopologicalSpace = x.toTopologicalSpace \u2293 y.toTopologicalSpace :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_sInf (L142-L144)\ntheorem toTopologicalSpace_sInf (s : Set (GroupTopology \u03b1)) :\n (sInf s).toTopologicalSpace = sInf (toTopologicalSpace '' s) := rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_iInf (L146-L157)\ntheorem toTopologicalSpace_iInf {\u03b9} (s : \u03b9 \u2192 GroupTopology \u03b1) :\n (\u2a05 i, s i).toTopologicalSpace = \u2a05 i, (s i).toTopologicalSpace :=\ncongr_arg sInf (range_comp _ _).symm\n\n/-- Group topologies on `\u03b3` form a complete lattice, with `\u22a5` the discrete topology and `\u22a4` the\nindiscrete topology.\n\nThe infimum of a collection of group topologies is the topology generated by all their open sets\n(which is a group topology).\n\nThe supremum of two group topologies `s` and `t` is the infimum of the family of all group\ntopologies contained in the intersection of `s` and `t`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.coinduced (L184-L187)\ndef coinduced {\u03b1 \u03b2 : Type*} [t : TopologicalSpace \u03b1] [Group \u03b2] (f : \u03b1 \u2192 \u03b2) : GroupTopology \u03b2 :=\nsInf { b : GroupTopology \u03b2 | TopologicalSpace.coinduced f t \u2264 b.toTopologicalSpace }\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Group.GroupTopology.coinduced_continuous (L189-L195)\ntheorem coinduced_continuous {\u03b1 \u03b2 : Type*} [t : TopologicalSpace \u03b1] [Group \u03b2] (f : \u03b1 \u2192 \u03b2) :\n Continuous[t, (coinduced f).toTopologicalSpace] f := by\nrw [continuous_sInf_rng]\n rintro _ \u27e8t', ht', rfl\u27e9\n exact continuous_iff_coinduced_le.2 ht'\n\nend GroupTopology\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.surjective (L348-L353)\ntheorem surjective (e : A \u2243A[R] B) : Function.Surjective e := e.toAlgEquiv.surjective\n/-- `Equiv.cast (congrArg _ h)` as a continuous algebra equiv.\n\nNote that unlike `Equiv.cast`, this takes an equality of indices rather than an equality of types,\nto avoid having to deal with an equality of the algebraic structure itself. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.map_eq_zero_iff (L164-L166)\ntheorem map_eq_zero_iff (e : A \u2243A[R] B) {a : A} : e a = 0 \u2194 a = 0 :=\ne.toAlgEquiv.toLinearEquiv.map_eq_zero_iff\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_toAlgEquiv (L242-L243)\ntheorem symm_toAlgEquiv (e : A \u2243A[R] B) : e.symm.toAlgEquiv = e.toAlgEquiv.symm := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_map_nhds_eq (L251-L254)\ntheorem symm_map_nhds_eq (e : A \u2243A[R] B) (a : A) : Filter.map e.symm (\ud835\udcdd (e a)) = \ud835\udcdd a :=\ne.toHomeomorph.symm_map_nhds_eq a\n\n/-- The composition of two continuous algebra equivalences. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.comp_continuous_iff (L183-L186)\ntheorem comp_continuous_iff {\u03b1 : Type*} [TopologicalSpace \u03b1] (e : A \u2243A[R] B) {f : \u03b1 \u2192 A} :\n Continuous (e \u2218 f) \u2194 Continuous f :=\ne.toHomeomorph.comp_continuous_iff\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_bijective (L306-L308)\ntheorem symm_bijective : Function.Bijective (symm : (A \u2243A[R] B) \u2192 _) :=\nFunction.bijective_iff_has_inverse.mpr \u27e8_, symm_symm, symm_symm\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousWithinAt (L179-L182)\ntheorem continuousWithinAt (e : A \u2243A[R] B) {S : Set A} {a : A} :\n ContinuousWithinAt e S a :=\ne.continuous.continuousWithinAt\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans_toAlgEquiv (L262-L265)\ntheorem trans_toAlgEquiv (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) :\n (e\u2081.trans e\u2082).toAlgEquiv = e\u2081.toAlgEquiv.trans e\u2082.toAlgEquiv :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.preimage_symm_preimage (L331-L333)\ntheorem preimage_symm_preimage (e : A \u2243A[R] B) (S : Set A) : e \u207b\u00b9' (e.symm \u207b\u00b9' S) = S :=\ne.symm.symm_preimage_preimage S\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.map_nhds_eq (L161-L163)\ntheorem map_nhds_eq (e : A \u2243A[R] B) (a : A) : Filter.map e (\ud835\udcdd a) = \ud835\udcdd (e a) :=\ne.toHomeomorph.map_nhds_eq a\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAt (L176-L178)\ntheorem continuousAt (e : A \u2243A[R] B) {a : A} : ContinuousAt e a :=\ne.continuous.continuousAt\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.self_comp_symm (L300-L302)\ntheorem self_comp_symm (e : A \u2243A[R] B) : (e : A \u2192 B) \u2218 e.symm = id :=\nfunext <| e.apply_symm_apply\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_image_image (L234-L236)\ntheorem symm_image_image (e : A \u2243A[R] B) (S : Set A) : e.symm '' (e '' S) = S :=\ne.toEquiv.symm_image_image S\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_symm_apply (L312-L313)\ntheorem symm_symm_apply (e : A \u2243A[R] B) (a : A) : e.symm.symm a = e a := rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl (L195-L199)\ndef refl : A \u2243A[R] A where\n __ := AlgEquiv.refl\ncontinuous_toFun := continuous_id\n continuous_invFun := continuous_id\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_apply_apply (L230-L232)\ntheorem symm_apply_apply (e : A \u2243A[R] B) (a : A) : e.symm (e a) = a :=\ne.1.left_inv a\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_symm_eq_preimage (L323-L325)\ntheorem image_symm_eq_preimage (e : A \u2243A[R] B) (S : Set B) : e.symm '' S = e \u207b\u00b9' S := by\nrw [e.symm.image_eq_preimage_symm, e.symm_symm]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.eq_symm_apply (L317-L319)\ntheorem eq_symm_apply (e : A \u2243A[R] B) {a : A} {b : B} : a = e.symm b \u2194 e a = b :=\ne.toEquiv.eq_symm_apply\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Algebra.Algebra.continuous_algebraMap (L48-L51)\ntheorem continuous_algebraMap [ContinuousSMul R A] : Continuous (algebraMap R A) := by\nrw [algebraMap_eq_smul_one']\n fun_prop\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_toHomeomorph (L245-L246)\ntheorem symm_toHomeomorph (e : A \u2243A[R] B) : e.symm.toHomeomorph = e.toHomeomorph.symm := rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_symm_comp_coe (L291-L294)\ntheorem coe_symm_comp_coe (e : A \u2243A[R] B) :\n e.symm.toContinuousAlgHom.comp e = ContinuousAlgHom.id R A :=\nContinuousAlgHom.ext e.symm_apply_apply\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuous (L171-L172)\ntheorem continuous (e : A \u2243A[R] B) : Continuous e := e.continuous_toFun\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm (L220-L224)\ndef symm (e : A \u2243A[R] B) : B \u2243A[R] A where\n __ := e.toAlgEquiv.symm\ncontinuous_toFun := e.continuous_invFun\n continuous_invFun := e.continuous_toFun\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coeCLE_refl (L207-L208)\ntheorem coeCLE_refl : (refl R A).toContinuousLinearEquiv = ContinuousLinearEquiv.refl R A := rfl\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.cast (L354-L360)\ndef cast {\u03b9 : Type*} {A : \u03b9 \u2192 Type*} [(i : \u03b9) \u2192 Semiring (A i)] [(i : \u03b9) \u2192 Algebra R (A i)]\n [(i : \u03b9) \u2192 TopologicalSpace (A i)] {i j : \u03b9} (h : i = j) :\n A i \u2243A[R] A j where\n __ := AlgEquiv.cast h\ncontinuous_toFun := by cases h; exact continuous_id\n continuous_invFun := by cases h; exact continuous_id\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.cast_symm_apply (L367-L371)\ntheorem cast_symm_apply {\u03b9 : Type*} {A : \u03b9 \u2192 Type*} [(i : \u03b9) \u2192 Semiring (A i)]\n [(i : \u03b9) \u2192 Algebra R (A i)] [(i : \u03b9) \u2192 TopologicalSpace (A i)] {i j : \u03b9} (h : i = j)\n (x : A j) : (cast (R := R) h).symm x = Equiv.cast (congrArg A h.symm) x := rfl\nend ContinuousAlgEquiv\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans_apply (L272-L275)\ntheorem trans_apply (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) (a : A) :\n (e\u2081.trans e\u2082) a = e\u2082 (e\u2081 a) :=\nrfl\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans (L256-L260)\ndef trans (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) : A \u2243A[R] C where\n __ := e\u2081.toAlgEquiv.trans e\u2082.toAlgEquiv\ncontinuous_toFun := e\u2082.continuous_toFun.comp e\u2081.continuous_toFun\n continuous_invFun := e\u2081.continuous_invFun.comp e\u2082.continuous_invFun\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.apply_symm_apply (L226-L228)\ntheorem apply_symm_apply (e : A \u2243A[R] B) (b : B) : e (e.symm b) = b :=\ne.1.right_inv b\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_trans_apply (L277-L280)\ntheorem symm_trans_apply (e\u2081 : B \u2243A[R] A) (e\u2082 : C \u2243A[R] B) (a : A) :\n (e\u2082.trans e\u2081).symm a = e\u2082.symm (e\u2081.symm a) :=\nrfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_preimage_preimage (L327-L329)\ntheorem symm_preimage_preimage (e : A \u2243A[R] B) (S : Set B) : e.symm \u207b\u00b9' (e \u207b\u00b9' S) = S :=\ne.toEquiv.symm_preimage_preimage S\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.comp_continuous_iff' (L187-L193)\ntheorem comp_continuous_iff' {\u03b2 : Type*} [TopologicalSpace \u03b2] (e : A \u2243A[R] B) {g : B \u2192 \u03b2} :\n Continuous (g \u2218 e) \u2194 Continuous g :=\ne.toHomeomorph.comp_continuous_iff'\n\nvariable (R A)\n\n/-- The identity isomorphism as a continuous `R`-algebra equivalence. -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousOn (L173-L175)\ntheorem continuousOn (e : A \u2243A[R] B) {S : Set A} : ContinuousOn e S :=\ne.continuous.continuousOn\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_symm_image (L238-L240)\ntheorem image_symm_image (e : A \u2243A[R] B) (S : Set B) : e '' (e.symm '' S) = S :=\ne.symm.symm_image_image S\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Rat.DivisionRing (L26-L30)\ninstance DivisionRing.continuousConstSMul_rat {A} [DivisionRing A] [TopologicalSpace A]\n [SeparatelyContinuousMul A] [CharZero A] : ContinuousConstSMul \u211a A :=\n\u27e8fun r => by simpa only [Algebra.smul_def] using continuous_id.const_mul _\u27e9\n\nend DivisionRing\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_refl' (L210-L211)\ntheorem coe_refl' : \u21d1(refl R A) = id := rfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Topology.Algebra.Algebra.continuous_algebraMap_iff_smul (L52-L57)\ntheorem continuous_algebraMap_iff_smul [ContinuousMul A] :\n Continuous (algebraMap R A) \u2194 Continuous fun p : R \u00d7 A => p.1 \u2022 p.2 := by\nrefine \u27e8fun h => ?_, fun h => have : ContinuousSMul R A := \u27e8h\u27e9; continuous_algebraMap _ _\u27e9\n simp only [Algebra.smul_def]\n exact (h.comp continuous_fst).mul continuous_snd\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_eq_preimage_symm (L320-L322)\ntheorem image_eq_preimage_symm (e : A \u2243A[R] B) (S : Set A) : e '' S = e.symm \u207b\u00b9' S :=\ne.toEquiv.image_eq_preimage_symm S\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_apply_eq (L314-L316)\ntheorem symm_apply_eq (e : A \u2243A[R] B) {a : A} {b : B} : e.symm b = a \u2194 b = e a :=\ne.toEquiv.symm_apply_eq\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_comp_self (L296-L298)\ntheorem symm_comp_self (e : A \u2243A[R] B) : (e.symm : B \u2192 A) \u2218 e = id := by\nexact funext <| e.symm_apply_apply\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_refl (L204-L205)\ntheorem coe_refl : refl R A = ContinuousAlgHom.id R A := rfl\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isUniformEmbedding (L334-L339)\ntheorem isUniformEmbedding {E\u2081 E\u2082 : Type*} [UniformSpace E\u2081] [UniformSpace E\u2082] [Ring E\u2081]\n [IsUniformAddGroup E\u2081] [Algebra R E\u2081] [Ring E\u2082] [IsUniformAddGroup E\u2082] [Algebra R E\u2082]\n (e : E\u2081 \u2243A[R] E\u2082) : IsUniformEmbedding e :=\ne.toAlgEquiv.isUniformEmbedding e.toContinuousAlgHom.uniformContinuous\n e.symm.toContinuousAlgHom.uniformContinuous\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.symm_symm (L304-L305)\ntheorem symm_symm (e : A \u2243A[R] B) : e.symm.symm = e := rfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl_toContinuousLinearEquiv (L213-L218)\ntheorem refl_toContinuousLinearEquiv :\n (refl R A).toContinuousLinearEquiv = .refl R A := rfl\nvariable {R A}\n\n/-- The inverse of a continuous algebra equivalence. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.trans_toContinuousLinearEquiv (L267-L270)\ntheorem trans_toContinuousLinearEquiv (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) :\n (e\u2081.trans e\u2082).toContinuousLinearEquiv\n = e\u2081.toContinuousLinearEquiv.trans e\u2082.toContinuousLinearEquiv := rfl\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_symm (L248-L250)\ntheorem toContinuousLinearEquiv_symm (e : A \u2243A[R] B) :\n e.symm.toContinuousLinearEquiv = e.toContinuousLinearEquiv.symm := rfl\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Subalgebra (L62-L65)\ninstance Subalgebra.continuousSMul (S : Subalgebra R A) (X) [TopologicalSpace X] [MulAction A X]\n [ContinuousSMul A X] : ContinuousSMul S X :=\nSubsemiring.continuousSMul S.toSubsemiring X\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Topology.Algebra.Algebra.continuousSMul_of_algebraMap (L58-L61)\ntheorem continuousSMul_of_algebraMap [ContinuousMul A] (h : Continuous (algebraMap R A)) :\n ContinuousSMul R A :=\n\u27e8(continuous_algebraMap_iff_smul R A).1 h\u27e9\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.comp_coe (L281-L284)\ntheorem comp_coe (e\u2081 : A \u2243A[R] B) (e\u2082 : B \u2243A[R] C) :\n e\u2082.toAlgHom.comp e\u2081.toAlgHom = e\u2081.trans e\u2082 := by\nrfl\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_comp_coe_symm (L286-L289)\ntheorem coe_comp_coe_symm (e : A \u2243A[R] B) :\n e.toContinuousAlgHom.comp e.symm = ContinuousAlgHom.id R B :=\nContinuousAlgHom.ext e.apply_symm_apply\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.preimage_closure (L154-L156)\ntheorem preimage_closure (e : A \u2243A[R] B) (S : Set B) : e \u207b\u00b9' closure S = closure (e \u207b\u00b9' S) :=\ne.toHomeomorph.preimage_closure S\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isClosed_image (L158-L160)\ntheorem isClosed_image (e : A \u2243A[R] B) {S : Set A} : IsClosed (e '' S) \u2194 IsClosed S :=\ne.toHomeomorph.isClosed_image\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl_symm (L310-L311)\ntheorem refl_symm : (refl R A).symm = refl R A := rfl\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.cast_apply (L362-L365)\ntheorem cast_apply {\u03b9 : Type*} {A : \u03b9 \u2192 Type*} [(i : \u03b9) \u2192 Semiring (A i)]\n [(i : \u03b9) \u2192 Algebra R (A i)] [(i : \u03b9) \u2192 TopologicalSpace (A i)] {i j : \u03b9} (h : i = j) (x : A i) :\n cast (R := R) h x = Equiv.cast (congrArg A h) x := rfl\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.refl_apply (L201-L202)\ntheorem refl_apply (a : A) : refl R A a = a := rfl\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/Group/GroupTopology.lean", "module": "Mathlib.Topology.Algebra.Group.GroupTopology", "declaration": "Mathlib.Topology.Algebra.Group.GroupTopology.toTopologicalSpace_le", "span": "L87-L90", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Group/GroupTopology.lean#L87"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 9132, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 24160, "lean_code_chars": 21270, "natural_language_chars": 2890, "lean_code_ratio": 0.8804, "line_count": 782, "imports_count": 0, "declarations_count": 2366, "diagnostics_count": 0, "retrieval_snippets_count": 91, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "afb4343e01c38008", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Topology.Order.LocalExtr.IsLocalMax", "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.Topology.Order.LocalExtr)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsLocalMax.on (h : IsLocalMax f a) (s) : IsLocalMaxOn f s a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L49-L52)\ndef IsLocalMinOn :=\nIsMinFilter f (\ud835\udcdd[s] a) a\n\n/-- `IsLocalMaxOn f s a` means that `f x \u2264 f a` for all `x \u2208 s` in some neighborhood of `a`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L53-L56)\ndef IsLocalMaxOn :=\nIsMaxFilter f (\ud835\udcdd[s] a) a\n\n/-- `IsLocalExtrOn f s a` means `IsLocalMinOn f s a \u2228 IsLocalMaxOn f s a`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L57-L60)\ndef IsLocalExtrOn :=\nIsExtrFilter f (\ud835\udcdd[s] a) a\n\n/-- `IsLocalMin f a` means that `f a \u2264 f x` for all `x` in some neighborhood of `a`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMin (L61-L64)\ndef IsLocalMin :=\nIsMinFilter f (\ud835\udcdd a) a\n\n/-- `IsLocalMax f a` means that `f x \u2264 f a` for all `x \u2208 s` in some neighborhood of `a`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtr (L69-L73)\ndef IsLocalExtr :=\nIsExtrFilter f (\ud835\udcdd a) a\n\nvariable {f s a}\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L74-L77)\ntheorem IsLocalExtrOn.elim {p : Prop} :\n IsLocalExtrOn f s a \u2192 (IsLocalMinOn f s a \u2192 p) \u2192 (IsLocalMaxOn f s a \u2192 p) \u2192 p :=\nOr.elim\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtr (L78-L83)\ntheorem IsLocalExtr.elim {p : Prop} :\n IsLocalExtr f a \u2192 (IsLocalMin f a \u2192 p) \u2192 (IsLocalMax f a \u2192 p) \u2192 p :=\nOr.elim\n\n/-! ### Restriction to (sub)sets -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMin (L84-L86)\ntheorem IsLocalMin.on (h : IsLocalMin f a) (s) : IsLocalMinOn f s a :=\nh.filter_inf _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtr (L90-L92)\ntheorem IsLocalExtr.on (h : IsLocalExtr f a) (s) : IsLocalExtrOn f s a :=\nh.filter_inf _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L93-L96)\ntheorem IsLocalMinOn.on_subset {t : Set \u03b1} (hf : IsLocalMinOn f t a) (h : s \u2286 t) :\n IsLocalMinOn f s a :=\nhf.filter_mono <| nhdsWithin_mono a h\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L97-L100)\ntheorem IsLocalMaxOn.on_subset {t : Set \u03b1} (hf : IsLocalMaxOn f t a) (h : s \u2286 t) :\n IsLocalMaxOn f s a :=\nhf.filter_mono <| nhdsWithin_mono a h\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L101-L104)\ntheorem IsLocalExtrOn.on_subset {t : Set \u03b1} (hf : IsLocalExtrOn f t a) (h : s \u2286 t) :\n IsLocalExtrOn f s a :=\nhf.filter_mono <| nhdsWithin_mono a h\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L105-L107)\ntheorem IsLocalMinOn.inter (hf : IsLocalMinOn f s a) (t) : IsLocalMinOn f (s \u2229 t) a :=\nhf.on_subset inter_subset_left\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L108-L110)\ntheorem IsLocalMaxOn.inter (hf : IsLocalMaxOn f s a) (t) : IsLocalMaxOn f (s \u2229 t) a :=\nhf.on_subset inter_subset_left\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L111-L113)\ntheorem IsLocalExtrOn.inter (hf : IsLocalExtrOn f s a) (t) : IsLocalExtrOn f (s \u2229 t) a :=\nhf.on_subset inter_subset_left\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsMinOn (L114-L116)\ntheorem IsMinOn.localize (hf : IsMinOn f s a) : IsLocalMinOn f s a :=\nhf.filter_mono <| inf_le_right\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsMaxOn (L117-L119)\ntheorem IsMaxOn.localize (hf : IsMaxOn f s a) : IsLocalMaxOn f s a :=\nhf.filter_mono <| inf_le_right\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsExtrOn (L120-L122)\ntheorem IsExtrOn.localize (hf : IsExtrOn f s a) : IsLocalExtrOn f s a :=\nhf.filter_mono <| inf_le_right\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L123-L126)\ntheorem IsLocalMinOn.isLocalMin (hf : IsLocalMinOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalMin f a :=\nhave : \ud835\udcdd a \u2264 \ud835\udcdf s := le_principal_iff.2 hs\n hf.filter_mono <| le_inf le_rfl this\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L127-L130)\ntheorem IsLocalMaxOn.isLocalMax (hf : IsLocalMaxOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalMax f a :=\nhave : \ud835\udcdd a \u2264 \ud835\udcdf s := le_principal_iff.2 hs\n hf.filter_mono <| le_inf le_rfl this\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L131-L133)\ntheorem IsLocalExtrOn.isLocalExtr (hf : IsLocalExtrOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalExtr f a :=\nhf.elim (fun hf => (hf.isLocalMin hs).isExtr) fun hf => (hf.isLocalMax hs).isExtr\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Order.LocalExtr.isLocalMinOn_univ_iff (L134-L136)\nlemma isLocalMinOn_univ_iff : IsLocalMinOn f univ a \u2194 IsLocalMin f a := by\nsimp only [IsLocalMinOn, IsLocalMin, nhdsWithin_univ]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Order.LocalExtr.isLocalMaxOn_univ_iff (L137-L139)\nlemma isLocalMaxOn_univ_iff : IsLocalMaxOn f univ a \u2194 IsLocalMax f a := by\nsimp only [IsLocalMaxOn, IsLocalMax, nhdsWithin_univ]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Order.LocalExtr.isLocalExtrOn_univ_iff (L140-L142)\nlemma isLocalExtrOn_univ_iff : IsLocalExtrOn f univ a \u2194 IsLocalExtr f a :=\nisLocalMinOn_univ_iff.or isLocalMaxOn_univ_iff\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsMinOn (L143-L145)\ntheorem IsMinOn.isLocalMin (hf : IsMinOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalMin f a :=\nhf.localize.isLocalMin hs\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIooClassNhds (L155-L160)\ninstance tendstoIooClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Ioo (\ud835\udcdd a) (\ud835\udcdd a) :=\ntendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self\n\nvariable (\u03b1) in\n/-- In a second countable topological space with the order topology, the topology is generated\nby half-infinite open intervals with endpoints in a countable set. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_eq_order (L132-L137)\ntheorem nhds_eq_order [OrderTopology \u03b1] (a : \u03b1) :\n \ud835\udcdd a = (\u2a05 b \u2208 Iio a, \ud835\udcdf (Ioi b)) \u2293 \u2a05 b \u2208 Ioi a, \ud835\udcdf (Iio b) := by\nrw [OrderTopology.topology_eq_generate_intervals (\u03b1 := \u03b1), nhds_generateFrom]\n simp_rw [mem_setOf_eq, @and_comm (a \u2208 _), exists_or, or_and_right, iInf_or, iInf_and,\n iInf_exists, iInf_inf_eq, iInf_comm (\u03b9 := Set \u03b1), iInf_iInf_eq_left, mem_Ioi, mem_Iio]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Ioi_nhdsGT (L130-L133)\ntheorem comap_coe_Ioi_nhdsGT (a : X) (ha : IsPredPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : Ioi a \u2192 X) (\ud835\udcdd[>] a) = atBot :=\n comap_coe_nhdsGT_of_Ioo_subset Subset.rfl (fun \u27e8x, hx\u27e9 => \u27e8x, hx, Ioo_subset_Ioi_self\u27e9) ha\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_order_unbounded (L236-L239)\ntheorem nhds_order_unbounded [OrderTopology \u03b1] {a : \u03b1} (hu : \u2203 u, a < u) (hl : \u2203 l, l < a) :\n \ud835\udcdd a = \u2a05 (l) (_ : l < a) (u) (_ : a < u), \ud835\udcdf (Ioo l u) := by\nsimp only [nhds_eq_order, \u2190 inf_biInf, \u2190 biInf_inf, *, \u2190 inf_principal, \u2190 Ioi_inter_Iio]; rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ioc_subset_of_mem_nhds (L442-L445)\ntheorem exists_Ioc_subset_of_mem_nhds {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) (h : \u2203 l, l < a) :\n \u2203 l < a, Ioc l a \u2286 s :=\n(nhdsLE_basis_of_exists_lt h).mem_iff.mp (nhdsWithin_le_nhds hs)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_iff_generate_intervals (L106-L109)\ntheorem isOpen_iff_generate_intervals [t : OrderTopology \u03b1] {s : Set \u03b1} :\n IsOpen s \u2194 GenerateOpen { s | \u2203 a, s = Ioi a \u2228 s = Iio a } s := by\nrw [t.topology_eq_generate_intervals]; rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Ioi_atBot (L150-L153)\ntheorem map_coe_Ioi_atBot (a : X) (ha : IsPredPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : Ioi a \u2192 X) atBot = \ud835\udcdd[>] a :=\n map_coe_atBot_of_Ioo_subset Subset.rfl (fun b hb => \u27e8b, hb, Ioo_subset_Ioi_self\u27e9) ha\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Order.Basic.gt_mem_nhds (L126-L128)\ntheorem gt_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd a, x < b :=\n(isOpen_gt' _).mem_nhds h\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ico_subset_of_mem_nhds (L457-L462)\ntheorem exists_Ico_subset_of_mem_nhds {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) (h : \u2203 u, a < u) :\n \u2203 u, a < u \u2227 Ico a u \u2286 s :=\nlet \u27e8_l', hl'\u27e9 := h\n let \u27e8l, hl\u27e9 := exists_Ico_subset_of_mem_nhds' hs hl'\n \u27e8l, hl.1.1, hl.2\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Ioo_atTop (L162-L165)\ntheorem tendsto_comp_coe_Ioo_atTop (h : a < b) (hb : IsSuccPrelimit b := by exact .of_dense _) :\nTendsto (fun x : Ioo a b => f x) atTop l \u2194 Tendsto f (\ud835\udcdd[<] b) l := by\n rw [\u2190 map_coe_Ioo_atTop h hb, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Order.Basic.ge_mem_nhds (L129-L131)\ntheorem ge_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd a, x \u2264 b :=\n(gt_mem_nhds h).mono fun _ => le_of_lt\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsLT_of_Ioo_subset (L80-L89)\ntheorem comap_coe_nhdsLT_of_Ioo_subset (hsb : s \u2286 Iio b) (hs : s.Nonempty \u2192 \u2203 a < b, Ioo a b \u2286 s)\n (hb : IsSuccPrelimit b := by exact .of_dense _) :\ncomap ((\u2191) : s \u2192 X) (\ud835\udcdd[<] b) = atTop := by\n rw [comap_coe_nhdsLT_eq_atTop_iff]\n refine \u27e8hsb, fun hsne a ha \u21a6 ?_\u27e9\n rcases hs hsne with \u27e8c, hcb, hcs\u27e9\n rcases hb.lt_iff_exists_lt.mp (max_lt ha hcb) with \u27e8x, hxb, hacx\u27e9\n rw [max_lt_iff] at hacx\n exact \u27e8x, hcs \u27e8hacx.2, hxb\u27e9, hacx.1, hxb\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_atTop_of_Ioo_subset (L96-L105)\ntheorem map_coe_atTop_of_Ioo_subset (hsb : s \u2286 Iio b) (hs : \u2200 a' < b, \u2203 a < b, Ioo a b \u2286 s)\n (hb : IsSuccPrelimit b := by exact .of_dense _) :\nmap ((\u2191) : s \u2192 X) atTop = \ud835\udcdd[<] b := by\n rcases eq_empty_or_nonempty (Iio b) with (hb' | \u27e8a, ha\u27e9)\n \u00b7 have : IsEmpty s := \u27e8fun x => hb'.subset (hsb x.2)\u27e9\n rw [filter_eq_bot_of_isEmpty atTop, Filter.map_bot, hb', nhdsWithin_empty]\n \u00b7 rw [\u2190 comap_coe_nhdsLT_of_Ioo_subset hsb (fun _ => hs a ha) hb, map_comap_of_mem]\n rw [Subtype.range_val]\n exact (mem_nhdsLT_iff_exists_Ioo_subset' ha).2 (hs a ha)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_top_mono' (L415-L418)\ntheorem tendsto_nhds_top_mono' [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderTop \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a4)) (hg : f \u2264 g) : Tendsto g l (\ud835\udcdd \u22a4) :=\ntendsto_nhds_top_mono hf (Eventually.of_forall hg)\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Order.Basic.exists_countable_generateFrom_Ioi_Iio (L161-L182)\nlemma exists_countable_generateFrom_Ioi_Iio\n [OrderTopology \u03b1] [SecondCountableTopology \u03b1] :\n \u2203 (c : Set \u03b1), c.Countable \u2227 ts = generateFrom { s | \u2203 a \u2208 c, s = Ioi a \u2228 s = Iio a } := by\nrcases isEmpty_or_nonempty \u03b1 with h\u03b1 | h\u03b1\n \u00b7 exact \u27e8\u2205, by simp, Subsingleton.elim _ _\u27e9\n obtain \u27e8t, t_subs, t_count, ht\u27e9 : \u2203 t \u2286 { s | \u2203 a, s = Ioi a \u2228 s = Iio a },\n t.Countable \u2227 ts = generateFrom t :=\n exists_countable_of_generateFrom OrderTopology.topology_eq_generate_intervals\n have A : \u2200 s \u2208 t, \u2203 a, s = Ioi a \u2228 s = Iio a := t_subs\n choose! a ha using A\n refine \u27e8a '' t, t_count.image _, ?_\u27e9\n apply le_antisymm\n \u00b7 apply le_generateFrom_iff_subset_isOpen.2\n simp only [mem_image, exists_exists_and_eq_and, setOf_subset_setOf, forall_exists_index,\n and_imp]\n grind [isOpen_Iio', isOpen_Ioi']\n \u00b7 rw [ht]\n apply generateFrom_anti\n grind\n\n/-- If a topology is generated by half-open intervals with endpoints in a set `c`, then the sets\nformed by intersecting finitely many of these intervals form a topological basis. -/\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Ioo_atTop (L140-L143)\ntheorem map_coe_Ioo_atTop (h : a < b) (hb : IsSuccPrelimit b := by exact .of_dense _) :\nmap ((\u2191) : Ioo a b \u2192 X) atTop = \ud835\udcdd[<] b :=\n map_coe_atTop_of_Ioo_subset Ioo_subset_Iio_self (fun _ _ => \u27e8_, h, Subset.rfl\u27e9) hb\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Order.Basic.induced_topology_eq_preorder (L273-L293)\ntheorem induced_topology_eq_preorder [Preorder \u03b1] [Preorder \u03b2] [TopologicalSpace \u03b2]\n [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H\u2081 : \u2200 {a b x}, b < f a \u2192 \u00ac(b < f x) \u2192 \u2203 y, y < a \u2227 b \u2264 f y)\n (H\u2082 : \u2200 {a b x}, f a < b \u2192 \u00ac(f x < b) \u2192 \u2203 y, a < y \u2227 f y \u2264 b) :\n induced f \u2039TopologicalSpace \u03b2\u203a = Preorder.topology \u03b1 := by\nlet _ := Preorder.topology \u03b1; have : OrderTopology \u03b1 := \u27e8rfl\u27e9\n refine le_antisymm (induced_topology_le_preorder hf) ?_\n refine le_of_nhds_le_nhds fun a => ?_\n simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]\n refine inf_le_inf (le_iInf\u2082 fun b hb => ?_) (le_iInf\u2082 fun b hb => ?_)\n \u00b7 by_cases! h : \u2203 x, \u00ac(b < f x)\n \u00b7 rcases h with \u27e8x, hx\u27e9\n rcases H\u2081 hb hx with \u27e8y, hya, hyb\u27e9\n exact iInf\u2082_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz))\n \u00b7 exact le_principal_iff.2 (univ_mem' h)\n \u00b7 by_cases! h : \u2203 x, \u00ac(f x < b)\n \u00b7 rcases h with \u27e8x, hx\u27e9\n rcases H\u2082 hb hx with \u27e8y, hya, hyb\u27e9\n exact iInf\u2082_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb)\n \u00b7 exact le_principal_iff.2 (univ_mem' h)\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Ioo_atBot (L167-L170)\ntheorem tendsto_comp_coe_Ioo_atBot (h : a < b) (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto (fun x : Ioo a b => f x) atBot l \u2194 Tendsto f (\ud835\udcdd[>] a) l := by\n rw [\u2190 map_coe_Ioo_atBot h ha, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Iio_atTop (L155-L160)\ntheorem map_coe_Iio_atTop (a : X) (ha : IsSuccPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : Iio a \u2192 X) atTop = \ud835\udcdd[<] a :=\n map_coe_Ioi_atBot (toDual a) ha.dual\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1} {f : X \u2192 \u03b1}\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIccClassNhdsPi (L253-L263)\ninstance tendstoIccClassNhdsPi {\u03b9 : Type*} {\u03b1 : \u03b9 \u2192 Type*} [\u2200 i, Preorder (\u03b1 i)]\n [\u2200 i, TopologicalSpace (\u03b1 i)] [\u2200 i, OrderTopology (\u03b1 i)] (f : \u2200 i, \u03b1 i) :\n TendstoIxxClass Icc (\ud835\udcdd f) (\ud835\udcdd f) := by\nconstructor\n conv in (\ud835\udcdd f).smallSets => rw [nhds_pi, Filter.pi]\n simp only [smallSets_iInf, smallSets_comap_eq_comap_image, tendsto_iInf, tendsto_comap_iff]\n intro i\n have : Tendsto (fun g : \u2200 i, \u03b1 i => g i) (\ud835\udcdd f) (\ud835\udcdd (f i)) := (continuous_apply i).tendsto f\n refine (this.comp tendsto_fst).Icc (this.comp tendsto_snd) |>.smallSets_mono ?_\n filter_upwards [] using fun \u27e8f, g\u27e9 \u21a6 image_subset_iff.mpr fun p hp \u21a6 \u27e8hp.1 i, hp.2 i\u27e9\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsLT_eq_atTop_iff (L36-L72)\ntheorem comap_coe_nhdsLT_eq_atTop_iff :\n comap ((\u2191) : s \u2192 X) (\ud835\udcdd[<] b) = atTop \u2194\n s \u2286 Iio b \u2227 (s.Nonempty \u2192 \u2200 a < b, (s \u2229 Ioo a b).Nonempty) := by\nrcases s.eq_empty_or_nonempty with rfl | hsne\n \u00b7 simp [eq_iff_true_of_subsingleton]\n have := hsne.to_subtype\n simp only [hsne, true_imp_iff]\n by_cases hsub : s \u2286 Iio b\n \u00b7 simp only [hsub, true_and]\n constructor\n \u00b7 intro h a ha\n have := preimage_mem_comap (m := ((\u2191) : s \u2192 X)) (Ioo_mem_nhdsLT ha)\n rw [h] at this\n rcases Filter.nonempty_of_mem this with \u27e8\u27e8c, hcs\u27e9, hc\u27e9\n exact \u27e8c, hcs, hc\u27e9\n \u00b7 intro h\n refine (nhdsLT_basis_of_exists_lt (hsne.mono hsub)).comap _ |>.ext atTop_basis ?_ ?_\n \u00b7 intro a hab\n rcases h a hab with \u27e8c, hcs, hc\u27e9\n use \u27e8c, hcs\u27e9\n simp_all [subset_def, hc.1.trans_le]\n \u00b7 rintro \u27e8a, has\u27e9 -\n use a, hsub has\n simp_all [subset_def, le_of_lt]\n \u00b7 suffices \u00acTendsto (\u2191) (atTop : Filter s) (\ud835\udcdd[<] b) by\n contrapose this\n simp_all [tendsto_iff_comap]\n intro h\n rcases not_subset_iff_exists_mem_notMem.mp hsub with \u27e8a, has, ha\u27e9\n rcases h.eventually eventually_mem_nhdsWithin |>.and (eventually_ge_atTop \u27e8a, has\u27e9) |>.exists\n with \u27e8\u27e8c, hcs\u27e9, hcb, hac\u27e9\n apply lt_irrefl a\n calc\n a \u2264 c := by simpa using hac\n _ < b := by simpa using hcb\n _ \u2264 a := by simpa using ha\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Iio_atTop (L177-L180)\ntheorem tendsto_comp_coe_Iio_atTop (ha : IsSuccPrelimit a := by exact .of_dense _) :\nTendsto (fun x : Iio a => f x) atTop l \u2194 Tendsto f (\ud835\udcdd[<] a) l := by\n rw [\u2190 map_coe_Iio_atTop a ha, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Iio_nhdsLT (L135-L138)\ntheorem comap_coe_Iio_nhdsLT (a : X) (ha : IsSuccPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : Iio a \u2192 X) (\ud835\udcdd[<] a) = atTop :=\n comap_coe_Ioi_nhdsGT (toDual a) ha.dual\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_bot_mono (L411-L414)\ntheorem tendsto_nhds_bot_mono [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderBot \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a5)) (hg : g \u2264\u1da0[l] f) : Tendsto g l (\ud835\udcdd \u22a5) :=\ntendsto_nhds_top_mono (\u03b2 := \u03b2\u1d52\u1d48) hf hg\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Ioi_atBot (L172-L175)\ntheorem tendsto_comp_coe_Ioi_atBot (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto (fun x : Ioi a => f x) atBot l \u2194 Tendsto f (\ud835\udcdd[>] a) l := by\n rw [\u2190 map_coe_Ioi_atBot a ha, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_bot_basis (L391-L394)\ntheorem nhds_bot_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderBot \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] : (\ud835\udcdd \u22a5).HasBasis (fun a : \u03b1 => \u22a5 < a) fun a : \u03b1 => Iio a :=\nnhds_top_basis (\u03b1 := \u03b1\u1d52\u1d48)\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_basis (L372-L375)\ntheorem nhdsGE_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] [NoMaxOrder \u03b1] (a : \u03b1) :\n (\ud835\udcdd[\u2265] a).HasBasis (fun u => a < u) fun u => Ico a u :=\nnhdsGE_basis_of_exists_gt (exists_gt a)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Topology.Order.Basic.lt_mem_nhds (L120-L122)\ntheorem lt_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd b, a < x :=\n(isOpen_lt' _).mem_nhds h\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_gt' (L115-L117)\ntheorem isOpen_gt' [OrderTopology \u03b1] (a : \u03b1) : IsOpen { b : \u03b1 | b < a } :=\nisOpen_iff_generate_intervals.2 <| .basic _ \u27e8a, .inr rfl\u27e9\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Topology.Order.Basic.le_mem_nhds (L123-L125)\ntheorem le_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd b, a \u2264 x :=\n(lt_mem_nhds h).mono fun _ => le_of_lt\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_eq_iInf_inf_principal (L346-L349)\ntheorem nhdsLE_eq_iInf_inf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] (a : \u03b1) :\n \ud835\udcdd[\u2264] a = (\u2a05 l < a, \ud835\udcdf (Ioi l)) \u2293 \ud835\udcdf (Iic a) :=\nnhdsGE_eq_iInf_inf_principal (toDual a)\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Topology.Order.Basic.induced_orderTopology' (L294-L300)\ntheorem induced_orderTopology' {\u03b1 : Type u} {\u03b2 : Type v} [Preorder \u03b1] [ta : TopologicalSpace \u03b2]\n [Preorder \u03b2] [OrderTopology \u03b2] (f : \u03b1 \u2192 \u03b2) (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H\u2081 : \u2200 {a x}, x < f a \u2192 \u2203 b < a, x \u2264 f b) (H\u2082 : \u2200 {a x}, f a < x \u2192 \u2203 b > a, f b \u2264 x) :\n @OrderTopology _ (induced f ta) _ :=\nlet _ := induced f ta\n \u27e8induced_topology_eq_preorder hf (fun h _ => H\u2081 h) (fun h _ => H\u2082 h)\u27e9\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Ioo_atBot (L187-L190)\ntheorem tendsto_Ioo_atBot {f : \u03b1 \u2192 Ioo a b} (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto f l atBot \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[>] a) := by\n rw [\u2190 comap_coe_Ioo_nhdsGT a b ha, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_eq_iInf_principal (L354-L357)\ntheorem nhdsLE_eq_iInf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 l, l < a) : \ud835\udcdd[\u2264] a = \u2a05 l < a, \ud835\udcdf (Ioc l a) := by\nsimp only [nhdsLE_eq_iInf_inf_principal, biInf_inf ha, inf_principal, Ioi_inter_Iic]\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Ioi_atBot (L192-L195)\ntheorem tendsto_Ioi_atBot {f : \u03b1 \u2192 Ioi a} (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto f l atBot \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[>] a) := by\n rw [\u2190 comap_coe_Ioi_nhdsGT a ha, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Iio_atTop (L197-L199)\ntheorem tendsto_Iio_atTop {f : \u03b1 \u2192 Iio a} (ha : IsSuccPrelimit a := by exact .of_dense _) :\nTendsto f l atTop \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[<] a) := by\n rw [\u2190 comap_coe_Iio_nhdsLT a ha, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_bot_order (L383-L385)\ntheorem nhds_bot_order [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderBot \u03b1] [OrderTopology \u03b1] :\n \ud835\udcdd (\u22a5 : \u03b1) = \u2a05 (l) (_ : \u22a5 < l), \ud835\udcdf (Iio l) := by simp [nhds_eq_order (\u22a5 : \u03b1)]\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_top_mono (L405-L410)\ntheorem tendsto_nhds_top_mono [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderTop \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a4)) (hg : f \u2264\u1da0[l] g) : Tendsto g l (\ud835\udcdd \u22a4) := by\nsimp only [nhds_top_order, tendsto_iInf, tendsto_principal] at hf \u22a2\n intro x hx\n filter_upwards [hf x hx, hg] with _ using lt_of_lt_of_le\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_eq_iInf_inf_principal (L340-L345)\ntheorem nhdsGE_eq_iInf_inf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] (a : \u03b1) :\n \ud835\udcdd[\u2265] a = (\u2a05 (u) (_ : a < u), \ud835\udcdf (Iio u)) \u2293 \ud835\udcdf (Ici a) := by\nrw [nhdsWithin, nhds_eq_order]\n refine le_antisymm (inf_le_inf_right _ inf_le_right) (le_inf (le_inf ?_ inf_le_left) inf_le_right)\n exact inf_le_right.trans (le_iInf\u2082 fun l hl => principal_mono.2 <| Ici_subset_Ioi.2 hl)\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Topology.Order.Basic.Preorder (L79-L86)\ndef Preorder.topology (\u03b1 : Type*) [Preorder \u03b1] : TopologicalSpace \u03b1 :=\ngenerateFrom { s : Set \u03b1 | \u2203 a : \u03b1, s = { b : \u03b1 | a < b } \u2228 s = { b : \u03b1 | b < a } }\n\nsection Preorder\n\nvariable [ts : TopologicalSpace \u03b1] [Preorder \u03b1]\n\n/-- A countable preordered set equipped with the order topology is second countable. -/\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Icc_mem_subset_of_mem_nhdsGE (L463-L474)\ntheorem exists_Icc_mem_subset_of_mem_nhdsGE {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd[\u2265] a) :\n \u2203 b, a \u2264 b \u2227 Icc a b \u2208 \ud835\udcdd[\u2265] a \u2227 Icc a b \u2286 s := by\nrcases (em (IsMax a)).imp_right not_isMax_iff.mp with (ha | ha)\n \u00b7 use a\n simpa [ha.Ici_eq] using hs\n \u00b7 rcases (nhdsGE_basis_of_exists_gt ha).mem_iff.mp hs with \u27e8b, hab, hbs\u27e9\n rcases eq_empty_or_nonempty (Ioo a b) with (H | \u27e8c, hac, hcb\u27e9)\n \u00b7 have : Ico a b = Icc a a := by rw [\u2190 Icc_union_Ioo_eq_Ico le_rfl hab, H, union_empty]\n exact \u27e8a, le_rfl, this \u25b8 \u27e8Ico_mem_nhdsGE hab, hbs\u27e9\u27e9\n \u00b7 refine \u27e8c, hac.le, Icc_mem_nhdsGE hac, ?_\u27e9\n exact (Icc_subset_Ico_right hcb).trans hbs\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Ioo_nhdsLT (L116-L122)\ntheorem comap_coe_Ioo_nhdsLT (a b : X) (hb : IsSuccPrelimit b := by exact .of_dense _) :\ncomap ((\u2191) : Ioo a b \u2192 X) (\ud835\udcdd[<] b) = atTop :=\n comap_coe_nhdsLT_of_Ioo_subset Ioo_subset_Iio_self\n (fun h => \u27e8a, h.elim fun _x hx \u21a6 hx.1.trans hx.2, Subset.rfl\u27e9) hb\n\n/-- The `atBot` filter for an open interval `Ioo a b` comes from the right-neighbourhoods filter at\nthe left endpoint in the ambient order. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_basis (L376-L379)\ntheorem nhdsLE_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] [NoMinOrder \u03b1] (a : \u03b1) :\n (\ud835\udcdd[\u2264] a).HasBasis (fun l => l < a) fun l => Ioc l a :=\nnhdsLE_basis_of_exists_lt (exists_lt a)\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_Iio' (L118-L119)\ntheorem isOpen_Iio' [OrderTopology \u03b1] (a : \u03b1) : IsOpen (Iio a) := isOpen_gt' a\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsGT_of_Ioo_subset (L90-L95)\ntheorem comap_coe_nhdsGT_of_Ioo_subset (hsa : s \u2286 Ioi a) (hs : s.Nonempty \u2192 \u2203 b > a, Ioo a b \u2286 s)\n (ha : IsPredPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : s \u2192 X) (\ud835\udcdd[>] a) = atBot := by\n refine comap_coe_nhdsLT_of_Ioo_subset (show ofDual \u207b\u00b9' s \u2286 Iio (toDual a) from hsa) ?_ ha.dual\n simpa only [OrderDual.exists, Ioo_toDual]\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_top_basis_Ici (L395-L400)\ntheorem nhds_top_basis_Ici [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTop \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] [DenselyOrdered \u03b1] : (\ud835\udcdd \u22a4).HasBasis (fun a : \u03b1 => a < \u22a4) Ici :=\nnhds_top_basis.to_hasBasis\n (fun _a ha => let \u27e8b, hab, hb\u27e9 := exists_between ha; \u27e8b, hb, Ici_subset_Ioi.mpr hab\u27e9)\n fun a ha => \u27e8a, ha, Ioi_subset_Ici_self\u27e9\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIccClassNhds (L141-L148)\ninstance tendstoIccClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Icc (\ud835\udcdd a) (\ud835\udcdd a) := by\nsimp only [nhds_eq_order, iInf_subtype']\n refine\n ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass\n fun s _ => ?_\n refine ((ordConnected_biInter ?_).inter (ordConnected_biInter ?_)).out <;> intro _ _\n exacts [ordConnected_Ioi, ordConnected_Iio]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ico_subset_of_mem_nhds' (L452-L456)\ntheorem exists_Ico_subset_of_mem_nhds' {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) {u : \u03b1} (hu : a < u) :\n \u2203 u' \u2208 Ioc a u, Ico a u' \u2286 s := by\nsimpa only [OrderDual.exists, exists_prop, Ico_toDual, Ioc_toDual] using\n exists_Ioc_subset_of_mem_nhds' (show ofDual \u207b\u00b9' s \u2208 \ud835\udcdd (toDual a) from hs) hu.dual\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_Ioi' (L113-L114)\ntheorem isOpen_Ioi' [OrderTopology \u03b1] (a : \u03b1) : IsOpen (Ioi a) := isOpen_lt' a\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIcoClassNhds (L149-L151)\ninstance tendstoIcoClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Ico (\ud835\udcdd a) (\ud835\udcdd a) :=\ntendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_eq_iInf_principal (L350-L353)\ntheorem nhdsGE_eq_iInf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 u, a < u) : \ud835\udcdd[\u2265] a = \u2a05 (u) (_ : a < u), \ud835\udcdf (Ico a u) := by\nsimp only [nhdsGE_eq_iInf_inf_principal, biInf_inf ha, inf_principal, Iio_inter_Ici]\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_bot_basis_Iic (L401-L404)\ntheorem nhds_bot_basis_Iic [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderBot \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] [DenselyOrdered \u03b1] : (\ud835\udcdd \u22a5).HasBasis (fun a : \u03b1 => \u22a5 < a) Iic :=\nnhds_top_basis_Ici (\u03b1 := \u03b1\u1d52\u1d48)\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Topology.Order.Basic.induced_topology_le_preorder (L264-L272)\ntheorem induced_topology_le_preorder [Preorder \u03b1] [Preorder \u03b2] [TopologicalSpace \u03b2]\n [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : \u2200 {x y}, f x < f y \u2194 x < y) :\n induced f \u2039TopologicalSpace \u03b2\u203a \u2264 Preorder.topology \u03b1 := by\nlet _ := Preorder.topology \u03b1; have : OrderTopology \u03b1 := \u27e8rfl\u27e9\n refine le_of_nhds_le_nhds fun x => ?_\n simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, \u2190 hf]\n refine inf_le_inf (le_iInf\u2082 fun a ha => ?_) (le_iInf\u2082 fun a ha => ?_)\n exacts [iInf\u2082_le (f a) ha, iInf\u2082_le (f a) ha]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Topology.Order.Basic.order_separated (L430-L435)\ntheorem order_separated {a\u2081 a\u2082 : \u03b1} (h : a\u2081 < a\u2082) :\n \u2203 u v : Set \u03b1, IsOpen u \u2227 IsOpen v \u2227 a\u2081 \u2208 u \u2227 a\u2082 \u2208 v \u2227 \u2200 b\u2081 \u2208 u, \u2200 b\u2082 \u2208 v, b\u2081 < b\u2082 :=\nlet \u27e8x, hx, y, hy, h\u27e9 := h.exists_disjoint_Iio_Ioi\n \u27e8Iio x, Ioi y, isOpen_gt' _, isOpen_lt' _, hx, hy, h\u27e9\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_lt' (L110-L112)\ntheorem isOpen_lt' [OrderTopology \u03b1] (a : \u03b1) : IsOpen { b : \u03b1 | a < b } :=\nisOpen_iff_generate_intervals.2 <| .basic _ \u27e8a, .inl rfl\u27e9\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_top_basis (L386-L390)\ntheorem nhds_top_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTop \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] : (\ud835\udcdd \u22a4).HasBasis (fun a : \u03b1 => a < \u22a4) fun a : \u03b1 => Ioi a := by\nhave : \u2203 x : \u03b1, x < \u22a4 := (exists_ne \u22a4).imp fun x hx => hx.lt_top\n simpa only [Iic_top, nhdsWithin_univ, Ioc_top] using nhdsLE_basis_of_exists_lt this\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_order (L138-L140)\ntheorem tendsto_order [OrderTopology \u03b1] {f : \u03b2 \u2192 \u03b1} {a : \u03b1} {x : Filter \u03b2} :\n Tendsto f x (\ud835\udcdd a) \u2194 (\u2200 a' < a, \u2200\u1da0 b in x, a' < f b) \u2227 \u2200 a' > a, \u2200\u1da0 b in x, f b < a' := by\nsimp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_basis_of_exists_gt (L358-L366)\ntheorem nhdsGE_basis_of_exists_gt [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 u, a < u) : (\ud835\udcdd[\u2265] a).HasBasis (fun u => a < u) fun u => Ico a u :=\n(nhdsGE_eq_iInf_principal ha).symm \u25b8\n hasBasis_biInf_principal\n (fun b hb c hc => \u27e8min b c, lt_min hb hc, Ico_subset_Ico_right (min_le_left _ _),\n Ico_subset_Ico_right (min_le_right _ _)\u27e9)\n ha\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_of_tendsto_of_tendsto_of_le_of_le (L228-L235)\ntheorem tendsto_of_tendsto_of_tendsto_of_le_of_le [OrderTopology \u03b1] {f g h : \u03b2 \u2192 \u03b1} {b : Filter \u03b2}\n {a : \u03b1} (hg : Tendsto g b (\ud835\udcdd a)) (hh : Tendsto h b (\ud835\udcdd a)) (hgf : g \u2264 f) (hfh : f \u2264 h) :\n Tendsto f b (\ud835\udcdd a) :=\ntendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (Eventually.of_forall hgf)\n (Eventually.of_forall hfh)\n\nalias Filter.Tendsto.squeeze := tendsto_of_tendsto_of_tendsto_of_le_of_le\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_atBot_of_Ioo_subset (L106-L114)\ntheorem map_coe_atBot_of_Ioo_subset (hsa : s \u2286 Ioi a) (hs : \u2200 b' > a, \u2203 b > a, Ioo a b \u2286 s)\n (ha : IsPredPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : s \u2192 X) atBot = \ud835\udcdd[>] a := by\n refine map_coe_atTop_of_Ioo_subset (s := ofDual \u207b\u00b9' s) (b := toDual a) hsa ?_ ha.dual\n intro b' hb'\n simpa [OrderDual.exists] using hs (ofDual b') hb'\n\n/-- The `atTop` filter for an open interval `Ioo a b` comes from the left-neighbourhoods filter at\nthe right endpoint in the ambient order. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIocClassNhds (L152-L154)\ninstance tendstoIocClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Ioc (\ud835\udcdd a) (\ud835\udcdd a) :=\ntendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIxxNhdsWithin (L248-L252)\ninstance tendstoIxxNhdsWithin {\u03b1 : Type*} [TopologicalSpace \u03b1] (a : \u03b1) {s t : Set \u03b1}\n {Ixx} [TendstoIxxClass Ixx (\ud835\udcdd a) (\ud835\udcdd a)] [TendstoIxxClass Ixx (\ud835\udcdf s) (\ud835\udcdf t)] :\n TendstoIxxClass Ixx (\ud835\udcdd[s] a) (\ud835\udcdd[t] a) :=\nFilter.tendstoIxxClass_inf\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Ioo_atTop (L182-L185)\ntheorem tendsto_Ioo_atTop {f : \u03b1 \u2192 Ioo a b} (hb : IsSuccPrelimit b := by exact .of_dense _) :\nTendsto f l atTop \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[<] b) := by\n rw [\u2190 comap_coe_Ioo_nhdsLT a b hb, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Ioo_atBot (L145-L148)\ntheorem map_coe_Ioo_atBot (h : a < b) (ha : IsPredPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : Ioo a b \u2192 X) atBot = \ud835\udcdd[>] a :=\n map_coe_atBot_of_Ioo_subset Ioo_subset_Ioi_self (fun _ _ => \u27e8_, h, Subset.rfl\u27e9) ha\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ioc_subset_of_mem_nhds' (L446-L451)\ntheorem exists_Ioc_subset_of_mem_nhds' {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) {l : \u03b1} (hl : l < a) :\n \u2203 l' \u2208 Ico l a, Ioc l' a \u2286 s :=\nlet \u27e8l', hl'a, hl's\u27e9 := exists_Ioc_subset_of_mem_nhds hs \u27e8l, hl\u27e9\n \u27e8max l l', \u27e8le_max_left _ _, max_lt hl hl'a\u27e9,\n (Ioc_subset_Ioc_left <| le_max_right _ _).trans hl's\u27e9\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Icc_mem_subset_of_mem_nhdsLE (L475-L479)\ntheorem exists_Icc_mem_subset_of_mem_nhdsLE {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd[\u2264] a) :\n \u2203 b \u2264 a, Icc b a \u2208 \ud835\udcdd[\u2264] a \u2227 Icc b a \u2286 s := by\nsimpa only [Icc_toDual, toDual.surjective.exists] using\n exists_Icc_mem_subset_of_mem_nhdsGE (\u03b1 := \u03b1\u1d52\u1d48) (a := toDual a) hs\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Topology.Order.Basic.OrderEmbedding (L328-L334)\nlemma OrderEmbedding.isEmbedding_of_ordConnected {\u03b1 \u03b2 : Type*} [LinearOrder \u03b1] [LinearOrder \u03b2]\n [TopologicalSpace \u03b1] [OrderTopology \u03b1] [TopologicalSpace \u03b2] [OrderTopology \u03b2]\n (f : \u03b1 \u21aao \u03b2) (hc : OrdConnected (range f)) : Topology.IsEmbedding f :=\nf.strictMono.isEmbedding_of_ordConnected hc\n\n/-- On a `Set.OrdConnected` subset of a linear order, the order topology for the restriction of the\norder is the same as the restriction to the subset of the order topology. -/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Ioo_nhdsGT (L124-L128)\ntheorem comap_coe_Ioo_nhdsGT (a b : X) (ha : IsPredPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : Ioo a b \u2192 X) (\ud835\udcdd[>] a) = atBot :=\n comap_coe_nhdsGT_of_Ioo_subset Ioo_subset_Ioi_self\n (fun h => \u27e8b, h.elim fun _x hx \u21a6 hx.1.trans hx.2, Subset.rfl\u27e9) ha\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_top_order (L380-L382)\ntheorem nhds_top_order [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTop \u03b1] [OrderTopology \u03b1] :\n \ud835\udcdd (\u22a4 : \u03b1) = \u2a05 (l) (_ : l < \u22a4), \ud835\udcdf (Ioi l) := by simp [nhds_eq_order (\u22a4 : \u03b1)]\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Topology.Order.Basic.StrictMono (L321-L327)\ntheorem StrictMono.isEmbedding_of_ordConnected {\u03b1 \u03b2 : Type*} [LinearOrder \u03b1] [LinearOrder \u03b2]\n [TopologicalSpace \u03b1] [h : OrderTopology \u03b1] [TopologicalSpace \u03b2] [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2}\n (hf : StrictMono f) (hc : OrdConnected (range f)) : IsEmbedding f :=\n\u27e8\u27e8h.1.trans <| Eq.symm <| hf.induced_topology_eq_preorder hc\u27e9, hf.injective\u27e9\n\n/-- An `OrderEmbedding` is a topological embedding provided that the range of `f` is\norder-connected -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Topology.Order.Basic.orderTopology_of_ordConnected (L335-L339)\ninstance orderTopology_of_ordConnected {\u03b1 : Type u} [TopologicalSpace \u03b1] [LinearOrder \u03b1]\n [OrderTopology \u03b1] {t : Set \u03b1} [ht : OrdConnected t] : OrderTopology t :=\n\u27e8(Subtype.strictMono_coe (\u00b7 \u2208 t)).induced_topology_eq_preorder <| by\n rwa [\u2190 @Subtype.range_val _ t] at ht\u27e9\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Icc_mem_subset_of_mem_nhds (L480-L489)\ntheorem exists_Icc_mem_subset_of_mem_nhds {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) :\n \u2203 b c, a \u2208 Icc b c \u2227 Icc b c \u2208 \ud835\udcdd a \u2227 Icc b c \u2286 s := by\nrcases exists_Icc_mem_subset_of_mem_nhdsLE (nhdsWithin_le_nhds hs) with\n \u27e8b, hba, hb_nhds, hbs\u27e9\n rcases exists_Icc_mem_subset_of_mem_nhdsGE (nhdsWithin_le_nhds hs) with\n \u27e8c, hac, hc_nhds, hcs\u27e9\n refine \u27e8b, c, \u27e8hba, hac\u27e9, ?_\u27e9\n rw [\u2190 Icc_union_Icc_eq_Icc hba hac, \u2190 nhdsLE_sup_nhdsGE]\n exact \u27e8union_mem_sup hb_nhds hc_nhds, union_subset hbs hcs\u27e9\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsGT_eq_atBot_iff (L73-L79)\ntheorem comap_coe_nhdsGT_eq_atBot_iff :\n comap ((\u2191) : s \u2192 X) (\ud835\udcdd[>] b) = atBot \u2194\n s \u2286 Ioi b \u2227 (s.Nonempty \u2192 \u2200 a > b, (s \u2229 Ioo b a).Nonempty) := by\nrefine comap_coe_nhdsLT_eq_atTop_iff (s := OrderDual.ofDual \u207b\u00b9' s) (b := OrderDual.toDual b)\n |>.trans ?_\n simp [\u2190 preimage_inter, ofDual.surjective]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Topology.Order.Basic.IsOpen (L490-L502)\ntheorem IsOpen.exists_Ioo_subset [Nontrivial \u03b1] {s : Set \u03b1} (hs : IsOpen s) (h : s.Nonempty) :\n \u2203 a b, a < b \u2227 Ioo a b \u2286 s := by\nobtain \u27e8x, hx\u27e9 : \u2203 x, x \u2208 s := h\n obtain \u27e8y, hy\u27e9 : \u2203 y, y \u2260 x := exists_ne x\n rcases lt_trichotomy x y with (H | rfl | H)\n \u00b7 obtain \u27e8u, xu, hu\u27e9 : \u2203 u, x < u \u2227 Ico x u \u2286 s :=\n exists_Ico_subset_of_mem_nhds (hs.mem_nhds hx) \u27e8y, H\u27e9\n exact \u27e8x, u, xu, Ioo_subset_Ico_self.trans hu\u27e9\n \u00b7 exact (hy rfl).elim\n \u00b7 obtain \u27e8l, lx, hl\u27e9 : \u2203 l, l < x \u2227 Ioc l x \u2286 s :=\n exists_Ioc_subset_of_mem_nhds (hs.mem_nhds hx) \u27e8y, H\u27e9\n exact \u27e8l, x, lx, Ioo_subset_Ioc_self.trans hl\u27e9\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_of_tendsto_of_tendsto_of_le_of_le' (L219-L227)\ntheorem tendsto_of_tendsto_of_tendsto_of_le_of_le' [OrderTopology \u03b1] {f g h : \u03b2 \u2192 \u03b1} {b : Filter \u03b2}\n {a : \u03b1} (hg : Tendsto g b (\ud835\udcdd a)) (hh : Tendsto h b (\ud835\udcdd a)) (hgf : \u2200\u1da0 b in b, g b \u2264 f b)\n (hfh : \u2200\u1da0 b in b, f b \u2264 h b) : Tendsto f b (\ud835\udcdd a) :=\n(hg.Icc hh).of_smallSets <| hgf.and hfh\n\nalias Filter.Tendsto.squeeze' := tendsto_of_tendsto_of_tendsto_of_le_of_le'\n\n/-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities\nhold everywhere. -/\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_bot_mono' (L419-L429)\ntheorem tendsto_nhds_bot_mono' [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderBot \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a5)) (hg : g \u2264 f) : Tendsto g l (\ud835\udcdd \u22a5) :=\ntendsto_nhds_bot_mono hf (Eventually.of_forall hg)\n\nsection LinearOrder\n\nvariable [TopologicalSpace \u03b1] [LinearOrder \u03b1]\n\nsection OrderTopology\nvariable [OrderTopology \u03b1]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Topology.Order.Basic.isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom (L183-L218)\nlemma isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom (c : Set \u03b1)\n (h : ts = generateFrom { s | \u2203 a \u2208 c, s = Ioi a \u2228 s = Iio a }) :\n IsTopologicalBasis {s | \u2203 (f g : Set \u03b1), f \u2286 c \u2227 g \u2286 c \u2227 f.Finite \u2227 g.Finite\n \u2227 s = (\u22c2 a \u2208 f, Ioi a) \u2229 (\u22c2 a \u2208 g, Iio a)} := by\nrefine IsTopologicalBasis.of_isOpen_of_subset ?_ (isTopologicalBasis_of_subbasis h) ?_\n \u00b7 rintro u \u27e8f, g, hfc, hgc, hf_fin, hg_fin, rfl\u27e9\n apply IsOpen.inter\n \u00b7 apply hf_fin.isOpen_biInter (fun i hi \u21a6 ?_)\n rw [h]\n exact isOpen_generateFrom_of_mem \u27e8i, hfc hi, Or.inl rfl\u27e9\n \u00b7 apply hg_fin.isOpen_biInter (fun i hi \u21a6 ?_)\n rw [h]\n exact isOpen_generateFrom_of_mem \u27e8i, hgc hi, Or.inr rfl\u27e9\n simp only [exists_and_left, image_subset_iff, preimage_setOf_eq, setOf_subset_setOf, and_imp]\n intro k k_fin hk\n let kl := {s \u2208 k | \u2203 a \u2208 c, s = Ioi a}\n let kr := {s \u2208 k | \u2203 a \u2208 c, s = Iio a}\n have k_eq : k = kl \u222a kr := by\n -- this `have` can be removed, but makes `grind` slower\n have : \u2200 s \u2208 k, \u2203 a \u2208 c, s = Ioi a \u2228 s = Iio a := hk\n ext\n grind\n have : Finite kl := k_fin.subset (by simp [k_eq])\n have : Finite kr := k_fin.subset (by simp [k_eq])\n have Al : \u2200 s : kl, \u2203 a \u2208 c, s = Ioi a := fun s \u21a6 s.2.2\n choose al alc hal using Al\n have Ar : \u2200 s : kr, \u2203 a \u2208 c, s = Iio a := fun s \u21a6 s.2.2\n choose ar arc har using Ar\n refine \u27e8range al, by simp [range_subset_iff, alc], range ar,\n by simp [range_subset_iff, arc], finite_range _, finite_range _, ?_\u27e9\n rw [k_eq, sInter_eq_biInter, biInter_union, biInter_range, biInter_range, biInter_eq_iInter,\n biInter_eq_iInter]\n simp [hal, har]\n\n/-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities\nhold eventually for the filter. -/\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_order_unbounded (L240-L247)\ntheorem tendsto_order_unbounded [OrderTopology \u03b1] {f : \u03b2 \u2192 \u03b1} {a : \u03b1} {x : Filter \u03b2}\n (hu : \u2203 u, a < u) (hl : \u2203 l, l < a) (h : \u2200 l u, l < a \u2192 a < u \u2192 \u2200\u1da0 b in x, l < f b \u2227 f b < u) :\n Tendsto f x (\ud835\udcdd a) := by\nsimp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal]\n exact fun l hl u => h l u hl\n\nend Preorder\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_basis_of_exists_lt (L367-L371)\ntheorem nhdsLE_basis_of_exists_lt [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 l, l < a) : (\ud835\udcdd[\u2264] a).HasBasis (fun l => l < a) fun l => Ioc l a := by\nconvert nhdsGE_basis_of_exists_gt (\u03b1 := \u03b1\u1d52\u1d48) ha using 2\n exact Ico_toDual.symm\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Topology.Order.Basic.induced_orderTopology (L301-L320)\ntheorem induced_orderTopology {\u03b1 : Type u} {\u03b2 : Type v} [Preorder \u03b1] [ta : TopologicalSpace \u03b2]\n [Preorder \u03b2] [OrderTopology \u03b2] (f : \u03b1 \u2192 \u03b2) (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H : \u2200 {x y}, x < y \u2192 \u2203 a, x < f a \u2227 f a < y) : @OrderTopology _ (induced f ta) _ :=\ninduced_orderTopology' f (hf)\n (fun xa => let \u27e8b, xb, ba\u27e9 := H xa; \u27e8b, hf.1 ba, le_of_lt xb\u27e9)\n fun ax => let \u27e8b, ab, bx\u27e9 := H ax; \u27e8b, hf.1 ab, le_of_lt bx\u27e9\n\n/-- The topology induced by a strictly monotone function with order-connected range is the preorder\ntopology. -/\nnonrec theorem StrictMono.induced_topology_eq_preorder {\u03b1 \u03b2 : Type*} [LinearOrder \u03b1]\n [LinearOrder \u03b2] [t : TopologicalSpace \u03b2] [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2}\n (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology \u03b1 := by\n refine induced_topology_eq_preorder hf.lt_iff_lt (fun h\u2081 h\u2082 => ?_) fun h\u2081 h\u2082 => ?_\n \u00b7 rcases hc.out (mem_range_self _) (mem_range_self _) \u27e8not_lt.1 h\u2082, h\u2081.le\u27e9 with \u27e8y, rfl\u27e9\n exact \u27e8y, hf.lt_iff_lt.1 h\u2081, le_rfl\u27e9\n \u00b7 rcases hc.out (mem_range_self _) (mem_range_self _) \u27e8h\u2081.le, not_lt.1 h\u2082\u27e9 with \u27e8y, rfl\u27e9\n exact \u27e8y, hf.lt_iff_lt.1 h\u2081, le_rfl\u27e9\n\n/-- A strictly monotone function between linear orders with order topology is a topological\nembedding provided that the range of `f` is order-connected. -/\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.Topology.Order.LocalExtr).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsLocalMax.on (h : IsLocalMax f a) (s) : IsLocalMaxOn f s a\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L49-L52)\ndef IsLocalMinOn :=\nIsMinFilter f (\ud835\udcdd[s] a) a\n\n/-- `IsLocalMaxOn f s a` means that `f x \u2264 f a` for all `x \u2208 s` in some neighborhood of `a`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L53-L56)\ndef IsLocalMaxOn :=\nIsMaxFilter f (\ud835\udcdd[s] a) a\n\n/-- `IsLocalExtrOn f s a` means `IsLocalMinOn f s a \u2228 IsLocalMaxOn f s a`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L57-L60)\ndef IsLocalExtrOn :=\nIsExtrFilter f (\ud835\udcdd[s] a) a\n\n/-- `IsLocalMin f a` means that `f a \u2264 f x` for all `x` in some neighborhood of `a`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMin (L61-L64)\ndef IsLocalMin :=\nIsMinFilter f (\ud835\udcdd a) a\n\n/-- `IsLocalMax f a` means that `f x \u2264 f a` for all `x \u2208 s` in some neighborhood of `a`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtr (L69-L73)\ndef IsLocalExtr :=\nIsExtrFilter f (\ud835\udcdd a) a\n\nvariable {f s a}\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L74-L77)\ntheorem IsLocalExtrOn.elim {p : Prop} :\n IsLocalExtrOn f s a \u2192 (IsLocalMinOn f s a \u2192 p) \u2192 (IsLocalMaxOn f s a \u2192 p) \u2192 p :=\nOr.elim\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtr (L78-L83)\ntheorem IsLocalExtr.elim {p : Prop} :\n IsLocalExtr f a \u2192 (IsLocalMin f a \u2192 p) \u2192 (IsLocalMax f a \u2192 p) \u2192 p :=\nOr.elim\n\n/-! ### Restriction to (sub)sets -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMin (L84-L86)\ntheorem IsLocalMin.on (h : IsLocalMin f a) (s) : IsLocalMinOn f s a :=\nh.filter_inf _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtr (L90-L92)\ntheorem IsLocalExtr.on (h : IsLocalExtr f a) (s) : IsLocalExtrOn f s a :=\nh.filter_inf _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L93-L96)\ntheorem IsLocalMinOn.on_subset {t : Set \u03b1} (hf : IsLocalMinOn f t a) (h : s \u2286 t) :\n IsLocalMinOn f s a :=\nhf.filter_mono <| nhdsWithin_mono a h\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L97-L100)\ntheorem IsLocalMaxOn.on_subset {t : Set \u03b1} (hf : IsLocalMaxOn f t a) (h : s \u2286 t) :\n IsLocalMaxOn f s a :=\nhf.filter_mono <| nhdsWithin_mono a h\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L101-L104)\ntheorem IsLocalExtrOn.on_subset {t : Set \u03b1} (hf : IsLocalExtrOn f t a) (h : s \u2286 t) :\n IsLocalExtrOn f s a :=\nhf.filter_mono <| nhdsWithin_mono a h\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L105-L107)\ntheorem IsLocalMinOn.inter (hf : IsLocalMinOn f s a) (t) : IsLocalMinOn f (s \u2229 t) a :=\nhf.on_subset inter_subset_left\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L108-L110)\ntheorem IsLocalMaxOn.inter (hf : IsLocalMaxOn f s a) (t) : IsLocalMaxOn f (s \u2229 t) a :=\nhf.on_subset inter_subset_left\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L111-L113)\ntheorem IsLocalExtrOn.inter (hf : IsLocalExtrOn f s a) (t) : IsLocalExtrOn f (s \u2229 t) a :=\nhf.on_subset inter_subset_left\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsMinOn (L114-L116)\ntheorem IsMinOn.localize (hf : IsMinOn f s a) : IsLocalMinOn f s a :=\nhf.filter_mono <| inf_le_right\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsMaxOn (L117-L119)\ntheorem IsMaxOn.localize (hf : IsMaxOn f s a) : IsLocalMaxOn f s a :=\nhf.filter_mono <| inf_le_right\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsExtrOn (L120-L122)\ntheorem IsExtrOn.localize (hf : IsExtrOn f s a) : IsLocalExtrOn f s a :=\nhf.filter_mono <| inf_le_right\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMinOn (L123-L126)\ntheorem IsLocalMinOn.isLocalMin (hf : IsLocalMinOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalMin f a :=\nhave : \ud835\udcdd a \u2264 \ud835\udcdf s := le_principal_iff.2 hs\n hf.filter_mono <| le_inf le_rfl this\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalMaxOn (L127-L130)\ntheorem IsLocalMaxOn.isLocalMax (hf : IsLocalMaxOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalMax f a :=\nhave : \ud835\udcdd a \u2264 \ud835\udcdf s := le_principal_iff.2 hs\n hf.filter_mono <| le_inf le_rfl this\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsLocalExtrOn (L131-L133)\ntheorem IsLocalExtrOn.isLocalExtr (hf : IsLocalExtrOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalExtr f a :=\nhf.elim (fun hf => (hf.isLocalMin hs).isExtr) fun hf => (hf.isLocalMax hs).isExtr\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Order.LocalExtr.isLocalMinOn_univ_iff (L134-L136)\nlemma isLocalMinOn_univ_iff : IsLocalMinOn f univ a \u2194 IsLocalMin f a := by\nsimp only [IsLocalMinOn, IsLocalMin, nhdsWithin_univ]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Order.LocalExtr.isLocalMaxOn_univ_iff (L137-L139)\nlemma isLocalMaxOn_univ_iff : IsLocalMaxOn f univ a \u2194 IsLocalMax f a := by\nsimp only [IsLocalMaxOn, IsLocalMax, nhdsWithin_univ]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Order.LocalExtr.isLocalExtrOn_univ_iff (L140-L142)\nlemma isLocalExtrOn_univ_iff : IsLocalExtrOn f univ a \u2194 IsLocalExtr f a :=\nisLocalMinOn_univ_iff.or isLocalMaxOn_univ_iff\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Order.LocalExtr.IsMinOn (L143-L145)\ntheorem IsMinOn.isLocalMin (hf : IsMinOn f s a) (hs : s \u2208 \ud835\udcdd a) : IsLocalMin f a :=\nhf.localize.isLocalMin hs\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIooClassNhds (L155-L160)\ninstance tendstoIooClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Ioo (\ud835\udcdd a) (\ud835\udcdd a) :=\ntendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self\n\nvariable (\u03b1) in\n/-- In a second countable topological space with the order topology, the topology is generated\nby half-infinite open intervals with endpoints in a countable set. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_eq_order (L132-L137)\ntheorem nhds_eq_order [OrderTopology \u03b1] (a : \u03b1) :\n \ud835\udcdd a = (\u2a05 b \u2208 Iio a, \ud835\udcdf (Ioi b)) \u2293 \u2a05 b \u2208 Ioi a, \ud835\udcdf (Iio b) := by\nrw [OrderTopology.topology_eq_generate_intervals (\u03b1 := \u03b1), nhds_generateFrom]\n simp_rw [mem_setOf_eq, @and_comm (a \u2208 _), exists_or, or_and_right, iInf_or, iInf_and,\n iInf_exists, iInf_inf_eq, iInf_comm (\u03b9 := Set \u03b1), iInf_iInf_eq_left, mem_Ioi, mem_Iio]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Ioi_nhdsGT (L130-L133)\ntheorem comap_coe_Ioi_nhdsGT (a : X) (ha : IsPredPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : Ioi a \u2192 X) (\ud835\udcdd[>] a) = atBot :=\n comap_coe_nhdsGT_of_Ioo_subset Subset.rfl (fun \u27e8x, hx\u27e9 => \u27e8x, hx, Ioo_subset_Ioi_self\u27e9) ha\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_order_unbounded (L236-L239)\ntheorem nhds_order_unbounded [OrderTopology \u03b1] {a : \u03b1} (hu : \u2203 u, a < u) (hl : \u2203 l, l < a) :\n \ud835\udcdd a = \u2a05 (l) (_ : l < a) (u) (_ : a < u), \ud835\udcdf (Ioo l u) := by\nsimp only [nhds_eq_order, \u2190 inf_biInf, \u2190 biInf_inf, *, \u2190 inf_principal, \u2190 Ioi_inter_Iio]; rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ioc_subset_of_mem_nhds (L442-L445)\ntheorem exists_Ioc_subset_of_mem_nhds {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) (h : \u2203 l, l < a) :\n \u2203 l < a, Ioc l a \u2286 s :=\n(nhdsLE_basis_of_exists_lt h).mem_iff.mp (nhdsWithin_le_nhds hs)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_iff_generate_intervals (L106-L109)\ntheorem isOpen_iff_generate_intervals [t : OrderTopology \u03b1] {s : Set \u03b1} :\n IsOpen s \u2194 GenerateOpen { s | \u2203 a, s = Ioi a \u2228 s = Iio a } s := by\nrw [t.topology_eq_generate_intervals]; rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Ioi_atBot (L150-L153)\ntheorem map_coe_Ioi_atBot (a : X) (ha : IsPredPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : Ioi a \u2192 X) atBot = \ud835\udcdd[>] a :=\n map_coe_atBot_of_Ioo_subset Subset.rfl (fun b hb => \u27e8b, hb, Ioo_subset_Ioi_self\u27e9) ha\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Order.Basic.gt_mem_nhds (L126-L128)\ntheorem gt_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd a, x < b :=\n(isOpen_gt' _).mem_nhds h\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ico_subset_of_mem_nhds (L457-L462)\ntheorem exists_Ico_subset_of_mem_nhds {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) (h : \u2203 u, a < u) :\n \u2203 u, a < u \u2227 Ico a u \u2286 s :=\nlet \u27e8_l', hl'\u27e9 := h\n let \u27e8l, hl\u27e9 := exists_Ico_subset_of_mem_nhds' hs hl'\n \u27e8l, hl.1.1, hl.2\u27e9\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Ioo_atTop (L162-L165)\ntheorem tendsto_comp_coe_Ioo_atTop (h : a < b) (hb : IsSuccPrelimit b := by exact .of_dense _) :\nTendsto (fun x : Ioo a b => f x) atTop l \u2194 Tendsto f (\ud835\udcdd[<] b) l := by\n rw [\u2190 map_coe_Ioo_atTop h hb, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Order.Basic.ge_mem_nhds (L129-L131)\ntheorem ge_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd a, x \u2264 b :=\n(gt_mem_nhds h).mono fun _ => le_of_lt\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsLT_of_Ioo_subset (L80-L89)\ntheorem comap_coe_nhdsLT_of_Ioo_subset (hsb : s \u2286 Iio b) (hs : s.Nonempty \u2192 \u2203 a < b, Ioo a b \u2286 s)\n (hb : IsSuccPrelimit b := by exact .of_dense _) :\ncomap ((\u2191) : s \u2192 X) (\ud835\udcdd[<] b) = atTop := by\n rw [comap_coe_nhdsLT_eq_atTop_iff]\n refine \u27e8hsb, fun hsne a ha \u21a6 ?_\u27e9\n rcases hs hsne with \u27e8c, hcb, hcs\u27e9\n rcases hb.lt_iff_exists_lt.mp (max_lt ha hcb) with \u27e8x, hxb, hacx\u27e9\n rw [max_lt_iff] at hacx\n exact \u27e8x, hcs \u27e8hacx.2, hxb\u27e9, hacx.1, hxb\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_atTop_of_Ioo_subset (L96-L105)\ntheorem map_coe_atTop_of_Ioo_subset (hsb : s \u2286 Iio b) (hs : \u2200 a' < b, \u2203 a < b, Ioo a b \u2286 s)\n (hb : IsSuccPrelimit b := by exact .of_dense _) :\nmap ((\u2191) : s \u2192 X) atTop = \ud835\udcdd[<] b := by\n rcases eq_empty_or_nonempty (Iio b) with (hb' | \u27e8a, ha\u27e9)\n \u00b7 have : IsEmpty s := \u27e8fun x => hb'.subset (hsb x.2)\u27e9\n rw [filter_eq_bot_of_isEmpty atTop, Filter.map_bot, hb', nhdsWithin_empty]\n \u00b7 rw [\u2190 comap_coe_nhdsLT_of_Ioo_subset hsb (fun _ => hs a ha) hb, map_comap_of_mem]\n rw [Subtype.range_val]\n exact (mem_nhdsLT_iff_exists_Ioo_subset' ha).2 (hs a ha)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_top_mono' (L415-L418)\ntheorem tendsto_nhds_top_mono' [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderTop \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a4)) (hg : f \u2264 g) : Tendsto g l (\ud835\udcdd \u22a4) :=\ntendsto_nhds_top_mono hf (Eventually.of_forall hg)\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Order.Basic.exists_countable_generateFrom_Ioi_Iio (L161-L182)\nlemma exists_countable_generateFrom_Ioi_Iio\n [OrderTopology \u03b1] [SecondCountableTopology \u03b1] :\n \u2203 (c : Set \u03b1), c.Countable \u2227 ts = generateFrom { s | \u2203 a \u2208 c, s = Ioi a \u2228 s = Iio a } := by\nrcases isEmpty_or_nonempty \u03b1 with h\u03b1 | h\u03b1\n \u00b7 exact \u27e8\u2205, by simp, Subsingleton.elim _ _\u27e9\n obtain \u27e8t, t_subs, t_count, ht\u27e9 : \u2203 t \u2286 { s | \u2203 a, s = Ioi a \u2228 s = Iio a },\n t.Countable \u2227 ts = generateFrom t :=\n exists_countable_of_generateFrom OrderTopology.topology_eq_generate_intervals\n have A : \u2200 s \u2208 t, \u2203 a, s = Ioi a \u2228 s = Iio a := t_subs\n choose! a ha using A\n refine \u27e8a '' t, t_count.image _, ?_\u27e9\n apply le_antisymm\n \u00b7 apply le_generateFrom_iff_subset_isOpen.2\n simp only [mem_image, exists_exists_and_eq_and, setOf_subset_setOf, forall_exists_index,\n and_imp]\n grind [isOpen_Iio', isOpen_Ioi']\n \u00b7 rw [ht]\n apply generateFrom_anti\n grind\n\n/-- If a topology is generated by half-open intervals with endpoints in a set `c`, then the sets\nformed by intersecting finitely many of these intervals form a topological basis. -/\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Ioo_atTop (L140-L143)\ntheorem map_coe_Ioo_atTop (h : a < b) (hb : IsSuccPrelimit b := by exact .of_dense _) :\nmap ((\u2191) : Ioo a b \u2192 X) atTop = \ud835\udcdd[<] b :=\n map_coe_atTop_of_Ioo_subset Ioo_subset_Iio_self (fun _ _ => \u27e8_, h, Subset.rfl\u27e9) hb\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Topology.Order.Basic.induced_topology_eq_preorder (L273-L293)\ntheorem induced_topology_eq_preorder [Preorder \u03b1] [Preorder \u03b2] [TopologicalSpace \u03b2]\n [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H\u2081 : \u2200 {a b x}, b < f a \u2192 \u00ac(b < f x) \u2192 \u2203 y, y < a \u2227 b \u2264 f y)\n (H\u2082 : \u2200 {a b x}, f a < b \u2192 \u00ac(f x < b) \u2192 \u2203 y, a < y \u2227 f y \u2264 b) :\n induced f \u2039TopologicalSpace \u03b2\u203a = Preorder.topology \u03b1 := by\nlet _ := Preorder.topology \u03b1; have : OrderTopology \u03b1 := \u27e8rfl\u27e9\n refine le_antisymm (induced_topology_le_preorder hf) ?_\n refine le_of_nhds_le_nhds fun a => ?_\n simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]\n refine inf_le_inf (le_iInf\u2082 fun b hb => ?_) (le_iInf\u2082 fun b hb => ?_)\n \u00b7 by_cases! h : \u2203 x, \u00ac(b < f x)\n \u00b7 rcases h with \u27e8x, hx\u27e9\n rcases H\u2081 hb hx with \u27e8y, hya, hyb\u27e9\n exact iInf\u2082_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz))\n \u00b7 exact le_principal_iff.2 (univ_mem' h)\n \u00b7 by_cases! h : \u2203 x, \u00ac(f x < b)\n \u00b7 rcases h with \u27e8x, hx\u27e9\n rcases H\u2082 hb hx with \u27e8y, hya, hyb\u27e9\n exact iInf\u2082_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb)\n \u00b7 exact le_principal_iff.2 (univ_mem' h)\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Ioo_atBot (L167-L170)\ntheorem tendsto_comp_coe_Ioo_atBot (h : a < b) (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto (fun x : Ioo a b => f x) atBot l \u2194 Tendsto f (\ud835\udcdd[>] a) l := by\n rw [\u2190 map_coe_Ioo_atBot h ha, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Iio_atTop (L155-L160)\ntheorem map_coe_Iio_atTop (a : X) (ha : IsSuccPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : Iio a \u2192 X) atTop = \ud835\udcdd[<] a :=\n map_coe_Ioi_atBot (toDual a) ha.dual\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1} {f : X \u2192 \u03b1}\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIccClassNhdsPi (L253-L263)\ninstance tendstoIccClassNhdsPi {\u03b9 : Type*} {\u03b1 : \u03b9 \u2192 Type*} [\u2200 i, Preorder (\u03b1 i)]\n [\u2200 i, TopologicalSpace (\u03b1 i)] [\u2200 i, OrderTopology (\u03b1 i)] (f : \u2200 i, \u03b1 i) :\n TendstoIxxClass Icc (\ud835\udcdd f) (\ud835\udcdd f) := by\nconstructor\n conv in (\ud835\udcdd f).smallSets => rw [nhds_pi, Filter.pi]\n simp only [smallSets_iInf, smallSets_comap_eq_comap_image, tendsto_iInf, tendsto_comap_iff]\n intro i\n have : Tendsto (fun g : \u2200 i, \u03b1 i => g i) (\ud835\udcdd f) (\ud835\udcdd (f i)) := (continuous_apply i).tendsto f\n refine (this.comp tendsto_fst).Icc (this.comp tendsto_snd) |>.smallSets_mono ?_\n filter_upwards [] using fun \u27e8f, g\u27e9 \u21a6 image_subset_iff.mpr fun p hp \u21a6 \u27e8hp.1 i, hp.2 i\u27e9\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsLT_eq_atTop_iff (L36-L72)\ntheorem comap_coe_nhdsLT_eq_atTop_iff :\n comap ((\u2191) : s \u2192 X) (\ud835\udcdd[<] b) = atTop \u2194\n s \u2286 Iio b \u2227 (s.Nonempty \u2192 \u2200 a < b, (s \u2229 Ioo a b).Nonempty) := by\nrcases s.eq_empty_or_nonempty with rfl | hsne\n \u00b7 simp [eq_iff_true_of_subsingleton]\n have := hsne.to_subtype\n simp only [hsne, true_imp_iff]\n by_cases hsub : s \u2286 Iio b\n \u00b7 simp only [hsub, true_and]\n constructor\n \u00b7 intro h a ha\n have := preimage_mem_comap (m := ((\u2191) : s \u2192 X)) (Ioo_mem_nhdsLT ha)\n rw [h] at this\n rcases Filter.nonempty_of_mem this with \u27e8\u27e8c, hcs\u27e9, hc\u27e9\n exact \u27e8c, hcs, hc\u27e9\n \u00b7 intro h\n refine (nhdsLT_basis_of_exists_lt (hsne.mono hsub)).comap _ |>.ext atTop_basis ?_ ?_\n \u00b7 intro a hab\n rcases h a hab with \u27e8c, hcs, hc\u27e9\n use \u27e8c, hcs\u27e9\n simp_all [subset_def, hc.1.trans_le]\n \u00b7 rintro \u27e8a, has\u27e9 -\n use a, hsub has\n simp_all [subset_def, le_of_lt]\n \u00b7 suffices \u00acTendsto (\u2191) (atTop : Filter s) (\ud835\udcdd[<] b) by\n contrapose this\n simp_all [tendsto_iff_comap]\n intro h\n rcases not_subset_iff_exists_mem_notMem.mp hsub with \u27e8a, has, ha\u27e9\n rcases h.eventually eventually_mem_nhdsWithin |>.and (eventually_ge_atTop \u27e8a, has\u27e9) |>.exists\n with \u27e8\u27e8c, hcs\u27e9, hcb, hac\u27e9\n apply lt_irrefl a\n calc\n a \u2264 c := by simpa using hac\n _ < b := by simpa using hcb\n _ \u2264 a := by simpa using ha\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Iio_atTop (L177-L180)\ntheorem tendsto_comp_coe_Iio_atTop (ha : IsSuccPrelimit a := by exact .of_dense _) :\nTendsto (fun x : Iio a => f x) atTop l \u2194 Tendsto f (\ud835\udcdd[<] a) l := by\n rw [\u2190 map_coe_Iio_atTop a ha, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Iio_nhdsLT (L135-L138)\ntheorem comap_coe_Iio_nhdsLT (a : X) (ha : IsSuccPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : Iio a \u2192 X) (\ud835\udcdd[<] a) = atTop :=\n comap_coe_Ioi_nhdsGT (toDual a) ha.dual\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_bot_mono (L411-L414)\ntheorem tendsto_nhds_bot_mono [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderBot \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a5)) (hg : g \u2264\u1da0[l] f) : Tendsto g l (\ud835\udcdd \u22a5) :=\ntendsto_nhds_top_mono (\u03b2 := \u03b2\u1d52\u1d48) hf hg\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_comp_coe_Ioi_atBot (L172-L175)\ntheorem tendsto_comp_coe_Ioi_atBot (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto (fun x : Ioi a => f x) atBot l \u2194 Tendsto f (\ud835\udcdd[>] a) l := by\n rw [\u2190 map_coe_Ioi_atBot a ha, tendsto_map'_iff, Function.comp_def]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_bot_basis (L391-L394)\ntheorem nhds_bot_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderBot \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] : (\ud835\udcdd \u22a5).HasBasis (fun a : \u03b1 => \u22a5 < a) fun a : \u03b1 => Iio a :=\nnhds_top_basis (\u03b1 := \u03b1\u1d52\u1d48)\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_basis (L372-L375)\ntheorem nhdsGE_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] [NoMaxOrder \u03b1] (a : \u03b1) :\n (\ud835\udcdd[\u2265] a).HasBasis (fun u => a < u) fun u => Ico a u :=\nnhdsGE_basis_of_exists_gt (exists_gt a)\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Topology.Order.Basic.lt_mem_nhds (L120-L122)\ntheorem lt_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd b, a < x :=\n(isOpen_lt' _).mem_nhds h\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_gt' (L115-L117)\ntheorem isOpen_gt' [OrderTopology \u03b1] (a : \u03b1) : IsOpen { b : \u03b1 | b < a } :=\nisOpen_iff_generate_intervals.2 <| .basic _ \u27e8a, .inr rfl\u27e9\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Topology.Order.Basic.le_mem_nhds (L123-L125)\ntheorem le_mem_nhds [OrderTopology \u03b1] {a b : \u03b1} (h : a < b) : \u2200\u1da0 x in \ud835\udcdd b, a \u2264 x :=\n(lt_mem_nhds h).mono fun _ => le_of_lt\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_eq_iInf_inf_principal (L346-L349)\ntheorem nhdsLE_eq_iInf_inf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] (a : \u03b1) :\n \ud835\udcdd[\u2264] a = (\u2a05 l < a, \ud835\udcdf (Ioi l)) \u2293 \ud835\udcdf (Iic a) :=\nnhdsGE_eq_iInf_inf_principal (toDual a)\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Topology.Order.Basic.induced_orderTopology' (L294-L300)\ntheorem induced_orderTopology' {\u03b1 : Type u} {\u03b2 : Type v} [Preorder \u03b1] [ta : TopologicalSpace \u03b2]\n [Preorder \u03b2] [OrderTopology \u03b2] (f : \u03b1 \u2192 \u03b2) (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H\u2081 : \u2200 {a x}, x < f a \u2192 \u2203 b < a, x \u2264 f b) (H\u2082 : \u2200 {a x}, f a < x \u2192 \u2203 b > a, f b \u2264 x) :\n @OrderTopology _ (induced f ta) _ :=\nlet _ := induced f ta\n \u27e8induced_topology_eq_preorder hf (fun h _ => H\u2081 h) (fun h _ => H\u2082 h)\u27e9\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Ioo_atBot (L187-L190)\ntheorem tendsto_Ioo_atBot {f : \u03b1 \u2192 Ioo a b} (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto f l atBot \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[>] a) := by\n rw [\u2190 comap_coe_Ioo_nhdsGT a b ha, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_eq_iInf_principal (L354-L357)\ntheorem nhdsLE_eq_iInf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 l, l < a) : \ud835\udcdd[\u2264] a = \u2a05 l < a, \ud835\udcdf (Ioc l a) := by\nsimp only [nhdsLE_eq_iInf_inf_principal, biInf_inf ha, inf_principal, Ioi_inter_Iic]\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Ioi_atBot (L192-L195)\ntheorem tendsto_Ioi_atBot {f : \u03b1 \u2192 Ioi a} (ha : IsPredPrelimit a := by exact .of_dense _) :\nTendsto f l atBot \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[>] a) := by\n rw [\u2190 comap_coe_Ioi_nhdsGT a ha, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Iio_atTop (L197-L199)\ntheorem tendsto_Iio_atTop {f : \u03b1 \u2192 Iio a} (ha : IsSuccPrelimit a := by exact .of_dense _) :\nTendsto f l atTop \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[<] a) := by\n rw [\u2190 comap_coe_Iio_nhdsLT a ha, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_bot_order (L383-L385)\ntheorem nhds_bot_order [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderBot \u03b1] [OrderTopology \u03b1] :\n \ud835\udcdd (\u22a5 : \u03b1) = \u2a05 (l) (_ : \u22a5 < l), \ud835\udcdf (Iio l) := by simp [nhds_eq_order (\u22a5 : \u03b1)]\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_top_mono (L405-L410)\ntheorem tendsto_nhds_top_mono [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderTop \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a4)) (hg : f \u2264\u1da0[l] g) : Tendsto g l (\ud835\udcdd \u22a4) := by\nsimp only [nhds_top_order, tendsto_iInf, tendsto_principal] at hf \u22a2\n intro x hx\n filter_upwards [hf x hx, hg] with _ using lt_of_lt_of_le\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_eq_iInf_inf_principal (L340-L345)\ntheorem nhdsGE_eq_iInf_inf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] (a : \u03b1) :\n \ud835\udcdd[\u2265] a = (\u2a05 (u) (_ : a < u), \ud835\udcdf (Iio u)) \u2293 \ud835\udcdf (Ici a) := by\nrw [nhdsWithin, nhds_eq_order]\n refine le_antisymm (inf_le_inf_right _ inf_le_right) (le_inf (le_inf ?_ inf_le_left) inf_le_right)\n exact inf_le_right.trans (le_iInf\u2082 fun l hl => principal_mono.2 <| Ici_subset_Ioi.2 hl)\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Topology.Order.Basic.Preorder (L79-L86)\ndef Preorder.topology (\u03b1 : Type*) [Preorder \u03b1] : TopologicalSpace \u03b1 :=\ngenerateFrom { s : Set \u03b1 | \u2203 a : \u03b1, s = { b : \u03b1 | a < b } \u2228 s = { b : \u03b1 | b < a } }\n\nsection Preorder\n\nvariable [ts : TopologicalSpace \u03b1] [Preorder \u03b1]\n\n/-- A countable preordered set equipped with the order topology is second countable. -/\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Icc_mem_subset_of_mem_nhdsGE (L463-L474)\ntheorem exists_Icc_mem_subset_of_mem_nhdsGE {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd[\u2265] a) :\n \u2203 b, a \u2264 b \u2227 Icc a b \u2208 \ud835\udcdd[\u2265] a \u2227 Icc a b \u2286 s := by\nrcases (em (IsMax a)).imp_right not_isMax_iff.mp with (ha | ha)\n \u00b7 use a\n simpa [ha.Ici_eq] using hs\n \u00b7 rcases (nhdsGE_basis_of_exists_gt ha).mem_iff.mp hs with \u27e8b, hab, hbs\u27e9\n rcases eq_empty_or_nonempty (Ioo a b) with (H | \u27e8c, hac, hcb\u27e9)\n \u00b7 have : Ico a b = Icc a a := by rw [\u2190 Icc_union_Ioo_eq_Ico le_rfl hab, H, union_empty]\n exact \u27e8a, le_rfl, this \u25b8 \u27e8Ico_mem_nhdsGE hab, hbs\u27e9\u27e9\n \u00b7 refine \u27e8c, hac.le, Icc_mem_nhdsGE hac, ?_\u27e9\n exact (Icc_subset_Ico_right hcb).trans hbs\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Ioo_nhdsLT (L116-L122)\ntheorem comap_coe_Ioo_nhdsLT (a b : X) (hb : IsSuccPrelimit b := by exact .of_dense _) :\ncomap ((\u2191) : Ioo a b \u2192 X) (\ud835\udcdd[<] b) = atTop :=\n comap_coe_nhdsLT_of_Ioo_subset Ioo_subset_Iio_self\n (fun h => \u27e8a, h.elim fun _x hx \u21a6 hx.1.trans hx.2, Subset.rfl\u27e9) hb\n\n/-- The `atBot` filter for an open interval `Ioo a b` comes from the right-neighbourhoods filter at\nthe left endpoint in the ambient order. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_basis (L376-L379)\ntheorem nhdsLE_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] [NoMinOrder \u03b1] (a : \u03b1) :\n (\ud835\udcdd[\u2264] a).HasBasis (fun l => l < a) fun l => Ioc l a :=\nnhdsLE_basis_of_exists_lt (exists_lt a)\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_Iio' (L118-L119)\ntheorem isOpen_Iio' [OrderTopology \u03b1] (a : \u03b1) : IsOpen (Iio a) := isOpen_gt' a\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsGT_of_Ioo_subset (L90-L95)\ntheorem comap_coe_nhdsGT_of_Ioo_subset (hsa : s \u2286 Ioi a) (hs : s.Nonempty \u2192 \u2203 b > a, Ioo a b \u2286 s)\n (ha : IsPredPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : s \u2192 X) (\ud835\udcdd[>] a) = atBot := by\n refine comap_coe_nhdsLT_of_Ioo_subset (show ofDual \u207b\u00b9' s \u2286 Iio (toDual a) from hsa) ?_ ha.dual\n simpa only [OrderDual.exists, Ioo_toDual]\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_top_basis_Ici (L395-L400)\ntheorem nhds_top_basis_Ici [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTop \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] [DenselyOrdered \u03b1] : (\ud835\udcdd \u22a4).HasBasis (fun a : \u03b1 => a < \u22a4) Ici :=\nnhds_top_basis.to_hasBasis\n (fun _a ha => let \u27e8b, hab, hb\u27e9 := exists_between ha; \u27e8b, hb, Ici_subset_Ioi.mpr hab\u27e9)\n fun a ha => \u27e8a, ha, Ioi_subset_Ici_self\u27e9\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIccClassNhds (L141-L148)\ninstance tendstoIccClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Icc (\ud835\udcdd a) (\ud835\udcdd a) := by\nsimp only [nhds_eq_order, iInf_subtype']\n refine\n ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass\n fun s _ => ?_\n refine ((ordConnected_biInter ?_).inter (ordConnected_biInter ?_)).out <;> intro _ _\n exacts [ordConnected_Ioi, ordConnected_Iio]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ico_subset_of_mem_nhds' (L452-L456)\ntheorem exists_Ico_subset_of_mem_nhds' {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) {u : \u03b1} (hu : a < u) :\n \u2203 u' \u2208 Ioc a u, Ico a u' \u2286 s := by\nsimpa only [OrderDual.exists, exists_prop, Ico_toDual, Ioc_toDual] using\n exists_Ioc_subset_of_mem_nhds' (show ofDual \u207b\u00b9' s \u2208 \ud835\udcdd (toDual a) from hs) hu.dual\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_Ioi' (L113-L114)\ntheorem isOpen_Ioi' [OrderTopology \u03b1] (a : \u03b1) : IsOpen (Ioi a) := isOpen_lt' a\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIcoClassNhds (L149-L151)\ninstance tendstoIcoClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Ico (\ud835\udcdd a) (\ud835\udcdd a) :=\ntendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_eq_iInf_principal (L350-L353)\ntheorem nhdsGE_eq_iInf_principal [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 u, a < u) : \ud835\udcdd[\u2265] a = \u2a05 (u) (_ : a < u), \ud835\udcdf (Ico a u) := by\nsimp only [nhdsGE_eq_iInf_inf_principal, biInf_inf ha, inf_principal, Iio_inter_Ici]\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_bot_basis_Iic (L401-L404)\ntheorem nhds_bot_basis_Iic [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderBot \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] [DenselyOrdered \u03b1] : (\ud835\udcdd \u22a5).HasBasis (fun a : \u03b1 => \u22a5 < a) Iic :=\nnhds_top_basis_Ici (\u03b1 := \u03b1\u1d52\u1d48)\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Topology.Order.Basic.induced_topology_le_preorder (L264-L272)\ntheorem induced_topology_le_preorder [Preorder \u03b1] [Preorder \u03b2] [TopologicalSpace \u03b2]\n [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2} (hf : \u2200 {x y}, f x < f y \u2194 x < y) :\n induced f \u2039TopologicalSpace \u03b2\u203a \u2264 Preorder.topology \u03b1 := by\nlet _ := Preorder.topology \u03b1; have : OrderTopology \u03b1 := \u27e8rfl\u27e9\n refine le_of_nhds_le_nhds fun x => ?_\n simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, \u2190 hf]\n refine inf_le_inf (le_iInf\u2082 fun a ha => ?_) (le_iInf\u2082 fun a ha => ?_)\n exacts [iInf\u2082_le (f a) ha, iInf\u2082_le (f a) ha]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Topology.Order.Basic.order_separated (L430-L435)\ntheorem order_separated {a\u2081 a\u2082 : \u03b1} (h : a\u2081 < a\u2082) :\n \u2203 u v : Set \u03b1, IsOpen u \u2227 IsOpen v \u2227 a\u2081 \u2208 u \u2227 a\u2082 \u2208 v \u2227 \u2200 b\u2081 \u2208 u, \u2200 b\u2082 \u2208 v, b\u2081 < b\u2082 :=\nlet \u27e8x, hx, y, hy, h\u27e9 := h.exists_disjoint_Iio_Ioi\n \u27e8Iio x, Ioi y, isOpen_gt' _, isOpen_lt' _, hx, hy, h\u27e9\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Topology.Order.Basic.isOpen_lt' (L110-L112)\ntheorem isOpen_lt' [OrderTopology \u03b1] (a : \u03b1) : IsOpen { b : \u03b1 | a < b } :=\nisOpen_iff_generate_intervals.2 <| .basic _ \u27e8a, .inl rfl\u27e9\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_top_basis (L386-L390)\ntheorem nhds_top_basis [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTop \u03b1] [OrderTopology \u03b1]\n [Nontrivial \u03b1] : (\ud835\udcdd \u22a4).HasBasis (fun a : \u03b1 => a < \u22a4) fun a : \u03b1 => Ioi a := by\nhave : \u2203 x : \u03b1, x < \u22a4 := (exists_ne \u22a4).imp fun x hx => hx.lt_top\n simpa only [Iic_top, nhdsWithin_univ, Ioc_top] using nhdsLE_basis_of_exists_lt this\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_order (L138-L140)\ntheorem tendsto_order [OrderTopology \u03b1] {f : \u03b2 \u2192 \u03b1} {a : \u03b1} {x : Filter \u03b2} :\n Tendsto f x (\ud835\udcdd a) \u2194 (\u2200 a' < a, \u2200\u1da0 b in x, a' < f b) \u2227 \u2200 a' > a, \u2200\u1da0 b in x, f b < a' := by\nsimp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsGE_basis_of_exists_gt (L358-L366)\ntheorem nhdsGE_basis_of_exists_gt [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 u, a < u) : (\ud835\udcdd[\u2265] a).HasBasis (fun u => a < u) fun u => Ico a u :=\n(nhdsGE_eq_iInf_principal ha).symm \u25b8\n hasBasis_biInf_principal\n (fun b hb c hc => \u27e8min b c, lt_min hb hc, Ico_subset_Ico_right (min_le_left _ _),\n Ico_subset_Ico_right (min_le_right _ _)\u27e9)\n ha\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_of_tendsto_of_tendsto_of_le_of_le (L228-L235)\ntheorem tendsto_of_tendsto_of_tendsto_of_le_of_le [OrderTopology \u03b1] {f g h : \u03b2 \u2192 \u03b1} {b : Filter \u03b2}\n {a : \u03b1} (hg : Tendsto g b (\ud835\udcdd a)) (hh : Tendsto h b (\ud835\udcdd a)) (hgf : g \u2264 f) (hfh : f \u2264 h) :\n Tendsto f b (\ud835\udcdd a) :=\ntendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (Eventually.of_forall hgf)\n (Eventually.of_forall hfh)\n\nalias Filter.Tendsto.squeeze := tendsto_of_tendsto_of_tendsto_of_le_of_le\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_atBot_of_Ioo_subset (L106-L114)\ntheorem map_coe_atBot_of_Ioo_subset (hsa : s \u2286 Ioi a) (hs : \u2200 b' > a, \u2203 b > a, Ioo a b \u2286 s)\n (ha : IsPredPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : s \u2192 X) atBot = \ud835\udcdd[>] a := by\n refine map_coe_atTop_of_Ioo_subset (s := ofDual \u207b\u00b9' s) (b := toDual a) hsa ?_ ha.dual\n intro b' hb'\n simpa [OrderDual.exists] using hs (ofDual b') hb'\n\n/-- The `atTop` filter for an open interval `Ioo a b` comes from the left-neighbourhoods filter at\nthe right endpoint in the ambient order. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIocClassNhds (L152-L154)\ninstance tendstoIocClassNhds [OrderTopology \u03b1] (a : \u03b1) : TendstoIxxClass Ioc (\ud835\udcdd a) (\ud835\udcdd a) :=\ntendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Topology.Order.Basic.tendstoIxxNhdsWithin (L248-L252)\ninstance tendstoIxxNhdsWithin {\u03b1 : Type*} [TopologicalSpace \u03b1] (a : \u03b1) {s t : Set \u03b1}\n {Ixx} [TendstoIxxClass Ixx (\ud835\udcdd a) (\ud835\udcdd a)] [TendstoIxxClass Ixx (\ud835\udcdf s) (\ud835\udcdf t)] :\n TendstoIxxClass Ixx (\ud835\udcdd[s] a) (\ud835\udcdd[t] a) :=\nFilter.tendstoIxxClass_inf\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.tendsto_Ioo_atTop (L182-L185)\ntheorem tendsto_Ioo_atTop {f : \u03b1 \u2192 Ioo a b} (hb : IsSuccPrelimit b := by exact .of_dense _) :\nTendsto f l atTop \u2194 Tendsto (fun x => (f x : X)) l (\ud835\udcdd[<] b) := by\n rw [\u2190 comap_coe_Ioo_nhdsLT a b hb, tendsto_comap_iff, Function.comp_def]\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.map_coe_Ioo_atBot (L145-L148)\ntheorem map_coe_Ioo_atBot (h : a < b) (ha : IsPredPrelimit a := by exact .of_dense _) :\nmap ((\u2191) : Ioo a b \u2192 X) atBot = \ud835\udcdd[>] a :=\n map_coe_atBot_of_Ioo_subset Ioo_subset_Ioi_self (fun _ _ => \u27e8_, h, Subset.rfl\u27e9) ha\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Ioc_subset_of_mem_nhds' (L446-L451)\ntheorem exists_Ioc_subset_of_mem_nhds' {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) {l : \u03b1} (hl : l < a) :\n \u2203 l' \u2208 Ico l a, Ioc l' a \u2286 s :=\nlet \u27e8l', hl'a, hl's\u27e9 := exists_Ioc_subset_of_mem_nhds hs \u27e8l, hl\u27e9\n \u27e8max l l', \u27e8le_max_left _ _, max_lt hl hl'a\u27e9,\n (Ioc_subset_Ioc_left <| le_max_right _ _).trans hl's\u27e9\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Icc_mem_subset_of_mem_nhdsLE (L475-L479)\ntheorem exists_Icc_mem_subset_of_mem_nhdsLE {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd[\u2264] a) :\n \u2203 b \u2264 a, Icc b a \u2208 \ud835\udcdd[\u2264] a \u2227 Icc b a \u2286 s := by\nsimpa only [Icc_toDual, toDual.surjective.exists] using\n exists_Icc_mem_subset_of_mem_nhdsGE (\u03b1 := \u03b1\u1d52\u1d48) (a := toDual a) hs\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Topology.Order.Basic.OrderEmbedding (L328-L334)\nlemma OrderEmbedding.isEmbedding_of_ordConnected {\u03b1 \u03b2 : Type*} [LinearOrder \u03b1] [LinearOrder \u03b2]\n [TopologicalSpace \u03b1] [OrderTopology \u03b1] [TopologicalSpace \u03b2] [OrderTopology \u03b2]\n (f : \u03b1 \u21aao \u03b2) (hc : OrdConnected (range f)) : Topology.IsEmbedding f :=\nf.strictMono.isEmbedding_of_ordConnected hc\n\n/-- On a `Set.OrdConnected` subset of a linear order, the order topology for the restriction of the\norder is the same as the restriction to the subset of the order topology. -/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_Ioo_nhdsGT (L124-L128)\ntheorem comap_coe_Ioo_nhdsGT (a b : X) (ha : IsPredPrelimit a := by exact .of_dense _) :\ncomap ((\u2191) : Ioo a b \u2192 X) (\ud835\udcdd[>] a) = atBot :=\n comap_coe_nhdsGT_of_Ioo_subset Ioo_subset_Ioi_self\n (fun h => \u27e8b, h.elim fun _x hx \u21a6 hx.1.trans hx.2, Subset.rfl\u27e9) ha\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Topology.Order.Basic.nhds_top_order (L380-L382)\ntheorem nhds_top_order [TopologicalSpace \u03b1] [Preorder \u03b1] [OrderTop \u03b1] [OrderTopology \u03b1] :\n \ud835\udcdd (\u22a4 : \u03b1) = \u2a05 (l) (_ : l < \u22a4), \ud835\udcdf (Ioi l) := by simp [nhds_eq_order (\u22a4 : \u03b1)]\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Topology.Order.Basic.StrictMono (L321-L327)\ntheorem StrictMono.isEmbedding_of_ordConnected {\u03b1 \u03b2 : Type*} [LinearOrder \u03b1] [LinearOrder \u03b2]\n [TopologicalSpace \u03b1] [h : OrderTopology \u03b1] [TopologicalSpace \u03b2] [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2}\n (hf : StrictMono f) (hc : OrdConnected (range f)) : IsEmbedding f :=\n\u27e8\u27e8h.1.trans <| Eq.symm <| hf.induced_topology_eq_preorder hc\u27e9, hf.injective\u27e9\n\n/-- An `OrderEmbedding` is a topological embedding provided that the range of `f` is\norder-connected -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Topology.Order.Basic.orderTopology_of_ordConnected (L335-L339)\ninstance orderTopology_of_ordConnected {\u03b1 : Type u} [TopologicalSpace \u03b1] [LinearOrder \u03b1]\n [OrderTopology \u03b1] {t : Set \u03b1} [ht : OrdConnected t] : OrderTopology t :=\n\u27e8(Subtype.strictMono_coe (\u00b7 \u2208 t)).induced_topology_eq_preorder <| by\n rwa [\u2190 @Subtype.range_val _ t] at ht\u27e9\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Topology.Order.Basic.exists_Icc_mem_subset_of_mem_nhds (L480-L489)\ntheorem exists_Icc_mem_subset_of_mem_nhds {a : \u03b1} {s : Set \u03b1} (hs : s \u2208 \ud835\udcdd a) :\n \u2203 b c, a \u2208 Icc b c \u2227 Icc b c \u2208 \ud835\udcdd a \u2227 Icc b c \u2286 s := by\nrcases exists_Icc_mem_subset_of_mem_nhdsLE (nhdsWithin_le_nhds hs) with\n \u27e8b, hba, hb_nhds, hbs\u27e9\n rcases exists_Icc_mem_subset_of_mem_nhdsGE (nhdsWithin_le_nhds hs) with\n \u27e8c, hac, hc_nhds, hcs\u27e9\n refine \u27e8b, c, \u27e8hba, hac\u27e9, ?_\u27e9\n rw [\u2190 Icc_union_Icc_eq_Icc hba hac, \u2190 nhdsLE_sup_nhdsGE]\n exact \u27e8union_mem_sup hb_nhds hc_nhds, union_subset hbs hcs\u27e9\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Topology.Order.AtTopBotIxx.comap_coe_nhdsGT_eq_atBot_iff (L73-L79)\ntheorem comap_coe_nhdsGT_eq_atBot_iff :\n comap ((\u2191) : s \u2192 X) (\ud835\udcdd[>] b) = atBot \u2194\n s \u2286 Ioi b \u2227 (s.Nonempty \u2192 \u2200 a > b, (s \u2229 Ioo b a).Nonempty) := by\nrefine comap_coe_nhdsLT_eq_atTop_iff (s := OrderDual.ofDual \u207b\u00b9' s) (b := OrderDual.toDual b)\n |>.trans ?_\n simp [\u2190 preimage_inter, ofDual.surjective]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Topology.Order.Basic.IsOpen (L490-L502)\ntheorem IsOpen.exists_Ioo_subset [Nontrivial \u03b1] {s : Set \u03b1} (hs : IsOpen s) (h : s.Nonempty) :\n \u2203 a b, a < b \u2227 Ioo a b \u2286 s := by\nobtain \u27e8x, hx\u27e9 : \u2203 x, x \u2208 s := h\n obtain \u27e8y, hy\u27e9 : \u2203 y, y \u2260 x := exists_ne x\n rcases lt_trichotomy x y with (H | rfl | H)\n \u00b7 obtain \u27e8u, xu, hu\u27e9 : \u2203 u, x < u \u2227 Ico x u \u2286 s :=\n exists_Ico_subset_of_mem_nhds (hs.mem_nhds hx) \u27e8y, H\u27e9\n exact \u27e8x, u, xu, Ioo_subset_Ico_self.trans hu\u27e9\n \u00b7 exact (hy rfl).elim\n \u00b7 obtain \u27e8l, lx, hl\u27e9 : \u2203 l, l < x \u2227 Ioc l x \u2286 s :=\n exists_Ioc_subset_of_mem_nhds (hs.mem_nhds hx) \u27e8y, H\u27e9\n exact \u27e8l, x, lx, Ioo_subset_Ioc_self.trans hl\u27e9\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_of_tendsto_of_tendsto_of_le_of_le' (L219-L227)\ntheorem tendsto_of_tendsto_of_tendsto_of_le_of_le' [OrderTopology \u03b1] {f g h : \u03b2 \u2192 \u03b1} {b : Filter \u03b2}\n {a : \u03b1} (hg : Tendsto g b (\ud835\udcdd a)) (hh : Tendsto h b (\ud835\udcdd a)) (hgf : \u2200\u1da0 b in b, g b \u2264 f b)\n (hfh : \u2200\u1da0 b in b, f b \u2264 h b) : Tendsto f b (\ud835\udcdd a) :=\n(hg.Icc hh).of_smallSets <| hgf.and hfh\n\nalias Filter.Tendsto.squeeze' := tendsto_of_tendsto_of_tendsto_of_le_of_le'\n\n/-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities\nhold everywhere. -/\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_nhds_bot_mono' (L419-L429)\ntheorem tendsto_nhds_bot_mono' [TopologicalSpace \u03b2] [Preorder \u03b2] [OrderBot \u03b2] [OrderTopology \u03b2]\n {l : Filter \u03b1} {f g : \u03b1 \u2192 \u03b2} (hf : Tendsto f l (\ud835\udcdd \u22a5)) (hg : g \u2264 f) : Tendsto g l (\ud835\udcdd \u22a5) :=\ntendsto_nhds_bot_mono hf (Eventually.of_forall hg)\n\nsection LinearOrder\n\nvariable [TopologicalSpace \u03b1] [LinearOrder \u03b1]\n\nsection OrderTopology\nvariable [OrderTopology \u03b1]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Topology.Order.Basic.isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom (L183-L218)\nlemma isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom (c : Set \u03b1)\n (h : ts = generateFrom { s | \u2203 a \u2208 c, s = Ioi a \u2228 s = Iio a }) :\n IsTopologicalBasis {s | \u2203 (f g : Set \u03b1), f \u2286 c \u2227 g \u2286 c \u2227 f.Finite \u2227 g.Finite\n \u2227 s = (\u22c2 a \u2208 f, Ioi a) \u2229 (\u22c2 a \u2208 g, Iio a)} := by\nrefine IsTopologicalBasis.of_isOpen_of_subset ?_ (isTopologicalBasis_of_subbasis h) ?_\n \u00b7 rintro u \u27e8f, g, hfc, hgc, hf_fin, hg_fin, rfl\u27e9\n apply IsOpen.inter\n \u00b7 apply hf_fin.isOpen_biInter (fun i hi \u21a6 ?_)\n rw [h]\n exact isOpen_generateFrom_of_mem \u27e8i, hfc hi, Or.inl rfl\u27e9\n \u00b7 apply hg_fin.isOpen_biInter (fun i hi \u21a6 ?_)\n rw [h]\n exact isOpen_generateFrom_of_mem \u27e8i, hgc hi, Or.inr rfl\u27e9\n simp only [exists_and_left, image_subset_iff, preimage_setOf_eq, setOf_subset_setOf, and_imp]\n intro k k_fin hk\n let kl := {s \u2208 k | \u2203 a \u2208 c, s = Ioi a}\n let kr := {s \u2208 k | \u2203 a \u2208 c, s = Iio a}\n have k_eq : k = kl \u222a kr := by\n -- this `have` can be removed, but makes `grind` slower\n have : \u2200 s \u2208 k, \u2203 a \u2208 c, s = Ioi a \u2228 s = Iio a := hk\n ext\n grind\n have : Finite kl := k_fin.subset (by simp [k_eq])\n have : Finite kr := k_fin.subset (by simp [k_eq])\n have Al : \u2200 s : kl, \u2203 a \u2208 c, s = Ioi a := fun s \u21a6 s.2.2\n choose al alc hal using Al\n have Ar : \u2200 s : kr, \u2203 a \u2208 c, s = Iio a := fun s \u21a6 s.2.2\n choose ar arc har using Ar\n refine \u27e8range al, by simp [range_subset_iff, alc], range ar,\n by simp [range_subset_iff, arc], finite_range _, finite_range _, ?_\u27e9\n rw [k_eq, sInter_eq_biInter, biInter_union, biInter_range, biInter_range, biInter_eq_iInter,\n biInter_eq_iInter]\n simp [hal, har]\n\n/-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities\nhold eventually for the filter. -/\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Topology.Order.Basic.tendsto_order_unbounded (L240-L247)\ntheorem tendsto_order_unbounded [OrderTopology \u03b1] {f : \u03b2 \u2192 \u03b1} {a : \u03b1} {x : Filter \u03b2}\n (hu : \u2203 u, a < u) (hl : \u2203 l, l < a) (h : \u2200 l u, l < a \u2192 a < u \u2192 \u2200\u1da0 b in x, l < f b \u2227 f b < u) :\n Tendsto f x (\ud835\udcdd a) := by\nsimp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal]\n exact fun l hl u => h l u hl\n\nend Preorder\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Topology.Order.Basic.nhdsLE_basis_of_exists_lt (L367-L371)\ntheorem nhdsLE_basis_of_exists_lt [TopologicalSpace \u03b1] [LinearOrder \u03b1] [OrderTopology \u03b1] {a : \u03b1}\n (ha : \u2203 l, l < a) : (\ud835\udcdd[\u2264] a).HasBasis (fun l => l < a) fun l => Ioc l a := by\nconvert nhdsGE_basis_of_exists_gt (\u03b1 := \u03b1\u1d52\u1d48) ha using 2\n exact Ico_toDual.symm\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Topology.Order.Basic.induced_orderTopology (L301-L320)\ntheorem induced_orderTopology {\u03b1 : Type u} {\u03b2 : Type v} [Preorder \u03b1] [ta : TopologicalSpace \u03b2]\n [Preorder \u03b2] [OrderTopology \u03b2] (f : \u03b1 \u2192 \u03b2) (hf : \u2200 {x y}, f x < f y \u2194 x < y)\n (H : \u2200 {x y}, x < y \u2192 \u2203 a, x < f a \u2227 f a < y) : @OrderTopology _ (induced f ta) _ :=\ninduced_orderTopology' f (hf)\n (fun xa => let \u27e8b, xb, ba\u27e9 := H xa; \u27e8b, hf.1 ba, le_of_lt xb\u27e9)\n fun ax => let \u27e8b, ab, bx\u27e9 := H ax; \u27e8b, hf.1 ab, le_of_lt bx\u27e9\n\n/-- The topology induced by a strictly monotone function with order-connected range is the preorder\ntopology. -/\nnonrec theorem StrictMono.induced_topology_eq_preorder {\u03b1 \u03b2 : Type*} [LinearOrder \u03b1]\n [LinearOrder \u03b2] [t : TopologicalSpace \u03b2] [OrderTopology \u03b2] {f : \u03b1 \u2192 \u03b2}\n (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology \u03b1 := by\n refine induced_topology_eq_preorder hf.lt_iff_lt (fun h\u2081 h\u2082 => ?_) fun h\u2081 h\u2082 => ?_\n \u00b7 rcases hc.out (mem_range_self _) (mem_range_self _) \u27e8not_lt.1 h\u2082, h\u2081.le\u27e9 with \u27e8y, rfl\u27e9\n exact \u27e8y, hf.lt_iff_lt.1 h\u2081, le_rfl\u27e9\n \u00b7 rcases hc.out (mem_range_self _) (mem_range_self _) \u27e8h\u2081.le, not_lt.1 h\u2082\u27e9 with \u27e8y, rfl\u27e9\n exact \u27e8y, hf.lt_iff_lt.1 h\u2081, le_rfl\u27e9\n\n/-- A strictly monotone function between linear orders with order topology is a topological\nembedding provided that the range of `f` is order-connected. -/\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Order/LocalExtr.lean", "module": "Mathlib.Topology.Order.LocalExtr", "declaration": "Mathlib.Topology.Order.LocalExtr.IsLocalMax", "span": "L87-L89", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Order/LocalExtr.lean#L87"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 17164, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 41447, "lean_code_chars": 38185, "natural_language_chars": 3262, "lean_code_ratio": 0.9213, "line_count": 1082, "imports_count": 0, "declarations_count": 4445, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "75547040d046f11e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal", "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.RingTheory.Jacobson.Ideal)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem eq_jacobson_iff_sInf_maximal :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, IsMaximal J \u2228 J = \u22a4) \u2227 I = sInf M\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson (L65-L67)\ndef jacobson (I : Ideal R) : Ideal R :=\nsInf { J : Ideal R | I \u2264 J \u2227 IsMaximal J }\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.le_jacobson (L68-L69)\ntheorem le_jacobson : I \u2264 jacobson I := fun _ hx => mem_sInf.mpr fun _ hJ => hJ.left hx\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_idem (L71-L73)\ntheorem jacobson_idem : jacobson (jacobson I) = jacobson I :=\nle_antisymm (sInf_le_sInf fun _ hJ => \u27e8sInf_le hJ, hJ.2\u27e9) le_jacobson\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_top (L75-L77)\ntheorem jacobson_top : jacobson (\u22a4 : Ideal R) = \u22a4 :=\neq_top_iff.2 le_jacobson\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_bot (L78-L80)\ntheorem jacobson_bot : jacobson (\u22a5 : Ideal R) = Ring.jacobson R := by\nsimp_rw [jacobson, Ring.jacobson, Module.jacobson, bot_le, true_and, isMaximal_def]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_top_iff (L82-L89)\ntheorem jacobson_eq_top_iff : jacobson I = \u22a4 \u2194 I = \u22a4 :=\n\u27e8fun H =>\n by_contradiction fun hi => let \u27e8M, hm, him\u27e9 := exists_le_maximal I hi\n lt_top_iff_ne_top.1\n (lt_of_le_of_lt (show jacobson I \u2264 M from sInf_le \u27e8him, hm\u27e9) <|\n lt_top_iff_ne_top.2 hm.ne_top) H,\n fun H => eq_top_iff.2 <| le_sInf fun _ \u27e8hij, _\u27e9 => H \u25b8 hij\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_bot (L90-L91)\ntheorem jacobson_eq_bot : jacobson I = \u22a5 \u2192 I = \u22a5 := fun h => eq_bot_iff.mpr (h \u25b8 le_jacobson)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_self_of_isMaximal (L92-L94)\ntheorem jacobson_eq_self_of_isMaximal [H : IsMaximal I] : I.jacobson = I :=\nle_antisymm (sInf_le \u27e8le_of_eq rfl, H\u27e9) le_jacobson\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.mem_jacobson_iff (L99-L120)\ntheorem mem_jacobson_iff {x : R} : x \u2208 jacobson I \u2194 \u2200 y, \u2203 z, z * y * x + z - 1 \u2208 I :=\n\u27e8fun hx y =>\n by_cases\n (fun hxy : I \u2294 span {y * x + 1} = \u22a4 =>\n let \u27e8p, hpi, q, hq, hpq\u27e9 := Submodule.mem_sup.1 ((eq_top_iff_one _).1 hxy)\n let \u27e8r, hr\u27e9 := mem_span_singleton'.1 hq\n \u27e8r, by\n rw [mul_assoc, \u2190 mul_add_one, hr, \u2190 hpq, \u2190 neg_sub, add_sub_cancel_right]\n exact I.neg_mem hpi\u27e9)\n fun hxy : I \u2294 span {y * x + 1} \u2260 \u22a4 => let \u27e8M, hm1, hm2\u27e9 := exists_le_maximal _ hxy\n suffices x \u2209 M from (this <| mem_sInf.1 hx \u27e8le_trans le_sup_left hm2, hm1\u27e9).elim\n fun hxm => hm1.1.1 <| (eq_top_iff_one _).2 <| add_sub_cancel_left (y * x) 1 \u25b8\n M.sub_mem (le_sup_right.trans hm2 <| subset_span rfl) (M.mul_mem_left _ hxm),\n fun hx => mem_sInf.2 fun M \u27e8him, hm\u27e9 => by_contradiction fun hxm =>\n let \u27e8y, i, hi, df\u27e9 := hm.exists_inv hxm\n let \u27e8z, hz\u27e9 := hx (-y)\n hm.1.1 <| (eq_top_iff_one _).2 <| sub_sub_cancel (z * -y * x + z) 1 \u25b8\n M.sub_mem (by\n rw [mul_assoc, \u2190 mul_add_one, neg_mul, \u2190 sub_eq_iff_eq_add.mpr df.symm, neg_sub,\n sub_add_cancel]\n exact M.mul_mem_left _ hi) <| him hz\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_add_sub_mem_of_mem_jacobson (L121-L127)\ntheorem exists_mul_add_sub_mem_of_mem_jacobson {I : Ideal R} (r : R) (h : r \u2208 jacobson I) :\n \u2203 s, s * (r + 1) - 1 \u2208 I := by\nobtain \u27e8s, hs\u27e9 := mem_jacobson_iff.1 h 1\n use s\n rw [mul_add, mul_one]\n simpa using hs\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_sub_mem_of_sub_one_mem_jacobson (L128-L134)\ntheorem exists_mul_sub_mem_of_sub_one_mem_jacobson {I : Ideal R} (r : R) (h : r - 1 \u2208 jacobson I) :\n \u2203 s, s * r - 1 \u2208 I := by\nconvert exists_mul_add_sub_mem_of_mem_jacobson _ h\n simp\n\n/-- An ideal equals its Jacobson radical iff it is the intersection of a set of maximal ideals.\nAllowing the set to include \u22a4 is equivalent, and is included only to simplify some proofs. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal' (L146-L163)\ntheorem eq_jacobson_iff_sInf_maximal' :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, \u2200 (K : Ideal R), J < K \u2192 K = \u22a4) \u2227 I = sInf M :=\neq_jacobson_iff_sInf_maximal.trans\n \u27e8fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ K hK =>\n Or.recOn (hM.1 J hJ) (fun h => h.1.2 K hK) fun h => eq_top_iff.2 (le_of_lt (h \u25b8 hK)),\n hM.2\u27e9\u27e9,\n fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ =>\n Or.recOn (Classical.em (J = \u22a4)) (fun h => Or.inr h) fun h => Or.inl \u27e8\u27e8h, hM.1 J hJ\u27e9\u27e9,\n hM.2\u27e9\u27e9\u27e9\n\n/-- An ideal `I` equals its Jacobson radical if and only if every element outside `I`\nalso lies outside of a maximal ideal containing `I`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_notMem (L164-L176)\ntheorem eq_jacobson_iff_notMem :\n I.jacobson = I \u2194 \u2200 x \u2209 I, \u2203 M : Ideal R, (I \u2264 M \u2227 M.IsMaximal) \u2227 x \u2209 M := by\nconstructor\n \u00b7 intro h x hx\n rw [\u2190 h, Ideal.jacobson, mem_sInf] at hx\n push Not at hx\n exact hx\n \u00b7 refine fun h => le_antisymm (fun x hx => ?_) le_jacobson\n contrapose hx\n rw [Ideal.jacobson, mem_sInf]\n push Not\n exact h x hx\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_surjective (L177-L195)\ntheorem map_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) :\n RingHom.ker f \u2264 I \u2192 map f I.jacobson = (map f I).jacobson := by\nintro h\n unfold Ideal.jacobson\n -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11036): dot notation for `RingHom.ker` does not work\n have : \u2200 J \u2208 { J : Ideal R | I \u2264 J \u2227 J.IsMaximal }, RingHom.ker f \u2264 J :=\n fun J hJ => le_trans h hJ.left\n refine Trans.trans (map_sInf hf this) (le_antisymm ?_ ?_)\n \u00b7 refine\n sInf_le_sInf fun J hJ =>\n \u27e8comap f J, \u27e8\u27e8le_comap_of_map_le hJ.1, ?_\u27e9, map_comap_of_surjective f hf J\u27e9\u27e9\n haveI : J.IsMaximal := hJ.right\n exact comap_isMaximal_of_surjective f hf\n \u00b7 refine sInf_le_sInf_of_subset_insert_top fun j hj => hj.recOn fun J hJ => ?_\n rw [\u2190 hJ.2]\n rcases map_eq_top_or_isMaximal_of_surjective f hf hJ.left.right with htop | hmax\n \u00b7 exact htop.symm \u25b8 Set.mem_insert \u22a4 _\n \u00b7 exact Set.mem_insert_of_mem \u22a4 \u27e8map_mono hJ.1.1, hmax\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_bijective (L196-L200)\ntheorem map_jacobson_of_bijective {f : R \u2192+* S} (hf : Function.Bijective f) :\n map f I.jacobson = (map f I).jacobson :=\nmap_jacobson_of_surjective hf.right\n (le_trans (le_of_eq ((RingHom.injective_iff_ker_eq_bot f).1 hf.left)) bot_le)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson (L201-L204)\ntheorem comap_jacobson {f : R \u2192+* S} {K : Ideal S} :\n comap f K.jacobson = sInf (comap f '' { J : Ideal S | K \u2264 J \u2227 J.IsMaximal }) :=\nTrans.trans (comap_sInf' f _) sInf_eq_iInf.symm\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson_of_surjective (L205-L223)\ntheorem comap_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) {K : Ideal S} :\n comap f K.jacobson = (comap f K).jacobson := by\nunfold Ideal.jacobson\n refine le_antisymm ?_ ?_\n \u00b7 rw [\u2190 top_inf_eq (sInf _), \u2190 sInf_insert, comap_sInf', sInf_eq_iInf]\n refine iInf_le_iInf_of_subset fun J hJ => ?_\n have : comap f (map f J) = J :=\n Trans.trans (comap_map_of_surjective f hf J)\n (le_antisymm (sup_le_iff.2 \u27e8le_of_eq rfl, le_trans (comap_mono bot_le) hJ.left\u27e9)\n le_sup_left)\n rcases map_eq_top_or_isMaximal_of_surjective _ hf hJ.right with htop | hmax\n \u00b7 exact \u27e8\u22a4, Set.mem_insert \u22a4 _, htop \u25b8 this\u27e9\n \u00b7 exact \u27e8map f J, Set.mem_insert_of_mem _ \u27e8le_map_of_comap_le_of_surjective f hf hJ.1, hmax\u27e9,\n this\u27e9\n \u00b7 simp_rw [comap_sInf, le_iInf_iff]\n intro J hJ\n haveI : J.IsMaximal := hJ.right\n exact sInf_le \u27e8comap_mono hJ.left, comap_isMaximal_of_surjective _ hf\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_mono (L225-L229)\ntheorem jacobson_mono {I J : Ideal R} : I \u2264 J \u2192 I.jacobson \u2264 J.jacobson := by\nintro h x hx\n rw [jacobson, mem_sInf] at hx \u22a2\n exact fun K \u27e8hK, hK_max\u27e9 => hx \u27e8Trans.trans h hK, hK_max\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.ringJacobson_le_jacobson (L230-L233)\ntheorem ringJacobson_le_jacobson {I : Ideal R} : Ring.jacobson R \u2264 I.jacobson :=\njacobson_bot.symm.trans_le (jacobson_mono bot_le)\n\n/-- The Jacobson radical of a two-sided ideal is two-sided. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.radical_le_jacobson (L273-L275)\ntheorem radical_le_jacobson : radical I \u2264 jacobson I :=\nle_sInf fun _ hJ => (radical_eq_sInf I).symm \u25b8 sInf_le \u27e8hJ.left, IsMaximal.isPrime hJ.right\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_of_eq_jacobson (L276-L278)\ntheorem isRadical_of_eq_jacobson (h : jacobson I = I) : I.IsRadical :=\nradical_le_jacobson.trans h.le\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_jacobson (L279-L281)\nlemma isRadical_jacobson (I : Ideal R) : I.jacobson.IsRadical :=\nisRadical_of_eq_jacobson jacobson_idem\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isUnit_of_sub_one_mem_jacobson_bot (L282-L287)\ntheorem isUnit_of_sub_one_mem_jacobson_bot (r : R) (h : r - 1 \u2208 jacobson (\u22a5 : Ideal R)) :\n IsUnit r := by\nobtain \u27e8s, hs\u27e9 := exists_mul_sub_mem_of_sub_one_mem_jacobson r h\n rw [mem_bot, sub_eq_zero, mul_comm] at hs\n exact .of_mul_eq_one _ hs\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.mem_jacobson_bot (L288-L299)\ntheorem mem_jacobson_bot {x : R} : x \u2208 jacobson (\u22a5 : Ideal R) \u2194 \u2200 y, IsUnit (x * y + 1) :=\n\u27e8fun hx y =>\n let \u27e8z, hz\u27e9 := (mem_jacobson_iff.1 hx) y\n isUnit_iff_exists_inv.2\n \u27e8z, by rwa [add_mul, one_mul, \u2190 sub_eq_zero, mul_right_comm, mul_comm _ z, mul_right_comm]\u27e9,\n fun h =>\n mem_jacobson_iff.mpr fun y =>\n let \u27e8b, hb\u27e9 := isUnit_iff_exists_inv.1 (h y)\n \u27e8b, (Submodule.mem_bot R).2 (hb \u25b8 by ring)\u27e9\u27e9\n\n/-- An ideal `I` of `R` is equal to its Jacobson radical if and only if\nthe Jacobson radical of the quotient ring `R/I` is the zero ideal -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_iff_jacobson_quotient_eq_bot (L300-L314)\ntheorem jacobson_eq_iff_jacobson_quotient_eq_bot :\n I.jacobson = I \u2194 jacobson (\u22a5 : Ideal (R \u29f8 I)) = \u22a5 := by\nhave hf : Function.Surjective (Ideal.Quotient.mk I) := Submodule.Quotient.mk_surjective I\n constructor\n \u00b7 intro h\n replace h := congr_arg (Ideal.map (Ideal.Quotient.mk I)) h\n rw [map_jacobson_of_surjective hf (le_of_eq mk_ker)] at h\n simpa using h\n \u00b7 intro h\n replace h := congr_arg (comap (Ideal.Quotient.mk I)) h\n rw [comap_jacobson_of_surjective hf, \u2190 RingHom.ker_eq_comap_bot (Ideal.Quotient.mk I)] at h\n simpa using h\n\n/-- The standard radical and Jacobson radical of an ideal `I` of `R` are equal if and only if\nthe nilradical and Jacobson radical of the quotient ring `R/I` coincide -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_le_of_isMaximal (L139-L142)\nlemma jacobson_le_of_isMaximal (m : Ideal R) [m.IsMaximal] : jacobson R \u2264 m := by\nrw [Ring.jacobson_eq_sInf_isMaximal]\n exact sInf_le \u2039_\u203a\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.Ideal (L95-L98)\ntheorem Ideal.radical_eq_jacobson [H : IsJacobsonRing R] (I : Ideal R) : I.radical = I.jacobson :=\nle_antisymm (le_sInf fun _J \u27e8hJ, hJ_max\u27e9 => (IsPrime.radical_le_iff hJ_max.isPrime).mpr hJ)\n (H.out (radical_isRadical I) \u25b8 jacobson_mono le_radical)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.jacobson_bot_of_integral_localization (L320-L385)\ntheorem jacobson_bot_of_integral_localization\n {R : Type*} [CommRing R] [IsDomain R] [IsJacobsonRing R]\n (R\u2098 S\u2098 : Type*) [CommRing R\u2098] [CommRing S\u2098] (\u03c6 : R \u2192+* S) (h\u03c6 : Function.Injective \u2191\u03c6) (x : R)\n (hx : x \u2260 0) [Algebra R R\u2098] [IsLocalization.Away x R\u2098] [Algebra S S\u2098]\n [IsLocalization ((Submonoid.powers x).map \u03c6 : Submonoid S) S\u2098]\n (h\u03c6' :\n RingHom.IsIntegral (IsLocalization.map S\u2098 \u03c6 (Submonoid.powers x).le_comap_map : R\u2098 \u2192+* S\u2098)) :\n (\u22a5 : Ideal S).jacobson = (\u22a5 : Ideal S) := by\nhave hM : ((Submonoid.powers x).map \u03c6 : Submonoid S) \u2264 nonZeroDivisors S :=\n map_le_nonZeroDivisors_of_injective \u03c6 h\u03c6 (powers_le_nonZeroDivisors_of_noZeroDivisors hx)\n letI : IsDomain S\u2098 := IsLocalization.isDomain_of_le_nonZeroDivisors _ hM\n let \u03c6' : R\u2098 \u2192+* S\u2098 := IsLocalization.map _ \u03c6 (Submonoid.powers x).le_comap_map\n suffices \u2200 I : Ideal S\u2098, I.IsMaximal \u2192 (I.comap (algebraMap S S\u2098)).IsMaximal by\n have h\u03d5' : comap (algebraMap S S\u2098) (\u22a5 : Ideal S\u2098) = (\u22a5 : Ideal S) := by\n rw [\u2190 RingHom.ker_eq_comap_bot, \u2190 RingHom.injective_iff_ker_eq_bot]\n exact IsLocalization.injective S\u2098 hM\n have hR\u2098 : IsJacobsonRing R\u2098 := isJacobsonRing_localization x\n have hS\u2098 : IsJacobsonRing S\u2098 := isJacobsonRing_of_isIntegral' \u03c6' h\u03c6'\n refine eq_bot_iff.mpr (le_trans ?_ (le_of_eq h\u03d5'))\n rw [\u2190 hS\u2098.out isRadical_bot_of_noZeroDivisors, comap_jacobson]\n exact sInf_le_sInf fun j hj => \u27e8bot_le,\n let \u27e8J, hJ\u27e9 := hj\n hJ.2 \u25b8 this J hJ.1.2\u27e9\n intro I hI\n -- Remainder of the proof is pulling and pushing ideals around the square and the quotient square\n have : (I.comap (algebraMap S S\u2098)).IsPrime := comap_isPrime _ I\n have : (I.comap \u03c6').IsPrime := comap_isPrime \u03c6' I\n have : (\u22a5 : Ideal (S \u29f8 I.comap (algebraMap S S\u2098))).IsPrime := isPrime_bot\n have hcomm : \u03c6'.comp (algebraMap R R\u2098) = (algebraMap S S\u2098).comp \u03c6 := IsLocalization.map_comp _\n let f := quotientMap (I.comap (algebraMap S S\u2098)) \u03c6 le_rfl\n let g := quotientMap I (algebraMap S S\u2098) le_rfl\n have := isMaximal_comap_of_isIntegral_of_isMaximal' \u03c6' h\u03c6' I\n have := ((IsLocalization.isMaximal_iff_isMaximal_disjoint R\u2098 x _).1 this).left\n have : ((I.comap (algebraMap S S\u2098)).comap \u03c6).IsMaximal := by\n rwa [comap_comap, hcomm, \u2190 comap_comap] at this\n rw [\u2190 bot_quotient_isMaximal_iff] at this \u22a2\n refine isMaximal_of_isIntegral_of_isMaximal_comap' f ?_ \u22a5\n ((eq_bot_iff.2 (comap_bot_le_of_injective f quotientMap_injective)).symm \u25b8 this)\n exact RingHom.IsIntegral.tower_bot f g quotientMap_injective\n ((comp_quotientMap_eq_of_comp_eq hcomm I).symm \u25b8\n (RingHom.isIntegral_of_surjective _\n (IsLocalization.surjective_quotientMap_of_maximal_of_localization (Submonoid.powers x) R\u2098\n (by rwa [comap_comap, hcomm, \u2190 bot_quotient_isMaximal_iff]))).trans _ _ (h\u03c6'.quotient _))\n\n/-- Used to bootstrap the proof of `isJacobsonRing_polynomial_iff_isJacobsonRing`.\n That theorem is more general and should be used instead of this one. -/\nprivate theorem isJacobsonRing_polynomial_of_domain (R : Type*) [CommRing R] [IsDomain R]\n [hR : IsJacobsonRing R] (P : Ideal R[X]) [IsPrime P] (hP : \u2200 x : R, C x \u2208 P \u2192 x = 0) :\n P.jacobson = P := by\n by_cases Pb : P = \u22a5\n \u00b7 exact Pb.symm \u25b8\n jacobson_bot_polynomial_of_jacobson_bot (hR.out isRadical_bot_of_noZeroDivisors)\n \u00b7 rw [jacobson_eq_iff_jacobson_quotient_eq_bot]\n let P' := P.comap (C : R \u2192+* R[X])\n have : P'.IsPrime := comap_isPrime C P\n have hR' : IsJacobsonRing (R \u29f8 P') := by infer_instance\n obtain \u27e8p, pP, p0\u27e9 := exists_nonzero_mem_of_ne_bot Pb hP\n let x := (Polynomial.map (Ideal.Quotient.mk P') p).leadingCoeff\n have hx : x \u2260 0 := by rwa [Ne, leadingCoeff_eq_zero]\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := Ideal.quotientMap P (C : R \u2192+* R[X]) le_rfl\n let h\u03c6 : Function.Injective \u2191\u03c6 := quotientMap_injective\n let R\u2098 := Localization.Away x\n let S\u2098 := (Localization ((Submonoid.powers x).map \u03c6 : Submonoid (R[X] \u29f8 P)))\n refine jacobson_bot_of_integral_localization (S := R[X] \u29f8 P) (R := R \u29f8 P') R\u2098 S\u2098 _ h\u03c6 _ hx ?_\n exact isIntegral_isLocalization_polynomial_quotient P p pP\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_polynomial_of_isJacobsonRing (L386-L413)\ntheorem isJacobsonRing_polynomial_of_isJacobsonRing (hR : IsJacobsonRing R) :\n IsJacobsonRing R[X] := by\nrw [isJacobsonRing_iff_prime_eq]\n intro I hI\n let R' : Subring (R[X] \u29f8 I) := ((Ideal.Quotient.mk I).comp C).range\n let i : R \u2192+* R' := ((Ideal.Quotient.mk I).comp C).rangeRestrict\n have hi : Function.Surjective \u2191i := ((Ideal.Quotient.mk I).comp C).rangeRestrict_surjective\n have hi' : RingHom.ker (mapRingHom i) \u2264 I := by\n intro f hf\n apply polynomial_mem_ideal_of_coeff_mem_ideal I f\n intro n\n replace hf := congrArg (fun g : Polynomial ((Ideal.Quotient.mk I).comp C).range => g.coeff n) hf\n change (Polynomial.map ((Ideal.Quotient.mk I).comp C).rangeRestrict f).coeff n = 0 at hf\n rw [coeff_map, Subtype.ext_iff] at hf\n rwa [mem_comap, \u2190 Quotient.eq_zero_iff_mem, \u2190 RingHom.comp_apply]\n have R'_jacob : IsJacobsonRing R' := isJacobsonRing_of_surjective \u27e8i, hi\u27e9\n let J := I.map (mapRingHom i)\n have h_surj : Function.Surjective (mapRingHom i) := Polynomial.map_surjective i hi\n have : IsPrime J := map_isPrime_of_surjective h_surj hi'\n suffices h : J.jacobson = J by\n replace h := congrArg (comap (Polynomial.mapRingHom i)) h\n rw [\u2190 map_jacobson_of_surjective h_surj hi', comap_map_of_surjective _ h_surj,\n comap_map_of_surjective _ h_surj] at h\n refine le_antisymm ?_ le_jacobson\n exact le_trans (le_sup_of_le_left le_rfl) (le_trans (le_of_eq h) (sup_le le_rfl hi'))\n apply isJacobsonRing_polynomial_of_domain R' J\n exact eq_zero_of_polynomial_mem_map_range I\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_le (L108-L114)\ntheorem jacobson_pi_le : jacobson R (\u03a0 i, M i) \u2264 Submodule.pi Set.univ (jacobson R <| M \u00b7) := by\nsimp_rw [\u2190 iInf_comap_proj, jacobson, sInf_eq_iInf', comap_iInf, le_iInf_iff]\n intro i m\n exact iInf_le_of_le \u27e8_, (isCoatom_comap_iff <| LinearMap.proj_surjective i).mpr m.2\u27e9 le_rfl\n\n/-- A product of modules with trivial Jacobson radical (e.g. simple modules) also has trivial\nJacobson radical. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.IsJacobsonRing (L64-L69)\ntheorem IsJacobsonRing.out {R} [CommRing R] :\n IsJacobsonRing R \u2192 \u2200 {I : Ideal R}, I.IsRadical \u2192 I.jacobson = I :=\nisJacobsonRing_iff.1\n\n/-- A ring is a Jacobson ring if and only if for all prime ideals `P`,\nthe Jacobson radical of `P` is equal to `P`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.FG (L196-L204)\ntheorem FG.jacobson_smul_lt {N : Submodule R M} (ne_bot : N \u2260 \u22a5) (fg : N.FG) :\n Ring.jacobson R \u2022 N < N := by\nrw [\u2190 Module.Finite.iff_fg] at fg\n rw [\u2190 nontrivial_iff_ne_bot] at ne_bot\n convert map_strictMono_of_injective N.injective_subtype (jacobson_smul_lt_top \u22a4)\n on_goal 1 => rw [map_smul'']\n all_goals rw [Submodule.map_top, range_subtype]\n\n/-- A form of Nakayama's lemma for modules over noncommutative rings. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff_sInf_maximal (L84-L89)\ntheorem isJacobsonRing_iff_sInf_maximal : IsJacobsonRing R \u2194 \u2200 {I : Ideal R}, I.IsPrime \u2192\n \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, IsMaximal J \u2228 J = \u22a4) \u2227 I = sInf M :=\n\u27e8fun H _I h => eq_jacobson_iff_sInf_maximal.1 (H.out h.isRadical), fun H =>\n isJacobsonRing_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal.2 (H hP)\u27e9\n\n/-- A variant of `isJacobsonRing_iff_sInf_maximal` with a different spelling of \"maximal or `\u22a4`\". -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_surjective (L102-L112)\ntheorem isJacobsonRing_of_surjective [H : IsJacobsonRing R] :\n (\u2203 f : R \u2192+* S, Function.Surjective \u2191f) \u2192 IsJacobsonRing S := by\nrintro \u27e8f, hf\u27e9\n rw [isJacobsonRing_iff_sInf_maximal]\n intro p hp\n use map f '' { J : Ideal R | comap f p \u2264 J \u2227 J.IsMaximal }\n use fun j \u27e8J, hJ, hmap\u27e9 => hmap \u25b8 (map_eq_top_or_isMaximal_of_surjective f hf hJ.right).symm\n have : p = map f (comap f p).jacobson :=\n (IsJacobsonRing.out' _ <| hp.isRadical.comap f).symm \u25b8 (map_comap_of_surjective f hf p).symm\n exact this.trans (map_sInf hf fun J \u27e8hJ, _\u27e9 => le_trans (Ideal.ker_le_comap f) hJ)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_bijective (L78-L81)\ntheorem map_jacobson_of_bijective (hf : Function.Bijective f) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nmap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.comp_C_integral_of_surjective_of_isJacobsonRing (L544-L555)\ntheorem comp_C_integral_of_surjective_of_isJacobsonRing {S : Type*} [Field S] (f : R[X] \u2192+* S)\n (hf : Function.Surjective \u2191f) : (f.comp C).IsIntegral := by\nhave : (RingHom.ker f).IsMaximal := RingHom.ker_isMaximal_of_surjective f hf\n let g : R[X] \u29f8 (RingHom.ker f) \u2192+* S := Ideal.Quotient.lift (RingHom.ker f) f fun _ h => h\n have hfg : g.comp (Ideal.Quotient.mk (RingHom.ker f)) = f := ringHom_ext' rfl rfl\n rw [\u2190 hfg, RingHom.comp_assoc]\n refine (quotient_mk_comp_C_isIntegral_of_isJacobsonRing (RingHom.ker f)).trans _ g\n (g.isIntegral_of_surjective ?_)\n rw [\u2190 hfg] at hf\n norm_num at hf\n exact Function.Surjective.of_comp hf\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_le_of_eq_bot (L90-L95)\ntheorem jacobson_le_of_eq_bot {N : Submodule R M} (h : jacobson R (M \u29f8 N) = \u22a5) :\n jacobson R M \u2264 N := by\nsimp_rw [\u2190 N.ker_mkQ, \u2190 comap_bot, \u2190 h, le_comap_jacobson]\n\nvariable (R M)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.coe_jacobson_quotient (L155-L161)\ntheorem coe_jacobson_quotient (I : Ideal R) [I.IsTwoSided] :\n (jacobson (R \u29f8 I) : Set (R \u29f8 I)) = Module.jacobson R (R \u29f8 I) := by\nlet f : R \u29f8 I \u2192\u209b\u2097[Ideal.Quotient.mk I] R \u29f8 I := \u27e8AddHom.id _, fun _ _ \u21a6 rfl\u27e9\n rw [jacobson, \u2190 Module.map_jacobson_of_ker_le (f := f) Function.surjective_id]\n \u00b7 apply Set.image_id\n \u00b7 rintro _ rfl; exact zero_mem _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_eq_bot_of_injective (L58-L64)\ntheorem jacobson_eq_bot_of_injective (inj : Function.Injective f) (h : jacobson R\u2082 M\u2082 = \u22a5) :\n jacobson R M = \u22a5 :=\nle_bot_iff.mp <| (le_comap_jacobson f).trans <| by\n simp_rw [h, comap_bot, (LinearMap.ker_eq_bot.mpr inj).le]\n\nvariable {f}\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Jacobson.Semiprimary.IsSimpleModule (L26-L28)\ntheorem IsSimpleModule.jacobson_eq_bot [IsSimpleModule R M] : Module.jacobson R M = \u22a5 :=\nle_bot_iff.mp <| sInf_le isCoatom_bot\n```\n\n-- snippet 41\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff (L60-L63)\ntheorem isJacobsonRing_iff {R} [CommRing R] :\n IsJacobsonRing R \u2194 \u2200 I : Ideal R, I.IsRadical \u2192 I.jacobson = I :=\n\u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n```\n\n-- snippet 42\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_isIntegral' (L142-L161)\ntheorem isJacobsonRing_of_isIntegral' (f : R \u2192+* S) (hf : f.IsIntegral) [IsJacobsonRing R] :\n IsJacobsonRing S :=\nlet _ : Algebra R S := f.toAlgebra\n have : Algebra.IsIntegral R S := \u27e8hf\u27e9\n isJacobsonRing_of_isIntegral (R := R)\n\nend IsJacobsonRing\n\nsection Localization\n\nopen IsLocalization Submonoid\n\nvariable {R S : Type*} [CommRing R] [CommRing S]\nvariable (y : R) [Algebra R S] [IsLocalization.Away y S]\n\nvariable (S) in\n/-- If `R` is a Jacobson ring, then maximal ideals in the localization at `y`\ncorrespond to maximal ideals in the original ring `R` that don't contain `y`.\nThis lemma gives the correspondence in the particular case of an ideal and its comap.\nSee `le_relIso_of_maximal` for the more general relation isomorphism -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_bijective (L82-L85)\ntheorem comap_jacobson_of_bijective (hf : Function.Bijective f) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M :=\ncomap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.RingTheory.Jacobson.Polynomial.jacobson_bot_polynomial_le_sInf_map_maximal (L25-L38)\ntheorem jacobson_bot_polynomial_le_sInf_map_maximal :\n jacobson (\u22a5 : Ideal R[X]) \u2264 sInf (map (C : R \u2192+* R[X]) '' { J : Ideal R | J.IsMaximal }) := by\nrefine le_sInf fun J => exists_imp.2 fun j hj => ?_\n haveI : j.IsMaximal := hj.1\n refine Trans.trans (jacobson_mono bot_le) (le_of_eq ?_ : J.jacobson \u2264 J)\n suffices t : (\u22a5 : Ideal (Polynomial (R \u29f8 j))).jacobson = \u22a5 by\n rw [\u2190 hj.2, jacobson_eq_iff_jacobson_quotient_eq_bot]\n replace t := congr_arg (map (polynomialQuotientEquivQuotientPolynomial j).toRingHom) t\n rwa [map_jacobson_of_bijective _, map_bot] at t\n exact RingEquiv.bijective (polynomialQuotientEquivQuotientPolynomial j)\n refine eq_bot_iff.2 fun f hf => ?_\n have r1 : (X : (R \u29f8 j)[X]) \u2260 0 := ne_of_apply_ne (coeff \u00b7 1) <| by simp\n simpa [r1] using eq_C_of_degree_eq_zero (degree_eq_zero_of_isUnit ((mem_jacobson_bot.1 hf) X))\n```\n\n-- snippet 45\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isMaximal_comap_C_of_isMaximal (L430-L513)\ntheorem isMaximal_comap_C_of_isMaximal [IsJacobsonRing R] [Nontrivial R]\n (hP' : \u2200 x : R, C x \u2208 P \u2192 x = 0) :\n IsMaximal (comap (C : R \u2192+* R[X]) P : Ideal R) := by\nlet P' := comap (C : R \u2192+* R[X]) P\n have hP'_prime : P'.IsPrime := comap_isPrime C P\n obtain \u27e8\u27e8m, hmem_P\u27e9, hm\u27e9 :=\n Submodule.nonzero_mem_of_bot_lt (bot_lt_of_maximal P polynomial_not_isField)\n have hm' : m \u2260 0 := by\n simpa [Submodule.coe_eq_zero] using hm\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := quotientMap P (C : R \u2192+* R[X]) le_rfl\n let a : R \u29f8 P' := (m.map (Ideal.Quotient.mk P')).leadingCoeff\n let M : Submonoid (R \u29f8 P') := Submonoid.powers a\n rw [\u2190 bot_quotient_isMaximal_iff]\n have hp0 : a \u2260 0 := fun hp0' =>\n hm' <| map_injective (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X]) : Ideal R))\n ((injective_iff_map_eq_zero (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X]) : Ideal R))).2\n fun x hx => by\n rwa [Quotient.eq_zero_iff_mem, (by rwa [eq_bot_iff] : (P.comap C : Ideal R) = \u22a5)] at hx)\n (by simpa only [a, leadingCoeff_eq_zero, Polynomial.map_zero] using hp0')\n have hM : (0 : R \u29f8 P') \u2209 M := fun \u27e8n, hn\u27e9 => hp0 (eq_zero_of_pow_eq_zero hn)\n suffices (\u22a5 : Ideal (Localization M)).IsMaximal by\n rw [\u2190 IsLocalization.comap_map_of_isPrime_disjoint M (Localization M) isPrime_bot\n (disjoint_iff_inf_le.mpr fun x hx => hM (hx.2 \u25b8 hx.1))]\n exact ((IsLocalization.isMaximal_iff_isMaximal_disjoint (Localization M) a _).mp\n (by rwa [Ideal.map_bot])).1\n let M' : Submonoid (R[X] \u29f8 P) := M.map \u03c6\n have hM' : (0 : R[X] \u29f8 P) \u2209 M' := fun \u27e8z, hz\u27e9 =>\n hM (quotientMap_injective (_root_.trans hz.2 \u03c6.map_zero.symm) \u25b8 hz.1)\n suffices (\u22a5 : Ideal (Localization M')).IsMaximal by\n rw [le_antisymm bot_le (comap_bot_le_of_injective _\n (IsLocalization.map_injective_of_injective M (Localization M) (Localization M')\n quotientMap_injective))]\n refine isMaximal_comap_of_isIntegral_of_isMaximal' _ ?_ \u22a5\n have isloc : IsLocalization (Submonoid.map \u03c6 M) (Localization M') := by infer_instance\n exact @isIntegral_isLocalization_polynomial_quotient R _\n (Localization M) (Localization M') _ _ P m hmem_P _ _ _ isloc\n rw [(map_bot.symm :\n (\u22a5 : Ideal (Localization M')) = Ideal.map (algebraMap (R[X] \u29f8 P) (Localization M')) \u22a5)]\n let bot_maximal := (bot_quotient_isMaximal_iff _).mpr hP\n refine bot_maximal.map_bijective (algebraMap (R[X] \u29f8 P) (Localization M')) ?_\n apply IsField.localization_map_bijective hM'\n rwa [\u2190 Quotient.maximal_ideal_iff_isField_quotient, \u2190 bot_quotient_isMaximal_iff]\n\n/-- Used to bootstrap the more general `quotient_mk_comp_C_isIntegral_of_jacobson` -/\nprivate theorem quotient_mk_comp_C_isIntegral_of_jacobson' [Nontrivial R] (hR : IsJacobsonRing R)\n (hP' : \u2200 x : R, C x \u2208 P \u2192 x = 0) :\n ((Ideal.Quotient.mk P).comp C : R \u2192+* R[X] \u29f8 P).IsIntegral := by\n refine (isIntegral_quotientMap_iff _).mp ?_\n let P' : Ideal R := P.comap C\n obtain \u27e8pX, hpX, hp0\u27e9 :=\n exists_nonzero_mem_of_ne_bot (ne_of_lt (bot_lt_of_maximal P polynomial_not_isField)).symm hP'\n let a : R \u29f8 P' := (pX.map (Ideal.Quotient.mk P')).leadingCoeff\n let M : Submonoid (R \u29f8 P') := Submonoid.powers a\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := quotientMap P C le_rfl\n have hP'_prime : P'.IsPrime := comap_isPrime C P\n have hM : (0 : R \u29f8 P') \u2209 M := fun \u27e8n, hn\u27e9 =>\n hp0 <| leadingCoeff_eq_zero.mp (eq_zero_of_pow_eq_zero hn)\n let M' : Submonoid (R[X] \u29f8 P) := M.map \u03c6\n refine RingHom.IsIntegral.tower_bot \u03c6 (algebraMap _ (Localization M')) ?_ ?_\n \u00b7 refine IsLocalization.injective (Localization M')\n (show M' \u2264 _ from le_nonZeroDivisors_of_noZeroDivisors fun hM' => hM ?_)\n exact\n let \u27e8z, zM, z0\u27e9 := hM'\n quotientMap_injective (_root_.trans z0 \u03c6.map_zero.symm) \u25b8 zM\n \u00b7 suffices RingHom.comp (algebraMap (R[X] \u29f8 P) (Localization M')) \u03c6 =\n (IsLocalization.map (Localization M') \u03c6 M.le_comap_map).comp\n (algebraMap (R \u29f8 P') (Localization M)) by\n rw [this]\n refine RingHom.IsIntegral.trans (algebraMap (R \u29f8 P') (Localization M))\n (IsLocalization.map (Localization M') \u03c6 M.le_comap_map) ?_ ?_\n \u00b7 exact (algebraMap (R \u29f8 P') (Localization M)).isIntegral_of_surjective\n (IsField.localization_map_bijective hM ((Quotient.maximal_ideal_iff_isField_quotient _).mp\n (isMaximal_comap_C_of_isMaximal P hP'))).2\n \u00b7 -- `convert` here is faster than `exact`, and this proof is near the time limit.\n -- convert isIntegral_isLocalization_polynomial_quotient P pX hpX\n have isloc : IsLocalization M' (Localization M') := by infer_instance\n exact @isIntegral_isLocalization_polynomial_quotient R _\n (Localization M) (Localization M') _ _ P pX hpX _ _ _ isloc\n rw [IsLocalization.map_comp M.le_comap_map]\n\nvariable [IsJacobsonRing R]\n\n/-- If `R` is a Jacobson ring, and `P` is a maximal ideal of `R[X]`,\n then `R \u2192 R[X]/P` is an integral map. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.RingTheory.Jacobson.Polynomial.jacobson_bot_polynomial_of_jacobson_bot (L39-L49)\ntheorem jacobson_bot_polynomial_of_jacobson_bot (h : jacobson (\u22a5 : Ideal R) = \u22a5) :\n jacobson (\u22a5 : Ideal R[X]) = \u22a5 := by\nrefine eq_bot_iff.2 (le_trans jacobson_bot_polynomial_le_sInf_map_maximal ?_)\n refine fun f hf => (Submodule.mem_bot R[X]).2 <| Polynomial.ext fun n =>\n Trans.trans (?_ : coeff f n = 0) (coeff_zero n).symm\n suffices f.coeff n \u2208 Ideal.jacobson \u22a5 by rwa [h, Submodule.mem_bot] at this\n exact mem_sInf.2 fun j hj => (mem_map_C_iff.1 ((mem_sInf.1 hf) \u27e8j, \u27e8hj.2, rfl\u27e9\u27e9)) n\n\nend Polynomial\n\nend Ideal\n```\n\n-- snippet 47\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_finiteType (L666-L670)\nlemma isJacobsonRing_of_finiteType {A B : Type*} [CommRing A] [CommRing B]\n [Algebra A B] [IsJacobsonRing A] [Algebra.FiniteType A B] : IsJacobsonRing B := by\nobtain \u27e8\u03b9, h\u03b9, f, hf\u27e9 := Algebra.FiniteType.iff_quotient_mvPolynomial'.mp \u2039_\u203a\n exact isJacobsonRing_of_surjective \u27e8f.toRingHom, hf\u27e9\n```\n\n-- snippet 48\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_eq_sInf_isMaximal (L131-L133)\ntheorem jacobson_eq_sInf_isMaximal : jacobson R = sInf {I : Ideal R | I.IsMaximal} := by\nsimp_rw [jacobson, Module.jacobson, Ideal.isMaximal_def]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_jacobson (L97-L99)\ntheorem jacobson_quotient_jacobson : jacobson R (M \u29f8 jacobson R M) = \u22a5 := by\nrw [jacobson_quotient_of_le le_rfl, mkQ_map_self]\n```\n\n-- snippet 50\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_ker_le (L65-L72)\ntheorem map_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nle_antisymm (map_jacobson_le f) <| by\n rw [jacobson, sInf_eq_iInf'] at le\n conv_rhs => rw [jacobson, sInf_eq_iInf', map_iInf_of_ker_le surj le]\n exact le_iInf fun m \u21a6 sInf_le (isCoatom_map_of_ker_le surj (le_iInf_iff.mp le m) m.2)\n```\n\n-- snippet 51\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.le_comap_jacobson (L48-L54)\ntheorem le_comap_jacobson : jacobson R M \u2264 comap f (jacobson R\u2082 M\u2082) := by\nconv_rhs => rw [jacobson, sInf_eq_iInf', comap_iInf]\n refine le_iInf_iff.mpr fun S m hm \u21a6 ?_\n obtain h | h := isCoatom_comap_or_eq_top f S.2\n \u00b7 exact mem_sInf.mp hm _ h\n \u00b7 simpa only [h] using mem_top\n```\n\n-- snippet 52\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_lt_top (L100-L103)\ntheorem jacobson_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] : jacobson R M < \u22a4 := by\nobtain \u27e8m, hm, -\u27e9 := (eq_top_or_exists_le_coatom (\u22a5 : Submodule R M)).resolve_left bot_ne_top\n exact (sInf_le <| Set.mem_setOf.mpr hm).trans_lt hm.1.lt_top\n```\n\n-- snippet 53\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.finite_of_finite_type_of_isJacobsonRing (L676-L690)\nlemma finite_of_finite_type_of_isJacobsonRing (R S : Type*) [CommRing R] [Field S]\n [Algebra R S] [IsJacobsonRing R] [Algebra.FiniteType R S] :\n Module.Finite R S := by\nobtain \u27e8\u03b9, h\u03b9, f, hf\u27e9 := Algebra.FiniteType.iff_quotient_mvPolynomial'.mp \u2039_\u203a\n have : (algebraMap R S).IsIntegral := by\n rw [\u2190 f.comp_algebraMap]\n -- We need to write `f.toRingHom` instead of just `f`, to avoid unification issues.\n exact MvPolynomial.comp_C_integral_of_surjective_of_isJacobsonRing f.toRingHom hf\n have : Algebra.IsIntegral R S := Algebra.isIntegral_def.mpr this\n exact Algebra.IsIntegral.finite\n\n/--\nIf `f : R \u2192+* S` is a ring homomorphism from a Jacobson ring to a field,\nthen it is finite if and only if it is finite type.\n-/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.RingTheory.Jacobson.Semiprimary.IsSemisimpleModule (L29-L35)\ntheorem IsSemisimpleModule.jacobson_eq_bot [IsSemisimpleModule R M] :\n Module.jacobson R M = \u22a5 :=\nhave \u27e8s, e, simple\u27e9 := isSemisimpleModule_iff_exists_linearEquiv_dfinsupp.mp \u2039_\u203a\n let f : M \u2192\u2097[R] \u2200 m : s, m.1 := (LinearMap.pi DFinsupp.lapply).comp e.toLinearMap\n Module.jacobson_eq_bot_of_injective f (DFinsupp.injective_pi_lapply (R := R).comp e.injective)\n (Module.jacobson_pi_eq_bot _ _ fun i \u21a6 IsSimpleModule.jacobson_eq_bot R _)\n```\n\n-- snippet 55\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_polynomial_iff_isJacobsonRing (L414-L419)\ntheorem isJacobsonRing_polynomial_iff_isJacobsonRing : IsJacobsonRing R[X] \u2194 IsJacobsonRing R := by\nrefine \u27e8?_, isJacobsonRing_polynomial_of_isJacobsonRing\u27e9\n intro H\n exact isJacobsonRing_of_surjective \u27e8eval\u2082RingHom (RingHom.id _) 1, fun x =>\n \u27e8C x, by simp only [coe_eval\u2082RingHom, RingHom.id_apply, eval\u2082_C]\u27e9\u27e9\n```\n\n-- snippet 56\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.IsLocalization (L162-L188)\ntheorem IsLocalization.isMaximal_iff_isMaximal_disjoint [H : IsJacobsonRing R] (J : Ideal S) :\n J.IsMaximal \u2194 (comap (algebraMap R S) J).IsMaximal \u2227 y \u2209 Ideal.comap (algebraMap R S) J := by\nconstructor\n \u00b7 refine fun h => \u27e8?_, fun hy =>\n h.ne_top (Ideal.eq_top_of_isUnit_mem _ hy (map_units _ \u27e8y, Submonoid.mem_powers _\u27e9))\u27e9\n have hJ : J.IsPrime := IsMaximal.isPrime h\n rw [isPrime_iff_isPrime_disjoint (Submonoid.powers y)] at hJ\n have : y \u2209 (comap (algebraMap R S) J).1 := Set.disjoint_left.1 hJ.right (Submonoid.mem_powers _)\n rw [\u2190 H.out hJ.left.isRadical, jacobson, Submodule.mem_toAddSubmonoid, Ideal.mem_sInf] at this\n push Not at this\n rcases this with \u27e8I, hI, hI'\u27e9\n convert hI.right\n by_cases hJ : J = I.map (algebraMap R S)\n \u00b7 rw [hJ, comap_map_of_isPrime_disjoint (powers y) S (IsMaximal.isPrime hI.right)]\n rwa [disjoint_powers_iff_notMem y hI.right.isPrime.isRadical]\n \u00b7 have hI_p : (I.map (algebraMap R S)).IsPrime := by\n refine isPrime_of_isPrime_disjoint (powers y) _ I hI.right.isPrime ?_\n rwa [disjoint_powers_iff_notMem y hI.right.isPrime.isRadical]\n have : J \u2264 I.map (algebraMap R S) := map_comap (Submonoid.powers y) S J \u25b8 map_mono hI.left\n exact absurd (h.1.2 _ (lt_of_le_of_ne this hJ)) hI_p.1\n \u00b7 simp only [Ideal.mem_comap, and_imp]\n exact (fun _ _ \u21a6 IsMaximal.of_isLocalization_of_disjoint (powers y))\n\n/-- If `R` is a Jacobson ring, then maximal ideals in the localization at `y`\ncorrespond to maximal ideals in the original ring `R` that don't contain `y`.\nThis lemma gives the correspondence in the particular case of an ideal and its map.\nSee `le_relIso_of_maximal` for the more general statement, and the reverse of this implication -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff_prime_eq (L70-L83)\ntheorem isJacobsonRing_iff_prime_eq :\n IsJacobsonRing R \u2194 \u2200 P : Ideal R, IsPrime P \u2192 P.jacobson = P := by\nrefine isJacobsonRing_iff.trans \u27e8fun h I hI => h I hI.isRadical, ?_\u27e9\n refine fun h I hI \u21a6 le_antisymm (fun x hx \u21a6 ?_) (fun x hx \u21a6 mem_sInf.mpr fun _ hJ \u21a6 hJ.left hx)\n rw [\u2190 hI.radical, radical_eq_sInf I, mem_sInf]\n intro P hP\n rw [Set.mem_setOf_eq] at hP\n rw [jacobson, mem_sInf] at hx\n rw [\u2190 h P hP.right, jacobson, mem_sInf]\n exact fun J hJ => hx \u27e8le_trans hP.left hJ.left, hJ.right\u27e9\n\n/-- A ring `R` is Jacobson if and only if for every prime ideal `I`,\n`I` can be written as the infimum of some collection of maximal ideals.\nAllowing \u22a4 in the set `M` of maximal ideals is equivalent, but makes some proofs cleaner. -/\n```\n\n-- snippet 58\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff_sInf_maximal' (L90-L94)\ntheorem isJacobsonRing_iff_sInf_maximal' : IsJacobsonRing R \u2194 \u2200 {I : Ideal R}, I.IsPrime \u2192\n \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, \u2200 (K : Ideal R), J < K \u2192 K = \u22a4) \u2227 I = sInf M :=\n\u27e8fun H _I h => eq_jacobson_iff_sInf_maximal'.1 (H.out h.isRadical), fun H =>\n isJacobsonRing_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal'.2 (H hP)\u27e9\n```\n\n-- snippet 59\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_eq_bot (L115-L119)\ntheorem jacobson_pi_eq_bot (h : \u2200 i, jacobson R (M i) = \u22a5) : jacobson R (\u03a0 i, M i) = \u22a5 :=\nle_bot_iff.mp <| (jacobson_pi_le R M).trans <| by simp_rw [h, pi_univ_bot, le_rfl]\n\nend Module\n```\n\n-- snippet 60\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.mem_closure_X_union_C (L248-L269)\nlemma mem_closure_X_union_C {R : Type*} [Ring R] (p : R[X]) :\n p \u2208 Subring.closure (insert X {f | f.degree \u2264 0} : Set R[X]) := by\nrefine Polynomial.induction_on p ?_ ?_ ?_\n \u00b7 intro r\n apply Subring.subset_closure\n apply Set.mem_insert_of_mem\n exact degree_C_le\n \u00b7 intro p1 p2 h1 h2\n exact Subring.add_mem _ h1 h2\n \u00b7 intro n r hr\n rw [pow_succ, \u2190 mul_assoc]\n apply Subring.mul_mem _ hr\n apply Subring.subset_closure\n apply Set.mem_insert\n\nvariable {R S : Type*} [CommRing R] [CommRing S] [IsDomain S]\nvariable {R\u2098 S\u2098 : Type*} [CommRing R\u2098] [CommRing S\u2098]\n\n/-- If `I` is a prime ideal of `R[X]` and `pX \u2208 I` is a non-constant polynomial,\n then the map `R \u2192+* R[x]/I` descends to an integral map when localizing at `pX.leadingCoeff`.\n In particular `X` is integral because it satisfies `pX`, and constants are trivially integral,\n so integrality of the entire extension follows by closure under addition and multiplication. -/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson (L43-L47)\ndef jacobson : Submodule R M :=\nsInf { m : Submodule R M | IsCoatom m }\n\nvariable {R R\u2082 M M\u2082}\n```\n\n-- snippet 62\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_of_le (L86-L89)\ntheorem jacobson_quotient_of_le {N : Submodule R M} (le : N \u2264 jacobson R M) :\n jacobson R (M \u29f8 N) = map N.mkQ (jacobson R M) :=\n(map_jacobson_of_ker_le N.mkQ_surjective <| by rwa [ker_mkQ]).symm\n```\n\n-- snippet 63\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.finite_of_algHom_finiteType_of_isJacobsonRing (L699-L719)\ntheorem finite_of_algHom_finiteType_of_isJacobsonRing\n {K L A : Type*} [CommRing K] [DivisionRing L] [CommRing A]\n [IsJacobsonRing K] [IsNoetherianRing K] [Nontrivial A]\n [Algebra K L] [Algebra K A]\n [Algebra.FiniteType K A] (f : L \u2192\u2090[K] A) :\n Module.Finite K L := by\nobtain \u27e8m, hm\u27e9 := Ideal.exists_maximal A\n letI := Ideal.Quotient.field m\n have := finite_of_finite_type_of_isJacobsonRing K (A \u29f8 m)\n exact Module.Finite.of_injective ((Ideal.Quotient.mk\u2090 K m).comp f).toLinearMap\n (RingHom.injective _)\n\n/-- If `K` is a Jacobson Noetherian ring, `A` a nontrivial `K`-algebra of finite type,\nthen any `K`-subfield of `A` is finite over `K`. -/\nnonrec theorem RingHom.finite_of_algHom_finiteType_of_isJacobsonRing\n {K L A : Type*} [CommRing K] [Field L] [CommRing A]\n [IsJacobsonRing K] [IsNoetherianRing K] [Nontrivial A]\n (f : K \u2192+* L) (g : L \u2192+* A) (hfg : (g.comp f).FiniteType) :\n f.Finite := by\n algebraize [f, (g.comp f)]\n exact finite_of_algHom_finiteType_of_isJacobsonRing \u27e8g, fun _ \u21a6 rfl\u27e9\n```\n\n-- snippet 64\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_isIntegral (L123-L141)\ntheorem isJacobsonRing_of_isIntegral [Algebra R S] [Algebra.IsIntegral R S] [IsJacobsonRing R] :\n IsJacobsonRing S := by\nrw [isJacobsonRing_iff_prime_eq]\n intro P hP\n by_cases hP_top : comap (algebraMap R S) P = \u22a4\n \u00b7 simp [comap_eq_top_iff.1 hP_top]\n have : Nontrivial (R \u29f8 comap (algebraMap R S) P) := by rwa [Quotient.nontrivial_iff]\n rw [jacobson_eq_iff_jacobson_quotient_eq_bot]\n refine eq_bot_of_comap_eq_bot (R := R \u29f8 comap (algebraMap R S) P) ?_\n rw [eq_bot_iff, \u2190 jacobson_eq_iff_jacobson_quotient_eq_bot.1\n ((isJacobsonRing_iff_prime_eq.1 \u2039_\u203a) (comap (algebraMap R S) P) (comap_isPrime _ _)),\n comap_jacobson]\n refine sInf_le_sInf fun J hJ => ?_\n simp only [true_and, Set.mem_image, bot_le, Set.mem_setOf_eq]\n have : J.IsMaximal := by simpa using hJ\n exact exists_ideal_over_maximal_of_isIntegral J\n (comap_bot_le_of_injective _ algebraMap_quotient_injective)\n\n/-- A variant of `isJacobsonRing_of_isIntegral` that takes `RingHom.IsIntegral` instead. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iso (L119-L122)\ntheorem isJacobsonRing_iso (e : R \u2243+* S) : IsJacobsonRing R \u2194 IsJacobsonRing S where\n mp _ := isJacobsonRing_of_surjective \u27e8(e : R \u2192+* S), e.surjective\u27e9\nmpr _ := isJacobsonRing_of_surjective \u27e8(e.symm : S \u2192+* R), e.symm.surjective\u27e9\n```\n\n-- snippet 66\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing (L575-L631)\ninstance isJacobsonRing {R : Type*} [CommRing R] {\u03b9 : Type*} [Finite \u03b9] [IsJacobsonRing R] :\n IsJacobsonRing (MvPolynomial \u03b9 R) := by\ncases nonempty_fintype \u03b9\n let e := Fintype.equivFin \u03b9\n rw [isJacobsonRing_iso (renameEquiv R e).toRingEquiv]\n exact isJacobsonRing_MvPolynomial_fin _\n\nvariable {n : \u2115}\n\nuniverse v w\n\n/-- The constant coefficient as an R-linear morphism -/\nprivate noncomputable def C\u2090 (R : Type u) (S : Type v)\n [CommRing R] [CommRing S] [Algebra R S] : S \u2192\u2090[R] S[X] :=\n { Polynomial.C with commutes' := fun r => by rfl }\n\nprivate lemma aux_IH {R : Type u} {S : Type v} {T : Type w}\n [CommRing R] [CommRing S] [CommRing T] [IsJacobsonRing S] [Algebra R S] [Algebra R T]\n (IH : \u2200 (Q : Ideal S), (IsMaximal Q) \u2192 RingHom.IsIntegral (algebraMap R (S \u29f8 Q)))\n (v : S[X] \u2243\u2090[R] T) (P : Ideal T) (hP : P.IsMaximal) :\n RingHom.IsIntegral (algebraMap R (T \u29f8 P)) := by\n let Q := P.comap v.toAlgHom.toRingHom\n have hw : Ideal.map v Q = P := map_comap_of_surjective v v.surjective P\n have hQ : IsMaximal Q := comap_isMaximal_of_surjective _ v.surjective\n let w : (S[X] \u29f8 Q) \u2243\u2090[R] (T \u29f8 P) := Ideal.quotientEquivAlg Q P v hw.symm\n let Q' := Q.comap (Polynomial.C)\n let w' : (S \u29f8 Q') \u2192\u2090[R] (S[X] \u29f8 Q) := Ideal.quotientMap\u2090 Q (C\u2090 R S) le_rfl\n have h_eq : algebraMap R (T \u29f8 P) =\n w.toRingEquiv.toRingHom.comp (w'.toRingHom.comp (algebraMap R (S \u29f8 Q'))) := by\n ext r\n simp only [AlgHom.toRingHom_eq_coe, AlgEquiv.toRingEquiv_eq_coe,\n RingEquiv.toRingHom_eq_coe, AlgHom.comp_algebraMap_of_tower, coe_comp, coe_coe,\n AlgEquiv.coe_ringEquiv, Function.comp_apply, AlgEquiv.commutes]\n rw [h_eq]\n apply RingHom.IsIntegral.trans\n \u00b7 apply RingHom.IsIntegral.trans\n \u00b7 apply IH\n apply Polynomial.isMaximal_comap_C_of_isJacobsonRing\n \u00b7 suffices w'.toRingHom = Ideal.quotientMap Q (Polynomial.C) le_rfl by\n rw [this]\n rw [isIntegral_quotientMap_iff _]\n apply Polynomial.quotient_mk_comp_C_isIntegral_of_isJacobsonRing\n rfl\n \u00b7 apply RingHom.isIntegral_of_surjective\n exact w.surjective\n\nprivate theorem quotient_mk_comp_C_isIntegral_of_isJacobsonRing'\n {R : Type*} [CommRing R] [IsJacobsonRing R]\n (P : Ideal (MvPolynomial (Fin n) R)) (hP : P.IsMaximal) :\n RingHom.IsIntegral (algebraMap R (MvPolynomial (Fin n) R \u29f8 P)) := by\n induction n with\n | zero =>\n apply RingHom.isIntegral_of_surjective\n apply Function.Surjective.comp Quotient.mk_surjective\n exact C_surjective (Fin 0)\n | succ n IH => apply aux_IH IH (finSuccEquiv R n).symm P hP\n```\n\n-- snippet 67\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isMaximal_comap_C_of_isJacobsonRing (L538-L543)\ntheorem isMaximal_comap_C_of_isJacobsonRing : (P.comap (C : R \u2192+* R[X])).IsMaximal := by\nrw [\u2190 @mk_ker _ _ P, RingHom.ker_eq_comap_bot, comap_comap]\n have := (bot_quotient_isMaximal_iff _).mpr hP\n exact isMaximal_comap_of_isIntegral_of_isMaximal' _\n (quotient_mk_comp_C_isIntegral_of_isJacobsonRing P) \u22a5\n```\n\n-- snippet 68\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_ker_le (L73-L77)\ntheorem comap_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M := by\nrw [\u2190 map_jacobson_of_ker_le surj le, comap_map_eq_self le]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.quotient_mk_comp_C_isIntegral_of_isJacobsonRing (L514-L537)\ntheorem quotient_mk_comp_C_isIntegral_of_isJacobsonRing :\n ((Ideal.Quotient.mk P).comp C : R \u2192+* R[X] \u29f8 P).IsIntegral := by\nlet P' : Ideal R := P.comap C\n have : P'.IsPrime := comap_isPrime C P\n let f : R[X] \u2192+* Polynomial (R \u29f8 P') := Polynomial.mapRingHom (Ideal.Quotient.mk P')\n have hf : Function.Surjective \u2191f := map_surjective (Ideal.Quotient.mk P') Quotient.mk_surjective\n have hPJ : P = (P.map f).comap f := by\n rw [comap_map_of_surjective _ hf]\n refine le_antisymm (le_sup_of_le_left le_rfl) (sup_le le_rfl ?_)\n refine fun p hp =>\n polynomial_mem_ideal_of_coeff_mem_ideal P p fun n => Quotient.eq_zero_iff_mem.mp ?_\n simpa only [f, coeff_map, coe_mapRingHom] using (Polynomial.ext_iff.mp hp) n\n refine RingHom.IsIntegral.tower_bot\n (T := (R \u29f8 comap C P)[X] \u29f8 _) _ _ (injective_quotient_le_comap_map P) ?_\n rw [\u2190 quotient_mk_maps_eq]\n refine ((Ideal.Quotient.mk P').isIntegral_of_surjective Quotient.mk_surjective).trans _ _ ?_\n have : IsMaximal (Ideal.map (mapRingHom (Ideal.Quotient.mk (comap C P))) P) :=\n Or.recOn (map_eq_top_or_isMaximal_of_surjective f hf hP)\n (fun h => absurd (_root_.trans (h \u25b8 hPJ : P = comap f \u22a4) comap_top : P = \u22a4) hP.ne_top) id\n apply quotient_mk_comp_C_isIntegral_of_jacobson' _ ?_ (fun x hx => ?_)\n any_goals exact isJacobsonRing_quotient\n obtain \u27e8z, rfl\u27e9 := Ideal.Quotient.mk_surjective x\n rwa [Quotient.eq_zero_iff_mem, mem_comap, hPJ, mem_comap, coe_mapRingHom, map_C]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isIntegral_isLocalization_polynomial_quotient (L270-L319)\ntheorem isIntegral_isLocalization_polynomial_quotient\n (P : Ideal R[X]) (pX : R[X]) (hpX : pX \u2208 P) [Algebra (R \u29f8 P.comap (C : R \u2192+* R[X])) R\u2098]\n [IsLocalization.Away (pX.map (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X])))).leadingCoeff R\u2098]\n [Algebra (R[X] \u29f8 P) S\u2098] [IsLocalization ((Submonoid.powers (pX.map (Ideal.Quotient.mk (P.comap\n (C : R \u2192+* R[X])))).leadingCoeff).map (quotientMap P C le_rfl) : Submonoid (R[X] \u29f8 P)) S\u2098] :\n (IsLocalization.map S\u2098 (quotientMap P C le_rfl) (Submonoid.powers (pX.map (Ideal.Quotient.mk\n (P.comap (C : R \u2192+* R[X])))).leadingCoeff).le_comap_map : R\u2098 \u2192+* S\u2098).IsIntegral := by\nlet P' : Ideal R := P.comap C\n let M : Submonoid (R \u29f8 P') :=\n Submonoid.powers (pX.map (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X])))).leadingCoeff\n let M' : Submonoid (R[X] \u29f8 P) :=\n (Submonoid.powers (pX.map (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X])))).leadingCoeff).map\n (quotientMap P C le_rfl)\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := quotientMap P C le_rfl\n let \u03c6' : R\u2098 \u2192+* S\u2098 := IsLocalization.map S\u2098 \u03c6 M.le_comap_map\n have h\u03c6' : \u03c6.comp (Ideal.Quotient.mk P') = (Ideal.Quotient.mk P).comp C := rfl\n intro p\n obtain \u27e8\u27e8p', \u27e8q, hq\u27e9\u27e9, hp\u27e9 := IsLocalization.surj M' p\n suffices \u03c6'.IsIntegralElem (algebraMap (R[X] \u29f8 P) S\u2098 p') by\n obtain \u27e8q', hq', rfl\u27e9 := hq\n obtain \u27e8q'', hq''\u27e9 := isUnit_iff_exists_inv'.1 (IsLocalization.map_units R\u2098 (\u27e8q', hq'\u27e9 : M))\n refine (hp.symm \u25b8 this).of_mul_unit \u03c6' p (algebraMap (R[X] \u29f8 P) S\u2098 (\u03c6 q')) q'' ?_\n rw [\u2190 \u03c6'.map_one, \u2190 congr_arg \u03c6' hq'', \u03c6'.map_mul, \u2190 \u03c6'.comp_apply]\n simp only [\u03c6', IsLocalization.map_comp _, RingHom.comp_apply]\n dsimp at hp\n refine @IsIntegral.of_mem_closure'' R\u2098 _ S\u2098 _ \u03c6'\n ((algebraMap (R[X] \u29f8 P) S\u2098).comp (Ideal.Quotient.mk P) '' insert X { p | p.degree \u2264 0 }) ?_\n ((algebraMap (R[X] \u29f8 P) S\u2098) p') ?_\n \u00b7 rintro x \u27e8p, hp, rfl\u27e9\n push _ \u2208 _ at hp\n rcases hp with hy | hy\n \u00b7 rw [hy]\n refine \u03c6.isIntegralElem_localization_at_leadingCoeff ((Ideal.Quotient.mk P) X)\n (pX.map (Ideal.Quotient.mk P')) ?_ M ?_\n \u00b7 rwa [eval\u2082_map, h\u03c6', \u2190 hom_eval\u2082, Quotient.eq_zero_iff_mem, eval\u2082_C_X]\n \u00b7 use 1\n simp only [P', pow_one]\n \u00b7 rw [degree_le_zero_iff] at hy\n rw [hy]\n refine \u27e8X - C (algebraMap _ _ ((Ideal.Quotient.mk P') (p.coeff 0))), monic_X_sub_C _, ?_\u27e9\n simp only [eval\u2082_sub, eval\u2082_X, eval\u2082_C]\n rw [sub_eq_zero, \u2190 \u03c6'.comp_apply]\n simp [\u03c6', IsLocalization.map_comp _, P', \u03c6]\n \u00b7 obtain \u27e8p, rfl\u27e9 := Ideal.Quotient.mk_surjective p'\n rw [\u2190 RingHom.comp_apply]\n apply Subring.mem_closure_image_of\n apply Polynomial.mem_closure_X_union_C\n\n/-- If `f : R \u2192 S` descends to an integral map in the localization at `x`,\n and `R` is a Jacobson ring, then the intersection of all maximal ideals in `S` is trivial -/\n```\n\n-- snippet 71\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.RingHom (L671-L674)\nlemma RingHom.FiniteType.isJacobsonRing {A B : Type*} [CommRing A] [CommRing B]\n {f : A \u2192+* B} [IsJacobsonRing A] (H : f.FiniteType) : IsJacobsonRing B :=\n@isJacobsonRing_of_finiteType A B _ _ f.toAlgebra _ H\n```\n\n-- snippet 72\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_smul_top_le (L182-L190)\ntheorem jacobson_smul_top_le : jacobson R \u2022 (\u22a4 : Submodule R M) \u2264 Module.jacobson R M :=\nSubmodule.smul_le.mpr fun _ hr m _ \u21a6 Module.le_comap_jacobson (LinearMap.toSpanSingleton R M m) hr\n\nend Ring\n\nnamespace Submodule\n\nvariable {R M}\n```\n\n-- snippet 73\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_smul_lt_top (L191-L195)\ntheorem jacobson_smul_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] (N : Submodule R M) :\n Ring.jacobson R \u2022 N < \u22a4 :=\n((smul_mono_right _ le_top).trans <| Ring.jacobson_smul_top_le R M).trans_lt\n (Module.jacobson_lt_top R M)\n```\n\n-- snippet 74\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_le (L55-L57)\ntheorem map_jacobson_le : map f (jacobson R M) \u2264 jacobson R\u2082 M\u2082 :=\nmap_le_iff_le_comap.mpr (le_comap_jacobson f)\n```\n\n-- snippet 75\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_localization (L213-L247)\ntheorem isJacobsonRing_localization [H : IsJacobsonRing R] : IsJacobsonRing S := by\nrw [isJacobsonRing_iff_prime_eq]\n refine fun P' hP' => le_antisymm ?_ le_jacobson\n obtain \u27e8hP', hPM\u27e9 := (IsLocalization.isPrime_iff_isPrime_disjoint (powers y) S P').mp hP'\n have hP := H.out hP'.isRadical\n refine (IsLocalization.map_comap (powers y) S P'.jacobson).ge.trans\n ((map_mono ?_).trans (IsLocalization.map_comap (powers y) S P').le)\n have : sInf { I : Ideal R | comap (algebraMap R S) P' \u2264 I \u2227 I.IsMaximal \u2227 y \u2209 I } \u2264\n comap (algebraMap R S) P' := by\n intro x hx\n have hxy : x * y \u2208 (comap (algebraMap R S) P').jacobson := by\n rw [Ideal.jacobson, Ideal.mem_sInf]\n intro J hJ\n by_cases h : y \u2208 J\n \u00b7 exact J.mul_mem_left x h\n \u00b7 exact J.mul_mem_right y ((mem_sInf.1 hx) \u27e8hJ.left, \u27e8hJ.right, h\u27e9\u27e9)\n rw [hP] at hxy\n rcases hP'.mem_or_mem hxy with hxy | hxy\n \u00b7 exact hxy\n \u00b7 exact (hPM.le_bot \u27e8Submonoid.mem_powers _, hxy\u27e9).elim\n refine le_trans ?_ this\n rw [Ideal.jacobson, comap_sInf', sInf_eq_iInf]\n refine iInf_le_iInf_of_subset fun I hI => \u27e8map (algebraMap R S) I, \u27e8?_, ?_\u27e9\u27e9\n \u00b7 exact \u27e8le_trans (le_of_eq (IsLocalization.map_comap (powers y) S P').symm) (map_mono hI.1),\n isMaximal_of_isMaximal_disjoint y _ hI.2.1 hI.2.2\u27e9\n \u00b7 exact IsLocalization.comap_map_of_isPrime_disjoint _ S (IsMaximal.isPrime hI.2.1)\n ((disjoint_powers_iff_notMem y hI.2.1.isPrime.isRadical).2 hI.2.2)\n\nend Localization\n\nnamespace Polynomial\n\nsection CommRing\n\n-- Porting note: move to better place\n```\n\n-- snippet 76\n```lean\n-- Mathlib.RingTheory.Jacobson.Artinian.Module (L25-L34)\nlemma Module.finite_of_isSemisimpleRing [IsJacobsonRing R] [IsSemisimpleRing A] :\n Module.Finite R A :=\nhave (I : MaximalSpectrum A) := finite_of_finite_type_of_isJacobsonRing R (A \u29f8 I.asIdeal)\n .equiv ((IsArtinianRing.equivPi A).restrictScalars R).toLinearEquiv.symm\n\n/-- If `A` is a finite type algebra over `R`, then `A` is an Artinian ring and `R` is Jacobson\nimplies `A` is finite over `R`. -/\n/- If made an instance, causes timeouts synthesizing `FaithfulSMul R I.ResidueField` at\n`Ideal.algebraMap_residueField_eq_zero` and `Ideal.ker_algebraMap_residueField` during\nsimpNF linting. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.RingTheory.Jacobson.Semiprimary.IsSemisimpleRing (L36-L38)\ntheorem IsSemisimpleRing.jacobson_eq_bot [IsSemisimpleRing R] : Ring.jacobson R = \u22a5 :=\nIsSemisimpleModule.jacobson_eq_bot R R\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.RingTheory.Jacobson.Ideal).[/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_jacobson_iff_sInf_maximal :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, IsMaximal J \u2228 J = \u22a4) \u2227 I = sInf M\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson (L65-L67)\ndef jacobson (I : Ideal R) : Ideal R :=\nsInf { J : Ideal R | I \u2264 J \u2227 IsMaximal J }\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.le_jacobson (L68-L69)\ntheorem le_jacobson : I \u2264 jacobson I := fun _ hx => mem_sInf.mpr fun _ hJ => hJ.left hx\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_idem (L71-L73)\ntheorem jacobson_idem : jacobson (jacobson I) = jacobson I :=\nle_antisymm (sInf_le_sInf fun _ hJ => \u27e8sInf_le hJ, hJ.2\u27e9) le_jacobson\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_top (L75-L77)\ntheorem jacobson_top : jacobson (\u22a4 : Ideal R) = \u22a4 :=\neq_top_iff.2 le_jacobson\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_bot (L78-L80)\ntheorem jacobson_bot : jacobson (\u22a5 : Ideal R) = Ring.jacobson R := by\nsimp_rw [jacobson, Ring.jacobson, Module.jacobson, bot_le, true_and, isMaximal_def]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_top_iff (L82-L89)\ntheorem jacobson_eq_top_iff : jacobson I = \u22a4 \u2194 I = \u22a4 :=\n\u27e8fun H =>\n by_contradiction fun hi => let \u27e8M, hm, him\u27e9 := exists_le_maximal I hi\n lt_top_iff_ne_top.1\n (lt_of_le_of_lt (show jacobson I \u2264 M from sInf_le \u27e8him, hm\u27e9) <|\n lt_top_iff_ne_top.2 hm.ne_top) H,\n fun H => eq_top_iff.2 <| le_sInf fun _ \u27e8hij, _\u27e9 => H \u25b8 hij\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_bot (L90-L91)\ntheorem jacobson_eq_bot : jacobson I = \u22a5 \u2192 I = \u22a5 := fun h => eq_bot_iff.mpr (h \u25b8 le_jacobson)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_self_of_isMaximal (L92-L94)\ntheorem jacobson_eq_self_of_isMaximal [H : IsMaximal I] : I.jacobson = I :=\nle_antisymm (sInf_le \u27e8le_of_eq rfl, H\u27e9) le_jacobson\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.mem_jacobson_iff (L99-L120)\ntheorem mem_jacobson_iff {x : R} : x \u2208 jacobson I \u2194 \u2200 y, \u2203 z, z * y * x + z - 1 \u2208 I :=\n\u27e8fun hx y =>\n by_cases\n (fun hxy : I \u2294 span {y * x + 1} = \u22a4 =>\n let \u27e8p, hpi, q, hq, hpq\u27e9 := Submodule.mem_sup.1 ((eq_top_iff_one _).1 hxy)\n let \u27e8r, hr\u27e9 := mem_span_singleton'.1 hq\n \u27e8r, by\n rw [mul_assoc, \u2190 mul_add_one, hr, \u2190 hpq, \u2190 neg_sub, add_sub_cancel_right]\n exact I.neg_mem hpi\u27e9)\n fun hxy : I \u2294 span {y * x + 1} \u2260 \u22a4 => let \u27e8M, hm1, hm2\u27e9 := exists_le_maximal _ hxy\n suffices x \u2209 M from (this <| mem_sInf.1 hx \u27e8le_trans le_sup_left hm2, hm1\u27e9).elim\n fun hxm => hm1.1.1 <| (eq_top_iff_one _).2 <| add_sub_cancel_left (y * x) 1 \u25b8\n M.sub_mem (le_sup_right.trans hm2 <| subset_span rfl) (M.mul_mem_left _ hxm),\n fun hx => mem_sInf.2 fun M \u27e8him, hm\u27e9 => by_contradiction fun hxm =>\n let \u27e8y, i, hi, df\u27e9 := hm.exists_inv hxm\n let \u27e8z, hz\u27e9 := hx (-y)\n hm.1.1 <| (eq_top_iff_one _).2 <| sub_sub_cancel (z * -y * x + z) 1 \u25b8\n M.sub_mem (by\n rw [mul_assoc, \u2190 mul_add_one, neg_mul, \u2190 sub_eq_iff_eq_add.mpr df.symm, neg_sub,\n sub_add_cancel]\n exact M.mul_mem_left _ hi) <| him hz\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_add_sub_mem_of_mem_jacobson (L121-L127)\ntheorem exists_mul_add_sub_mem_of_mem_jacobson {I : Ideal R} (r : R) (h : r \u2208 jacobson I) :\n \u2203 s, s * (r + 1) - 1 \u2208 I := by\nobtain \u27e8s, hs\u27e9 := mem_jacobson_iff.1 h 1\n use s\n rw [mul_add, mul_one]\n simpa using hs\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.exists_mul_sub_mem_of_sub_one_mem_jacobson (L128-L134)\ntheorem exists_mul_sub_mem_of_sub_one_mem_jacobson {I : Ideal R} (r : R) (h : r - 1 \u2208 jacobson I) :\n \u2203 s, s * r - 1 \u2208 I := by\nconvert exists_mul_add_sub_mem_of_mem_jacobson _ h\n simp\n\n/-- An ideal equals its Jacobson radical iff it is the intersection of a set of maximal ideals.\nAllowing the set to include \u22a4 is equivalent, and is included only to simplify some proofs. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal' (L146-L163)\ntheorem eq_jacobson_iff_sInf_maximal' :\n I.jacobson = I \u2194 \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, \u2200 (K : Ideal R), J < K \u2192 K = \u22a4) \u2227 I = sInf M :=\neq_jacobson_iff_sInf_maximal.trans\n \u27e8fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ K hK =>\n Or.recOn (hM.1 J hJ) (fun h => h.1.2 K hK) fun h => eq_top_iff.2 (le_of_lt (h \u25b8 hK)),\n hM.2\u27e9\u27e9,\n fun h =>\n let \u27e8M, hM\u27e9 := h\n \u27e8M,\n \u27e8fun J hJ =>\n Or.recOn (Classical.em (J = \u22a4)) (fun h => Or.inr h) fun h => Or.inl \u27e8\u27e8h, hM.1 J hJ\u27e9\u27e9,\n hM.2\u27e9\u27e9\u27e9\n\n/-- An ideal `I` equals its Jacobson radical if and only if every element outside `I`\nalso lies outside of a maximal ideal containing `I`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_notMem (L164-L176)\ntheorem eq_jacobson_iff_notMem :\n I.jacobson = I \u2194 \u2200 x \u2209 I, \u2203 M : Ideal R, (I \u2264 M \u2227 M.IsMaximal) \u2227 x \u2209 M := by\nconstructor\n \u00b7 intro h x hx\n rw [\u2190 h, Ideal.jacobson, mem_sInf] at hx\n push Not at hx\n exact hx\n \u00b7 refine fun h => le_antisymm (fun x hx => ?_) le_jacobson\n contrapose hx\n rw [Ideal.jacobson, mem_sInf]\n push Not\n exact h x hx\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_surjective (L177-L195)\ntheorem map_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) :\n RingHom.ker f \u2264 I \u2192 map f I.jacobson = (map f I).jacobson := by\nintro h\n unfold Ideal.jacobson\n -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11036): dot notation for `RingHom.ker` does not work\n have : \u2200 J \u2208 { J : Ideal R | I \u2264 J \u2227 J.IsMaximal }, RingHom.ker f \u2264 J :=\n fun J hJ => le_trans h hJ.left\n refine Trans.trans (map_sInf hf this) (le_antisymm ?_ ?_)\n \u00b7 refine\n sInf_le_sInf fun J hJ =>\n \u27e8comap f J, \u27e8\u27e8le_comap_of_map_le hJ.1, ?_\u27e9, map_comap_of_surjective f hf J\u27e9\u27e9\n haveI : J.IsMaximal := hJ.right\n exact comap_isMaximal_of_surjective f hf\n \u00b7 refine sInf_le_sInf_of_subset_insert_top fun j hj => hj.recOn fun J hJ => ?_\n rw [\u2190 hJ.2]\n rcases map_eq_top_or_isMaximal_of_surjective f hf hJ.left.right with htop | hmax\n \u00b7 exact htop.symm \u25b8 Set.mem_insert \u22a4 _\n \u00b7 exact Set.mem_insert_of_mem \u22a4 \u27e8map_mono hJ.1.1, hmax\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.map_jacobson_of_bijective (L196-L200)\ntheorem map_jacobson_of_bijective {f : R \u2192+* S} (hf : Function.Bijective f) :\n map f I.jacobson = (map f I).jacobson :=\nmap_jacobson_of_surjective hf.right\n (le_trans (le_of_eq ((RingHom.injective_iff_ker_eq_bot f).1 hf.left)) bot_le)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson (L201-L204)\ntheorem comap_jacobson {f : R \u2192+* S} {K : Ideal S} :\n comap f K.jacobson = sInf (comap f '' { J : Ideal S | K \u2264 J \u2227 J.IsMaximal }) :=\nTrans.trans (comap_sInf' f _) sInf_eq_iInf.symm\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.comap_jacobson_of_surjective (L205-L223)\ntheorem comap_jacobson_of_surjective {f : R \u2192+* S} (hf : Function.Surjective f) {K : Ideal S} :\n comap f K.jacobson = (comap f K).jacobson := by\nunfold Ideal.jacobson\n refine le_antisymm ?_ ?_\n \u00b7 rw [\u2190 top_inf_eq (sInf _), \u2190 sInf_insert, comap_sInf', sInf_eq_iInf]\n refine iInf_le_iInf_of_subset fun J hJ => ?_\n have : comap f (map f J) = J :=\n Trans.trans (comap_map_of_surjective f hf J)\n (le_antisymm (sup_le_iff.2 \u27e8le_of_eq rfl, le_trans (comap_mono bot_le) hJ.left\u27e9)\n le_sup_left)\n rcases map_eq_top_or_isMaximal_of_surjective _ hf hJ.right with htop | hmax\n \u00b7 exact \u27e8\u22a4, Set.mem_insert \u22a4 _, htop \u25b8 this\u27e9\n \u00b7 exact \u27e8map f J, Set.mem_insert_of_mem _ \u27e8le_map_of_comap_le_of_surjective f hf hJ.1, hmax\u27e9,\n this\u27e9\n \u00b7 simp_rw [comap_sInf, le_iInf_iff]\n intro J hJ\n haveI : J.IsMaximal := hJ.right\n exact sInf_le \u27e8comap_mono hJ.left, comap_isMaximal_of_surjective _ hf\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_mono (L225-L229)\ntheorem jacobson_mono {I J : Ideal R} : I \u2264 J \u2192 I.jacobson \u2264 J.jacobson := by\nintro h x hx\n rw [jacobson, mem_sInf] at hx \u22a2\n exact fun K \u27e8hK, hK_max\u27e9 => hx \u27e8Trans.trans h hK, hK_max\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.ringJacobson_le_jacobson (L230-L233)\ntheorem ringJacobson_le_jacobson {I : Ideal R} : Ring.jacobson R \u2264 I.jacobson :=\njacobson_bot.symm.trans_le (jacobson_mono bot_le)\n\n/-- The Jacobson radical of a two-sided ideal is two-sided. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.radical_le_jacobson (L273-L275)\ntheorem radical_le_jacobson : radical I \u2264 jacobson I :=\nle_sInf fun _ hJ => (radical_eq_sInf I).symm \u25b8 sInf_le \u27e8hJ.left, IsMaximal.isPrime hJ.right\u27e9\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_of_eq_jacobson (L276-L278)\ntheorem isRadical_of_eq_jacobson (h : jacobson I = I) : I.IsRadical :=\nradical_le_jacobson.trans h.le\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isRadical_jacobson (L279-L281)\nlemma isRadical_jacobson (I : Ideal R) : I.jacobson.IsRadical :=\nisRadical_of_eq_jacobson jacobson_idem\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.isUnit_of_sub_one_mem_jacobson_bot (L282-L287)\ntheorem isUnit_of_sub_one_mem_jacobson_bot (r : R) (h : r - 1 \u2208 jacobson (\u22a5 : Ideal R)) :\n IsUnit r := by\nobtain \u27e8s, hs\u27e9 := exists_mul_sub_mem_of_sub_one_mem_jacobson r h\n rw [mem_bot, sub_eq_zero, mul_comm] at hs\n exact .of_mul_eq_one _ hs\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.mem_jacobson_bot (L288-L299)\ntheorem mem_jacobson_bot {x : R} : x \u2208 jacobson (\u22a5 : Ideal R) \u2194 \u2200 y, IsUnit (x * y + 1) :=\n\u27e8fun hx y =>\n let \u27e8z, hz\u27e9 := (mem_jacobson_iff.1 hx) y\n isUnit_iff_exists_inv.2\n \u27e8z, by rwa [add_mul, one_mul, \u2190 sub_eq_zero, mul_right_comm, mul_comm _ z, mul_right_comm]\u27e9,\n fun h =>\n mem_jacobson_iff.mpr fun y =>\n let \u27e8b, hb\u27e9 := isUnit_iff_exists_inv.1 (h y)\n \u27e8b, (Submodule.mem_bot R).2 (hb \u25b8 by ring)\u27e9\u27e9\n\n/-- An ideal `I` of `R` is equal to its Jacobson radical if and only if\nthe Jacobson radical of the quotient ring `R/I` is the zero ideal -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Jacobson.Ideal.jacobson_eq_iff_jacobson_quotient_eq_bot (L300-L314)\ntheorem jacobson_eq_iff_jacobson_quotient_eq_bot :\n I.jacobson = I \u2194 jacobson (\u22a5 : Ideal (R \u29f8 I)) = \u22a5 := by\nhave hf : Function.Surjective (Ideal.Quotient.mk I) := Submodule.Quotient.mk_surjective I\n constructor\n \u00b7 intro h\n replace h := congr_arg (Ideal.map (Ideal.Quotient.mk I)) h\n rw [map_jacobson_of_surjective hf (le_of_eq mk_ker)] at h\n simpa using h\n \u00b7 intro h\n replace h := congr_arg (comap (Ideal.Quotient.mk I)) h\n rw [comap_jacobson_of_surjective hf, \u2190 RingHom.ker_eq_comap_bot (Ideal.Quotient.mk I)] at h\n simpa using h\n\n/-- The standard radical and Jacobson radical of an ideal `I` of `R` are equal if and only if\nthe nilradical and Jacobson radical of the quotient ring `R/I` coincide -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_le_of_isMaximal (L139-L142)\nlemma jacobson_le_of_isMaximal (m : Ideal R) [m.IsMaximal] : jacobson R \u2264 m := by\nrw [Ring.jacobson_eq_sInf_isMaximal]\n exact sInf_le \u2039_\u203a\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.Ideal (L95-L98)\ntheorem Ideal.radical_eq_jacobson [H : IsJacobsonRing R] (I : Ideal R) : I.radical = I.jacobson :=\nle_antisymm (le_sInf fun _J \u27e8hJ, hJ_max\u27e9 => (IsPrime.radical_le_iff hJ_max.isPrime).mpr hJ)\n (H.out (radical_isRadical I) \u25b8 jacobson_mono le_radical)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.jacobson_bot_of_integral_localization (L320-L385)\ntheorem jacobson_bot_of_integral_localization\n {R : Type*} [CommRing R] [IsDomain R] [IsJacobsonRing R]\n (R\u2098 S\u2098 : Type*) [CommRing R\u2098] [CommRing S\u2098] (\u03c6 : R \u2192+* S) (h\u03c6 : Function.Injective \u2191\u03c6) (x : R)\n (hx : x \u2260 0) [Algebra R R\u2098] [IsLocalization.Away x R\u2098] [Algebra S S\u2098]\n [IsLocalization ((Submonoid.powers x).map \u03c6 : Submonoid S) S\u2098]\n (h\u03c6' :\n RingHom.IsIntegral (IsLocalization.map S\u2098 \u03c6 (Submonoid.powers x).le_comap_map : R\u2098 \u2192+* S\u2098)) :\n (\u22a5 : Ideal S).jacobson = (\u22a5 : Ideal S) := by\nhave hM : ((Submonoid.powers x).map \u03c6 : Submonoid S) \u2264 nonZeroDivisors S :=\n map_le_nonZeroDivisors_of_injective \u03c6 h\u03c6 (powers_le_nonZeroDivisors_of_noZeroDivisors hx)\n letI : IsDomain S\u2098 := IsLocalization.isDomain_of_le_nonZeroDivisors _ hM\n let \u03c6' : R\u2098 \u2192+* S\u2098 := IsLocalization.map _ \u03c6 (Submonoid.powers x).le_comap_map\n suffices \u2200 I : Ideal S\u2098, I.IsMaximal \u2192 (I.comap (algebraMap S S\u2098)).IsMaximal by\n have h\u03d5' : comap (algebraMap S S\u2098) (\u22a5 : Ideal S\u2098) = (\u22a5 : Ideal S) := by\n rw [\u2190 RingHom.ker_eq_comap_bot, \u2190 RingHom.injective_iff_ker_eq_bot]\n exact IsLocalization.injective S\u2098 hM\n have hR\u2098 : IsJacobsonRing R\u2098 := isJacobsonRing_localization x\n have hS\u2098 : IsJacobsonRing S\u2098 := isJacobsonRing_of_isIntegral' \u03c6' h\u03c6'\n refine eq_bot_iff.mpr (le_trans ?_ (le_of_eq h\u03d5'))\n rw [\u2190 hS\u2098.out isRadical_bot_of_noZeroDivisors, comap_jacobson]\n exact sInf_le_sInf fun j hj => \u27e8bot_le,\n let \u27e8J, hJ\u27e9 := hj\n hJ.2 \u25b8 this J hJ.1.2\u27e9\n intro I hI\n -- Remainder of the proof is pulling and pushing ideals around the square and the quotient square\n have : (I.comap (algebraMap S S\u2098)).IsPrime := comap_isPrime _ I\n have : (I.comap \u03c6').IsPrime := comap_isPrime \u03c6' I\n have : (\u22a5 : Ideal (S \u29f8 I.comap (algebraMap S S\u2098))).IsPrime := isPrime_bot\n have hcomm : \u03c6'.comp (algebraMap R R\u2098) = (algebraMap S S\u2098).comp \u03c6 := IsLocalization.map_comp _\n let f := quotientMap (I.comap (algebraMap S S\u2098)) \u03c6 le_rfl\n let g := quotientMap I (algebraMap S S\u2098) le_rfl\n have := isMaximal_comap_of_isIntegral_of_isMaximal' \u03c6' h\u03c6' I\n have := ((IsLocalization.isMaximal_iff_isMaximal_disjoint R\u2098 x _).1 this).left\n have : ((I.comap (algebraMap S S\u2098)).comap \u03c6).IsMaximal := by\n rwa [comap_comap, hcomm, \u2190 comap_comap] at this\n rw [\u2190 bot_quotient_isMaximal_iff] at this \u22a2\n refine isMaximal_of_isIntegral_of_isMaximal_comap' f ?_ \u22a5\n ((eq_bot_iff.2 (comap_bot_le_of_injective f quotientMap_injective)).symm \u25b8 this)\n exact RingHom.IsIntegral.tower_bot f g quotientMap_injective\n ((comp_quotientMap_eq_of_comp_eq hcomm I).symm \u25b8\n (RingHom.isIntegral_of_surjective _\n (IsLocalization.surjective_quotientMap_of_maximal_of_localization (Submonoid.powers x) R\u2098\n (by rwa [comap_comap, hcomm, \u2190 bot_quotient_isMaximal_iff]))).trans _ _ (h\u03c6'.quotient _))\n\n/-- Used to bootstrap the proof of `isJacobsonRing_polynomial_iff_isJacobsonRing`.\n That theorem is more general and should be used instead of this one. -/\nprivate theorem isJacobsonRing_polynomial_of_domain (R : Type*) [CommRing R] [IsDomain R]\n [hR : IsJacobsonRing R] (P : Ideal R[X]) [IsPrime P] (hP : \u2200 x : R, C x \u2208 P \u2192 x = 0) :\n P.jacobson = P := by\n by_cases Pb : P = \u22a5\n \u00b7 exact Pb.symm \u25b8\n jacobson_bot_polynomial_of_jacobson_bot (hR.out isRadical_bot_of_noZeroDivisors)\n \u00b7 rw [jacobson_eq_iff_jacobson_quotient_eq_bot]\n let P' := P.comap (C : R \u2192+* R[X])\n have : P'.IsPrime := comap_isPrime C P\n have hR' : IsJacobsonRing (R \u29f8 P') := by infer_instance\n obtain \u27e8p, pP, p0\u27e9 := exists_nonzero_mem_of_ne_bot Pb hP\n let x := (Polynomial.map (Ideal.Quotient.mk P') p).leadingCoeff\n have hx : x \u2260 0 := by rwa [Ne, leadingCoeff_eq_zero]\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := Ideal.quotientMap P (C : R \u2192+* R[X]) le_rfl\n let h\u03c6 : Function.Injective \u2191\u03c6 := quotientMap_injective\n let R\u2098 := Localization.Away x\n let S\u2098 := (Localization ((Submonoid.powers x).map \u03c6 : Submonoid (R[X] \u29f8 P)))\n refine jacobson_bot_of_integral_localization (S := R[X] \u29f8 P) (R := R \u29f8 P') R\u2098 S\u2098 _ h\u03c6 _ hx ?_\n exact isIntegral_isLocalization_polynomial_quotient P p pP\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_polynomial_of_isJacobsonRing (L386-L413)\ntheorem isJacobsonRing_polynomial_of_isJacobsonRing (hR : IsJacobsonRing R) :\n IsJacobsonRing R[X] := by\nrw [isJacobsonRing_iff_prime_eq]\n intro I hI\n let R' : Subring (R[X] \u29f8 I) := ((Ideal.Quotient.mk I).comp C).range\n let i : R \u2192+* R' := ((Ideal.Quotient.mk I).comp C).rangeRestrict\n have hi : Function.Surjective \u2191i := ((Ideal.Quotient.mk I).comp C).rangeRestrict_surjective\n have hi' : RingHom.ker (mapRingHom i) \u2264 I := by\n intro f hf\n apply polynomial_mem_ideal_of_coeff_mem_ideal I f\n intro n\n replace hf := congrArg (fun g : Polynomial ((Ideal.Quotient.mk I).comp C).range => g.coeff n) hf\n change (Polynomial.map ((Ideal.Quotient.mk I).comp C).rangeRestrict f).coeff n = 0 at hf\n rw [coeff_map, Subtype.ext_iff] at hf\n rwa [mem_comap, \u2190 Quotient.eq_zero_iff_mem, \u2190 RingHom.comp_apply]\n have R'_jacob : IsJacobsonRing R' := isJacobsonRing_of_surjective \u27e8i, hi\u27e9\n let J := I.map (mapRingHom i)\n have h_surj : Function.Surjective (mapRingHom i) := Polynomial.map_surjective i hi\n have : IsPrime J := map_isPrime_of_surjective h_surj hi'\n suffices h : J.jacobson = J by\n replace h := congrArg (comap (Polynomial.mapRingHom i)) h\n rw [\u2190 map_jacobson_of_surjective h_surj hi', comap_map_of_surjective _ h_surj,\n comap_map_of_surjective _ h_surj] at h\n refine le_antisymm ?_ le_jacobson\n exact le_trans (le_sup_of_le_left le_rfl) (le_trans (le_of_eq h) (sup_le le_rfl hi'))\n apply isJacobsonRing_polynomial_of_domain R' J\n exact eq_zero_of_polynomial_mem_map_range I\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_le (L108-L114)\ntheorem jacobson_pi_le : jacobson R (\u03a0 i, M i) \u2264 Submodule.pi Set.univ (jacobson R <| M \u00b7) := by\nsimp_rw [\u2190 iInf_comap_proj, jacobson, sInf_eq_iInf', comap_iInf, le_iInf_iff]\n intro i m\n exact iInf_le_of_le \u27e8_, (isCoatom_comap_iff <| LinearMap.proj_surjective i).mpr m.2\u27e9 le_rfl\n\n/-- A product of modules with trivial Jacobson radical (e.g. simple modules) also has trivial\nJacobson radical. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.IsJacobsonRing (L64-L69)\ntheorem IsJacobsonRing.out {R} [CommRing R] :\n IsJacobsonRing R \u2192 \u2200 {I : Ideal R}, I.IsRadical \u2192 I.jacobson = I :=\nisJacobsonRing_iff.1\n\n/-- A ring is a Jacobson ring if and only if for all prime ideals `P`,\nthe Jacobson radical of `P` is equal to `P`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.FG (L196-L204)\ntheorem FG.jacobson_smul_lt {N : Submodule R M} (ne_bot : N \u2260 \u22a5) (fg : N.FG) :\n Ring.jacobson R \u2022 N < N := by\nrw [\u2190 Module.Finite.iff_fg] at fg\n rw [\u2190 nontrivial_iff_ne_bot] at ne_bot\n convert map_strictMono_of_injective N.injective_subtype (jacobson_smul_lt_top \u22a4)\n on_goal 1 => rw [map_smul'']\n all_goals rw [Submodule.map_top, range_subtype]\n\n/-- A form of Nakayama's lemma for modules over noncommutative rings. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff_sInf_maximal (L84-L89)\ntheorem isJacobsonRing_iff_sInf_maximal : IsJacobsonRing R \u2194 \u2200 {I : Ideal R}, I.IsPrime \u2192\n \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, IsMaximal J \u2228 J = \u22a4) \u2227 I = sInf M :=\n\u27e8fun H _I h => eq_jacobson_iff_sInf_maximal.1 (H.out h.isRadical), fun H =>\n isJacobsonRing_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal.2 (H hP)\u27e9\n\n/-- A variant of `isJacobsonRing_iff_sInf_maximal` with a different spelling of \"maximal or `\u22a4`\". -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_surjective (L102-L112)\ntheorem isJacobsonRing_of_surjective [H : IsJacobsonRing R] :\n (\u2203 f : R \u2192+* S, Function.Surjective \u2191f) \u2192 IsJacobsonRing S := by\nrintro \u27e8f, hf\u27e9\n rw [isJacobsonRing_iff_sInf_maximal]\n intro p hp\n use map f '' { J : Ideal R | comap f p \u2264 J \u2227 J.IsMaximal }\n use fun j \u27e8J, hJ, hmap\u27e9 => hmap \u25b8 (map_eq_top_or_isMaximal_of_surjective f hf hJ.right).symm\n have : p = map f (comap f p).jacobson :=\n (IsJacobsonRing.out' _ <| hp.isRadical.comap f).symm \u25b8 (map_comap_of_surjective f hf p).symm\n exact this.trans (map_sInf hf fun J \u27e8hJ, _\u27e9 => le_trans (Ideal.ker_le_comap f) hJ)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_bijective (L78-L81)\ntheorem map_jacobson_of_bijective (hf : Function.Bijective f) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nmap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.comp_C_integral_of_surjective_of_isJacobsonRing (L544-L555)\ntheorem comp_C_integral_of_surjective_of_isJacobsonRing {S : Type*} [Field S] (f : R[X] \u2192+* S)\n (hf : Function.Surjective \u2191f) : (f.comp C).IsIntegral := by\nhave : (RingHom.ker f).IsMaximal := RingHom.ker_isMaximal_of_surjective f hf\n let g : R[X] \u29f8 (RingHom.ker f) \u2192+* S := Ideal.Quotient.lift (RingHom.ker f) f fun _ h => h\n have hfg : g.comp (Ideal.Quotient.mk (RingHom.ker f)) = f := ringHom_ext' rfl rfl\n rw [\u2190 hfg, RingHom.comp_assoc]\n refine (quotient_mk_comp_C_isIntegral_of_isJacobsonRing (RingHom.ker f)).trans _ g\n (g.isIntegral_of_surjective ?_)\n rw [\u2190 hfg] at hf\n norm_num at hf\n exact Function.Surjective.of_comp hf\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_le_of_eq_bot (L90-L95)\ntheorem jacobson_le_of_eq_bot {N : Submodule R M} (h : jacobson R (M \u29f8 N) = \u22a5) :\n jacobson R M \u2264 N := by\nsimp_rw [\u2190 N.ker_mkQ, \u2190 comap_bot, \u2190 h, le_comap_jacobson]\n\nvariable (R M)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.coe_jacobson_quotient (L155-L161)\ntheorem coe_jacobson_quotient (I : Ideal R) [I.IsTwoSided] :\n (jacobson (R \u29f8 I) : Set (R \u29f8 I)) = Module.jacobson R (R \u29f8 I) := by\nlet f : R \u29f8 I \u2192\u209b\u2097[Ideal.Quotient.mk I] R \u29f8 I := \u27e8AddHom.id _, fun _ _ \u21a6 rfl\u27e9\n rw [jacobson, \u2190 Module.map_jacobson_of_ker_le (f := f) Function.surjective_id]\n \u00b7 apply Set.image_id\n \u00b7 rintro _ rfl; exact zero_mem _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_eq_bot_of_injective (L58-L64)\ntheorem jacobson_eq_bot_of_injective (inj : Function.Injective f) (h : jacobson R\u2082 M\u2082 = \u22a5) :\n jacobson R M = \u22a5 :=\nle_bot_iff.mp <| (le_comap_jacobson f).trans <| by\n simp_rw [h, comap_bot, (LinearMap.ker_eq_bot.mpr inj).le]\n\nvariable {f}\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Jacobson.Semiprimary.IsSimpleModule (L26-L28)\ntheorem IsSimpleModule.jacobson_eq_bot [IsSimpleModule R M] : Module.jacobson R M = \u22a5 :=\nle_bot_iff.mp <| sInf_le isCoatom_bot\n```\n\n-- snippet 41\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff (L60-L63)\ntheorem isJacobsonRing_iff {R} [CommRing R] :\n IsJacobsonRing R \u2194 \u2200 I : Ideal R, I.IsRadical \u2192 I.jacobson = I :=\n\u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n```\n\n-- snippet 42\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_isIntegral' (L142-L161)\ntheorem isJacobsonRing_of_isIntegral' (f : R \u2192+* S) (hf : f.IsIntegral) [IsJacobsonRing R] :\n IsJacobsonRing S :=\nlet _ : Algebra R S := f.toAlgebra\n have : Algebra.IsIntegral R S := \u27e8hf\u27e9\n isJacobsonRing_of_isIntegral (R := R)\n\nend IsJacobsonRing\n\nsection Localization\n\nopen IsLocalization Submonoid\n\nvariable {R S : Type*} [CommRing R] [CommRing S]\nvariable (y : R) [Algebra R S] [IsLocalization.Away y S]\n\nvariable (S) in\n/-- If `R` is a Jacobson ring, then maximal ideals in the localization at `y`\ncorrespond to maximal ideals in the original ring `R` that don't contain `y`.\nThis lemma gives the correspondence in the particular case of an ideal and its comap.\nSee `le_relIso_of_maximal` for the more general relation isomorphism -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_bijective (L82-L85)\ntheorem comap_jacobson_of_bijective (hf : Function.Bijective f) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M :=\ncomap_jacobson_of_ker_le hf.2 <| by simp_rw [LinearMap.ker_eq_bot.mpr hf.1, bot_le]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.RingTheory.Jacobson.Polynomial.jacobson_bot_polynomial_le_sInf_map_maximal (L25-L38)\ntheorem jacobson_bot_polynomial_le_sInf_map_maximal :\n jacobson (\u22a5 : Ideal R[X]) \u2264 sInf (map (C : R \u2192+* R[X]) '' { J : Ideal R | J.IsMaximal }) := by\nrefine le_sInf fun J => exists_imp.2 fun j hj => ?_\n haveI : j.IsMaximal := hj.1\n refine Trans.trans (jacobson_mono bot_le) (le_of_eq ?_ : J.jacobson \u2264 J)\n suffices t : (\u22a5 : Ideal (Polynomial (R \u29f8 j))).jacobson = \u22a5 by\n rw [\u2190 hj.2, jacobson_eq_iff_jacobson_quotient_eq_bot]\n replace t := congr_arg (map (polynomialQuotientEquivQuotientPolynomial j).toRingHom) t\n rwa [map_jacobson_of_bijective _, map_bot] at t\n exact RingEquiv.bijective (polynomialQuotientEquivQuotientPolynomial j)\n refine eq_bot_iff.2 fun f hf => ?_\n have r1 : (X : (R \u29f8 j)[X]) \u2260 0 := ne_of_apply_ne (coeff \u00b7 1) <| by simp\n simpa [r1] using eq_C_of_degree_eq_zero (degree_eq_zero_of_isUnit ((mem_jacobson_bot.1 hf) X))\n```\n\n-- snippet 45\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isMaximal_comap_C_of_isMaximal (L430-L513)\ntheorem isMaximal_comap_C_of_isMaximal [IsJacobsonRing R] [Nontrivial R]\n (hP' : \u2200 x : R, C x \u2208 P \u2192 x = 0) :\n IsMaximal (comap (C : R \u2192+* R[X]) P : Ideal R) := by\nlet P' := comap (C : R \u2192+* R[X]) P\n have hP'_prime : P'.IsPrime := comap_isPrime C P\n obtain \u27e8\u27e8m, hmem_P\u27e9, hm\u27e9 :=\n Submodule.nonzero_mem_of_bot_lt (bot_lt_of_maximal P polynomial_not_isField)\n have hm' : m \u2260 0 := by\n simpa [Submodule.coe_eq_zero] using hm\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := quotientMap P (C : R \u2192+* R[X]) le_rfl\n let a : R \u29f8 P' := (m.map (Ideal.Quotient.mk P')).leadingCoeff\n let M : Submonoid (R \u29f8 P') := Submonoid.powers a\n rw [\u2190 bot_quotient_isMaximal_iff]\n have hp0 : a \u2260 0 := fun hp0' =>\n hm' <| map_injective (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X]) : Ideal R))\n ((injective_iff_map_eq_zero (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X]) : Ideal R))).2\n fun x hx => by\n rwa [Quotient.eq_zero_iff_mem, (by rwa [eq_bot_iff] : (P.comap C : Ideal R) = \u22a5)] at hx)\n (by simpa only [a, leadingCoeff_eq_zero, Polynomial.map_zero] using hp0')\n have hM : (0 : R \u29f8 P') \u2209 M := fun \u27e8n, hn\u27e9 => hp0 (eq_zero_of_pow_eq_zero hn)\n suffices (\u22a5 : Ideal (Localization M)).IsMaximal by\n rw [\u2190 IsLocalization.comap_map_of_isPrime_disjoint M (Localization M) isPrime_bot\n (disjoint_iff_inf_le.mpr fun x hx => hM (hx.2 \u25b8 hx.1))]\n exact ((IsLocalization.isMaximal_iff_isMaximal_disjoint (Localization M) a _).mp\n (by rwa [Ideal.map_bot])).1\n let M' : Submonoid (R[X] \u29f8 P) := M.map \u03c6\n have hM' : (0 : R[X] \u29f8 P) \u2209 M' := fun \u27e8z, hz\u27e9 =>\n hM (quotientMap_injective (_root_.trans hz.2 \u03c6.map_zero.symm) \u25b8 hz.1)\n suffices (\u22a5 : Ideal (Localization M')).IsMaximal by\n rw [le_antisymm bot_le (comap_bot_le_of_injective _\n (IsLocalization.map_injective_of_injective M (Localization M) (Localization M')\n quotientMap_injective))]\n refine isMaximal_comap_of_isIntegral_of_isMaximal' _ ?_ \u22a5\n have isloc : IsLocalization (Submonoid.map \u03c6 M) (Localization M') := by infer_instance\n exact @isIntegral_isLocalization_polynomial_quotient R _\n (Localization M) (Localization M') _ _ P m hmem_P _ _ _ isloc\n rw [(map_bot.symm :\n (\u22a5 : Ideal (Localization M')) = Ideal.map (algebraMap (R[X] \u29f8 P) (Localization M')) \u22a5)]\n let bot_maximal := (bot_quotient_isMaximal_iff _).mpr hP\n refine bot_maximal.map_bijective (algebraMap (R[X] \u29f8 P) (Localization M')) ?_\n apply IsField.localization_map_bijective hM'\n rwa [\u2190 Quotient.maximal_ideal_iff_isField_quotient, \u2190 bot_quotient_isMaximal_iff]\n\n/-- Used to bootstrap the more general `quotient_mk_comp_C_isIntegral_of_jacobson` -/\nprivate theorem quotient_mk_comp_C_isIntegral_of_jacobson' [Nontrivial R] (hR : IsJacobsonRing R)\n (hP' : \u2200 x : R, C x \u2208 P \u2192 x = 0) :\n ((Ideal.Quotient.mk P).comp C : R \u2192+* R[X] \u29f8 P).IsIntegral := by\n refine (isIntegral_quotientMap_iff _).mp ?_\n let P' : Ideal R := P.comap C\n obtain \u27e8pX, hpX, hp0\u27e9 :=\n exists_nonzero_mem_of_ne_bot (ne_of_lt (bot_lt_of_maximal P polynomial_not_isField)).symm hP'\n let a : R \u29f8 P' := (pX.map (Ideal.Quotient.mk P')).leadingCoeff\n let M : Submonoid (R \u29f8 P') := Submonoid.powers a\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := quotientMap P C le_rfl\n have hP'_prime : P'.IsPrime := comap_isPrime C P\n have hM : (0 : R \u29f8 P') \u2209 M := fun \u27e8n, hn\u27e9 =>\n hp0 <| leadingCoeff_eq_zero.mp (eq_zero_of_pow_eq_zero hn)\n let M' : Submonoid (R[X] \u29f8 P) := M.map \u03c6\n refine RingHom.IsIntegral.tower_bot \u03c6 (algebraMap _ (Localization M')) ?_ ?_\n \u00b7 refine IsLocalization.injective (Localization M')\n (show M' \u2264 _ from le_nonZeroDivisors_of_noZeroDivisors fun hM' => hM ?_)\n exact\n let \u27e8z, zM, z0\u27e9 := hM'\n quotientMap_injective (_root_.trans z0 \u03c6.map_zero.symm) \u25b8 zM\n \u00b7 suffices RingHom.comp (algebraMap (R[X] \u29f8 P) (Localization M')) \u03c6 =\n (IsLocalization.map (Localization M') \u03c6 M.le_comap_map).comp\n (algebraMap (R \u29f8 P') (Localization M)) by\n rw [this]\n refine RingHom.IsIntegral.trans (algebraMap (R \u29f8 P') (Localization M))\n (IsLocalization.map (Localization M') \u03c6 M.le_comap_map) ?_ ?_\n \u00b7 exact (algebraMap (R \u29f8 P') (Localization M)).isIntegral_of_surjective\n (IsField.localization_map_bijective hM ((Quotient.maximal_ideal_iff_isField_quotient _).mp\n (isMaximal_comap_C_of_isMaximal P hP'))).2\n \u00b7 -- `convert` here is faster than `exact`, and this proof is near the time limit.\n -- convert isIntegral_isLocalization_polynomial_quotient P pX hpX\n have isloc : IsLocalization M' (Localization M') := by infer_instance\n exact @isIntegral_isLocalization_polynomial_quotient R _\n (Localization M) (Localization M') _ _ P pX hpX _ _ _ isloc\n rw [IsLocalization.map_comp M.le_comap_map]\n\nvariable [IsJacobsonRing R]\n\n/-- If `R` is a Jacobson ring, and `P` is a maximal ideal of `R[X]`,\n then `R \u2192 R[X]/P` is an integral map. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.RingTheory.Jacobson.Polynomial.jacobson_bot_polynomial_of_jacobson_bot (L39-L49)\ntheorem jacobson_bot_polynomial_of_jacobson_bot (h : jacobson (\u22a5 : Ideal R) = \u22a5) :\n jacobson (\u22a5 : Ideal R[X]) = \u22a5 := by\nrefine eq_bot_iff.2 (le_trans jacobson_bot_polynomial_le_sInf_map_maximal ?_)\n refine fun f hf => (Submodule.mem_bot R[X]).2 <| Polynomial.ext fun n =>\n Trans.trans (?_ : coeff f n = 0) (coeff_zero n).symm\n suffices f.coeff n \u2208 Ideal.jacobson \u22a5 by rwa [h, Submodule.mem_bot] at this\n exact mem_sInf.2 fun j hj => (mem_map_C_iff.1 ((mem_sInf.1 hf) \u27e8j, \u27e8hj.2, rfl\u27e9\u27e9)) n\n\nend Polynomial\n\nend Ideal\n```\n\n-- snippet 47\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_finiteType (L666-L670)\nlemma isJacobsonRing_of_finiteType {A B : Type*} [CommRing A] [CommRing B]\n [Algebra A B] [IsJacobsonRing A] [Algebra.FiniteType A B] : IsJacobsonRing B := by\nobtain \u27e8\u03b9, h\u03b9, f, hf\u27e9 := Algebra.FiniteType.iff_quotient_mvPolynomial'.mp \u2039_\u203a\n exact isJacobsonRing_of_surjective \u27e8f.toRingHom, hf\u27e9\n```\n\n-- snippet 48\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_eq_sInf_isMaximal (L131-L133)\ntheorem jacobson_eq_sInf_isMaximal : jacobson R = sInf {I : Ideal R | I.IsMaximal} := by\nsimp_rw [jacobson, Module.jacobson, Ideal.isMaximal_def]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_jacobson (L97-L99)\ntheorem jacobson_quotient_jacobson : jacobson R (M \u29f8 jacobson R M) = \u22a5 := by\nrw [jacobson_quotient_of_le le_rfl, mkQ_map_self]\n```\n\n-- snippet 50\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_of_ker_le (L65-L72)\ntheorem map_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n map f (jacobson R M) = jacobson R\u2082 M\u2082 :=\nle_antisymm (map_jacobson_le f) <| by\n rw [jacobson, sInf_eq_iInf'] at le\n conv_rhs => rw [jacobson, sInf_eq_iInf', map_iInf_of_ker_le surj le]\n exact le_iInf fun m \u21a6 sInf_le (isCoatom_map_of_ker_le surj (le_iInf_iff.mp le m) m.2)\n```\n\n-- snippet 51\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.le_comap_jacobson (L48-L54)\ntheorem le_comap_jacobson : jacobson R M \u2264 comap f (jacobson R\u2082 M\u2082) := by\nconv_rhs => rw [jacobson, sInf_eq_iInf', comap_iInf]\n refine le_iInf_iff.mpr fun S m hm \u21a6 ?_\n obtain h | h := isCoatom_comap_or_eq_top f S.2\n \u00b7 exact mem_sInf.mp hm _ h\n \u00b7 simpa only [h] using mem_top\n```\n\n-- snippet 52\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_lt_top (L100-L103)\ntheorem jacobson_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] : jacobson R M < \u22a4 := by\nobtain \u27e8m, hm, -\u27e9 := (eq_top_or_exists_le_coatom (\u22a5 : Submodule R M)).resolve_left bot_ne_top\n exact (sInf_le <| Set.mem_setOf.mpr hm).trans_lt hm.1.lt_top\n```\n\n-- snippet 53\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.finite_of_finite_type_of_isJacobsonRing (L676-L690)\nlemma finite_of_finite_type_of_isJacobsonRing (R S : Type*) [CommRing R] [Field S]\n [Algebra R S] [IsJacobsonRing R] [Algebra.FiniteType R S] :\n Module.Finite R S := by\nobtain \u27e8\u03b9, h\u03b9, f, hf\u27e9 := Algebra.FiniteType.iff_quotient_mvPolynomial'.mp \u2039_\u203a\n have : (algebraMap R S).IsIntegral := by\n rw [\u2190 f.comp_algebraMap]\n -- We need to write `f.toRingHom` instead of just `f`, to avoid unification issues.\n exact MvPolynomial.comp_C_integral_of_surjective_of_isJacobsonRing f.toRingHom hf\n have : Algebra.IsIntegral R S := Algebra.isIntegral_def.mpr this\n exact Algebra.IsIntegral.finite\n\n/--\nIf `f : R \u2192+* S` is a ring homomorphism from a Jacobson ring to a field,\nthen it is finite if and only if it is finite type.\n-/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.RingTheory.Jacobson.Semiprimary.IsSemisimpleModule (L29-L35)\ntheorem IsSemisimpleModule.jacobson_eq_bot [IsSemisimpleModule R M] :\n Module.jacobson R M = \u22a5 :=\nhave \u27e8s, e, simple\u27e9 := isSemisimpleModule_iff_exists_linearEquiv_dfinsupp.mp \u2039_\u203a\n let f : M \u2192\u2097[R] \u2200 m : s, m.1 := (LinearMap.pi DFinsupp.lapply).comp e.toLinearMap\n Module.jacobson_eq_bot_of_injective f (DFinsupp.injective_pi_lapply (R := R).comp e.injective)\n (Module.jacobson_pi_eq_bot _ _ fun i \u21a6 IsSimpleModule.jacobson_eq_bot R _)\n```\n\n-- snippet 55\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_polynomial_iff_isJacobsonRing (L414-L419)\ntheorem isJacobsonRing_polynomial_iff_isJacobsonRing : IsJacobsonRing R[X] \u2194 IsJacobsonRing R := by\nrefine \u27e8?_, isJacobsonRing_polynomial_of_isJacobsonRing\u27e9\n intro H\n exact isJacobsonRing_of_surjective \u27e8eval\u2082RingHom (RingHom.id _) 1, fun x =>\n \u27e8C x, by simp only [coe_eval\u2082RingHom, RingHom.id_apply, eval\u2082_C]\u27e9\u27e9\n```\n\n-- snippet 56\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.IsLocalization (L162-L188)\ntheorem IsLocalization.isMaximal_iff_isMaximal_disjoint [H : IsJacobsonRing R] (J : Ideal S) :\n J.IsMaximal \u2194 (comap (algebraMap R S) J).IsMaximal \u2227 y \u2209 Ideal.comap (algebraMap R S) J := by\nconstructor\n \u00b7 refine fun h => \u27e8?_, fun hy =>\n h.ne_top (Ideal.eq_top_of_isUnit_mem _ hy (map_units _ \u27e8y, Submonoid.mem_powers _\u27e9))\u27e9\n have hJ : J.IsPrime := IsMaximal.isPrime h\n rw [isPrime_iff_isPrime_disjoint (Submonoid.powers y)] at hJ\n have : y \u2209 (comap (algebraMap R S) J).1 := Set.disjoint_left.1 hJ.right (Submonoid.mem_powers _)\n rw [\u2190 H.out hJ.left.isRadical, jacobson, Submodule.mem_toAddSubmonoid, Ideal.mem_sInf] at this\n push Not at this\n rcases this with \u27e8I, hI, hI'\u27e9\n convert hI.right\n by_cases hJ : J = I.map (algebraMap R S)\n \u00b7 rw [hJ, comap_map_of_isPrime_disjoint (powers y) S (IsMaximal.isPrime hI.right)]\n rwa [disjoint_powers_iff_notMem y hI.right.isPrime.isRadical]\n \u00b7 have hI_p : (I.map (algebraMap R S)).IsPrime := by\n refine isPrime_of_isPrime_disjoint (powers y) _ I hI.right.isPrime ?_\n rwa [disjoint_powers_iff_notMem y hI.right.isPrime.isRadical]\n have : J \u2264 I.map (algebraMap R S) := map_comap (Submonoid.powers y) S J \u25b8 map_mono hI.left\n exact absurd (h.1.2 _ (lt_of_le_of_ne this hJ)) hI_p.1\n \u00b7 simp only [Ideal.mem_comap, and_imp]\n exact (fun _ _ \u21a6 IsMaximal.of_isLocalization_of_disjoint (powers y))\n\n/-- If `R` is a Jacobson ring, then maximal ideals in the localization at `y`\ncorrespond to maximal ideals in the original ring `R` that don't contain `y`.\nThis lemma gives the correspondence in the particular case of an ideal and its map.\nSee `le_relIso_of_maximal` for the more general statement, and the reverse of this implication -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff_prime_eq (L70-L83)\ntheorem isJacobsonRing_iff_prime_eq :\n IsJacobsonRing R \u2194 \u2200 P : Ideal R, IsPrime P \u2192 P.jacobson = P := by\nrefine isJacobsonRing_iff.trans \u27e8fun h I hI => h I hI.isRadical, ?_\u27e9\n refine fun h I hI \u21a6 le_antisymm (fun x hx \u21a6 ?_) (fun x hx \u21a6 mem_sInf.mpr fun _ hJ \u21a6 hJ.left hx)\n rw [\u2190 hI.radical, radical_eq_sInf I, mem_sInf]\n intro P hP\n rw [Set.mem_setOf_eq] at hP\n rw [jacobson, mem_sInf] at hx\n rw [\u2190 h P hP.right, jacobson, mem_sInf]\n exact fun J hJ => hx \u27e8le_trans hP.left hJ.left, hJ.right\u27e9\n\n/-- A ring `R` is Jacobson if and only if for every prime ideal `I`,\n`I` can be written as the infimum of some collection of maximal ideals.\nAllowing \u22a4 in the set `M` of maximal ideals is equivalent, but makes some proofs cleaner. -/\n```\n\n-- snippet 58\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iff_sInf_maximal' (L90-L94)\ntheorem isJacobsonRing_iff_sInf_maximal' : IsJacobsonRing R \u2194 \u2200 {I : Ideal R}, I.IsPrime \u2192\n \u2203 M : Set (Ideal R), (\u2200 J \u2208 M, \u2200 (K : Ideal R), J < K \u2192 K = \u22a4) \u2227 I = sInf M :=\n\u27e8fun H _I h => eq_jacobson_iff_sInf_maximal'.1 (H.out h.isRadical), fun H =>\n isJacobsonRing_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal'.2 (H hP)\u27e9\n```\n\n-- snippet 59\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_pi_eq_bot (L115-L119)\ntheorem jacobson_pi_eq_bot (h : \u2200 i, jacobson R (M i) = \u22a5) : jacobson R (\u03a0 i, M i) = \u22a5 :=\nle_bot_iff.mp <| (jacobson_pi_le R M).trans <| by simp_rw [h, pi_univ_bot, le_rfl]\n\nend Module\n```\n\n-- snippet 60\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.mem_closure_X_union_C (L248-L269)\nlemma mem_closure_X_union_C {R : Type*} [Ring R] (p : R[X]) :\n p \u2208 Subring.closure (insert X {f | f.degree \u2264 0} : Set R[X]) := by\nrefine Polynomial.induction_on p ?_ ?_ ?_\n \u00b7 intro r\n apply Subring.subset_closure\n apply Set.mem_insert_of_mem\n exact degree_C_le\n \u00b7 intro p1 p2 h1 h2\n exact Subring.add_mem _ h1 h2\n \u00b7 intro n r hr\n rw [pow_succ, \u2190 mul_assoc]\n apply Subring.mul_mem _ hr\n apply Subring.subset_closure\n apply Set.mem_insert\n\nvariable {R S : Type*} [CommRing R] [CommRing S] [IsDomain S]\nvariable {R\u2098 S\u2098 : Type*} [CommRing R\u2098] [CommRing S\u2098]\n\n/-- If `I` is a prime ideal of `R[X]` and `pX \u2208 I` is a non-constant polynomial,\n then the map `R \u2192+* R[x]/I` descends to an integral map when localizing at `pX.leadingCoeff`.\n In particular `X` is integral because it satisfies `pX`, and constants are trivially integral,\n so integrality of the entire extension follows by closure under addition and multiplication. -/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson (L43-L47)\ndef jacobson : Submodule R M :=\nsInf { m : Submodule R M | IsCoatom m }\n\nvariable {R R\u2082 M M\u2082}\n```\n\n-- snippet 62\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_quotient_of_le (L86-L89)\ntheorem jacobson_quotient_of_le {N : Submodule R M} (le : N \u2264 jacobson R M) :\n jacobson R (M \u29f8 N) = map N.mkQ (jacobson R M) :=\n(map_jacobson_of_ker_le N.mkQ_surjective <| by rwa [ker_mkQ]).symm\n```\n\n-- snippet 63\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.finite_of_algHom_finiteType_of_isJacobsonRing (L699-L719)\ntheorem finite_of_algHom_finiteType_of_isJacobsonRing\n {K L A : Type*} [CommRing K] [DivisionRing L] [CommRing A]\n [IsJacobsonRing K] [IsNoetherianRing K] [Nontrivial A]\n [Algebra K L] [Algebra K A]\n [Algebra.FiniteType K A] (f : L \u2192\u2090[K] A) :\n Module.Finite K L := by\nobtain \u27e8m, hm\u27e9 := Ideal.exists_maximal A\n letI := Ideal.Quotient.field m\n have := finite_of_finite_type_of_isJacobsonRing K (A \u29f8 m)\n exact Module.Finite.of_injective ((Ideal.Quotient.mk\u2090 K m).comp f).toLinearMap\n (RingHom.injective _)\n\n/-- If `K` is a Jacobson Noetherian ring, `A` a nontrivial `K`-algebra of finite type,\nthen any `K`-subfield of `A` is finite over `K`. -/\nnonrec theorem RingHom.finite_of_algHom_finiteType_of_isJacobsonRing\n {K L A : Type*} [CommRing K] [Field L] [CommRing A]\n [IsJacobsonRing K] [IsNoetherianRing K] [Nontrivial A]\n (f : K \u2192+* L) (g : L \u2192+* A) (hfg : (g.comp f).FiniteType) :\n f.Finite := by\n algebraize [f, (g.comp f)]\n exact finite_of_algHom_finiteType_of_isJacobsonRing \u27e8g, fun _ \u21a6 rfl\u27e9\n```\n\n-- snippet 64\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_of_isIntegral (L123-L141)\ntheorem isJacobsonRing_of_isIntegral [Algebra R S] [Algebra.IsIntegral R S] [IsJacobsonRing R] :\n IsJacobsonRing S := by\nrw [isJacobsonRing_iff_prime_eq]\n intro P hP\n by_cases hP_top : comap (algebraMap R S) P = \u22a4\n \u00b7 simp [comap_eq_top_iff.1 hP_top]\n have : Nontrivial (R \u29f8 comap (algebraMap R S) P) := by rwa [Quotient.nontrivial_iff]\n rw [jacobson_eq_iff_jacobson_quotient_eq_bot]\n refine eq_bot_of_comap_eq_bot (R := R \u29f8 comap (algebraMap R S) P) ?_\n rw [eq_bot_iff, \u2190 jacobson_eq_iff_jacobson_quotient_eq_bot.1\n ((isJacobsonRing_iff_prime_eq.1 \u2039_\u203a) (comap (algebraMap R S) P) (comap_isPrime _ _)),\n comap_jacobson]\n refine sInf_le_sInf fun J hJ => ?_\n simp only [true_and, Set.mem_image, bot_le, Set.mem_setOf_eq]\n have : J.IsMaximal := by simpa using hJ\n exact exists_ideal_over_maximal_of_isIntegral J\n (comap_bot_le_of_injective _ algebraMap_quotient_injective)\n\n/-- A variant of `isJacobsonRing_of_isIntegral` that takes `RingHom.IsIntegral` instead. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_iso (L119-L122)\ntheorem isJacobsonRing_iso (e : R \u2243+* S) : IsJacobsonRing R \u2194 IsJacobsonRing S where\n mp _ := isJacobsonRing_of_surjective \u27e8(e : R \u2192+* S), e.surjective\u27e9\nmpr _ := isJacobsonRing_of_surjective \u27e8(e.symm : S \u2192+* R), e.symm.surjective\u27e9\n```\n\n-- snippet 66\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing (L575-L631)\ninstance isJacobsonRing {R : Type*} [CommRing R] {\u03b9 : Type*} [Finite \u03b9] [IsJacobsonRing R] :\n IsJacobsonRing (MvPolynomial \u03b9 R) := by\ncases nonempty_fintype \u03b9\n let e := Fintype.equivFin \u03b9\n rw [isJacobsonRing_iso (renameEquiv R e).toRingEquiv]\n exact isJacobsonRing_MvPolynomial_fin _\n\nvariable {n : \u2115}\n\nuniverse v w\n\n/-- The constant coefficient as an R-linear morphism -/\nprivate noncomputable def C\u2090 (R : Type u) (S : Type v)\n [CommRing R] [CommRing S] [Algebra R S] : S \u2192\u2090[R] S[X] :=\n { Polynomial.C with commutes' := fun r => by rfl }\n\nprivate lemma aux_IH {R : Type u} {S : Type v} {T : Type w}\n [CommRing R] [CommRing S] [CommRing T] [IsJacobsonRing S] [Algebra R S] [Algebra R T]\n (IH : \u2200 (Q : Ideal S), (IsMaximal Q) \u2192 RingHom.IsIntegral (algebraMap R (S \u29f8 Q)))\n (v : S[X] \u2243\u2090[R] T) (P : Ideal T) (hP : P.IsMaximal) :\n RingHom.IsIntegral (algebraMap R (T \u29f8 P)) := by\n let Q := P.comap v.toAlgHom.toRingHom\n have hw : Ideal.map v Q = P := map_comap_of_surjective v v.surjective P\n have hQ : IsMaximal Q := comap_isMaximal_of_surjective _ v.surjective\n let w : (S[X] \u29f8 Q) \u2243\u2090[R] (T \u29f8 P) := Ideal.quotientEquivAlg Q P v hw.symm\n let Q' := Q.comap (Polynomial.C)\n let w' : (S \u29f8 Q') \u2192\u2090[R] (S[X] \u29f8 Q) := Ideal.quotientMap\u2090 Q (C\u2090 R S) le_rfl\n have h_eq : algebraMap R (T \u29f8 P) =\n w.toRingEquiv.toRingHom.comp (w'.toRingHom.comp (algebraMap R (S \u29f8 Q'))) := by\n ext r\n simp only [AlgHom.toRingHom_eq_coe, AlgEquiv.toRingEquiv_eq_coe,\n RingEquiv.toRingHom_eq_coe, AlgHom.comp_algebraMap_of_tower, coe_comp, coe_coe,\n AlgEquiv.coe_ringEquiv, Function.comp_apply, AlgEquiv.commutes]\n rw [h_eq]\n apply RingHom.IsIntegral.trans\n \u00b7 apply RingHom.IsIntegral.trans\n \u00b7 apply IH\n apply Polynomial.isMaximal_comap_C_of_isJacobsonRing\n \u00b7 suffices w'.toRingHom = Ideal.quotientMap Q (Polynomial.C) le_rfl by\n rw [this]\n rw [isIntegral_quotientMap_iff _]\n apply Polynomial.quotient_mk_comp_C_isIntegral_of_isJacobsonRing\n rfl\n \u00b7 apply RingHom.isIntegral_of_surjective\n exact w.surjective\n\nprivate theorem quotient_mk_comp_C_isIntegral_of_isJacobsonRing'\n {R : Type*} [CommRing R] [IsJacobsonRing R]\n (P : Ideal (MvPolynomial (Fin n) R)) (hP : P.IsMaximal) :\n RingHom.IsIntegral (algebraMap R (MvPolynomial (Fin n) R \u29f8 P)) := by\n induction n with\n | zero =>\n apply RingHom.isIntegral_of_surjective\n apply Function.Surjective.comp Quotient.mk_surjective\n exact C_surjective (Fin 0)\n | succ n IH => apply aux_IH IH (finSuccEquiv R n).symm P hP\n```\n\n-- snippet 67\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isMaximal_comap_C_of_isJacobsonRing (L538-L543)\ntheorem isMaximal_comap_C_of_isJacobsonRing : (P.comap (C : R \u2192+* R[X])).IsMaximal := by\nrw [\u2190 @mk_ker _ _ P, RingHom.ker_eq_comap_bot, comap_comap]\n have := (bot_quotient_isMaximal_iff _).mpr hP\n exact isMaximal_comap_of_isIntegral_of_isMaximal' _\n (quotient_mk_comp_C_isIntegral_of_isJacobsonRing P) \u22a5\n```\n\n-- snippet 68\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.comap_jacobson_of_ker_le (L73-L77)\ntheorem comap_jacobson_of_ker_le (surj : Function.Surjective f)\n (le : LinearMap.ker f \u2264 jacobson R M) :\n comap f (jacobson R\u2082 M\u2082) = jacobson R M := by\nrw [\u2190 map_jacobson_of_ker_le surj le, comap_map_eq_self le]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.quotient_mk_comp_C_isIntegral_of_isJacobsonRing (L514-L537)\ntheorem quotient_mk_comp_C_isIntegral_of_isJacobsonRing :\n ((Ideal.Quotient.mk P).comp C : R \u2192+* R[X] \u29f8 P).IsIntegral := by\nlet P' : Ideal R := P.comap C\n have : P'.IsPrime := comap_isPrime C P\n let f : R[X] \u2192+* Polynomial (R \u29f8 P') := Polynomial.mapRingHom (Ideal.Quotient.mk P')\n have hf : Function.Surjective \u2191f := map_surjective (Ideal.Quotient.mk P') Quotient.mk_surjective\n have hPJ : P = (P.map f).comap f := by\n rw [comap_map_of_surjective _ hf]\n refine le_antisymm (le_sup_of_le_left le_rfl) (sup_le le_rfl ?_)\n refine fun p hp =>\n polynomial_mem_ideal_of_coeff_mem_ideal P p fun n => Quotient.eq_zero_iff_mem.mp ?_\n simpa only [f, coeff_map, coe_mapRingHom] using (Polynomial.ext_iff.mp hp) n\n refine RingHom.IsIntegral.tower_bot\n (T := (R \u29f8 comap C P)[X] \u29f8 _) _ _ (injective_quotient_le_comap_map P) ?_\n rw [\u2190 quotient_mk_maps_eq]\n refine ((Ideal.Quotient.mk P').isIntegral_of_surjective Quotient.mk_surjective).trans _ _ ?_\n have : IsMaximal (Ideal.map (mapRingHom (Ideal.Quotient.mk (comap C P))) P) :=\n Or.recOn (map_eq_top_or_isMaximal_of_surjective f hf hP)\n (fun h => absurd (_root_.trans (h \u25b8 hPJ : P = comap f \u22a4) comap_top : P = \u22a4) hP.ne_top) id\n apply quotient_mk_comp_C_isIntegral_of_jacobson' _ ?_ (fun x hx => ?_)\n any_goals exact isJacobsonRing_quotient\n obtain \u27e8z, rfl\u27e9 := Ideal.Quotient.mk_surjective x\n rwa [Quotient.eq_zero_iff_mem, mem_comap, hPJ, mem_comap, coe_mapRingHom, map_C]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isIntegral_isLocalization_polynomial_quotient (L270-L319)\ntheorem isIntegral_isLocalization_polynomial_quotient\n (P : Ideal R[X]) (pX : R[X]) (hpX : pX \u2208 P) [Algebra (R \u29f8 P.comap (C : R \u2192+* R[X])) R\u2098]\n [IsLocalization.Away (pX.map (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X])))).leadingCoeff R\u2098]\n [Algebra (R[X] \u29f8 P) S\u2098] [IsLocalization ((Submonoid.powers (pX.map (Ideal.Quotient.mk (P.comap\n (C : R \u2192+* R[X])))).leadingCoeff).map (quotientMap P C le_rfl) : Submonoid (R[X] \u29f8 P)) S\u2098] :\n (IsLocalization.map S\u2098 (quotientMap P C le_rfl) (Submonoid.powers (pX.map (Ideal.Quotient.mk\n (P.comap (C : R \u2192+* R[X])))).leadingCoeff).le_comap_map : R\u2098 \u2192+* S\u2098).IsIntegral := by\nlet P' : Ideal R := P.comap C\n let M : Submonoid (R \u29f8 P') :=\n Submonoid.powers (pX.map (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X])))).leadingCoeff\n let M' : Submonoid (R[X] \u29f8 P) :=\n (Submonoid.powers (pX.map (Ideal.Quotient.mk (P.comap (C : R \u2192+* R[X])))).leadingCoeff).map\n (quotientMap P C le_rfl)\n let \u03c6 : R \u29f8 P' \u2192+* R[X] \u29f8 P := quotientMap P C le_rfl\n let \u03c6' : R\u2098 \u2192+* S\u2098 := IsLocalization.map S\u2098 \u03c6 M.le_comap_map\n have h\u03c6' : \u03c6.comp (Ideal.Quotient.mk P') = (Ideal.Quotient.mk P).comp C := rfl\n intro p\n obtain \u27e8\u27e8p', \u27e8q, hq\u27e9\u27e9, hp\u27e9 := IsLocalization.surj M' p\n suffices \u03c6'.IsIntegralElem (algebraMap (R[X] \u29f8 P) S\u2098 p') by\n obtain \u27e8q', hq', rfl\u27e9 := hq\n obtain \u27e8q'', hq''\u27e9 := isUnit_iff_exists_inv'.1 (IsLocalization.map_units R\u2098 (\u27e8q', hq'\u27e9 : M))\n refine (hp.symm \u25b8 this).of_mul_unit \u03c6' p (algebraMap (R[X] \u29f8 P) S\u2098 (\u03c6 q')) q'' ?_\n rw [\u2190 \u03c6'.map_one, \u2190 congr_arg \u03c6' hq'', \u03c6'.map_mul, \u2190 \u03c6'.comp_apply]\n simp only [\u03c6', IsLocalization.map_comp _, RingHom.comp_apply]\n dsimp at hp\n refine @IsIntegral.of_mem_closure'' R\u2098 _ S\u2098 _ \u03c6'\n ((algebraMap (R[X] \u29f8 P) S\u2098).comp (Ideal.Quotient.mk P) '' insert X { p | p.degree \u2264 0 }) ?_\n ((algebraMap (R[X] \u29f8 P) S\u2098) p') ?_\n \u00b7 rintro x \u27e8p, hp, rfl\u27e9\n push _ \u2208 _ at hp\n rcases hp with hy | hy\n \u00b7 rw [hy]\n refine \u03c6.isIntegralElem_localization_at_leadingCoeff ((Ideal.Quotient.mk P) X)\n (pX.map (Ideal.Quotient.mk P')) ?_ M ?_\n \u00b7 rwa [eval\u2082_map, h\u03c6', \u2190 hom_eval\u2082, Quotient.eq_zero_iff_mem, eval\u2082_C_X]\n \u00b7 use 1\n simp only [P', pow_one]\n \u00b7 rw [degree_le_zero_iff] at hy\n rw [hy]\n refine \u27e8X - C (algebraMap _ _ ((Ideal.Quotient.mk P') (p.coeff 0))), monic_X_sub_C _, ?_\u27e9\n simp only [eval\u2082_sub, eval\u2082_X, eval\u2082_C]\n rw [sub_eq_zero, \u2190 \u03c6'.comp_apply]\n simp [\u03c6', IsLocalization.map_comp _, P', \u03c6]\n \u00b7 obtain \u27e8p, rfl\u27e9 := Ideal.Quotient.mk_surjective p'\n rw [\u2190 RingHom.comp_apply]\n apply Subring.mem_closure_image_of\n apply Polynomial.mem_closure_X_union_C\n\n/-- If `f : R \u2192 S` descends to an integral map in the localization at `x`,\n and `R` is a Jacobson ring, then the intersection of all maximal ideals in `S` is trivial -/\n```\n\n-- snippet 71\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.RingHom (L671-L674)\nlemma RingHom.FiniteType.isJacobsonRing {A B : Type*} [CommRing A] [CommRing B]\n {f : A \u2192+* B} [IsJacobsonRing A] (H : f.FiniteType) : IsJacobsonRing B :=\n@isJacobsonRing_of_finiteType A B _ _ f.toAlgebra _ H\n```\n\n-- snippet 72\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_smul_top_le (L182-L190)\ntheorem jacobson_smul_top_le : jacobson R \u2022 (\u22a4 : Submodule R M) \u2264 Module.jacobson R M :=\nSubmodule.smul_le.mpr fun _ hr m _ \u21a6 Module.le_comap_jacobson (LinearMap.toSpanSingleton R M m) hr\n\nend Ring\n\nnamespace Submodule\n\nvariable {R M}\n```\n\n-- snippet 73\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.jacobson_smul_lt_top (L191-L195)\ntheorem jacobson_smul_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] (N : Submodule R M) :\n Ring.jacobson R \u2022 N < \u22a4 :=\n((smul_mono_right _ le_top).trans <| Ring.jacobson_smul_top_le R M).trans_lt\n (Module.jacobson_lt_top R M)\n```\n\n-- snippet 74\n```lean\n-- Mathlib.RingTheory.Jacobson.Radical.map_jacobson_le (L55-L57)\ntheorem map_jacobson_le : map f (jacobson R M) \u2264 jacobson R\u2082 M\u2082 :=\nmap_le_iff_le_comap.mpr (le_comap_jacobson f)\n```\n\n-- snippet 75\n```lean\n-- Mathlib.RingTheory.Jacobson.Ring.isJacobsonRing_localization (L213-L247)\ntheorem isJacobsonRing_localization [H : IsJacobsonRing R] : IsJacobsonRing S := by\nrw [isJacobsonRing_iff_prime_eq]\n refine fun P' hP' => le_antisymm ?_ le_jacobson\n obtain \u27e8hP', hPM\u27e9 := (IsLocalization.isPrime_iff_isPrime_disjoint (powers y) S P').mp hP'\n have hP := H.out hP'.isRadical\n refine (IsLocalization.map_comap (powers y) S P'.jacobson).ge.trans\n ((map_mono ?_).trans (IsLocalization.map_comap (powers y) S P').le)\n have : sInf { I : Ideal R | comap (algebraMap R S) P' \u2264 I \u2227 I.IsMaximal \u2227 y \u2209 I } \u2264\n comap (algebraMap R S) P' := by\n intro x hx\n have hxy : x * y \u2208 (comap (algebraMap R S) P').jacobson := by\n rw [Ideal.jacobson, Ideal.mem_sInf]\n intro J hJ\n by_cases h : y \u2208 J\n \u00b7 exact J.mul_mem_left x h\n \u00b7 exact J.mul_mem_right y ((mem_sInf.1 hx) \u27e8hJ.left, \u27e8hJ.right, h\u27e9\u27e9)\n rw [hP] at hxy\n rcases hP'.mem_or_mem hxy with hxy | hxy\n \u00b7 exact hxy\n \u00b7 exact (hPM.le_bot \u27e8Submonoid.mem_powers _, hxy\u27e9).elim\n refine le_trans ?_ this\n rw [Ideal.jacobson, comap_sInf', sInf_eq_iInf]\n refine iInf_le_iInf_of_subset fun I hI => \u27e8map (algebraMap R S) I, \u27e8?_, ?_\u27e9\u27e9\n \u00b7 exact \u27e8le_trans (le_of_eq (IsLocalization.map_comap (powers y) S P').symm) (map_mono hI.1),\n isMaximal_of_isMaximal_disjoint y _ hI.2.1 hI.2.2\u27e9\n \u00b7 exact IsLocalization.comap_map_of_isPrime_disjoint _ S (IsMaximal.isPrime hI.2.1)\n ((disjoint_powers_iff_notMem y hI.2.1.isPrime.isRadical).2 hI.2.2)\n\nend Localization\n\nnamespace Polynomial\n\nsection CommRing\n\n-- Porting note: move to better place\n```\n\n-- snippet 76\n```lean\n-- Mathlib.RingTheory.Jacobson.Artinian.Module (L25-L34)\nlemma Module.finite_of_isSemisimpleRing [IsJacobsonRing R] [IsSemisimpleRing A] :\n Module.Finite R A :=\nhave (I : MaximalSpectrum A) := finite_of_finite_type_of_isJacobsonRing R (A \u29f8 I.asIdeal)\n .equiv ((IsArtinianRing.equivPi A).restrictScalars R).toLinearEquiv.symm\n\n/-- If `A` is a finite type algebra over `R`, then `A` is an Artinian ring and `R` is Jacobson\nimplies `A` is finite over `R`. -/\n/- If made an instance, causes timeouts synthesizing `FaithfulSMul R I.ResidueField` at\n`Ideal.algebraMap_residueField_eq_zero` and `Ideal.ker_algebraMap_residueField` during\nsimpNF linting. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.RingTheory.Jacobson.Semiprimary.IsSemisimpleRing (L36-L38)\ntheorem IsSemisimpleRing.jacobson_eq_bot [IsSemisimpleRing R] : Ring.jacobson R = \u22a5 :=\nIsSemisimpleModule.jacobson_eq_bot R R\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Jacobson/Ideal.lean", "module": "Mathlib.RingTheory.Jacobson.Ideal", "declaration": "Mathlib.RingTheory.Jacobson.Ideal.eq_jacobson_iff_sInf_maximal", "span": "L135-L145", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Jacobson/Ideal.lean#L135"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 20833, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 53789, "lean_code_chars": 51288, "natural_language_chars": 2501, "lean_code_ratio": 0.9535, "line_count": 1241, "imports_count": 0, "declarations_count": 5707, "diagnostics_count": 0, "retrieval_snippets_count": 77, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "28903b655303f93c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Data.Rat.Cast.Defs.cast_natCast", "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.Data.Rat.Cast.Defs)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem cast_natCast (n : \u2115) : ((n : \u211a) : \u03b1) = n\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_commute (L46-L48)\nlemma cast_commute (q : \u211a\u22650) (a : \u03b1) : Commute (\u2191q) a := by\nsimpa only [cast_def] using (q.num.cast_commute a).div_left (q.den.cast_commute a)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.commute_cast (L49-L50)\nlemma commute_cast (a : \u03b1) (q : \u211a\u22650) : Commute a q := (cast_commute ..).symm\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_comm (L51-L52)\nlemma cast_comm (q : \u211a\u22650) (a : \u03b1) : q * a = a * q := cast_commute _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_add_of_ne_zero (L73-L81)\nlemma cast_add_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q + r) = (q + r : \u03b1) := by\nrw [add_def, cast_divNat_of_ne_zero, cast_def, cast_def, mul_comm _ q.den,\n (Nat.commute_cast _ _).div_add_div (Nat.commute_cast _ _) hq hr]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_mul_of_ne_zero (L83-L91)\nlemma cast_mul_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q * r) = (q * r : \u03b1) := by\nrw [mul_def, cast_divNat_of_ne_zero, cast_def, cast_def,\n (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_inv_of_ne_zero (L93-L95)\nlemma cast_inv_of_ne_zero (hq : (q.num : \u03b1) \u2260 0) : (q\u207b\u00b9 : \u211a\u22650) = (q\u207b\u00b9 : \u03b1) := by\nrw [inv_def, cast_divNat_of_ne_zero _ hq, cast_def, inv_div]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_div_of_ne_zero (L97-L111)\nlemma cast_div_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.num : \u03b1) \u2260 0) :\n \u2191(q / r) = (q / r : \u03b1) := by\nrw [div_def, cast_divNat_of_ne_zero, cast_def, cast_def, div_eq_mul_inv (_ / _),\n inv_div, (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n\nend NNRat\n\nnamespace Rat\n\nvariable [DivisionRing \u03b1] {p q : \u211a}\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_intCast (L113-L115)\ntheorem cast_intCast (n : \u2124) : ((n : \u211a) : \u03b1) = n :=\n(cast_def _).trans <| show (n / (1 : \u2115) : \u03b1) = n by rw [Nat.cast_one, div_one]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_zero (L126-L128)\ntheorem cast_zero : ((0 : \u211a) : \u03b1) = 0 :=\n(cast_intCast _).trans Int.cast_zero\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_one (L130-L132)\ntheorem cast_one : ((1 : \u211a) : \u03b1) = 1 :=\n(cast_intCast _).trans Int.cast_one\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_commute (L133-L135)\ntheorem cast_commute (r : \u211a) (a : \u03b1) : Commute (\u2191r) a := by\nsimpa only [cast_def] using (r.1.cast_commute a).div_left (r.2.cast_commute a)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_comm (L136-L138)\ntheorem cast_comm (r : \u211a) (a : \u03b1) : (r : \u03b1) * a = a * r :=\n(cast_commute r a).eq\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.commute_cast (L139-L141)\ntheorem commute_cast (a : \u03b1) (r : \u211a) : Commute a r :=\n(r.cast_commute a).symm\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_divInt_of_ne_zero (L143-L161)\nlemma cast_divInt_of_ne_zero (a : \u2124) {b : \u2124} (b0 : (b : \u03b1) \u2260 0) : (a /. b : \u03b1) = a / b := by\nhave b0' : b \u2260 0 := by\n refine mt ?_ b0\n simp +contextual\n rcases e : a /. b with \u27e8n, d, h, c\u27e9\n have d0 : (d : \u03b1) \u2260 0 := by\n intro d0\n have dd := den_dvd a b\n rcases show (d : \u2124) \u2223 b by rwa [e] at dd with \u27e8k, ke\u27e9\n have : (b : \u03b1) = (d : \u03b1) * (k : \u03b1) := by rw [ke, Int.cast_mul, Int.cast_natCast]\n rw [d0, zero_mul] at this\n contradiction\n rw [mk_eq_divInt] at e\n have := congr_arg ((\u2191) : \u2124 \u2192 \u03b1)\n ((divInt_eq_divInt_iff b0' <| ne_of_gt <| Int.natCast_pos.2 h.bot_lt).1 e)\n rw [Int.cast_mul, Int.cast_mul, Int.cast_natCast] at this\n rw [eq_comm, cast_def, div_eq_mul_inv, eq_div_iff_mul_eq d0, mul_assoc, (d.commute_cast _).eq,\n \u2190 mul_assoc, this, mul_assoc, mul_inv_cancel\u2080 b0, mul_one]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_mkRat_of_ne_zero (L163-L165)\nlemma cast_mkRat_of_ne_zero (a : \u2124) {b : \u2115} (hb : (b : \u03b1) \u2260 0) : (mkRat a b : \u03b1) = a / b := by\nrw [Rat.mkRat_eq_divInt, cast_divInt_of_ne_zero, Int.cast_natCast]; rwa [Int.cast_natCast]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_add_of_ne_zero (L167-L175)\nlemma cast_add_of_ne_zero {q r : \u211a} (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n (q + r : \u211a) = (q + r : \u03b1) := by\nrw [add_def', cast_mkRat_of_ne_zero, cast_def, cast_def, mul_comm r.num,\n (Nat.cast_commute _ _).div_add_div (Nat.commute_cast _ _) hq hr]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_inv_of_ne_zero (L191-L193)\nlemma cast_inv_of_ne_zero (hq : (q.num : \u03b1) \u2260 0) : \u2191(q\u207b\u00b9) = (q\u207b\u00b9 : \u03b1) := by\nrw [inv_def, cast_divInt_of_ne_zero _ hq, cast_def, inv_div, Int.cast_natCast]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.eq_nnratCast (L213-L215)\nlemma eq_nnratCast [DivisionSemiring \u03b1] [FunLike F \u211a\u22650 \u03b1] [RingHomClass F \u211a\u22650 \u03b1] (f : F) (q : \u211a\u22650) :\n f q = q := by rw [\u2190 map_nnratCast f, NNRat.cast_id]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.map_ratCast (L217-L219)\ntheorem map_ratCast [DivisionRing \u03b1] [DivisionRing \u03b2] [RingHomClass F \u03b1 \u03b2] (f : F) (q : \u211a) :\n f q = q := by rw [cast_def, map_div\u2080, map_intCast, map_natCast, cast_def]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_nnrat' (L231-L238)\nlemma ext_nnrat' (h : \u2200 n : \u2115, f n = g n) : f = g :=\n(DFunLike.ext f g) fun r => by\n rw [\u2190 r.num_div_den, div_eq_mul_inv, map_mul, map_mul, h, eq_on_inv\u2080 f g]\n apply h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a\u22650` agree on the naturals then they are equal.\n\nSee note [partially-applied ext lemmas] for why `comp` is used here. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_nnrat (L240-L245)\nlemma ext_nnrat {f g : \u211a\u22650 \u2192*\u2080 M\u2080}\n (h : f.comp (Nat.castRingHom \u211a\u22650 : \u2115 \u2192*\u2080 \u211a\u22650) = g.comp (Nat.castRingHom \u211a\u22650)) : f = g :=\next_nnrat' <| DFunLike.congr_fun h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a\u22650` agree on the positive naturals then they are\nequal. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_nnrat_on_pnat (L246-L256)\nlemma ext_nnrat_on_pnat (same_on_pnat : \u2200 n : \u2115, 0 < n \u2192 f n = g n) : f = g :=\next_nnrat' <| DFunLike.congr_fun <| ext_nat''\n ((f : \u211a\u22650 \u2192*\u2080 M\u2080).comp (Nat.castRingHom \u211a\u22650 : \u2115 \u2192*\u2080 \u211a\u22650))\n ((g : \u211a\u22650 \u2192*\u2080 M\u2080).comp (Nat.castRingHom \u211a\u22650 : \u2115 \u2192*\u2080 \u211a\u22650)) (by simpa)\n\nend NNRat\n\nsection Rat\nvariable [FunLike F \u211a M\u2080] [MonoidWithZeroHomClass F \u211a M\u2080] {f g : F}\n\n/-- If monoid with zero homs `f` and `g` from `\u211a` agree on the integers then they are equal. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_rat' (L257-L265)\ntheorem ext_rat' (h : \u2200 m : \u2124, f m = g m) : f = g :=\n(DFunLike.ext f g) fun r => by\n rw [\u2190 r.num_div_den, div_eq_mul_inv, map_mul, map_mul, h, \u2190 Int.cast_natCast,\n eq_on_inv\u2080 f g]\n apply h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a` agree on the integers then they are equal.\n\nSee note [partially-applied ext lemmas] for why `comp` is used here. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_rat (L267-L272)\ntheorem ext_rat {f g : \u211a \u2192*\u2080 M\u2080}\n (h : f.comp (Int.castRingHom \u211a : \u2124 \u2192*\u2080 \u211a) = g.comp (Int.castRingHom \u211a)) : f = g :=\next_rat' <| DFunLike.congr_fun h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a` agree on the positive naturals and `-1` then\nthey are equal. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_rat_on_pnat (L273-L286)\ntheorem ext_rat_on_pnat (same_on_neg_one : f (-1) = g (-1))\n (same_on_pnat : \u2200 n : \u2115, 0 < n \u2192 f n = g n) : f = g :=\next_rat' <|\n DFunLike.congr_fun <|\n show\n (f : \u211a \u2192*\u2080 M\u2080).comp (Int.castRingHom \u211a : \u2124 \u2192*\u2080 \u211a) =\n (g : \u211a \u2192*\u2080 M\u2080).comp (Int.castRingHom \u211a : \u2124 \u2192*\u2080 \u211a)\n from ext_int' (by simpa) (by simpa)\n\nend Rat\nend MonoidWithZeroHomClass\n\n/-- Any two ring homomorphisms from `\u211a` to a semiring are equal. If the codomain is a division ring,\nthen this lemma follows from `eq_ratCast`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Rat.Defs.intCast_injective (L52-L52)\nlemma intCast_injective : Injective (Int.cast : \u2124 \u2192 \u211a) := fun _ _ \u21a6 congr_arg num\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_prod (L51-L56)\ntheorem cast_prod (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u220f i \u2208 s, f i = \u220f i \u2208 s, (f i : \u03b1) :=\nmap_prod (Rat.castHom \u03b1) _ _\n\nend Field\n\nend Rat\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_nnratCast (L48-L57)\ntheorem cast_nnratCast {K} [DivisionRing K] (q : \u211a\u22650) :\n ((q : \u211a) : K) = (q : K) := by\nrw [Rat.cast_def, NNRat.cast_def, NNRat.cast_def]\n have hn := @num_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den\n on_goal 1 => have hd := @den_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den\n case hdp => simpa only [Int.natCast_pos] using q.den_pos\n simp only [Int.cast_natCast, Nat.cast_inj] at hn hd\n rw [hn, hd, Int.cast_natCast]\n\n/-- Casting a scientific literal via `\u211a` is the same as casting directly. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Rat.Defs.num_neg_eq_neg_num (L207-L210)\ntheorem num_neg_eq_neg_num (q : \u211a) : (-q).num = -q.num :=\nrfl\n\n-- Not `@[simp]` as `num_ofNat` is stronger.\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_intCast (L85-L87)\ntheorem cast_lt_intCast {m : \u211a} {n : \u2124} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioc (L111-L113)\ntheorem preimage_cast_Ioc (p q : \u211a) : (\u2191) \u207b\u00b9' Ioc (p : K) q = Ioc p q :=\ncastOrderEmbedding.preimage_Ioc p q\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.castHom (L53-L59)\ndef castHom : \u211a \u2192+* \u03b1 where\n toFun := (\u2191)\nmap_one' := cast_one\n map_mul' := cast_mul\n map_zero' := cast_zero\n map_add' := cast_add\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_pow (L30-L33)\nlemma cast_pow (p : \u211a) (n : \u2115) : \u2191(p ^ n) = (p ^ n : \u03b1) := by\nrw [cast_def, cast_def, den_pow, num_pow, Nat.cast_pow, Int.cast_pow, div_eq_mul_inv, \u2190 inv_pow,\n \u2190 (Int.cast_commute _ _).mul_pow, \u2190 div_eq_mul_inv]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castHom_rat (L24-L30)\ntheorem castHom_rat : castHom \u211a = RingHom.id \u211a :=\nRingHom.ext cast_id\n\nsection LinearOrderedField\n\nvariable {K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Rat.Defs.commSemigroup (L198-L199)\ninstance commSemigroup : CommSemigroup \u211a := by infer_instance\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_inv_nat (L35-L40)\ntheorem cast_inv_nat (n : \u2115) : ((n\u207b\u00b9 : \u211a) : \u03b1) = (n : \u03b1)\u207b\u00b9 := by\nrcases n with - | n\n \u00b7 simp\n rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero,\n Int.sign_eq_one_of_pos (Int.ofNat_succ_pos n), Int.cast_one, one_div]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Icc (L103-L105)\ntheorem preimage_cast_Icc (p q : \u211a) : (\u2191) \u207b\u00b9' Icc (p : K) q = Icc p q :=\ncastOrderEmbedding.preimage_Icc ..\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_mk (L82-L87)\ntheorem cast_mk {K} [DivisionRing K] (q : \u211a) (h : 0 \u2264 q) :\n (NNRat.cast \u27e8q, h\u27e9 : K) = (q : K) := by\nsimp only [NNRat.cast_def, NNRat.num_mk, Nat.cast_natAbs, NNRat.den_mk, Rat.cast_def]\n rw [abs_of_nonneg (by simpa)]\n\nopen OfScientific in\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Rat.Defs.divInt_eq_zero (L76-L78)\ntheorem divInt_eq_zero {a b : \u2124} (b0 : b \u2260 0) : a /. b = 0 \u2194 a = 0 := by\nrw [\u2190 zero_divInt b, divInt_eq_divInt_iff b0 b0, Int.zero_mul, Int.mul_eq_zero, or_iff_left b0]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Rat.Defs.commMonoid (L187-L195)\ninstance commMonoid : CommMonoid \u211a where\n mul_one := Rat.mul_one\none_mul := Rat.one_mul\n mul_comm := Rat.mul_comm\n mul_assoc := Rat.mul_assoc\n npow n q := q ^ n\n npow_zero := Rat.pow_zero\n npow_succ n q := Rat.pow_succ q n\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Data.Rat.Defs.addSemigroup (L185-L186)\ninstance addSemigroup : AddSemigroup \u211a := by infer_instance\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_prod (L37-L45)\ntheorem cast_list_prod (s : List \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_list_prod (Rat.castHom \u03b1) _\n\nend WithDivRing\n\nsection Field\n\nvariable [Field \u03b1] [CharZero \u03b1]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Data.Rat.Defs.divInt_ne_zero (L79-L84)\ntheorem divInt_ne_zero {a b : \u2124} (b0 : b \u2260 0) : a /. b \u2260 0 \u2194 a \u2260 0 :=\n(divInt_eq_zero b0).not\n\n-- TODO: Rename `mkRat_num_den` in Lean core\nalias mkRat_num_den' := mkRat_self\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Data.Rat.Defs.addCommGroup (L155-L172)\ninstance addCommGroup : AddCommGroup \u211a where\n zero_add := Rat.zero_add\nadd_zero := Rat.add_zero\n add_comm := Rat.add_comm\n add_assoc := Rat.add_assoc\n neg_add_cancel := Rat.neg_add_cancel\n sub_eq_add_neg := Rat.sub_eq_add_neg\n nsmul := (\u00b7 * \u00b7)\n zsmul := (\u00b7 * \u00b7)\n nsmul_zero := Rat.zero_mul\n nsmul_succ n q := by\n change ((n + 1 : Int) : Rat) * q = _\n rw [Rat.intCast_add, Rat.add_mul, Rat.intCast_one, Rat.one_mul]\n rfl\n zsmul_zero' := Rat.zero_mul\n zsmul_succ' _ _ := by simp [Rat.add_mul]\n zsmul_neg' _ _ := by rw [Int.negSucc_eq, Rat.intCast_neg, Rat.neg_mul]; rfl\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Data.Rat.Defs.addLeftCancelSemigroup (L179-L180)\ninstance addLeftCancelSemigroup : AddLeftCancelSemigroup \u211a := by infer_instance\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_max (L96-L97)\nlemma cast_max (p q : \u211a) : (\u2191(max p q) : K) = max (p : K) (q : K) := (@cast_mono K _).map_max\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Data.Rat.Defs.mul_eq_mkRat (L115-L117)\nlemma mul_eq_mkRat (q r : \u211a) : q * r = mkRat (q.num * r.num) (q.den * r.den) := by\nrw [mul_def, normalize_eq_mkRat]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Data.Rat.Defs.natCast_injective (L53-L55)\nlemma natCast_injective : Injective (Nat.cast : \u2115 \u2192 \u211a) :=\nintCast_injective.comp fun _ _ \u21a6 Int.natCast_inj.1\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_sum (L29-L31)\ntheorem cast_multiset_sum (s : Multiset \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_multiset_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Data.Rat.Defs.div_def' (L135-L139)\nlemma div_def' (q r : \u211a) : q / r = (q.num * r.den) /. (q.den * r.num) := by\nrw [\u2190 divInt_div_divInt, num_divInt_den, num_divInt_den]\n\nvariable (a b c : \u211a)\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.Nonneg (L88-L92)\ntheorem Nonneg.coe_ofScientific {K} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n (m : \u2115) (s : Bool) (e : \u2115) :\n (ofScientific m s e : {x : K // 0 \u2264 x}).val = ofScientific m s e := rfl\nend NNRat\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Data.Rat.Defs.monoid (L196-L197)\ninstance monoid : Monoid \u211a := by infer_instance\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Data.Rat.Defs.den_neg_eq_den (L203-L205)\ntheorem den_neg_eq_den (q : \u211a) : (-q).den = q.den :=\nrfl\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Iio (L131-L133)\ntheorem preimage_cast_Iio (q : \u211a) : (\u2191) \u207b\u00b9' Iio (q : K) = Iio q :=\ncastOrderEmbedding.preimage_Iio q\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Data.Rat.Defs.semigroup (L200-L201)\ninstance semigroup : Semigroup \u211a := by infer_instance\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Data.Rat.Cardinal.Cardinal (L25-L25)\ntheorem Cardinal.mkRat : #\u211a = \u2135\u2080 := mk_eq_aleph0 \u211a\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Data.Rat.Defs.mk'_num_den (L46-L47)\nlemma mk'_num_den (q : \u211a) : mk' q.num q.den q.den_nz q.reduced = q := rfl\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_zpow_of_ne_zero (L73-L80)\ntheorem cast_zpow_of_ne_zero {K} [DivisionSemiring K] (q : \u211a\u22650) (z : \u2124) (hq : (q.num : K) \u2260 0) :\n NNRat.cast (q ^ z) = (NNRat.cast q : K) ^ z := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 simp\n \u00b7 simp_rw [zpow_neg, zpow_natCast, \u2190 inv_pow, NNRat.cast_pow]\n congr\n rw [cast_inv_of_ne_zero hq]\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_ofScientific (L59-L66)\ntheorem cast_ofScientific {K} [DivisionRing K] (m : \u2115) (s : Bool) (e : \u2115) :\n (OfScientific.ofScientific m s e : \u211a) = (OfScientific.ofScientific m s e : K) := by\nrw [\u2190 NNRat.cast_ofScientific (K := K), \u2190 NNRat.cast_ofScientific, cast_nnratCast]\n\nend Rat\n\nnamespace NNRat\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioi (L127-L129)\ntheorem preimage_cast_Ioi (q : \u211a) : (\u2191) \u207b\u00b9' Ioi (q : K) = Ioi q :=\ncastOrderEmbedding.preimage_Ioi q\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Data.Rat.Defs.addCommSemigroup (L183-L184)\ninstance addCommSemigroup : AddCommSemigroup \u211a := by infer_instance\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_pos_of_pos (L31-L34)\ntheorem cast_pos_of_pos (hq : 0 < q) : (0 : K) < q := by\nrw [Rat.cast_def]\n exact div_pos (Int.cast_pos.2 <| num_pos.2 hq) (Nat.cast_pos.2 q.pos)\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Data.Rat.Defs.ofInt_eq_cast (L49-L51)\ntheorem ofInt_eq_cast (n : \u2124) : ofInt n = Int.cast n :=\nrfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Data.Rat.Defs.neg_def (L105-L106)\nlemma neg_def (q : \u211a) : -q = -q.num /. q.den := by rw [\u2190 neg_divInt, num_divInt_den]\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Data.Rat.Defs.pos (L44-L45)\ntheorem pos (a : \u211a) : 0 < a.den := Nat.pos_of_ne_zero a.den_nz\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_uIoc (L139-L148)\ntheorem preimage_cast_uIoc (p q : \u211a) : (\u2191) \u207b\u00b9' uIoc (p : K) q = uIoc p q :=\n(castOrderEmbedding (K := K)).preimage_uIoc p q\n\nend LinearOrderedField\nend Rat\n\nnamespace NNRat\n\nvariable {K} [Semifield K] [LinearOrder K] [IsStrictOrderedRing K] {p q : \u211a\u22650}\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_sum (L33-L35)\ntheorem cast_sum (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u2211 i \u2208 s, f i = \u2211 i \u2208 s, (f i : \u03b1) :=\nmap_sum (Rat.castHom \u03b1) _ s\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_lt_cast (L89-L91)\ntheorem intCast_lt_cast {m : \u2124} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_uIcc (L135-L137)\ntheorem preimage_cast_uIcc (p q : \u211a) : (\u2191) \u207b\u00b9' uIcc (p : K) q = uIcc p q :=\n(castOrderEmbedding (K := K)).preimage_uIcc p q\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Data.Rat.Defs.divInt_one_one (L142-L146)\nlemma divInt_one_one : 1 /. 1 = 1 := by rw [divInt_one, Rat.intCast_one]\nprotected theorem zero_ne_one : 0 \u2260 (1 : \u211a) := by\n rw [ne_comm, \u2190 divInt_one_one, divInt_ne_zero] <;> lia\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Data.Rat.Defs.mkRat_eq_divInt (L67-L68)\nlemma mkRat_eq_divInt (n d) : mkRat n d = n /. d := rfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_sum (L25-L27)\ntheorem cast_list_sum (s : List \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_list_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_injective (L25-L36)\nlemma cast_injective : Injective ((\u2191) : \u211a \u2192 \u03b1)\n | \u27e8n\u2081, d\u2081, d\u20810, c\u2081\u27e9, \u27e8n\u2082, d\u2082, d\u20820, c\u2082\u27e9, h => by\n have d\u2081a : (d\u2081 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20810\nhave d\u2082a : (d\u2082 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20820\n rw [mk_eq_divInt, mk_eq_divInt] at h \u22a2\n rw [cast_divInt_of_ne_zero _ (by simpa), cast_divInt_of_ne_zero _ (by simpa)] at h\n norm_cast at h\n rwa [eq_div_iff_mul_eq d\u2082a, division_def, mul_assoc, (d\u2081.cast_commute (d\u2082 : \u03b1)).inv_left\u2080.eq,\n \u2190 mul_assoc, \u2190 division_def, eq_comm, eq_div_iff_mul_eq d\u2081a, eq_comm, \u2190 Int.cast_natCast d\u2081,\n \u2190 Int.cast_mul, \u2190 Int.cast_natCast d\u2082, \u2190 Int.cast_mul, Int.cast_inj, \u2190 mkRat_eq_iff d\u20810 d\u20820]\n at h\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Data.Rat.Defs.addMonoid (L177-L178)\ninstance addMonoid : AddMonoid \u211a := by infer_instance\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_natCast (L77-L79)\ntheorem cast_lt_natCast {m : \u211a} {n : \u2115} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Data.Rat.Defs.mk'_mul_mk' (L109-L114)\nlemma mk'_mul_mk' (n\u2081 n\u2082 : \u2124) (d\u2081 d\u2082 : \u2115) (hd\u2081 hd\u2082 hnd\u2081 hnd\u2082) (h\u2081\u2082 : n\u2081.natAbs.Coprime d\u2082)\n (h\u2082\u2081 : n\u2082.natAbs.Coprime d\u2081) :\n mk' n\u2081 d\u2081 hd\u2081 hnd\u2081 * mk' n\u2082 d\u2082 hd\u2082 hnd\u2082 = mk' (n\u2081 * n\u2082) (d\u2081 * d\u2082) (Nat.mul_ne_zero hd\u2081 hd\u2082) (by\n rw [Int.natAbs_mul]; exact (hnd\u2081.mul_left h\u2082\u2081).mul_right (h\u2081\u2082.mul_left hnd\u2082)) := by\nrw [mul_def]; simp [mk_eq_normalize]\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ico (L107-L109)\ntheorem preimage_cast_Ico (p q : \u211a) : (\u2191) \u207b\u00b9' Ico (p : K) q = Ico p q :=\ncastOrderEmbedding.preimage_Ico ..\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castOrderEmbedding (L45-L47)\ndef castOrderEmbedding : \u211a \u21aao K :=\nOrderEmbedding.ofStrictMono (\u2191) cast_strictMono\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_min (L93-L94)\nlemma cast_min (p q : \u211a) : (\u2191(min p q) : K) = min (p : K) (q : K) := (@cast_mono K _).map_min\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Iic (L123-L125)\ntheorem preimage_cast_Iic (q : \u211a) : (\u2191) \u207b\u00b9' Iic (q : K) = Iic q :=\ncastOrderEmbedding.preimage_Iic q\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_mono (L40-L43)\ntheorem cast_mono : Monotone ((\u2191) : \u211a \u2192 K) :=\ncast_strictMono.monotone\n\n/-- Coercion from `\u211a` as an order embedding. -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_ne_zero (L40-L41)\nlemma cast_ne_zero : (p : \u03b1) \u2260 0 \u2194 p \u2260 0 := cast_eq_zero.ne\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Data.Rat.Defs.num_zero (L211-L214)\ntheorem num_zero : Rat.num 0 = 0 :=\nrfl\n\n-- Not `@[simp]` as `den_ofNat` is stronger.\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Data.Rat.Defs.addRightCancelSemigroup (L181-L182)\ninstance addRightCancelSemigroup : AddRightCancelSemigroup \u211a := by infer_instance\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divInt (L69-L76)\ntheorem cast_divInt (a b : \u2124) : (a /. b : \u03b1) = a / b := by\nsimp only [divInt_eq_div, cast_div, cast_intCast]\n\nend Rat\n\nnamespace NNRat\nvariable [DivisionSemiring \u03b1] [CharZero \u03b1] {p q : \u211a\u22650}\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Data.Rat.Defs.addGroup (L173-L174)\ninstance addGroup : AddGroup \u211a := by infer_instance\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_intCast (L69-L71)\ntheorem cast_le_intCast {m : \u211a} {n : \u2124} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Data.Rat.Defs.nontrivial (L151-L154)\ninstance nontrivial : Nontrivial \u211a where exists_pair_ne := \u27e81, 0, by decide\u27e9\n/-! ### The rational numbers are a group -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_le_cast (L73-L75)\ntheorem intCast_le_cast {m : \u2124} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Data.Rat.Defs.pow_eq_mkRat (L118-L120)\nlemma pow_eq_mkRat (q : \u211a) (n : \u2115) : q ^ n = mkRat (q.num ^ n) (q.den ^ n) := by\nrw [pow_def, mk_eq_mkRat]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Data.Rat.Defs.num_ne_zero (L71-L72)\nlemma num_ne_zero {q : \u211a} : q.num \u2260 0 \u2194 q \u2260 0 := num_eq_zero.not\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Data.Rat.Defs.intCast_eq_divInt (L85-L86)\ntheorem intCast_eq_divInt (z : \u2124) : (z : \u211a) = z /. 1 := mk_eq_divInt\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divNat (L115-L121)\nlemma cast_divNat (a b : \u2115) : (divNat a b : \u03b1) = a / b := by\nrw [\u2190 cast_natCast, \u2190 cast_natCast b, \u2190 cast_div]\n congr\n ext\n apply Rat.mkRat_eq_div\n\nend NNRat\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_le_cast (L65-L67)\ntheorem natCast_le_cast {m : \u2115} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_lt_cast (L81-L83)\ntheorem natCast_lt_cast {m : \u2115} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_strictMono (L36-L38)\ntheorem cast_strictMono : StrictMono ((\u2191) : \u211a \u2192 K) := fun p q => by\nsimpa only [sub_pos, cast_sub] using cast_pos_of_pos (K := K) (q := q - p)\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioo (L115-L117)\ntheorem preimage_cast_Ioo (p q : \u211a) : (\u2191) \u207b\u00b9' Ioo (p : K) q = Ioo p q :=\ncastOrderEmbedding.preimage_Ioo p q\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_prod (L47-L49)\ntheorem cast_multiset_prod (s : Multiset \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_multiset_prod (Rat.castHom \u03b1) _\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ici (L119-L121)\ntheorem preimage_cast_Ici (q : \u211a) : (\u2191) \u207b\u00b9' Ici (q : K) = Ici q :=\ncastOrderEmbedding.preimage_Ici q\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_natCast (L61-L63)\ntheorem cast_le_natCast {m : \u211a} {n : \u2115} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Data.Rat.Defs.pow_eq_divInt (L121-L123)\nlemma pow_eq_divInt (q : \u211a) (n : \u2115) : q ^ n = q.num ^ n /. q.den ^ n := by\nrw [pow_def, mk_eq_divInt, Int.natCast_pow]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Data.Rat.Defs.lift_binop_eq (L87-L104)\ntheorem lift_binop_eq (f : \u211a \u2192 \u211a \u2192 \u211a) (f\u2081 : \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124) (f\u2082 : \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124)\n (fv :\n \u2200 {n\u2081 d\u2081 h\u2081 c\u2081 n\u2082 d\u2082 h\u2082 c\u2082},\n f \u27e8n\u2081, d\u2081, h\u2081, c\u2081\u27e9 \u27e8n\u2082, d\u2082, h\u2082, c\u2082\u27e9 = f\u2081 n\u2081 d\u2081 n\u2082 d\u2082 /. f\u2082 n\u2081 d\u2081 n\u2082 d\u2082)\n (f0 : \u2200 {n\u2081 d\u2081 n\u2082 d\u2082}, d\u2081 \u2260 0 \u2192 d\u2082 \u2260 0 \u2192 f\u2082 n\u2081 d\u2081 n\u2082 d\u2082 \u2260 0) (a b c d : \u2124)\n (b0 : b \u2260 0) (d0 : d \u2260 0)\n (H :\n \u2200 {n\u2081 d\u2081 n\u2082 d\u2082}, a * d\u2081 = n\u2081 * b \u2192 c * d\u2082 = n\u2082 * d \u2192\n f\u2081 n\u2081 d\u2081 n\u2082 d\u2082 * f\u2082 a b c d = f\u2081 a b c d * f\u2082 n\u2081 d\u2081 n\u2082 d\u2082) :\n f (a /. b) (c /. d) = f\u2081 a b c d /. f\u2082 a b c d := by\ngeneralize ha : a /. b = x; obtain \u27e8n\u2081, d\u2081, h\u2081, c\u2081\u27e9 := x; rw [mk_eq_divInt] at ha\n generalize hc : c /. d = x; obtain \u27e8n\u2082, d\u2082, h\u2082, c\u2082\u27e9 := x; rw [mk_eq_divInt] at hc\n rw [fv]\n have d\u20810 := Int.ofNat_ne_zero.2 h\u2081\n have d\u20820 := Int.ofNat_ne_zero.2 h\u2082\n exact (divInt_eq_divInt_iff (f0 d\u20810 d\u20820) (f0 b0 d0)).2\n (H ((divInt_eq_divInt_iff b0 d\u20810).1 ha) ((divInt_eq_divInt_iff d0 d\u20820).1 hc))\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_inv_int (L42-L46)\ntheorem cast_inv_int (n : \u2124) : ((n\u207b\u00b9 : \u211a) : \u03b1) = (n : \u03b1)\u207b\u00b9 := by\nrcases n with n | n\n \u00b7 simp [cast_inv_nat]\n \u00b7 simp only [Int.cast_negSucc, cast_neg, inv_neg, cast_inv_nat]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_zpow (L66-L67)\nlemma cast_zpow (p : \u211a) (n : \u2124) : \u2191(p ^ n) = (p ^ n : \u03b1) := map_zpow\u2080 (castHom \u03b1) ..\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Data.Rat.Defs.addCommMonoid (L175-L176)\ninstance addCommMonoid : AddCommMonoid \u211a := by infer_instance\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.Data.Rat.Cast.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 cast_natCast (n : \u2115) : ((n : \u211a) : \u03b1) = n\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_commute (L46-L48)\nlemma cast_commute (q : \u211a\u22650) (a : \u03b1) : Commute (\u2191q) a := by\nsimpa only [cast_def] using (q.num.cast_commute a).div_left (q.den.cast_commute a)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.commute_cast (L49-L50)\nlemma commute_cast (a : \u03b1) (q : \u211a\u22650) : Commute a q := (cast_commute ..).symm\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_comm (L51-L52)\nlemma cast_comm (q : \u211a\u22650) (a : \u03b1) : q * a = a * q := cast_commute _ _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_add_of_ne_zero (L73-L81)\nlemma cast_add_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q + r) = (q + r : \u03b1) := by\nrw [add_def, cast_divNat_of_ne_zero, cast_def, cast_def, mul_comm _ q.den,\n (Nat.commute_cast _ _).div_add_div (Nat.commute_cast _ _) hq hr]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_mul_of_ne_zero (L83-L91)\nlemma cast_mul_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n \u2191(q * r) = (q * r : \u03b1) := by\nrw [mul_def, cast_divNat_of_ne_zero, cast_def, cast_def,\n (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_inv_of_ne_zero (L93-L95)\nlemma cast_inv_of_ne_zero (hq : (q.num : \u03b1) \u2260 0) : (q\u207b\u00b9 : \u211a\u22650) = (q\u207b\u00b9 : \u03b1) := by\nrw [inv_def, cast_divNat_of_ne_zero _ hq, cast_def, inv_div]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_div_of_ne_zero (L97-L111)\nlemma cast_div_of_ne_zero (hq : (q.den : \u03b1) \u2260 0) (hr : (r.num : \u03b1) \u2260 0) :\n \u2191(q / r) = (q / r : \u03b1) := by\nrw [div_def, cast_divNat_of_ne_zero, cast_def, cast_def, div_eq_mul_inv (_ / _),\n inv_div, (Nat.commute_cast _ _).div_mul_div_comm (Nat.commute_cast _ _)]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n\nend NNRat\n\nnamespace Rat\n\nvariable [DivisionRing \u03b1] {p q : \u211a}\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_intCast (L113-L115)\ntheorem cast_intCast (n : \u2124) : ((n : \u211a) : \u03b1) = n :=\n(cast_def _).trans <| show (n / (1 : \u2115) : \u03b1) = n by rw [Nat.cast_one, div_one]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_zero (L126-L128)\ntheorem cast_zero : ((0 : \u211a) : \u03b1) = 0 :=\n(cast_intCast _).trans Int.cast_zero\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_one (L130-L132)\ntheorem cast_one : ((1 : \u211a) : \u03b1) = 1 :=\n(cast_intCast _).trans Int.cast_one\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_commute (L133-L135)\ntheorem cast_commute (r : \u211a) (a : \u03b1) : Commute (\u2191r) a := by\nsimpa only [cast_def] using (r.1.cast_commute a).div_left (r.2.cast_commute a)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_comm (L136-L138)\ntheorem cast_comm (r : \u211a) (a : \u03b1) : (r : \u03b1) * a = a * r :=\n(cast_commute r a).eq\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.commute_cast (L139-L141)\ntheorem commute_cast (a : \u03b1) (r : \u211a) : Commute a r :=\n(r.cast_commute a).symm\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_divInt_of_ne_zero (L143-L161)\nlemma cast_divInt_of_ne_zero (a : \u2124) {b : \u2124} (b0 : (b : \u03b1) \u2260 0) : (a /. b : \u03b1) = a / b := by\nhave b0' : b \u2260 0 := by\n refine mt ?_ b0\n simp +contextual\n rcases e : a /. b with \u27e8n, d, h, c\u27e9\n have d0 : (d : \u03b1) \u2260 0 := by\n intro d0\n have dd := den_dvd a b\n rcases show (d : \u2124) \u2223 b by rwa [e] at dd with \u27e8k, ke\u27e9\n have : (b : \u03b1) = (d : \u03b1) * (k : \u03b1) := by rw [ke, Int.cast_mul, Int.cast_natCast]\n rw [d0, zero_mul] at this\n contradiction\n rw [mk_eq_divInt] at e\n have := congr_arg ((\u2191) : \u2124 \u2192 \u03b1)\n ((divInt_eq_divInt_iff b0' <| ne_of_gt <| Int.natCast_pos.2 h.bot_lt).1 e)\n rw [Int.cast_mul, Int.cast_mul, Int.cast_natCast] at this\n rw [eq_comm, cast_def, div_eq_mul_inv, eq_div_iff_mul_eq d0, mul_assoc, (d.commute_cast _).eq,\n \u2190 mul_assoc, this, mul_assoc, mul_inv_cancel\u2080 b0, mul_one]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_mkRat_of_ne_zero (L163-L165)\nlemma cast_mkRat_of_ne_zero (a : \u2124) {b : \u2115} (hb : (b : \u03b1) \u2260 0) : (mkRat a b : \u03b1) = a / b := by\nrw [Rat.mkRat_eq_divInt, cast_divInt_of_ne_zero, Int.cast_natCast]; rwa [Int.cast_natCast]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_add_of_ne_zero (L167-L175)\nlemma cast_add_of_ne_zero {q r : \u211a} (hq : (q.den : \u03b1) \u2260 0) (hr : (r.den : \u03b1) \u2260 0) :\n (q + r : \u211a) = (q + r : \u03b1) := by\nrw [add_def', cast_mkRat_of_ne_zero, cast_def, cast_def, mul_comm r.num,\n (Nat.cast_commute _ _).div_add_div (Nat.commute_cast _ _) hq hr]\n \u00b7 push_cast\n rfl\n \u00b7 push_cast\n exact mul_ne_zero hq hr\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.cast_inv_of_ne_zero (L191-L193)\nlemma cast_inv_of_ne_zero (hq : (q.num : \u03b1) \u2260 0) : \u2191(q\u207b\u00b9) = (q\u207b\u00b9 : \u03b1) := by\nrw [inv_def, cast_divInt_of_ne_zero _ hq, cast_def, inv_div, Int.cast_natCast]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.eq_nnratCast (L213-L215)\nlemma eq_nnratCast [DivisionSemiring \u03b1] [FunLike F \u211a\u22650 \u03b1] [RingHomClass F \u211a\u22650 \u03b1] (f : F) (q : \u211a\u22650) :\n f q = q := by rw [\u2190 map_nnratCast f, NNRat.cast_id]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.map_ratCast (L217-L219)\ntheorem map_ratCast [DivisionRing \u03b1] [DivisionRing \u03b2] [RingHomClass F \u03b1 \u03b2] (f : F) (q : \u211a) :\n f q = q := by rw [cast_def, map_div\u2080, map_intCast, map_natCast, cast_def]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_nnrat' (L231-L238)\nlemma ext_nnrat' (h : \u2200 n : \u2115, f n = g n) : f = g :=\n(DFunLike.ext f g) fun r => by\n rw [\u2190 r.num_div_den, div_eq_mul_inv, map_mul, map_mul, h, eq_on_inv\u2080 f g]\n apply h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a\u22650` agree on the naturals then they are equal.\n\nSee note [partially-applied ext lemmas] for why `comp` is used here. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_nnrat (L240-L245)\nlemma ext_nnrat {f g : \u211a\u22650 \u2192*\u2080 M\u2080}\n (h : f.comp (Nat.castRingHom \u211a\u22650 : \u2115 \u2192*\u2080 \u211a\u22650) = g.comp (Nat.castRingHom \u211a\u22650)) : f = g :=\next_nnrat' <| DFunLike.congr_fun h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a\u22650` agree on the positive naturals then they are\nequal. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_nnrat_on_pnat (L246-L256)\nlemma ext_nnrat_on_pnat (same_on_pnat : \u2200 n : \u2115, 0 < n \u2192 f n = g n) : f = g :=\next_nnrat' <| DFunLike.congr_fun <| ext_nat''\n ((f : \u211a\u22650 \u2192*\u2080 M\u2080).comp (Nat.castRingHom \u211a\u22650 : \u2115 \u2192*\u2080 \u211a\u22650))\n ((g : \u211a\u22650 \u2192*\u2080 M\u2080).comp (Nat.castRingHom \u211a\u22650 : \u2115 \u2192*\u2080 \u211a\u22650)) (by simpa)\n\nend NNRat\n\nsection Rat\nvariable [FunLike F \u211a M\u2080] [MonoidWithZeroHomClass F \u211a M\u2080] {f g : F}\n\n/-- If monoid with zero homs `f` and `g` from `\u211a` agree on the integers then they are equal. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_rat' (L257-L265)\ntheorem ext_rat' (h : \u2200 m : \u2124, f m = g m) : f = g :=\n(DFunLike.ext f g) fun r => by\n rw [\u2190 r.num_div_den, div_eq_mul_inv, map_mul, map_mul, h, \u2190 Int.cast_natCast,\n eq_on_inv\u2080 f g]\n apply h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a` agree on the integers then they are equal.\n\nSee note [partially-applied ext lemmas] for why `comp` is used here. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_rat (L267-L272)\ntheorem ext_rat {f g : \u211a \u2192*\u2080 M\u2080}\n (h : f.comp (Int.castRingHom \u211a : \u2124 \u2192*\u2080 \u211a) = g.comp (Int.castRingHom \u211a)) : f = g :=\next_rat' <| DFunLike.congr_fun h\n\n/-- If monoid with zero homs `f` and `g` from `\u211a` agree on the positive naturals and `-1` then\nthey are equal. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Rat.Cast.Defs.ext_rat_on_pnat (L273-L286)\ntheorem ext_rat_on_pnat (same_on_neg_one : f (-1) = g (-1))\n (same_on_pnat : \u2200 n : \u2115, 0 < n \u2192 f n = g n) : f = g :=\next_rat' <|\n DFunLike.congr_fun <|\n show\n (f : \u211a \u2192*\u2080 M\u2080).comp (Int.castRingHom \u211a : \u2124 \u2192*\u2080 \u211a) =\n (g : \u211a \u2192*\u2080 M\u2080).comp (Int.castRingHom \u211a : \u2124 \u2192*\u2080 \u211a)\n from ext_int' (by simpa) (by simpa)\n\nend Rat\nend MonoidWithZeroHomClass\n\n/-- Any two ring homomorphisms from `\u211a` to a semiring are equal. If the codomain is a division ring,\nthen this lemma follows from `eq_ratCast`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Rat.Defs.intCast_injective (L52-L52)\nlemma intCast_injective : Injective (Int.cast : \u2124 \u2192 \u211a) := fun _ _ \u21a6 congr_arg num\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_prod (L51-L56)\ntheorem cast_prod (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u220f i \u2208 s, f i = \u220f i \u2208 s, (f i : \u03b1) :=\nmap_prod (Rat.castHom \u03b1) _ _\n\nend Field\n\nend Rat\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_nnratCast (L48-L57)\ntheorem cast_nnratCast {K} [DivisionRing K] (q : \u211a\u22650) :\n ((q : \u211a) : K) = (q : K) := by\nrw [Rat.cast_def, NNRat.cast_def, NNRat.cast_def]\n have hn := @num_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den\n on_goal 1 => have hd := @den_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den\n case hdp => simpa only [Int.natCast_pos] using q.den_pos\n simp only [Int.cast_natCast, Nat.cast_inj] at hn hd\n rw [hn, hd, Int.cast_natCast]\n\n/-- Casting a scientific literal via `\u211a` is the same as casting directly. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Rat.Defs.num_neg_eq_neg_num (L207-L210)\ntheorem num_neg_eq_neg_num (q : \u211a) : (-q).num = -q.num :=\nrfl\n\n-- Not `@[simp]` as `num_ofNat` is stronger.\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_intCast (L85-L87)\ntheorem cast_lt_intCast {m : \u211a} {n : \u2124} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioc (L111-L113)\ntheorem preimage_cast_Ioc (p q : \u211a) : (\u2191) \u207b\u00b9' Ioc (p : K) q = Ioc p q :=\ncastOrderEmbedding.preimage_Ioc p q\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.castHom (L53-L59)\ndef castHom : \u211a \u2192+* \u03b1 where\n toFun := (\u2191)\nmap_one' := cast_one\n map_mul' := cast_mul\n map_zero' := cast_zero\n map_add' := cast_add\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_pow (L30-L33)\nlemma cast_pow (p : \u211a) (n : \u2115) : \u2191(p ^ n) = (p ^ n : \u03b1) := by\nrw [cast_def, cast_def, den_pow, num_pow, Nat.cast_pow, Int.cast_pow, div_eq_mul_inv, \u2190 inv_pow,\n \u2190 (Int.cast_commute _ _).mul_pow, \u2190 div_eq_mul_inv]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castHom_rat (L24-L30)\ntheorem castHom_rat : castHom \u211a = RingHom.id \u211a :=\nRingHom.ext cast_id\n\nsection LinearOrderedField\n\nvariable {K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Rat.Defs.commSemigroup (L198-L199)\ninstance commSemigroup : CommSemigroup \u211a := by infer_instance\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_inv_nat (L35-L40)\ntheorem cast_inv_nat (n : \u2115) : ((n\u207b\u00b9 : \u211a) : \u03b1) = (n : \u03b1)\u207b\u00b9 := by\nrcases n with - | n\n \u00b7 simp\n rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero,\n Int.sign_eq_one_of_pos (Int.ofNat_succ_pos n), Int.cast_one, one_div]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Icc (L103-L105)\ntheorem preimage_cast_Icc (p q : \u211a) : (\u2191) \u207b\u00b9' Icc (p : K) q = Icc p q :=\ncastOrderEmbedding.preimage_Icc ..\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_mk (L82-L87)\ntheorem cast_mk {K} [DivisionRing K] (q : \u211a) (h : 0 \u2264 q) :\n (NNRat.cast \u27e8q, h\u27e9 : K) = (q : K) := by\nsimp only [NNRat.cast_def, NNRat.num_mk, Nat.cast_natAbs, NNRat.den_mk, Rat.cast_def]\n rw [abs_of_nonneg (by simpa)]\n\nopen OfScientific in\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Rat.Defs.divInt_eq_zero (L76-L78)\ntheorem divInt_eq_zero {a b : \u2124} (b0 : b \u2260 0) : a /. b = 0 \u2194 a = 0 := by\nrw [\u2190 zero_divInt b, divInt_eq_divInt_iff b0 b0, Int.zero_mul, Int.mul_eq_zero, or_iff_left b0]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Rat.Defs.commMonoid (L187-L195)\ninstance commMonoid : CommMonoid \u211a where\n mul_one := Rat.mul_one\none_mul := Rat.one_mul\n mul_comm := Rat.mul_comm\n mul_assoc := Rat.mul_assoc\n npow n q := q ^ n\n npow_zero := Rat.pow_zero\n npow_succ n q := Rat.pow_succ q n\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Data.Rat.Defs.addSemigroup (L185-L186)\ninstance addSemigroup : AddSemigroup \u211a := by infer_instance\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_prod (L37-L45)\ntheorem cast_list_prod (s : List \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_list_prod (Rat.castHom \u03b1) _\n\nend WithDivRing\n\nsection Field\n\nvariable [Field \u03b1] [CharZero \u03b1]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Data.Rat.Defs.divInt_ne_zero (L79-L84)\ntheorem divInt_ne_zero {a b : \u2124} (b0 : b \u2260 0) : a /. b \u2260 0 \u2194 a \u2260 0 :=\n(divInt_eq_zero b0).not\n\n-- TODO: Rename `mkRat_num_den` in Lean core\nalias mkRat_num_den' := mkRat_self\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Data.Rat.Defs.addCommGroup (L155-L172)\ninstance addCommGroup : AddCommGroup \u211a where\n zero_add := Rat.zero_add\nadd_zero := Rat.add_zero\n add_comm := Rat.add_comm\n add_assoc := Rat.add_assoc\n neg_add_cancel := Rat.neg_add_cancel\n sub_eq_add_neg := Rat.sub_eq_add_neg\n nsmul := (\u00b7 * \u00b7)\n zsmul := (\u00b7 * \u00b7)\n nsmul_zero := Rat.zero_mul\n nsmul_succ n q := by\n change ((n + 1 : Int) : Rat) * q = _\n rw [Rat.intCast_add, Rat.add_mul, Rat.intCast_one, Rat.one_mul]\n rfl\n zsmul_zero' := Rat.zero_mul\n zsmul_succ' _ _ := by simp [Rat.add_mul]\n zsmul_neg' _ _ := by rw [Int.negSucc_eq, Rat.intCast_neg, Rat.neg_mul]; rfl\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Data.Rat.Defs.addLeftCancelSemigroup (L179-L180)\ninstance addLeftCancelSemigroup : AddLeftCancelSemigroup \u211a := by infer_instance\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_max (L96-L97)\nlemma cast_max (p q : \u211a) : (\u2191(max p q) : K) = max (p : K) (q : K) := (@cast_mono K _).map_max\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Data.Rat.Defs.mul_eq_mkRat (L115-L117)\nlemma mul_eq_mkRat (q r : \u211a) : q * r = mkRat (q.num * r.num) (q.den * r.den) := by\nrw [mul_def, normalize_eq_mkRat]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Data.Rat.Defs.natCast_injective (L53-L55)\nlemma natCast_injective : Injective (Nat.cast : \u2115 \u2192 \u211a) :=\nintCast_injective.comp fun _ _ \u21a6 Int.natCast_inj.1\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_sum (L29-L31)\ntheorem cast_multiset_sum (s : Multiset \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_multiset_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Data.Rat.Defs.div_def' (L135-L139)\nlemma div_def' (q r : \u211a) : q / r = (q.num * r.den) /. (q.den * r.num) := by\nrw [\u2190 divInt_div_divInt, num_divInt_den, num_divInt_den]\n\nvariable (a b c : \u211a)\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.Nonneg (L88-L92)\ntheorem Nonneg.coe_ofScientific {K} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n (m : \u2115) (s : Bool) (e : \u2115) :\n (ofScientific m s e : {x : K // 0 \u2264 x}).val = ofScientific m s e := rfl\nend NNRat\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Data.Rat.Defs.monoid (L196-L197)\ninstance monoid : Monoid \u211a := by infer_instance\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Data.Rat.Defs.den_neg_eq_den (L203-L205)\ntheorem den_neg_eq_den (q : \u211a) : (-q).den = q.den :=\nrfl\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Iio (L131-L133)\ntheorem preimage_cast_Iio (q : \u211a) : (\u2191) \u207b\u00b9' Iio (q : K) = Iio q :=\ncastOrderEmbedding.preimage_Iio q\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Data.Rat.Defs.semigroup (L200-L201)\ninstance semigroup : Semigroup \u211a := by infer_instance\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Data.Rat.Cardinal.Cardinal (L25-L25)\ntheorem Cardinal.mkRat : #\u211a = \u2135\u2080 := mk_eq_aleph0 \u211a\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Data.Rat.Defs.mk'_num_den (L46-L47)\nlemma mk'_num_den (q : \u211a) : mk' q.num q.den q.den_nz q.reduced = q := rfl\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_zpow_of_ne_zero (L73-L80)\ntheorem cast_zpow_of_ne_zero {K} [DivisionSemiring K] (q : \u211a\u22650) (z : \u2124) (hq : (q.num : K) \u2260 0) :\n NNRat.cast (q ^ z) = (NNRat.cast q : K) ^ z := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 simp\n \u00b7 simp_rw [zpow_neg, zpow_natCast, \u2190 inv_pow, NNRat.cast_pow]\n congr\n rw [cast_inv_of_ne_zero hq]\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_ofScientific (L59-L66)\ntheorem cast_ofScientific {K} [DivisionRing K] (m : \u2115) (s : Bool) (e : \u2115) :\n (OfScientific.ofScientific m s e : \u211a) = (OfScientific.ofScientific m s e : K) := by\nrw [\u2190 NNRat.cast_ofScientific (K := K), \u2190 NNRat.cast_ofScientific, cast_nnratCast]\n\nend Rat\n\nnamespace NNRat\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioi (L127-L129)\ntheorem preimage_cast_Ioi (q : \u211a) : (\u2191) \u207b\u00b9' Ioi (q : K) = Ioi q :=\ncastOrderEmbedding.preimage_Ioi q\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Data.Rat.Defs.addCommSemigroup (L183-L184)\ninstance addCommSemigroup : AddCommSemigroup \u211a := by infer_instance\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_pos_of_pos (L31-L34)\ntheorem cast_pos_of_pos (hq : 0 < q) : (0 : K) < q := by\nrw [Rat.cast_def]\n exact div_pos (Int.cast_pos.2 <| num_pos.2 hq) (Nat.cast_pos.2 q.pos)\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Data.Rat.Defs.ofInt_eq_cast (L49-L51)\ntheorem ofInt_eq_cast (n : \u2124) : ofInt n = Int.cast n :=\nrfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Data.Rat.Defs.neg_def (L105-L106)\nlemma neg_def (q : \u211a) : -q = -q.num /. q.den := by rw [\u2190 neg_divInt, num_divInt_den]\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Data.Rat.Defs.pos (L44-L45)\ntheorem pos (a : \u211a) : 0 < a.den := Nat.pos_of_ne_zero a.den_nz\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_uIoc (L139-L148)\ntheorem preimage_cast_uIoc (p q : \u211a) : (\u2191) \u207b\u00b9' uIoc (p : K) q = uIoc p q :=\n(castOrderEmbedding (K := K)).preimage_uIoc p q\n\nend LinearOrderedField\nend Rat\n\nnamespace NNRat\n\nvariable {K} [Semifield K] [LinearOrder K] [IsStrictOrderedRing K] {p q : \u211a\u22650}\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_sum (L33-L35)\ntheorem cast_sum (s : Finset \u03b9) (f : \u03b9 \u2192 \u211a) : \u2211 i \u2208 s, f i = \u2211 i \u2208 s, (f i : \u03b1) :=\nmap_sum (Rat.castHom \u03b1) _ s\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_lt_cast (L89-L91)\ntheorem intCast_lt_cast {m : \u2124} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_intCast]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_uIcc (L135-L137)\ntheorem preimage_cast_uIcc (p q : \u211a) : (\u2191) \u207b\u00b9' uIcc (p : K) q = uIcc p q :=\n(castOrderEmbedding (K := K)).preimage_uIcc p q\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Data.Rat.Defs.divInt_one_one (L142-L146)\nlemma divInt_one_one : 1 /. 1 = 1 := by rw [divInt_one, Rat.intCast_one]\nprotected theorem zero_ne_one : 0 \u2260 (1 : \u211a) := by\n rw [ne_comm, \u2190 divInt_one_one, divInt_ne_zero] <;> lia\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Data.Rat.Defs.mkRat_eq_divInt (L67-L68)\nlemma mkRat_eq_divInt (n d) : mkRat n d = n /. d := rfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_list_sum (L25-L27)\ntheorem cast_list_sum (s : List \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum :=\nmap_list_sum (Rat.castHom \u03b1) _\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_injective (L25-L36)\nlemma cast_injective : Injective ((\u2191) : \u211a \u2192 \u03b1)\n | \u27e8n\u2081, d\u2081, d\u20810, c\u2081\u27e9, \u27e8n\u2082, d\u2082, d\u20820, c\u2082\u27e9, h => by\n have d\u2081a : (d\u2081 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20810\nhave d\u2082a : (d\u2082 : \u03b1) \u2260 0 := Nat.cast_ne_zero.2 d\u20820\n rw [mk_eq_divInt, mk_eq_divInt] at h \u22a2\n rw [cast_divInt_of_ne_zero _ (by simpa), cast_divInt_of_ne_zero _ (by simpa)] at h\n norm_cast at h\n rwa [eq_div_iff_mul_eq d\u2082a, division_def, mul_assoc, (d\u2081.cast_commute (d\u2082 : \u03b1)).inv_left\u2080.eq,\n \u2190 mul_assoc, \u2190 division_def, eq_comm, eq_div_iff_mul_eq d\u2081a, eq_comm, \u2190 Int.cast_natCast d\u2081,\n \u2190 Int.cast_mul, \u2190 Int.cast_natCast d\u2082, \u2190 Int.cast_mul, Int.cast_inj, \u2190 mkRat_eq_iff d\u20810 d\u20820]\n at h\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Data.Rat.Defs.addMonoid (L177-L178)\ninstance addMonoid : AddMonoid \u211a := by infer_instance\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_lt_natCast (L77-L79)\ntheorem cast_lt_natCast {m : \u211a} {n : \u2115} : (m : K) < n \u2194 m < (n : \u211a) := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Data.Rat.Defs.mk'_mul_mk' (L109-L114)\nlemma mk'_mul_mk' (n\u2081 n\u2082 : \u2124) (d\u2081 d\u2082 : \u2115) (hd\u2081 hd\u2082 hnd\u2081 hnd\u2082) (h\u2081\u2082 : n\u2081.natAbs.Coprime d\u2082)\n (h\u2082\u2081 : n\u2082.natAbs.Coprime d\u2081) :\n mk' n\u2081 d\u2081 hd\u2081 hnd\u2081 * mk' n\u2082 d\u2082 hd\u2082 hnd\u2082 = mk' (n\u2081 * n\u2082) (d\u2081 * d\u2082) (Nat.mul_ne_zero hd\u2081 hd\u2082) (by\n rw [Int.natAbs_mul]; exact (hnd\u2081.mul_left h\u2082\u2081).mul_right (h\u2081\u2082.mul_left hnd\u2082)) := by\nrw [mul_def]; simp [mk_eq_normalize]\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ico (L107-L109)\ntheorem preimage_cast_Ico (p q : \u211a) : (\u2191) \u207b\u00b9' Ico (p : K) q = Ico p q :=\ncastOrderEmbedding.preimage_Ico ..\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Data.Rat.Cast.Order.castOrderEmbedding (L45-L47)\ndef castOrderEmbedding : \u211a \u21aao K :=\nOrderEmbedding.ofStrictMono (\u2191) cast_strictMono\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_min (L93-L94)\nlemma cast_min (p q : \u211a) : (\u2191(min p q) : K) = min (p : K) (q : K) := (@cast_mono K _).map_min\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Iic (L123-L125)\ntheorem preimage_cast_Iic (q : \u211a) : (\u2191) \u207b\u00b9' Iic (q : K) = Iic q :=\ncastOrderEmbedding.preimage_Iic q\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_mono (L40-L43)\ntheorem cast_mono : Monotone ((\u2191) : \u211a \u2192 K) :=\ncast_strictMono.monotone\n\n/-- Coercion from `\u211a` as an order embedding. -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_ne_zero (L40-L41)\nlemma cast_ne_zero : (p : \u03b1) \u2260 0 \u2194 p \u2260 0 := cast_eq_zero.ne\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Data.Rat.Defs.num_zero (L211-L214)\ntheorem num_zero : Rat.num 0 = 0 :=\nrfl\n\n-- Not `@[simp]` as `den_ofNat` is stronger.\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Data.Rat.Defs.addRightCancelSemigroup (L181-L182)\ninstance addRightCancelSemigroup : AddRightCancelSemigroup \u211a := by infer_instance\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divInt (L69-L76)\ntheorem cast_divInt (a b : \u2124) : (a /. b : \u03b1) = a / b := by\nsimp only [divInt_eq_div, cast_div, cast_intCast]\n\nend Rat\n\nnamespace NNRat\nvariable [DivisionSemiring \u03b1] [CharZero \u03b1] {p q : \u211a\u22650}\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Data.Rat.Defs.addGroup (L173-L174)\ninstance addGroup : AddGroup \u211a := by infer_instance\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_intCast (L69-L71)\ntheorem cast_le_intCast {m : \u211a} {n : \u2124} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Data.Rat.Defs.nontrivial (L151-L154)\ninstance nontrivial : Nontrivial \u211a where exists_pair_ne := \u27e81, 0, by decide\u27e9\n/-! ### The rational numbers are a group -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Data.Rat.Cast.Order.intCast_le_cast (L73-L75)\ntheorem intCast_le_cast {m : \u2124} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_intCast]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Data.Rat.Defs.pow_eq_mkRat (L118-L120)\nlemma pow_eq_mkRat (q : \u211a) (n : \u2115) : q ^ n = mkRat (q.num ^ n) (q.den ^ n) := by\nrw [pow_def, mk_eq_mkRat]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Data.Rat.Defs.num_ne_zero (L71-L72)\nlemma num_ne_zero {q : \u211a} : q.num \u2260 0 \u2194 q \u2260 0 := num_eq_zero.not\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Data.Rat.Defs.intCast_eq_divInt (L85-L86)\ntheorem intCast_eq_divInt (z : \u2124) : (z : \u211a) = z /. 1 := mk_eq_divInt\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_divNat (L115-L121)\nlemma cast_divNat (a b : \u2115) : (divNat a b : \u03b1) = a / b := by\nrw [\u2190 cast_natCast, \u2190 cast_natCast b, \u2190 cast_div]\n congr\n ext\n apply Rat.mkRat_eq_div\n\nend NNRat\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_le_cast (L65-L67)\ntheorem natCast_le_cast {m : \u2115} {n : \u211a} : (m : K) \u2264 n \u2194 (m : \u211a) \u2264 n := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Data.Rat.Cast.Order.natCast_lt_cast (L81-L83)\ntheorem natCast_lt_cast {m : \u2115} {n : \u211a} : (m : K) < n \u2194 (m : \u211a) < n := by\nrw [\u2190 cast_lt (K := K), cast_natCast]\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_strictMono (L36-L38)\ntheorem cast_strictMono : StrictMono ((\u2191) : \u211a \u2192 K) := fun p q => by\nsimpa only [sub_pos, cast_sub] using cast_pos_of_pos (K := K) (q := q - p)\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ioo (L115-L117)\ntheorem preimage_cast_Ioo (p q : \u211a) : (\u2191) \u207b\u00b9' Ioo (p : K) q = Ioo p q :=\ncastOrderEmbedding.preimage_Ioo p q\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Data.Rat.BigOperators.cast_multiset_prod (L47-L49)\ntheorem cast_multiset_prod (s : Multiset \u211a) : (\u2191s.prod : \u03b1) = (s.map (\u2191)).prod :=\nmap_multiset_prod (Rat.castHom \u03b1) _\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Data.Rat.Cast.Order.preimage_cast_Ici (L119-L121)\ntheorem preimage_cast_Ici (q : \u211a) : (\u2191) \u207b\u00b9' Ici (q : K) = Ici q :=\ncastOrderEmbedding.preimage_Ici q\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Data.Rat.Cast.Order.cast_le_natCast (L61-L63)\ntheorem cast_le_natCast {m : \u211a} {n : \u2115} : (m : K) \u2264 n \u2194 m \u2264 (n : \u211a) := by\nrw [\u2190 cast_le (K := K), cast_natCast]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Data.Rat.Defs.pow_eq_divInt (L121-L123)\nlemma pow_eq_divInt (q : \u211a) (n : \u2115) : q ^ n = q.num ^ n /. q.den ^ n := by\nrw [pow_def, mk_eq_divInt, Int.natCast_pow]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Data.Rat.Defs.lift_binop_eq (L87-L104)\ntheorem lift_binop_eq (f : \u211a \u2192 \u211a \u2192 \u211a) (f\u2081 : \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124) (f\u2082 : \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124 \u2192 \u2124)\n (fv :\n \u2200 {n\u2081 d\u2081 h\u2081 c\u2081 n\u2082 d\u2082 h\u2082 c\u2082},\n f \u27e8n\u2081, d\u2081, h\u2081, c\u2081\u27e9 \u27e8n\u2082, d\u2082, h\u2082, c\u2082\u27e9 = f\u2081 n\u2081 d\u2081 n\u2082 d\u2082 /. f\u2082 n\u2081 d\u2081 n\u2082 d\u2082)\n (f0 : \u2200 {n\u2081 d\u2081 n\u2082 d\u2082}, d\u2081 \u2260 0 \u2192 d\u2082 \u2260 0 \u2192 f\u2082 n\u2081 d\u2081 n\u2082 d\u2082 \u2260 0) (a b c d : \u2124)\n (b0 : b \u2260 0) (d0 : d \u2260 0)\n (H :\n \u2200 {n\u2081 d\u2081 n\u2082 d\u2082}, a * d\u2081 = n\u2081 * b \u2192 c * d\u2082 = n\u2082 * d \u2192\n f\u2081 n\u2081 d\u2081 n\u2082 d\u2082 * f\u2082 a b c d = f\u2081 a b c d * f\u2082 n\u2081 d\u2081 n\u2082 d\u2082) :\n f (a /. b) (c /. d) = f\u2081 a b c d /. f\u2082 a b c d := by\ngeneralize ha : a /. b = x; obtain \u27e8n\u2081, d\u2081, h\u2081, c\u2081\u27e9 := x; rw [mk_eq_divInt] at ha\n generalize hc : c /. d = x; obtain \u27e8n\u2082, d\u2082, h\u2082, c\u2082\u27e9 := x; rw [mk_eq_divInt] at hc\n rw [fv]\n have d\u20810 := Int.ofNat_ne_zero.2 h\u2081\n have d\u20820 := Int.ofNat_ne_zero.2 h\u2082\n exact (divInt_eq_divInt_iff (f0 d\u20810 d\u20820) (f0 b0 d0)).2\n (H ((divInt_eq_divInt_iff b0 d\u20810).1 ha) ((divInt_eq_divInt_iff d0 d\u20820).1 hc))\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Data.Rat.Cast.Lemmas.cast_inv_int (L42-L46)\ntheorem cast_inv_int (n : \u2124) : ((n\u207b\u00b9 : \u211a) : \u03b1) = (n : \u03b1)\u207b\u00b9 := by\nrcases n with n | n\n \u00b7 simp [cast_inv_nat]\n \u00b7 simp only [Int.cast_negSucc, cast_neg, inv_neg, cast_inv_nat]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Data.Rat.Cast.CharZero.cast_zpow (L66-L67)\nlemma cast_zpow (p : \u211a) (n : \u2124) : \u2191(p ^ n) = (p ^ n : \u03b1) := map_zpow\u2080 (castHom \u03b1) ..\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Data.Rat.Defs.addCommMonoid (L175-L176)\ninstance addCommMonoid : AddCommMonoid \u211a := by infer_instance\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Rat/Cast/Defs.lean", "module": "Mathlib.Data.Rat.Cast.Defs", "declaration": "Mathlib.Data.Rat.Cast.Defs.cast_natCast", "span": "L117-L120", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Rat/Cast/Defs.lean#L117"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 11454, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 27039, "lean_code_chars": 23783, "natural_language_chars": 3256, "lean_code_ratio": 0.8796, "line_count": 932, "imports_count": 0, "declarations_count": 2718, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "b9829a5264d9a417", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.Algebra.Module.SpanRank.Module", "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.Algebra.Module.SpanRank)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma Module.Basis.mk_eq_spanRank [RankCondition R] {\u03b9 : Type*} (v : Basis \u03b9 R M) :\n #(Set.range v) = (\u22a4 : Submodule R M).spanRank\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_encard (L72-L87)\nlemma spanRank_toENat_eq_iInf_encard (p : Submodule R M) : p.spanRank.toENat =\n (\u2a05 (s : Set M) (_ : span R s = p), s.encard) := by\nrw [spanRank]\n apply le_antisymm\n \u00b7 refine le_iInf\u2082 (fun s hs \u21a6 ?_)\n rw [Set.encard, ENat.card]\n exact toENat.monotone' (ciInf_le' _ (\u27e8s, hs\u27e9 : {s : Set M // span R s = p}))\n \u00b7 have := congrFun toENat_comp_ofENat.{u}.symm (\u2a05 (s : Set M) (_ : span R s = p), s.encard)\n rw [id_eq] at this; rw [this]\n refine toENat.monotone' (le_ciInf fun s \u21a6 ?_)\n have : ofENat.{u} (\u2a05 (s' : Set M), \u2a05 (_ : span R s' = p), s'.encard) \u2264 ofENat s.1.encard :=\n ofENatHom.monotone' (le_trans (ciInf_le' _ s.1) (ciInf_le' _ s.2))\n apply le_trans this\n rw [Set.encard, ENat.card]\n exact Cardinal.ofENat_toENat_le _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_finset_card (L88-L102)\nlemma spanRank_toENat_eq_iInf_finset_card (p : Submodule R M) :\n p.spanRank.toENat = \u2a05 (s : {s : Finset M // span R s = p}), (s.1.card : \u2115\u221e) := by\nrw [spanRank_toENat_eq_iInf_encard]\n rcases eq_or_ne (\u2a05 (s : Set M) (_ : span R s = p), s.encard) \u22a4 with (h1 | h2)\n \u00b7 rw [h1, eq_comm]; simp_rw [iInf_eq_top] at h1 \u22a2\n exact fun s \u21a6 False.elim (Set.encard_ne_top_iff.mpr s.1.finite_toSet (h1 s.1 s.2))\n \u00b7 simp_rw [\u2190 Set.encard_coe_eq_coe_finsetCard]\n apply le_antisymm\n \u00b7 exact le_iInf fun s \u21a6 iInf\u2082_le (s.1 : Set M) s.2\n \u00b7 refine le_iInf fun s \u21a6 le_iInf fun h \u21a6 ?_\n by_cases hs : s.Finite\n \u00b7 exact iInf_le_of_le \u27e8hs.toFinset, by simpa\u27e9 (by simp)\n \u00b7 rw [Set.Infinite.encard_eq hs]\n exact OrderTop.le_top _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_eq_iInf (L103-L107)\nlemma spanFinrank_eq_iInf (p : Submodule R M) :\n p.spanFinrank = \u2a05 (s : {s : Finset M // span R s = p}), s.1.card := by\nsimp [spanFinrank, Cardinal.toNat, spanRank_toENat_eq_iInf_finset_card, ENat.iInf_toNat]\n\n/-- A submodule's `spanRank` is finite if and only if it is finitely generated. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_finite_iff_fg (L109-L119)\nlemma spanRank_finite_iff_fg {p : Submodule R M} : p.spanRank < aleph0 \u2194 p.FG := by\nrw [spanRank, Submodule.fg_def]\n constructor\n \u00b7 rintro h\n obtain \u27e8s, hs\u27e9 : \u2a05 (s : {s : Set M // span R s = p}), #s \u2208\n Set.range (fun (s : {s : Set M // span R s = p}) \u21a6 #s) := csInf_mem \u27e8#p, \u27e8\u27e8p, by simp\u27e9, rfl\u27e9\u27e9\n refine \u27e8s.1, ?_, s.2\u27e9\n simpa [\u2190 hs] using h\n \u00b7 rintro \u27e8s, hs\u2081, hs\u2082\u27e9\n exact (ciInf_le' _ \u27e8s, hs\u2082\u27e9).trans_lt (by simpa)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_of_not_fg (L120-L127)\nlemma spanFinrank_of_not_fg {p : Submodule R M} (hp : \u00acp.FG) : p.spanFinrank = 0 := by\nrefine toNat_eq_zero.2 ?_\n right\n by_contra! h\n exact hp (spanRank_finite_iff_fg.1 h)\n\n/-- A submodule is finitely generated if and only if its `spanRank` is equal to its `spanFinrank`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Module.SpanRank.fg_iff_spanRank_eq_spanFinrank (L128-L131)\nlemma fg_iff_spanRank_eq_spanFinrank {p : Submodule R M} : p.spanRank = p.spanFinrank \u2194 p.FG := by\nrw [spanFinrank, \u2190 spanRank_finite_iff_fg, eq_comm]\n exact cast_toNat_eq_iff_lt_aleph0\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L132-L134)\nlemma FG.spanRank_eq_spanFinrank {p : Submodule R M} (fg : p.FG) : p.spanRank = p.spanFinrank :=\nfg_iff_spanRank_eq_spanFinrank.mpr fg\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L135-L138)\nlemma FG.spanRank_le_iff {p : Submodule R M} (hp : p.FG) (n : \u2115) :\n p.spanRank \u2264 n \u2194 p.spanFinrank \u2264 n :=\n(Cardinal.toNat_le_iff_of_lt_aleph0 n (by simpa)).symm\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L139-L142)\nlemma FG.spanRank_eq_iff {p : Submodule R M} (hp : p.FG) (n : \u2115) :\n p.spanRank = n \u2194 p.spanFinrank = n :=\n(Cardinal.toNat_eq_iff_of_lt_aleph0 n (by simpa)).symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_span_le_card (L143-L147)\nlemma spanRank_span_le_card (s : Set M) : (Submodule.span R s).spanRank \u2264 #s := by\nrw [spanRank]\n let s' : {s1 : Set M // span R s1 = span R s} := \u27e8s, rfl\u27e9\n exact ciInf_le' _ s'\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_span_range_of_linearIndependent (L148-L160)\nlemma spanRank_span_range_of_linearIndependent [RankCondition R] {\u03b9 : Type u} {v : \u03b9 \u2192 M}\n (hv : v.Injective) (hs : LinearIndependent R v) :\n (span R (.range v)).spanRank = #\u03b9 := by\nrefine le_antisymm (le_trans (spanRank_span_le_card _) mk_range_le) (le_ciInf fun x \u21a6 ?_)\n have : #x.1 = #((Subtype.val : span R (.range v) \u2192 _) \u207b\u00b9' x.1) :=\n (mk_preimage_of_injective_of_subset_range _ _ Subtype.val_injective (by simp [\u2190 x.2])).symm\n rw [this]\n refine le_trans ?_ ((Module.Basis.span hs).le_span (R := R) (J := Subtype.val \u207b\u00b9' x.1) ?_)\n \u00b7 rw [mk_range_eq]\n exact .of_comp (f := Subtype.val) (by convert hv; ext; simp [Module.Basis.span_apply])\n \u00b7 apply map_injective_of_injective (f := (span R _).subtype) (injective_subtype _)\n simp [map_span, Set.image_preimage_eq_inter_range, Set.inter_eq_self_of_subset_left, \u2190 x.2]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_span_of_linearIndepOn (L161-L164)\nlemma spanRank_span_of_linearIndepOn [RankCondition R] (s : Set M) (hs : LinearIndepOn R id s) :\n (span R s).spanRank = #s := by\nsimp [\u2190 spanRank_span_range_of_linearIndependent Subtype.val_injective hs]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_span_le_encard (L165-L168)\nlemma spanFinrank_span_le_encard (s : Set M) : (span R s).spanFinrank \u2264 s.encard := by\nrw [spanFinrank, Set.encard, ENat.card]\n exact le_trans (by simp) (toENat.monotone' (spanRank_span_le_card (R := R) s))\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_span_le_ncard_of_finite (L169-L174)\nlemma spanFinrank_span_le_ncard_of_finite {s : Set M} (hs : s.Finite) :\n (span R s).spanFinrank \u2264 s.ncard := by\nrw [\u2190 Nat.cast_le (\u03b1 := \u2115\u221e)]\n exact le_trans (spanFinrank_span_le_encard _) hs.cast_ncard_eq.ge\n\n/-- Constructs a generating set with cardinality equal to the `spanRank` of the submodule -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Module.SpanRank.exists_span_set_card_eq_spanRank (L175-L183)\ntheorem exists_span_set_card_eq_spanRank (p : Submodule R M) :\n \u2203 s : Set M, #s = p.spanRank \u2227 span R s = p := by\nrw [spanRank]\n obtain \u27e8s, hs\u27e9 : \u2a05 (s : {s : Set M // span R s = p}), #s \u2208\n Set.range (fun (s : {s : Set M // span R s = p}) \u21a6 #s) := csInf_mem \u27e8#p, \u27e8\u27e8p, by simp\u27e9, rfl\u27e9\u27e9\n exact \u27e8s.1, \u27e8hs, s.2\u27e9\u27e9\n\n/-- Constructs a generating set with cardinality equal to the `spanFinrank` of the submodule when\n the submodule is finitely generated. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L184-L191)\ntheorem FG.exists_span_set_encard_eq_spanFinrank {p : Submodule R M} (h : p.FG) :\n \u2203 s : Set M, s.encard = p.spanFinrank \u2227 span R s = p := by\nobtain \u27e8s, \u27e8hs\u2081, hs\u2082\u27e9\u27e9 := exists_span_set_card_eq_spanRank p\n refine \u27e8s, \u27e8?_, hs\u2082\u27e9\u27e9\n have := fg_iff_spanRank_eq_spanFinrank.mpr h\n rw [Set.encard, ENat.card, spanFinrank, hs\u2081, this]\n simp\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Module.SpanRank.lift_spanRank_le_iff_exists_span_set_card_le (L192-L201)\nlemma lift_spanRank_le_iff_exists_span_set_card_le (p : Submodule R M) {a : Cardinal.{max u v}} :\n Cardinal.lift.{v} p.spanRank \u2264 a \u2194 \u2203 s : Set M, Cardinal.lift.{v} #s \u2264 a \u2227 span R s = p := by\nconstructor\n \u00b7 intro h\n obtain \u27e8s, \u27e8hs\u2081, hs\u2082\u27e9\u27e9 := exists_span_set_card_eq_spanRank p\n exact \u27e8s, \u27e8hs\u2081 \u25b8 h, hs\u2082\u27e9\u27e9\n \u00b7 exact fun \u27e8s, \u27e8h\u2081, h\u2082\u27e9\u27e9 \u21a6 h\u2082.symm \u25b8 (Cardinal.lift_le.mpr (spanRank_span_le_card s)).trans h\u2081\n\n/-- For a finitely generated submodule, its spanRank is less than or equal to a cardinal `a`\n if and only if there is a generating subset with cardinality less than or equal to `a`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L202-L205)\nlemma FG.spanRank_le_iff_exists_span_set_card_le (p : Submodule R M) {a : Cardinal} :\n p.spanRank \u2264 a \u2194 \u2203 s : Set M, #s \u2264 a \u2227 span R s = p := by\nconvert lift_spanRank_le_iff_exists_span_set_card_le p (a := a) <;> simp\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_eq_zero_iff_eq_bot (L207-L216)\nlemma spanRank_eq_zero_iff_eq_bot {I : Submodule R M} : I.spanRank = 0 \u2194 I = \u22a5 := by\nconstructor\n \u00b7 intro h\n obtain \u27e8s, \u27e8hs\u2081, hs\u2082\u27e9\u27e9 :=\n (FG.spanRank_le_iff_exists_span_set_card_le I (a := 0)).mp (by rw [h])\n simp only [nonpos_iff_eq_zero, mk_eq_zero_iff, Set.isEmpty_coe_sort] at hs\u2081\n simp_all\n \u00b7 rintro rfl; rw [spanRank]\n exact Cardinal.iInf_eq_zero_iff.mpr (Or.inr \u27e8\u27e8\u2205, by simp\u27e9, by simp\u27e9)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_bot (L218-L219)\nlemma spanRank_bot : (\u22a5 : Ideal R).spanRank = 0 := Submodule.spanRank_eq_zero_iff_eq_bot.mpr rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_bot (L221-L226)\nlemma spanFinrank_bot : (\u22a5 : Submodule R M).spanFinrank = 0 := by simp [spanFinrank]\n/-- Generating elements for the submodule of minimum cardinality. -/\nnoncomputable def generators (p : Submodule R M) : Set M :=\n Classical.choose (exists_span_set_card_eq_spanRank p)\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Module.SpanRank.generators_card (L227-L229)\nlemma generators_card (p : Submodule R M) : #(generators p) = spanRank p :=\n(Classical.choose_spec (exists_span_set_card_eq_spanRank p)).1\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L230-L235)\nlemma FG.generators_ncard {p : Submodule R M} (h : p.FG) :\n (generators p).ncard = spanFinrank p := by\nrw [\u2190 Nat.cast_inj (R := Cardinal), \u2190 fg_iff_spanRank_eq_spanFinrank.mpr h, Set.ncard, Set.encard,\n ENat.card, generators_card, toNat_toENat, \u2190 spanFinrank]\n exact (fg_iff_spanRank_eq_spanFinrank.mpr h).symm\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L236-L241)\nlemma FG.finite_generators {p : Submodule R M} (hp : p.FG) :\n p.generators.Finite := by\nrw [\u2190 Cardinal.lt_aleph0_iff_set_finite, Submodule.generators_card]\n exact spanRank_finite_iff_fg.mpr hp\n\n/-- The span of the generators equals the submodule. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Module.SpanRank.span_generators (L242-L245)\nlemma span_generators (p : Submodule R M) : span R (generators p) = p :=\n(Classical.choose_spec (exists_span_set_card_eq_spanRank p)).2\n\n/-- The elements of the generators are in the submodule. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Module.Basic.invOf_two_smul_add_invOf_two_smul (L36-L40)\ntheorem invOf_two_smul_add_invOf_two_smul (R) [Semiring R] [AddCommMonoid M] [Module R M]\n [Invertible (2 : R)] (x : M) :\n (\u215f2 : R) \u2022 x + (\u215f2 : R) \u2022 x = x :=\nConvex.combo_self invOf_two_add_invOf_two _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply (L122-L127)\nlemma indicator_smul_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = r a \u2022 indicator s f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (smul_zero (r a)).symm]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_single_smul (L66-L71)\nlemma sum_single_smul\n {R : Type*} [Semiring R] [Module R \u03b1] (f : \u03b9 \u2192 \u03b1) (r : R) (i\u2080 : \u03b9) :\n \u2211 i, (Pi.single (M := fun _ \u21a6 R) i\u2080 r i) \u2022 f i = r \u2022 f i\u2080 := by\nrw [Finset.sum_eq_single i\u2080, Pi.single_eq_same] <;> aesop\n\nend Fintype\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul_neg (L142-L145)\ntheorem neg_smul_neg : -r \u2022 -x = r \u2022 x := by rw [neg_smul, smul_neg, neg_neg]\nvariable (R)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_one (L99-L100)\nlemma coe_toLinearMap_one : (\u2191(1 : M \u2243\u2097[R] M) : M \u2192\u2097[R] M) = LinearMap.id := rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.CharacterModule (L46-L49)\ndef CharacterModule : Type uA := A \u2192+ AddCircle (1 : \u211a)\nnamespace CharacterModule\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_left (L151-L154)\nlemma indicator_smul_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 indicator s r a \u2022 f a :=\nfunext <| indicator_smul_apply_left _ _ _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_eq (L75-L80)\ntheorem inv_intCast_smul_eq {E : Type*} (R S : Type*) [AddCommGroup E] [DivisionRing R]\n [DivisionRing S] [Module R E] [Module S E] (n : \u2124) (x : E) : (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_intCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over a division semiring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of natural numbers in `R`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Module.Card.mk_le_of_module (L28-L35)\ntheorem mk_le_of_module (R : Type u) (E : Type v)\n [AddCommGroup E] [Ring R] [IsDomain R] [Module R E] [Nontrivial E] [Module.IsTorsionFree R E] :\n Cardinal.lift.{v} (#R) \u2264 Cardinal.lift.{u} (#E) := by\nobtain \u27e8x, hx\u27e9 : \u2203 (x : E), x \u2260 0 := exists_ne 0\n have : Injective (fun k \u21a6 k \u2022 x) := smul_left_injective R hx\n exact lift_mk_le_lift_mk_of_injective this\n\nend Cardinal\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Module.Defs.two_smul (L81-L104)\ntheorem two_smul : (2 : R) \u2022 x = x + x := by rw [\u2190 one_add_one_eq_two, add_smul, one_smul]\n/-- Pullback a `Module` structure along an injective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Injective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M\u2082 \u2192+ M)\n (hf : Injective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { hf.distribMulAction f smul with\n add_smul := fun c\u2081 c\u2082 x => hf <| by simp only [smul, f.map_add, add_smul]\n zero_smul := fun x => hf <| by simp only [smul, zero_smul, f.map_zero] }\n\n/-- Pushforward a `Module` structure along a surjective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Surjective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M \u2192+ M\u2082)\n (hf : Surjective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { toDistribMulAction := hf.distribMulAction f smul\n add_smul := fun c\u2081 c\u2082 x => by\n rcases hf x with \u27e8x, rfl\u27e9\n simp only [add_smul, \u2190 smul, \u2190 f.map_add]\n zero_smul := fun x => by\n rcases hf x with \u27e8x, rfl\u27e9\n rw [\u2190 f.map_zero, \u2190 smul, zero_smul] }\n\nvariable {R}\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul_apply (L132-L135)\nlemma indicator_const_smul_apply (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (r \u2022 f \u00b7) a = r \u2022 indicator s f a :=\nindicator_smul_apply s (fun _ \u21a6 r) f a\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_mul (L102-L105)\nlemma coe_toLinearMap_mul {e\u2081 e\u2082 : M \u2243\u2097[R] M} :\n (\u2191(e\u2081 * e\u2082) : M \u2192\u2097[R] M) = (e\u2081 : M \u2192\u2097[R] M) * (e\u2082 : M \u2192\u2097[R] M) :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_of_injective (L103-L109)\nlemma dual_surjective_of_injective (f : A \u2192\u2097[R] B) (hf : Function.Injective f) :\n Function.Surjective (dual f) :=\n(Module.Baer.of_divisible _).extension_property_addMonoidHom _ hf\n\n/--\nTwo isomorphic modules have isomorphic character modules.\n-/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Finset (L38-L40)\ntheorem Finset.sum_smul {f : \u03b9 \u2192 R} {s : Finset \u03b9} {x : M} :\n (\u2211 i \u2208 s, f i) \u2022 x = \u2211 i \u2208 s, f i \u2022 x := map_sum ((smulAddHom R M).flip x) f s\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Module.End.IsAddUnit (L62-L67)\nlemma IsAddUnit.smul_left [DistribSMul S M] (hx : IsAddUnit x) (s : S) :\n IsAddUnit (s \u2022 x) :=\nhx.map (DistribSMul.toAddMonoidHom M s)\n\nvariable {r} (x)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_injective (L55-L58)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : (M \u2243\u2097[S] M\u2082) \u2192 M \u2243\u2097[R] M\u2082) := fun _ _ h \u21a6\next (LinearEquiv.congr_fun h :)\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Module.Basic.Units (L31-L34)\ntheorem Units.neg_smul [Ring R] [AddCommGroup M] [Module R M] (u : R\u02e3) (x : M) :\n -u \u2022 x = -(u \u2022 x) := by\nrw [Units.smul_def, Units.val_neg, _root_.neg_smul, Units.smul_def]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.addConGen' (L64-L81)\ndef addConGen' (r : M \u2192 M \u2192 Prop) (hr : \u2200 (s : S) {m m'}, r m m' \u2192 r (s \u2022 m) (s \u2022 m')) :\n ModuleCon S M where\n toAddCon := addConGen r\nsmul s _ _ h := ((addConGen r).comap (DistribSMul.toAddMonoidHom M s) <| by simp).addConGen_le\n (fun _ _ h \u21a6 .of _ _ (hr s h)) h\n\n/-- The `AddCon` generated by a `SMulCon` is a `ModuleCon`. -/\nprotected abbrev addConGen (c : SMulCon S M) : ModuleCon S M := addConGen' c.r c.smul\n\nend addConGen\n\nend SMulCon\n\nnamespace ModuleCon\n\n/-- The quotient by a congruence relation preserving addition and scalar multiplication. -/\nprotected def Quotient [Add M] [SMul S M] (c : ModuleCon S M) : Type _ := Quotient c.toSetoid\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem (L91-L94)\ntheorem smul_mem (p : Submodule (A \u2297[R] B) M) (a : A) {m : M} (hm : m \u2208 p) : a \u2022 m \u2208 p := by\nsuffices a \u2022 m = a \u2297\u209c[R] (1 : B) \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom_apply (L57-L61)\ntheorem smulAddHom_apply : smulAddHom R M r x = r \u2022 x :=\nrfl\n\nvariable {x}\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_pow (L106-L107)\ntheorem coe_pow (e : M \u2243\u2097[R] M) (n : \u2115) : \u21d1(e ^ n) = e^[n] := hom_coe_pow _ rfl (fun _ _ \u21a6 rfl) _ _\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_right (L101-L104)\nlemma support_smul_subset_right [Zero M] [SMulZeroClass R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support g :=\nfun x hbf hf \u21a6 hbf <| by rw [Pi.smul_apply', hf, smul_zero]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_of_surjective (L95-L102)\nlemma dual_injective_of_surjective (f : A \u2192\u2097[R] B) (hf : Function.Surjective f) :\n Function.Injective (dual f) := by\nintro \u03c6 \u03c8 eq\n ext x\n obtain \u27e8y, rfl\u27e9 := hf x\n change (dual f) \u03c6 _ = (dual f) \u03c8 _\n rw [eq]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.exists_character_apply_ne_zero_of_ne_zero (L215-L219)\nlemma exists_character_apply_ne_zero_of_ne_zero {a : A} (ne_zero : a \u2260 0) :\n \u2203 (c : CharacterModule A), c a \u2260 0 :=\nhave \u27e8c, hc\u27e9 := dual_surjective_of_injective _ (Submodule.injective_subtype _) (ofSpanSingleton a)\n \u27e8c, fun h \u21a6 ne_zero <| eq_zero_of_ofSpanSingleton_apply_self a <| by rwa [\u2190 hc]\u27e9\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars (L48-L54)\ndef restrictScalars (f : M \u2243\u2097[S] M\u2082) : M \u2243\u2097[R] M\u2082 :=\n{ f.toLinearMap.restrictScalars R with\n toFun := f\n invFun := f.symm\n left_inv := f.left_inv\n right_inv := f.right_inv }\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule (L109-L114)\ndef toSubmodule (p : Submodule (A \u2297[R] B) M) : Submodule A M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem p }\n\n/-- Forgetting the `A` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `B`. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom (L51-L55)\ndef smulAddHom : R \u2192+ M \u2192+ M :=\n(Module.toAddMonoidEnd R M).toAddMonoidHom\n\nvariable {R M}\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Module.End.AddMonoid (L32-L41)\ntheorem AddMonoid.End.natCast_def (n : \u2115) :\n (\u2191n : AddMonoid.End M) = DistribMulAction.toAddMonoidEnd \u2115 M n :=\nrfl\n\nvariable (R M)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- `(\u2022)` as an `AddMonoidHom`.\n\nThis is a stronger version of `DistribMulAction.toAddMonoidEnd` -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Module.Bimodule.mk (L82-L90)\ndef mk (p : AddSubmonoid M) (hA : \u2200 (a : A) {m : M}, m \u2208 p \u2192 a \u2022 m \u2208 p)\n (hB : \u2200 (b : B) {m : M}, m \u2208 p \u2192 b \u2022 m \u2208 p) : Submodule (A \u2297[R] B) M :=\n{ p with\n carrier := p\n smul_mem' := fun ab m =>\n TensorProduct.induction_on ab (fun _ => by simp only [zero_smul, SetLike.mem_coe, zero_mem])\n (fun a b hm => by simpa only [TensorProduct.Algebra.smul_def] using hA a (hB b hm))\n fun z w hz hw hm => by simpa only [add_smul] using p.add_mem (hz hm) (hw hm) }\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Fintype (L45-L51)\nlemma Fintype.sum_smul_sum [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2192 R) (g : \u03b2 \u2192 M) :\n (\u2211 i, f i) \u2022 \u2211 j, g j = \u2211 i, \u2211 j, f i \u2022 g j := Finset.sum_smul_sum _ _\nend AddCommMonoid\n\nopen Finset\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_character_apply (L220-L224)\nlemma eq_zero_of_character_apply {a : A} (h : \u2200 c : CharacterModule A, c a = 0) : a = 0 := by\ncontrapose! h; exact exists_character_apply_ne_zero_of_ne_zero h\n\nvariable [Module R A] [Module R A'] [Module R B] {R A' B}\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul (L128-L131)\nlemma indicator_smul (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 r a \u2022 indicator s f a :=\nfunext <| indicator_smul_apply s r f\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Module.Basic.smul_indicator_one_apply (L168-L173)\nlemma smul_indicator_one_apply (s : Set \u03b1) (r : R) (a : \u03b1) :\n r \u2022 s.indicator (1 : \u03b1 \u2192 R) a = s.indicator (fun _ \u21a6 r) a := by\nsimp_rw [\u2190 indicator_const_smul_apply, Pi.one_apply, smul_eq_mul, mul_one]\n\nend MulZeroOneClass\nend Set\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule' (L116-L129)\ndef toSubmodule' (p : Submodule (A \u2297[R] B) M) : Submodule B M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem' p }\n\nend Algebra\n\nsection Ring\n\nvariable (R S M : Type*) [Ring R] [Ring S]\nvariable [AddCommGroup M] [Module R M] [Module S M] [SMulCommClass R S M]\n\n/-- A `Submodule` over `R \u2297[\u2115] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2124] S`. -/\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Module.Defs.Convex (L76-L80)\ntheorem Convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a \u2022 x + b \u2022 x = x := by\nrw [\u2190 add_smul, h, one_smul]\n\nvariable (R)\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem' (L95-L100)\ntheorem smul_mem' (p : Submodule (A \u2297[R] B) M) (b : B) {m : M} (hm : m \u2208 p) : b \u2022 m \u2208 p := by\nsuffices b \u2022 m = (1 : A) \u2297\u209c[R] b \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n\n/-- If `A` and `B` are also `Algebra`s over yet another set of scalars `S` then we may \"base change\"\nfrom `R` to `S`. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_comm (L88-L94)\ntheorem inv_intCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommGroup E] [DivisionRing R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2124) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_intCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\nnamespace Function\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const (L158-L167)\nlemma indicator_smul_const (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) :\n indicator s (r \u00b7 \u2022 m) = (indicator s r \u00b7 \u2022 m) :=\nfunext <| indicator_smul_const_apply _ _ _\n\nend SMulWithZero\n\nsection MulZeroOneClass\n\nvariable [MulZeroOneClass R]\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_iff_surjective (L246-L249)\nlemma dual_injective_iff_surjective {f : A \u2192\u2097[R] A'} :\n Function.Injective (dual f) \u2194 Function.Surjective f :=\n\u27e8fun h \u21a6 surjective_of_dual_injective f h, fun h \u21a6 dual_injective_of_surjective f h\u27e9\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_one (L94-L95)\nlemma coe_one : \u2191(1 : M \u2243\u2097[R] M) = id := rfl\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_zero (L86-L89)\nlemma dual_zero : dual (0 : A \u2192\u2097[R] B) = 0 := by\next f\n exact map_zero f\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply_left (L145-L150)\nlemma indicator_smul_apply_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = indicator s r a \u2022 f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (zero_smul _ (f a)).symm]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_piFinset_apply (L58-L64)\nlemma sum_piFinset_apply (f : \u03ba \u2192 \u03b1) (s : Finset \u03ba) (i : \u03b9) :\n \u2211 g \u2208 piFinset fun _ : \u03b9 \u21a6 s, f (g i) = #s ^ (card \u03b9 - 1) \u2022 \u2211 b \u2208 s, f b := by\nclassical\n rw [Finset.sum_comp]\n simp only [eval_image_piFinset_const, card_filter_piFinset_const s, ite_smul, zero_smul, smul_sum,\n Finset.sum_ite_mem, inter_self]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Module.Defs.add_smul (L73-L75)\ntheorem add_smul : (r + s) \u2022 x = r \u2022 x + s \u2022 x :=\nModule.add_smul r s x\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.ModuleCon (L148-L160)\ndef ModuleCon.ker [Monoid R] [Monoid S] [AddMonoid M] [AddMonoid N] [DistribMulAction R M]\n [DistribMulAction S N] {\u03c6 : R \u2192* S} (f : M \u2192\u2091+[\u03c6] N) : ModuleCon R M where\n __ := SMulCon.ker f.toMulActionHom\n__ := AddCon.ker f\n\n/-- The first isomorphism theorem for semimodules in the case of a surjective homomorphism. -/\nnoncomputable def ModuleCon.quotientKerEquivOfSurjective [Semiring S] [AddCommMonoid M]\n [AddCommMonoid N] [Module S M] [Module S N] (f : M \u2192\u2097[S] N) (hf : Function.Surjective f) :\n (ker f.toDistribMulActionHom).Quotient \u2243\u2097[S] N where\n __ := AddCon.quotientKerEquivOfSurjective f.toAddMonoidHom hf\n map_smul' s := by rintro \u27e8\u27e9; apply map_smul f\n\nend ker\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul (L136-L144)\nlemma indicator_const_smul (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) :\n indicator s (r \u2022 f \u00b7) = (r \u2022 indicator s f \u00b7) :=\nfunext <| indicator_const_smul_apply s r f\n\nend SMulZeroClass\n\nsection SMulWithZero\nvariable [Zero R] [Zero M] [SMulWithZero R M]\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion (L64-L75)\ntheorem isInternal_prime_power_torsion [Module.Finite R M]\n (hM : Module.IsTorsion R M) :\n DirectSum.IsInternal fun p : (factors (\u22a4 : Submodule R M).annihilator).toFinset =>\n torsionBySet R M (p ^ (factors (\u22a4 : Submodule R M).annihilator).count \u2191p : Ideal R) := by\nhave hM' := Module.isTorsionBySet_annihilator_top R M\n have hI := Submodule.annihilator_top_inter_nonZeroDivisors hM\n refine isInternal_prime_power_torsion_of_is_torsion_by_ideal ?_ hM'\n rw [Submodule.ne_bot_iff]\n obtain \u27e8x, H, hx\u27e9 := hI; exact \u27e8x, H, nonZeroDivisors.ne_zero hx\u27e9\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules for some prime ideals `p i` and numbers `e i`. -/\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.automorphismGroup (L81-L89)\ninstance automorphismGroup : Group (M \u2243\u2097[R] M) where\n mul f g := g.trans f\none := LinearEquiv.refl R M\n inv f := f.symm\n mul_assoc _ _ _ := rfl\n mul_one _ := ext fun _ \u21a6 rfl\n one_mul _ := ext fun _ \u21a6 rfl\n inv_mul_cancel f := ext <| f.left_inv\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const_apply (L155-L157)\nlemma indicator_smul_const_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) (a : \u03b1) :\n indicator s (r \u00b7 \u2022 m) a = indicator s r a \u2022 m := indicator_smul_apply_left _ _ _ _\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_rTensor_conj_homEquiv (L147-L171)\ntheorem dual_rTensor_conj_homEquiv (f : A \u2192\u2097[R] A') :\n homEquiv.symm.toLinearMap \u2218\u2097 dual (f.rTensor B) \u2218\u2097 homEquiv.toLinearMap = f.lcomp R _ := rfl\nend module\n\n/--\n`\u2124\u22c6`, the character module of `\u2124` in the unit rational circle.\n-/\nprotected abbrev int : Type := CharacterModule \u2124\n\n/-- Given `n : \u2115`, the map `m \u21a6 m / n`. -/\nprotected abbrev int.divByNat (n : \u2115) : CharacterModule.int :=\n LinearMap.toSpanSingleton \u2124 _ (QuotientAddGroup.mk (n : \u211a)\u207b\u00b9) |>.toAddMonoidHom\n\nprotected lemma int.divByNat_self (n : \u2115) :\n int.divByNat n n = 0 := by\n obtain rfl | h0 := eq_or_ne n 0\n \u00b7 apply map_zero\n exact (AddCircle.coe_eq_zero_iff _).mpr\n \u27e81, by simp [mul_inv_cancel\u2080 (Nat.cast_ne_zero (R := \u211a).mpr h0)]\u27e9\n\nvariable {A}\n\n/-- The `\u2124`-submodule spanned by a single element `a` is isomorphic to the quotient of `\u2124`\nby the ideal generated by the order of `a`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Multiset (L29-L31)\ntheorem Multiset.sum_smul {l : Multiset R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\n((smulAddHom R M).flip x).map_multiset_sum l\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_intCast_smul (L58-L67)\ntheorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]\n [Module S M\u2082] (z : \u2124) (x : M) : f ((z\u207b\u00b9 : R) \u2022 x) = (z\u207b\u00b9 : S) \u2022 f x := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]\n \u00b7 simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,\n map_inv_natCast_smul _ R S]\n\n/-- If `E` is a vector space over two division semirings `R` and `S`, then scalar multiplications\nagree on inverses of natural numbers in `R` and `S`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Module.Defs.smul_add_one_sub_smul (L109-L117)\ntheorem smul_add_one_sub_smul {R : Type*} [Ring R] [Module R M] {r : R} {m : M} :\n r \u2022 m + (1 - r) \u2022 m = m := by rw [\u2190 add_smul, add_sub_cancel, one_smul]\nend AddCommMonoid\n\nsection AddCommGroup\n\nvariable [Semiring R] [AddCommGroup M]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.surjective_of_dual_injective (L236-L245)\nlemma surjective_of_dual_injective (f : A \u2192\u2097[R] A') (hf : Function.Injective (dual f)) :\n Function.Surjective f := by\nrw [\u2190 LinearMap.range_eq_top, \u2190 Submodule.unique_quotient_iff_eq_top]\n refine \u27e8Unique.mk inferInstance fun a \u21a6 eq_zero_of_character_apply fun c \u21a6 ?_\u27e9\n obtain \u27e8b, rfl\u27e9 := QuotientAddGroup.mk'_surjective _ a\n suffices eq : dual (Submodule.mkQ _) c = 0 from congr($eq b)\n refine hf ?_\n rw [\u2190 LinearMap.comp_apply, \u2190 dual_comp, LinearMap.range_mkQ_comp, dual_zero,\n LinearMap.zero_apply, dual_apply, AddMonoidHom.zero_comp]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.congr (L110-L119)\ndef congr (e : A \u2243\u2097[R] B) : CharacterModule A \u2243\u2097[R] CharacterModule B :=\n.ofLinear (dual e.symm) (dual e)\n (by ext c _; exact congr(c $(e.right_inv _)))\n (by ext c _; exact congr(c $(e.left_inv _)))\n\nopen TensorProduct\n\n/--\nAny linear map `L : A \u2192 B\u22c6` induces a character in `(A \u2297 B)\u22c6` by `a \u2297 b \u21a6 L a b`.\n-/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.one_eq_refl (L90-L90)\nlemma one_eq_refl : (1 : M \u2243\u2097[R] M) = refl R M := rfl\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.exists_isInternal_prime_power_torsion (L76-L83)\ntheorem exists_isInternal_prime_power_torsion [Module.Finite R M] (hM : Module.IsTorsion R M) :\n \u2203 (P : Finset <| Ideal R) (_ : DecidableEq P) (_ : \u2200 p \u2208 P, Prime p) (e : P \u2192 \u2115),\n DirectSum.IsInternal fun p : P => torsionBySet R M (p ^ e p : Ideal R) := by\nclassical\n exact \u27e8_, _, fun p hp => prime_of_factor p (Multiset.mem_toFinset.mp hp), _,\n isInternal_prime_power_torsion hM\u27e9\n\nend Submodule\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Module.Defs.sub_smul (L150-L166)\ntheorem sub_smul (r s : R) (y : M) : (r - s) \u2022 y = r \u2022 y - s \u2022 y := by\nsimp [add_smul, sub_eq_add_neg]\n\nend Module\n\n/-- A module over a `Subsingleton` semiring is a `Subsingleton`. We cannot register this\nas an instance because Lean has no way to guess `R`. -/\nprotected theorem Module.subsingleton (R M : Type*) [MonoidWithZero R] [Subsingleton R] [Zero M]\n [MulActionWithZero R M] : Subsingleton M :=\n MulActionWithZero.subsingleton R M\n\n/-- A semiring is `Nontrivial` provided that there exists a nontrivial module over this semiring. -/\nprotected theorem Module.nontrivial (R M : Type*) [MonoidWithZero R] [Nontrivial M] [Zero M]\n [MulActionWithZero R M] : Nontrivial R :=\n MulActionWithZero.nontrivial R M\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_bijective_iff_bijective (L250-L255)\nlemma dual_bijective_iff_bijective {f : A \u2192\u2097[R] A'} :\n Function.Bijective (dual f) \u2194 Function.Bijective f :=\n\u27e8fun h \u21a6 \u27e8dual_surjective_iff_injective.mp h.2, dual_injective_iff_surjective.mp h.1\u27e9,\n fun h \u21a6 \u27e8dual_injective_iff_surjective.mpr h.2, dual_surjective_iff_injective.mpr h.1\u27e9\u27e9\n\nend CharacterModule\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Algebra.Module.Bimodule.baseChange (L102-L107)\ndef baseChange (S : Type*) [CommSemiring S] [Module S M] [Algebra S A] [Algebra S B]\n [IsScalarTower S A M] [IsScalarTower S B M] (p : Submodule (A \u2297[R] B) M) :\n Submodule (A \u2297[S] B) M :=\nmk p.toAddSubmonoid (smul_mem p) (smul_mem' p)\n\n/-- Forgetting the `B` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `A`. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_subset (L113-L121)\nlemma support_const_smul_subset [Zero M] [SMulZeroClass R M] (a : R) (f : \u03b1 \u2192 M) :\n support (a \u2022 f) \u2286 support f := support_smul_subset_right (fun _ \u21a6 a) f\nend Function\n\nnamespace Set\nsection SMulZeroClass\nvariable [Zero M] [SMulZeroClass R M]\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleInt (L131-L135)\ndef toSubbimoduleInt (p : Submodule (R \u2297[\u2115] S) M) : Submodule (R \u2297[\u2124] S) M :=\nbaseChange \u2124 p\n\n/-- A `Submodule` over `R \u2297[\u2124] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2115] S`. -/\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Algebra.Module.BigOperators.List (L26-L28)\ntheorem List.sum_smul {l : List R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\nmap_list_sum ((smulAddHom R M).flip x) l\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion_of_is_torsion_by_ideal (L37-L63)\ntheorem isInternal_prime_power_torsion_of_is_torsion_by_ideal\n {I : Ideal R} (hI : I \u2260 \u22a5) (hM : Module.IsTorsionBySet R M I) :\n DirectSum.IsInternal fun p : (factors I).toFinset =>\n torsionBySet R M (p ^ (factors I).count \u2191p : Ideal R) := by\nlet P := factors I\n have prime_of_mem := fun p (hp : p \u2208 P.toFinset) =>\n prime_of_factor p (Multiset.mem_toFinset.mp hp)\n apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _\n \u00b7 convert hM\n rw [\u2190 Finset.inf_eq_iInf, IsDedekindDomain.inf_pow_eq_prod_of_prime,\n \u2190 Finset.prod_multiset_count, \u2190 associated_iff_eq]\n \u00b7 exact factors_prod hI\n \u00b7 exact prime_of_mem\n \u00b7 exact fun _ _ _ _ ij => ij\n \u00b7 intro p hp q hq pq; dsimp\n rw [irreducible_pow_sup]\n \u00b7 suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]\n rw [Multiset.count_eq_zero,\n normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,\n Multiset.mem_replicate]\n exact fun H => pq <| H.2.trans <| normalize_eq q\n \u00b7 rw [\u2190 Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero\n \u00b7 exact (prime_of_mem p hp).irreducible\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules where `p i` are factors of `(\u22a4 : Submodule R M).annihilator` and\n`e i` are their multiplicities. -/\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_one_smul (L146-L149)\ntheorem neg_one_smul (x : M) : (-1 : R) \u2022 x = -x := by simp\nvariable {R}\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.SMulCon (L143-L147)\ndef SMulCon.ker [SMul R M] [SMul S N] {\u03c6 : R \u2192 S} (f : M \u2192\u2091[\u03c6] N) : SMulCon R M where\n __ := Setoid.ker f\nsmul r _ _ h := by rw [Setoid.ker_def] at h \u22a2; simp_rw [map_smul\u209b\u2097, h]\n\n/-- The kernel of a `DistribMulActionHom` as a congruence relation. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_of_ne_zero (L105-L108)\nlemma support_const_smul_of_ne_zero [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (c : R) (g : \u03b1 \u2192 M) (hc : c \u2260 0) : support (c \u2022 g) = support g :=\next fun _ \u21a6 smul_ne_zero_iff_right hc\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_ofSpanSingleton_apply_self (L201-L214)\nlemma eq_zero_of_ofSpanSingleton_apply_self (a : A)\n (h : ofSpanSingleton a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 = 0) : a = 0 := by\nerw [ofSpanSingleton, LinearMap.toAddMonoidHom_coe, LinearMap.comp_apply,\n intSpanEquivQuotAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,\n AddMonoidHom.coe_toIntLinearMap, int.divByNat, LinearMap.toSpanSingleton_apply_one,\n AddCircle.coe_eq_zero_iff] at h\n rcases h with \u27e8n, hn\u27e9\n apply_fun Rat.den at hn\n rw [zsmul_one, Rat.den_intCast, Rat.inv_natCast_den_of_pos] at hn\n \u00b7 split_ifs at hn\n \u00b7 cases hn\n \u00b7 rwa [eq_comm, AddMonoid.addOrderOf_eq_one_iff] at hn\n \u00b7 grind\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleNat (L137-L142)\ndef toSubbimoduleNat (p : Submodule (R \u2297[\u2124] S) M) : Submodule (R \u2297[\u2115] S) M :=\nbaseChange \u2115 p\n\nend Ring\n\nend Subbimodule\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.intSpanEquivQuotAddOrderOf_apply_self (L181-L200)\nlemma intSpanEquivQuotAddOrderOf_apply_self (a : A) :\n intSpanEquivQuotAddOrderOf a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 =\n Submodule.Quotient.mk 1 :=\n(LinearEquiv.eq_symm_apply _).mp <| Subtype.ext (one_zsmul _).symm\n\n/--\nFor an abelian group `A` and an element `a \u2208 A`, there is a character `c : \u2124 \u2219 a \u2192 \u211a \u29f8 \u2124` given by\n`m \u2022 a \u21a6 m / n` where `n` is the smallest positive integer such that `n \u2022 a = 0` and when such `n`\ndoes not exist, `c` is defined by `m \u2022 a \u21a6 m / 2`.\n-/\nnoncomputable def ofSpanSingleton (a : A) : CharacterModule (\u2124 \u2219 a) :=\n let l : \u2124 \u29f8 Ideal.span {(addOrderOf a : \u2124)} \u2192\u2097[\u2124] AddCircle (1 : \u211a) :=\n Submodule.liftQSpanSingleton _\n (CharacterModule.int.divByNat <|\n if addOrderOf a = 0 then 2 else addOrderOf a).toIntLinearMap <| by\n split_ifs with h\n \u00b7 rw [h, Nat.cast_zero, map_zero]\n \u00b7 apply CharacterModule.int.divByNat_self\n l \u2218\u2097 intSpanEquivQuotAddOrderOf a |>.toAddMonoidHom\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul (L109-L112)\nlemma support_smul [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) : support (f \u2022 g) = support f \u2229 support g :=\next fun _ => smul_ne_zero_iff\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_comp (L90-L94)\nlemma dual_comp {C : Type*} [AddCommGroup C] [Module R C] (f : A \u2192\u2097[R] B) (g : B \u2192\u2097[R] C) :\n dual (g.comp f) = (dual f).comp (dual g) := by\next\n rfl\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul (L139-L141)\ntheorem neg_smul : -r \u2022 x = -(r \u2022 x) :=\neq_neg_of_add_eq_zero_left <| by rw [\u2190 add_smul, neg_add_cancel, zero_smul]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_comm (L81-L87)\ntheorem inv_natCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2115) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_natCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\n/-- If `E` is a vector space over a division ring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of integers in `R` -/\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_left (L95-L100)\nlemma support_smul_subset_left [Zero R] [Zero M] [SMulWithZero R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support f := fun x hfg hf \u21a6\nhfg <| by rw [Pi.smul_apply', hf, zero_smul]\n\n-- Changed (2024-01-21): this lemma was generalised;\n-- the old version is now called `support_const_smul_subset`.\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_natCast_smul (L41-L57)\ntheorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*)\n [DivisionSemiring R] [DivisionSemiring S] [Module R M]\n [Module S M\u2082] (n : \u2115) (x : M) : f ((n\u207b\u00b9 : R) \u2022 x) = (n\u207b\u00b9 : S) \u2022 f x := by\nby_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0\n \u00b7 simp [hR, hS, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by rw [this, this, smul_zero]\n clear x\n intro x\n rw [\u2190 inv_smul_smul\u2080 hS (f x), \u2190 map_natCast_smul f R S]\n simp [hR, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by simp [this]\n clear x\n intro x\n rw [\u2190 smul_inv_smul\u2080 hR x, map_natCast_smul f R S, hS, zero_smul]\n \u00b7 rw [\u2190 inv_smul_smul\u2080 hS (f _), \u2190 map_natCast_smul f R S, smul_inv_smul\u2080 hR]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.mul_eq_trans (L91-L92)\nlemma mul_eq_trans (f g : M \u2243\u2097[R] M) : f * g = g.trans f := rfl\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_eq (L68-L74)\ntheorem inv_natCast_smul_eq {E : Type*} (R S : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [DivisionSemiring S] [Module R E] [Module S E] (n : \u2115) (x : E) :\n (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_natCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over two division rings `R` and `S`, then scalar multiplications\nagree on inverses of integer numbers in `R` and `S`. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_iff_injective (L225-L230)\nlemma dual_surjective_iff_injective {f : A \u2192\u2097[R] A'} :\n Function.Surjective (dual f) \u2194 Function.Injective f :=\n\u27e8fun h \u21a6 (injective_iff_map_eq_zero _).2 fun a h0 \u21a6 eq_zero_of_character_apply fun c \u21a6 by\n obtain \u27e8c, rfl\u27e9 := h c; exact congr(c $h0).trans c.map_zero,\n dual_surjective_of_injective f\u27e9\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_inj (L60-L65)\ntheorem restrictScalars_inj (f g : M \u2243\u2097[S] M\u2082) :\n f.restrictScalars R = g.restrictScalars R \u2194 f = g :=\n(restrictScalars_injective R).eq_iff\n\nend RestrictScalars\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.Algebra.Module.SpanRank).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma Module.Basis.mk_eq_spanRank [RankCondition R] {\u03b9 : Type*} (v : Basis \u03b9 R M) :\n #(Set.range v) = (\u22a4 : Submodule R M).spanRank\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_encard (L72-L87)\nlemma spanRank_toENat_eq_iInf_encard (p : Submodule R M) : p.spanRank.toENat =\n (\u2a05 (s : Set M) (_ : span R s = p), s.encard) := by\nrw [spanRank]\n apply le_antisymm\n \u00b7 refine le_iInf\u2082 (fun s hs \u21a6 ?_)\n rw [Set.encard, ENat.card]\n exact toENat.monotone' (ciInf_le' _ (\u27e8s, hs\u27e9 : {s : Set M // span R s = p}))\n \u00b7 have := congrFun toENat_comp_ofENat.{u}.symm (\u2a05 (s : Set M) (_ : span R s = p), s.encard)\n rw [id_eq] at this; rw [this]\n refine toENat.monotone' (le_ciInf fun s \u21a6 ?_)\n have : ofENat.{u} (\u2a05 (s' : Set M), \u2a05 (_ : span R s' = p), s'.encard) \u2264 ofENat s.1.encard :=\n ofENatHom.monotone' (le_trans (ciInf_le' _ s.1) (ciInf_le' _ s.2))\n apply le_trans this\n rw [Set.encard, ENat.card]\n exact Cardinal.ofENat_toENat_le _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_finset_card (L88-L102)\nlemma spanRank_toENat_eq_iInf_finset_card (p : Submodule R M) :\n p.spanRank.toENat = \u2a05 (s : {s : Finset M // span R s = p}), (s.1.card : \u2115\u221e) := by\nrw [spanRank_toENat_eq_iInf_encard]\n rcases eq_or_ne (\u2a05 (s : Set M) (_ : span R s = p), s.encard) \u22a4 with (h1 | h2)\n \u00b7 rw [h1, eq_comm]; simp_rw [iInf_eq_top] at h1 \u22a2\n exact fun s \u21a6 False.elim (Set.encard_ne_top_iff.mpr s.1.finite_toSet (h1 s.1 s.2))\n \u00b7 simp_rw [\u2190 Set.encard_coe_eq_coe_finsetCard]\n apply le_antisymm\n \u00b7 exact le_iInf fun s \u21a6 iInf\u2082_le (s.1 : Set M) s.2\n \u00b7 refine le_iInf fun s \u21a6 le_iInf fun h \u21a6 ?_\n by_cases hs : s.Finite\n \u00b7 exact iInf_le_of_le \u27e8hs.toFinset, by simpa\u27e9 (by simp)\n \u00b7 rw [Set.Infinite.encard_eq hs]\n exact OrderTop.le_top _\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_eq_iInf (L103-L107)\nlemma spanFinrank_eq_iInf (p : Submodule R M) :\n p.spanFinrank = \u2a05 (s : {s : Finset M // span R s = p}), s.1.card := by\nsimp [spanFinrank, Cardinal.toNat, spanRank_toENat_eq_iInf_finset_card, ENat.iInf_toNat]\n\n/-- A submodule's `spanRank` is finite if and only if it is finitely generated. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_finite_iff_fg (L109-L119)\nlemma spanRank_finite_iff_fg {p : Submodule R M} : p.spanRank < aleph0 \u2194 p.FG := by\nrw [spanRank, Submodule.fg_def]\n constructor\n \u00b7 rintro h\n obtain \u27e8s, hs\u27e9 : \u2a05 (s : {s : Set M // span R s = p}), #s \u2208\n Set.range (fun (s : {s : Set M // span R s = p}) \u21a6 #s) := csInf_mem \u27e8#p, \u27e8\u27e8p, by simp\u27e9, rfl\u27e9\u27e9\n refine \u27e8s.1, ?_, s.2\u27e9\n simpa [\u2190 hs] using h\n \u00b7 rintro \u27e8s, hs\u2081, hs\u2082\u27e9\n exact (ciInf_le' _ \u27e8s, hs\u2082\u27e9).trans_lt (by simpa)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_of_not_fg (L120-L127)\nlemma spanFinrank_of_not_fg {p : Submodule R M} (hp : \u00acp.FG) : p.spanFinrank = 0 := by\nrefine toNat_eq_zero.2 ?_\n right\n by_contra! h\n exact hp (spanRank_finite_iff_fg.1 h)\n\n/-- A submodule is finitely generated if and only if its `spanRank` is equal to its `spanFinrank`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Module.SpanRank.fg_iff_spanRank_eq_spanFinrank (L128-L131)\nlemma fg_iff_spanRank_eq_spanFinrank {p : Submodule R M} : p.spanRank = p.spanFinrank \u2194 p.FG := by\nrw [spanFinrank, \u2190 spanRank_finite_iff_fg, eq_comm]\n exact cast_toNat_eq_iff_lt_aleph0\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L132-L134)\nlemma FG.spanRank_eq_spanFinrank {p : Submodule R M} (fg : p.FG) : p.spanRank = p.spanFinrank :=\nfg_iff_spanRank_eq_spanFinrank.mpr fg\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L135-L138)\nlemma FG.spanRank_le_iff {p : Submodule R M} (hp : p.FG) (n : \u2115) :\n p.spanRank \u2264 n \u2194 p.spanFinrank \u2264 n :=\n(Cardinal.toNat_le_iff_of_lt_aleph0 n (by simpa)).symm\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L139-L142)\nlemma FG.spanRank_eq_iff {p : Submodule R M} (hp : p.FG) (n : \u2115) :\n p.spanRank = n \u2194 p.spanFinrank = n :=\n(Cardinal.toNat_eq_iff_of_lt_aleph0 n (by simpa)).symm\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_span_le_card (L143-L147)\nlemma spanRank_span_le_card (s : Set M) : (Submodule.span R s).spanRank \u2264 #s := by\nrw [spanRank]\n let s' : {s1 : Set M // span R s1 = span R s} := \u27e8s, rfl\u27e9\n exact ciInf_le' _ s'\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_span_range_of_linearIndependent (L148-L160)\nlemma spanRank_span_range_of_linearIndependent [RankCondition R] {\u03b9 : Type u} {v : \u03b9 \u2192 M}\n (hv : v.Injective) (hs : LinearIndependent R v) :\n (span R (.range v)).spanRank = #\u03b9 := by\nrefine le_antisymm (le_trans (spanRank_span_le_card _) mk_range_le) (le_ciInf fun x \u21a6 ?_)\n have : #x.1 = #((Subtype.val : span R (.range v) \u2192 _) \u207b\u00b9' x.1) :=\n (mk_preimage_of_injective_of_subset_range _ _ Subtype.val_injective (by simp [\u2190 x.2])).symm\n rw [this]\n refine le_trans ?_ ((Module.Basis.span hs).le_span (R := R) (J := Subtype.val \u207b\u00b9' x.1) ?_)\n \u00b7 rw [mk_range_eq]\n exact .of_comp (f := Subtype.val) (by convert hv; ext; simp [Module.Basis.span_apply])\n \u00b7 apply map_injective_of_injective (f := (span R _).subtype) (injective_subtype _)\n simp [map_span, Set.image_preimage_eq_inter_range, Set.inter_eq_self_of_subset_left, \u2190 x.2]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_span_of_linearIndepOn (L161-L164)\nlemma spanRank_span_of_linearIndepOn [RankCondition R] (s : Set M) (hs : LinearIndepOn R id s) :\n (span R s).spanRank = #s := by\nsimp [\u2190 spanRank_span_range_of_linearIndependent Subtype.val_injective hs]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_span_le_encard (L165-L168)\nlemma spanFinrank_span_le_encard (s : Set M) : (span R s).spanFinrank \u2264 s.encard := by\nrw [spanFinrank, Set.encard, ENat.card]\n exact le_trans (by simp) (toENat.monotone' (spanRank_span_le_card (R := R) s))\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_span_le_ncard_of_finite (L169-L174)\nlemma spanFinrank_span_le_ncard_of_finite {s : Set M} (hs : s.Finite) :\n (span R s).spanFinrank \u2264 s.ncard := by\nrw [\u2190 Nat.cast_le (\u03b1 := \u2115\u221e)]\n exact le_trans (spanFinrank_span_le_encard _) hs.cast_ncard_eq.ge\n\n/-- Constructs a generating set with cardinality equal to the `spanRank` of the submodule -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Module.SpanRank.exists_span_set_card_eq_spanRank (L175-L183)\ntheorem exists_span_set_card_eq_spanRank (p : Submodule R M) :\n \u2203 s : Set M, #s = p.spanRank \u2227 span R s = p := by\nrw [spanRank]\n obtain \u27e8s, hs\u27e9 : \u2a05 (s : {s : Set M // span R s = p}), #s \u2208\n Set.range (fun (s : {s : Set M // span R s = p}) \u21a6 #s) := csInf_mem \u27e8#p, \u27e8\u27e8p, by simp\u27e9, rfl\u27e9\u27e9\n exact \u27e8s.1, \u27e8hs, s.2\u27e9\u27e9\n\n/-- Constructs a generating set with cardinality equal to the `spanFinrank` of the submodule when\n the submodule is finitely generated. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L184-L191)\ntheorem FG.exists_span_set_encard_eq_spanFinrank {p : Submodule R M} (h : p.FG) :\n \u2203 s : Set M, s.encard = p.spanFinrank \u2227 span R s = p := by\nobtain \u27e8s, \u27e8hs\u2081, hs\u2082\u27e9\u27e9 := exists_span_set_card_eq_spanRank p\n refine \u27e8s, \u27e8?_, hs\u2082\u27e9\u27e9\n have := fg_iff_spanRank_eq_spanFinrank.mpr h\n rw [Set.encard, ENat.card, spanFinrank, hs\u2081, this]\n simp\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Module.SpanRank.lift_spanRank_le_iff_exists_span_set_card_le (L192-L201)\nlemma lift_spanRank_le_iff_exists_span_set_card_le (p : Submodule R M) {a : Cardinal.{max u v}} :\n Cardinal.lift.{v} p.spanRank \u2264 a \u2194 \u2203 s : Set M, Cardinal.lift.{v} #s \u2264 a \u2227 span R s = p := by\nconstructor\n \u00b7 intro h\n obtain \u27e8s, \u27e8hs\u2081, hs\u2082\u27e9\u27e9 := exists_span_set_card_eq_spanRank p\n exact \u27e8s, \u27e8hs\u2081 \u25b8 h, hs\u2082\u27e9\u27e9\n \u00b7 exact fun \u27e8s, \u27e8h\u2081, h\u2082\u27e9\u27e9 \u21a6 h\u2082.symm \u25b8 (Cardinal.lift_le.mpr (spanRank_span_le_card s)).trans h\u2081\n\n/-- For a finitely generated submodule, its spanRank is less than or equal to a cardinal `a`\n if and only if there is a generating subset with cardinality less than or equal to `a`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L202-L205)\nlemma FG.spanRank_le_iff_exists_span_set_card_le (p : Submodule R M) {a : Cardinal} :\n p.spanRank \u2264 a \u2194 \u2203 s : Set M, #s \u2264 a \u2227 span R s = p := by\nconvert lift_spanRank_le_iff_exists_span_set_card_le p (a := a) <;> simp\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_eq_zero_iff_eq_bot (L207-L216)\nlemma spanRank_eq_zero_iff_eq_bot {I : Submodule R M} : I.spanRank = 0 \u2194 I = \u22a5 := by\nconstructor\n \u00b7 intro h\n obtain \u27e8s, \u27e8hs\u2081, hs\u2082\u27e9\u27e9 :=\n (FG.spanRank_le_iff_exists_span_set_card_le I (a := 0)).mp (by rw [h])\n simp only [nonpos_iff_eq_zero, mk_eq_zero_iff, Set.isEmpty_coe_sort] at hs\u2081\n simp_all\n \u00b7 rintro rfl; rw [spanRank]\n exact Cardinal.iInf_eq_zero_iff.mpr (Or.inr \u27e8\u27e8\u2205, by simp\u27e9, by simp\u27e9)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanRank_bot (L218-L219)\nlemma spanRank_bot : (\u22a5 : Ideal R).spanRank = 0 := Submodule.spanRank_eq_zero_iff_eq_bot.mpr rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Module.SpanRank.spanFinrank_bot (L221-L226)\nlemma spanFinrank_bot : (\u22a5 : Submodule R M).spanFinrank = 0 := by simp [spanFinrank]\n/-- Generating elements for the submodule of minimum cardinality. -/\nnoncomputable def generators (p : Submodule R M) : Set M :=\n Classical.choose (exists_span_set_card_eq_spanRank p)\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Module.SpanRank.generators_card (L227-L229)\nlemma generators_card (p : Submodule R M) : #(generators p) = spanRank p :=\n(Classical.choose_spec (exists_span_set_card_eq_spanRank p)).1\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L230-L235)\nlemma FG.generators_ncard {p : Submodule R M} (h : p.FG) :\n (generators p).ncard = spanFinrank p := by\nrw [\u2190 Nat.cast_inj (R := Cardinal), \u2190 fg_iff_spanRank_eq_spanFinrank.mpr h, Set.ncard, Set.encard,\n ENat.card, generators_card, toNat_toENat, \u2190 spanFinrank]\n exact (fg_iff_spanRank_eq_spanFinrank.mpr h).symm\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Module.SpanRank.FG (L236-L241)\nlemma FG.finite_generators {p : Submodule R M} (hp : p.FG) :\n p.generators.Finite := by\nrw [\u2190 Cardinal.lt_aleph0_iff_set_finite, Submodule.generators_card]\n exact spanRank_finite_iff_fg.mpr hp\n\n/-- The span of the generators equals the submodule. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Module.SpanRank.span_generators (L242-L245)\nlemma span_generators (p : Submodule R M) : span R (generators p) = p :=\n(Classical.choose_spec (exists_span_set_card_eq_spanRank p)).2\n\n/-- The elements of the generators are in the submodule. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Module.Basic.invOf_two_smul_add_invOf_two_smul (L36-L40)\ntheorem invOf_two_smul_add_invOf_two_smul (R) [Semiring R] [AddCommMonoid M] [Module R M]\n [Invertible (2 : R)] (x : M) :\n (\u215f2 : R) \u2022 x + (\u215f2 : R) \u2022 x = x :=\nConvex.combo_self invOf_two_add_invOf_two _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply (L122-L127)\nlemma indicator_smul_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = r a \u2022 indicator s f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (smul_zero (r a)).symm]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_single_smul (L66-L71)\nlemma sum_single_smul\n {R : Type*} [Semiring R] [Module R \u03b1] (f : \u03b9 \u2192 \u03b1) (r : R) (i\u2080 : \u03b9) :\n \u2211 i, (Pi.single (M := fun _ \u21a6 R) i\u2080 r i) \u2022 f i = r \u2022 f i\u2080 := by\nrw [Finset.sum_eq_single i\u2080, Pi.single_eq_same] <;> aesop\n\nend Fintype\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul_neg (L142-L145)\ntheorem neg_smul_neg : -r \u2022 -x = r \u2022 x := by rw [neg_smul, smul_neg, neg_neg]\nvariable (R)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_one (L99-L100)\nlemma coe_toLinearMap_one : (\u2191(1 : M \u2243\u2097[R] M) : M \u2192\u2097[R] M) = LinearMap.id := rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.CharacterModule (L46-L49)\ndef CharacterModule : Type uA := A \u2192+ AddCircle (1 : \u211a)\nnamespace CharacterModule\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_left (L151-L154)\nlemma indicator_smul_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 indicator s r a \u2022 f a :=\nfunext <| indicator_smul_apply_left _ _ _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_eq (L75-L80)\ntheorem inv_intCast_smul_eq {E : Type*} (R S : Type*) [AddCommGroup E] [DivisionRing R]\n [DivisionRing S] [Module R E] [Module S E] (n : \u2124) (x : E) : (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_intCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over a division semiring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of natural numbers in `R`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Module.Card.mk_le_of_module (L28-L35)\ntheorem mk_le_of_module (R : Type u) (E : Type v)\n [AddCommGroup E] [Ring R] [IsDomain R] [Module R E] [Nontrivial E] [Module.IsTorsionFree R E] :\n Cardinal.lift.{v} (#R) \u2264 Cardinal.lift.{u} (#E) := by\nobtain \u27e8x, hx\u27e9 : \u2203 (x : E), x \u2260 0 := exists_ne 0\n have : Injective (fun k \u21a6 k \u2022 x) := smul_left_injective R hx\n exact lift_mk_le_lift_mk_of_injective this\n\nend Cardinal\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Module.Defs.two_smul (L81-L104)\ntheorem two_smul : (2 : R) \u2022 x = x + x := by rw [\u2190 one_add_one_eq_two, add_smul, one_smul]\n/-- Pullback a `Module` structure along an injective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Injective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M\u2082 \u2192+ M)\n (hf : Injective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { hf.distribMulAction f smul with\n add_smul := fun c\u2081 c\u2082 x => hf <| by simp only [smul, f.map_add, add_smul]\n zero_smul := fun x => hf <| by simp only [smul, zero_smul, f.map_zero] }\n\n/-- Pushforward a `Module` structure along a surjective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Surjective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M \u2192+ M\u2082)\n (hf : Surjective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { toDistribMulAction := hf.distribMulAction f smul\n add_smul := fun c\u2081 c\u2082 x => by\n rcases hf x with \u27e8x, rfl\u27e9\n simp only [add_smul, \u2190 smul, \u2190 f.map_add]\n zero_smul := fun x => by\n rcases hf x with \u27e8x, rfl\u27e9\n rw [\u2190 f.map_zero, \u2190 smul, zero_smul] }\n\nvariable {R}\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul_apply (L132-L135)\nlemma indicator_const_smul_apply (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (r \u2022 f \u00b7) a = r \u2022 indicator s f a :=\nindicator_smul_apply s (fun _ \u21a6 r) f a\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_mul (L102-L105)\nlemma coe_toLinearMap_mul {e\u2081 e\u2082 : M \u2243\u2097[R] M} :\n (\u2191(e\u2081 * e\u2082) : M \u2192\u2097[R] M) = (e\u2081 : M \u2192\u2097[R] M) * (e\u2082 : M \u2192\u2097[R] M) :=\nrfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_of_injective (L103-L109)\nlemma dual_surjective_of_injective (f : A \u2192\u2097[R] B) (hf : Function.Injective f) :\n Function.Surjective (dual f) :=\n(Module.Baer.of_divisible _).extension_property_addMonoidHom _ hf\n\n/--\nTwo isomorphic modules have isomorphic character modules.\n-/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Finset (L38-L40)\ntheorem Finset.sum_smul {f : \u03b9 \u2192 R} {s : Finset \u03b9} {x : M} :\n (\u2211 i \u2208 s, f i) \u2022 x = \u2211 i \u2208 s, f i \u2022 x := map_sum ((smulAddHom R M).flip x) f s\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Module.End.IsAddUnit (L62-L67)\nlemma IsAddUnit.smul_left [DistribSMul S M] (hx : IsAddUnit x) (s : S) :\n IsAddUnit (s \u2022 x) :=\nhx.map (DistribSMul.toAddMonoidHom M s)\n\nvariable {r} (x)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_injective (L55-L58)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : (M \u2243\u2097[S] M\u2082) \u2192 M \u2243\u2097[R] M\u2082) := fun _ _ h \u21a6\next (LinearEquiv.congr_fun h :)\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Module.Basic.Units (L31-L34)\ntheorem Units.neg_smul [Ring R] [AddCommGroup M] [Module R M] (u : R\u02e3) (x : M) :\n -u \u2022 x = -(u \u2022 x) := by\nrw [Units.smul_def, Units.val_neg, _root_.neg_smul, Units.smul_def]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.addConGen' (L64-L81)\ndef addConGen' (r : M \u2192 M \u2192 Prop) (hr : \u2200 (s : S) {m m'}, r m m' \u2192 r (s \u2022 m) (s \u2022 m')) :\n ModuleCon S M where\n toAddCon := addConGen r\nsmul s _ _ h := ((addConGen r).comap (DistribSMul.toAddMonoidHom M s) <| by simp).addConGen_le\n (fun _ _ h \u21a6 .of _ _ (hr s h)) h\n\n/-- The `AddCon` generated by a `SMulCon` is a `ModuleCon`. -/\nprotected abbrev addConGen (c : SMulCon S M) : ModuleCon S M := addConGen' c.r c.smul\n\nend addConGen\n\nend SMulCon\n\nnamespace ModuleCon\n\n/-- The quotient by a congruence relation preserving addition and scalar multiplication. -/\nprotected def Quotient [Add M] [SMul S M] (c : ModuleCon S M) : Type _ := Quotient c.toSetoid\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem (L91-L94)\ntheorem smul_mem (p : Submodule (A \u2297[R] B) M) (a : A) {m : M} (hm : m \u2208 p) : a \u2022 m \u2208 p := by\nsuffices a \u2022 m = a \u2297\u209c[R] (1 : B) \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom_apply (L57-L61)\ntheorem smulAddHom_apply : smulAddHom R M r x = r \u2022 x :=\nrfl\n\nvariable {x}\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_pow (L106-L107)\ntheorem coe_pow (e : M \u2243\u2097[R] M) (n : \u2115) : \u21d1(e ^ n) = e^[n] := hom_coe_pow _ rfl (fun _ _ \u21a6 rfl) _ _\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_right (L101-L104)\nlemma support_smul_subset_right [Zero M] [SMulZeroClass R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support g :=\nfun x hbf hf \u21a6 hbf <| by rw [Pi.smul_apply', hf, smul_zero]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_of_surjective (L95-L102)\nlemma dual_injective_of_surjective (f : A \u2192\u2097[R] B) (hf : Function.Surjective f) :\n Function.Injective (dual f) := by\nintro \u03c6 \u03c8 eq\n ext x\n obtain \u27e8y, rfl\u27e9 := hf x\n change (dual f) \u03c6 _ = (dual f) \u03c8 _\n rw [eq]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.exists_character_apply_ne_zero_of_ne_zero (L215-L219)\nlemma exists_character_apply_ne_zero_of_ne_zero {a : A} (ne_zero : a \u2260 0) :\n \u2203 (c : CharacterModule A), c a \u2260 0 :=\nhave \u27e8c, hc\u27e9 := dual_surjective_of_injective _ (Submodule.injective_subtype _) (ofSpanSingleton a)\n \u27e8c, fun h \u21a6 ne_zero <| eq_zero_of_ofSpanSingleton_apply_self a <| by rwa [\u2190 hc]\u27e9\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars (L48-L54)\ndef restrictScalars (f : M \u2243\u2097[S] M\u2082) : M \u2243\u2097[R] M\u2082 :=\n{ f.toLinearMap.restrictScalars R with\n toFun := f\n invFun := f.symm\n left_inv := f.left_inv\n right_inv := f.right_inv }\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule (L109-L114)\ndef toSubmodule (p : Submodule (A \u2297[R] B) M) : Submodule A M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem p }\n\n/-- Forgetting the `A` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `B`. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom (L51-L55)\ndef smulAddHom : R \u2192+ M \u2192+ M :=\n(Module.toAddMonoidEnd R M).toAddMonoidHom\n\nvariable {R M}\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Module.End.AddMonoid (L32-L41)\ntheorem AddMonoid.End.natCast_def (n : \u2115) :\n (\u2191n : AddMonoid.End M) = DistribMulAction.toAddMonoidEnd \u2115 M n :=\nrfl\n\nvariable (R M)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- `(\u2022)` as an `AddMonoidHom`.\n\nThis is a stronger version of `DistribMulAction.toAddMonoidEnd` -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Module.Bimodule.mk (L82-L90)\ndef mk (p : AddSubmonoid M) (hA : \u2200 (a : A) {m : M}, m \u2208 p \u2192 a \u2022 m \u2208 p)\n (hB : \u2200 (b : B) {m : M}, m \u2208 p \u2192 b \u2022 m \u2208 p) : Submodule (A \u2297[R] B) M :=\n{ p with\n carrier := p\n smul_mem' := fun ab m =>\n TensorProduct.induction_on ab (fun _ => by simp only [zero_smul, SetLike.mem_coe, zero_mem])\n (fun a b hm => by simpa only [TensorProduct.Algebra.smul_def] using hA a (hB b hm))\n fun z w hz hw hm => by simpa only [add_smul] using p.add_mem (hz hm) (hw hm) }\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Fintype (L45-L51)\nlemma Fintype.sum_smul_sum [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2192 R) (g : \u03b2 \u2192 M) :\n (\u2211 i, f i) \u2022 \u2211 j, g j = \u2211 i, \u2211 j, f i \u2022 g j := Finset.sum_smul_sum _ _\nend AddCommMonoid\n\nopen Finset\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_character_apply (L220-L224)\nlemma eq_zero_of_character_apply {a : A} (h : \u2200 c : CharacterModule A, c a = 0) : a = 0 := by\ncontrapose! h; exact exists_character_apply_ne_zero_of_ne_zero h\n\nvariable [Module R A] [Module R A'] [Module R B] {R A' B}\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul (L128-L131)\nlemma indicator_smul (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 r a \u2022 indicator s f a :=\nfunext <| indicator_smul_apply s r f\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Module.Basic.smul_indicator_one_apply (L168-L173)\nlemma smul_indicator_one_apply (s : Set \u03b1) (r : R) (a : \u03b1) :\n r \u2022 s.indicator (1 : \u03b1 \u2192 R) a = s.indicator (fun _ \u21a6 r) a := by\nsimp_rw [\u2190 indicator_const_smul_apply, Pi.one_apply, smul_eq_mul, mul_one]\n\nend MulZeroOneClass\nend Set\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule' (L116-L129)\ndef toSubmodule' (p : Submodule (A \u2297[R] B) M) : Submodule B M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem' p }\n\nend Algebra\n\nsection Ring\n\nvariable (R S M : Type*) [Ring R] [Ring S]\nvariable [AddCommGroup M] [Module R M] [Module S M] [SMulCommClass R S M]\n\n/-- A `Submodule` over `R \u2297[\u2115] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2124] S`. -/\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Module.Defs.Convex (L76-L80)\ntheorem Convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a \u2022 x + b \u2022 x = x := by\nrw [\u2190 add_smul, h, one_smul]\n\nvariable (R)\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem' (L95-L100)\ntheorem smul_mem' (p : Submodule (A \u2297[R] B) M) (b : B) {m : M} (hm : m \u2208 p) : b \u2022 m \u2208 p := by\nsuffices b \u2022 m = (1 : A) \u2297\u209c[R] b \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n\n/-- If `A` and `B` are also `Algebra`s over yet another set of scalars `S` then we may \"base change\"\nfrom `R` to `S`. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_comm (L88-L94)\ntheorem inv_intCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommGroup E] [DivisionRing R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2124) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_intCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\nnamespace Function\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const (L158-L167)\nlemma indicator_smul_const (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) :\n indicator s (r \u00b7 \u2022 m) = (indicator s r \u00b7 \u2022 m) :=\nfunext <| indicator_smul_const_apply _ _ _\n\nend SMulWithZero\n\nsection MulZeroOneClass\n\nvariable [MulZeroOneClass R]\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_iff_surjective (L246-L249)\nlemma dual_injective_iff_surjective {f : A \u2192\u2097[R] A'} :\n Function.Injective (dual f) \u2194 Function.Surjective f :=\n\u27e8fun h \u21a6 surjective_of_dual_injective f h, fun h \u21a6 dual_injective_of_surjective f h\u27e9\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_one (L94-L95)\nlemma coe_one : \u2191(1 : M \u2243\u2097[R] M) = id := rfl\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_zero (L86-L89)\nlemma dual_zero : dual (0 : A \u2192\u2097[R] B) = 0 := by\next f\n exact map_zero f\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply_left (L145-L150)\nlemma indicator_smul_apply_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = indicator s r a \u2022 f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (zero_smul _ (f a)).symm]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_piFinset_apply (L58-L64)\nlemma sum_piFinset_apply (f : \u03ba \u2192 \u03b1) (s : Finset \u03ba) (i : \u03b9) :\n \u2211 g \u2208 piFinset fun _ : \u03b9 \u21a6 s, f (g i) = #s ^ (card \u03b9 - 1) \u2022 \u2211 b \u2208 s, f b := by\nclassical\n rw [Finset.sum_comp]\n simp only [eval_image_piFinset_const, card_filter_piFinset_const s, ite_smul, zero_smul, smul_sum,\n Finset.sum_ite_mem, inter_self]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Module.Defs.add_smul (L73-L75)\ntheorem add_smul : (r + s) \u2022 x = r \u2022 x + s \u2022 x :=\nModule.add_smul r s x\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.ModuleCon (L148-L160)\ndef ModuleCon.ker [Monoid R] [Monoid S] [AddMonoid M] [AddMonoid N] [DistribMulAction R M]\n [DistribMulAction S N] {\u03c6 : R \u2192* S} (f : M \u2192\u2091+[\u03c6] N) : ModuleCon R M where\n __ := SMulCon.ker f.toMulActionHom\n__ := AddCon.ker f\n\n/-- The first isomorphism theorem for semimodules in the case of a surjective homomorphism. -/\nnoncomputable def ModuleCon.quotientKerEquivOfSurjective [Semiring S] [AddCommMonoid M]\n [AddCommMonoid N] [Module S M] [Module S N] (f : M \u2192\u2097[S] N) (hf : Function.Surjective f) :\n (ker f.toDistribMulActionHom).Quotient \u2243\u2097[S] N where\n __ := AddCon.quotientKerEquivOfSurjective f.toAddMonoidHom hf\n map_smul' s := by rintro \u27e8\u27e9; apply map_smul f\n\nend ker\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul (L136-L144)\nlemma indicator_const_smul (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) :\n indicator s (r \u2022 f \u00b7) = (r \u2022 indicator s f \u00b7) :=\nfunext <| indicator_const_smul_apply s r f\n\nend SMulZeroClass\n\nsection SMulWithZero\nvariable [Zero R] [Zero M] [SMulWithZero R M]\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion (L64-L75)\ntheorem isInternal_prime_power_torsion [Module.Finite R M]\n (hM : Module.IsTorsion R M) :\n DirectSum.IsInternal fun p : (factors (\u22a4 : Submodule R M).annihilator).toFinset =>\n torsionBySet R M (p ^ (factors (\u22a4 : Submodule R M).annihilator).count \u2191p : Ideal R) := by\nhave hM' := Module.isTorsionBySet_annihilator_top R M\n have hI := Submodule.annihilator_top_inter_nonZeroDivisors hM\n refine isInternal_prime_power_torsion_of_is_torsion_by_ideal ?_ hM'\n rw [Submodule.ne_bot_iff]\n obtain \u27e8x, H, hx\u27e9 := hI; exact \u27e8x, H, nonZeroDivisors.ne_zero hx\u27e9\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules for some prime ideals `p i` and numbers `e i`. -/\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.automorphismGroup (L81-L89)\ninstance automorphismGroup : Group (M \u2243\u2097[R] M) where\n mul f g := g.trans f\none := LinearEquiv.refl R M\n inv f := f.symm\n mul_assoc _ _ _ := rfl\n mul_one _ := ext fun _ \u21a6 rfl\n one_mul _ := ext fun _ \u21a6 rfl\n inv_mul_cancel f := ext <| f.left_inv\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const_apply (L155-L157)\nlemma indicator_smul_const_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) (a : \u03b1) :\n indicator s (r \u00b7 \u2022 m) a = indicator s r a \u2022 m := indicator_smul_apply_left _ _ _ _\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_rTensor_conj_homEquiv (L147-L171)\ntheorem dual_rTensor_conj_homEquiv (f : A \u2192\u2097[R] A') :\n homEquiv.symm.toLinearMap \u2218\u2097 dual (f.rTensor B) \u2218\u2097 homEquiv.toLinearMap = f.lcomp R _ := rfl\nend module\n\n/--\n`\u2124\u22c6`, the character module of `\u2124` in the unit rational circle.\n-/\nprotected abbrev int : Type := CharacterModule \u2124\n\n/-- Given `n : \u2115`, the map `m \u21a6 m / n`. -/\nprotected abbrev int.divByNat (n : \u2115) : CharacterModule.int :=\n LinearMap.toSpanSingleton \u2124 _ (QuotientAddGroup.mk (n : \u211a)\u207b\u00b9) |>.toAddMonoidHom\n\nprotected lemma int.divByNat_self (n : \u2115) :\n int.divByNat n n = 0 := by\n obtain rfl | h0 := eq_or_ne n 0\n \u00b7 apply map_zero\n exact (AddCircle.coe_eq_zero_iff _).mpr\n \u27e81, by simp [mul_inv_cancel\u2080 (Nat.cast_ne_zero (R := \u211a).mpr h0)]\u27e9\n\nvariable {A}\n\n/-- The `\u2124`-submodule spanned by a single element `a` is isomorphic to the quotient of `\u2124`\nby the ideal generated by the order of `a`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Multiset (L29-L31)\ntheorem Multiset.sum_smul {l : Multiset R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\n((smulAddHom R M).flip x).map_multiset_sum l\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_intCast_smul (L58-L67)\ntheorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]\n [Module S M\u2082] (z : \u2124) (x : M) : f ((z\u207b\u00b9 : R) \u2022 x) = (z\u207b\u00b9 : S) \u2022 f x := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]\n \u00b7 simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,\n map_inv_natCast_smul _ R S]\n\n/-- If `E` is a vector space over two division semirings `R` and `S`, then scalar multiplications\nagree on inverses of natural numbers in `R` and `S`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Module.Defs.smul_add_one_sub_smul (L109-L117)\ntheorem smul_add_one_sub_smul {R : Type*} [Ring R] [Module R M] {r : R} {m : M} :\n r \u2022 m + (1 - r) \u2022 m = m := by rw [\u2190 add_smul, add_sub_cancel, one_smul]\nend AddCommMonoid\n\nsection AddCommGroup\n\nvariable [Semiring R] [AddCommGroup M]\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.surjective_of_dual_injective (L236-L245)\nlemma surjective_of_dual_injective (f : A \u2192\u2097[R] A') (hf : Function.Injective (dual f)) :\n Function.Surjective f := by\nrw [\u2190 LinearMap.range_eq_top, \u2190 Submodule.unique_quotient_iff_eq_top]\n refine \u27e8Unique.mk inferInstance fun a \u21a6 eq_zero_of_character_apply fun c \u21a6 ?_\u27e9\n obtain \u27e8b, rfl\u27e9 := QuotientAddGroup.mk'_surjective _ a\n suffices eq : dual (Submodule.mkQ _) c = 0 from congr($eq b)\n refine hf ?_\n rw [\u2190 LinearMap.comp_apply, \u2190 dual_comp, LinearMap.range_mkQ_comp, dual_zero,\n LinearMap.zero_apply, dual_apply, AddMonoidHom.zero_comp]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.congr (L110-L119)\ndef congr (e : A \u2243\u2097[R] B) : CharacterModule A \u2243\u2097[R] CharacterModule B :=\n.ofLinear (dual e.symm) (dual e)\n (by ext c _; exact congr(c $(e.right_inv _)))\n (by ext c _; exact congr(c $(e.left_inv _)))\n\nopen TensorProduct\n\n/--\nAny linear map `L : A \u2192 B\u22c6` induces a character in `(A \u2297 B)\u22c6` by `a \u2297 b \u21a6 L a b`.\n-/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.one_eq_refl (L90-L90)\nlemma one_eq_refl : (1 : M \u2243\u2097[R] M) = refl R M := rfl\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.exists_isInternal_prime_power_torsion (L76-L83)\ntheorem exists_isInternal_prime_power_torsion [Module.Finite R M] (hM : Module.IsTorsion R M) :\n \u2203 (P : Finset <| Ideal R) (_ : DecidableEq P) (_ : \u2200 p \u2208 P, Prime p) (e : P \u2192 \u2115),\n DirectSum.IsInternal fun p : P => torsionBySet R M (p ^ e p : Ideal R) := by\nclassical\n exact \u27e8_, _, fun p hp => prime_of_factor p (Multiset.mem_toFinset.mp hp), _,\n isInternal_prime_power_torsion hM\u27e9\n\nend Submodule\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Module.Defs.sub_smul (L150-L166)\ntheorem sub_smul (r s : R) (y : M) : (r - s) \u2022 y = r \u2022 y - s \u2022 y := by\nsimp [add_smul, sub_eq_add_neg]\n\nend Module\n\n/-- A module over a `Subsingleton` semiring is a `Subsingleton`. We cannot register this\nas an instance because Lean has no way to guess `R`. -/\nprotected theorem Module.subsingleton (R M : Type*) [MonoidWithZero R] [Subsingleton R] [Zero M]\n [MulActionWithZero R M] : Subsingleton M :=\n MulActionWithZero.subsingleton R M\n\n/-- A semiring is `Nontrivial` provided that there exists a nontrivial module over this semiring. -/\nprotected theorem Module.nontrivial (R M : Type*) [MonoidWithZero R] [Nontrivial M] [Zero M]\n [MulActionWithZero R M] : Nontrivial R :=\n MulActionWithZero.nontrivial R M\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_bijective_iff_bijective (L250-L255)\nlemma dual_bijective_iff_bijective {f : A \u2192\u2097[R] A'} :\n Function.Bijective (dual f) \u2194 Function.Bijective f :=\n\u27e8fun h \u21a6 \u27e8dual_surjective_iff_injective.mp h.2, dual_injective_iff_surjective.mp h.1\u27e9,\n fun h \u21a6 \u27e8dual_injective_iff_surjective.mpr h.2, dual_surjective_iff_injective.mpr h.1\u27e9\u27e9\n\nend CharacterModule\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Algebra.Module.Bimodule.baseChange (L102-L107)\ndef baseChange (S : Type*) [CommSemiring S] [Module S M] [Algebra S A] [Algebra S B]\n [IsScalarTower S A M] [IsScalarTower S B M] (p : Submodule (A \u2297[R] B) M) :\n Submodule (A \u2297[S] B) M :=\nmk p.toAddSubmonoid (smul_mem p) (smul_mem' p)\n\n/-- Forgetting the `B` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `A`. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_subset (L113-L121)\nlemma support_const_smul_subset [Zero M] [SMulZeroClass R M] (a : R) (f : \u03b1 \u2192 M) :\n support (a \u2022 f) \u2286 support f := support_smul_subset_right (fun _ \u21a6 a) f\nend Function\n\nnamespace Set\nsection SMulZeroClass\nvariable [Zero M] [SMulZeroClass R M]\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleInt (L131-L135)\ndef toSubbimoduleInt (p : Submodule (R \u2297[\u2115] S) M) : Submodule (R \u2297[\u2124] S) M :=\nbaseChange \u2124 p\n\n/-- A `Submodule` over `R \u2297[\u2124] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2115] S`. -/\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Algebra.Module.BigOperators.List (L26-L28)\ntheorem List.sum_smul {l : List R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\nmap_list_sum ((smulAddHom R M).flip x) l\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion_of_is_torsion_by_ideal (L37-L63)\ntheorem isInternal_prime_power_torsion_of_is_torsion_by_ideal\n {I : Ideal R} (hI : I \u2260 \u22a5) (hM : Module.IsTorsionBySet R M I) :\n DirectSum.IsInternal fun p : (factors I).toFinset =>\n torsionBySet R M (p ^ (factors I).count \u2191p : Ideal R) := by\nlet P := factors I\n have prime_of_mem := fun p (hp : p \u2208 P.toFinset) =>\n prime_of_factor p (Multiset.mem_toFinset.mp hp)\n apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _\n \u00b7 convert hM\n rw [\u2190 Finset.inf_eq_iInf, IsDedekindDomain.inf_pow_eq_prod_of_prime,\n \u2190 Finset.prod_multiset_count, \u2190 associated_iff_eq]\n \u00b7 exact factors_prod hI\n \u00b7 exact prime_of_mem\n \u00b7 exact fun _ _ _ _ ij => ij\n \u00b7 intro p hp q hq pq; dsimp\n rw [irreducible_pow_sup]\n \u00b7 suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]\n rw [Multiset.count_eq_zero,\n normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,\n Multiset.mem_replicate]\n exact fun H => pq <| H.2.trans <| normalize_eq q\n \u00b7 rw [\u2190 Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero\n \u00b7 exact (prime_of_mem p hp).irreducible\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules where `p i` are factors of `(\u22a4 : Submodule R M).annihilator` and\n`e i` are their multiplicities. -/\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_one_smul (L146-L149)\ntheorem neg_one_smul (x : M) : (-1 : R) \u2022 x = -x := by simp\nvariable {R}\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.SMulCon (L143-L147)\ndef SMulCon.ker [SMul R M] [SMul S N] {\u03c6 : R \u2192 S} (f : M \u2192\u2091[\u03c6] N) : SMulCon R M where\n __ := Setoid.ker f\nsmul r _ _ h := by rw [Setoid.ker_def] at h \u22a2; simp_rw [map_smul\u209b\u2097, h]\n\n/-- The kernel of a `DistribMulActionHom` as a congruence relation. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_of_ne_zero (L105-L108)\nlemma support_const_smul_of_ne_zero [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (c : R) (g : \u03b1 \u2192 M) (hc : c \u2260 0) : support (c \u2022 g) = support g :=\next fun _ \u21a6 smul_ne_zero_iff_right hc\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_ofSpanSingleton_apply_self (L201-L214)\nlemma eq_zero_of_ofSpanSingleton_apply_self (a : A)\n (h : ofSpanSingleton a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 = 0) : a = 0 := by\nerw [ofSpanSingleton, LinearMap.toAddMonoidHom_coe, LinearMap.comp_apply,\n intSpanEquivQuotAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,\n AddMonoidHom.coe_toIntLinearMap, int.divByNat, LinearMap.toSpanSingleton_apply_one,\n AddCircle.coe_eq_zero_iff] at h\n rcases h with \u27e8n, hn\u27e9\n apply_fun Rat.den at hn\n rw [zsmul_one, Rat.den_intCast, Rat.inv_natCast_den_of_pos] at hn\n \u00b7 split_ifs at hn\n \u00b7 cases hn\n \u00b7 rwa [eq_comm, AddMonoid.addOrderOf_eq_one_iff] at hn\n \u00b7 grind\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleNat (L137-L142)\ndef toSubbimoduleNat (p : Submodule (R \u2297[\u2124] S) M) : Submodule (R \u2297[\u2115] S) M :=\nbaseChange \u2115 p\n\nend Ring\n\nend Subbimodule\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.intSpanEquivQuotAddOrderOf_apply_self (L181-L200)\nlemma intSpanEquivQuotAddOrderOf_apply_self (a : A) :\n intSpanEquivQuotAddOrderOf a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 =\n Submodule.Quotient.mk 1 :=\n(LinearEquiv.eq_symm_apply _).mp <| Subtype.ext (one_zsmul _).symm\n\n/--\nFor an abelian group `A` and an element `a \u2208 A`, there is a character `c : \u2124 \u2219 a \u2192 \u211a \u29f8 \u2124` given by\n`m \u2022 a \u21a6 m / n` where `n` is the smallest positive integer such that `n \u2022 a = 0` and when such `n`\ndoes not exist, `c` is defined by `m \u2022 a \u21a6 m / 2`.\n-/\nnoncomputable def ofSpanSingleton (a : A) : CharacterModule (\u2124 \u2219 a) :=\n let l : \u2124 \u29f8 Ideal.span {(addOrderOf a : \u2124)} \u2192\u2097[\u2124] AddCircle (1 : \u211a) :=\n Submodule.liftQSpanSingleton _\n (CharacterModule.int.divByNat <|\n if addOrderOf a = 0 then 2 else addOrderOf a).toIntLinearMap <| by\n split_ifs with h\n \u00b7 rw [h, Nat.cast_zero, map_zero]\n \u00b7 apply CharacterModule.int.divByNat_self\n l \u2218\u2097 intSpanEquivQuotAddOrderOf a |>.toAddMonoidHom\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul (L109-L112)\nlemma support_smul [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) : support (f \u2022 g) = support f \u2229 support g :=\next fun _ => smul_ne_zero_iff\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_comp (L90-L94)\nlemma dual_comp {C : Type*} [AddCommGroup C] [Module R C] (f : A \u2192\u2097[R] B) (g : B \u2192\u2097[R] C) :\n dual (g.comp f) = (dual f).comp (dual g) := by\next\n rfl\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul (L139-L141)\ntheorem neg_smul : -r \u2022 x = -(r \u2022 x) :=\neq_neg_of_add_eq_zero_left <| by rw [\u2190 add_smul, neg_add_cancel, zero_smul]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_comm (L81-L87)\ntheorem inv_natCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2115) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_natCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\n/-- If `E` is a vector space over a division ring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of integers in `R` -/\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_left (L95-L100)\nlemma support_smul_subset_left [Zero R] [Zero M] [SMulWithZero R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support f := fun x hfg hf \u21a6\nhfg <| by rw [Pi.smul_apply', hf, zero_smul]\n\n-- Changed (2024-01-21): this lemma was generalised;\n-- the old version is now called `support_const_smul_subset`.\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_natCast_smul (L41-L57)\ntheorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*)\n [DivisionSemiring R] [DivisionSemiring S] [Module R M]\n [Module S M\u2082] (n : \u2115) (x : M) : f ((n\u207b\u00b9 : R) \u2022 x) = (n\u207b\u00b9 : S) \u2022 f x := by\nby_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0\n \u00b7 simp [hR, hS, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by rw [this, this, smul_zero]\n clear x\n intro x\n rw [\u2190 inv_smul_smul\u2080 hS (f x), \u2190 map_natCast_smul f R S]\n simp [hR, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by simp [this]\n clear x\n intro x\n rw [\u2190 smul_inv_smul\u2080 hR x, map_natCast_smul f R S, hS, zero_smul]\n \u00b7 rw [\u2190 inv_smul_smul\u2080 hS (f _), \u2190 map_natCast_smul f R S, smul_inv_smul\u2080 hR]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.mul_eq_trans (L91-L92)\nlemma mul_eq_trans (f g : M \u2243\u2097[R] M) : f * g = g.trans f := rfl\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_eq (L68-L74)\ntheorem inv_natCast_smul_eq {E : Type*} (R S : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [DivisionSemiring S] [Module R E] [Module S E] (n : \u2115) (x : E) :\n (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_natCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over two division rings `R` and `S`, then scalar multiplications\nagree on inverses of integer numbers in `R` and `S`. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_iff_injective (L225-L230)\nlemma dual_surjective_iff_injective {f : A \u2192\u2097[R] A'} :\n Function.Surjective (dual f) \u2194 Function.Injective f :=\n\u27e8fun h \u21a6 (injective_iff_map_eq_zero _).2 fun a h0 \u21a6 eq_zero_of_character_apply fun c \u21a6 by\n obtain \u27e8c, rfl\u27e9 := h c; exact congr(c $h0).trans c.map_zero,\n dual_surjective_of_injective f\u27e9\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_inj (L60-L65)\ntheorem restrictScalars_inj (f g : M \u2243\u2097[S] M\u2082) :\n f.restrictScalars R = g.restrictScalars R \u2194 f = g :=\n(restrictScalars_injective R).eq_iff\n\nend RestrictScalars\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Module/SpanRank.lean", "module": "Mathlib.Algebra.Module.SpanRank", "declaration": "Mathlib.Algebra.Module.SpanRank.Module", "span": "L411-L415", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Module/SpanRank.lean#L411"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 16427, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 42676, "lean_code_chars": 39415, "natural_language_chars": 3261, "lean_code_ratio": 0.9236, "line_count": 1207, "imports_count": 0, "declarations_count": 4790, "diagnostics_count": 0, "retrieval_snippets_count": 105, "tool_transcript_turns": 0, "length_bucket": "long", "duplicate_fingerprint": "67a38559d1fc4cda", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "C-Mathlib.LinearAlgebra.Projection.commute_iff_of_isUnit", "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.LinearAlgebra.Projection)."}, {"role": "user", "content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem commute_iff_of_isUnit (hT : IsUnit T) (hf : IsIdempotentElem f) :\n Commute f T \u2194 (range f).map T = range f \u2227 (ker f).map T = ker f\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.Projection.ker_id_sub_eq_of_proj (L46-L51)\ntheorem ker_id_sub_eq_of_proj {f : E \u2192\u2097[R] p} (hf : \u2200 x : p, f x = x) :\n ker (id - p.subtype.comp f) = p := by\next x\n simp only [comp_apply, mem_ker, subtype_apply, sub_apply, id_apply, sub_eq_zero]\n exact \u27e8fun h => h.symm \u25b8 Submodule.coe_mem _, fun hx => by rw [hf \u27e8x, hx\u27e9, Subtype.coe_mk]\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.Projection.range_eq_of_proj (L52-L54)\ntheorem range_eq_of_proj {f : E \u2192\u2097[R] p} (hf : \u2200 x : p, f x = x) : range f = \u22a4 :=\nrange_eq_top.2 fun x => \u27e8x, hf x\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.Projection.isCompl_of_proj (L55-L73)\ntheorem isCompl_of_proj {f : E \u2192\u2097[R] p} (hf : \u2200 x : p, f x = x) : IsCompl p (ker f) := by\nconstructor\n \u00b7 rw [disjoint_iff_inf_le]\n rintro x \u27e8hpx, hfx\u27e9\n rw [SetLike.mem_coe, mem_ker, hf \u27e8x, hpx\u27e9, mk_eq_zero] at hfx\n simp only [hfx, zero_mem]\n \u00b7 rw [codisjoint_iff_le_sup]\n intro x _\n rw [mem_sup']\n refine \u27e8f x, \u27e8x - f x, ?_\u27e9, add_sub_cancel _ _\u27e9\n rw [mem_ker, map_sub, hf, sub_self]\n\nend LinearMap\n\nnamespace Submodule\n\nopen LinearMap\n\n/-- If `q` is a complement of `p`, then `M/p \u2243 q`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.Projection.quotientEquivOfIsCompl (L74-L79)\ndef quotientEquivOfIsCompl (h : IsCompl p q) : (E \u29f8 p) \u2243\u2097[R] q :=\nLinearEquiv.symm <|\n LinearEquiv.ofBijective (p.mkQ.comp q.subtype)\n \u27e8by rw [\u2190 ker_eq_bot, ker_comp, ker_mkQ, disjoint_iff_comap_eq_bot.1 h.symm.disjoint], by\n rw [\u2190 range_eq_top, range_comp, range_subtype, map_mkQ_eq_top, h.sup_eq_top]\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.Projection.quotientEquivOfIsCompl_symm_apply (L81-L84)\ntheorem quotientEquivOfIsCompl_symm_apply (h : IsCompl p q) (x : q) :\n -- Porting note: type ascriptions needed on the RHS\n (quotientEquivOfIsCompl p q h).symm x = (Quotient.mk x : E \u29f8 p) := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.Projection.quotientEquivOfIsCompl_apply_mk_coe (L86-L89)\ntheorem quotientEquivOfIsCompl_apply_mk_coe (h : IsCompl p q) (x : q) :\n quotientEquivOfIsCompl p q h (Quotient.mk x) = x :=\n(quotientEquivOfIsCompl p q h).apply_symm_apply x\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.Projection.mk_quotientEquivOfIsCompl_apply (L91-L95)\ntheorem mk_quotientEquivOfIsCompl_apply (h : IsCompl p q) (x : E \u29f8 p) :\n (Quotient.mk (quotientEquivOfIsCompl p q h x) : E \u29f8 p) = x :=\n(quotientEquivOfIsCompl p q h).symm_apply_apply x\n\n/-- If `q` is a complement of `p`, then `p \u00d7 q` is isomorphic to `E`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl (L96-L103)\ndef prodEquivOfIsCompl (h : IsCompl p q) : (p \u00d7 q) \u2243\u2097[R] E := by\napply LinearEquiv.ofBijective (p.subtype.coprod q.subtype)\n constructor\n \u00b7 rw [\u2190 ker_eq_bot, ker_coprod_of_disjoint_range, ker_subtype, ker_subtype, prod_bot]\n rw [range_subtype, range_subtype]\n exact h.1\n \u00b7 rw [\u2190 range_eq_top, \u2190 sup_eq_range, h.sup_eq_top]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.Projection.coe_prodEquivOfIsCompl (L105-L107)\ntheorem coe_prodEquivOfIsCompl (h : IsCompl p q) :\n (prodEquivOfIsCompl p q h : p \u00d7 q \u2192\u2097[R] E) = p.subtype.coprod q.subtype := rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.Projection.coe_prodEquivOfIsCompl' (L109-L111)\ntheorem coe_prodEquivOfIsCompl' (h : IsCompl p q) (x : p \u00d7 q) :\n prodEquivOfIsCompl p q h x = x.1 + x.2 := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_left (L112-L115)\ntheorem prodEquivOfIsCompl_symm_apply_left (h : IsCompl p q) (x : p) :\n (prodEquivOfIsCompl p q h).symm x = (x, 0) :=\n(prodEquivOfIsCompl p q h).symm_apply_eq.2 <| by simp\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_right (L116-L119)\ntheorem prodEquivOfIsCompl_symm_apply_right (h : IsCompl p q) (x : q) :\n (prodEquivOfIsCompl p q h).symm x = (0, x) :=\n(prodEquivOfIsCompl p q h).symm_apply_eq.2 <| by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_fst_eq_zero (L120-L125)\ntheorem prodEquivOfIsCompl_symm_apply_fst_eq_zero (h : IsCompl p q) {x : E} :\n ((prodEquivOfIsCompl p q h).symm x).1 = 0 \u2194 x \u2208 q := by\nconv_rhs => rw [\u2190 (prodEquivOfIsCompl p q h).apply_symm_apply x]\n rw [coe_prodEquivOfIsCompl', Submodule.add_mem_iff_left _ (Submodule.coe_mem _),\n mem_right_iff_eq_zero_of_disjoint h.disjoint]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_snd_eq_zero (L126-L131)\ntheorem prodEquivOfIsCompl_symm_apply_snd_eq_zero (h : IsCompl p q) {x : E} :\n ((prodEquivOfIsCompl p q h).symm x).2 = 0 \u2194 x \u2208 p := by\nconv_rhs => rw [\u2190 (prodEquivOfIsCompl p q h).apply_symm_apply x]\n rw [coe_prodEquivOfIsCompl', Submodule.add_mem_iff_right _ (Submodule.coe_mem _),\n mem_left_iff_eq_zero_of_disjoint h.disjoint]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodComm_trans_prodEquivOfIsCompl (L133-L140)\ntheorem prodComm_trans_prodEquivOfIsCompl (h : IsCompl p q) :\n LinearEquiv.prodComm R q p \u226a\u226b\u2097 prodEquivOfIsCompl p q h = prodEquivOfIsCompl q p h.symm :=\nLinearEquiv.ext fun _ => add_comm _ _\n\n/-- Projection to a submodule along a complement. It is the unique\nlinear map `f : E \u2192 p` such that `f x = x` for `x \u2208 p` and `f x = 0` for `x \u2208 q`.\n\nSee also `LinearMap.linearProjOfIsCompl`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl (L141-L154)\ndef linearProjOfIsCompl (h : IsCompl p q) : E \u2192\u2097[R] p :=\nLinearMap.fst R p q \u2218\u2097 \u2191(prodEquivOfIsCompl p q h).symm\n\nvariable {p q}\n\n/-- The linear projection onto a subspace along its complement\nas a map from the full space to itself, as opposed to `Submodule.linearProjOfIsCompl`,\nwhich maps into the subtype.\nThis version is important as it satisfies `IsIdempotentElem`. -/\nnoncomputable def IsCompl.projection (hpq : IsCompl p q) :=\n p.subtype \u2218\u2097 p.linearProjOfIsCompl q hpq\n\nopen Submodule\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L155-L158)\ntheorem IsCompl.projection_apply (hpq : IsCompl p q) (x : E) :\n hpq.projection x = p.linearProjOfIsCompl q hpq x :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.Projection.coe_linearProjOfIsCompl_apply (L160-L163)\ntheorem coe_linearProjOfIsCompl_apply (hpq : IsCompl p q) (x : E) :\n (p.linearProjOfIsCompl q hpq x : E) = hpq.projection x :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L165-L168)\ntheorem IsCompl.projection_apply_mem (hpq : IsCompl p q) (x : E) :\n hpq.projection x \u2208 p :=\nSetLike.coe_mem _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_apply_left (L170-L173)\ntheorem linearProjOfIsCompl_apply_left (h : IsCompl p q) (x : p) :\n linearProjOfIsCompl p q h x = x := by\nsimp [linearProjOfIsCompl, prodEquivOfIsCompl_symm_apply_left]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L175-L177)\ntheorem IsCompl.projection_apply_left (hpq : IsCompl p q) (x : p) :\n hpq.projection x = x := by simp [projection]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_range (L179-L181)\ntheorem linearProjOfIsCompl_range (h : IsCompl p q) : range (linearProjOfIsCompl p q h) = \u22a4 :=\nrange_eq_of_proj (linearProjOfIsCompl_apply_left h)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L183-L185)\ntheorem IsCompl.projection_range (hpq : IsCompl p q) : range hpq.projection = p := by\nsimp [projection, range_comp]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_surjective (L186-L189)\ntheorem linearProjOfIsCompl_surjective (h : IsCompl p q) :\n Function.Surjective (linearProjOfIsCompl p q h) :=\nrange_eq_top.mp (linearProjOfIsCompl_range h)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_apply_eq_zero_iff (L191-L194)\ntheorem linearProjOfIsCompl_apply_eq_zero_iff (h : IsCompl p q) {x : E} :\n linearProjOfIsCompl p q h x = 0 \u2194 x \u2208 q := by\nsimp [linearProjOfIsCompl, prodEquivOfIsCompl_symm_apply_fst_eq_zero]\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.LinearAlgebra.Projection).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem commute_iff_of_isUnit (hT : IsUnit T) (hf : IsIdempotentElem f) :\n Commute f T \u2194 (range f).map T = range f \u2227 (ker f).map T = ker f\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.Projection.ker_id_sub_eq_of_proj (L46-L51)\ntheorem ker_id_sub_eq_of_proj {f : E \u2192\u2097[R] p} (hf : \u2200 x : p, f x = x) :\n ker (id - p.subtype.comp f) = p := by\next x\n simp only [comp_apply, mem_ker, subtype_apply, sub_apply, id_apply, sub_eq_zero]\n exact \u27e8fun h => h.symm \u25b8 Submodule.coe_mem _, fun hx => by rw [hf \u27e8x, hx\u27e9, Subtype.coe_mk]\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.Projection.range_eq_of_proj (L52-L54)\ntheorem range_eq_of_proj {f : E \u2192\u2097[R] p} (hf : \u2200 x : p, f x = x) : range f = \u22a4 :=\nrange_eq_top.2 fun x => \u27e8x, hf x\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.Projection.isCompl_of_proj (L55-L73)\ntheorem isCompl_of_proj {f : E \u2192\u2097[R] p} (hf : \u2200 x : p, f x = x) : IsCompl p (ker f) := by\nconstructor\n \u00b7 rw [disjoint_iff_inf_le]\n rintro x \u27e8hpx, hfx\u27e9\n rw [SetLike.mem_coe, mem_ker, hf \u27e8x, hpx\u27e9, mk_eq_zero] at hfx\n simp only [hfx, zero_mem]\n \u00b7 rw [codisjoint_iff_le_sup]\n intro x _\n rw [mem_sup']\n refine \u27e8f x, \u27e8x - f x, ?_\u27e9, add_sub_cancel _ _\u27e9\n rw [mem_ker, map_sub, hf, sub_self]\n\nend LinearMap\n\nnamespace Submodule\n\nopen LinearMap\n\n/-- If `q` is a complement of `p`, then `M/p \u2243 q`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.Projection.quotientEquivOfIsCompl (L74-L79)\ndef quotientEquivOfIsCompl (h : IsCompl p q) : (E \u29f8 p) \u2243\u2097[R] q :=\nLinearEquiv.symm <|\n LinearEquiv.ofBijective (p.mkQ.comp q.subtype)\n \u27e8by rw [\u2190 ker_eq_bot, ker_comp, ker_mkQ, disjoint_iff_comap_eq_bot.1 h.symm.disjoint], by\n rw [\u2190 range_eq_top, range_comp, range_subtype, map_mkQ_eq_top, h.sup_eq_top]\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.Projection.quotientEquivOfIsCompl_symm_apply (L81-L84)\ntheorem quotientEquivOfIsCompl_symm_apply (h : IsCompl p q) (x : q) :\n -- Porting note: type ascriptions needed on the RHS\n (quotientEquivOfIsCompl p q h).symm x = (Quotient.mk x : E \u29f8 p) := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.Projection.quotientEquivOfIsCompl_apply_mk_coe (L86-L89)\ntheorem quotientEquivOfIsCompl_apply_mk_coe (h : IsCompl p q) (x : q) :\n quotientEquivOfIsCompl p q h (Quotient.mk x) = x :=\n(quotientEquivOfIsCompl p q h).apply_symm_apply x\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.Projection.mk_quotientEquivOfIsCompl_apply (L91-L95)\ntheorem mk_quotientEquivOfIsCompl_apply (h : IsCompl p q) (x : E \u29f8 p) :\n (Quotient.mk (quotientEquivOfIsCompl p q h x) : E \u29f8 p) = x :=\n(quotientEquivOfIsCompl p q h).symm_apply_apply x\n\n/-- If `q` is a complement of `p`, then `p \u00d7 q` is isomorphic to `E`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl (L96-L103)\ndef prodEquivOfIsCompl (h : IsCompl p q) : (p \u00d7 q) \u2243\u2097[R] E := by\napply LinearEquiv.ofBijective (p.subtype.coprod q.subtype)\n constructor\n \u00b7 rw [\u2190 ker_eq_bot, ker_coprod_of_disjoint_range, ker_subtype, ker_subtype, prod_bot]\n rw [range_subtype, range_subtype]\n exact h.1\n \u00b7 rw [\u2190 range_eq_top, \u2190 sup_eq_range, h.sup_eq_top]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.Projection.coe_prodEquivOfIsCompl (L105-L107)\ntheorem coe_prodEquivOfIsCompl (h : IsCompl p q) :\n (prodEquivOfIsCompl p q h : p \u00d7 q \u2192\u2097[R] E) = p.subtype.coprod q.subtype := rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.Projection.coe_prodEquivOfIsCompl' (L109-L111)\ntheorem coe_prodEquivOfIsCompl' (h : IsCompl p q) (x : p \u00d7 q) :\n prodEquivOfIsCompl p q h x = x.1 + x.2 := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_left (L112-L115)\ntheorem prodEquivOfIsCompl_symm_apply_left (h : IsCompl p q) (x : p) :\n (prodEquivOfIsCompl p q h).symm x = (x, 0) :=\n(prodEquivOfIsCompl p q h).symm_apply_eq.2 <| by simp\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_right (L116-L119)\ntheorem prodEquivOfIsCompl_symm_apply_right (h : IsCompl p q) (x : q) :\n (prodEquivOfIsCompl p q h).symm x = (0, x) :=\n(prodEquivOfIsCompl p q h).symm_apply_eq.2 <| by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_fst_eq_zero (L120-L125)\ntheorem prodEquivOfIsCompl_symm_apply_fst_eq_zero (h : IsCompl p q) {x : E} :\n ((prodEquivOfIsCompl p q h).symm x).1 = 0 \u2194 x \u2208 q := by\nconv_rhs => rw [\u2190 (prodEquivOfIsCompl p q h).apply_symm_apply x]\n rw [coe_prodEquivOfIsCompl', Submodule.add_mem_iff_left _ (Submodule.coe_mem _),\n mem_right_iff_eq_zero_of_disjoint h.disjoint]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodEquivOfIsCompl_symm_apply_snd_eq_zero (L126-L131)\ntheorem prodEquivOfIsCompl_symm_apply_snd_eq_zero (h : IsCompl p q) {x : E} :\n ((prodEquivOfIsCompl p q h).symm x).2 = 0 \u2194 x \u2208 p := by\nconv_rhs => rw [\u2190 (prodEquivOfIsCompl p q h).apply_symm_apply x]\n rw [coe_prodEquivOfIsCompl', Submodule.add_mem_iff_right _ (Submodule.coe_mem _),\n mem_left_iff_eq_zero_of_disjoint h.disjoint]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.Projection.prodComm_trans_prodEquivOfIsCompl (L133-L140)\ntheorem prodComm_trans_prodEquivOfIsCompl (h : IsCompl p q) :\n LinearEquiv.prodComm R q p \u226a\u226b\u2097 prodEquivOfIsCompl p q h = prodEquivOfIsCompl q p h.symm :=\nLinearEquiv.ext fun _ => add_comm _ _\n\n/-- Projection to a submodule along a complement. It is the unique\nlinear map `f : E \u2192 p` such that `f x = x` for `x \u2208 p` and `f x = 0` for `x \u2208 q`.\n\nSee also `LinearMap.linearProjOfIsCompl`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl (L141-L154)\ndef linearProjOfIsCompl (h : IsCompl p q) : E \u2192\u2097[R] p :=\nLinearMap.fst R p q \u2218\u2097 \u2191(prodEquivOfIsCompl p q h).symm\n\nvariable {p q}\n\n/-- The linear projection onto a subspace along its complement\nas a map from the full space to itself, as opposed to `Submodule.linearProjOfIsCompl`,\nwhich maps into the subtype.\nThis version is important as it satisfies `IsIdempotentElem`. -/\nnoncomputable def IsCompl.projection (hpq : IsCompl p q) :=\n p.subtype \u2218\u2097 p.linearProjOfIsCompl q hpq\n\nopen Submodule\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L155-L158)\ntheorem IsCompl.projection_apply (hpq : IsCompl p q) (x : E) :\n hpq.projection x = p.linearProjOfIsCompl q hpq x :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.Projection.coe_linearProjOfIsCompl_apply (L160-L163)\ntheorem coe_linearProjOfIsCompl_apply (hpq : IsCompl p q) (x : E) :\n (p.linearProjOfIsCompl q hpq x : E) = hpq.projection x :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L165-L168)\ntheorem IsCompl.projection_apply_mem (hpq : IsCompl p q) (x : E) :\n hpq.projection x \u2208 p :=\nSetLike.coe_mem _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_apply_left (L170-L173)\ntheorem linearProjOfIsCompl_apply_left (h : IsCompl p q) (x : p) :\n linearProjOfIsCompl p q h x = x := by\nsimp [linearProjOfIsCompl, prodEquivOfIsCompl_symm_apply_left]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L175-L177)\ntheorem IsCompl.projection_apply_left (hpq : IsCompl p q) (x : p) :\n hpq.projection x = x := by simp [projection]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_range (L179-L181)\ntheorem linearProjOfIsCompl_range (h : IsCompl p q) : range (linearProjOfIsCompl p q h) = \u22a4 :=\nrange_eq_of_proj (linearProjOfIsCompl_apply_left h)\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.Projection.IsCompl (L183-L185)\ntheorem IsCompl.projection_range (hpq : IsCompl p q) : range hpq.projection = p := by\nsimp [projection, range_comp]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_surjective (L186-L189)\ntheorem linearProjOfIsCompl_surjective (h : IsCompl p q) :\n Function.Surjective (linearProjOfIsCompl p q h) :=\nrange_eq_top.mp (linearProjOfIsCompl_range h)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.Projection.linearProjOfIsCompl_apply_eq_zero_iff (L191-L194)\ntheorem linearProjOfIsCompl_apply_eq_zero_iff (h : IsCompl p q) {x : E} :\n linearProjOfIsCompl p q h x = 0 \u2194 x \u2208 q := by\nsimp [linearProjOfIsCompl, prodEquivOfIsCompl_symm_apply_fst_eq_zero]\n```\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Projection.lean", "module": "Mathlib.LinearAlgebra.Projection", "declaration": "Mathlib.LinearAlgebra.Projection.commute_iff_of_isUnit", "span": "L714-L723", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Projection.lean#L714"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 3358, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 8715, "lean_code_chars": 7619, "natural_language_chars": 1096, "lean_code_ratio": 0.8742, "line_count": 247, "imports_count": 0, "declarations_count": 884, "diagnostics_count": 0, "retrieval_snippets_count": 25, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "1ef35dfc8c7315ca", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.GroupTheory.GroupAction.ConjAct.toConjAct_inv", "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.GroupTheory.GroupAction.ConjAct)."}, {"role": "user", "content": "You are editing a file in `Mathlib/GroupTheory/GroupAction/ConjAct.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.GroupTheory.GroupAction.ConjAct.toConjAct_inv`, L117-L119)\n```lean\ntheorem toConjAct_inv (x : G) : toConjAct x\u207b\u00b9 = (toConjAct x)\u207b\u00b9 := rfl\n```\n\n## Edit instruction\nEdit `toConjAct_inv` so it still compiles and the proof is simplified where possible. Return the full updated `toConjAct_inv` 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.GroupTheory.GroupAction.ConjAct).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/GroupTheory/GroupAction/ConjAct.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.GroupTheory.GroupAction.ConjAct.toConjAct_inv`, L117-L119)\n```lean\ntheorem toConjAct_inv (x : G) : toConjAct x\u207b\u00b9 = (toConjAct x)\u207b\u00b9 := rfl\n```\n\n## Edit instruction\nEdit `toConjAct_inv` so it still compiles and the proof is simplified where possible. Return the full updated `toConjAct_inv` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/GroupAction/ConjAct.lean", "module": "Mathlib.GroupTheory.GroupAction.ConjAct", "declaration": "Mathlib.GroupTheory.GroupAction.ConjAct.toConjAct_inv", "span": "L117-L119", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/GroupAction/ConjAct.lean#L117"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 265, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 801, "lean_code_chars": 71, "natural_language_chars": 730, "lean_code_ratio": 0.0886, "line_count": 10, "imports_count": 0, "declarations_count": 84, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "86e2b23a31af539f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal.node_eq_neg_one", "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.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/Extremal.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal.node_eq_neg_one`, L56-L59)\n```lean\nlemma node_eq_neg_one {n : \u2115} (hn : n \u2260 0) : node n n = -1 := by\nhave : n * \u03c0 / n = \u03c0 := by aesop\n simp [node, this]\n```\n\n## Edit instruction\nEdit `node_eq_neg_one` so it still compiles and the proof is simplified where possible. Return the full updated `node_eq_neg_one` 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.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/Extremal.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal.node_eq_neg_one`, L56-L59)\n```lean\nlemma node_eq_neg_one {n : \u2115} (hn : n \u2260 0) : node n n = -1 := by\nhave : n * \u03c0 / n = \u03c0 := by aesop\n simp [node, this]\n```\n\n## Edit instruction\nEdit `node_eq_neg_one` so it still compiles and the proof is simplified where possible. Return the full updated `node_eq_neg_one` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/Extremal.lean", "module": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal", "declaration": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Extremal.node_eq_neg_one", "span": "L56-L59", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/Extremal.lean#L56"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 306, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 933, "lean_code_chars": 118, "natural_language_chars": 815, "lean_code_ratio": 0.1265, "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": "42f17ddc0f6adba8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Set.Basic.setOf_or", "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.Data.Set.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Set/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.Basic.setOf_or`, L216-L221)\n```lean\ntheorem setOf_or {p q : \u03b1 \u2192 Prop} : { a | p a \u2228 q a } = { a | p a } \u222a { a | q a } := rfl\n\n/-! ### Subset and strict subset relations -/\n```\n\n## Edit instruction\nEdit `setOf_or` so it still compiles and the proof is simplified where possible. Return the full updated `setOf_or` 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.Data.Set.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Set/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.Basic.setOf_or`, L216-L221)\n```lean\ntheorem setOf_or {p q : \u03b1 \u2192 Prop} : { a | p a \u2228 q a } = { a | p a } \u222a { a | q a } := rfl\n\n/-! ### Subset and strict subset relations -/\n```\n\n## Edit instruction\nEdit `setOf_or` so it still compiles and the proof is simplified where possible. Return the full updated `setOf_or` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Basic.lean", "module": "Mathlib.Data.Set.Basic", "declaration": "Mathlib.Data.Set.Basic.setOf_or", "span": "L216-L221", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Basic.lean#L216"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 263, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 800, "lean_code_chars": 136, "natural_language_chars": 664, "lean_code_ratio": 0.17, "line_count": 12, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f3031a1fcd342fd1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Finset.Lattice.Lemmas.singleton_inter_of_notMem", "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.Data.Finset.Lattice.Lemmas)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Finset/Lattice/Lemmas.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Finset.Lattice.Lemmas.singleton_inter_of_notMem`, L158-L161)\n```lean\ntheorem singleton_inter_of_notMem {a : \u03b1} {s : Finset \u03b1} (H : a \u2209 s) : {a} \u2229 s = \u2205 := eq_empty_of_forall_notMem <| by\n simp only [mem_inter, mem_singleton]; rintro x \u27e8rfl, h\u27e9; exact H h\n```\n\n## Edit instruction\nEdit `singleton_inter_of_notMem` so it still compiles and the proof is simplified where possible. Return the full updated `singleton_inter_of_notMem` 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.Data.Finset.Lattice.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Finset/Lattice/Lemmas.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Finset.Lattice.Lemmas.singleton_inter_of_notMem`, L158-L161)\n```lean\ntheorem singleton_inter_of_notMem {a : \u03b1} {s : Finset \u03b1} (H : a \u2209 s) : {a} \u2229 s = \u2205 := eq_empty_of_forall_notMem <| by\n simp only [mem_inter, mem_singleton]; rintro x \u27e8rfl, h\u27e9; exact H h\n```\n\n## Edit instruction\nEdit `singleton_inter_of_notMem` so it still compiles and the proof is simplified where possible. Return the full updated `singleton_inter_of_notMem` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Finset/Lattice/Lemmas.lean", "module": "Mathlib.Data.Finset.Lattice.Lemmas", "declaration": "Mathlib.Data.Finset.Lattice.Lemmas.singleton_inter_of_notMem", "span": "L158-L161", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finset/Lattice/Lemmas.lean#L158"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 311, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 940, "lean_code_chars": 189, "natural_language_chars": 751, "lean_code_ratio": 0.2011, "line_count": 11, "imports_count": 0, "declarations_count": 99, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "307156e4d57f18c1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Topology.Constructions.instTopologicalSpaceSigma", "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.Topology.Constructions)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Topology/Constructions.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.Constructions.instTopologicalSpaceSigma`, L61-L64)\n```lean\ninstance instTopologicalSpaceSigma {\u03b9 : Type*} {X : \u03b9 \u2192 Type v} [t\u2082 : \u2200 i, TopologicalSpace (X i)] :\n TopologicalSpace (Sigma X) := \u2a06 i, coinduced (Sigma.mk i) (t\u2082 i)\n```\n\n## Edit instruction\nEdit `instTopologicalSpaceSigma` so it still compiles and the proof is simplified where possible. Return the full updated `instTopologicalSpaceSigma` 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.Topology.Constructions).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Topology/Constructions.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.Constructions.instTopologicalSpaceSigma`, L61-L64)\n```lean\ninstance instTopologicalSpaceSigma {\u03b9 : Type*} {X : \u03b9 \u2192 Type v} [t\u2082 : \u2200 i, TopologicalSpace (X i)] :\n TopologicalSpace (Sigma X) := \u2a06 i, coinduced (Sigma.mk i) (t\u2082 i)\n```\n\n## Edit instruction\nEdit `instTopologicalSpaceSigma` so it still compiles and the proof is simplified where possible. Return the full updated `instTopologicalSpaceSigma` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Constructions.lean", "module": "Mathlib.Topology.Constructions", "declaration": "Mathlib.Topology.Constructions.instTopologicalSpaceSigma", "span": "L61-L64", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Constructions.lean#L61"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 277, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 907, "lean_code_chars": 170, "natural_language_chars": 737, "lean_code_ratio": 0.1874, "line_count": 11, "imports_count": 0, "declarations_count": 94, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8b6d3939124c099f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.MvPolynomial.Eval.eval_monomial", "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.Algebra.MvPolynomial.Eval)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/MvPolynomial/Eval.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.MvPolynomial.Eval.eval_monomial`, L262-L264)\n```lean\ntheorem eval_monomial : eval f (monomial s a) = a * s.prod fun n e => f n ^ e := eval\u2082_monomial _ _\n```\n\n## Edit instruction\nEdit `eval_monomial` so it still compiles and the proof is simplified where possible. Return the full updated `eval_monomial` 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.Algebra.MvPolynomial.Eval).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/MvPolynomial/Eval.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.MvPolynomial.Eval.eval_monomial`, L262-L264)\n```lean\ntheorem eval_monomial : eval f (monomial s a) = a * s.prod fun n e => f n ^ e := eval\u2082_monomial _ _\n```\n\n## Edit instruction\nEdit `eval_monomial` so it still compiles and the proof is simplified where possible. Return the full updated `eval_monomial` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/MvPolynomial/Eval.lean", "module": "Mathlib.Algebra.MvPolynomial.Eval", "declaration": "Mathlib.Algebra.MvPolynomial.Eval.eval_monomial", "span": "L262-L264", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/MvPolynomial/Eval.lean#L262"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 264, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 812, "lean_code_chars": 100, "natural_language_chars": 712, "lean_code_ratio": 0.1232, "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": "88d472921b1fd3eb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Order.Interval.Finset.Basic.uIcc_subset_uIcc_iff_le'", "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.Order.Interval.Finset.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Order/Interval/Finset/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.Interval.Finset.Basic.uIcc_subset_uIcc_iff_le'`, L972-L975)\n```lean\ntheorem uIcc_subset_uIcc_iff_le' :\n [[a\u2081, b\u2081]] \u2286 [[a\u2082, b\u2082]] \u2194 a\u2082 \u2293 b\u2082 \u2264 a\u2081 \u2293 b\u2081 \u2227 a\u2081 \u2294 b\u2081 \u2264 a\u2082 \u2294 b\u2082 := Icc_subset_Icc_iff inf_le_sup\n```\n\n## Edit instruction\nEdit `uIcc_subset_uIcc_iff_le'` so it still compiles and the proof is simplified where possible. Return the full updated `uIcc_subset_uIcc_iff_le'` 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.Order.Interval.Finset.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Order/Interval/Finset/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.Interval.Finset.Basic.uIcc_subset_uIcc_iff_le'`, L972-L975)\n```lean\ntheorem uIcc_subset_uIcc_iff_le' :\n [[a\u2081, b\u2081]] \u2286 [[a\u2082, b\u2082]] \u2194 a\u2082 \u2293 b\u2082 \u2264 a\u2081 \u2293 b\u2081 \u2227 a\u2081 \u2294 b\u2081 \u2264 a\u2082 \u2294 b\u2082 := Icc_subset_Icc_iff inf_le_sup\n```\n\n## Edit instruction\nEdit `uIcc_subset_uIcc_iff_le'` so it still compiles and the proof is simplified where possible. Return the full updated `uIcc_subset_uIcc_iff_le'` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Interval/Finset/Basic.lean", "module": "Mathlib.Order.Interval.Finset.Basic", "declaration": "Mathlib.Order.Interval.Finset.Basic.uIcc_subset_uIcc_iff_le'", "span": "L972-L975", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Finset/Basic.lean#L972"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 326, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 887, "lean_code_chars": 136, "natural_language_chars": 751, "lean_code_ratio": 0.1533, "line_count": 11, "imports_count": 0, "declarations_count": 92, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c19384826dccbdad", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Order.Nonneg.Basic.mk_sub_mk", "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.Algebra.Order.Nonneg.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Order/Nonneg/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Order.Nonneg.Basic.mk_sub_mk`, L283-L291)\n```lean\ntheorem mk_sub_mk [Sub \u03b1] {x y : \u03b1} (hx : 0 \u2264 x) (hy : 0 \u2264 y) :\n (\u27e8x, hx\u27e9 : { x : \u03b1 // 0 \u2264 x }) - \u27e8y, hy\u27e9 = toNonneg (x - y) := rfl\n\nend SemilatticeSup\n\nsection LinearOrder\nvariable [Zero \u03b1] [LinearOrder \u03b1]\n```\n\n## Edit instruction\nEdit `mk_sub_mk` so it still compiles and the proof is simplified where possible. Return the full updated `mk_sub_mk` 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.Algebra.Order.Nonneg.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Order/Nonneg/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Order.Nonneg.Basic.mk_sub_mk`, L283-L291)\n```lean\ntheorem mk_sub_mk [Sub \u03b1] {x y : \u03b1} (hx : 0 \u2264 x) (hy : 0 \u2264 y) :\n (\u27e8x, hx\u27e9 : { x : \u03b1 // 0 \u2264 x }) - \u27e8y, hy\u27e9 = toNonneg (x - y) := rfl\n\nend SemilatticeSup\n\nsection LinearOrder\nvariable [Zero \u03b1] [LinearOrder \u03b1]\n```\n\n## Edit instruction\nEdit `mk_sub_mk` so it still compiles and the proof is simplified where possible. Return the full updated `mk_sub_mk` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Nonneg/Basic.lean", "module": "Mathlib.Algebra.Order.Nonneg.Basic", "declaration": "Mathlib.Algebra.Order.Nonneg.Basic.mk_sub_mk", "span": "L283-L291", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Nonneg/Basic.lean#L283"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 323, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 913, "lean_code_chars": 210, "natural_language_chars": 703, "lean_code_ratio": 0.23, "line_count": 16, "imports_count": 0, "declarations_count": 102, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6378ef7580a60de7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.List.TFAE.tfae_of_cycle", "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.Data.List.TFAE)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/List/TFAE.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.List.TFAE.tfae_of_cycle`, L58-L67)\n```lean\ntheorem tfae_of_cycle {a b} {l : List Prop} (h_chain : List.IsChain (\u00b7 \u2192 \u00b7) (a :: b :: l))\n (h_last : getLastD l b \u2192 a) : TFAE (a :: b :: l) := by\ninduction l generalizing a b with\n | nil => simp_all [tfae_cons_cons, iff_def]\n | cons c l IH =>\n simp only [tfae_cons_cons, getLastD_cons, isChain_cons_cons] at *\n rcases h_chain with \u27e8ab, \u27e8bc, ch\u27e9\u27e9\n have := IH \u27e8bc, ch\u27e9 (ab \u2218 h_last)\n exact \u27e8\u27e8ab, h_last \u2218 (this.2 c (.head _) _ getLastD_mem_cons).1 \u2218 bc\u27e9, this\u27e9\n```\n\n## Edit instruction\nEdit `tfae_of_cycle` so it still compiles and the proof is simplified where possible. Return the full updated `tfae_of_cycle` 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.Data.List.TFAE).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/List/TFAE.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.List.TFAE.tfae_of_cycle`, L58-L67)\n```lean\ntheorem tfae_of_cycle {a b} {l : List Prop} (h_chain : List.IsChain (\u00b7 \u2192 \u00b7) (a :: b :: l))\n (h_last : getLastD l b \u2192 a) : TFAE (a :: b :: l) := by\ninduction l generalizing a b with\n | nil => simp_all [tfae_cons_cons, iff_def]\n | cons c l IH =>\n simp only [tfae_cons_cons, getLastD_cons, isChain_cons_cons] at *\n rcases h_chain with \u27e8ab, \u27e8bc, ch\u27e9\u27e9\n have := IH \u27e8bc, ch\u27e9 (ab \u2218 h_last)\n exact \u27e8\u27e8ab, h_last \u2218 (this.2 c (.head _) _ getLastD_mem_cons).1 \u2218 bc\u27e9, this\u27e9\n```\n\n## Edit instruction\nEdit `tfae_of_cycle` so it still compiles and the proof is simplified where possible. Return the full updated `tfae_of_cycle` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/List/TFAE.lean", "module": "Mathlib.Data.List.TFAE", "declaration": "Mathlib.Data.List.TFAE.tfae_of_cycle", "span": "L58-L67", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/TFAE.lean#L58"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 420, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1154, "lean_code_chars": 477, "natural_language_chars": 677, "lean_code_ratio": 0.4133, "line_count": 18, "imports_count": 0, "declarations_count": 140, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e61de801c4148b11", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.RingTheory.TwoSidedIdeal.Lattice.iInf_ringCon", "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.RingTheory.TwoSidedIdeal.Lattice)."}, {"role": "user", "content": "You are editing a file in `Mathlib/RingTheory/TwoSidedIdeal/Lattice.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.TwoSidedIdeal.Lattice.iInf_ringCon`, L93-L96)\n```lean\nlemma iInf_ringCon {\u03b9 : Type*} (I : \u03b9 \u2192 TwoSidedIdeal R) :\n (\u2a05 i, I i).ringCon = \u2a05 i, (I i).ringCon := by\nsimp only [iInf, sInf_ringCon]; congr!; ext; simp\n```\n\n## Edit instruction\nEdit `iInf_ringCon` so it still compiles and the proof is simplified where possible. Return the full updated `iInf_ringCon` 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.RingTheory.TwoSidedIdeal.Lattice).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/TwoSidedIdeal/Lattice.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.TwoSidedIdeal.Lattice.iInf_ringCon`, L93-L96)\n```lean\nlemma iInf_ringCon {\u03b9 : Type*} (I : \u03b9 \u2192 TwoSidedIdeal R) :\n (\u2a05 i, I i).ringCon = \u2a05 i, (I i).ringCon := by\nsimp only [iInf, sInf_ringCon]; congr!; ext; simp\n```\n\n## Edit instruction\nEdit `iInf_ringCon` so it still compiles and the proof is simplified where possible. Return the full updated `iInf_ringCon` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/TwoSidedIdeal/Lattice.lean", "module": "Mathlib.RingTheory.TwoSidedIdeal.Lattice", "declaration": "Mathlib.RingTheory.TwoSidedIdeal.Lattice.iInf_ringCon", "span": "L93-L96", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/TwoSidedIdeal/Lattice.lean#L93"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 308, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 887, "lean_code_chars": 159, "natural_language_chars": 728, "lean_code_ratio": 0.1793, "line_count": 12, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "63d37f9f5ae1737e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Order.Category.Preord.inv_hom_apply", "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.Order.Category.Preord)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Order/Category/Preord.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.Category.Preord.inv_hom_apply`, L140-L142)\n```lean\nlemma inv_hom_apply {X Y : Preord} (e : X \u2245 Y) (x : X) : e.inv (e.hom x) = x := by\nsimp\n```\n\n## Edit instruction\nEdit `inv_hom_apply` so it still compiles and the proof is simplified where possible. Return the full updated `inv_hom_apply` 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.Order.Category.Preord).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Order/Category/Preord.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.Category.Preord.inv_hom_apply`, L140-L142)\n```lean\nlemma inv_hom_apply {X Y : Preord} (e : X \u2245 Y) (x : X) : e.inv (e.hom x) = x := by\nsimp\n```\n\n## Edit instruction\nEdit `inv_hom_apply` so it still compiles and the proof is simplified where possible. Return the full updated `inv_hom_apply` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Category/Preord.lean", "module": "Mathlib.Order.Category.Preord", "declaration": "Mathlib.Order.Category.Preord.inv_hom_apply", "span": "L140-L142", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Category/Preord.lean#L140"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 261, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 788, "lean_code_chars": 88, "natural_language_chars": 700, "lean_code_ratio": 0.1117, "line_count": 11, "imports_count": 0, "declarations_count": 91, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9a9f5238ad07c8a0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Set.Lattice.Image.prod_eq_biUnion_left", "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.Data.Set.Lattice.Image)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Set/Lattice/Image.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.Lattice.Image.prod_eq_biUnion_left`, L573-L575)\n```lean\ntheorem prod_eq_biUnion_left : s \u00d7\u02e2 t = \u22c3 a \u2208 s, (fun b => (a, b)) '' t := by\nrw [iUnion_image_left, image2_mk_eq_prod]\n```\n\n## Edit instruction\nEdit `prod_eq_biUnion_left` so it still compiles and the proof is simplified where possible. Return the full updated `prod_eq_biUnion_left` 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.Data.Set.Lattice.Image).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Set/Lattice/Image.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.Lattice.Image.prod_eq_biUnion_left`, L573-L575)\n```lean\ntheorem prod_eq_biUnion_left : s \u00d7\u02e2 t = \u22c3 a \u2208 s, (fun b => (a, b)) '' t := by\nrw [iUnion_image_left, image2_mk_eq_prod]\n```\n\n## Edit instruction\nEdit `prod_eq_biUnion_left` so it still compiles and the proof is simplified where possible. Return the full updated `prod_eq_biUnion_left` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Lattice/Image.lean", "module": "Mathlib.Data.Set.Lattice.Image", "declaration": "Mathlib.Data.Set.Lattice.Image.prod_eq_biUnion_left", "span": "L573-L575", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Lattice/Image.lean#L573"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 273, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 844, "lean_code_chars": 120, "natural_language_chars": 724, "lean_code_ratio": 0.1422, "line_count": 11, "imports_count": 0, "declarations_count": 91, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7a6c86a9449a34a5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.DFinsupp.WellFounded.Pi", "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.Data.DFinsupp.WellFounded)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/DFinsupp/WellFounded.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.DFinsupp.WellFounded.Pi`, L187-L195)\n```lean\ntheorem Pi.Lex.wellFounded [IsStrictTotalOrder \u03b9 r] [Finite \u03b9] (hs : \u2200 i, WellFounded (s i)) :\n WellFounded (Pi.Lex r (fun {i} \u21a6 s i)) := by\nobtain h | \u27e8\u27e8x\u27e9\u27e9 := isEmpty_or_nonempty (\u2200 i, \u03b1 i)\n \u00b7 convert emptyWf.wf\n letI : \u2200 i, Zero (\u03b1 i) := fun i => \u27e8(hs i).min \u22a4 \u27e8x i, trivial\u27e9\u27e9\n haveI := IsTrans.swap r; haveI := Std.Irrefl.swap r; haveI := Fintype.ofFinite \u03b9\n refine InvImage.wf equivFunOnFintype.symm (Lex.wellFounded' (fun i a => ?_) hs ?_)\n exacts [(hs i).not_lt_min \u22a4 trivial, Finite.wellFounded_of_trans_of_irrefl (Function.swap r)]\n```\n\n## Edit instruction\nEdit `Pi` so it still compiles and the proof is simplified where possible. Return the full updated `Pi` 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.Data.DFinsupp.WellFounded).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/DFinsupp/WellFounded.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.DFinsupp.WellFounded.Pi`, L187-L195)\n```lean\ntheorem Pi.Lex.wellFounded [IsStrictTotalOrder \u03b9 r] [Finite \u03b9] (hs : \u2200 i, WellFounded (s i)) :\n WellFounded (Pi.Lex r (fun {i} \u21a6 s i)) := by\nobtain h | \u27e8\u27e8x\u27e9\u27e9 := isEmpty_or_nonempty (\u2200 i, \u03b1 i)\n \u00b7 convert emptyWf.wf\n letI : \u2200 i, Zero (\u03b1 i) := fun i => \u27e8(hs i).min \u22a4 \u27e8x i, trivial\u27e9\u27e9\n haveI := IsTrans.swap r; haveI := Std.Irrefl.swap r; haveI := Fintype.ofFinite \u03b9\n refine InvImage.wf equivFunOnFintype.symm (Lex.wellFounded' (fun i a => ?_) hs ?_)\n exacts [(hs i).not_lt_min \u22a4 trivial, Finite.wellFounded_of_trans_of_irrefl (Function.swap r)]\n```\n\n## Edit instruction\nEdit `Pi` so it still compiles and the proof is simplified where possible. Return the full updated `Pi` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/DFinsupp/WellFounded.lean", "module": "Mathlib.Data.DFinsupp.WellFounded", "declaration": "Mathlib.Data.DFinsupp.WellFounded.Pi", "span": "L187-L195", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/DFinsupp/WellFounded.lean#L187"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 453, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1228, "lean_code_chars": 549, "natural_language_chars": 679, "lean_code_ratio": 0.4471, "line_count": 17, "imports_count": 0, "declarations_count": 139, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9b7545a7eb504277", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Order.SupClosed.latticeClosure_min", "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.Order.SupClosed)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Order/SupClosed.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.SupClosed.latticeClosure_min`, L437-L439)\n```lean\nlemma latticeClosure_min : s \u2286 t \u2192 IsSublattice t \u2192 latticeClosure s \u2286 t := latticeClosure.closure_min\n```\n\n## Edit instruction\nEdit `latticeClosure_min` so it still compiles and the proof is simplified where possible. Return the full updated `latticeClosure_min` 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.Order.SupClosed).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Order/SupClosed.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.SupClosed.latticeClosure_min`, L437-L439)\n```lean\nlemma latticeClosure_min : s \u2286 t \u2192 IsSublattice t \u2192 latticeClosure s \u2286 t := latticeClosure.closure_min\n```\n\n## Edit instruction\nEdit `latticeClosure_min` so it still compiles and the proof is simplified where possible. Return the full updated `latticeClosure_min` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/SupClosed.lean", "module": "Mathlib.Order.SupClosed", "declaration": "Mathlib.Order.SupClosed.latticeClosure_min", "span": "L437-L439", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/SupClosed.lean#L437"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 249, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 800, "lean_code_chars": 103, "natural_language_chars": 697, "lean_code_ratio": 0.1288, "line_count": 10, "imports_count": 0, "declarations_count": 84, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f3e606314682ea00", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Finset.Max.exists_next_left", "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.Data.Finset.Max)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Finset/Max.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Finset.Max.exists_next_left`, L409-L413)\n```lean\ntheorem exists_next_left {x : \u03b1} {s : Finset \u03b1} (h : \u2203 y \u2208 s, y < x) :\n \u2203 y \u2208 s, y < x \u2227 \u2200 z \u2208 s, z < x \u2192 z \u2264 y := @exists_next_right \u03b1\u1d52\u1d48 _ x s h\n\n/-- If finsets `s` and `t` are interleaved, then `Finset.card s \u2264 Finset.card t + 1`. -/\n```\n\n## Edit instruction\nEdit `exists_next_left` so it still compiles and the proof is simplified where possible. Return the full updated `exists_next_left` 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.Data.Finset.Max).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Finset/Max.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Finset.Max.exists_next_left`, L409-L413)\n```lean\ntheorem exists_next_left {x : \u03b1} {s : Finset \u03b1} (h : \u2203 y \u2208 s, y < x) :\n \u2203 y \u2208 s, y < x \u2227 \u2200 z \u2208 s, z < x \u2192 z \u2264 y := @exists_next_right \u03b1\u1d52\u1d48 _ x s h\n\n/-- If finsets `s` and `t` are interleaved, then `Finset.card s \u2264 Finset.card t + 1`. -/\n```\n\n## Edit instruction\nEdit `exists_next_left` so it still compiles and the proof is simplified where possible. Return the full updated `exists_next_left` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Finset/Max.lean", "module": "Mathlib.Data.Finset.Max", "declaration": "Mathlib.Data.Finset.Max.exists_next_left", "span": "L409-L413", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finset/Max.lean#L409"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 321, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 930, "lean_code_chars": 239, "natural_language_chars": 691, "lean_code_ratio": 0.257, "line_count": 13, "imports_count": 0, "declarations_count": 112, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3389012aff562f1d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Group.Pointwise.Finset.Basic.image_one", "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.Algebra.Group.Pointwise.Finset.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Group.Pointwise.Finset.Basic.image_one`, L110-L112)\n```lean\ntheorem image_one [DecidableEq \u03b2] {f : \u03b1 \u2192 \u03b2} : image f 1 = {f 1} := image_singleton _ _\n```\n\n## Edit instruction\nEdit `image_one` so it still compiles and the proof is simplified where possible. Return the full updated `image_one` 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.Algebra.Group.Pointwise.Finset.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Group.Pointwise.Finset.Basic.image_one`, L110-L112)\n```lean\ntheorem image_one [DecidableEq \u03b2] {f : \u03b1 \u2192 \u03b2} : image f 1 = {f 1} := image_singleton _ _\n```\n\n## Edit instruction\nEdit `image_one` so it still compiles and the proof is simplified where possible. Return the full updated `image_one` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean", "module": "Mathlib.Algebra.Group.Pointwise.Finset.Basic", "declaration": "Mathlib.Algebra.Group.Pointwise.Finset.Basic.image_one", "span": "L110-L112", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean#L110"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 260, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 822, "lean_code_chars": 89, "natural_language_chars": 733, "lean_code_ratio": 0.1083, "line_count": 10, "imports_count": 0, "declarations_count": 87, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "46bb47062e5327fd", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Topology.EMetricSpace.Lipschitz.continuousOn_prod_of_continuousOn_lipschitzOnWith'", "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.Topology.EMetricSpace.Lipschitz)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Topology/EMetricSpace/Lipschitz.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.EMetricSpace.Lipschitz.continuousOn_prod_of_continuousOn_lipschitzOnWith'`, L510-L517)\n```lean\ntheorem continuousOn_prod_of_continuousOn_lipschitzOnWith' [TopologicalSpace \u03b1]\n [PseudoEMetricSpace \u03b2] [PseudoEMetricSpace \u03b3] (f : \u03b1 \u00d7 \u03b2 \u2192 \u03b3) {s : Set \u03b1} {t : Set \u03b2} (K : \u211d\u22650)\n (ha : \u2200 a \u2208 s, LipschitzOnWith K (fun y => f (a, y)) t)\n (hb : \u2200 b \u2208 t, ContinuousOn (fun x => f (x, b)) s) : ContinuousOn f (s \u00d7\u02e2 t) := have : ContinuousOn (f \u2218 Prod.swap) (t \u00d7\u02e2 s) :=\n continuousOn_prod_of_continuousOn_lipschitzOnWith _ K hb ha\n this.comp continuous_swap.continuousOn (mapsTo_swap_prod _ _)\n```\n\n## Edit instruction\nEdit `continuousOn_prod_of_continuousOn_lipschitzOnWith'` so it still compiles and the proof is simplified where possible. Return the full updated `continuousOn_prod_of_continuousOn_lipschitzOnWith'` 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.Topology.EMetricSpace.Lipschitz).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Topology/EMetricSpace/Lipschitz.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.EMetricSpace.Lipschitz.continuousOn_prod_of_continuousOn_lipschitzOnWith'`, L510-L517)\n```lean\ntheorem continuousOn_prod_of_continuousOn_lipschitzOnWith' [TopologicalSpace \u03b1]\n [PseudoEMetricSpace \u03b2] [PseudoEMetricSpace \u03b3] (f : \u03b1 \u00d7 \u03b2 \u2192 \u03b3) {s : Set \u03b1} {t : Set \u03b2} (K : \u211d\u22650)\n (ha : \u2200 a \u2208 s, LipschitzOnWith K (fun y => f (a, y)) t)\n (hb : \u2200 b \u2208 t, ContinuousOn (fun x => f (x, b)) s) : ContinuousOn f (s \u00d7\u02e2 t) := have : ContinuousOn (f \u2218 Prod.swap) (t \u00d7\u02e2 s) :=\n continuousOn_prod_of_continuousOn_lipschitzOnWith _ K hb ha\n this.comp continuous_swap.continuousOn (mapsTo_swap_prod _ _)\n```\n\n## Edit instruction\nEdit `continuousOn_prod_of_continuousOn_lipschitzOnWith'` so it still compiles and the proof is simplified where possible. Return the full updated `continuousOn_prod_of_continuousOn_lipschitzOnWith'` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/EMetricSpace/Lipschitz.lean", "module": "Mathlib.Topology.EMetricSpace.Lipschitz", "declaration": "Mathlib.Topology.EMetricSpace.Lipschitz.continuousOn_prod_of_continuousOn_lipschitzOnWith'", "span": "L510-L517", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/EMetricSpace/Lipschitz.lean#L510"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 456, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1341, "lean_code_chars": 500, "natural_language_chars": 841, "lean_code_ratio": 0.3729, "line_count": 15, "imports_count": 0, "declarations_count": 127, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a7d044d3dd950f7b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Order.KrullDimension.krullDim_eq_iSup_height_add_coheight_of_nonempty", "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.Order.KrullDimension)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Order/KrullDimension.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.KrullDimension.krullDim_eq_iSup_height_add_coheight_of_nonempty`, L800-L827)\n```lean\nlemma krullDim_eq_iSup_height_add_coheight_of_nonempty [Nonempty \u03b1] :\n krullDim \u03b1 = \u2191(\u2a06 (a : \u03b1), height a + coheight a) := by\napply le_antisymm\n \u00b7 rw [krullDim_eq_iSup_height_of_nonempty, WithBot.coe_le_coe]\n apply ciSup_mono (by bddDefault) (by simp)\n \u00b7 wlog hnottop : krullDim \u03b1 < \u22a4\n \u00b7 simp_all\n rw [krullDim_eq_iSup_length, WithBot.coe_le_coe]\n apply iSup_le\n intro a\n have : height a < \u22a4 := WithBot.coe_lt_coe.mp (lt_of_le_of_lt (height_le_krullDim a) hnottop)\n have : coheight a < \u22a4 := WithBot.coe_lt_coe.mp (lt_of_le_of_lt (coheight_le_krullDim a) hnottop)\n cases hh : height a with\n | top => simp_all\n | coe n =>\n cases hch : coheight a with\n | top => simp_all\n | coe m =>\n obtain \u27e8p\u2081, hlast, hlen\u2081\u27e9 := exists_series_of_height_eq_coe a hh\n obtain \u27e8p\u2082, hhead, hlen\u2082\u27e9 := exists_series_of_coheight_eq_coe a hch\n apply le_iSup_of_le ((p\u2081.smash p\u2082) (by simp [*])) (by simp [*])\n\n/--\nThe Krull dimension is the supremum of the elements' heights.\n\nIf `\u03b1` is `Nonempty`, then `krullDim_eq_iSup_height_of_nonempty`, with the coercion from\n`\u2115\u221e` to `WithBot \u2115\u221e` outside the supremum, can be more convenient.\n-/\n```\n\n## Edit instruction\nEdit `krullDim_eq_iSup_height_add_coheight_of_nonempty` so it still compiles and the proof is simplified where possible. Return the full updated `krullDim_eq_iSup_height_add_coheight_of_nonempty` 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.Order.KrullDimension).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Order/KrullDimension.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.KrullDimension.krullDim_eq_iSup_height_add_coheight_of_nonempty`, L800-L827)\n```lean\nlemma krullDim_eq_iSup_height_add_coheight_of_nonempty [Nonempty \u03b1] :\n krullDim \u03b1 = \u2191(\u2a06 (a : \u03b1), height a + coheight a) := by\napply le_antisymm\n \u00b7 rw [krullDim_eq_iSup_height_of_nonempty, WithBot.coe_le_coe]\n apply ciSup_mono (by bddDefault) (by simp)\n \u00b7 wlog hnottop : krullDim \u03b1 < \u22a4\n \u00b7 simp_all\n rw [krullDim_eq_iSup_length, WithBot.coe_le_coe]\n apply iSup_le\n intro a\n have : height a < \u22a4 := WithBot.coe_lt_coe.mp (lt_of_le_of_lt (height_le_krullDim a) hnottop)\n have : coheight a < \u22a4 := WithBot.coe_lt_coe.mp (lt_of_le_of_lt (coheight_le_krullDim a) hnottop)\n cases hh : height a with\n | top => simp_all\n | coe n =>\n cases hch : coheight a with\n | top => simp_all\n | coe m =>\n obtain \u27e8p\u2081, hlast, hlen\u2081\u27e9 := exists_series_of_height_eq_coe a hh\n obtain \u27e8p\u2082, hhead, hlen\u2082\u27e9 := exists_series_of_coheight_eq_coe a hch\n apply le_iSup_of_le ((p\u2081.smash p\u2082) (by simp [*])) (by simp [*])\n\n/--\nThe Krull dimension is the supremum of the elements' heights.\n\nIf `\u03b1` is `Nonempty`, then `krullDim_eq_iSup_height_of_nonempty`, with the coercion from\n`\u2115\u221e` to `WithBot \u2115\u221e` outside the supremum, can be more convenient.\n-/\n```\n\n## Edit instruction\nEdit `krullDim_eq_iSup_height_add_coheight_of_nonempty` so it still compiles and the proof is simplified where possible. Return the full updated `krullDim_eq_iSup_height_add_coheight_of_nonempty` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/KrullDimension.lean", "module": "Mathlib.Order.KrullDimension", "declaration": "Mathlib.Order.KrullDimension.krullDim_eq_iSup_height_add_coheight_of_nonempty", "span": "L800-L827", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/KrullDimension.lean#L800"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 676, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1980, "lean_code_chars": 1178, "natural_language_chars": 802, "lean_code_ratio": 0.5949, "line_count": 37, "imports_count": 0, "declarations_count": 191, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "2f8fce86f8f58b8c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.NumberTheory.NumberField.Basic.minpoly_coe", "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.NumberTheory.NumberField.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/NumberTheory/NumberField/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.NumberField.Basic.minpoly_coe`, L265-L268)\n```lean\ntheorem minpoly_coe (x : \ud835\udcde K) :\n minpoly \u2124 (x : K) = minpoly \u2124 x := minpoly.algebraMap_eq RingOfIntegers.coe_injective x\n```\n\n## Edit instruction\nEdit `minpoly_coe` so it still compiles and the proof is simplified where possible. Return the full updated `minpoly_coe` 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.NumberTheory.NumberField.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/NumberField/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.NumberField.Basic.minpoly_coe`, L265-L268)\n```lean\ntheorem minpoly_coe (x : \ud835\udcde K) :\n minpoly \u2124 (x : K) = minpoly \u2124 x := minpoly.algebraMap_eq RingOfIntegers.coe_injective x\n```\n\n## Edit instruction\nEdit `minpoly_coe` so it still compiles and the proof is simplified where possible. Return the full updated `minpoly_coe` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/Basic.lean", "module": "Mathlib.NumberTheory.NumberField.Basic", "declaration": "Mathlib.NumberTheory.NumberField.Basic.minpoly_coe", "span": "L265-L268", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/Basic.lean#L265"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 272, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 845, "lean_code_chars": 124, "natural_language_chars": 721, "lean_code_ratio": 0.1467, "line_count": 11, "imports_count": 0, "declarations_count": 87, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "beba67cadba1e9d6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.Analytic.CPolynomialDef.HasFiniteFPowerSeriesOnBall", "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.Analysis.Analytic.CPolynomialDef)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/Analytic/CPolynomialDef.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Analytic.CPolynomialDef.HasFiniteFPowerSeriesOnBall`, L437-L453)\n```lean\ntheorem HasFiniteFPowerSeriesOnBall.changeOrigin (hf : HasFiniteFPowerSeriesOnBall f p x n r)\n (h : (\u2016y\u2016\u208a : \u211d\u22650\u221e) < r) :\n HasFiniteFPowerSeriesOnBall f (p.changeOrigin y) (x + y) n (r - \u2016y\u2016\u208a) where\n r_le := (tsub_le_tsub_right hf.r_le _).trans p.changeOrigin_radius\nr_pos := by simp [h]\n finite _ hm := p.changeOrigin_finite_of_finite hf.finite hm\n hasSum {z} hz := by\n have : f (x + y + z) =\n FormalMultilinearSeries.sum (FormalMultilinearSeries.changeOrigin p y) z := by\n rw [mem_eball_zero_iff, lt_tsub_iff_right, add_comm] at hz\n rw [p.changeOrigin_eval_of_finite hf.finite, add_assoc, hf.sum]\n exact mem_eball_zero_iff.2 ((enorm_add_le _ _).trans_lt hz)\n rw [this]\n apply (p.changeOrigin y).hasSum_of_finite fun _ => p.changeOrigin_finite_of_finite hf.finite\n\n/-- If a function admits a finite power series expansion `p` on an open ball `B (x, r)`, then\nit is continuously polynomial at every point of this ball. -/\n```\n\n## Edit instruction\nEdit `HasFiniteFPowerSeriesOnBall` so it still compiles and the proof is simplified where possible. Return the full updated `HasFiniteFPowerSeriesOnBall` 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.Analysis.Analytic.CPolynomialDef).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Analytic/CPolynomialDef.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Analytic.CPolynomialDef.HasFiniteFPowerSeriesOnBall`, L437-L453)\n```lean\ntheorem HasFiniteFPowerSeriesOnBall.changeOrigin (hf : HasFiniteFPowerSeriesOnBall f p x n r)\n (h : (\u2016y\u2016\u208a : \u211d\u22650\u221e) < r) :\n HasFiniteFPowerSeriesOnBall f (p.changeOrigin y) (x + y) n (r - \u2016y\u2016\u208a) where\n r_le := (tsub_le_tsub_right hf.r_le _).trans p.changeOrigin_radius\nr_pos := by simp [h]\n finite _ hm := p.changeOrigin_finite_of_finite hf.finite hm\n hasSum {z} hz := by\n have : f (x + y + z) =\n FormalMultilinearSeries.sum (FormalMultilinearSeries.changeOrigin p y) z := by\n rw [mem_eball_zero_iff, lt_tsub_iff_right, add_comm] at hz\n rw [p.changeOrigin_eval_of_finite hf.finite, add_assoc, hf.sum]\n exact mem_eball_zero_iff.2 ((enorm_add_le _ _).trans_lt hz)\n rw [this]\n apply (p.changeOrigin y).hasSum_of_finite fun _ => p.changeOrigin_finite_of_finite hf.finite\n\n/-- If a function admits a finite power series expansion `p` on an open ball `B (x, r)`, then\nit is continuously polynomial at every point of this ball. -/\n```\n\n## Edit instruction\nEdit `HasFiniteFPowerSeriesOnBall` so it still compiles and the proof is simplified where possible. Return the full updated `HasFiniteFPowerSeriesOnBall` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Analytic/CPolynomialDef.lean", "module": "Mathlib.Analysis.Analytic.CPolynomialDef", "declaration": "Mathlib.Analysis.Analytic.CPolynomialDef.HasFiniteFPowerSeriesOnBall", "span": "L437-L453", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Analytic/CPolynomialDef.lean#L437"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 579, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1736, "lean_code_chars": 961, "natural_language_chars": 775, "lean_code_ratio": 0.5536, "line_count": 26, "imports_count": 0, "declarations_count": 184, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "c1fe9048da5f2ea8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.LinearAlgebra.QuadraticForm.Basic.isOrtho_comm", "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.LinearAlgebra.QuadraticForm.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/LinearAlgebra/QuadraticForm/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.QuadraticForm.Basic.isOrtho_comm`, L1060-L1063)\n```lean\ntheorem isOrtho_comm {x y : M} : IsOrtho Q x y \u2194 IsOrtho Q y x := by simp_rw [isOrtho_def, add_comm]\nalias \u27e8IsOrtho.symm, _\u27e9 := isOrtho_comm\n```\n\n## Edit instruction\nEdit `isOrtho_comm` so it still compiles and the proof is simplified where possible. Return the full updated `isOrtho_comm` 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.LinearAlgebra.QuadraticForm.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/LinearAlgebra/QuadraticForm/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.QuadraticForm.Basic.isOrtho_comm`, L1060-L1063)\n```lean\ntheorem isOrtho_comm {x y : M} : IsOrtho Q x y \u2194 IsOrtho Q y x := by simp_rw [isOrtho_def, add_comm]\nalias \u27e8IsOrtho.symm, _\u27e9 := isOrtho_comm\n```\n\n## Edit instruction\nEdit `isOrtho_comm` so it still compiles and the proof is simplified where possible. Return the full updated `isOrtho_comm` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/QuadraticForm/Basic.lean", "module": "Mathlib.LinearAlgebra.QuadraticForm.Basic", "declaration": "Mathlib.LinearAlgebra.QuadraticForm.Basic.isOrtho_comm", "span": "L1060-L1063", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/QuadraticForm/Basic.lean#L1060"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 307, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 876, "lean_code_chars": 141, "natural_language_chars": 735, "lean_code_ratio": 0.161, "line_count": 11, "imports_count": 0, "declarations_count": 96, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d7ed66deec1cd622", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.LinearAlgebra.CliffordAlgebra.Even.even_toSubmodule", "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.LinearAlgebra.CliffordAlgebra.Even)."}, {"role": "user", "content": "You are editing a file in `Mathlib/LinearAlgebra/CliffordAlgebra/Even.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.CliffordAlgebra.Even.even_toSubmodule`, L59-L64)\n```lean\ntheorem even_toSubmodule : Subalgebra.toSubmodule (even Q) = evenOdd Q 0 := rfl\n\nvariable (A)\n\n/-- The type of bilinear maps which are accepted by `CliffordAlgebra.even.lift`. -/\n```\n\n## Edit instruction\nEdit `even_toSubmodule` so it still compiles and the proof is simplified where possible. Return the full updated `even_toSubmodule` 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.LinearAlgebra.CliffordAlgebra.Even).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/LinearAlgebra/CliffordAlgebra/Even.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.CliffordAlgebra.Even.even_toSubmodule`, L59-L64)\n```lean\ntheorem even_toSubmodule : Subalgebra.toSubmodule (even Q) = evenOdd Q 0 := rfl\n\nvariable (A)\n\n/-- The type of bilinear maps which are accepted by `CliffordAlgebra.even.lift`. -/\n```\n\n## Edit instruction\nEdit `even_toSubmodule` so it still compiles and the proof is simplified where possible. Return the full updated `even_toSubmodule` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/CliffordAlgebra/Even.lean", "module": "Mathlib.LinearAlgebra.CliffordAlgebra.Even", "declaration": "Mathlib.LinearAlgebra.CliffordAlgebra.Even.even_toSubmodule", "span": "L59-L64", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/CliffordAlgebra/Even.lean#L59"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 288, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 925, "lean_code_chars": 179, "natural_language_chars": 746, "lean_code_ratio": 0.1935, "line_count": 14, "imports_count": 0, "declarations_count": 95, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0b0f89fc16361a7b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.List.Sort.sortedGT_iff_isChain", "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.Data.List.Sort)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/List/Sort.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.List.Sort.sortedGT_iff_isChain`, L461-L470)\n```lean\ntheorem sortedGT_iff_isChain : l.SortedGT \u2194 IsChain (\u00b7 > \u00b7) l := sortedGT_iff_pairwise.trans isChain_iff_pairwise.symm\n\nprotected alias \u27e8SortedLE.isChain, IsChain.sortedLE\u27e9 := sortedLE_iff_isChain\nprotected alias \u27e8SortedGE.isChain, IsChain.sortedGE\u27e9 := sortedGE_iff_isChain\nprotected alias \u27e8SortedLT.isChain, IsChain.sortedLT\u27e9 := sortedLT_iff_isChain\nprotected alias \u27e8SortedGT.isChain, IsChain.sortedGT\u27e9 := sortedGT_iff_isChain\n\nsection Decidable\n```\n\n## Edit instruction\nEdit `sortedGT_iff_isChain` so it still compiles and the proof is simplified where possible. Return the full updated `sortedGT_iff_isChain` 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.Data.List.Sort).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/List/Sort.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.List.Sort.sortedGT_iff_isChain`, L461-L470)\n```lean\ntheorem sortedGT_iff_isChain : l.SortedGT \u2194 IsChain (\u00b7 > \u00b7) l := sortedGT_iff_pairwise.trans isChain_iff_pairwise.symm\n\nprotected alias \u27e8SortedLE.isChain, IsChain.sortedLE\u27e9 := sortedLE_iff_isChain\nprotected alias \u27e8SortedGE.isChain, IsChain.sortedGE\u27e9 := sortedGE_iff_isChain\nprotected alias \u27e8SortedLT.isChain, IsChain.sortedLT\u27e9 := sortedLT_iff_isChain\nprotected alias \u27e8SortedGT.isChain, IsChain.sortedGT\u27e9 := sortedGT_iff_isChain\n\nsection Decidable\n```\n\n## Edit instruction\nEdit `sortedGT_iff_isChain` so it still compiles and the proof is simplified where possible. Return the full updated `sortedGT_iff_isChain` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/List/Sort.lean", "module": "Mathlib.Data.List.Sort", "declaration": "Mathlib.Data.List.Sort.sortedGT_iff_isChain", "span": "L461-L470", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/Sort.lean#L461"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 358, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1147, "lean_code_chars": 447, "natural_language_chars": 700, "lean_code_ratio": 0.3897, "line_count": 17, "imports_count": 0, "declarations_count": 104, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "994db6484e89e6f6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.MvPolynomial.Eval.aeval_X_left_apply", "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.Algebra.MvPolynomial.Eval)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/MvPolynomial/Eval.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.MvPolynomial.Eval.aeval_X_left_apply`, L634-L636)\n```lean\ntheorem aeval_X_left_apply (p : MvPolynomial \u03c3 R) : aeval X p = p := AlgHom.congr_fun aeval_X_left p\n```\n\n## Edit instruction\nEdit `aeval_X_left_apply` so it still compiles and the proof is simplified where possible. Return the full updated `aeval_X_left_apply` 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.Algebra.MvPolynomial.Eval).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/MvPolynomial/Eval.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.MvPolynomial.Eval.aeval_X_left_apply`, L634-L636)\n```lean\ntheorem aeval_X_left_apply (p : MvPolynomial \u03c3 R) : aeval X p = p := AlgHom.congr_fun aeval_X_left p\n```\n\n## Edit instruction\nEdit `aeval_X_left_apply` so it still compiles and the proof is simplified where possible. Return the full updated `aeval_X_left_apply` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/MvPolynomial/Eval.lean", "module": "Mathlib.Algebra.MvPolynomial.Eval", "declaration": "Mathlib.Algebra.MvPolynomial.Eval.aeval_X_left_apply", "span": "L634-L636", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/MvPolynomial/Eval.lean#L634"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 273, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 828, "lean_code_chars": 101, "natural_language_chars": 727, "lean_code_ratio": 0.122, "line_count": 10, "imports_count": 0, "declarations_count": 87, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "49bfbb69c9f53ef5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.LinearAlgebra.Matrix.PosDef.of_dotProduct_mulVec_nonneg", "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.LinearAlgebra.Matrix.PosDef)."}, {"role": "user", "content": "You are editing a file in `Mathlib/LinearAlgebra/Matrix/PosDef.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.Matrix.PosDef.of_dotProduct_mulVec_nonneg`, L301-L305)\n```lean\nlemma of_dotProduct_mulVec_nonneg {M : Matrix n n R} (hM1 : M.IsHermitian)\n (hM2 : \u2200 x, 0 \u2264 star x \u2b1d\u1d65 (M *\u1d65 x)) : M.PosSemidef := posSemidef_iff_dotProduct_mulVec.mpr \u27e8hM1, hM2\u27e9\n\nomit [Fintype m] in variable [Finite m] in\n```\n\n## Edit instruction\nEdit `of_dotProduct_mulVec_nonneg` so it still compiles and the proof is simplified where possible. Return the full updated `of_dotProduct_mulVec_nonneg` 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.LinearAlgebra.Matrix.PosDef).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/LinearAlgebra/Matrix/PosDef.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.Matrix.PosDef.of_dotProduct_mulVec_nonneg`, L301-L305)\n```lean\nlemma of_dotProduct_mulVec_nonneg {M : Matrix n n R} (hM1 : M.IsHermitian)\n (hM2 : \u2200 x, 0 \u2264 star x \u2b1d\u1d65 (M *\u1d65 x)) : M.PosSemidef := posSemidef_iff_dotProduct_mulVec.mpr \u27e8hM1, hM2\u27e9\n\nomit [Fintype m] in variable [Finite m] in\n```\n\n## Edit instruction\nEdit `of_dotProduct_mulVec_nonneg` so it still compiles and the proof is simplified where possible. Return the full updated `of_dotProduct_mulVec_nonneg` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Matrix/PosDef.lean", "module": "Mathlib.LinearAlgebra.Matrix.PosDef", "declaration": "Mathlib.LinearAlgebra.Matrix.PosDef.of_dotProduct_mulVec_nonneg", "span": "L301-L305", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/PosDef.lean#L301"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 347, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 985, "lean_code_chars": 225, "natural_language_chars": 760, "lean_code_ratio": 0.2284, "line_count": 13, "imports_count": 0, "declarations_count": 102, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5fde76df7d887558", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Field.IsField.IsField", "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.Algebra.Field.IsField)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Field/IsField.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Field.IsField.IsField`, L51-L53)\n```lean\ntheorem IsField.nontrivial {R : Type u} [Semiring R] (h : IsField R) : Nontrivial R := \u27e8h.exists_pair_ne\u27e9\n```\n\n## Edit instruction\nEdit `IsField` so it still compiles and the proof is simplified where possible. Return the full updated `IsField` 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.Algebra.Field.IsField).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Field/IsField.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Field.IsField.IsField`, L51-L53)\n```lean\ntheorem IsField.nontrivial {R : Type u} [Semiring R] (h : IsField R) : Nontrivial R := \u27e8h.exists_pair_ne\u27e9\n```\n\n## Edit instruction\nEdit `IsField` so it still compiles and the proof is simplified where possible. Return the full updated `IsField` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Field/IsField.lean", "module": "Mathlib.Algebra.Field.IsField", "declaration": "Mathlib.Algebra.Field.IsField.IsField", "span": "L51-L53", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Field/IsField.lean#L51"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 250, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 786, "lean_code_chars": 106, "natural_language_chars": 680, "lean_code_ratio": 0.1349, "line_count": 10, "imports_count": 0, "declarations_count": 88, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3bbb6e6ae081eec0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.Calculus.UniformLimitsDeriv.hasFDerivAt_of_tendstoUniformly", "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.Analysis.Calculus.UniformLimitsDeriv)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Calculus.UniformLimitsDeriv.hasFDerivAt_of_tendstoUniformly`, L429-L451)\n```lean\ntheorem hasFDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)\n (hf : \u2200 n : \u03b9, \u2200 x : E, HasFDerivAt (f n) (f' n x) x)\n (hfg : \u2200 x : E, Tendsto (fun n => f n x) l (\ud835\udcdd (g x))) (x : E) : HasFDerivAt g (g' x) x := by\nhave hf : \u2200 n : \u03b9, \u2200 x : E, x \u2208 Set.univ \u2192 HasFDerivAt (f n) (f' n x) x := by simp [hf]\n have hfg : \u2200 x : E, x \u2208 Set.univ \u2192 Tendsto (fun n => f n x) l (\ud835\udcdd (g x)) := by simp [hfg]\n have hf' : TendstoUniformlyOn f' g' l Set.univ := by rwa [tendstoUniformlyOn_univ]\n exact hasFDerivAt_of_tendstoUniformlyOn isOpen_univ hf' hf hfg (Set.mem_univ x)\n\nend LimitsOfDerivatives\n\nsection deriv\n\n/-! ### `deriv` versions of above theorems\n\nIn this section, we provide `deriv` equivalents of the `fderiv` lemmas in the previous section.\n-/\n\n\nvariable {\u03b9 : Type*} {l : Filter \u03b9} {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c]\n {G : Type*} [NormedAddCommGroup G]\n [NormedSpace \ud835\udd5c G] {f : \u03b9 \u2192 \ud835\udd5c \u2192 G} {g : \ud835\udd5c \u2192 G} {f' : \u03b9 \u2192 \ud835\udd5c \u2192 G} {g' : \ud835\udd5c \u2192 G} {x : \ud835\udd5c}\n\n/-- If our derivatives converge uniformly, then the Fr\u00e9chet derivatives converge uniformly -/\n```\n\n## Edit instruction\nEdit `hasFDerivAt_of_tendstoUniformly` so it still compiles and the proof is simplified where possible. Return the full updated `hasFDerivAt_of_tendstoUniformly` 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.Analysis.Calculus.UniformLimitsDeriv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Calculus.UniformLimitsDeriv.hasFDerivAt_of_tendstoUniformly`, L429-L451)\n```lean\ntheorem hasFDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)\n (hf : \u2200 n : \u03b9, \u2200 x : E, HasFDerivAt (f n) (f' n x) x)\n (hfg : \u2200 x : E, Tendsto (fun n => f n x) l (\ud835\udcdd (g x))) (x : E) : HasFDerivAt g (g' x) x := by\nhave hf : \u2200 n : \u03b9, \u2200 x : E, x \u2208 Set.univ \u2192 HasFDerivAt (f n) (f' n x) x := by simp [hf]\n have hfg : \u2200 x : E, x \u2208 Set.univ \u2192 Tendsto (fun n => f n x) l (\ud835\udcdd (g x)) := by simp [hfg]\n have hf' : TendstoUniformlyOn f' g' l Set.univ := by rwa [tendstoUniformlyOn_univ]\n exact hasFDerivAt_of_tendstoUniformlyOn isOpen_univ hf' hf hfg (Set.mem_univ x)\n\nend LimitsOfDerivatives\n\nsection deriv\n\n/-! ### `deriv` versions of above theorems\n\nIn this section, we provide `deriv` equivalents of the `fderiv` lemmas in the previous section.\n-/\n\n\nvariable {\u03b9 : Type*} {l : Filter \u03b9} {\ud835\udd5c : Type*} [NontriviallyNormedField \ud835\udd5c]\n {G : Type*} [NormedAddCommGroup G]\n [NormedSpace \ud835\udd5c G] {f : \u03b9 \u2192 \ud835\udd5c \u2192 G} {g : \ud835\udd5c \u2192 G} {f' : \u03b9 \u2192 \ud835\udd5c \u2192 G} {g' : \ud835\udd5c \u2192 G} {x : \ud835\udd5c}\n\n/-- If our derivatives converge uniformly, then the Fr\u00e9chet derivatives converge uniformly -/\n```\n\n## Edit instruction\nEdit `hasFDerivAt_of_tendstoUniformly` so it still compiles and the proof is simplified where possible. Return the full updated `hasFDerivAt_of_tendstoUniformly` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean", "module": "Mathlib.Analysis.Calculus.UniformLimitsDeriv", "declaration": "Mathlib.Analysis.Calculus.UniformLimitsDeriv.hasFDerivAt_of_tendstoUniformly", "span": "L429-L451", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean#L429"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 710, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1863, "lean_code_chars": 1064, "natural_language_chars": 799, "lean_code_ratio": 0.5711, "line_count": 32, "imports_count": 0, "declarations_count": 225, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "bc7357fd2cadb22e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Multiset.Count.countP_pos", "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.Data.Multiset.Count)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Multiset/Count.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Multiset.Count.countP_pos`, L90-L92)\n```lean\ntheorem countP_pos {s} : 0 < countP p s \u2194 \u2203 a \u2208 s, p a := Quot.inductionOn s fun _l => by simp\n```\n\n## Edit instruction\nEdit `countP_pos` so it still compiles and the proof is simplified where possible. Return the full updated `countP_pos` 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.Data.Multiset.Count).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Multiset/Count.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Multiset.Count.countP_pos`, L90-L92)\n```lean\ntheorem countP_pos {s} : 0 < countP p s \u2194 \u2203 a \u2208 s, p a := Quot.inductionOn s fun _l => by simp\n```\n\n## Edit instruction\nEdit `countP_pos` so it still compiles and the proof is simplified where possible. Return the full updated `countP_pos` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Multiset/Count.lean", "module": "Mathlib.Data.Multiset.Count", "declaration": "Mathlib.Data.Multiset.Count.countP_pos", "span": "L90-L92", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Multiset/Count.lean#L90"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 251, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 778, "lean_code_chars": 95, "natural_language_chars": 683, "lean_code_ratio": 0.1221, "line_count": 10, "imports_count": 0, "declarations_count": 91, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "250c63a1aa646c9b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.Asymptotics.Lemmas.isBigO_atTop_iff_eventually_exists_pos", "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.Analysis.Asymptotics.Lemmas)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/Asymptotics/Lemmas.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Asymptotics.Lemmas.isBigO_atTop_iff_eventually_exists_pos`, L701-L705)\n```lean\ntheorem isBigO_atTop_iff_eventually_exists_pos {\u03b1 : Type*}\n [SemilatticeSup \u03b1] [Nonempty \u03b1] {f : \u03b1 \u2192 G} {g : \u03b1 \u2192 G'} :\n f =O[atTop] g \u2194 \u2200\u1da0 n\u2080 in atTop, \u2203 c > 0, \u2200 n \u2265 n\u2080, c * \u2016f n\u2016 \u2264 \u2016g n\u2016 := by\nsimp_rw [isBigO_iff'', \u2190 exists_prop, Subtype.exists', exists_eventually_atTop]\n```\n\n## Edit instruction\nEdit `isBigO_atTop_iff_eventually_exists_pos` so it still compiles and the proof is simplified where possible. Return the full updated `isBigO_atTop_iff_eventually_exists_pos` 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.Analysis.Asymptotics.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Asymptotics/Lemmas.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Asymptotics.Lemmas.isBigO_atTop_iff_eventually_exists_pos`, L701-L705)\n```lean\ntheorem isBigO_atTop_iff_eventually_exists_pos {\u03b1 : Type*}\n [SemilatticeSup \u03b1] [Nonempty \u03b1] {f : \u03b1 \u2192 G} {g : \u03b1 \u2192 G'} :\n f =O[atTop] g \u2194 \u2200\u1da0 n\u2080 in atTop, \u2203 c > 0, \u2200 n \u2265 n\u2080, c * \u2016f n\u2016 \u2264 \u2016g n\u2016 := by\nsimp_rw [isBigO_iff'', \u2190 exists_prop, Subtype.exists', exists_eventually_atTop]\n```\n\n## Edit instruction\nEdit `isBigO_atTop_iff_eventually_exists_pos` so it still compiles and the proof is simplified where possible. Return the full updated `isBigO_atTop_iff_eventually_exists_pos` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Asymptotics/Lemmas.lean", "module": "Mathlib.Analysis.Asymptotics.Lemmas", "declaration": "Mathlib.Analysis.Asymptotics.Lemmas.isBigO_atTop_iff_eventually_exists_pos", "span": "L701-L705", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Asymptotics/Lemmas.lean#L701"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 377, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1074, "lean_code_chars": 281, "natural_language_chars": 793, "lean_code_ratio": 0.2616, "line_count": 13, "imports_count": 0, "declarations_count": 105, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e123334bff6ccd97", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Topology.MetricSpace.HausdorffDistance.hausdorffDist_le_diam", "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.Topology.MetricSpace.HausdorffDistance)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Topology/MetricSpace/HausdorffDistance.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.MetricSpace.HausdorffDistance.hausdorffDist_le_diam`, L853-L863)\n```lean\ntheorem hausdorffDist_le_diam (hs : s.Nonempty) (bs : IsBounded s) (ht : t.Nonempty)\n (bt : IsBounded t) : hausdorffDist s t \u2264 diam (s \u222a t) := by\nrcases hs with \u27e8x, xs\u27e9\n rcases ht with \u27e8y, yt\u27e9\n refine hausdorffDist_le_of_mem_dist diam_nonneg ?_ ?_\n \u00b7 exact fun z hz => \u27e8y, yt, dist_le_diam_of_mem (bs.union bt) (subset_union_left hz)\n (subset_union_right yt)\u27e9\n \u00b7 exact fun z hz => \u27e8x, xs, dist_le_diam_of_mem (bs.union bt) (subset_union_right hz)\n (subset_union_left xs)\u27e9\n\n/-- The distance to a set is controlled by the Hausdorff distance. -/\n```\n\n## Edit instruction\nEdit `hausdorffDist_le_diam` so it still compiles and the proof is simplified where possible. Return the full updated `hausdorffDist_le_diam` 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.Topology.MetricSpace.HausdorffDistance).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Topology/MetricSpace/HausdorffDistance.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.MetricSpace.HausdorffDistance.hausdorffDist_le_diam`, L853-L863)\n```lean\ntheorem hausdorffDist_le_diam (hs : s.Nonempty) (bs : IsBounded s) (ht : t.Nonempty)\n (bt : IsBounded t) : hausdorffDist s t \u2264 diam (s \u222a t) := by\nrcases hs with \u27e8x, xs\u27e9\n rcases ht with \u27e8y, yt\u27e9\n refine hausdorffDist_le_of_mem_dist diam_nonneg ?_ ?_\n \u00b7 exact fun z hz => \u27e8y, yt, dist_le_diam_of_mem (bs.union bt) (subset_union_left hz)\n (subset_union_right yt)\u27e9\n \u00b7 exact fun z hz => \u27e8x, xs, dist_le_diam_of_mem (bs.union bt) (subset_union_right hz)\n (subset_union_left xs)\u27e9\n\n/-- The distance to a set is controlled by the Hausdorff distance. -/\n```\n\n## Edit instruction\nEdit `hausdorffDist_le_diam` so it still compiles and the proof is simplified where possible. Return the full updated `hausdorffDist_le_diam` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/MetricSpace/HausdorffDistance.lean", "module": "Mathlib.Topology.MetricSpace.HausdorffDistance", "declaration": "Mathlib.Topology.MetricSpace.HausdorffDistance.hausdorffDist_le_diam", "span": "L853-L863", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/MetricSpace/HausdorffDistance.lean#L853"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 452, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1335, "lean_code_chars": 560, "natural_language_chars": 775, "lean_code_ratio": 0.4195, "line_count": 20, "imports_count": 0, "declarations_count": 146, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f92709322f11645f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integralBasis_repr_apply", "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.NumberTheory.NumberField.CanonicalEmbedding.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integralBasis_repr_apply`, L163-L185)\n```lean\ntheorem integralBasis_repr_apply [NumberField K] (x : K) (i : Free.ChooseBasisIndex \u2124 (\ud835\udcde K)) :\n (latticeBasis K).repr (canonicalEmbedding K x) i = (integralBasis K).repr x i := by\nrw [\u2190 Basis.restrictScalars_repr_apply \u211a _ \u27e8_, mem_rat_span_latticeBasis K x\u27e9, eq_ratCast,\n Rat.cast_inj]\n let f := (canonicalEmbedding K).toRatAlgHom.toLinearMap.codRestrict _\n (fun x \u21a6 mem_rat_span_latticeBasis K x)\n suffices ((latticeBasis K).restrictScalars \u211a).repr.toLinearMap \u2218\u2097 f =\n (integralBasis K).repr.toLinearMap from DFunLike.congr_fun (LinearMap.congr_fun this x) i\n refine Basis.ext (integralBasis K) (fun i \u21a6 ?_)\n have : f (integralBasis K i) = ((latticeBasis K).restrictScalars \u211a) i := by\n apply Subtype.val_injective\n rw [LinearMap.codRestrict_apply, AlgHom.toLinearMap_apply, Basis.restrictScalars_apply,\n latticeBasis_apply]\n rfl\n simp_rw [LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, this, Basis.repr_self]\n\nend NumberField.canonicalEmbedding\n\nnamespace NumberField.mixedEmbedding\n\nopen NumberField.InfinitePlace Module Finset\n\n/-- The mixed space `\u211d^r\u2081 \u00d7 \u2102^r\u2082` with `(r\u2081, r\u2082)` the signature of `K`. -/\n```\n\n## Edit instruction\nEdit `integralBasis_repr_apply` so it still compiles and the proof is simplified where possible. Return the full updated `integralBasis_repr_apply` 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.NumberTheory.NumberField.CanonicalEmbedding.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integralBasis_repr_apply`, L163-L185)\n```lean\ntheorem integralBasis_repr_apply [NumberField K] (x : K) (i : Free.ChooseBasisIndex \u2124 (\ud835\udcde K)) :\n (latticeBasis K).repr (canonicalEmbedding K x) i = (integralBasis K).repr x i := by\nrw [\u2190 Basis.restrictScalars_repr_apply \u211a _ \u27e8_, mem_rat_span_latticeBasis K x\u27e9, eq_ratCast,\n Rat.cast_inj]\n let f := (canonicalEmbedding K).toRatAlgHom.toLinearMap.codRestrict _\n (fun x \u21a6 mem_rat_span_latticeBasis K x)\n suffices ((latticeBasis K).restrictScalars \u211a).repr.toLinearMap \u2218\u2097 f =\n (integralBasis K).repr.toLinearMap from DFunLike.congr_fun (LinearMap.congr_fun this x) i\n refine Basis.ext (integralBasis K) (fun i \u21a6 ?_)\n have : f (integralBasis K i) = ((latticeBasis K).restrictScalars \u211a) i := by\n apply Subtype.val_injective\n rw [LinearMap.codRestrict_apply, AlgHom.toLinearMap_apply, Basis.restrictScalars_apply,\n latticeBasis_apply]\n rfl\n simp_rw [LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, this, Basis.repr_self]\n\nend NumberField.canonicalEmbedding\n\nnamespace NumberField.mixedEmbedding\n\nopen NumberField.InfinitePlace Module Finset\n\n/-- The mixed space `\u211d^r\u2081 \u00d7 \u2102^r\u2082` with `(r\u2081, r\u2082)` the signature of `K`. -/\n```\n\n## Edit instruction\nEdit `integralBasis_repr_apply` so it still compiles and the proof is simplified where possible. Return the full updated `integralBasis_repr_apply` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean", "module": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic", "declaration": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integralBasis_repr_apply", "span": "L163-L185", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean#L163"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 658, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1969, "lean_code_chars": 1152, "natural_language_chars": 817, "lean_code_ratio": 0.5851, "line_count": 32, "imports_count": 0, "declarations_count": 184, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "5bf1b552249ee4c5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Polynomial.Derivative.derivative_X", "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.Algebra.Polynomial.Derivative)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Polynomial/Derivative.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Polynomial.Derivative.derivative_X`, L117-L119)\n```lean\ntheorem derivative_X : derivative (X : R[X]) = 1 := (derivative_monomial _ _).trans <| by simp\n```\n\n## Edit instruction\nEdit `derivative_X` so it still compiles and the proof is simplified where possible. Return the full updated `derivative_X` 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.Algebra.Polynomial.Derivative).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Polynomial/Derivative.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Polynomial.Derivative.derivative_X`, L117-L119)\n```lean\ntheorem derivative_X : derivative (X : R[X]) = 1 := (derivative_monomial _ _).trans <| by simp\n```\n\n## Edit instruction\nEdit `derivative_X` so it still compiles and the proof is simplified where possible. Return the full updated `derivative_X` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Polynomial/Derivative.lean", "module": "Mathlib.Algebra.Polynomial.Derivative", "declaration": "Mathlib.Algebra.Polynomial.Derivative.derivative_X", "span": "L117-L119", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Derivative.lean#L117"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 257, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 816, "lean_code_chars": 95, "natural_language_chars": 721, "lean_code_ratio": 0.1164, "line_count": 10, "imports_count": 0, "declarations_count": 87, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "59f7547879e11423", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Set.Basic.nonempty_of_ssubset", "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.Data.Set.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Set/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.Basic.nonempty_of_ssubset`, L370-L372)\n```lean\ntheorem nonempty_of_ssubset (ht : s \u2282 t) : (t \\ s).Nonempty := nonempty_of_not_subset ht.2\n```\n\n## Edit instruction\nEdit `nonempty_of_ssubset` so it still compiles and the proof is simplified where possible. Return the full updated `nonempty_of_ssubset` 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.Data.Set.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Set/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.Basic.nonempty_of_ssubset`, L370-L372)\n```lean\ntheorem nonempty_of_ssubset (ht : s \u2282 t) : (t \\ s).Nonempty := nonempty_of_not_subset ht.2\n```\n\n## Edit instruction\nEdit `nonempty_of_ssubset` so it still compiles and the proof is simplified where possible. Return the full updated `nonempty_of_ssubset` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Basic.lean", "module": "Mathlib.Data.Set.Basic", "declaration": "Mathlib.Data.Set.Basic.nonempty_of_ssubset", "span": "L370-L372", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Basic.lean#L370"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 258, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 788, "lean_code_chars": 91, "natural_language_chars": 697, "lean_code_ratio": 0.1155, "line_count": 10, "imports_count": 0, "declarations_count": 85, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d8a041ea63b92802", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Nat.Factorization.Basic.ordCompl_div_of_dvd", "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.Data.Nat.Factorization.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Nat/Factorization/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Nat.Factorization.Basic.ordCompl_div_of_dvd`, L257-L261)\n```lean\ntheorem ordCompl_div_of_dvd {x : \u2115} {p : \u2115} (hp : p.Prime) (hx : p \u2223 x) :\n ordCompl[p] (x / p) = ordCompl[p] x := by\nsimpa [pow_one] using ordCompl_div_pow_of_dvd 1 hp (show p ^ 1 \u2223 x by simpa)\n\n-- `ordCompl[p] n` is the largest divisor of `n` not divisible by `p`.\n```\n\n## Edit instruction\nEdit `ordCompl_div_of_dvd` so it still compiles and the proof is simplified where possible. Return the full updated `ordCompl_div_of_dvd` 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.Data.Nat.Factorization.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Nat/Factorization/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Nat.Factorization.Basic.ordCompl_div_of_dvd`, L257-L261)\n```lean\ntheorem ordCompl_div_of_dvd {x : \u2115} {p : \u2115} (hp : p.Prime) (hx : p \u2223 x) :\n ordCompl[p] (x / p) = ordCompl[p] x := by\nsimpa [pow_one] using ordCompl_div_pow_of_dvd 1 hp (show p ^ 1 \u2223 x by simpa)\n\n-- `ordCompl[p] n` is the largest divisor of `n` not divisible by `p`.\n```\n\n## Edit instruction\nEdit `ordCompl_div_of_dvd` so it still compiles and the proof is simplified where possible. Return the full updated `ordCompl_div_of_dvd` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Nat/Factorization/Basic.lean", "module": "Mathlib.Data.Nat.Factorization.Basic", "declaration": "Mathlib.Data.Nat.Factorization.Basic.ordCompl_div_of_dvd", "span": "L257-L261", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Nat/Factorization/Basic.lean#L257"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 347, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1008, "lean_code_chars": 269, "natural_language_chars": 739, "lean_code_ratio": 0.2669, "line_count": 14, "imports_count": 0, "declarations_count": 116, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c61edc7915ed1815", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Combinatorics.SimpleGraph.Metric.edist_anti", "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.Combinatorics.SimpleGraph.Metric)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Combinatorics/SimpleGraph/Metric.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.SimpleGraph.Metric.edist_anti`, L189-L209)\n```lean\ntheorem edist_anti {G' : SimpleGraph V} (h : G \u2264 G') :\n G'.edist u v \u2264 G.edist u v := by\nby_cases hr : G.Reachable u v\n \u00b7 obtain \u27e8_, hw\u27e9 := hr.exists_walk_length_eq_edist\n rw [\u2190 hw, \u2190 Walk.length_map (.ofLE h)]\n apply edist_le\n \u00b7 exact edist_eq_top_of_not_reachable hr \u25b8 le_top\n\nend edist\n\nsection dist\n\n/--\nThe distance between two vertices is the length of the shortest walk between them.\nIf no such walk exists, this uses the junk value of `0`.\n-/\nnoncomputable def dist (u v : V) : \u2115 :=\n (G.edist u v).toNat\n\nvariable {G} {u v w : V}\n```\n\n## Edit instruction\nEdit `edist_anti` so it still compiles and the proof is simplified where possible. Return the full updated `edist_anti` 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.Combinatorics.SimpleGraph.Metric).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Combinatorics/SimpleGraph/Metric.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.SimpleGraph.Metric.edist_anti`, L189-L209)\n```lean\ntheorem edist_anti {G' : SimpleGraph V} (h : G \u2264 G') :\n G'.edist u v \u2264 G.edist u v := by\nby_cases hr : G.Reachable u v\n \u00b7 obtain \u27e8_, hw\u27e9 := hr.exists_walk_length_eq_edist\n rw [\u2190 hw, \u2190 Walk.length_map (.ofLE h)]\n apply edist_le\n \u00b7 exact edist_eq_top_of_not_reachable hr \u25b8 le_top\n\nend edist\n\nsection dist\n\n/--\nThe distance between two vertices is the length of the shortest walk between them.\nIf no such walk exists, this uses the junk value of `0`.\n-/\nnoncomputable def dist (u v : V) : \u2115 :=\n (G.edist u v).toNat\n\nvariable {G} {u v w : V}\n```\n\n## Edit instruction\nEdit `edist_anti` so it still compiles and the proof is simplified where possible. Return the full updated `edist_anti` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Metric.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Metric", "declaration": "Mathlib.Combinatorics.SimpleGraph.Metric.edist_anti", "span": "L189-L209", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Metric.lean#L189"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 416, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1274, "lean_code_chars": 550, "natural_language_chars": 724, "lean_code_ratio": 0.4317, "line_count": 29, "imports_count": 0, "declarations_count": 155, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ad16221b532f185e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.NumberTheory.LSeries.HurwitzZetaOdd.hasSum_nat_hurwitzZetaOdd_of_mem_Icc", "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.NumberTheory.LSeries.HurwitzZetaOdd)."}, {"role": "user", "content": "You are editing a file in `Mathlib/NumberTheory/LSeries/HurwitzZetaOdd.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.LSeries.HurwitzZetaOdd.hasSum_nat_hurwitzZetaOdd_of_mem_Icc`, L501-L514)\n```lean\nlemma hasSum_nat_hurwitzZetaOdd_of_mem_Icc {a : \u211d} (ha : a \u2208 Icc 0 1) {s : \u2102} (hs : 1 < re s) :\n HasSum (fun n : \u2115 \u21a6 (1 / (n + a : \u2102) ^ s - 1 / (n + 1 - a : \u2102) ^ s) / 2)\n (hurwitzZetaOdd a s) := by\nrefine (hasSum_nat_hurwitzZetaOdd a hs).congr_fun fun n \u21a6 ?_\n suffices \u2200 b : \u211d, 0 \u2264 b \u2192 SignType.sign (n + b) / (\u2191|n + b| : \u2102) ^ s = 1 / (n + b) ^ s by\n simp only [add_sub_assoc, this a ha.1, this (1 - a) (sub_nonneg.mpr ha.2), push_cast]\n intro b hb\n rw [abs_of_nonneg (by positivity), (by simp : (n : \u2102) + b = \u2191(n + b))]\n rcases lt_or_eq_of_le (by positivity : 0 \u2264 n + b) with hb | hb\n \u00b7 simp [sign_pos hb]\n \u00b7 rw [\u2190 hb, ofReal_zero, zero_cpow ((not_lt.mpr zero_le_one) \u2218 (zero_re \u25b8 \u00b7 \u25b8 hs)),\n div_zero, div_zero]\n\n/-- Formula for `sinZeta` as a Dirichlet series in the convergence range, with sum over `\u2124`. -/\n```\n\n## Edit instruction\nEdit `hasSum_nat_hurwitzZetaOdd_of_mem_Icc` so it still compiles and the proof is simplified where possible. Return the full updated `hasSum_nat_hurwitzZetaOdd_of_mem_Icc` 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.NumberTheory.LSeries.HurwitzZetaOdd).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/LSeries/HurwitzZetaOdd.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.LSeries.HurwitzZetaOdd.hasSum_nat_hurwitzZetaOdd_of_mem_Icc`, L501-L514)\n```lean\nlemma hasSum_nat_hurwitzZetaOdd_of_mem_Icc {a : \u211d} (ha : a \u2208 Icc 0 1) {s : \u2102} (hs : 1 < re s) :\n HasSum (fun n : \u2115 \u21a6 (1 / (n + a : \u2102) ^ s - 1 / (n + 1 - a : \u2102) ^ s) / 2)\n (hurwitzZetaOdd a s) := by\nrefine (hasSum_nat_hurwitzZetaOdd a hs).congr_fun fun n \u21a6 ?_\n suffices \u2200 b : \u211d, 0 \u2264 b \u2192 SignType.sign (n + b) / (\u2191|n + b| : \u2102) ^ s = 1 / (n + b) ^ s by\n simp only [add_sub_assoc, this a ha.1, this (1 - a) (sub_nonneg.mpr ha.2), push_cast]\n intro b hb\n rw [abs_of_nonneg (by positivity), (by simp : (n : \u2102) + b = \u2191(n + b))]\n rcases lt_or_eq_of_le (by positivity : 0 \u2264 n + b) with hb | hb\n \u00b7 simp [sign_pos hb]\n \u00b7 rw [\u2190 hb, ofReal_zero, zero_cpow ((not_lt.mpr zero_le_one) \u2218 (zero_re \u25b8 \u00b7 \u25b8 hs)),\n div_zero, div_zero]\n\n/-- Formula for `sinZeta` as a Dirichlet series in the convergence range, with sum over `\u2124`. -/\n```\n\n## Edit instruction\nEdit `hasSum_nat_hurwitzZetaOdd_of_mem_Icc` so it still compiles and the proof is simplified where possible. Return the full updated `hasSum_nat_hurwitzZetaOdd_of_mem_Icc` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/LSeries/HurwitzZetaOdd.lean", "module": "Mathlib.NumberTheory.LSeries.HurwitzZetaOdd", "declaration": "Mathlib.NumberTheory.LSeries.HurwitzZetaOdd.hasSum_nat_hurwitzZetaOdd_of_mem_Icc", "span": "L501-L514", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LSeries/HurwitzZetaOdd.lean#L501"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 633, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1641, "lean_code_chars": 830, "natural_language_chars": 811, "lean_code_ratio": 0.5058, "line_count": 23, "imports_count": 0, "declarations_count": 179, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "e8a6ff989ee4c779", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.RingTheory.Polynomial.UniversalFactorizationRing.universalFactorizationMap_freeMonic", "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.RingTheory.Polynomial.UniversalFactorizationRing)."}, {"role": "user", "content": "You are editing a file in `Mathlib/RingTheory/Polynomial/UniversalFactorizationRing.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Polynomial.UniversalFactorizationRing.universalFactorizationMap_freeMonic`, L143-L150)\n```lean\nlemma universalFactorizationMap_freeMonic :\n (freeMonic R n).map (toRingHom <| universalFactorizationMap R n m k hn) =\n (freeMonic R m).map (algebraMap _ _) *\n (freeMonic R k).map (toRingHom <| Algebra.TensorProduct.includeRight) := by\nchange (mapEquivMonic _ _ _ (universalFactorizationMap R n m k hn)).1 = _\n simp [universalFactorizationMap]\n rfl\n```\n\n## Edit instruction\nEdit `universalFactorizationMap_freeMonic` so it still compiles and the proof is simplified where possible. Return the full updated `universalFactorizationMap_freeMonic` 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.RingTheory.Polynomial.UniversalFactorizationRing).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/Polynomial/UniversalFactorizationRing.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Polynomial.UniversalFactorizationRing.universalFactorizationMap_freeMonic`, L143-L150)\n```lean\nlemma universalFactorizationMap_freeMonic :\n (freeMonic R n).map (toRingHom <| universalFactorizationMap R n m k hn) =\n (freeMonic R m).map (algebraMap _ _) *\n (freeMonic R k).map (toRingHom <| Algebra.TensorProduct.includeRight) := by\nchange (mapEquivMonic _ _ _ (universalFactorizationMap R n m k hn)).1 = _\n simp [universalFactorizationMap]\n rfl\n```\n\n## Edit instruction\nEdit `universalFactorizationMap_freeMonic` so it still compiles and the proof is simplified where possible. Return the full updated `universalFactorizationMap_freeMonic` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Polynomial/UniversalFactorizationRing.lean", "module": "Mathlib.RingTheory.Polynomial.UniversalFactorizationRing", "declaration": "Mathlib.RingTheory.Polynomial.UniversalFactorizationRing.universalFactorizationMap_freeMonic", "span": "L143-L150", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/UniversalFactorizationRing.lean#L143"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 368, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1213, "lean_code_chars": 366, "natural_language_chars": 847, "lean_code_ratio": 0.3017, "line_count": 16, "imports_count": 0, "declarations_count": 117, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f5f572e073ba4ba7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Homology.ShortComplex.RightHomology.leftHomologyMap_op", "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.Algebra.Homology.ShortComplex.RightHomology)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Homology/ShortComplex/RightHomology.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Homology.ShortComplex.RightHomology.leftHomologyMap_op`, L1082-L1088)\n```lean\nlemma leftHomologyMap_op (\u03c6 : S\u2081 \u27f6 S\u2082) [S\u2081.HasLeftHomology] [S\u2082.HasLeftHomology] :\n (leftHomologyMap \u03c6).op = S\u2082.rightHomologyOpIso.inv \u226b rightHomologyMap (opMap \u03c6) \u226b\n S\u2081.rightHomologyOpIso.hom := by\ndsimp [rightHomologyOpIso, RightHomologyData.rightHomologyIso, rightHomologyMap,\n leftHomologyMap]\n simp only [\u2190 rightHomologyMap'_comp, comp_id, id_comp, leftHomologyMap'_op]\n```\n\n## Edit instruction\nEdit `leftHomologyMap_op` so it still compiles and the proof is simplified where possible. Return the full updated `leftHomologyMap_op` 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.Algebra.Homology.ShortComplex.RightHomology).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Homology/ShortComplex/RightHomology.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Homology.ShortComplex.RightHomology.leftHomologyMap_op`, L1082-L1088)\n```lean\nlemma leftHomologyMap_op (\u03c6 : S\u2081 \u27f6 S\u2082) [S\u2081.HasLeftHomology] [S\u2082.HasLeftHomology] :\n (leftHomologyMap \u03c6).op = S\u2082.rightHomologyOpIso.inv \u226b rightHomologyMap (opMap \u03c6) \u226b\n S\u2081.rightHomologyOpIso.hom := by\ndsimp [rightHomologyOpIso, RightHomologyData.rightHomologyIso, rightHomologyMap,\n leftHomologyMap]\n simp only [\u2190 rightHomologyMap'_comp, comp_id, id_comp, leftHomologyMap'_op]\n```\n\n## Edit instruction\nEdit `leftHomologyMap_op` so it still compiles and the proof is simplified where possible. Return the full updated `leftHomologyMap_op` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Homology/ShortComplex/RightHomology.lean", "module": "Mathlib.Algebra.Homology.ShortComplex.RightHomology", "declaration": "Mathlib.Algebra.Homology.ShortComplex.RightHomology.leftHomologyMap_op", "span": "L1082-L1088", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/ShortComplex/RightHomology.lean#L1082"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 381, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1170, "lean_code_chars": 387, "natural_language_chars": 783, "lean_code_ratio": 0.3308, "line_count": 15, "imports_count": 0, "declarations_count": 104, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7cbc80ef7ef8e40a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcUnits_pow", "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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcUnits_pow`, L771-L779)\n```lean\nlemma cfcUnits_pow (hf' : \u2200 x \u2208 spectrum R a, f x \u2260 0) (n : \u2115)\n (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) :\n(cfcUnits f a hf') ^ n =\n cfcUnits _ _ (forall\u2082_imp (fun _ _ \u21a6 pow_ne_zero n) hf') (hf := hf.pow n) := by\n ext\n cases n with\n | zero => simp [cfc_const_one R a]\n | succ n => simp [cfc_pow f _ a]\n```\n\n## Edit instruction\nEdit `cfcUnits_pow` so it still compiles and the proof is simplified where possible. Return the full updated `cfcUnits_pow` 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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcUnits_pow`, L771-L779)\n```lean\nlemma cfcUnits_pow (hf' : \u2200 x \u2208 spectrum R a, f x \u2260 0) (n : \u2115)\n (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) :\n(cfcUnits f a hf') ^ n =\n cfcUnits _ _ (forall\u2082_imp (fun _ _ \u21a6 pow_ne_zero n) hf') (hf := hf.pow n) := by\n ext\n cases n with\n | zero => simp [cfc_const_one R a]\n | succ n => simp [cfc_pow f _ a]\n```\n\n## Edit instruction\nEdit `cfcUnits_pow` so it still compiles and the proof is simplified where possible. Return the full updated `cfcUnits_pow` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean", "module": "Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital", "declaration": "Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital.cfcUnits_pow", "span": "L771-L779", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean#L771"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 403, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1159, "lean_code_chars": 354, "natural_language_chars": 805, "lean_code_ratio": 0.3054, "line_count": 17, "imports_count": 0, "declarations_count": 135, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f6e8fd81708e0ab2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.Calculus.VectorField.pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt", "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.Analysis.Calculus.VectorField)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/Calculus/VectorField.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Calculus.VectorField.pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt`, L619-L654)\n```lean\nlemma pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt\n {f : E \u2192 F} {V W : F \u2192 F} {x : E} {t : Set F}\n (hf : IsSymmSndFDerivWithinAt \ud835\udd5c f s x) (h'f : ContDiffWithinAt \ud835\udd5c 2 f s x)\n (hV : DifferentiableWithinAt \ud835\udd5c V t (f x)) (hW : DifferentiableWithinAt \ud835\udd5c W t (f x))\n (hu : UniqueDiffOn \ud835\udd5c s) (hx : x \u2208 s) (hst : MapsTo f s t) :\n pullbackWithin \ud835\udd5c f (lieBracketWithin \ud835\udd5c V W t) s x\n = lieBracketWithin \ud835\udd5c (pullbackWithin \ud835\udd5c f V s) (pullbackWithin \ud835\udd5c f W s) s x := by\nby_cases h : (fderivWithin \ud835\udd5c f s x).IsInvertible; swap\n \u00b7 simp [pullbackWithin_eq_of_not_isInvertible h, lieBracketWithin_eq]\n rcases exists_continuousLinearEquiv_fderivWithin_symm_eq h'f h hu hx\n with \u27e8M, -, M_symm_smooth, hM, M_diff\u27e9\n have hMx : M x = fderivWithin \ud835\udd5c f s x := (mem_of_mem_nhdsWithin hx hM :)\n have AV : fderivWithin \ud835\udd5c (pullbackWithin \ud835\udd5c f V s) s x =\n fderivWithin \ud835\udd5c (fun y \u21a6 ((M y).symm : F \u2192L[\ud835\udd5c] E) (V (f y))) s x := by\n apply Filter.EventuallyEq.fderivWithin_eq_of_mem _ hx\n filter_upwards [hM] with y hy using pullbackWithin_eq_of_fderivWithin_eq hy _\n have AW : fderivWithin \ud835\udd5c (pullbackWithin \ud835\udd5c f W s) s x =\n fderivWithin \ud835\udd5c (fun y \u21a6 ((M y).symm : F \u2192L[\ud835\udd5c] E) (W (f y))) s x := by\n apply Filter.EventuallyEq.fderivWithin_eq_of_mem _ hx\n filter_upwards [hM] with y hy using pullbackWithin_eq_of_fderivWithin_eq hy _\n have Af : DifferentiableWithinAt \ud835\udd5c f s x := h'f.differentiableWithinAt two_ne_zero\n simp only [lieBracketWithin_eq, pullbackWithin_eq_of_fderivWithin_eq hMx, map_sub, AV, AW]\n rw [fderivWithin_clm_apply, fderivWithin_clm_apply]\n \u00b7 simp [fderivWithin_comp' x hW Af hst (hu x hx), \u2190 hMx,\n fderivWithin_comp' x hV Af hst (hu x hx), M_diff, hf.eq]\n \u00b7 exact hu x hx\n \u00b7 exact M_symm_smooth.differentiableWithinAt one_ne_zero\n \u00b7 exact hV.comp x Af hst\n \u00b7 exact hu x hx\n \u00b7 exact M_symm_smooth.differentiableWithinAt one_ne_zero\n \u00b7 exact hW.comp x Af hst\n\n/-- The Lie bracket commutes with taking pullbacks. This requires the function to have symmetric\nsecond derivative. Version in a complete space. One could also give a version avoiding\ncompleteness but requiring that `f` is a local diffeomorphism. Variant where unique\ndifferentiability and the invariance property are only required in a smaller set `u`. -/\n```\n\n## Edit instruction\nEdit `pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt` so it still compiles and the proof is simplified where possible. Return the full updated `pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt` 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.Analysis.Calculus.VectorField).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Calculus/VectorField.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Calculus.VectorField.pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt`, L619-L654)\n```lean\nlemma pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt\n {f : E \u2192 F} {V W : F \u2192 F} {x : E} {t : Set F}\n (hf : IsSymmSndFDerivWithinAt \ud835\udd5c f s x) (h'f : ContDiffWithinAt \ud835\udd5c 2 f s x)\n (hV : DifferentiableWithinAt \ud835\udd5c V t (f x)) (hW : DifferentiableWithinAt \ud835\udd5c W t (f x))\n (hu : UniqueDiffOn \ud835\udd5c s) (hx : x \u2208 s) (hst : MapsTo f s t) :\n pullbackWithin \ud835\udd5c f (lieBracketWithin \ud835\udd5c V W t) s x\n = lieBracketWithin \ud835\udd5c (pullbackWithin \ud835\udd5c f V s) (pullbackWithin \ud835\udd5c f W s) s x := by\nby_cases h : (fderivWithin \ud835\udd5c f s x).IsInvertible; swap\n \u00b7 simp [pullbackWithin_eq_of_not_isInvertible h, lieBracketWithin_eq]\n rcases exists_continuousLinearEquiv_fderivWithin_symm_eq h'f h hu hx\n with \u27e8M, -, M_symm_smooth, hM, M_diff\u27e9\n have hMx : M x = fderivWithin \ud835\udd5c f s x := (mem_of_mem_nhdsWithin hx hM :)\n have AV : fderivWithin \ud835\udd5c (pullbackWithin \ud835\udd5c f V s) s x =\n fderivWithin \ud835\udd5c (fun y \u21a6 ((M y).symm : F \u2192L[\ud835\udd5c] E) (V (f y))) s x := by\n apply Filter.EventuallyEq.fderivWithin_eq_of_mem _ hx\n filter_upwards [hM] with y hy using pullbackWithin_eq_of_fderivWithin_eq hy _\n have AW : fderivWithin \ud835\udd5c (pullbackWithin \ud835\udd5c f W s) s x =\n fderivWithin \ud835\udd5c (fun y \u21a6 ((M y).symm : F \u2192L[\ud835\udd5c] E) (W (f y))) s x := by\n apply Filter.EventuallyEq.fderivWithin_eq_of_mem _ hx\n filter_upwards [hM] with y hy using pullbackWithin_eq_of_fderivWithin_eq hy _\n have Af : DifferentiableWithinAt \ud835\udd5c f s x := h'f.differentiableWithinAt two_ne_zero\n simp only [lieBracketWithin_eq, pullbackWithin_eq_of_fderivWithin_eq hMx, map_sub, AV, AW]\n rw [fderivWithin_clm_apply, fderivWithin_clm_apply]\n \u00b7 simp [fderivWithin_comp' x hW Af hst (hu x hx), \u2190 hMx,\n fderivWithin_comp' x hV Af hst (hu x hx), M_diff, hf.eq]\n \u00b7 exact hu x hx\n \u00b7 exact M_symm_smooth.differentiableWithinAt one_ne_zero\n \u00b7 exact hV.comp x Af hst\n \u00b7 exact hu x hx\n \u00b7 exact M_symm_smooth.differentiableWithinAt one_ne_zero\n \u00b7 exact hW.comp x Af hst\n\n/-- The Lie bracket commutes with taking pullbacks. This requires the function to have symmetric\nsecond derivative. Version in a complete space. One could also give a version avoiding\ncompleteness but requiring that `f` is a local diffeomorphism. Variant where unique\ndifferentiability and the invariance property are only required in a smaller set `u`. -/\n```\n\n## Edit instruction\nEdit `pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt` so it still compiles and the proof is simplified where possible. Return the full updated `pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Calculus/VectorField.lean", "module": "Mathlib.Analysis.Calculus.VectorField", "declaration": "Mathlib.Analysis.Calculus.VectorField.pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt", "span": "L619-L654", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/VectorField.lean#L619"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1130, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3129, "lean_code_chars": 2270, "natural_language_chars": 859, "lean_code_ratio": 0.7255, "line_count": 45, "imports_count": 0, "declarations_count": 366, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "30274abdcefd0e2a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.NumberTheory.ModularForms.Cusps.IsRegularAtInfty", "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.NumberTheory.ModularForms.Cusps)."}, {"role": "user", "content": "You are editing a file in `Mathlib/NumberTheory/ModularForms/Cusps.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.ModularForms.Cusps.IsRegularAtInfty`, L246-L248)\n```lean\ndef IsRegularAtInfty : Prop := \ud835\udca2.strictPeriods = \ud835\udca2.periods\n```\n\n## Edit instruction\nEdit `IsRegularAtInfty` so it still compiles and the proof is simplified where possible. Return the full updated `IsRegularAtInfty` 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.NumberTheory.ModularForms.Cusps).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/ModularForms/Cusps.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.ModularForms.Cusps.IsRegularAtInfty`, L246-L248)\n```lean\ndef IsRegularAtInfty : Prop := \ud835\udca2.strictPeriods = \ud835\udca2.periods\n```\n\n## Edit instruction\nEdit `IsRegularAtInfty` so it still compiles and the proof is simplified where possible. Return the full updated `IsRegularAtInfty` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/ModularForms/Cusps.lean", "module": "Mathlib.NumberTheory.ModularForms.Cusps", "declaration": "Mathlib.NumberTheory.ModularForms.Cusps.IsRegularAtInfty", "span": "L246-L248", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ModularForms/Cusps.lean#L246"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 257, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 798, "lean_code_chars": 59, "natural_language_chars": 739, "lean_code_ratio": 0.0739, "line_count": 10, "imports_count": 0, "declarations_count": 80, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "67ccaa8896c9c51b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.NumberTheory.Padics.PadicVal.Basic.pow_succ_padicValNat_not_dvd", "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.NumberTheory.Padics.PadicVal.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/NumberTheory/Padics/PadicVal/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.Padics.PadicVal.Basic.pow_succ_padicValNat_not_dvd`, L435-L439)\n```lean\ntheorem pow_succ_padicValNat_not_dvd {n : \u2115} [hp : Fact p.Prime] (hn : n \u2260 0) :\n \u00acp ^ (padicValNat p n + 1) \u2223 n := by\nrw [padicValNat_dvd_iff_le hn, not_le]\n exact Nat.lt_succ_self _\n```\n\n## Edit instruction\nEdit `pow_succ_padicValNat_not_dvd` so it still compiles and the proof is simplified where possible. Return the full updated `pow_succ_padicValNat_not_dvd` 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.NumberTheory.Padics.PadicVal.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/Padics/PadicVal/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.Padics.PadicVal.Basic.pow_succ_padicValNat_not_dvd`, L435-L439)\n```lean\ntheorem pow_succ_padicValNat_not_dvd {n : \u2115} [hp : Fact p.Prime] (hn : n \u2260 0) :\n \u00acp ^ (padicValNat p n + 1) \u2223 n := by\nrw [padicValNat_dvd_iff_le hn, not_le]\n exact Nat.lt_succ_self _\n```\n\n## Edit instruction\nEdit `pow_succ_padicValNat_not_dvd` so it still compiles and the proof is simplified where possible. Return the full updated `pow_succ_padicValNat_not_dvd` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/Padics/PadicVal/Basic.lean", "module": "Mathlib.NumberTheory.Padics.PadicVal.Basic", "declaration": "Mathlib.NumberTheory.Padics.PadicVal.Basic.pow_succ_padicValNat_not_dvd", "span": "L435-L439", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Padics/PadicVal/Basic.lean#L435"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 340, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 971, "lean_code_chars": 187, "natural_language_chars": 784, "lean_code_ratio": 0.1926, "line_count": 13, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "bde01391d19e4fd2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Category.Ring.FilteredColimits.forget\u2082Ring_preservesFilteredColimits", "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.Algebra.Category.Ring.FilteredColimits)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Category/Ring/FilteredColimits.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Category.Ring.FilteredColimits.forget\u2082Ring_preservesFilteredColimits`, L352-L359)\n```lean\ninstance forget\u2082Ring_preservesFilteredColimits :\n PreservesFilteredColimits (forget\u2082 CommRingCat RingCat.{u}) where\n preserves_filtered_colimits {J hJ1 _} := letI : Category J := hJ1\n { preservesColimit := fun {F} =>\n preservesColimit_of_preserves_colimit_cocone (colimitCoconeIsColimit.{u, u} F)\n (RingCat.FilteredColimits.colimitCoconeIsColimit (F \u22d9 forget\u2082 CommRingCat RingCat.{u})) }\n```\n\n## Edit instruction\nEdit `forget\u2082Ring_preservesFilteredColimits` so it still compiles and the proof is simplified where possible. Return the full updated `forget\u2082Ring_preservesFilteredColimits` 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.Algebra.Category.Ring.FilteredColimits).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Category/Ring/FilteredColimits.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Category.Ring.FilteredColimits.forget\u2082Ring_preservesFilteredColimits`, L352-L359)\n```lean\ninstance forget\u2082Ring_preservesFilteredColimits :\n PreservesFilteredColimits (forget\u2082 CommRingCat RingCat.{u}) where\n preserves_filtered_colimits {J hJ1 _} := letI : Category J := hJ1\n { preservesColimit := fun {F} =>\n preservesColimit_of_preserves_colimit_cocone (colimitCoconeIsColimit.{u, u} F)\n (RingCat.FilteredColimits.colimitCoconeIsColimit (F \u22d9 forget\u2082 CommRingCat RingCat.{u})) }\n```\n\n## Edit instruction\nEdit `forget\u2082Ring_preservesFilteredColimits` so it still compiles and the proof is simplified where possible. Return the full updated `forget\u2082Ring_preservesFilteredColimits` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Category/Ring/FilteredColimits.lean", "module": "Mathlib.Algebra.Category.Ring.FilteredColimits", "declaration": "Mathlib.Algebra.Category.Ring.FilteredColimits.forget\u2082Ring_preservesFilteredColimits", "span": "L352-L359", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Category/Ring/FilteredColimits.lean#L352"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 373, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1234, "lean_code_chars": 411, "natural_language_chars": 823, "lean_code_ratio": 0.3331, "line_count": 15, "imports_count": 0, "declarations_count": 110, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "408db505c977d8c4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.RingTheory.Valuation.Basic.ne_zero_of_unit", "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.RingTheory.Valuation.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/RingTheory/Valuation/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Valuation.Basic.ne_zero_of_unit`, L218-L220)\n```lean\ntheorem ne_zero_of_unit [Nontrivial \u0393\u2080] (v : Valuation K \u0393\u2080) (x : K\u02e3) : v x \u2260 (0 : \u0393\u2080) := by\nsimp only [ne_eq, Valuation.zero_iff, Units.ne_zero x, not_false_iff]\n```\n\n## Edit instruction\nEdit `ne_zero_of_unit` so it still compiles and the proof is simplified where possible. Return the full updated `ne_zero_of_unit` 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.RingTheory.Valuation.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/Valuation/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Valuation.Basic.ne_zero_of_unit`, L218-L220)\n```lean\ntheorem ne_zero_of_unit [Nontrivial \u0393\u2080] (v : Valuation K \u0393\u2080) (x : K\u02e3) : v x \u2260 (0 : \u0393\u2080) := by\nsimp only [ne_eq, Valuation.zero_iff, Units.ne_zero x, not_false_iff]\n```\n\n## Edit instruction\nEdit `ne_zero_of_unit` so it still compiles and the proof is simplified where possible. Return the full updated `ne_zero_of_unit` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Valuation/Basic.lean", "module": "Mathlib.RingTheory.Valuation.Basic", "declaration": "Mathlib.RingTheory.Valuation.Basic.ne_zero_of_unit", "span": "L218-L220", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Valuation/Basic.lean#L218"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 298, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 884, "lean_code_chars": 163, "natural_language_chars": 721, "lean_code_ratio": 0.1844, "line_count": 11, "imports_count": 0, "declarations_count": 93, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "fab71c8475e27cf1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Combinatorics.SimpleGraph.Walks.Decomp.rotate", "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.Combinatorics.SimpleGraph.Walks.Decomp)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Combinatorics/SimpleGraph/Walks/Decomp.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.SimpleGraph.Walks.Decomp.rotate`, L300-L302)\n```lean\ndef rotate (c : G.Walk v v) (u : V) (h : u \u2208 c.support) : G.Walk u u := (c.dropUntil u h).append (c.takeUntil u h)\n```\n\n## Edit instruction\nEdit `rotate` so it still compiles and the proof is simplified where possible. Return the full updated `rotate` 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.Combinatorics.SimpleGraph.Walks.Decomp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Combinatorics/SimpleGraph/Walks/Decomp.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.SimpleGraph.Walks.Decomp.rotate`, L300-L302)\n```lean\ndef rotate (c : G.Walk v v) (u : V) (h : u \u2208 c.support) : G.Walk u u := (c.dropUntil u h).append (c.takeUntil u h)\n```\n\n## Edit instruction\nEdit `rotate` so it still compiles and the proof is simplified where possible. Return the full updated `rotate` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Walks/Decomp.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Walks.Decomp", "declaration": "Mathlib.Combinatorics.SimpleGraph.Walks.Decomp.rotate", "span": "L300-L302", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Walks/Decomp.lean#L300"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 273, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 845, "lean_code_chars": 115, "natural_language_chars": 730, "lean_code_ratio": 0.1361, "line_count": 10, "imports_count": 0, "declarations_count": 97, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a6ea0df48e131cd4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.NumberTheory.NumberField.CMField.regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv", "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.NumberTheory.NumberField.CMField)."}, {"role": "user", "content": "You are editing a file in `Mathlib/NumberTheory/NumberField/CMField.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.NumberField.CMField.regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv`, L443-L460)\n```lean\ntheorem regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv :\n regulator K / regulator K\u207a = 2 ^ rank K * (indexRealUnits K : \u211d)\u207b\u00b9 := by\nrw [indexRealUnits, \u2190 closure_realFundSystem_sup_torsion, \u2190 regOfFamily_div_regulator\n (realFundSystem K), regOfFamily_realFunSystem, inv_div, \u2190 mul_div_assoc, mul_div_mul_comm,\n div_self (by positivity), one_mul]\n\nend units\n\nend IsCMField\n\nend maximalRealSubfield\n\nnamespace CMExtension\n\nvariable (F K : Type*) [Field F] [IsTotallyReal F] [Field K] [CharZero K] [Algebra.IsIntegral \u211a K]\n [IsTotallyComplex K] [Algebra F K] [IsQuadraticExtension F K]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Edit instruction\nEdit `regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv` so it still compiles and the proof is simplified where possible. Return the full updated `regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv` 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.NumberTheory.NumberField.CMField).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/NumberField/CMField.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.NumberField.CMField.regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv`, L443-L460)\n```lean\ntheorem regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv :\n regulator K / regulator K\u207a = 2 ^ rank K * (indexRealUnits K : \u211d)\u207b\u00b9 := by\nrw [indexRealUnits, \u2190 closure_realFundSystem_sup_torsion, \u2190 regOfFamily_div_regulator\n (realFundSystem K), regOfFamily_realFunSystem, inv_div, \u2190 mul_div_assoc, mul_div_mul_comm,\n div_self (by positivity), one_mul]\n\nend units\n\nend IsCMField\n\nend maximalRealSubfield\n\nnamespace CMExtension\n\nvariable (F K : Type*) [Field F] [IsTotallyReal F] [Field K] [CharZero K] [Algebra.IsIntegral \u211a K]\n [IsTotallyComplex K] [Algebra F K] [IsQuadraticExtension F K]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Edit instruction\nEdit `regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv` so it still compiles and the proof is simplified where possible. Return the full updated `regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/CMField.lean", "module": "Mathlib.NumberTheory.NumberField.CMField", "declaration": "Mathlib.NumberTheory.NumberField.CMField.regulator_div_regulator_eq_two_pow_mul_indexRealUnits_inv", "span": "L443-L460", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CMField.lean#L443"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 463, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1526, "lean_code_chars": 661, "natural_language_chars": 865, "lean_code_ratio": 0.4332, "line_count": 27, "imports_count": 0, "declarations_count": 134, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6cb643c9cfb1f3cc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.LinearAlgebra.Multilinear.Basic.map_nonempty", "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.LinearAlgebra.Multilinear.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/LinearAlgebra/Multilinear/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.Multilinear.Basic.map_nonempty`, L1432-L1436)\n```lean\ntheorem map_nonempty [Nonempty \u03b9] (f : MultilinearMap R M\u2081 M\u2082) (p : \u2200 i, Submodule R (M\u2081 i)) :\n (map f p : Set M\u2082).Nonempty := \u27e8f 0, 0, fun i => (p i).zero_mem, rfl\u27e9\n\n/-- The range of a multilinear map, closed under scalar multiplication. -/\n```\n\n## Edit instruction\nEdit `map_nonempty` so it still compiles and the proof is simplified where possible. Return the full updated `map_nonempty` 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.LinearAlgebra.Multilinear.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/LinearAlgebra/Multilinear/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.Multilinear.Basic.map_nonempty`, L1432-L1436)\n```lean\ntheorem map_nonempty [Nonempty \u03b9] (f : MultilinearMap R M\u2081 M\u2082) (p : \u2200 i, Submodule R (M\u2081 i)) :\n (map f p : Set M\u2082).Nonempty := \u27e8f 0, 0, fun i => (p i).zero_mem, rfl\u27e9\n\n/-- The range of a multilinear map, closed under scalar multiplication. -/\n```\n\n## Edit instruction\nEdit `map_nonempty` so it still compiles and the proof is simplified where possible. Return the full updated `map_nonempty` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Multilinear/Basic.lean", "module": "Mathlib.LinearAlgebra.Multilinear.Basic", "declaration": "Mathlib.LinearAlgebra.Multilinear.Basic.map_nonempty", "span": "L1432-L1436", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Multilinear/Basic.lean#L1432"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 325, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 974, "lean_code_chars": 245, "natural_language_chars": 729, "lean_code_ratio": 0.2515, "line_count": 13, "imports_count": 0, "declarations_count": 112, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9a06c19f52b9260e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.RingTheory.MvPowerSeries.PiTopology.tendsto_iff_coeff_tendsto", "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.RingTheory.MvPowerSeries.PiTopology)."}, {"role": "user", "content": "You are editing a file in `Mathlib/RingTheory/MvPowerSeries/PiTopology.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.MvPowerSeries.PiTopology.tendsto_iff_coeff_tendsto`, L131-L137)\n```lean\ntheorem tendsto_iff_coeff_tendsto [Semiring R] {\u03b9 : Type*}\n (f : \u03b9 \u2192 MvPowerSeries \u03c3 R) (u : Filter \u03b9) (g : MvPowerSeries \u03c3 R) :\n Tendsto f u (nhds g) \u2194\n \u2200 d : \u03c3 \u2192\u2080 \u2115, Tendsto (fun i => coeff d (f i)) u (nhds (coeff d g)) := by\nrw [nhds_pi, tendsto_pi]\n exact forall_congr' (fun d => Iff.rfl)\n```\n\n## Edit instruction\nEdit `tendsto_iff_coeff_tendsto` so it still compiles and the proof is simplified where possible. Return the full updated `tendsto_iff_coeff_tendsto` 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.RingTheory.MvPowerSeries.PiTopology).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/MvPowerSeries/PiTopology.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.MvPowerSeries.PiTopology.tendsto_iff_coeff_tendsto`, L131-L137)\n```lean\ntheorem tendsto_iff_coeff_tendsto [Semiring R] {\u03b9 : Type*}\n (f : \u03b9 \u2192 MvPowerSeries \u03c3 R) (u : Filter \u03b9) (g : MvPowerSeries \u03c3 R) :\n Tendsto f u (nhds g) \u2194\n \u2200 d : \u03c3 \u2192\u2080 \u2115, Tendsto (fun i => coeff d (f i)) u (nhds (coeff d g)) := by\nrw [nhds_pi, tendsto_pi]\n exact forall_congr' (fun d => Iff.rfl)\n```\n\n## Edit instruction\nEdit `tendsto_iff_coeff_tendsto` so it still compiles and the proof is simplified where possible. Return the full updated `tendsto_iff_coeff_tendsto` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/MvPowerSeries/PiTopology.lean", "module": "Mathlib.RingTheory.MvPowerSeries.PiTopology", "declaration": "Mathlib.RingTheory.MvPowerSeries.PiTopology.tendsto_iff_coeff_tendsto", "span": "L131-L137", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPowerSeries/PiTopology.lean#L131"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 382, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1081, "lean_code_chars": 303, "natural_language_chars": 778, "lean_code_ratio": 0.2803, "line_count": 15, "imports_count": 0, "declarations_count": 115, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "cfd46c54ddac4ff8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Topology.Sheaves.Stalks.stalkFunctor_map_germ", "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.Topology.Sheaves.Stalks)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Topology/Sheaves/Stalks.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.Sheaves.Stalks.stalkFunctor_map_germ`, L145-L149)\n```lean\ntheorem stalkFunctor_map_germ {F G : X.Presheaf C} (U : Opens X) (x : X) (hx : x \u2208 U) (f : F \u27f6 G) :\n F.germ U x hx \u226b (stalkFunctor C x).map f = f.app (op U) \u226b G.germ U x hx := colimit.\u03b9_map (whiskerLeft (OpenNhds.inclusion x).op f) (op \u27e8U, hx\u27e9)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Edit instruction\nEdit `stalkFunctor_map_germ` so it still compiles and the proof is simplified where possible. Return the full updated `stalkFunctor_map_germ` 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.Topology.Sheaves.Stalks).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Topology/Sheaves/Stalks.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.Sheaves.Stalks.stalkFunctor_map_germ`, L145-L149)\n```lean\ntheorem stalkFunctor_map_germ {F G : X.Presheaf C} (U : Opens X) (x : X) (hx : x \u2208 U) (f : F \u27f6 G) :\n F.germ U x hx \u226b (stalkFunctor C x).map f = f.app (op U) \u226b G.germ U x hx := colimit.\u03b9_map (whiskerLeft (OpenNhds.inclusion x).op f) (op \u27e8U, hx\u27e9)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Edit instruction\nEdit `stalkFunctor_map_germ` so it still compiles and the proof is simplified where possible. Return the full updated `stalkFunctor_map_germ` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Sheaves/Stalks.lean", "module": "Mathlib.Topology.Sheaves.Stalks", "declaration": "Mathlib.Topology.Sheaves.Stalks.stalkFunctor_map_germ", "span": "L145-L149", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Sheaves/Stalks.lean#L145"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 363, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1036, "lean_code_chars": 306, "natural_language_chars": 730, "lean_code_ratio": 0.2954, "line_count": 13, "imports_count": 0, "declarations_count": 122, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "26da5ec20c667466", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Order.Preorder.Chain.IsChain", "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.Order.Preorder.Chain)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Order/Preorder/Chain.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.Preorder.Chain.IsChain`, L77-L79)\n```lean\ntheorem IsChain.symm (h : IsChain r s) : IsChain (flip r) s := h.mono' fun _ _ => Or.symm\n```\n\n## Edit instruction\nEdit `IsChain` so it still compiles and the proof is simplified where possible. Return the full updated `IsChain` 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.Order.Preorder.Chain).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Order/Preorder/Chain.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.Preorder.Chain.IsChain`, L77-L79)\n```lean\ntheorem IsChain.symm (h : IsChain r s) : IsChain (flip r) s := h.mono' fun _ _ => Or.symm\n```\n\n## Edit instruction\nEdit `IsChain` so it still compiles and the proof is simplified where possible. Return the full updated `IsChain` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Preorder/Chain.lean", "module": "Mathlib.Order.Preorder.Chain", "declaration": "Mathlib.Order.Preorder.Chain.IsChain", "span": "L77-L79", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Preorder/Chain.lean#L77"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 244, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 767, "lean_code_chars": 90, "natural_language_chars": 677, "lean_code_ratio": 0.1173, "line_count": 10, "imports_count": 0, "declarations_count": 90, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "977d56c46bc7dedc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Ring.Parity.Even", "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.Algebra.Ring.Parity)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Ring/Parity.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Ring.Parity.Even`, L84-L86)\n```lean\nlemma Even.trans_dvd (ha : Even a) (hab : a \u2223 b) : Even b := even_iff_two_dvd.2 <| ha.two_dvd.trans hab\n```\n\n## Edit instruction\nEdit `Even` so it still compiles and the proof is simplified where possible. Return the full updated `Even` 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.Algebra.Ring.Parity).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Ring/Parity.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Ring.Parity.Even`, L84-L86)\n```lean\nlemma Even.trans_dvd (ha : Even a) (hab : a \u2223 b) : Even b := even_iff_two_dvd.2 <| ha.two_dvd.trans hab\n```\n\n## Edit instruction\nEdit `Even` so it still compiles and the proof is simplified where possible. Return the full updated `Even` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Ring/Parity.lean", "module": "Mathlib.Algebra.Ring.Parity", "declaration": "Mathlib.Algebra.Ring.Parity.Even", "span": "L84-L86", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Ring/Parity.lean#L84"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 252, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 769, "lean_code_chars": 104, "natural_language_chars": 665, "lean_code_ratio": 0.1352, "line_count": 10, "imports_count": 0, "declarations_count": 88, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "be2585dc3780d10e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.LinearAlgebra.Matrix.Basis.toMatrix_transpose_apply", "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.LinearAlgebra.Matrix.Basis)."}, {"role": "user", "content": "You are editing a file in `Mathlib/LinearAlgebra/Matrix/Basis.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.Matrix.Basis.toMatrix_transpose_apply`, L58-L60)\n```lean\ntheorem toMatrix_transpose_apply : (e.toMatrix v)\u1d40 j = e.repr (v j) := funext fun _ => rfl\n```\n\n## Edit instruction\nEdit `toMatrix_transpose_apply` so it still compiles and the proof is simplified where possible. Return the full updated `toMatrix_transpose_apply` 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.LinearAlgebra.Matrix.Basis).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/LinearAlgebra/Matrix/Basis.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.Matrix.Basis.toMatrix_transpose_apply`, L58-L60)\n```lean\ntheorem toMatrix_transpose_apply : (e.toMatrix v)\u1d40 j = e.repr (v j) := funext fun _ => rfl\n```\n\n## Edit instruction\nEdit `toMatrix_transpose_apply` so it still compiles and the proof is simplified where possible. Return the full updated `toMatrix_transpose_apply` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Matrix/Basis.lean", "module": "Mathlib.LinearAlgebra.Matrix.Basis", "declaration": "Mathlib.LinearAlgebra.Matrix.Basis.toMatrix_transpose_apply", "span": "L58-L60", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/Basis.lean#L58"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 262, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 837, "lean_code_chars": 91, "natural_language_chars": 746, "lean_code_ratio": 0.1087, "line_count": 10, "imports_count": 0, "declarations_count": 87, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "48b15ded9faf93df", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Combinatorics.SimpleGraph.Matching.IsMatching", "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.Combinatorics.SimpleGraph.Matching)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Combinatorics/SimpleGraph/Matching.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.SimpleGraph.Matching.IsMatching`, L79-L82)\n```lean\ntheorem IsMatching.toEdge.surjective (h : M.IsMatching) : Surjective h.toEdge := by\nrintro \u27e8\u27e8x, y\u27e9, he\u27e9\n exact \u27e8\u27e8x, M.edge_vert he\u27e9, h.toEdge_eq_of_adj _ he\u27e9\n```\n\n## Edit instruction\nEdit `IsMatching` so it still compiles and the proof is simplified where possible. Return the full updated `IsMatching` 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.Combinatorics.SimpleGraph.Matching).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Combinatorics/SimpleGraph/Matching.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.SimpleGraph.Matching.IsMatching`, L79-L82)\n```lean\ntheorem IsMatching.toEdge.surjective (h : M.IsMatching) : Surjective h.toEdge := by\nrintro \u27e8\u27e8x, y\u27e9, he\u27e9\n exact \u27e8\u27e8x, M.edge_vert he\u27e9, h.toEdge_eq_of_adj _ he\u27e9\n```\n\n## Edit instruction\nEdit `IsMatching` so it still compiles and the proof is simplified where possible. Return the full updated `IsMatching` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Matching.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Matching", "declaration": "Mathlib.Combinatorics.SimpleGraph.Matching.IsMatching", "span": "L79-L82", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Matching.lean#L79"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 292, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 887, "lean_code_chars": 159, "natural_language_chars": 728, "lean_code_ratio": 0.1793, "line_count": 12, "imports_count": 0, "declarations_count": 93, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "94b807d7689be816", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.RingTheory.Spectrum.Prime.Topology.discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical", "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.RingTheory.Spectrum.Prime.Topology)."}, {"role": "user", "content": "You are editing a file in `Mathlib/RingTheory/Spectrum/Prime/Topology.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Spectrum.Prime.Topology.discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical`, L308-L322)\n```lean\ntheorem discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical :\n letI s := {I : Ideal R | I.IsMaximal}\nDiscreteTopology (PrimeSpectrum R) \u2194 Finite s \u2227 sInf s \u2264 nilradical R := by\n rw [discreteTopology_iff_finite_and_krullDimLE_zero, Ring.krullDimLE_zero_iff,\n (equivSubtype R).finite_iff, \u2190 Set.coe_setOf, Set.finite_coe_iff, Set.finite_coe_iff]\n refine \u27e8fun h \u21a6 \u27e8h.1.subset fun _ h \u21a6 h.isPrime, nilradical_eq_sInf R \u25b8 sInf_le_sInf h.2\u27e9,\n fun \u27e8fin, le\u27e9 \u21a6 ?_\u27e9\n have hpm (I : Ideal R) (hI : I.IsPrime) : I.IsMaximal := by\n replace le := le.trans (nilradical_le_prime I)\n rw [\u2190 fin.coe_toFinset, \u2190 Finset.inf_id_eq_sInf, hI.inf_le'] at le\n have \u27e8M, hM, hMI\u27e9 := le\n rw [fin.mem_toFinset] at hM\n rwa [\u2190 hM.eq_of_le hI.1 hMI]\n exact \u27e8fin.subset hpm, hpm\u27e9\n```\n\n## Edit instruction\nEdit `discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical` so it still compiles and the proof is simplified where possible. Return the full updated `discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical` 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.RingTheory.Spectrum.Prime.Topology).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/Spectrum/Prime/Topology.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Spectrum.Prime.Topology.discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical`, L308-L322)\n```lean\ntheorem discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical :\n letI s := {I : Ideal R | I.IsMaximal}\nDiscreteTopology (PrimeSpectrum R) \u2194 Finite s \u2227 sInf s \u2264 nilradical R := by\n rw [discreteTopology_iff_finite_and_krullDimLE_zero, Ring.krullDimLE_zero_iff,\n (equivSubtype R).finite_iff, \u2190 Set.coe_setOf, Set.finite_coe_iff, Set.finite_coe_iff]\n refine \u27e8fun h \u21a6 \u27e8h.1.subset fun _ h \u21a6 h.isPrime, nilradical_eq_sInf R \u25b8 sInf_le_sInf h.2\u27e9,\n fun \u27e8fin, le\u27e9 \u21a6 ?_\u27e9\n have hpm (I : Ideal R) (hI : I.IsPrime) : I.IsMaximal := by\n replace le := le.trans (nilradical_le_prime I)\n rw [\u2190 fin.coe_toFinset, \u2190 Finset.inf_id_eq_sInf, hI.inf_le'] at le\n have \u27e8M, hM, hMI\u27e9 := le\n rw [fin.mem_toFinset] at hM\n rwa [\u2190 hM.eq_of_le hI.1 hMI]\n exact \u27e8fin.subset hpm, hpm\u27e9\n```\n\n## Edit instruction\nEdit `discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical` so it still compiles and the proof is simplified where possible. Return the full updated `discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Spectrum/Prime/Topology.lean", "module": "Mathlib.RingTheory.Spectrum.Prime.Topology", "declaration": "Mathlib.RingTheory.Spectrum.Prime.Topology.discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical", "span": "L308-L322", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Spectrum/Prime/Topology.lean#L308"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 601, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1664, "lean_code_chars": 784, "natural_language_chars": 880, "lean_code_ratio": 0.4712, "line_count": 23, "imports_count": 0, "declarations_count": 156, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a8cd2fd679820ac7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle.abs_toReal_coe_eq_self_iff", "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.Analysis.SpecialFunctions.Trigonometric.Angle)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle.abs_toReal_coe_eq_self_iff`, L542-L546)\n```lean\ntheorem abs_toReal_coe_eq_self_iff {\u03b8 : \u211d} : |(\u03b8 : Angle).toReal| = \u03b8 \u2194 0 \u2264 \u03b8 \u2227 \u03b8 \u2264 \u03c0 := \u27e8fun h => h \u25b8 \u27e8abs_nonneg _, abs_toReal_le_pi _\u27e9, fun h =>\n (toReal_coe_eq_self_iff.2 \u27e8(Left.neg_neg_iff.2 Real.pi_pos).trans_le h.1, h.2\u27e9).symm \u25b8\n abs_eq_self.2 h.1\u27e9\n```\n\n## Edit instruction\nEdit `abs_toReal_coe_eq_self_iff` so it still compiles and the proof is simplified where possible. Return the full updated `abs_toReal_coe_eq_self_iff` 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.Analysis.SpecialFunctions.Trigonometric.Angle).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle.abs_toReal_coe_eq_self_iff`, L542-L546)\n```lean\ntheorem abs_toReal_coe_eq_self_iff {\u03b8 : \u211d} : |(\u03b8 : Angle).toReal| = \u03b8 \u2194 0 \u2264 \u03b8 \u2227 \u03b8 \u2264 \u03c0 := \u27e8fun h => h \u25b8 \u27e8abs_nonneg _, abs_toReal_le_pi _\u27e9, fun h =>\n (toReal_coe_eq_self_iff.2 \u27e8(Left.neg_neg_iff.2 Real.pi_pos).trans_le h.1, h.2\u27e9).symm \u25b8\n abs_eq_self.2 h.1\u27e9\n```\n\n## Edit instruction\nEdit `abs_toReal_coe_eq_self_iff` so it still compiles and the proof is simplified where possible. Return the full updated `abs_toReal_coe_eq_self_iff` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean", "module": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle", "declaration": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle.abs_toReal_coe_eq_self_iff", "span": "L542-L546", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean#L542"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 377, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1075, "lean_code_chars": 264, "natural_language_chars": 811, "lean_code_ratio": 0.2456, "line_count": 12, "imports_count": 0, "declarations_count": 98, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "15394d4a8c3aec7d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Option.Basic.elim_apply", "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.Data.Option.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Option/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Option.Basic.elim_apply`, L225-L228)\n```lean\ntheorem elim_apply {f : \u03b3 \u2192 \u03b1 \u2192 \u03b2} {x : \u03b1 \u2192 \u03b2} {i : Option \u03b3} {y : \u03b1} :\n i.elim x f y = i.elim (x y) fun j => f j y := by rw [elim_comp fun f : \u03b1 \u2192 \u03b2 => f y]\nopen Function in\n```\n\n## Edit instruction\nEdit `elim_apply` so it still compiles and the proof is simplified where possible. Return the full updated `elim_apply` 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.Data.Option.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Option/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Option.Basic.elim_apply`, L225-L228)\n```lean\ntheorem elim_apply {f : \u03b3 \u2192 \u03b1 \u2192 \u03b2} {x : \u03b1 \u2192 \u03b2} {i : Option \u03b3} {y : \u03b1} :\n i.elim x f y = i.elim (x y) fun j => f j y := by rw [elim_comp fun f : \u03b1 \u2192 \u03b2 => f y]\nopen Function in\n```\n\n## Edit instruction\nEdit `elim_apply` so it still compiles and the proof is simplified where possible. Return the full updated `elim_apply` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Option/Basic.lean", "module": "Mathlib.Data.Option.Basic", "declaration": "Mathlib.Data.Option.Basic.elim_apply", "span": "L225-L228", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Option/Basic.lean#L225"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 290, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 857, "lean_code_chars": 178, "natural_language_chars": 679, "lean_code_ratio": 0.2077, "line_count": 12, "imports_count": 0, "declarations_count": 104, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "05575f7c10b190ee", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences.covariantSequence_exact", "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.Algebra.Homology.DerivedCategory.Ext.ExactSequences)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Homology/DerivedCategory/Ext/ExactSequences.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences.covariantSequence_exact`, L131-L137)\n```lean\nlemma covariantSequence_exact :\n (covariantSequence X hS n\u2080 n\u2081 h).Exact := exact_of_\u03b4\u2080 (covariant_sequence_exact\u2082' X hS n\u2080).exact_toComposableArrows\n (exact_of_\u03b4\u2080 (covariant_sequence_exact\u2083' X hS n\u2080 n\u2081 h).exact_toComposableArrows\n (exact_of_\u03b4\u2080 (covariant_sequence_exact\u2081' X hS n\u2080 n\u2081 h).exact_toComposableArrows\n (covariant_sequence_exact\u2082' X hS n\u2081).exact_toComposableArrows))\n```\n\n## Edit instruction\nEdit `covariantSequence_exact` so it still compiles and the proof is simplified where possible. Return the full updated `covariantSequence_exact` 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.Algebra.Homology.DerivedCategory.Ext.ExactSequences).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Homology/DerivedCategory/Ext/ExactSequences.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences.covariantSequence_exact`, L131-L137)\n```lean\nlemma covariantSequence_exact :\n (covariantSequence X hS n\u2080 n\u2081 h).Exact := exact_of_\u03b4\u2080 (covariant_sequence_exact\u2082' X hS n\u2080).exact_toComposableArrows\n (exact_of_\u03b4\u2080 (covariant_sequence_exact\u2083' X hS n\u2080 n\u2081 h).exact_toComposableArrows\n (exact_of_\u03b4\u2080 (covariant_sequence_exact\u2081' X hS n\u2080 n\u2081 h).exact_toComposableArrows\n (covariant_sequence_exact\u2082' X hS n\u2081).exact_toComposableArrows))\n```\n\n## Edit instruction\nEdit `covariantSequence_exact` so it still compiles and the proof is simplified where possible. Return the full updated `covariantSequence_exact` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Homology/DerivedCategory/Ext/ExactSequences.lean", "module": "Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences", "declaration": "Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences.covariantSequence_exact", "span": "L131-L137", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/DerivedCategory/Ext/ExactSequences.lean#L131"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 404, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1214, "lean_code_chars": 394, "natural_language_chars": 820, "lean_code_ratio": 0.3245, "line_count": 14, "imports_count": 0, "declarations_count": 113, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "262618abbe4aeaa4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.RingTheory.Polynomial.GaussNorm.le_gaussNorm", "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.RingTheory.Polynomial.GaussNorm)."}, {"role": "user", "content": "You are editing a file in `Mathlib/RingTheory/Polynomial/GaussNorm.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Polynomial.GaussNorm.le_gaussNorm`, L137-L141)\n```lean\nlemma le_gaussNorm (hc : 0 \u2264 c) (i : \u2115) : v (p.coeff i) * c ^ i \u2264 p.gaussNorm v c := by\nrw [\u2190 gaussNorm_coe_powerSeries _ _ hc, \u2190 coeff_coe]\n apply PowerSeries.le_gaussNorm\n simpa using aux_bdd v p\n```\n\n## Edit instruction\nEdit `le_gaussNorm` so it still compiles and the proof is simplified where possible. Return the full updated `le_gaussNorm` 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.RingTheory.Polynomial.GaussNorm).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/Polynomial/GaussNorm.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.Polynomial.GaussNorm.le_gaussNorm`, L137-L141)\n```lean\nlemma le_gaussNorm (hc : 0 \u2264 c) (i : \u2115) : v (p.coeff i) * c ^ i \u2264 p.gaussNorm v c := by\nrw [\u2190 gaussNorm_coe_powerSeries _ _ hc, \u2190 coeff_coe]\n apply PowerSeries.le_gaussNorm\n simpa using aux_bdd v p\n```\n\n## Edit instruction\nEdit `le_gaussNorm` so it still compiles and the proof is simplified where possible. Return the full updated `le_gaussNorm` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Polynomial/GaussNorm.lean", "module": "Mathlib.RingTheory.Polynomial.GaussNorm", "declaration": "Mathlib.RingTheory.Polynomial.GaussNorm.le_gaussNorm", "span": "L137-L141", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/GaussNorm.lean#L137"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 316, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 927, "lean_code_chars": 200, "natural_language_chars": 727, "lean_code_ratio": 0.2157, "line_count": 13, "imports_count": 0, "declarations_count": 102, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2b91fdff9f270253", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Topology.Separation.Basic.t0Space_iff_not_inseparable", "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.Topology.Separation.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Topology/Separation/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.Separation.Basic.t0Space_iff_not_inseparable`, L85-L88)\n```lean\ntheorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Pairwise fun x y : X => \u00acInseparable x y := by\nsimp only [t0Space_iff_inseparable, Ne, not_imp_not, Pairwise]\n```\n\n## Edit instruction\nEdit `t0Space_iff_not_inseparable` so it still compiles and the proof is simplified where possible. Return the full updated `t0Space_iff_not_inseparable` 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.Topology.Separation.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Topology/Separation/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Topology.Separation.Basic.t0Space_iff_not_inseparable`, L85-L88)\n```lean\ntheorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] :\n T0Space X \u2194 Pairwise fun x y : X => \u00acInseparable x y := by\nsimp only [t0Space_iff_inseparable, Ne, not_imp_not, Pairwise]\n```\n\n## Edit instruction\nEdit `t0Space_iff_not_inseparable` so it still compiles and the proof is simplified where possible. Return the full updated `t0Space_iff_not_inseparable` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Separation/Basic.lean", "module": "Mathlib.Topology.Separation.Basic", "declaration": "Mathlib.Topology.Separation.Basic.t0Space_iff_not_inseparable", "span": "L85-L88", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Separation/Basic.lean#L85"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 308, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 950, "lean_code_chars": 198, "natural_language_chars": 752, "lean_code_ratio": 0.2084, "line_count": 12, "imports_count": 0, "declarations_count": 99, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7eee1357bb5ae84f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Combinatorics.Configuration.eq_or_eq_of_orthogonal", "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.Combinatorics.Configuration)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Combinatorics/Configuration.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.Configuration.eq_or_eq_of_orthogonal`, L500-L509)\n```lean\nlemma eq_or_eq_of_orthogonal {a b c d : \u2119 K (Fin 3 \u2192 K)} (hac : a.orthogonal c)\n (hbc : b.orthogonal c) (had : a.orthogonal d) (hbd : b.orthogonal d) :\n a = b \u2228 c = d := by\ninduction a with | h a ha =>\n induction b with | h b hb =>\n induction c with | h c hc =>\n induction d with | h d hd =>\n rw [mk_eq_mk_iff_crossProduct_eq_zero, mk_eq_mk_iff_crossProduct_eq_zero]\n exact crossProduct_eq_zero_of_dotProduct_eq_zero hac hbc had hbd\n```\n\n## Edit instruction\nEdit `eq_or_eq_of_orthogonal` so it still compiles and the proof is simplified where possible. Return the full updated `eq_or_eq_of_orthogonal` 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.Combinatorics.Configuration).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Combinatorics/Configuration.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Combinatorics.Configuration.eq_or_eq_of_orthogonal`, L500-L509)\n```lean\nlemma eq_or_eq_of_orthogonal {a b c d : \u2119 K (Fin 3 \u2192 K)} (hac : a.orthogonal c)\n (hbc : b.orthogonal c) (had : a.orthogonal d) (hbd : b.orthogonal d) :\n a = b \u2228 c = d := by\ninduction a with | h a ha =>\n induction b with | h b hb =>\n induction c with | h c hc =>\n induction d with | h d hd =>\n rw [mk_eq_mk_iff_crossProduct_eq_zero, mk_eq_mk_iff_crossProduct_eq_zero]\n exact crossProduct_eq_zero_of_dotProduct_eq_zero hac hbc had hbd\n```\n\n## Edit instruction\nEdit `eq_or_eq_of_orthogonal` so it still compiles and the proof is simplified where possible. Return the full updated `eq_or_eq_of_orthogonal` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/Configuration.lean", "module": "Mathlib.Combinatorics.Configuration", "declaration": "Mathlib.Combinatorics.Configuration.eq_or_eq_of_orthogonal", "span": "L500-L509", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Configuration.lean#L500"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 387, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1189, "lean_code_chars": 444, "natural_language_chars": 745, "lean_code_ratio": 0.3734, "line_count": 18, "imports_count": 0, "declarations_count": 133, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3d2addf0c5d433a3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Finset.Prod.disjoint_product", "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.Data.Finset.Prod)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Finset/Prod.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Finset.Prod.disjoint_product`, L222-L224)\n```lean\ntheorem disjoint_product : Disjoint (s \u00d7\u02e2 t) (s' \u00d7\u02e2 t') \u2194 Disjoint s s' \u2228 Disjoint t t' := by\nsimp_rw [\u2190 disjoint_coe, coe_product, Set.disjoint_prod]\n```\n\n## Edit instruction\nEdit `disjoint_product` so it still compiles and the proof is simplified where possible. Return the full updated `disjoint_product` 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.Data.Finset.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Finset/Prod.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Finset.Prod.disjoint_product`, L222-L224)\n```lean\ntheorem disjoint_product : Disjoint (s \u00d7\u02e2 t) (s' \u00d7\u02e2 t') \u2194 Disjoint s s' \u2228 Disjoint t t' := by\nsimp_rw [\u2190 disjoint_coe, coe_product, Set.disjoint_prod]\n```\n\n## Edit instruction\nEdit `disjoint_product` so it still compiles and the proof is simplified where possible. Return the full updated `disjoint_product` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Finset/Prod.lean", "module": "Mathlib.Data.Finset.Prod", "declaration": "Mathlib.Data.Finset.Prod.disjoint_product", "span": "L222-L224", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finset/Prod.lean#L222"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 271, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 845, "lean_code_chars": 151, "natural_language_chars": 694, "lean_code_ratio": 0.1787, "line_count": 11, "imports_count": 0, "declarations_count": 93, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c35d5508628ceb1b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Lie.SkewAdjoint.mem_skewAdjointMatricesLieSubalgebra_unit_smul", "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.Algebra.Lie.SkewAdjoint)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Lie/SkewAdjoint.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Lie.SkewAdjoint.mem_skewAdjointMatricesLieSubalgebra_unit_smul`, L153-L161)\n```lean\ntheorem mem_skewAdjointMatricesLieSubalgebra_unit_smul (u : R\u02e3) (J A : Matrix n n R) :\n A \u2208 skewAdjointMatricesLieSubalgebra (u \u2022 J) \u2194 A \u2208 skewAdjointMatricesLieSubalgebra J := by\nchange A \u2208 skewAdjointMatricesSubmodule (u \u2022 J) \u2194 A \u2208 skewAdjointMatricesSubmodule J\n simp only [mem_skewAdjointMatricesSubmodule, Matrix.IsSkewAdjoint, Matrix.IsAdjointPair]\n constructor <;> intro h\n \u00b7 simpa using congr_arg (fun B => u\u207b\u00b9 \u2022 B) h\n \u00b7 simp [h]\n\nend SkewAdjointMatrices\n```\n\n## Edit instruction\nEdit `mem_skewAdjointMatricesLieSubalgebra_unit_smul` so it still compiles and the proof is simplified where possible. Return the full updated `mem_skewAdjointMatricesLieSubalgebra_unit_smul` 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.Algebra.Lie.SkewAdjoint).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Lie/SkewAdjoint.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Lie.SkewAdjoint.mem_skewAdjointMatricesLieSubalgebra_unit_smul`, L153-L161)\n```lean\ntheorem mem_skewAdjointMatricesLieSubalgebra_unit_smul (u : R\u02e3) (J A : Matrix n n R) :\n A \u2208 skewAdjointMatricesLieSubalgebra (u \u2022 J) \u2194 A \u2208 skewAdjointMatricesLieSubalgebra J := by\nchange A \u2208 skewAdjointMatricesSubmodule (u \u2022 J) \u2194 A \u2208 skewAdjointMatricesSubmodule J\n simp only [mem_skewAdjointMatricesSubmodule, Matrix.IsSkewAdjoint, Matrix.IsAdjointPair]\n constructor <;> intro h\n \u00b7 simpa using congr_arg (fun B => u\u207b\u00b9 \u2022 B) h\n \u00b7 simp [h]\n\nend SkewAdjointMatrices\n```\n\n## Edit instruction\nEdit `mem_skewAdjointMatricesLieSubalgebra_unit_smul` so it still compiles and the proof is simplified where possible. Return the full updated `mem_skewAdjointMatricesLieSubalgebra_unit_smul` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Lie/SkewAdjoint.lean", "module": "Mathlib.Algebra.Lie.SkewAdjoint", "declaration": "Mathlib.Algebra.Lie.SkewAdjoint.mem_skewAdjointMatricesLieSubalgebra_unit_smul", "span": "L153-L161", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/SkewAdjoint.lean#L153"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 428, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1275, "lean_code_chars": 470, "natural_language_chars": 805, "lean_code_ratio": 0.3686, "line_count": 18, "imports_count": 0, "declarations_count": 121, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "211b5ce1a5afbebf", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.GroupWithZero.Range.valueGroup_def", "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.Algebra.GroupWithZero.Range)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/GroupWithZero/Range.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.GroupWithZero.Range.valueGroup_def`, L99-L102)\n```lean\nlemma valueGroup_def : valueGroup f = Subgroup.closure (valueMonoid f) := rfl\n/-- For a morphism of monoids with zero `f`, this is the smallest submonoid with zero of the\ncodomain containing the range of `f`. -/\n```\n\n## Edit instruction\nEdit `valueGroup_def` so it still compiles and the proof is simplified where possible. Return the full updated `valueGroup_def` 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.Algebra.GroupWithZero.Range).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/GroupWithZero/Range.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.GroupWithZero.Range.valueGroup_def`, L99-L102)\n```lean\nlemma valueGroup_def : valueGroup f = Subgroup.closure (valueMonoid f) := rfl\n/-- For a morphism of monoids with zero `f`, this is the smallest submonoid with zero of the\ncodomain containing the range of `f`. -/\n```\n\n## Edit instruction\nEdit `valueGroup_def` so it still compiles and the proof is simplified where possible. Return the full updated `valueGroup_def` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/GroupWithZero/Range.lean", "module": "Mathlib.Algebra.GroupWithZero.Range", "declaration": "Mathlib.Algebra.GroupWithZero.Range.valueGroup_def", "span": "L99-L102", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/GroupWithZero/Range.lean#L99"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 278, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 932, "lean_code_chars": 212, "natural_language_chars": 720, "lean_code_ratio": 0.2275, "line_count": 12, "imports_count": 0, "declarations_count": 106, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c050624149a4c77d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Set.MemPartition.mem_memPartitionSet", "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.Data.Set.MemPartition)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Set/MemPartition.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.MemPartition.mem_memPartitionSet`, L136-L143)\n```lean\nlemma mem_memPartitionSet (f : \u2115 \u2192 Set \u03b1) (n : \u2115) (a : \u03b1) : a \u2208 memPartitionSet f n a := by\ninduction n with\n | zero => simp [memPartitionSet]\n | succ n ih =>\n classical\n rw [memPartitionSet_succ]\n split_ifs with h <;> exact \u27e8ih, h\u27e9\n```\n\n## Edit instruction\nEdit `mem_memPartitionSet` so it still compiles and the proof is simplified where possible. Return the full updated `mem_memPartitionSet` 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.Data.Set.MemPartition).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Set/MemPartition.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Set.MemPartition.mem_memPartitionSet`, L136-L143)\n```lean\nlemma mem_memPartitionSet (f : \u2115 \u2192 Set \u03b1) (n : \u2115) (a : \u03b1) : a \u2208 memPartitionSet f n a := by\ninduction n with\n | zero => simp [memPartitionSet]\n | succ n ih =>\n classical\n rw [memPartitionSet_succ]\n split_ifs with h <;> exact \u27e8ih, h\u27e9\n```\n\n## Edit instruction\nEdit `mem_memPartitionSet` so it still compiles and the proof is simplified where possible. Return the full updated `mem_memPartitionSet` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/MemPartition.lean", "module": "Mathlib.Data.Set.MemPartition", "declaration": "Mathlib.Data.Set.MemPartition.mem_memPartitionSet", "span": "L136-L143", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/MemPartition.lean#L136"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 307, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 962, "lean_code_chars": 244, "natural_language_chars": 718, "lean_code_ratio": 0.2536, "line_count": 16, "imports_count": 0, "declarations_count": 105, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d34117299eff16ca", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Algebra.Subalgebra.MulOpposite.op_sSup", "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.Algebra.Algebra.Subalgebra.MulOpposite)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Algebra/Subalgebra/MulOpposite.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Algebra.Subalgebra.MulOpposite.op_sSup`, L104-L106)\n```lean\ntheorem op_sSup (S : Set (Subalgebra R A)) : (sSup S).op = sSup (.unop \u207b\u00b9' S) := opEquiv.map_sSup_eq_sSup_symm_preimage _\n```\n\n## Edit instruction\nEdit `op_sSup` so it still compiles and the proof is simplified where possible. Return the full updated `op_sSup` 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.Algebra.Algebra.Subalgebra.MulOpposite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Algebra/Subalgebra/MulOpposite.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Algebra.Subalgebra.MulOpposite.op_sSup`, L104-L106)\n```lean\ntheorem op_sSup (S : Set (Subalgebra R A)) : (sSup S).op = sSup (.unop \u207b\u00b9' S) := opEquiv.map_sSup_eq_sSup_symm_preimage _\n```\n\n## Edit instruction\nEdit `op_sSup` so it still compiles and the proof is simplified where possible. Return the full updated `op_sSup` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Algebra/Subalgebra/MulOpposite.lean", "module": "Mathlib.Algebra.Algebra.Subalgebra.MulOpposite", "declaration": "Mathlib.Algebra.Algebra.Subalgebra.MulOpposite.op_sSup", "span": "L104-L106", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/Subalgebra/MulOpposite.lean#L104"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 288, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 855, "lean_code_chars": 122, "natural_language_chars": 733, "lean_code_ratio": 0.1427, "line_count": 10, "imports_count": 0, "declarations_count": 91, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b46a91d60732e09c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.Normed.Group.Hom.coe_nsmul", "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.Analysis.Normed.Group.Hom)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/Normed/Group/Hom.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Normed.Group.Hom.coe_nsmul`, L471-L473)\n```lean\ntheorem coe_nsmul (r : \u2115) (f : NormedAddGroupHom V\u2081 V\u2082) : \u21d1(r \u2022 f) = r \u2022 \u21d1f := rfl\n```\n\n## Edit instruction\nEdit `coe_nsmul` so it still compiles and the proof is simplified where possible. Return the full updated `coe_nsmul` 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.Analysis.Normed.Group.Hom).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Normed/Group/Hom.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Normed.Group.Hom.coe_nsmul`, L471-L473)\n```lean\ntheorem coe_nsmul (r : \u2115) (f : NormedAddGroupHom V\u2081 V\u2082) : \u21d1(r \u2022 f) = r \u2022 \u21d1f := rfl\n```\n\n## Edit instruction\nEdit `coe_nsmul` so it still compiles and the proof is simplified where possible. Return the full updated `coe_nsmul` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Normed/Group/Hom.lean", "module": "Mathlib.Analysis.Normed.Group.Hom", "declaration": "Mathlib.Analysis.Normed.Group.Hom.coe_nsmul", "span": "L471-L473", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Group/Hom.lean#L471"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 273, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 783, "lean_code_chars": 83, "natural_language_chars": 700, "lean_code_ratio": 0.106, "line_count": 10, "imports_count": 0, "declarations_count": 88, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f2af0ebeded8d408", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Order.CompleteBooleanAlgebra.Pi", "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.Order.CompleteBooleanAlgebra)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Order/CompleteBooleanAlgebra.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.CompleteBooleanAlgebra.Pi`, L626-L630)\n```lean\ninstance Pi.instCompleteBooleanAlgebra {\u03b9 : Type*} {\u03c0 : \u03b9 \u2192 Type*}\n [\u2200 i, CompleteBooleanAlgebra (\u03c0 i)] : CompleteBooleanAlgebra (\u2200 i, \u03c0 i) where\n __ := instBooleanAlgebra\n__ := instCompleteDistribLattice\n```\n\n## Edit instruction\nEdit `Pi` so it still compiles and the proof is simplified where possible. Return the full updated `Pi` 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.Order.CompleteBooleanAlgebra).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Order/CompleteBooleanAlgebra.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Order.CompleteBooleanAlgebra.Pi`, L626-L630)\n```lean\ninstance Pi.instCompleteBooleanAlgebra {\u03b9 : Type*} {\u03c0 : \u03b9 \u2192 Type*}\n [\u2200 i, CompleteBooleanAlgebra (\u03c0 i)] : CompleteBooleanAlgebra (\u2200 i, \u03c0 i) where\n __ := instBooleanAlgebra\n__ := instCompleteDistribLattice\n```\n\n## Edit instruction\nEdit `Pi` so it still compiles and the proof is simplified where possible. Return the full updated `Pi` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/CompleteBooleanAlgebra.lean", "module": "Mathlib.Order.CompleteBooleanAlgebra", "declaration": "Mathlib.Order.CompleteBooleanAlgebra.Pi", "span": "L626-L630", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/CompleteBooleanAlgebra.lean#L626"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 275, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 897, "lean_code_chars": 209, "natural_language_chars": 688, "lean_code_ratio": 0.233, "line_count": 13, "imports_count": 0, "declarations_count": 89, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7f6f3f1abbe12a6f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_const", "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.Analysis.Distribution.SchwartzSpace.Basic)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_const`, L754-L759)\n```lean\ntheorem smulLeftCLM_const (c : \ud835\udd5c) :\n smulLeftCLM F (fun (_ : E) \u21a6 c) = c \u2022 ContinuousLinearMap.id \ud835\udd5c _ := by\next f x\n have : (fun (_ : E) \u21a6 c).HasTemperateGrowth := by fun_prop\n simp [this]\n```\n\n## Edit instruction\nEdit `smulLeftCLM_const` so it still compiles and the proof is simplified where possible. Return the full updated `smulLeftCLM_const` 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.Analysis.Distribution.SchwartzSpace.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_const`, L754-L759)\n```lean\ntheorem smulLeftCLM_const (c : \ud835\udd5c) :\n smulLeftCLM F (fun (_ : E) \u21a6 c) = c \u2022 ContinuousLinearMap.id \ud835\udd5c _ := by\next f x\n have : (fun (_ : E) \u21a6 c).HasTemperateGrowth := by fun_prop\n simp [this]\n```\n\n## Edit instruction\nEdit `smulLeftCLM_const` so it still compiles and the proof is simplified where possible. Return the full updated `smulLeftCLM_const` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean", "module": "Mathlib.Analysis.Distribution.SchwartzSpace.Basic", "declaration": "Mathlib.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_const", "span": "L754-L759", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean#L754"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 323, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 966, "lean_code_chars": 194, "natural_language_chars": 772, "lean_code_ratio": 0.2008, "line_count": 14, "imports_count": 0, "declarations_count": 102, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "15c9290efa57941c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Data.Int.GCD.gcd_eq_gcd_ab", "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.Data.Int.GCD)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Data/Int/GCD.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Int.GCD.gcd_eq_gcd_ab`, L174-L184)\n```lean\ntheorem gcd_eq_gcd_ab : \u2200 x y : \u2124, (gcd x y : \u2124) = x * gcdA x y + y * gcdB x y\n | (m : \u2115), (n : \u2115) => Nat.gcd_eq_gcd_ab _ _\n | (m : \u2115), -[n+1] =>\n show (_ : \u2124) = _ + -(n + 1) * -_ by rw [Int.neg_mul_neg]; apply Nat.gcd_eq_gcd_ab\n | -[m+1], (n : \u2115) =>\n show (_ : \u2124) = -(m + 1) * -_ + _ by rw [Int.neg_mul_neg]; apply Nat.gcd_eq_gcd_ab\n | -[m+1], -[n+1] =>\n show (_ : \u2124) = -(m + 1) * -_ + -(n + 1) * -_ by\n rw [Int.neg_mul_neg, Int.neg_mul_neg]\n apply Nat.gcd_eq_gcd_ab\n```\n\n## Edit instruction\nEdit `gcd_eq_gcd_ab` so it still compiles and the proof is simplified where possible. Return the full updated `gcd_eq_gcd_ab` 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.Data.Int.GCD).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Data/Int/GCD.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Data.Int.GCD.gcd_eq_gcd_ab`, L174-L184)\n```lean\ntheorem gcd_eq_gcd_ab : \u2200 x y : \u2124, (gcd x y : \u2124) = x * gcdA x y + y * gcdB x y\n | (m : \u2115), (n : \u2115) => Nat.gcd_eq_gcd_ab _ _\n | (m : \u2115), -[n+1] =>\n show (_ : \u2124) = _ + -(n + 1) * -_ by rw [Int.neg_mul_neg]; apply Nat.gcd_eq_gcd_ab\n | -[m+1], (n : \u2115) =>\n show (_ : \u2124) = -(m + 1) * -_ + _ by rw [Int.neg_mul_neg]; apply Nat.gcd_eq_gcd_ab\n | -[m+1], -[n+1] =>\n show (_ : \u2124) = -(m + 1) * -_ + -(n + 1) * -_ by\n rw [Int.neg_mul_neg, Int.neg_mul_neg]\n apply Nat.gcd_eq_gcd_ab\n```\n\n## Edit instruction\nEdit `gcd_eq_gcd_ab` so it still compiles and the proof is simplified where possible. Return the full updated `gcd_eq_gcd_ab` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Int/GCD.lean", "module": "Mathlib.Data.Int.GCD", "declaration": "Mathlib.Data.Int.GCD.gcd_eq_gcd_ab", "span": "L174-L184", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Int/GCD.lean#L174"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 477, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1164, "lean_code_chars": 491, "natural_language_chars": 673, "lean_code_ratio": 0.4218, "line_count": 19, "imports_count": 0, "declarations_count": 133, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c4ead7ed8865b74b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "D-Mathlib.Algebra.Algebra.Spectrum.Quasispectrum.apply_mem", "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.Algebra.Algebra.Spectrum.Quasispectrum)."}, {"role": "user", "content": "You are editing a file in `Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Algebra.Spectrum.Quasispectrum.apply_mem`, L506-L509)\n```lean\ntheorem apply_mem (h : QuasispectrumRestricts a f) {s : S} (hs : s \u2208 quasispectrum S a) :\n f s \u2208 quasispectrum R a := h.image \u25b8 \u27e8s, hs, rfl\u27e9\n```\n\n## Edit instruction\nEdit `apply_mem` so it still compiles and the proof is simplified where possible. Return the full updated `apply_mem` 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.Algebra.Algebra.Spectrum.Quasispectrum).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Algebra.Spectrum.Quasispectrum.apply_mem`, L506-L509)\n```lean\ntheorem apply_mem (h : QuasispectrumRestricts a f) {s : S} (hs : s \u2208 quasispectrum S a) :\n f s \u2208 quasispectrum R a := h.image \u25b8 \u27e8s, hs, rfl\u27e9\n```\n\n## Edit instruction\nEdit `apply_mem` so it still compiles and the proof is simplified where possible. Return the full updated `apply_mem` block.\n[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean", "module": "Mathlib.Algebra.Algebra.Spectrum.Quasispectrum", "declaration": "Mathlib.Algebra.Algebra.Spectrum.Quasispectrum.apply_mem", "span": "L506-L509", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean#L506"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 282, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 883, "lean_code_chars": 144, "natural_language_chars": 739, "lean_code_ratio": 0.1631, "line_count": 11, "imports_count": 0, "declarations_count": 98, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "72fc37528cb40684", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Order.Sub.Defs.antitone_const_tsub", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Sub.Defs)."}, {"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 antitone_const_tsub : Antitone fun x => c - x\n```\n\nDeclaration: `Mathlib.Algebra.Order.Sub.Defs.antitone_const_tsub` (module Mathlib.Algebra.Order.Sub.Defs)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Sub.Defs).[/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 antitone_const_tsub : Antitone fun x => c - x\n```\n\nDeclaration: `Mathlib.Algebra.Order.Sub.Defs.antitone_const_tsub` (module Mathlib.Algebra.Order.Sub.Defs).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Sub/Defs.lean", "module": "Mathlib.Algebra.Order.Sub.Defs", "declaration": "Mathlib.Algebra.Order.Sub.Defs.antitone_const_tsub", "span": "L120-L122", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Sub/Defs.lean#L120"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 154, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 552, "lean_code_chars": 54, "natural_language_chars": 498, "lean_code_ratio": 0.0978, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "024d852b02ece3fa", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.Normed.Affine.Isometry.subtype\u2090\u1d62", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Affine.Isometry)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ndef subtype\u2090\u1d62 (s : AffineSubspace \ud835\udd5c P) [Nonempty s] : s \u2192\u1d43\u2071[\ud835\udd5c] P\n```\n\nDeclaration: `Mathlib.Analysis.Normed.Affine.Isometry.subtype\u2090\u1d62` (module Mathlib.Analysis.Normed.Affine.Isometry)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Affine.Isometry).[/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\ndef subtype\u2090\u1d62 (s : AffineSubspace \ud835\udd5c P) [Nonempty s] : s \u2192\u1d43\u2071[\ud835\udd5c] P\n```\n\nDeclaration: `Mathlib.Analysis.Normed.Affine.Isometry.subtype\u2090\u1d62` (module Mathlib.Analysis.Normed.Affine.Isometry).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Normed/Affine/Isometry.lean", "module": "Mathlib.Analysis.Normed.Affine.Isometry", "declaration": "Mathlib.Analysis.Normed.Affine.Isometry.subtype\u2090\u1d62", "span": "L261-L263", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Affine/Isometry.lean#L261"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 194, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 580, "lean_code_chars": 65, "natural_language_chars": 515, "lean_code_ratio": 0.1121, "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": "387b889c723efc4a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Star.LinearMap.intrinsicStar_mul'", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Star.LinearMap)."}, {"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 intrinsicStar_mul' [SMulCommClass R' E E] [IsScalarTower R' E E] :\n star (toConv (mul' R' E)) = toConv (mul' R' E \u2218\u2097 TensorProduct.comm R' E E)\n```\n\nDeclaration: `Mathlib.Algebra.Star.LinearMap.intrinsicStar_mul'` (module Mathlib.Algebra.Star.LinearMap)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Star.LinearMap).[/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 intrinsicStar_mul' [SMulCommClass R' E E] [IsScalarTower R' E E] :\n star (toConv (mul' R' E)) = toConv (mul' R' E \u2218\u2097 TensorProduct.comm R' E E)\n```\n\nDeclaration: `Mathlib.Algebra.Star.LinearMap.intrinsicStar_mul'` (module Mathlib.Algebra.Star.LinearMap).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Star/LinearMap.lean", "module": "Mathlib.Algebra.Star.LinearMap", "declaration": "Mathlib.Algebra.Star.LinearMap.intrinsicStar_mul'", "span": "L107-L113", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Star/LinearMap.lean#L107"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 199, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 652, "lean_code_chars": 155, "natural_language_chars": 497, "lean_code_ratio": 0.2377, "line_count": 8, "imports_count": 0, "declarations_count": 69, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9e504a15a49a429c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Order.Monoid.Unbundled.Pow.Monotone", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.Unbundled.Pow)."}, {"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 Monotone.pow_const {f : \u03b2 \u2192 M} (hf : Monotone f) : \u2200 n : \u2115, Monotone fun a => f a ^ n\n | 0 => by simpa using monotone_const\n | n + 1 => by\n simp_rw [pow_succ]\n exact (Monotone.pow_const hf _).mul' hf\n```\n\nDeclaration: `Mathlib.Algebra.Order.Monoid.Unbundled.Pow.Monotone` (module Mathlib.Algebra.Order.Monoid.Unbundled.Pow)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.Unbundled.Pow).[/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 Monotone.pow_const {f : \u03b2 \u2192 M} (hf : Monotone f) : \u2200 n : \u2115, Monotone fun a => f a ^ n\n | 0 => by simpa using monotone_const\n | n + 1 => by\n simp_rw [pow_succ]\n exact (Monotone.pow_const hf _).mul' hf\n```\n\nDeclaration: `Mathlib.Algebra.Order.Monoid.Unbundled.Pow.Monotone` (module Mathlib.Algebra.Order.Monoid.Unbundled.Pow).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Monoid/Unbundled/Pow.lean", "module": "Mathlib.Algebra.Order.Monoid.Unbundled.Pow", "declaration": "Mathlib.Algebra.Order.Monoid.Unbundled.Pow.Monotone", "span": "L167-L172", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Monoid/Unbundled/Pow.lean#L167"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 242, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 739, "lean_code_chars": 216, "natural_language_chars": 523, "lean_code_ratio": 0.2923, "line_count": 11, "imports_count": 0, "declarations_count": 74, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d14c04185b3bd5b7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Data.List.Sublists.sublists'_cons", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.List.Sublists)."}, {"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 sublists'_cons (a : \u03b1) (l : List \u03b1) :\n sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l)\n```\n\nDeclaration: `Mathlib.Data.List.Sublists.sublists'_cons` (module Mathlib.Data.List.Sublists)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.List.Sublists).[/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 sublists'_cons (a : \u03b1) (l : List \u03b1) :\n sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l)\n```\n\nDeclaration: `Mathlib.Data.List.Sublists.sublists'_cons` (module Mathlib.Data.List.Sublists).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/List/Sublists.lean", "module": "Mathlib.Data.List.Sublists", "declaration": "Mathlib.Data.List.Sublists.sublists'_cons", "span": "L70-L73", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/Sublists.lean#L70"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 178, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 594, "lean_code_chars": 113, "natural_language_chars": 481, "lean_code_ratio": 0.1902, "line_count": 8, "imports_count": 0, "declarations_count": 61, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "77d87944e0171b7a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics.IsBigO", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics)."}, {"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 IsBigO.rpow_rpow_nhdsGE_zero_of_le {a b : \u211d} (h : a \u2264 b) (hb : b \u2260 0) :\n (\u00b7 ^ b : \u211d \u2192 \u211d) =O[\ud835\udcdd[\u2265] 0] (\u00b7 ^ a)\n```\n\nDeclaration: `Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics.IsBigO` (module Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics).[/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 IsBigO.rpow_rpow_nhdsGE_zero_of_le {a b : \u211d} (h : a \u2264 b) (hb : b \u2260 0) :\n (\u00b7 ^ b : \u211d \u2192 \u211d) =O[\ud835\udcdd[\u2265] 0] (\u00b7 ^ a)\n```\n\nDeclaration: `Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics.IsBigO` (module Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean", "module": "Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics", "declaration": "Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics.IsBigO", "span": "L306-L310", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean#L306"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 223, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 661, "lean_code_chars": 119, "natural_language_chars": 542, "lean_code_ratio": 0.18, "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": "0c3989a33c5dfed5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Group.Pi.Lemmas.Pi", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Pi.Lemmas)."}, {"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 Pi.mulSingle_inf [\u2200 i, SemilatticeInf (f i)] [\u2200 i, One (f i)] (i : I) (x y : f i) :\n Pi.mulSingle i (x \u2293 y) = Pi.mulSingle i x \u2293 Pi.mulSingle i y\n```\n\nDeclaration: `Mathlib.Algebra.Group.Pi.Lemmas.Pi` (module Mathlib.Algebra.Group.Pi.Lemmas)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Pi.Lemmas).[/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 Pi.mulSingle_inf [\u2200 i, SemilatticeInf (f i)] [\u2200 i, One (f i)] (i : I) (x y : f i) :\n Pi.mulSingle i (x \u2293 y) = Pi.mulSingle i x \u2293 Pi.mulSingle i y\n```\n\nDeclaration: `Mathlib.Algebra.Group.Pi.Lemmas.Pi` (module Mathlib.Algebra.Group.Pi.Lemmas).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Group/Pi/Lemmas.lean", "module": "Mathlib.Algebra.Group.Pi.Lemmas", "declaration": "Mathlib.Algebra.Group.Pi.Lemmas.Pi", "span": "L248-L251", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Pi/Lemmas.lean#L248"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 213, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 641, "lean_code_chars": 157, "natural_language_chars": 484, "lean_code_ratio": 0.2449, "line_count": 8, "imports_count": 0, "declarations_count": 72, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "75f19d7ea78bd6aa", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Order.Rearrangement.Antivary", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Rearrangement)."}, {"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 Antivary.sum_smul_le_sum_smul_comp_perm (hfg : Antivary f g) :\n \u2211 i, f i \u2022 g i \u2264 \u2211 i, f i \u2022 g (\u03c3 i)\n```\n\nDeclaration: `Mathlib.Algebra.Order.Rearrangement.Antivary` (module Mathlib.Algebra.Order.Rearrangement)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Rearrangement).[/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 Antivary.sum_smul_le_sum_smul_comp_perm (hfg : Antivary f g) :\n \u2211 i, f i \u2022 g i \u2264 \u2211 i, f i \u2022 g (\u03c3 i)\n```\n\nDeclaration: `Mathlib.Algebra.Order.Rearrangement.Antivary` (module Mathlib.Algebra.Order.Rearrangement).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Rearrangement.lean", "module": "Mathlib.Algebra.Order.Rearrangement", "declaration": "Mathlib.Algebra.Order.Rearrangement.Antivary", "span": "L144-L149", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Rearrangement.lean#L144"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 187, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 613, "lean_code_chars": 111, "natural_language_chars": 502, "lean_code_ratio": 0.1811, "line_count": 8, "imports_count": 0, "declarations_count": 62, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f9147bd1e1fce020", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Topology.Algebra.InfiniteSum.Order.le_hasProd_of_le_prod", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.InfiniteSum.Order)."}, {"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 le_hasProd_of_le_prod [ClosedIciTopology \u03b1] [L.NeBot]\n (hf : HasProd f a L) (h : \u2200 s, c \u2264 \u220f i \u2208 s, f i) : c \u2264 a\n```\n\nDeclaration: `Mathlib.Topology.Algebra.InfiniteSum.Order.le_hasProd_of_le_prod` (module Mathlib.Topology.Algebra.InfiniteSum.Order)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.InfiniteSum.Order).[/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 le_hasProd_of_le_prod [ClosedIciTopology \u03b1] [L.NeBot]\n (hf : HasProd f a L) (h : \u2200 s, c \u2264 \u220f i \u2208 s, f i) : c \u2264 a\n```\n\nDeclaration: `Mathlib.Topology.Algebra.InfiniteSum.Order.le_hasProd_of_le_prod` (module Mathlib.Topology.Algebra.InfiniteSum.Order).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/InfiniteSum/Order.lean", "module": "Mathlib.Topology.Algebra.InfiniteSum.Order", "declaration": "Mathlib.Topology.Algebra.InfiniteSum.Order.le_hasProd_of_le_prod", "span": "L36-L39", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/InfiniteSum/Order.lean#L36"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 202, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 659, "lean_code_chars": 123, "natural_language_chars": 536, "lean_code_ratio": 0.1866, "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": "fbafc75de984cc63", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Order.Interval.Finset.Fin.attachFin_Iic", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Finset.Fin)."}, {"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 attachFin_Iic : attachFin (Iic a) (fun _x hx \u21a6 (mem_Iic.mp hx).trans_lt a.2) = Iic a\n```\n\nDeclaration: `Mathlib.Order.Interval.Finset.Fin.attachFin_Iic` (module Mathlib.Order.Interval.Finset.Fin)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Finset.Fin).[/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 attachFin_Iic : attachFin (Iic a) (fun _x hx \u21a6 (mem_Iic.mp hx).trans_lt a.2) = Iic a\n```\n\nDeclaration: `Mathlib.Order.Interval.Finset.Fin.attachFin_Iic` (module Mathlib.Order.Interval.Finset.Fin).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Interval/Finset/Fin.lean", "module": "Mathlib.Order.Interval.Finset.Fin", "declaration": "Mathlib.Order.Interval.Finset.Fin.attachFin_Iic", "span": "L88-L90", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Finset/Fin.lean#L88"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 183, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 594, "lean_code_chars": 93, "natural_language_chars": 501, "lean_code_ratio": 0.1566, "line_count": 7, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "16eb61a76b1d58e4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Topology.Algebra.ContinuousAffineEquiv.preimage_image", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.ContinuousAffineEquiv)."}, {"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 preimage_image (e : P\u2081 \u2243\u1d2c[k] P\u2082) (s : Set P\u2081) : e \u207b\u00b9' (e '' s) = s\n```\n\nDeclaration: `Mathlib.Topology.Algebra.ContinuousAffineEquiv.preimage_image` (module Mathlib.Topology.Algebra.ContinuousAffineEquiv)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.ContinuousAffineEquiv).[/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 preimage_image (e : P\u2081 \u2243\u1d2c[k] P\u2082) (s : Set P\u2081) : e \u207b\u00b9' (e '' s) = s\n```\n\nDeclaration: `Mathlib.Topology.Algebra.ContinuousAffineEquiv.preimage_image` (module Mathlib.Topology.Algebra.ContinuousAffineEquiv).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/ContinuousAffineEquiv.lean", "module": "Mathlib.Topology.Algebra.ContinuousAffineEquiv", "declaration": "Mathlib.Topology.Algebra.ContinuousAffineEquiv.preimage_image", "span": "L252-L254", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/ContinuousAffineEquiv.lean#L252"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 192, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 616, "lean_code_chars": 75, "natural_language_chars": 541, "lean_code_ratio": 0.1218, "line_count": 7, "imports_count": 0, "declarations_count": 59, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ed77fe19ae14ce18", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.Normed.Algebra.Spectrum.coe_le_norm_of_mem", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Algebra.Spectrum)."}, {"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 coe_le_norm_of_mem {a : A} {r : \u211d\u22650} (hr : r \u2208 spectrum \u211d\u22650 a) :\n r \u2264 \u2016a\u2016\n```\n\nDeclaration: `Mathlib.Analysis.Normed.Algebra.Spectrum.coe_le_norm_of_mem` (module Mathlib.Analysis.Normed.Algebra.Spectrum)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Algebra.Spectrum).[/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 coe_le_norm_of_mem {a : A} {r : \u211d\u22650} (hr : r \u2208 spectrum \u211d\u22650 a) :\n r \u2264 \u2016a\u2016\n```\n\nDeclaration: `Mathlib.Analysis.Normed.Algebra.Spectrum.coe_le_norm_of_mem` (module Mathlib.Analysis.Normed.Algebra.Spectrum).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Normed/Algebra/Spectrum.lean", "module": "Mathlib.Analysis.Normed.Algebra.Spectrum", "declaration": "Mathlib.Analysis.Normed.Algebra.Spectrum.coe_le_norm_of_mem", "span": "L220-L225", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Algebra/Spectrum.lean#L220"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 191, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 612, "lean_code_chars": 85, "natural_language_chars": 527, "lean_code_ratio": 0.1389, "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": "e86f2a14446f4975", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Lie.Basic.symm_bijective", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Basic)."}, {"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 symm_bijective :\n Function.Bijective (LieModuleEquiv.symm : (M \u2243\u2097\u2045R,L\u2046 N) \u2192 N \u2243\u2097\u2045R,L\u2046 M)\n```\n\nDeclaration: `Mathlib.Algebra.Lie.Basic.symm_bijective` (module Mathlib.Algebra.Lie.Basic)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Basic).[/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 symm_bijective :\n Function.Bijective (LieModuleEquiv.symm : (M \u2243\u2097\u2045R,L\u2046 N) \u2192 N \u2243\u2097\u2045R,L\u2046 M)\n```\n\nDeclaration: `Mathlib.Algebra.Lie.Basic.symm_bijective` (module Mathlib.Algebra.Lie.Basic).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Lie/Basic.lean", "module": "Mathlib.Algebra.Lie.Basic", "declaration": "Mathlib.Algebra.Lie.Basic.symm_bijective", "span": "L1007-L1011", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Basic.lean#L1007"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 187, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 578, "lean_code_chars": 100, "natural_language_chars": 478, "lean_code_ratio": 0.173, "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": "500f0818d4ca744d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Topology.Category.TopCommRingCat.coe_of", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Category.TopCommRingCat)."}, {"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 coe_of (X : Type u) [CommRing X] [TopologicalSpace X] [IsTopologicalRing X] :\n (of X : Type u) = X\n```\n\nDeclaration: `Mathlib.Topology.Category.TopCommRingCat.coe_of` (module Mathlib.Topology.Category.TopCommRingCat)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Category.TopCommRingCat).[/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 coe_of (X : Type u) [CommRing X] [TopologicalSpace X] [IsTopologicalRing X] :\n (of X : Type u) = X\n```\n\nDeclaration: `Mathlib.Topology.Category.TopCommRingCat.coe_of` (module Mathlib.Topology.Category.TopCommRingCat).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Category/TopCommRingCat.lean", "module": "Mathlib.Topology.Category.TopCommRingCat", "declaration": "Mathlib.Topology.Category.TopCommRingCat.coe_of", "span": "L77-L79", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Category/TopCommRingCat.lean#L77"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 177, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 625, "lean_code_chars": 110, "natural_language_chars": 515, "lean_code_ratio": 0.176, "line_count": 8, "imports_count": 0, "declarations_count": 62, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "bd26833dec06825c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Order.ConditionallyCompleteLattice.Indexed.l_ciSup_set", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.ConditionallyCompleteLattice.Indexed)."}, {"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 l_ciSup_set (gc : GaloisConnection l u) {s : Set \u03b3} {f : \u03b3 \u2192 \u03b1} (hf : BddAbove (f '' s))\n (hne : s.Nonempty) : l (\u2a06 i : s, f i) = \u2a06 i : s, l (f i)\n```\n\nDeclaration: `Mathlib.Order.ConditionallyCompleteLattice.Indexed.l_ciSup_set` (module Mathlib.Order.ConditionallyCompleteLattice.Indexed)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.ConditionallyCompleteLattice.Indexed).[/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 l_ciSup_set (gc : GaloisConnection l u) {s : Set \u03b3} {f : \u03b3 \u2192 \u03b1} (hf : BddAbove (f '' s))\n (hne : s.Nonempty) : l (\u2a06 i : s, f i) = \u2a06 i : s, l (f i)\n```\n\nDeclaration: `Mathlib.Order.ConditionallyCompleteLattice.Indexed.l_ciSup_set` (module Mathlib.Order.ConditionallyCompleteLattice.Indexed).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/ConditionallyCompleteLattice/Indexed.lean", "module": "Mathlib.Order.ConditionallyCompleteLattice.Indexed", "declaration": "Mathlib.Order.ConditionallyCompleteLattice.Indexed.l_ciSup_set", "span": "L502-L507", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/ConditionallyCompleteLattice/Indexed.lean#L502"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 222, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 708, "lean_code_chars": 158, "natural_language_chars": 550, "lean_code_ratio": 0.2232, "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": "6a658d312eead0ef", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Order.Interval.Finset.Fin.finsetImage_castLE_Icc", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Finset.Fin)."}, {"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 finsetImage_castLE_Icc (h : n \u2264 m) :\n (Icc a b).image (castLE h) = Icc (castLE h a) (castLE h b)\n```\n\nDeclaration: `Mathlib.Order.Interval.Finset.Fin.finsetImage_castLE_Icc` (module Mathlib.Order.Interval.Finset.Fin)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Interval.Finset.Fin).[/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 finsetImage_castLE_Icc (h : n \u2264 m) :\n (Icc a b).image (castLE h) = Icc (castLE h a) (castLE h b)\n```\n\nDeclaration: `Mathlib.Order.Interval.Finset.Fin.finsetImage_castLE_Icc` (module Mathlib.Order.Interval.Finset.Fin).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Interval/Finset/Fin.lean", "module": "Mathlib.Order.Interval.Finset.Fin", "declaration": "Mathlib.Order.Interval.Finset.Fin.finsetImage_castLE_Icc", "span": "L182-L184", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Finset/Fin.lean#L182"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 190, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 618, "lean_code_chars": 108, "natural_language_chars": 510, "lean_code_ratio": 0.1748, "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": "3c0280e722f6a654", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.GroupTheory.Perm.Support.disjoint_iff_disjoint_support", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.Perm.Support)."}, {"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 disjoint_iff_disjoint_support : Disjoint f g \u2194 _root_.Disjoint f.support g.support\n```\n\nDeclaration: `Mathlib.GroupTheory.Perm.Support.disjoint_iff_disjoint_support` (module Mathlib.GroupTheory.Perm.Support)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.Perm.Support).[/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 disjoint_iff_disjoint_support : Disjoint f g \u2194 _root_.Disjoint f.support g.support\n```\n\nDeclaration: `Mathlib.GroupTheory.Perm.Support.disjoint_iff_disjoint_support` (module Mathlib.GroupTheory.Perm.Support).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/Perm/Support.lean", "module": "Mathlib.GroupTheory.Perm.Support", "declaration": "Mathlib.GroupTheory.Perm.Support.disjoint_iff_disjoint_support", "span": "L396-L399", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Perm/Support.lean#L396"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 165, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 605, "lean_code_chars": 91, "natural_language_chars": 514, "lean_code_ratio": 0.1504, "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": "c8b8139b5c836c14", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.LinearAlgebra.RootSystem.Base.coroot_mem_span_int", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.RootSystem.Base)."}, {"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 coroot_mem_span_int (i : \u03b9) :\n P.coroot i \u2208 span \u2124 (P.coroot '' b.support)\n```\n\nDeclaration: `Mathlib.LinearAlgebra.RootSystem.Base.coroot_mem_span_int` (module Mathlib.LinearAlgebra.RootSystem.Base)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.RootSystem.Base).[/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 coroot_mem_span_int (i : \u03b9) :\n P.coroot i \u2208 span \u2124 (P.coroot '' b.support)\n```\n\nDeclaration: `Mathlib.LinearAlgebra.RootSystem.Base.coroot_mem_span_int` (module Mathlib.LinearAlgebra.RootSystem.Base).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/RootSystem/Base.lean", "module": "Mathlib.LinearAlgebra.RootSystem.Base", "declaration": "Mathlib.LinearAlgebra.RootSystem.Base.coroot_mem_span_int", "span": "L126-L129", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/RootSystem/Base.lean#L126"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 170, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 603, "lean_code_chars": 84, "natural_language_chars": 519, "lean_code_ratio": 0.1393, "line_count": 8, "imports_count": 0, "declarations_count": 54, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "010f934907fdbbdc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.LinearAlgebra.Matrix.Defs.subDownRight", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Matrix.Defs)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nabbrev subDownRight {d u l r : Nat} (A : Matrix (Fin (u + d)) (Fin (l + r)) \u03b1) :\n Matrix (Fin d) (Fin r) \u03b1\n```\n\nDeclaration: `Mathlib.LinearAlgebra.Matrix.Defs.subDownRight` (module Mathlib.LinearAlgebra.Matrix.Defs)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Matrix.Defs).[/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\nabbrev subDownRight {d u l r : Nat} (A : Matrix (Fin (u + d)) (Fin (l + r)) \u03b1) :\n Matrix (Fin d) (Fin r) \u03b1\n```\n\nDeclaration: `Mathlib.LinearAlgebra.Matrix.Defs.subDownRight` (module Mathlib.LinearAlgebra.Matrix.Defs).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Matrix/Defs.lean", "module": "Mathlib.LinearAlgebra.Matrix.Defs", "declaration": "Mathlib.LinearAlgebra.Matrix.Defs.subDownRight", "span": "L500-L504", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/Defs.lean#L500"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 184, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 610, "lean_code_chars": 110, "natural_language_chars": 500, "lean_code_ratio": 0.1803, "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": "1a4e47b2d801d10d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.GroupTheory.FreeGroup.IsFreeGroup.lift", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.FreeGroup.IsFreeGroup)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ndef lift (b : FreeGroupBasis \u03b9 G) : (\u03b9 \u2192 H) \u2243 (G \u2192* H)\n```\n\nDeclaration: `Mathlib.GroupTheory.FreeGroup.IsFreeGroup.lift` (module Mathlib.GroupTheory.FreeGroup.IsFreeGroup)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.FreeGroup.IsFreeGroup).[/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\ndef lift (b : FreeGroupBasis \u03b9 G) : (\u03b9 \u2192 H) \u2243 (G \u2192* H)\n```\n\nDeclaration: `Mathlib.GroupTheory.FreeGroup.IsFreeGroup.lift` (module Mathlib.GroupTheory.FreeGroup.IsFreeGroup).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/FreeGroup/IsFreeGroup.lean", "module": "Mathlib.GroupTheory.FreeGroup.IsFreeGroup", "declaration": "Mathlib.GroupTheory.FreeGroup.IsFreeGroup.lift", "span": "L120-L131", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/FreeGroup/IsFreeGroup.lean#L120"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 168, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 571, "lean_code_chars": 55, "natural_language_chars": 516, "lean_code_ratio": 0.0963, "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": "cb7f7ae17398b714", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.BigOperators.Group.List.Basic.headI_mul_tail_prod_of_ne_nil", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.BigOperators.Group.List.Basic)."}, {"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 headI_mul_tail_prod_of_ne_nil [Inhabited M] (l : List M) (h : l \u2260 []) :\n l.headI * l.tail.prod = l.prod\n```\n\nDeclaration: `Mathlib.Algebra.BigOperators.Group.List.Basic.headI_mul_tail_prod_of_ne_nil` (module Mathlib.Algebra.BigOperators.Group.List.Basic)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.BigOperators.Group.List.Basic).[/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 headI_mul_tail_prod_of_ne_nil [Inhabited M] (l : List M) (h : l \u2260 []) :\n l.headI * l.tail.prod = l.prod\n```\n\nDeclaration: `Mathlib.Algebra.BigOperators.Group.List.Basic.headI_mul_tail_prod_of_ne_nil` (module Mathlib.Algebra.BigOperators.Group.List.Basic).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/BigOperators/Group/List/Basic.lean", "module": "Mathlib.Algebra.BigOperators.Group.List.Basic", "declaration": "Mathlib.Algebra.BigOperators.Group.List.Basic.headI_mul_tail_prod_of_ne_nil", "span": "L130-L132", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/BigOperators/Group/List/Basic.lean#L130"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 202, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 668, "lean_code_chars": 115, "natural_language_chars": 553, "lean_code_ratio": 0.1722, "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": "ce25d4bc7e8dd58c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.GroupTheory.Sylow.not_dvd_card_sylow", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.Sylow)."}, {"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 not_dvd_card_sylow [hp : Fact p.Prime] [Finite (Sylow p G)] : \u00acp \u2223 Nat.card (Sylow p G)\n```\n\nDeclaration: `Mathlib.GroupTheory.Sylow.not_dvd_card_sylow` (module Mathlib.GroupTheory.Sylow)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.Sylow).[/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 not_dvd_card_sylow [hp : Fact p.Prime] [Finite (Sylow p G)] : \u00acp \u2223 Nat.card (Sylow p G)\n```\n\nDeclaration: `Mathlib.GroupTheory.Sylow.not_dvd_card_sylow` (module Mathlib.GroupTheory.Sylow).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/Sylow.lean", "module": "Mathlib.GroupTheory.Sylow", "declaration": "Mathlib.GroupTheory.Sylow.not_dvd_card_sylow", "span": "L332-L351", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Sylow.lean#L332"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 180, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 578, "lean_code_chars": 96, "natural_language_chars": 482, "lean_code_ratio": 0.1661, "line_count": 7, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "024d9fada35c33df", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Ring.Subsemiring.Basic.mem_centralizer_iff", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Ring.Subsemiring.Basic)."}, {"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 mem_centralizer_iff {R} [Semiring R] {s : Set R} {z : R} :\n z \u2208 centralizer s \u2194 \u2200 g \u2208 s, g * z = z * g\n```\n\nDeclaration: `Mathlib.Algebra.Ring.Subsemiring.Basic.mem_centralizer_iff` (module Mathlib.Algebra.Ring.Subsemiring.Basic)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Ring.Subsemiring.Basic).[/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 mem_centralizer_iff {R} [Semiring R] {s : Set R} {z : R} :\n z \u2208 centralizer s \u2194 \u2200 g \u2208 s, g * z = z * g\n```\n\nDeclaration: `Mathlib.Algebra.Ring.Subsemiring.Basic.mem_centralizer_iff` (module Mathlib.Algebra.Ring.Subsemiring.Basic).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Ring/Subsemiring/Basic.lean", "module": "Mathlib.Algebra.Ring.Subsemiring.Basic", "declaration": "Mathlib.Algebra.Ring.Subsemiring.Basic.mem_centralizer_iff", "span": "L328-L331", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Ring/Subsemiring/Basic.lean#L328"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 196, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 636, "lean_code_chars": 114, "natural_language_chars": 522, "lean_code_ratio": 0.1792, "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": "aa2dd448fd453105", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Data.Set.Prod.pi_update_of_notMem", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.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\ntheorem pi_update_of_notMem [DecidableEq \u03b9] (hi : i \u2209 s) (f : \u2200 j, \u03b1 j) (a : \u03b1 i)\n (t : \u2200 j, \u03b1 j \u2192 Set (\u03b2 j)) : (s.pi fun j => t j (update f i a j)) = s.pi fun j => t j (f j)\n```\n\nDeclaration: `Mathlib.Data.Set.Prod.pi_update_of_notMem` (module Mathlib.Data.Set.Prod)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.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\ntheorem pi_update_of_notMem [DecidableEq \u03b9] (hi : i \u2209 s) (f : \u2200 j, \u03b1 j) (a : \u03b1 i)\n (t : \u2200 j, \u03b1 j \u2192 Set (\u03b2 j)) : (s.pi fun j => t j (update f i a j)) = s.pi fun j => t j (f j)\n```\n\nDeclaration: `Mathlib.Data.Set.Prod.pi_update_of_notMem` (module Mathlib.Data.Set.Prod).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Prod.lean", "module": "Mathlib.Data.Set.Prod", "declaration": "Mathlib.Data.Set.Prod.pi_update_of_notMem", "span": "L734-L739", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Prod.lean#L734"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 211, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 649, "lean_code_chars": 178, "natural_language_chars": 471, "lean_code_ratio": 0.2743, "line_count": 8, "imports_count": 0, "declarations_count": 79, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "702b1356d4e729ff", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Data.Set.Basic.lt_iff_ssubset", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Basic)."}, {"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 lt_iff_ssubset : s < t \u2194 s \u2282 t\n```\n\nDeclaration: `Mathlib.Data.Set.Basic.lt_iff_ssubset` (module Mathlib.Data.Set.Basic)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Basic).[/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 lt_iff_ssubset : s < t \u2194 s \u2282 t\n```\n\nDeclaration: `Mathlib.Data.Set.Basic.lt_iff_ssubset` (module Mathlib.Data.Set.Basic).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Basic.lean", "module": "Mathlib.Data.Set.Basic", "declaration": "Mathlib.Data.Set.Basic.lt_iff_ssubset", "span": "L118-L124", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Basic.lean#L118"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 153, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 508, "lean_code_chars": 39, "natural_language_chars": 469, "lean_code_ratio": 0.0768, "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": "7f8aa43c30f992f2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.Calculus.Deriv.Mul.deriv_div_const", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.Deriv.Mul)."}, {"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 deriv_div_const (d : \ud835\udd5c') : deriv (fun x => c x / d) x = deriv c x / d\n```\n\nDeclaration: `Mathlib.Analysis.Calculus.Deriv.Mul.deriv_div_const` (module Mathlib.Analysis.Calculus.Deriv.Mul)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.Deriv.Mul).[/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 deriv_div_const (d : \ud835\udd5c') : deriv (fun x => c x / d) x = deriv c x / d\n```\n\nDeclaration: `Mathlib.Analysis.Calculus.Deriv.Mul.deriv_div_const` (module Mathlib.Analysis.Calculus.Deriv.Mul).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Calculus/Deriv/Mul.lean", "module": "Mathlib.Analysis.Calculus.Deriv.Mul", "declaration": "Mathlib.Analysis.Calculus.Deriv.Mul.deriv_div_const", "span": "L541-L555", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/Deriv/Mul.lean#L541"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 183, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 587, "lean_code_chars": 78, "natural_language_chars": 509, "lean_code_ratio": 0.1329, "line_count": 7, "imports_count": 0, "declarations_count": 60, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "aeb7684ad43796da", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.RingTheory.FractionalIdeal.Basic.mul_eq_mul", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.FractionalIdeal.Basic)."}, {"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 mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J\n```\n\nDeclaration: `Mathlib.RingTheory.FractionalIdeal.Basic.mul_eq_mul` (module Mathlib.RingTheory.FractionalIdeal.Basic)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.FractionalIdeal.Basic).[/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 mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J\n```\n\nDeclaration: `Mathlib.RingTheory.FractionalIdeal.Basic.mul_eq_mul` (module Mathlib.RingTheory.FractionalIdeal.Basic).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/FractionalIdeal/Basic.lean", "module": "Mathlib.RingTheory.FractionalIdeal.Basic", "declaration": "Mathlib.RingTheory.FractionalIdeal.Basic.mul_eq_mul", "span": "L557-L559", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/FractionalIdeal/Basic.lean#L557"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 177, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 584, "lean_code_chars": 65, "natural_language_chars": 519, "lean_code_ratio": 0.1113, "line_count": 7, "imports_count": 0, "declarations_count": 58, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "dcac846a8bec8c08", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Data.List.Chain.IsChain", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.List.Chain)."}, {"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 IsChain.cons {x} : \u2200 {l : List \u03b1}, IsChain R l \u2192 (\u2200 y \u2208 l.head?, R x y) \u2192\n IsChain R (x :: l)\n | [], _, _ => .singleton x\n | _ :: _, hl, H => hl.cons_cons <| H _ rfl\n```\n\nDeclaration: `Mathlib.Data.List.Chain.IsChain` (module Mathlib.Data.List.Chain)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.List.Chain).[/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 IsChain.cons {x} : \u2200 {l : List \u03b1}, IsChain R l \u2192 (\u2200 y \u2208 l.head?, R x y) \u2192\n IsChain R (x :: l)\n | [], _, _ => .singleton x\n | _ :: _, hl, H => hl.cons_cons <| H _ rfl\n```\n\nDeclaration: `Mathlib.Data.List.Chain.IsChain` (module Mathlib.Data.List.Chain).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/List/Chain.lean", "module": "Mathlib.Data.List.Chain", "declaration": "Mathlib.Data.List.Chain.IsChain", "span": "L203-L207", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/Chain.lean#L203"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 204, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 644, "lean_code_chars": 179, "natural_language_chars": 465, "lean_code_ratio": 0.278, "line_count": 10, "imports_count": 0, "declarations_count": 75, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c3fc1b6218be554a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Order.Monoid.Unbundled.WithTop.add_right_inj", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.Unbundled.WithTop)."}, {"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 add_right_inj [IsRightCancelAdd \u03b1] (hz : z \u2260 \u22a4) : x + z = y + z \u2194 x = y\n```\n\nDeclaration: `Mathlib.Algebra.Order.Monoid.Unbundled.WithTop.add_right_inj` (module Mathlib.Algebra.Order.Monoid.Unbundled.WithTop)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.Unbundled.WithTop).[/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 add_right_inj [IsRightCancelAdd \u03b1] (hz : z \u2260 \u22a4) : x + z = y + z \u2194 x = y\n```\n\nDeclaration: `Mathlib.Algebra.Order.Monoid.Unbundled.WithTop.add_right_inj` (module Mathlib.Algebra.Order.Monoid.Unbundled.WithTop).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Monoid/Unbundled/WithTop.lean", "module": "Mathlib.Algebra.Order.Monoid.Unbundled.WithTop", "declaration": "Mathlib.Algebra.Order.Monoid.Unbundled.WithTop.add_right_inj", "span": "L137-L139", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Monoid/Unbundled/WithTop.lean#L137"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 186, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 618, "lean_code_chars": 78, "natural_language_chars": 540, "lean_code_ratio": 0.1262, "line_count": 7, "imports_count": 0, "declarations_count": 57, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "cfafde29adc7efa4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Topology.Category.Compactum.isEquivalence", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Category.Compactum)."}, {"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 isEquivalence : compactumToCompHaus.IsEquivalence where\n\nend compactumToCompHaus\n\n/-- The forgetful functors of `Compactum` and `CompHaus` are compatible via\n`compactumToCompHaus`. -/\n```\n\nDeclaration: `Mathlib.Topology.Category.Compactum.isEquivalence` (module Mathlib.Topology.Category.Compactum)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Category.Compactum).[/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 isEquivalence : compactumToCompHaus.IsEquivalence where\n\nend compactumToCompHaus\n\n/-- The forgetful functors of `Compactum` and `CompHaus` are compatible via\n`compactumToCompHaus`. -/\n```\n\nDeclaration: `Mathlib.Topology.Category.Compactum.isEquivalence` (module Mathlib.Topology.Category.Compactum).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Category/Compactum.lean", "module": "Mathlib.Topology.Category.Compactum", "declaration": "Mathlib.Topology.Category.Compactum.isEquivalence", "span": "L462-L467", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Category/Compactum.lean#L462"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 190, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 700, "lean_code_chars": 193, "natural_language_chars": 507, "lean_code_ratio": 0.2757, "line_count": 12, "imports_count": 0, "declarations_count": 63, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "776d7a30e08e2fe6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Topology.OpenPartialHomeomorph.Constructions.lift_openEmbedding_trans_apply", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.OpenPartialHomeomorph.Constructions)."}, {"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 lift_openEmbedding_trans_apply\n (e e' : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) (z : Z) :\n (e.lift_openEmbedding hf).symm.trans (e'.lift_openEmbedding hf) z = (e.symm.trans e') z\n```\n\nDeclaration: `Mathlib.Topology.OpenPartialHomeomorph.Constructions.lift_openEmbedding_trans_apply` (module Mathlib.Topology.OpenPartialHomeomorph.Constructions)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.OpenPartialHomeomorph.Constructions).[/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 lift_openEmbedding_trans_apply\n (e e' : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) (z : Z) :\n (e.lift_openEmbedding hf).symm.trans (e'.lift_openEmbedding hf) z = (e.symm.trans e') z\n```\n\nDeclaration: `Mathlib.Topology.OpenPartialHomeomorph.Constructions.lift_openEmbedding_trans_apply` (module Mathlib.Topology.OpenPartialHomeomorph.Constructions).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/OpenPartialHomeomorph/Constructions.lean", "module": "Mathlib.Topology.OpenPartialHomeomorph.Constructions", "declaration": "Mathlib.Topology.OpenPartialHomeomorph.Constructions.lift_openEmbedding_trans_apply", "span": "L414-L418", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/OpenPartialHomeomorph/Constructions.lean#L414"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 220, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 778, "lean_code_chars": 203, "natural_language_chars": 575, "lean_code_ratio": 0.2609, "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": "1cf3f57f30649d7b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Order.Group.Synonym.toLex_one", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Group.Synonym)."}, {"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 toLex_one [One \u03b1] : toLex (1 : \u03b1) = 1\n```\n\nDeclaration: `Mathlib.Algebra.Order.Group.Synonym.toLex_one` (module Mathlib.Algebra.Order.Group.Synonym)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Group.Synonym).[/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 toLex_one [One \u03b1] : toLex (1 : \u03b1) = 1\n```\n\nDeclaration: `Mathlib.Algebra.Order.Group.Synonym.toLex_one` (module Mathlib.Algebra.Order.Group.Synonym).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Order/Group/Synonym.lean", "module": "Mathlib.Algebra.Order.Group.Synonym", "declaration": "Mathlib.Algebra.Order.Group.Synonym.toLex_one", "span": "L274-L275", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Group/Synonym.lean#L274"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 158, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 549, "lean_code_chars": 46, "natural_language_chars": 503, "lean_code_ratio": 0.0838, "line_count": 7, "imports_count": 0, "declarations_count": 50, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "cc6f8063e5f07cd8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Polynomial.Derivation.mkDerivationEquiv", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Polynomial.Derivation)."}, {"role": "user", "content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ndef mkDerivationEquiv : A \u2243\u2097[R] Derivation R R[X] A\n```\n\nDeclaration: `Mathlib.Algebra.Polynomial.Derivation.mkDerivationEquiv` (module Mathlib.Algebra.Polynomial.Derivation)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Polynomial.Derivation).[/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\ndef mkDerivationEquiv : A \u2243\u2097[R] Derivation R R[X] A\n```\n\nDeclaration: `Mathlib.Algebra.Polynomial.Derivation.mkDerivationEquiv` (module Mathlib.Algebra.Polynomial.Derivation).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Polynomial/Derivation.lean", "module": "Mathlib.Algebra.Polynomial.Derivation", "declaration": "Mathlib.Algebra.Polynomial.Derivation.mkDerivationEquiv", "span": "L83-L91", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Derivation.lean#L83"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 169, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 569, "lean_code_chars": 52, "natural_language_chars": 517, "lean_code_ratio": 0.0914, "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": "7a066ffdb04bdbdc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Data.QPF.Multivariate.Constructions.Cofix.Cofix", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.QPF.Multivariate.Constructions.Cofix)."}, {"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 Cofix.dest_corec' {\u03b1 : TypeVec.{u} n} {\u03b2 : Type u}\n (g : \u03b2 \u2192 F (\u03b1.append1 (Cofix F \u03b1 \u2295 \u03b2))) (x : \u03b2) :\n Cofix.dest (Cofix.corec' g x) =\n appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x\n```\n\nDeclaration: `Mathlib.Data.QPF.Multivariate.Constructions.Cofix.Cofix` (module Mathlib.Data.QPF.Multivariate.Constructions.Cofix)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.QPF.Multivariate.Constructions.Cofix).[/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 Cofix.dest_corec' {\u03b1 : TypeVec.{u} n} {\u03b2 : Type u}\n (g : \u03b2 \u2192 F (\u03b1.append1 (Cofix F \u03b1 \u2295 \u03b2))) (x : \u03b2) :\n Cofix.dest (Cofix.corec' g x) =\n appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x\n```\n\nDeclaration: `Mathlib.Data.QPF.Multivariate.Constructions.Cofix.Cofix` (module Mathlib.Data.QPF.Multivariate.Constructions.Cofix).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/QPF/Multivariate/Constructions/Cofix.lean", "module": "Mathlib.Data.QPF.Multivariate.Constructions.Cofix", "declaration": "Mathlib.Data.QPF.Multivariate.Constructions.Cofix.Cofix", "span": "L494-L511", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/QPF/Multivariate/Constructions/Cofix.lean#L494"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 245, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 756, "lean_code_chars": 215, "natural_language_chars": 541, "lean_code_ratio": 0.2844, "line_count": 10, "imports_count": 0, "declarations_count": 71, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5613b5d1b27b8f9a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.NumberTheory.ModularForms.NormTrace.ModularForm", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.ModularForms.NormTrace)."}, {"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 ModularForm.eq_const_of_weight_zero [\ud835\udca2.IsArithmetic] (f : ModularForm \ud835\udca2 0) :\n \u2203 c, (f : \u210d \u2192 \u2102) = Function.const \u210d c\n```\n\nDeclaration: `Mathlib.NumberTheory.ModularForms.NormTrace.ModularForm` (module Mathlib.NumberTheory.ModularForms.NormTrace)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.ModularForms.NormTrace).[/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 ModularForm.eq_const_of_weight_zero [\ud835\udca2.IsArithmetic] (f : ModularForm \ud835\udca2 0) :\n \u2203 c, (f : \u210d \u2192 \u2102) = Function.const \u210d c\n```\n\nDeclaration: `Mathlib.NumberTheory.ModularForms.NormTrace.ModularForm` (module Mathlib.NumberTheory.ModularForms.NormTrace).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/ModularForms/NormTrace.lean", "module": "Mathlib.NumberTheory.ModularForms.NormTrace", "declaration": "Mathlib.NumberTheory.ModularForms.NormTrace.ModularForm", "span": "L167-L176", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ModularForms/NormTrace.lean#L167"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 197, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 654, "lean_code_chars": 125, "natural_language_chars": 529, "lean_code_ratio": 0.1911, "line_count": 8, "imports_count": 0, "declarations_count": 55, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b5a731e71cc5f1c6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.LocallyConvex.Separation)."}, {"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 geometric_hahn_banach_open_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht\u2081 : Convex \u211d t)\n (ht\u2083 : IsOpen t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u < f b\n```\n\nDeclaration: `Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open` (module Mathlib.Analysis.LocallyConvex.Separation)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.LocallyConvex.Separation).[/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 geometric_hahn_banach_open_open (hs\u2081 : Convex \u211d s) (hs\u2082 : IsOpen s) (ht\u2081 : Convex \u211d t)\n (ht\u2083 : IsOpen t) (disj : Disjoint s t) :\n \u2203 (f : StrongDual \u211d E) (u : \u211d), (\u2200 a \u2208 s, f a < u) \u2227 \u2200 b \u2208 t, u < f b\n```\n\nDeclaration: `Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open` (module Mathlib.Analysis.LocallyConvex.Separation).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/LocallyConvex/Separation.lean", "module": "Mathlib.Analysis.LocallyConvex.Separation", "declaration": "Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open", "span": "L135-L153", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/LocallyConvex/Separation.lean#L135"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 262, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 757, "lean_code_chars": 214, "natural_language_chars": 543, "lean_code_ratio": 0.2827, "line_count": 9, "imports_count": 0, "declarations_count": 78, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9ae0f587971a7712", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Algebra.Lie.Ideal.mem_ker", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Ideal)."}, {"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 mem_ker {x : L} : x \u2208 ker f \u2194 f x = 0\n```\n\nDeclaration: `Mathlib.Algebra.Lie.Ideal.mem_ker` (module Mathlib.Algebra.Lie.Ideal)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Ideal).[/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 mem_ker {x : L} : x \u2208 ker f \u2194 f x = 0\n```\n\nDeclaration: `Mathlib.Algebra.Lie.Ideal.mem_ker` (module Mathlib.Algebra.Lie.Ideal).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Lie/Ideal.lean", "module": "Mathlib.Algebra.Lie.Ideal", "declaration": "Mathlib.Algebra.Lie.Ideal.mem_ker", "span": "L299-L302", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Ideal.lean#L299"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 157, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 517, "lean_code_chars": 46, "natural_language_chars": 471, "lean_code_ratio": 0.089, "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": "d5e4ff99ada42078", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Topology.Algebra.Order.Field.comap_mulLeft_nhdsGT_zero", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Order.Field)."}, {"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 comap_mulLeft_nhdsGT_zero {x : \ud835\udd5c} (hx : 0 < x) : comap (x * \u00b7) (\ud835\udcdd[>] 0) = \ud835\udcdd[>] 0\n```\n\nDeclaration: `Mathlib.Topology.Algebra.Order.Field.comap_mulLeft_nhdsGT_zero` (module Mathlib.Topology.Algebra.Order.Field)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Order.Field).[/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 comap_mulLeft_nhdsGT_zero {x : \ud835\udd5c} (hx : 0 < x) : comap (x * \u00b7) (\ud835\udcdd[>] 0) = \ud835\udcdd[>] 0\n```\n\nDeclaration: `Mathlib.Topology.Algebra.Order.Field.comap_mulLeft_nhdsGT_zero` (module Mathlib.Topology.Algebra.Order.Field).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Algebra/Order/Field.lean", "module": "Mathlib.Topology.Algebra.Order.Field", "declaration": "Mathlib.Topology.Algebra.Order.Field.comap_mulLeft_nhdsGT_zero", "span": "L308-L313", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Order/Field.lean#L308"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 200, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 611, "lean_code_chars": 89, "natural_language_chars": 522, "lean_code_ratio": 0.1457, "line_count": 7, "imports_count": 0, "declarations_count": 53, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "356c2ea8581c0aa2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Data.PFun.fixInduction'_fwd", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.PFun)."}, {"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 fixInduction'_fwd {C : \u03b1 \u2192 Sort*} {f : \u03b1 \u2192. \u03b2 \u2295 \u03b1} {b : \u03b2} {a a' : \u03b1} (h : b \u2208 f.fix a)\n (h' : b \u2208 f.fix a') (fa : Sum.inr a' \u2208 f a)\n (hbase : \u2200 a_final : \u03b1, Sum.inl b \u2208 f a_final \u2192 C a_final)\n (hind : \u2200 a\u2080 a\u2081 : \u03b1, b \u2208 f.fix a\u2081 \u2192 Sum.inr a\u2081 \u2208 f a\u2080 \u2192 C a\u2081 \u2192 C a\u2080) :\n @fixInduction' _ _ C _ _ _ h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind)\n```\n\nDeclaration: `Mathlib.Data.PFun.fixInduction'_fwd` (module Mathlib.Data.PFun)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.PFun).[/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 fixInduction'_fwd {C : \u03b1 \u2192 Sort*} {f : \u03b1 \u2192. \u03b2 \u2295 \u03b1} {b : \u03b2} {a a' : \u03b1} (h : b \u2208 f.fix a)\n (h' : b \u2208 f.fix a') (fa : Sum.inr a' \u2208 f a)\n (hbase : \u2200 a_final : \u03b1, Sum.inl b \u2208 f a_final \u2192 C a_final)\n (hind : \u2200 a\u2080 a\u2081 : \u03b1, b \u2208 f.fix a\u2081 \u2192 Sum.inr a\u2081 \u2208 f a\u2080 \u2192 C a\u2081 \u2192 C a\u2080) :\n @fixInduction' _ _ C _ _ _ h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind)\n```\n\nDeclaration: `Mathlib.Data.PFun.fixInduction'_fwd` (module Mathlib.Data.PFun).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/PFun.lean", "module": "Mathlib.Data.PFun", "declaration": "Mathlib.Data.PFun.fixInduction'_fwd", "span": "L324-L340", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/PFun.lean#L324"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 309, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 831, "lean_code_chars": 374, "natural_language_chars": 457, "lean_code_ratio": 0.4501, "line_count": 11, "imports_count": 0, "declarations_count": 108, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c081c37bbf08677d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.Calculus.ContDiff.Operations.ContDiffWithinAt", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.ContDiff.Operations)."}, {"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 ContDiffWithinAt.div {f g : E \u2192 \ud835\udd5c} {n} (hf : ContDiffWithinAt \ud835\udd5c n f s x)\n (hg : ContDiffWithinAt \ud835\udd5c n g s x) (hx : g x \u2260 0) :\n ContDiffWithinAt \ud835\udd5c n (fun x => f x / g x) s x\n```\n\nDeclaration: `Mathlib.Analysis.Calculus.ContDiff.Operations.ContDiffWithinAt` (module Mathlib.Analysis.Calculus.ContDiff.Operations)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.ContDiff.Operations).[/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 ContDiffWithinAt.div {f g : E \u2192 \ud835\udd5c} {n} (hf : ContDiffWithinAt \ud835\udd5c n f s x)\n (hg : ContDiffWithinAt \ud835\udd5c n g s x) (hx : g x \u2260 0) :\n ContDiffWithinAt \ud835\udd5c n (fun x => f x / g x) s x\n```\n\nDeclaration: `Mathlib.Analysis.Calculus.ContDiff.Operations.ContDiffWithinAt` (module Mathlib.Analysis.Calculus.ContDiff.Operations).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Calculus/ContDiff/Operations.lean", "module": "Mathlib.Analysis.Calculus.ContDiff.Operations", "declaration": "Mathlib.Analysis.Calculus.ContDiff.Operations.ContDiffWithinAt", "span": "L818-L822", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/ContDiff/Operations.lean#L818"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 242, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 726, "lean_code_chars": 186, "natural_language_chars": 540, "lean_code_ratio": 0.2562, "line_count": 9, "imports_count": 0, "declarations_count": 77, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b3b3524d94fddae3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.hasSumLocallyUniformly_aux", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass)."}, {"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 hasSumLocallyUniformly_aux (f : L.lattice \u2192 \u2102 \u2192 \u2102)\n (u : \u211d \u2192 L.lattice \u2192 \u211d) (hu : \u2200 r > 0, Summable (u r))\n (hf : \u2200 r > 0, \u2200\u1da0 R in atTop, \u2200 x, \u2016x\u2016 < r \u2192 \u2200 l : L.lattice, \u2016l.1\u2016 = R \u2192 \u2016f l x\u2016 \u2264 u r l) :\n HasSumLocallyUniformly f (\u2211' j, f j \u00b7)\n```\n\nDeclaration: `Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.hasSumLocallyUniformly_aux` (module Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass).[/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 hasSumLocallyUniformly_aux (f : L.lattice \u2192 \u2102 \u2192 \u2102)\n (u : \u211d \u2192 L.lattice \u2192 \u211d) (hu : \u2200 r > 0, Summable (u r))\n (hf : \u2200 r > 0, \u2200\u1da0 R in atTop, \u2200 x, \u2016x\u2016 < r \u2192 \u2200 l : L.lattice, \u2016l.1\u2016 = R \u2192 \u2016f l x\u2016 \u2264 u r l) :\n HasSumLocallyUniformly f (\u2211' j, f j \u00b7)\n```\n\nDeclaration: `Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.hasSumLocallyUniformly_aux` (module Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Elliptic/Weierstrass.lean", "module": "Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass", "declaration": "Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass.hasSumLocallyUniformly_aux", "span": "L163-L182", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Elliptic/Weierstrass.lean#L163"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 302, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 833, "lean_code_chars": 256, "natural_language_chars": 577, "lean_code_ratio": 0.3073, "line_count": 10, "imports_count": 0, "declarations_count": 80, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2ee322563973d89d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "F-Mathlib.NumberTheory.Cyclotomic.Basic.IntermediateField", "category": "F", "messages": [{"role": "system", "content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.Cyclotomic.Basic)."}, {"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 IntermediateField.isCyclotomicExtension_lcm_sup [NeZero n\u2081] [NeZero n\u2082] :\n IsCyclotomicExtension {n\u2081.lcm n\u2082} K (F\u2081 \u2294 F\u2082 : IntermediateField K L)\n```\n\nDeclaration: `Mathlib.NumberTheory.Cyclotomic.Basic.IntermediateField` (module Mathlib.NumberTheory.Cyclotomic.Basic)."}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.Cyclotomic.Basic).[/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 IntermediateField.isCyclotomicExtension_lcm_sup [NeZero n\u2081] [NeZero n\u2082] :\n IsCyclotomicExtension {n\u2081.lcm n\u2082} K (F\u2081 \u2294 F\u2082 : IntermediateField K L)\n```\n\nDeclaration: `Mathlib.NumberTheory.Cyclotomic.Basic.IntermediateField` (module Mathlib.NumberTheory.Cyclotomic.Basic).[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/Cyclotomic/Basic.lean", "module": "Mathlib.NumberTheory.Cyclotomic.Basic", "declaration": "Mathlib.NumberTheory.Cyclotomic.Basic.IntermediateField", "span": "L989-L995", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Cyclotomic/Basic.lean#L989"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 203, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 673, "lean_code_chars": 156, "natural_language_chars": 517, "lean_code_ratio": 0.2318, "line_count": 8, "imports_count": 0, "declarations_count": 62, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ccc3685fd595bfcd", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.SkewMonoidAlgebra.Basic.mapDomainRingHom", "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.Algebra.SkewMonoidAlgebra.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef mapDomainRingHom [MulSemiringAction \u03b1 \u03b2] [MulSemiringAction \u03b1\u2082 \u03b2]\n [MonoidHomClass F \u03b1 \u03b1\u2082] {f : F} (hf : \u2200 (a : \u03b1) (x : \u03b2), a \u2022 x = (f a) \u2022 x) :\n SkewMonoidAlgebra \u03b2 \u03b1 \u2192+* SkewMonoidAlgebra \u03b2 \u03b1\u2082 where\n __\n:= (mapDomain f : SkewMonoidAlgebra \u03b2 \u03b1 \u2192+ SkewMonoidAlgebra \u03b2 \u03b1\u2082) .someMissingNamespaceXYZ\nmap_one' := mapDomain_one f\n map_mul' x y := mapDomain_mul x y hf\n\nend MapDomain\n\nsection of\n\nvariable (k G)\n\nvariable [Monoid G] [MulSemiringAction G k]\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The embedding of a monoid into its skew monoid algebra. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=342, messages=[Message(data='failed to synthesize instance of type class\\n Monoid \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=43), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=342, i_end=425, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=6, column=0), pos_end=Position(line=6, column=8), 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=9, column=0), pos_end=Position(line=9, column=13), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=425, i_end=437, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=437, i_end=453, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=453, i_end=498, messages=[Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=15, column=21), pos_end=Position(line=15, column=42), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=498, i_end=642, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=18, column=62), 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.Algebra.SkewMonoidAlgebra.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef mapDomainRingHom [MulSemiringAction \u03b1 \u03b2] [MulSemiringAction \u03b1\u2082 \u03b2]\n [MonoidHomClass F \u03b1 \u03b1\u2082] {f : F} (hf : \u2200 (a : \u03b1) (x : \u03b2), a \u2022 x = (f a) \u2022 x) :\n SkewMonoidAlgebra \u03b2 \u03b1 \u2192+* SkewMonoidAlgebra \u03b2 \u03b1\u2082 where\n __\n:= (mapDomain f : SkewMonoidAlgebra \u03b2 \u03b1 \u2192+ SkewMonoidAlgebra \u03b2 \u03b1\u2082) .someMissingNamespaceXYZ\nmap_one' := mapDomain_one f\n map_mul' x y := mapDomain_mul x y hf\n\nend MapDomain\n\nsection of\n\nvariable (k G)\n\nvariable [Monoid G] [MulSemiringAction G k]\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The embedding of a monoid into its skew monoid algebra. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=342, messages=[Message(data='failed to synthesize instance of type class\\n Monoid \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=43), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=342, i_end=425, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=6, column=0), pos_end=Position(line=6, column=8), 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=9, column=0), pos_end=Position(line=9, column=13), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=425, i_end=437, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=437, i_end=453, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=453, i_end=498, messages=[Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=15, column=21), pos_end=Position(line=15, column=42), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=498, i_end=642, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=18, column=62), 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/Algebra/SkewMonoidAlgebra/Basic.lean", "module": "Mathlib.Algebra.SkewMonoidAlgebra.Basic", "declaration": "Mathlib.Algebra.SkewMonoidAlgebra.Basic.mapDomainRingHom", "span": "L1087-L1103", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean#L1087"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 909, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3138, "lean_code_chars": 609, "natural_language_chars": 2529, "lean_code_ratio": 0.1941, "line_count": 29, "imports_count": 0, "declarations_count": 340, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "575adff4ae657a5e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Sum.Order.sumLexCongr", "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.Data.Sum.Order)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef sumLexCongr (ea : \u03b1\u2081 \u2243o \u03b1\u2082) (eb : \u03b2\u2081 \u2243o \u03b2\u2082) : \u03b1\u2081 \u2295\u2097 \u03b2\u2081 \u2243o \u03b1\u2082 \u2295\u2097 \u03b2\u2082 where\n toEquiv\n frobnicateTacticThatDoesNotExist := ofLex.trans ((Equiv.sumCongr ea eb).trans toLex)\nmap_rel_iff' := by simp_rw [Lex.forall]; rintro (a | a) (b | b) <;> simp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=212, messages=[Message(data='failed to synthesize instance of type class\\n LE \u03b1\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=30), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LE \u03b2\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=38), pos_end=Position(line=1, column=46), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LE (Lex (\u03b1\u2081 \u2295 \u03b2\u2081))\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=50), pos_end=Position(line=1, column=70), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=212, i_end=284, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=12), 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.Data.Sum.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef sumLexCongr (ea : \u03b1\u2081 \u2243o \u03b1\u2082) (eb : \u03b2\u2081 \u2243o \u03b2\u2082) : \u03b1\u2081 \u2295\u2097 \u03b2\u2081 \u2243o \u03b1\u2082 \u2295\u2097 \u03b2\u2082 where\n toEquiv\n frobnicateTacticThatDoesNotExist := ofLex.trans ((Equiv.sumCongr ea eb).trans toLex)\nmap_rel_iff' := by simp_rw [Lex.forall]; rintro (a | a) (b | b) <;> simp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=212, messages=[Message(data='failed to synthesize instance of type class\\n LE \u03b1\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=30), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LE \u03b2\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=38), pos_end=Position(line=1, column=46), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LE (Lex (\u03b1\u2081 \u2295 \u03b2\u2081))\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=50), pos_end=Position(line=1, column=70), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=212, i_end=284, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=12), 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/Data/Sum/Order.lean", "module": "Mathlib.Data.Sum.Order", "declaration": "Mathlib.Data.Sum.Order.sumLexCongr", "span": "L611-L614", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Sum/Order.lean#L611"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 639, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2183, "lean_code_chars": 247, "natural_language_chars": 1936, "lean_code_ratio": 0.1131, "line_count": 15, "imports_count": 0, "declarations_count": 240, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "bdf7252d9f9e5151", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.SuccPred.Basic.Ioo_pred_left_of_not_isMin", "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.Order.SuccPred.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Ioo_pred_left_of_not_isMin (ha : \u00acIsMin a) : Ioo (pred a) b = Ico a b\n:= by .someMissingNamespaceXYZ\nrw [\u2190 Ioi_inter_Iio, Ioi_pred_of_not_isMin ha, Ici_inter_Iio]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=87, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n Ioo\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (pred a)\\n\\nHint: The identifier `Ioo` 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=67), severity=, kind=None), Message(data=\"Function expected at\\n Ico\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `Ico` 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=70), pos_end=Position(line=1, column=77), severity=, kind=None), Message(data='unsolved goals\\n\u03b1\u271d : Type u_1\\na : \u03b1\u271d\\nx\u271d\u00b9 : Sort u_2\\nIoo : x\u271d\u00b9\\nx\u271d : Sort u_3\\nIco : x\u271d\\nha : \u00acIsMin a\\n\u22a2 sorry = sorry', pos=Position(line=2, column=6), pos_end=Position(line=2, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=87, i_end=173, 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.Order.SuccPred.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Ioo_pred_left_of_not_isMin (ha : \u00acIsMin a) : Ioo (pred a) b = Ico a b\n:= by .someMissingNamespaceXYZ\nrw [\u2190 Ioi_inter_Iio, Ioi_pred_of_not_isMin ha, Ici_inter_Iio]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=87, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n Ioo\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (pred a)\\n\\nHint: The identifier `Ioo` 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=67), severity=, kind=None), Message(data=\"Function expected at\\n Ico\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `Ico` 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=70), pos_end=Position(line=1, column=77), severity=, kind=None), Message(data='unsolved goals\\n\u03b1\u271d : Type u_1\\na : \u03b1\u271d\\nx\u271d\u00b9 : Sort u_2\\nIoo : x\u271d\u00b9\\nx\u271d : Sort u_3\\nIco : x\u271d\\nha : \u00acIsMin a\\n\u22a2 sorry = sorry', pos=Position(line=2, column=6), pos_end=Position(line=2, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=87, i_end=173, 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/Order/SuccPred/Basic.lean", "module": "Mathlib.Order.SuccPred.Basic", "declaration": "Mathlib.Order.SuccPred.Basic.Ioo_pred_left_of_not_isMin", "span": "L642-L644", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/SuccPred/Basic.lean#L642"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 731, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2526, "lean_code_chars": 171, "natural_language_chars": 2355, "lean_code_ratio": 0.0677, "line_count": 14, "imports_count": 0, "declarations_count": 348, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "203f03577d361298", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Algebra.Valued.LocallyCompact.norm_coe_unit", "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.Topology.Algebra.Valued.LocallyCompact)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma norm_coe_unit (u : \ud835\udcaa[K]\u02e3) : \u2016((u : \ud835\udcaa[K]) : K)\u2016 = 1\n:= by thisIsWrongLemmaNameXYZ\nsimpa [\u2190 NNReal.coe_inj] using\n (Valuation.integer.integers (NormedField.valuation (K := K))).valuation_unit u\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=75, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Norm K\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=34), pos_end=Position(line=1, column=52), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Monoid \ud835\udcaa[K]\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=30), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=75, i_end=271, 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.Topology.Algebra.Valued.LocallyCompact).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma norm_coe_unit (u : \ud835\udcaa[K]\u02e3) : \u2016((u : \ud835\udcaa[K]) : K)\u2016 = 1\n:= by thisIsWrongLemmaNameXYZ\nsimpa [\u2190 NNReal.coe_inj] using\n (Valuation.integer.integers (NormedField.valuation (K := K))).valuation_unit u\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=75, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Norm K\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=34), pos_end=Position(line=1, column=52), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Monoid \ud835\udcaa[K]\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=30), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=75, i_end=271, 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/Topology/Algebra/Valued/LocallyCompact.lean", "module": "Mathlib.Topology.Algebra.Valued.LocallyCompact", "declaration": "Mathlib.Topology.Algebra.Valued.LocallyCompact.norm_coe_unit", "span": "L53-L57", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Valued/LocallyCompact.lean#L53"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 550, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1950, "lean_code_chars": 259, "natural_language_chars": 1691, "lean_code_ratio": 0.1328, "line_count": 17, "imports_count": 0, "declarations_count": 210, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "5f52b21c432481a0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.CStarAlgebra.GelfandNaimarkSegal.ofPreGNS_toPreGNS", "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.Analysis.CStarAlgebra.GelfandNaimarkSegal)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma ofPreGNS_toPreGNS (a : A) : f.ofPreGNS (f.toPreGNS a) = a\n:= rfl .someMissingNamespaceXYZ\nvariable [StarOrderedRing A]\n\n/--\nThe (semi-)inner product space whose elements are the elements of `A`, but which has an\ninner product-induced norm that is different from the norm on `A` and which is induced by `f`.\n-/\nnoncomputable abbrev preGNSpreInnerProdSpace : PreInnerProductSpace.Core \u2102 f.PreGNS where\n inner a b := f (star (f.ofPreGNS a) * f.ofPreGNS b)\n conj_inner_symm := by simp [\u2190 Complex.star_def, \u2190 map_star f]\n re_inner_nonneg _ := RCLike.nonneg_iff.mp (f.map_nonneg (star_mul_self_nonneg _)) |>.1\n add_left _ _ _ := by rw [map_add, star_add, add_mul, map_add]\n smul_left := by simp [smul_mul_assoc]\n\nnoncomputable instance : SeminormedAddCommGroup f.PreGNS :=\n InnerProductSpace.Core.toSeminormedAddCommGroup (c := f.preGNSpreInnerProdSpace)\nnoncomputable instance : InnerProductSpace \u2102 f.PreGNS :=\n InnerProductSpace.ofCore f.preGNSpreInnerProdSpace\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=96, messages=[Message(data='Unknown identifier `f.ofPreGNS`', pos=Position(line=1, column=34), pos_end=Position(line=1, column=44), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Function expected at\\n rfl\\nbut this term has type\\n ?m.5 = ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n .someMissingNamespaceXYZ', pos=Position(line=2, column=3), pos_end=Position(line=2, column=31), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=96, i_end=126, messages=[Message(data='failed to synthesize instance of type class\\n NonUnitalSemiring A\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=10), pos_end=Position(line=3, column=27), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=126, i_end=724, messages=[Message(data='Unknown identifier `f.PreGNS`', pos=Position(line=9, column=75), pos_end=Position(line=9, column=83), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=724, i_end=867, messages=[Message(data='Unknown identifier `f.PreGNS`', pos=Position(line=16, column=48), pos_end=Position(line=16, column=56), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `f.preGNSpreInnerProdSpace`', pos=Position(line=17, column=56), pos_end=Position(line=17, column=81), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=867, i_end=978, messages=[Message(data='Unknown identifier `f.PreGNS`', pos=Position(line=18, column=45), pos_end=Position(line=18, column=53), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `f.preGNSpreInnerProdSpace`', pos=Position(line=19, column=27), pos_end=Position(line=19, column=52), 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.Analysis.CStarAlgebra.GelfandNaimarkSegal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma ofPreGNS_toPreGNS (a : A) : f.ofPreGNS (f.toPreGNS a) = a\n:= rfl .someMissingNamespaceXYZ\nvariable [StarOrderedRing A]\n\n/--\nThe (semi-)inner product space whose elements are the elements of `A`, but which has an\ninner product-induced norm that is different from the norm on `A` and which is induced by `f`.\n-/\nnoncomputable abbrev preGNSpreInnerProdSpace : PreInnerProductSpace.Core \u2102 f.PreGNS where\n inner a b := f (star (f.ofPreGNS a) * f.ofPreGNS b)\n conj_inner_symm := by simp [\u2190 Complex.star_def, \u2190 map_star f]\n re_inner_nonneg _ := RCLike.nonneg_iff.mp (f.map_nonneg (star_mul_self_nonneg _)) |>.1\n add_left _ _ _ := by rw [map_add, star_add, add_mul, map_add]\n smul_left := by simp [smul_mul_assoc]\n\nnoncomputable instance : SeminormedAddCommGroup f.PreGNS :=\n InnerProductSpace.Core.toSeminormedAddCommGroup (c := f.preGNSpreInnerProdSpace)\nnoncomputable instance : InnerProductSpace \u2102 f.PreGNS :=\n InnerProductSpace.ofCore f.preGNSpreInnerProdSpace\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=96, messages=[Message(data='Unknown identifier `f.ofPreGNS`', pos=Position(line=1, column=34), pos_end=Position(line=1, column=44), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Function expected at\\n rfl\\nbut this term has type\\n ?m.5 = ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n .someMissingNamespaceXYZ', pos=Position(line=2, column=3), pos_end=Position(line=2, column=31), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=96, i_end=126, messages=[Message(data='failed to synthesize instance of type class\\n NonUnitalSemiring A\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=10), pos_end=Position(line=3, column=27), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=126, i_end=724, messages=[Message(data='Unknown identifier `f.PreGNS`', pos=Position(line=9, column=75), pos_end=Position(line=9, column=83), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=724, i_end=867, messages=[Message(data='Unknown identifier `f.PreGNS`', pos=Position(line=16, column=48), pos_end=Position(line=16, column=56), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `f.preGNSpreInnerProdSpace`', pos=Position(line=17, column=56), pos_end=Position(line=17, column=81), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=867, i_end=978, messages=[Message(data='Unknown identifier `f.PreGNS`', pos=Position(line=18, column=45), pos_end=Position(line=18, column=53), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `f.preGNSpreInnerProdSpace`', pos=Position(line=19, column=27), pos_end=Position(line=19, column=52), 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/Analysis/CStarAlgebra/GelfandNaimarkSegal.lean", "module": "Mathlib.Analysis.CStarAlgebra.GelfandNaimarkSegal", "declaration": "Mathlib.Analysis.CStarAlgebra.GelfandNaimarkSegal.ofPreGNS_toPreGNS", "span": "L68-L87", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/CStarAlgebra/GelfandNaimarkSegal.lean#L68"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1172, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3967, "lean_code_chars": 971, "natural_language_chars": 2996, "lean_code_ratio": 0.2448, "line_count": 30, "imports_count": 0, "declarations_count": 400, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "d47844ee2c290ca8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.SimpleGraph.StronglyRegular.IsSRGWith", "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.Combinatorics.SimpleGraph.StronglyRegular)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsSRGWith.compl_is_regular (h : G.IsSRGWith n k \u2113 \u03bc) :\n G\u1d9c.IsRegularOfDegree (n - k - 1)\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 h.card, Nat.sub_sub, add_comm, \u2190 Nat.sub_sub]\n exact h.regular.compl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=112, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Invalid field notation: Type of\\n G\\nis not known; cannot resolve field `IsSRGWith`\\n\\nHint: Consider replacing the field projection `.IsSRGWith` with a call to the function `SimpleGraph.IsSRGWith`.', pos=Position(line=1, column=40), pos_end=Position(line=1, column=59), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n G\u1d9c\\nis not known; cannot resolve field `IsRegularOfDegree`\\n\\nHint: Consider replacing the field projection `.IsRegularOfDegree` with a call to the function `SimpleGraph.IsRegularOfDegree`.', pos=Position(line=2, column=4), pos_end=Position(line=2, column=36), severity=, kind='lean.invalidField._namedError'), Message(data='unsolved goals\\nx\u271d : Type u_1\\nG : x\u271d\\nh : sorry\\n\u22a2 sorry', 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=112, i_end=214, 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.Combinatorics.SimpleGraph.StronglyRegular).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsSRGWith.compl_is_regular (h : G.IsSRGWith n k \u2113 \u03bc) :\n G\u1d9c.IsRegularOfDegree (n - k - 1)\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 h.card, Nat.sub_sub, add_comm, \u2190 Nat.sub_sub]\n exact h.regular.compl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=112, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Invalid field notation: Type of\\n G\\nis not known; cannot resolve field `IsSRGWith`\\n\\nHint: Consider replacing the field projection `.IsSRGWith` with a call to the function `SimpleGraph.IsSRGWith`.', pos=Position(line=1, column=40), pos_end=Position(line=1, column=59), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n G\u1d9c\\nis not known; cannot resolve field `IsRegularOfDegree`\\n\\nHint: Consider replacing the field projection `.IsRegularOfDegree` with a call to the function `SimpleGraph.IsRegularOfDegree`.', pos=Position(line=2, column=4), pos_end=Position(line=2, column=36), severity=, kind='lean.invalidField._namedError'), Message(data='unsolved goals\\nx\u271d : Type u_1\\nG : x\u271d\\nh : sorry\\n\u22a2 sorry', 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=112, i_end=214, 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/Combinatorics/SimpleGraph/StronglyRegular.lean", "module": "Mathlib.Combinatorics.SimpleGraph.StronglyRegular", "declaration": "Mathlib.Combinatorics.SimpleGraph.StronglyRegular.IsSRGWith", "span": "L119-L123", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/StronglyRegular.lean#L119"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 595, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2021, "lean_code_chars": 206, "natural_language_chars": 1815, "lean_code_ratio": 0.1019, "line_count": 16, "imports_count": 0, "declarations_count": 222, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "39e18791e25dc1dd", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.Perm.Cycle.Factors.isCycle_cycleOf", "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.GroupTheory.Perm.Cycle.Factors)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isCycle_cycleOf (f : Perm \u03b1) [DecidableRel f.SameCycle] (hx : f x \u2260 x) :\n IsCycle (cycleOf f x)\n:= thisIsWrongLemmaNameXYZ\nhave : cycleOf f x x \u2260 x := by rwa [SameCycle.rfl.cycleOf_apply]\n (isCycle_iff_sameCycle this).2 @fun y =>\n \u27e8fun h => mt h.apply_eq_self_iff.2 this, fun h =>\n if hxy : SameCycle f x y then\n let \u27e8i, hi\u27e9 := hxy\n \u27e8i, by rw [cycleOf_zpow_apply_self, hi]\u27e9\n else by\n rw [cycleOf_apply_of_not_sameCycle hxy] at h\n exact (h rfl).elim\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=137, messages=[Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=29), pos_end=Position(line=1, column=35), severity=, kind=None), Message(data=\"Function expected at\\n IsCycle\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (cycleOf f x)\\n\\nHint: The identifier `IsCycle` 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=25), 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), CompilationUnit(i_begin=137, i_end=519, messages=[Message(data=\"unexpected token 'have'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=4), 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.GroupTheory.Perm.Cycle.Factors).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isCycle_cycleOf (f : Perm \u03b1) [DecidableRel f.SameCycle] (hx : f x \u2260 x) :\n IsCycle (cycleOf f x)\n:= thisIsWrongLemmaNameXYZ\nhave : cycleOf f x x \u2260 x := by rwa [SameCycle.rfl.cycleOf_apply]\n (isCycle_iff_sameCycle this).2 @fun y =>\n \u27e8fun h => mt h.apply_eq_self_iff.2 this, fun h =>\n if hxy : SameCycle f x y then\n let \u27e8i, hi\u27e9 := hxy\n \u27e8i, by rw [cycleOf_zpow_apply_self, hi]\u27e9\n else by\n rw [cycleOf_apply_of_not_sameCycle hxy] at h\n exact (h rfl).elim\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=137, messages=[Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=29), pos_end=Position(line=1, column=35), severity=, kind=None), Message(data=\"Function expected at\\n IsCycle\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (cycleOf f x)\\n\\nHint: The identifier `IsCycle` 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=25), 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), CompilationUnit(i_begin=137, i_end=519, messages=[Message(data=\"unexpected token 'have'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=4), 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/GroupTheory/Perm/Cycle/Factors.lean", "module": "Mathlib.GroupTheory.Perm.Cycle.Factors", "declaration": "Mathlib.GroupTheory.Perm.Cycle.Factors.isCycle_cycleOf", "span": "L155-L166", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Perm/Cycle/Factors.lean#L155"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 813, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2868, "lean_code_chars": 503, "natural_language_chars": 2365, "lean_code_ratio": 0.1754, "line_count": 23, "imports_count": 0, "declarations_count": 377, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "0f6bc956394f4346", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.TwoSidedIdeal.Operations.mem_fromIdeal", "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.RingTheory.TwoSidedIdeal.Operations)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mem_fromIdeal {I : Ideal R} {x : R} :\n x \u2208 fromIdeal I \u2194 x \u2208 span I\n:= by simp [fromIdeal] _unbalancedParenXYZ\n/-- Every two-sided ideal is also a left ideal. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=32), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n fromIdeal\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n I\\n\\nHint: The identifier `fromIdeal` 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=8), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n span\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n I\\n\\nHint: The identifier `span` 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=26), pos_end=Position(line=2, column=32), severity=, kind=None), Message(data='Invalid argument: Variable `fromIdeal` is not a proposition or let-declaration', pos=Position(line=3, column=12), pos_end=Position(line=3, column=21), severity=, kind=None), Message(data='unsolved goals\\nR : Type u_1\\nx\u271d\u00b9 : Sort u_2\\nfromIdeal : x\u271d\u00b9\\nx\u271d : Sort u_3\\nspan : x\u271d\\nI : sorry\\nx : R\\n\u22a2 x \u2208 sorry () \u2194 x \u2208 sorry ()', pos=Position(line=3, column=3), pos_end=Position(line=3, column=22), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=106, i_end=176, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=23), pos_end=Position(line=3, column=42), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=4, 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.RingTheory.TwoSidedIdeal.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mem_fromIdeal {I : Ideal R} {x : R} :\n x \u2208 fromIdeal I \u2194 x \u2208 span I\n:= by simp [fromIdeal] _unbalancedParenXYZ\n/-- Every two-sided ideal is also a left ideal. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=32), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n fromIdeal\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n I\\n\\nHint: The identifier `fromIdeal` 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=8), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n span\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n I\\n\\nHint: The identifier `span` 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=26), pos_end=Position(line=2, column=32), severity=, kind=None), Message(data='Invalid argument: Variable `fromIdeal` is not a proposition or let-declaration', pos=Position(line=3, column=12), pos_end=Position(line=3, column=21), severity=, kind=None), Message(data='unsolved goals\\nR : Type u_1\\nx\u271d\u00b9 : Sort u_2\\nfromIdeal : x\u271d\u00b9\\nx\u271d : Sort u_3\\nspan : x\u271d\\nI : sorry\\nx : R\\n\u22a2 x \u2208 sorry () \u2194 x \u2208 sorry ()', pos=Position(line=3, column=3), pos_end=Position(line=3, column=22), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=106, i_end=176, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=23), pos_end=Position(line=3, column=42), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=4, 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/RingTheory/TwoSidedIdeal/Operations.lean", "module": "Mathlib.RingTheory.TwoSidedIdeal.Operations", "declaration": "Mathlib.RingTheory.TwoSidedIdeal.Operations.mem_fromIdeal", "span": "L320-L323", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/TwoSidedIdeal/Operations.lean#L320"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 925, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3312, "lean_code_chars": 171, "natural_language_chars": 3141, "lean_code_ratio": 0.0516, "line_count": 15, "imports_count": 0, "declarations_count": 443, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "fa59d0f910935ecd", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Matrix.NonsingularInverse.coe_units_inv", "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.LinearAlgebra.Matrix.NonsingularInverse)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem coe_units_inv (A : (Matrix n n \u03b1)\u02e3) : \u2191A\u207b\u00b9 = (A\u207b\u00b9 : Matrix n n \u03b1)\n:= by thisIsWrongLemmaNameXYZ\nletI := A.invertible\n rw [\u2190 invOf_eq_nonsing_inv, invOf_units]\n\n/-- The nonsingular inverse is the same as the general `Ring.inverse`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=92, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Monoid (Matrix n n \u03b1)\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=27), pos_end=Position(line=1, column=42), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Inv (Matrix n n \u03b1)\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=54), pos_end=Position(line=1, column=57), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='unsolved goals\\nn : Type u_1\\n\u03b1 : Type u_2\\nA : sorry\\n\u22a2 sorry = sorry', 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=92, i_end=255, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=73), 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.LinearAlgebra.Matrix.NonsingularInverse).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem coe_units_inv (A : (Matrix n n \u03b1)\u02e3) : \u2191A\u207b\u00b9 = (A\u207b\u00b9 : Matrix n n \u03b1)\n:= by thisIsWrongLemmaNameXYZ\nletI := A.invertible\n rw [\u2190 invOf_eq_nonsing_inv, invOf_units]\n\n/-- The nonsingular inverse is the same as the general `Ring.inverse`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=92, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Monoid (Matrix n n \u03b1)\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=27), pos_end=Position(line=1, column=42), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Inv (Matrix n n \u03b1)\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=54), pos_end=Position(line=1, column=57), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='unsolved goals\\nn : Type u_1\\n\u03b1 : Type u_2\\nA : sorry\\n\u22a2 sorry = sorry', 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=92, i_end=255, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=73), 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/LinearAlgebra/Matrix/NonsingularInverse.lean", "module": "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "declaration": "Mathlib.LinearAlgebra.Matrix.NonsingularInverse.coe_units_inv", "span": "L190-L194", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean#L190"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 622, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2191, "lean_code_chars": 243, "natural_language_chars": 1948, "lean_code_ratio": 0.1109, "line_count": 17, "imports_count": 0, "declarations_count": 249, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "1218b3446c41d6a0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.LSeries.Linearity.LSeries_neg", "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.NumberTheory.LSeries.Linearity)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma LSeries_neg (f : \u2115 \u2192 \u2102) (s : \u2102) : LSeries (-f) s = -LSeries f s\n:= by .someMissingNamespaceXYZ\nsimp [LSeries, term_neg_apply, tsum_neg]\n\n/-!\n### Subtraction\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=86, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=86, i_end=173, 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.NumberTheory.LSeries.Linearity).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma LSeries_neg (f : \u2115 \u2192 \u2102) (s : \u2102) : LSeries (-f) s = -LSeries f s\n:= by .someMissingNamespaceXYZ\nsimp [LSeries, term_neg_apply, tsum_neg]\n\n/-!\n### Subtraction\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=86, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=86, i_end=173, 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/NumberTheory/LSeries/Linearity.lean", "module": "Mathlib.NumberTheory.LSeries.Linearity", "declaration": "Mathlib.NumberTheory.LSeries.Linearity.LSeries_neg", "span": "L74-L80", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LSeries/Linearity.lean#L74"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 300, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1031, "lean_code_chars": 166, "natural_language_chars": 865, "lean_code_ratio": 0.161, "line_count": 18, "imports_count": 0, "declarations_count": 109, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "79dc369a7c0d2c72", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Order.Field.Power.zpow_eq_one_iff_cases\u2080", "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.Algebra.Order.Field.Power)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma zpow_eq_one_iff_cases\u2080 : a ^ n = 1 \u2194 n = 0 \u2228 a = 1 \u2228 a = -1 \u2227 Even n\n frobnicateTacticThatDoesNotExist := by\nsimp [\u2190 zpow_eq_zpow_iff_cases\u2080]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data='`zpow_eq_one_iff_cases\u2080` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=28), 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.Algebra.Order.Field.Power).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma zpow_eq_one_iff_cases\u2080 : a ^ n = 1 \u2194 n = 0 \u2228 a = 1 \u2228 a = -1 \u2227 Even n\n frobnicateTacticThatDoesNotExist := by\nsimp [\u2190 zpow_eq_zpow_iff_cases\u2080]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data='`zpow_eq_one_iff_cases\u2080` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=28), 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/Algebra/Order/Field/Power.lean", "module": "Mathlib.Algebra.Order.Field.Power", "declaration": "Mathlib.Algebra.Order.Field.Power.zpow_eq_one_iff_cases\u2080", "span": "L90-L92", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Field/Power.lean#L90"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 285, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 935, "lean_code_chars": 149, "natural_language_chars": 786, "lean_code_ratio": 0.1594, "line_count": 14, "imports_count": 0, "declarations_count": 98, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "40d99bc056ea6fbe", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Stream.Init.get_succ_iterate", "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.Data.Stream.Init)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem get_succ_iterate (n : \u2115) (f : \u03b1 \u2192 \u03b1) (a : \u03b1) :\n get (iterate f a) (succ n) = get (iterate f (f a)) n\n:= by rw [get_succ, tail_iterate] thisIsWrongLemmaNameXYZ\nsection Bisim\n\nvariable (R : Stream' \u03b1 \u2192 Stream' \u03b1 \u2192 Prop)\n\n/-- equivalence relation -/\nlocal infixl:50 \" ~ \" => R\n\n/-- Streams `s\u2081` and `s\u2082` are defined to be bisimulations if\ntheir heads are equal and tails are bisimulations. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=153, messages=[Message(data='Function expected at\\n get\\nbut this term has type\\n ?m.3 ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (iterate f a)', pos=Position(line=2, column=4), pos_end=Position(line=2, column=30), severity=, kind=None), Message(data='Function expected at\\n get\\nbut this term has type\\n ?m.8 ?m.7\\n\\nNote: Expected a function because this term is being applied to the argument\\n (iterate f (f a))', pos=Position(line=2, column=33), pos_end=Position(line=2, column=56), severity=, kind=None), Message(data='Unknown identifier `get_succ`', pos=Position(line=3, column=10), pos_end=Position(line=3, column=18), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u03b1 : Sort u_1\\nn : \u2115\\nf : \u03b1 \u2192 \u03b1\\na : \u03b1\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=33), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=153, i_end=192, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=34), pos_end=Position(line=3, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=192, i_end=243, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=243, i_end=299, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=299, i_end=417, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=53), 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.Data.Stream.Init).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem get_succ_iterate (n : \u2115) (f : \u03b1 \u2192 \u03b1) (a : \u03b1) :\n get (iterate f a) (succ n) = get (iterate f (f a)) n\n:= by rw [get_succ, tail_iterate] thisIsWrongLemmaNameXYZ\nsection Bisim\n\nvariable (R : Stream' \u03b1 \u2192 Stream' \u03b1 \u2192 Prop)\n\n/-- equivalence relation -/\nlocal infixl:50 \" ~ \" => R\n\n/-- Streams `s\u2081` and `s\u2082` are defined to be bisimulations if\ntheir heads are equal and tails are bisimulations. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=153, messages=[Message(data='Function expected at\\n get\\nbut this term has type\\n ?m.3 ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (iterate f a)', pos=Position(line=2, column=4), pos_end=Position(line=2, column=30), severity=, kind=None), Message(data='Function expected at\\n get\\nbut this term has type\\n ?m.8 ?m.7\\n\\nNote: Expected a function because this term is being applied to the argument\\n (iterate f (f a))', pos=Position(line=2, column=33), pos_end=Position(line=2, column=56), severity=, kind=None), Message(data='Unknown identifier `get_succ`', pos=Position(line=3, column=10), pos_end=Position(line=3, column=18), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u03b1 : Sort u_1\\nn : \u2115\\nf : \u03b1 \u2192 \u03b1\\na : \u03b1\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=33), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=153, i_end=192, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=34), pos_end=Position(line=3, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=192, i_end=243, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=243, i_end=299, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=299, i_end=417, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=53), 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/Data/Stream/Init.lean", "module": "Mathlib.Data.Stream.Init", "declaration": "Mathlib.Data.Stream.Init.get_succ_iterate", "span": "L254-L265", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Stream/Init.lean#L254"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 851, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2841, "lean_code_chars": 401, "natural_language_chars": 2440, "lean_code_ratio": 0.1411, "line_count": 23, "imports_count": 0, "declarations_count": 335, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "4b99981d619bd490", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.GameAdd.GameAdd", "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.Order.GameAdd)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem GameAdd.induction {C : \u03b1 \u2192 \u03b2 \u2192 Prop} :\n WellFounded r\u03b1 \u2192\n WellFounded r\u03b2 \u2192\n (\u2200 a\u2081 b\u2081, (\u2200 a\u2082 b\u2082, GameAdd r\u03b1 r\u03b2 (a\u2082, b\u2082) (a\u2081, b\u2081) \u2192 C a\u2082 b\u2082) \u2192 C a\u2081 b\u2081) \u2192 \u2200 a b, C a b\n:= thisIsWrongLemmaNameXYZ\nGameAdd.recursion\n\nend Prod\n\n/-! ### `Sym2.GameAdd` -/\n\nnamespace Sym2\n\n/-- `Sym2.GameAdd r\u03b1 x y` means that `x` can be reached from `y` by decreasing either entry with\n respect to the relation `r\u03b1`.\n\n See `Prod.GameAdd` for the ordered pair analog. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=284, messages=[Message(data=\"Function expected at\\n GameAdd\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n r\u03b1\\n\\nHint: The identifier `GameAdd` 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=4, column=28), pos_end=Position(line=4, column=59), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=5, column=3), pos_end=Position(line=5, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=284, i_end=294, messages=[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=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=294, i_end=321, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=321, i_end=337, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=337, i_end=521, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=17, column=52), 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.Order.GameAdd).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem GameAdd.induction {C : \u03b1 \u2192 \u03b2 \u2192 Prop} :\n WellFounded r\u03b1 \u2192\n WellFounded r\u03b2 \u2192\n (\u2200 a\u2081 b\u2081, (\u2200 a\u2082 b\u2082, GameAdd r\u03b1 r\u03b2 (a\u2082, b\u2082) (a\u2081, b\u2081) \u2192 C a\u2082 b\u2082) \u2192 C a\u2081 b\u2081) \u2192 \u2200 a b, C a b\n:= thisIsWrongLemmaNameXYZ\nGameAdd.recursion\n\nend Prod\n\n/-! ### `Sym2.GameAdd` -/\n\nnamespace Sym2\n\n/-- `Sym2.GameAdd r\u03b1 x y` means that `x` can be reached from `y` by decreasing either entry with\n respect to the relation `r\u03b1`.\n\n See `Prod.GameAdd` for the ordered pair analog. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=284, messages=[Message(data=\"Function expected at\\n GameAdd\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n r\u03b1\\n\\nHint: The identifier `GameAdd` 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=4, column=28), pos_end=Position(line=4, column=59), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=5, column=3), pos_end=Position(line=5, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=284, i_end=294, messages=[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=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=294, i_end=321, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=321, i_end=337, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=337, i_end=521, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=17, column=52), 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/Order/GameAdd.lean", "module": "Mathlib.Order.GameAdd", "declaration": "Mathlib.Order.GameAdd.GameAdd", "span": "L130-L145", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/GameAdd.lean#L130"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 819, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2813, "lean_code_chars": 470, "natural_language_chars": 2343, "lean_code_ratio": 0.1671, "line_count": 28, "imports_count": 0, "declarations_count": 347, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "d2096875ea7599b7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Algebra.Module.LinearMap.toSpanSingleton_comp_toSpanSingleton", "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.Topology.Algebra.Module.LinearMap)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem toSpanSingleton_comp_toSpanSingleton [ContinuousMul R\u2081] {x : M\u2082} {c : R\u2081} :\n (toSpanSingleton R\u2081 x).comp (toSpanSingleton R\u2081 c) =\n toSpanSingleton R\u2081 (c \u2022 x)\n:= smulRight_comp_smulRight 1 1 \u27e8\u27e9\u27e8\u27e9\nend ToSpanSingleton\n\nend Semiring\n\nsection Ring\n\nvariable {R : Type*} [Ring R] {R\u2082 : Type*} [Ring R\u2082] {R\u2083 : Type*} [Ring R\u2083] {M : Type*}\n [TopologicalSpace M] [AddCommGroup M] {M\u2082 : Type*} [TopologicalSpace M\u2082] [AddCommGroup M\u2082]\n {M\u2083 : Type*} [TopologicalSpace M\u2083] [AddCommGroup M\u2083] {M\u2084 : Type*} [TopologicalSpace M\u2084]\n [AddCommGroup M\u2084] [Module R M] [Module R\u2082 M\u2082] [Module R\u2083 M\u2083] {\u03c3\u2081\u2082 : R \u2192+* R\u2082} {\u03c3\u2082\u2083 : R\u2082 \u2192+* R\u2083}\n {\u03c3\u2081\u2083 : R \u2192+* R\u2083}\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=226, messages=[Message(data='failed to synthesize instance of type class\\n TopologicalSpace R\u2081\\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=62), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=226, i_end=254, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=4, column=34), pos_end=Position(line=4, column=35), 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=5, column=0), pos_end=Position(line=5, column=19), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=254, i_end=268, messages=[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=12), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=268, i_end=282, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=282, i_end=732, 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.Topology.Algebra.Module.LinearMap).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem toSpanSingleton_comp_toSpanSingleton [ContinuousMul R\u2081] {x : M\u2082} {c : R\u2081} :\n (toSpanSingleton R\u2081 x).comp (toSpanSingleton R\u2081 c) =\n toSpanSingleton R\u2081 (c \u2022 x)\n:= smulRight_comp_smulRight 1 1 \u27e8\u27e9\u27e8\u27e9\nend ToSpanSingleton\n\nend Semiring\n\nsection Ring\n\nvariable {R : Type*} [Ring R] {R\u2082 : Type*} [Ring R\u2082] {R\u2083 : Type*} [Ring R\u2083] {M : Type*}\n [TopologicalSpace M] [AddCommGroup M] {M\u2082 : Type*} [TopologicalSpace M\u2082] [AddCommGroup M\u2082]\n {M\u2083 : Type*} [TopologicalSpace M\u2083] [AddCommGroup M\u2083] {M\u2084 : Type*} [TopologicalSpace M\u2084]\n [AddCommGroup M\u2084] [Module R M] [Module R\u2082 M\u2082] [Module R\u2083 M\u2083] {\u03c3\u2081\u2082 : R \u2192+* R\u2082} {\u03c3\u2082\u2083 : R\u2082 \u2192+* R\u2083}\n {\u03c3\u2081\u2083 : R \u2192+* R\u2083}\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=226, messages=[Message(data='failed to synthesize instance of type class\\n TopologicalSpace R\u2081\\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=62), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=226, i_end=254, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=4, column=34), pos_end=Position(line=4, column=35), 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=5, column=0), pos_end=Position(line=5, column=19), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=254, i_end=268, messages=[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=12), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=268, i_end=282, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=282, i_end=732, 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/Topology/Algebra/Module/LinearMap.lean", "module": "Mathlib.Topology.Algebra.Module.LinearMap", "declaration": "Mathlib.Topology.Algebra.Module.LinearMap.toSpanSingleton_comp_toSpanSingleton", "span": "L831-L846", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Module/LinearMap.lean#L831"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 876, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2799, "lean_code_chars": 648, "natural_language_chars": 2151, "lean_code_ratio": 0.2315, "line_count": 26, "imports_count": 0, "declarations_count": 314, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "055ddf396b9a6fbc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Calculus.FDeriv.Mul.HasFDerivWithinAt", "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.Analysis.Calculus.FDeriv.Mul)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem HasFDerivWithinAt.const_mul (ha : HasFDerivWithinAt a a' s x) (b : \ud835\udd38) :\n HasFDerivWithinAt (fun y => b * a y) (b \u2022 a') s x\n:= \u27e8\u27e9\u27e8\u27e9\n((ContinuousLinearMap.mul \ud835\udd5c \ud835\udd38) b).hasFDerivAt.comp_hasFDerivWithinAt x ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=148, messages=[Message(data='`HasFDerivWithinAt.const_mul` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=35), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=148, i_end=234, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=5), pos_end=Position(line=3, 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.Analysis.Calculus.FDeriv.Mul).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem HasFDerivWithinAt.const_mul (ha : HasFDerivWithinAt a a' s x) (b : \ud835\udd38) :\n HasFDerivWithinAt (fun y => b * a y) (b \u2022 a') s x\n:= \u27e8\u27e9\u27e8\u27e9\n((ContinuousLinearMap.mul \ud835\udd5c \ud835\udd38) b).hasFDerivAt.comp_hasFDerivWithinAt x ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=148, messages=[Message(data='`HasFDerivWithinAt.const_mul` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=35), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=148, i_end=234, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=5), pos_end=Position(line=3, 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/Analysis/Calculus/FDeriv/Mul.lean", "module": "Mathlib.Analysis.Calculus.FDeriv.Mul", "declaration": "Mathlib.Analysis.Calculus.FDeriv.Mul.HasFDerivWithinAt", "span": "L347-L350", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/FDeriv/Mul.lean#L347"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 413, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1308, "lean_code_chars": 216, "natural_language_chars": 1092, "lean_code_ratio": 0.1651, "line_count": 15, "imports_count": 0, "declarations_count": 139, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8d8c47d43cf07fe8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.SimpleGraph.UniversalVerts.deleteUniversalVerts", "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.Combinatorics.SimpleGraph.UniversalVerts)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef deleteUniversalVerts (G : SimpleGraph V) : Subgraph G\n:= \u27e8\u27e9\u27e8\u27e9\n(\u22a4 : Subgraph G).deleteVerts G.universalVerts\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=67, messages=[Message(data=\"Function expected at\\n Subgraph\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `Subgraph` 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=47), pos_end=Position(line=1, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=67, i_end=121, 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.Combinatorics.SimpleGraph.UniversalVerts).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef deleteUniversalVerts (G : SimpleGraph V) : Subgraph G\n:= \u27e8\u27e9\u27e8\u27e9\n(\u22a4 : Subgraph G).deleteVerts G.universalVerts\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=67, messages=[Message(data=\"Function expected at\\n Subgraph\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `Subgraph` 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=47), pos_end=Position(line=1, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=67, i_end=121, 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/Combinatorics/SimpleGraph/UniversalVerts.lean", "module": "Mathlib.Combinatorics.SimpleGraph.UniversalVerts", "declaration": "Mathlib.Combinatorics.SimpleGraph.UniversalVerts.deleteUniversalVerts", "span": "L45-L47", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/UniversalVerts.lean#L45"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 453, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1654, "lean_code_chars": 112, "natural_language_chars": 1542, "lean_code_ratio": 0.0677, "line_count": 14, "imports_count": 0, "declarations_count": 207, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2d575a00a6f6425c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.Subgroup.Center.instNormalCenter", "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.GroupTheory.Subgroup.Center)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance instNormalCenter : (center G).Normal\n:= .someMissingNamespaceXYZ\n\u27e8fun a ha b \u21a6 by simp [mul_assoc, mem_center_iff.mp ha b, ha]\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=142, messages=[Message(data=\"Function expected at\\n center\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `center` 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=29), pos_end=Position(line=1, column=37), 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.GroupTheory.Subgroup.Center).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance instNormalCenter : (center G).Normal\n:= .someMissingNamespaceXYZ\n\u27e8fun a ha b \u21a6 by simp [mul_assoc, mem_center_iff.mp ha b, ha]\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=142, messages=[Message(data=\"Function expected at\\n center\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `center` 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=29), pos_end=Position(line=1, column=37), 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/GroupTheory/Subgroup/Center.lean", "module": "Mathlib.GroupTheory.Subgroup.Center", "declaration": "Mathlib.GroupTheory.Subgroup.Center.instNormalCenter", "span": "L97-L99", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Subgroup/Center.lean#L97"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 362, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1366, "lean_code_chars": 137, "natural_language_chars": 1229, "lean_code_ratio": 0.1003, "line_count": 14, "imports_count": 0, "declarations_count": 183, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7fae20273a0ed3e8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.MvPolynomial.Homogeneous.aeval", "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.RingTheory.MvPolynomial.Homogeneous)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma aeval [Algebra R S] (h\u03c6 : \u03c6.IsHomogeneous m)\n (g : \u03c3 \u2192 MvPolynomial \u03c4 S) (hg : \u2200 i, (g i).IsHomogeneous n) :\n (aeval g \u03c6).IsHomogeneous (n * m)\n:= .someMissingNamespaceXYZ\nh\u03c6.eval\u2082 _ _ (fun _ \u21a6 isHomogeneous_C _ _) hg\n\nsection CommRing\n\n-- In this section we shadow the semiring `R` with a ring `R`.\nvariable {R \u03c3 : Type*} [CommRing R] {\u03c6 \u03c8 : MvPolynomial \u03c3 R} {n : \u2115}\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=245, messages=[Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=13), pos_end=Position(line=1, column=24), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=245, i_end=326, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=326, i_end=400, 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.RingTheory.MvPolynomial.Homogeneous).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma aeval [Algebra R S] (h\u03c6 : \u03c6.IsHomogeneous m)\n (g : \u03c3 \u2192 MvPolynomial \u03c4 S) (hg : \u2200 i, (g i).IsHomogeneous n) :\n (aeval g \u03c6).IsHomogeneous (n * m)\n:= .someMissingNamespaceXYZ\nh\u03c6.eval\u2082 _ _ (fun _ \u21a6 isHomogeneous_C _ _) hg\n\nsection CommRing\n\n-- In this section we shadow the semiring `R` with a ring `R`.\nvariable {R \u03c3 : Type*} [CommRing R] {\u03c6 \u03c8 : MvPolynomial \u03c3 R} {n : \u2115}\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=245, messages=[Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=13), pos_end=Position(line=1, column=24), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=245, i_end=326, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=326, i_end=400, 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/RingTheory/MvPolynomial/Homogeneous.lean", "module": "Mathlib.RingTheory.MvPolynomial.Homogeneous", "declaration": "Mathlib.RingTheory.MvPolynomial.Homogeneous.aeval", "span": "L294-L303", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPolynomial/Homogeneous.lean#L294"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 478, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1620, "lean_code_chars": 381, "natural_language_chars": 1239, "lean_code_ratio": 0.2352, "line_count": 21, "imports_count": 0, "declarations_count": 185, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "69b51032fe722a56", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Dual.Defs.dualCoannihilator_sup_eq", "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.LinearAlgebra.Dual.Defs)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem dualCoannihilator_sup_eq (U V : Submodule R (Module.Dual R M)) :\n (U \u2294 V).dualCoannihilator = U.dualCoannihilator \u2293 V.dualCoannihilator\n:= thisIsWrongLemmaNameXYZ\n(dualAnnihilator_gc R M).u_inf\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=208, messages=[Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=53), pos_end=Position(line=1, column=68), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=40), pos_end=Position(line=1, column=69), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=53), pos_end=Position(line=1, column=68), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=40), pos_end=Position(line=1, column=69), severity=, kind='lean.synthInstanceFailed._namedError'), 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.LinearAlgebra.Dual.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem dualCoannihilator_sup_eq (U V : Submodule R (Module.Dual R M)) :\n (U \u2294 V).dualCoannihilator = U.dualCoannihilator \u2293 V.dualCoannihilator\n:= thisIsWrongLemmaNameXYZ\n(dualAnnihilator_gc R M).u_inf\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=208, messages=[Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=53), pos_end=Position(line=1, column=68), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=40), pos_end=Position(line=1, column=69), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=53), pos_end=Position(line=1, column=68), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=40), pos_end=Position(line=1, column=69), severity=, kind='lean.synthInstanceFailed._namedError'), 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/LinearAlgebra/Dual/Defs.lean", "module": "Mathlib.LinearAlgebra.Dual.Defs", "declaration": "Mathlib.LinearAlgebra.Dual.Defs.dualCoannihilator_sup_eq", "span": "L425-L428", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Dual/Defs.lean#L425"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 655, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2403, "lean_code_chars": 205, "natural_language_chars": 2198, "lean_code_ratio": 0.0853, "line_count": 15, "imports_count": 0, "declarations_count": 262, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "8deee7db6d1e1b80", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.ArithmeticFunction.Defs.natToArithmeticFunction", "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.NumberTheory.ArithmeticFunction.Defs)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef natToArithmeticFunction [AddMonoidWithOne R] :\n (ArithmeticFunction \u2115) \u2192 (ArithmeticFunction R)\n:= .someMissingNamespaceXYZ\nfun f => \u27e8fun n => \u2191(f n), by simp\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=176, messages=[Message(data='Unknown constant `ArithmeticFunction.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n ArithmeticFunction \u2115 \u2192 ArithmeticFunction R', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `ZeroHom.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n ArithmeticFunction \u2115 \u2192 ArithmeticFunction R', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), 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.NumberTheory.ArithmeticFunction.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef natToArithmeticFunction [AddMonoidWithOne R] :\n (ArithmeticFunction \u2115) \u2192 (ArithmeticFunction R)\n:= .someMissingNamespaceXYZ\nfun f => \u27e8fun n => \u2191(f n), by simp\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=176, messages=[Message(data='Unknown constant `ArithmeticFunction.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n ArithmeticFunction \u2115 \u2192 ArithmeticFunction R', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `ZeroHom.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n ArithmeticFunction \u2115 \u2192 ArithmeticFunction R', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), 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/NumberTheory/ArithmeticFunction/Defs.lean", "module": "Mathlib.NumberTheory.ArithmeticFunction.Defs", "declaration": "Mathlib.NumberTheory.ArithmeticFunction.Defs.natToArithmeticFunction", "span": "L119-L122", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ArithmeticFunction/Defs.lean#L119"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 404, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1495, "lean_code_chars": 167, "natural_language_chars": 1328, "lean_code_ratio": 0.1117, "line_count": 15, "imports_count": 0, "declarations_count": 148, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "3aa5228baf3ad753", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Algebra.Unitization.fst_neg", "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.Algebra.Algebra.Unitization)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem fst_neg [Neg R] [Neg A] (x : Unitization R A) : (-x).fst = -x.fst\n:= .someMissingNamespaceXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=105, messages=[Message(data='Unknown constant `Eq.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n (-x).toProd.1 = -x.toProd.1', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), 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.Algebra.Algebra.Unitization).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem fst_neg [Neg R] [Neg A] (x : Unitization R A) : (-x).fst = -x.fst\n:= .someMissingNamespaceXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=105, messages=[Message(data='Unknown constant `Eq.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n (-x).toProd.1 = -x.toProd.1', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), 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/Algebra/Algebra/Unitization.lean", "module": "Mathlib.Algebra.Algebra.Unitization", "declaration": "Mathlib.Algebra.Algebra.Unitization.fst_neg", "span": "L317-L319", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/Unitization.lean#L317"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 299, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1044, "lean_code_chars": 106, "natural_language_chars": 938, "lean_code_ratio": 0.1015, "line_count": 14, "imports_count": 0, "declarations_count": 114, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b921d7c8c0355bca", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.List.Cycle.fintypeNodupNontrivialCycle", "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.Data.List.Cycle)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance fintypeNodupNontrivialCycle [Fintype \u03b1] :\n Fintype { s : Cycle \u03b1 // s.Nodup \u2227 s.Nontrivial }\n:= _unbalancedParenXYZ\nFintype.subtype\n (((Finset.univ : Finset { s : Cycle \u03b1 // s.Nodup }).map (Function.Embedding.subtype _)).filter\n Cycle.Nontrivial)\n (by simp)\n\n/-- The `s : Cycle \u03b1` as a `Finset \u03b1`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=287, messages=[Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=3, column=3), pos_end=Position(line=3, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=287, i_end=330, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=41), 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.Data.List.Cycle).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance fintypeNodupNontrivialCycle [Fintype \u03b1] :\n Fintype { s : Cycle \u03b1 // s.Nodup \u2227 s.Nontrivial }\n:= _unbalancedParenXYZ\nFintype.subtype\n (((Finset.univ : Finset { s : Cycle \u03b1 // s.Nodup }).map (Function.Embedding.subtype _)).filter\n Cycle.Nontrivial)\n (by simp)\n\n/-- The `s : Cycle \u03b1` as a `Finset \u03b1`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=287, messages=[Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=3, column=3), pos_end=Position(line=3, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=287, i_end=330, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=41), 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/Data/List/Cycle.lean", "module": "Mathlib.Data.List.Cycle", "declaration": "Mathlib.Data.List.Cycle.fintypeNodupNontrivialCycle", "span": "L700-L707", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/List/Cycle.lean#L700"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 412, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1402, "lean_code_chars": 324, "natural_language_chars": 1078, "lean_code_ratio": 0.2311, "line_count": 20, "imports_count": 0, "declarations_count": 141, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5999c3b3eccc3a05", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.ConditionallyCompleteLattice.Indexed.ciInf_subtype''", "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.Order.ConditionallyCompleteLattice.Indexed)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ciInf_subtype'' {\u03b9} [Nonempty \u03b9] {s : Set \u03b9} (hs : s.Nonempty) {f : \u03b9 \u2192 \u03b1}\n (hf : BddBelow (Set.range fun i : s \u21a6 f i)) (hf' : \u2a05 i : s, f i \u2264 sInf \u2205) :\n \u2a05 i : s, f i = \u2a05 (t : \u03b9) (_ : t \u2208 s), f t\n:= _unbalancedParenXYZ\nhaveI : Nonempty s := Set.Nonempty.to_subtype hs\n ciInf_subtype hf hf'\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=325, messages=[Message(data=\"unexpected end of input; expected ';' or line break\", pos=Position(line=6, column=22), 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.Order.ConditionallyCompleteLattice.Indexed).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ciInf_subtype'' {\u03b9} [Nonempty \u03b9] {s : Set \u03b9} (hs : s.Nonempty) {f : \u03b9 \u2192 \u03b1}\n (hf : BddBelow (Set.range fun i : s \u21a6 f i)) (hf' : \u2a05 i : s, f i \u2264 sInf \u2205) :\n \u2a05 i : s, f i = \u2a05 (t : \u03b9) (_ : t \u2208 s), f t\n:= _unbalancedParenXYZ\nhaveI : Nonempty s := Set.Nonempty.to_subtype hs\n ciInf_subtype hf hf'\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=325, messages=[Message(data=\"unexpected end of input; expected ';' or line break\", pos=Position(line=6, column=22), 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/Order/ConditionallyCompleteLattice/Indexed.lean", "module": "Mathlib.Order.ConditionallyCompleteLattice.Indexed", "declaration": "Mathlib.Order.ConditionallyCompleteLattice.Indexed.ciInf_subtype''", "span": "L303-L308", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/ConditionallyCompleteLattice/Indexed.lean#L303"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 344, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1086, "lean_code_chars": 304, "natural_language_chars": 782, "lean_code_ratio": 0.2799, "line_count": 17, "imports_count": 0, "declarations_count": 127, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b1bb4edd3001c7e8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Algebra.SeparationQuotient.Basic.mkCLM", "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.Topology.Algebra.SeparationQuotient.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef mkCLM : M \u2192L[R] SeparationQuotient M where\n toFun\n:= mk .someMissingNamespaceXYZ\nmap_add' := mk_add\n map_smul' := mk_smul\n\nvariable {R M}\n\n/-- The lift (as a continuous linear map) of `f` with `f x = f y` for `Inseparable x y`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=88, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=12), pos_end=Position(line=1, column=40), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n TopologicalSpace M\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=20), pos_end=Position(line=1, column=40), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=12), pos_end=Position(line=1, column=40), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=88, i_end=147, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=147, i_end=238, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=91), 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.Topology.Algebra.SeparationQuotient.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef mkCLM : M \u2192L[R] SeparationQuotient M where\n toFun\n:= mk .someMissingNamespaceXYZ\nmap_add' := mk_add\n map_smul' := mk_smul\n\nvariable {R M}\n\n/-- The lift (as a continuous linear map) of `f` with `f x = f y` for `Inseparable x y`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=88, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=12), pos_end=Position(line=1, column=40), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n TopologicalSpace M\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=20), pos_end=Position(line=1, column=40), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=12), pos_end=Position(line=1, column=40), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=88, i_end=147, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=147, i_end=238, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=91), 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/Topology/Algebra/SeparationQuotient/Basic.lean", "module": "Mathlib.Topology.Algebra.SeparationQuotient.Basic", "declaration": "Mathlib.Topology.Algebra.SeparationQuotient.Basic.mkCLM", "span": "L388-L395", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/SeparationQuotient/Basic.lean#L388"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 678, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2495, "lean_code_chars": 237, "natural_language_chars": 2258, "lean_code_ratio": 0.095, "line_count": 20, "imports_count": 0, "declarations_count": 282, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "8781e10c083eb50b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.InnerProductSpace.Positive.IsPositive", "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.Analysis.InnerProductSpace.Positive)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsPositive.add {T S : E \u2192L[\ud835\udd5c] E} (hT : T.IsPositive) (hS : S.IsPositive) :\n (T + S).IsPositive\n frobnicateTacticThatDoesNotExist :=\n(isPositive_toLinearMap_iff _).mp (hT.toLinearMap.add hS.toLinearMap)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=218, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n NonAssocSemiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `isPositive_toLinearMap_iff`', pos=Position(line=4, column=1), pos_end=Position(line=4, column=27), 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.Analysis.InnerProductSpace.Positive).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsPositive.add {T S : E \u2192L[\ud835\udd5c] E} (hT : T.IsPositive) (hS : S.IsPositive) :\n (T + S).IsPositive\n frobnicateTacticThatDoesNotExist :=\n(isPositive_toLinearMap_iff _).mp (hT.toLinearMap.add hS.toLinearMap)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=218, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n NonAssocSemiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=30), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `isPositive_toLinearMap_iff`', pos=Position(line=4, column=1), pos_end=Position(line=4, column=27), 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/Analysis/InnerProductSpace/Positive.lean", "module": "Mathlib.Analysis.InnerProductSpace.Positive", "declaration": "Mathlib.Analysis.InnerProductSpace.Positive.IsPositive", "span": "L344-L347", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/Positive.lean#L344"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 670, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2443, "lean_code_chars": 214, "natural_language_chars": 2229, "lean_code_ratio": 0.0876, "line_count": 15, "imports_count": 0, "declarations_count": 259, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "b6565e88f9fdce61", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Additive.DoublingConst.divConst_inv_left", "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.Combinatorics.Additive.DoublingConst)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma divConst_inv_left (A B : Finset G) : \u03b4\u2098[A\u207b\u00b9, B] = \u03c3\u2098[A, B]\n frobnicateTacticThatDoesNotExist := by\nrw [mulConst, divConst, card_inv, \u2190 card_inv, inv_div, div_inv_eq_mul, mul_comm]\n\n/-- If `A` has small difference, then it has small doubling, with the constant squared.\n\nThis is a consequence of the Ruzsa triangle inequality. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=55, messages=[Message(data=\"unexpected token ','; expected ':', ']' or ']''\", pos=Position(line=1, column=49), pos_end=Position(line=1, column=50), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=55, i_end=346, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, 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.Combinatorics.Additive.DoublingConst).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma divConst_inv_left (A B : Finset G) : \u03b4\u2098[A\u207b\u00b9, B] = \u03c3\u2098[A, B]\n frobnicateTacticThatDoesNotExist := by\nrw [mulConst, divConst, card_inv, \u2190 card_inv, inv_div, div_inv_eq_mul, mul_comm]\n\n/-- If `A` has small difference, then it has small doubling, with the constant squared.\n\nThis is a consequence of the Ruzsa triangle inequality. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=55, messages=[Message(data=\"unexpected token ','; expected ':', ']' or ']''\", pos=Position(line=1, column=49), pos_end=Position(line=1, column=50), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=55, i_end=346, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, 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/Combinatorics/Additive/DoublingConst.lean", "module": "Mathlib.Combinatorics.Additive.DoublingConst", "declaration": "Mathlib.Combinatorics.Additive.DoublingConst.divConst_inv_left", "span": "L225-L230", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Additive/DoublingConst.lean#L225"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 405, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1409, "lean_code_chars": 336, "natural_language_chars": 1073, "lean_code_ratio": 0.2385, "line_count": 18, "imports_count": 0, "declarations_count": 157, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8d670e1847e9b980", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.Perm.Cycle.Basic.subtypePerm_apply_zpow_of_mem", "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.GroupTheory.Perm.Cycle.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem subtypePerm_apply_zpow_of_mem {g : Perm \u03b1} {s : Finset \u03b1}\n (hs : \u2200 x : \u03b1, g x \u2208 s \u2194 x \u2208 s) {i : \u2124} {x : \u03b1} (hx : x \u2208 s) :\n ((g.subtypePerm hs ^ i) (\u27e8x, hx\u27e9 : s) : \u03b1) = (g ^ i) x\n:= by _unbalancedParenXYZ\nsimp only [subtypePerm_zpow, subtypePerm_apply]\n\nvariable [Fintype \u03b1] [DecidableEq \u03b1]\n\n/-- Restrict a permutation to its support -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=220, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=43), pos_end=Position(line=1, column=49), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nPerm : x\u271d\\n\u03b1 : Type u_2\\ng : sorry\\ns : Finset \u03b1\\nhs : \u2200 (x : \u03b1), sorry \u2208 s \u2194 x \u2208 s\\ni : \u2124\\nx : \u03b1\\nhx : x \u2208 s\\n\u22a2 sorry = sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=25), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=220, i_end=328, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=328, i_end=372, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=44), 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.GroupTheory.Perm.Cycle.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem subtypePerm_apply_zpow_of_mem {g : Perm \u03b1} {s : Finset \u03b1}\n (hs : \u2200 x : \u03b1, g x \u2208 s \u2194 x \u2208 s) {i : \u2124} {x : \u03b1} (hx : x \u2208 s) :\n ((g.subtypePerm hs ^ i) (\u27e8x, hx\u27e9 : s) : \u03b1) = (g ^ i) x\n:= by _unbalancedParenXYZ\nsimp only [subtypePerm_zpow, subtypePerm_apply]\n\nvariable [Fintype \u03b1] [DecidableEq \u03b1]\n\n/-- Restrict a permutation to its support -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=220, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=43), pos_end=Position(line=1, column=49), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nPerm : x\u271d\\n\u03b1 : Type u_2\\ng : sorry\\ns : Finset \u03b1\\nhs : \u2200 (x : \u03b1), sorry \u2208 s \u2194 x \u2208 s\\ni : \u2124\\nx : \u03b1\\nhx : x \u2208 s\\n\u22a2 sorry = sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=25), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=220, i_end=328, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=328, i_end=372, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=44), 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/GroupTheory/Perm/Cycle/Basic.lean", "module": "Mathlib.GroupTheory.Perm.Cycle.Basic", "declaration": "Mathlib.GroupTheory.Perm.Cycle.Basic.subtypePerm_apply_zpow_of_mem", "span": "L966-L973", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Perm/Cycle/Basic.lean#L966"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 741, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2413, "lean_code_chars": 350, "natural_language_chars": 2063, "lean_code_ratio": 0.145, "line_count": 20, "imports_count": 0, "declarations_count": 305, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "bbb6c1bde50710ad", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.PowerSeries.WellKnown.invOneSubPow_add", "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.RingTheory.PowerSeries.WellKnown)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem invOneSubPow_add (e : \u2115) :\n invOneSubPow S (d + e) = invOneSubPow S d * invOneSubPow S e\n:= by thisIsWrongLemmaNameXYZ\nsimp_rw [invOneSubPow_eq_inv_one_sub_pow, pow_add]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=109, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n invOneSubPow\\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 `invOneSubPow` 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=26), severity=, kind=None), Message(data=\"Function expected at\\n invOneSubPow\\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 `invOneSubPow` 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=29), pos_end=Position(line=2, column=45), severity=, kind=None), Message(data=\"Function expected at\\n invOneSubPow\\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 `invOneSubPow` 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=48), pos_end=Position(line=2, column=64), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\ninvOneSubPow : x\u271d\\ne : \u2115\\n\u22a2 sorry = sorry * sorry', 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=109, i_end=182, 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.RingTheory.PowerSeries.WellKnown).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem invOneSubPow_add (e : \u2115) :\n invOneSubPow S (d + e) = invOneSubPow S d * invOneSubPow S e\n:= by thisIsWrongLemmaNameXYZ\nsimp_rw [invOneSubPow_eq_inv_one_sub_pow, pow_add]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=109, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n invOneSubPow\\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 `invOneSubPow` 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=26), severity=, kind=None), Message(data=\"Function expected at\\n invOneSubPow\\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 `invOneSubPow` 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=29), pos_end=Position(line=2, column=45), severity=, kind=None), Message(data=\"Function expected at\\n invOneSubPow\\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 `invOneSubPow` 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=48), pos_end=Position(line=2, column=64), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\ninvOneSubPow : x\u271d\\ne : \u2115\\n\u22a2 sorry = sorry * sorry', 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=109, i_end=182, 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/RingTheory/PowerSeries/WellKnown.lean", "module": "Mathlib.RingTheory.PowerSeries.WellKnown", "declaration": "Mathlib.RingTheory.PowerSeries.WellKnown.invOneSubPow_add", "span": "L163-L166", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/PowerSeries/WellKnown.lean#L163"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 867, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3168, "lean_code_chars": 181, "natural_language_chars": 2987, "lean_code_ratio": 0.0571, "line_count": 15, "imports_count": 0, "declarations_count": 436, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "15b2bf89b70d39ea", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional.AffineIndependent", "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.LinearAlgebra.AffineSpace.FiniteDimensional)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem AffineIndependent.finrank_vectorSpan [Fintype \u03b9] {p : \u03b9 \u2192 P} (hi : AffineIndependent k p)\n {n : \u2115} (hc : Fintype.card \u03b9 = n + 1) : finrank k (vectorSpan k (Set.range p)) = n\n:= by .someMissingNamespaceXYZ\nclassical\n rw [\u2190 Finset.card_univ] at hc\n rw [\u2190 Set.image_univ, \u2190 Finset.coe_univ, \u2190 Finset.coe_image]\n exact hi.finrank_vectorSpan_image_finset hc\n\n/-- The `vectorSpan` of a finite affinely independent family has dimension one less than its\ncardinality. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=200, 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=200, i_end=491, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=10, column=15), 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.LinearAlgebra.AffineSpace.FiniteDimensional).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem AffineIndependent.finrank_vectorSpan [Fintype \u03b9] {p : \u03b9 \u2192 P} (hi : AffineIndependent k p)\n {n : \u2115} (hc : Fintype.card \u03b9 = n + 1) : finrank k (vectorSpan k (Set.range p)) = n\n:= by .someMissingNamespaceXYZ\nclassical\n rw [\u2190 Finset.card_univ] at hc\n rw [\u2190 Set.image_univ, \u2190 Finset.coe_univ, \u2190 Finset.coe_image]\n exact hi.finrank_vectorSpan_image_finset hc\n\n/-- The `vectorSpan` of a finite affinely independent family has dimension one less than its\ncardinality. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=200, 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=200, i_end=491, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=10, column=15), 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/LinearAlgebra/AffineSpace/FiniteDimensional.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional", "declaration": "Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional.AffineIndependent", "span": "L149-L157", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/FiniteDimensional.lean#L149"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 444, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1503, "lean_code_chars": 477, "natural_language_chars": 1026, "lean_code_ratio": 0.3174, "line_count": 21, "imports_count": 0, "declarations_count": 159, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b6433590d14de2a3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.Divisors.divisors_prime_pow", "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.NumberTheory.Divisors)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem divisors_prime_pow {p : \u2115} (pp : p.Prime) (k : \u2115) :\n divisors (p ^ k) = (Finset.range (k + 1)).map \u27e8(p ^ \u00b7), Nat.pow_right_injective pp.two_le\u27e9\n:= by thisIsWrongLemmaNameXYZ\next a\n rw [mem_divisors_prime_pow pp]\n simp [eq_comm]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=171, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n divisors\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (p ^ k)\\n\\nHint: The identifier `divisors` 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=20), severity=, kind=None), Message(data=\"unsolved goals\\nx\u271d : Sort u_1\\ndivisors : x\u271d\\np : \u2115\\npp : Nat.Prime p\\nk : \u2115\\n\u22a2 sorry = Finset.map { toFun := fun x => p ^ x, inj' := \u22ef } (Finset.range (k + 1))\", 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=171, i_end=249, 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.NumberTheory.Divisors).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem divisors_prime_pow {p : \u2115} (pp : p.Prime) (k : \u2115) :\n divisors (p ^ k) = (Finset.range (k + 1)).map \u27e8(p ^ \u00b7), Nat.pow_right_injective pp.two_le\u27e9\n:= by thisIsWrongLemmaNameXYZ\next a\n rw [mem_divisors_prime_pow pp]\n simp [eq_comm]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=171, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n divisors\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (p ^ k)\\n\\nHint: The identifier `divisors` 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=20), severity=, kind=None), Message(data=\"unsolved goals\\nx\u271d : Sort u_1\\ndivisors : x\u271d\\np : \u2115\\npp : Nat.Prime p\\nk : \u2115\\n\u22a2 sorry = Finset.map { toFun := fun x => p ^ x, inj' := \u22ef } (Finset.range (k + 1))\", 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=171, i_end=249, 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/NumberTheory/Divisors.lean", "module": "Mathlib.NumberTheory.Divisors", "declaration": "Mathlib.NumberTheory.Divisors.divisors_prime_pow", "span": "L421-L426", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Divisors.lean#L421"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 621, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2033, "lean_code_chars": 241, "natural_language_chars": 1792, "lean_code_ratio": 0.1185, "line_count": 17, "imports_count": 0, "declarations_count": 254, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "698244d1111e0eb7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Lie.Sl2.mem_toLieSubalgebra_iff", "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.Algebra.Lie.Sl2)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mem_toLieSubalgebra_iff {x : L} {t : IsSl2Triple h e f} :\n x \u2208 t.toLieSubalgebra R \u2194 \u2203 c\u2081 c\u2082 c\u2083 : R, x = c\u2081 \u2022 e + c\u2082 \u2022 f + c\u2083 \u2022 \u2045e, f\u2046\n:= by thisIsWrongLemmaNameXYZ\nsimp_rw [t.lie_e_f, toLieSubalgebra, \u2190 LieSubalgebra.mem_toSubmodule, Submodule.mem_span_triple,\n eq_comm]\n\nnamespace HasPrimitiveVectorWith\n\nvariable {m : M} {\u03bc : R} {t : IsSl2Triple h e f}\nlocal notation \"\u03c8 \" n => ((toEnd R L M f) ^ n) m\n\n-- Although this is true by definition, we include this lemma (and the assumption) to mirror the API\n-- for `lie_h_pow_toEnd_f` and `lie_e_pow_succ_toEnd_f`.\nset_option linter.unusedVariables false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=179, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n CommRing R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=8), pos_end=Position(line=2, column=27), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Bracket L L\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=73), pos_end=Position(line=2, column=79), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HSMul R L ?m.31\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=50), pos_end=Position(line=2, column=56), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LieRing L\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=60), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='unsolved goals\\nL : Type u_1\\nh e f : L\\nR : Type u_2\\nx : L\\nt : IsSl2Triple h e f\\n\u22a2 x \u2208 sorry \u2194 \u2203 c\u2081 c\u2082 c\u2083, sorry', 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=179, i_end=349, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=349, i_end=399, messages=[Message(data='typeclass instance problem is stuck\\n LieRing ?m.9\\n\\nNote: Lean will not try to resolve this typeclass instance problem because the type argument to `LieRing` 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=9, column=30), pos_end=Position(line=9, column=47), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=399, i_end=608, messages=[Message(data='Unknown identifier `toEnd` at quotation precheck\\n\\nNote: You can use `set_option quotPrecheck false` to disable this check.', pos=Position(line=10, column=27), pos_end=Position(line=10, column=32), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=608, i_end=650, messages=[Message(data='unexpected end of input', pos=Position(line=14, column=42), 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.Algebra.Lie.Sl2).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mem_toLieSubalgebra_iff {x : L} {t : IsSl2Triple h e f} :\n x \u2208 t.toLieSubalgebra R \u2194 \u2203 c\u2081 c\u2082 c\u2083 : R, x = c\u2081 \u2022 e + c\u2082 \u2022 f + c\u2083 \u2022 \u2045e, f\u2046\n:= by thisIsWrongLemmaNameXYZ\nsimp_rw [t.lie_e_f, toLieSubalgebra, \u2190 LieSubalgebra.mem_toSubmodule, Submodule.mem_span_triple,\n eq_comm]\n\nnamespace HasPrimitiveVectorWith\n\nvariable {m : M} {\u03bc : R} {t : IsSl2Triple h e f}\nlocal notation \"\u03c8 \" n => ((toEnd R L M f) ^ n) m\n\n-- Although this is true by definition, we include this lemma (and the assumption) to mirror the API\n-- for `lie_h_pow_toEnd_f` and `lie_e_pow_succ_toEnd_f`.\nset_option linter.unusedVariables false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=179, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n CommRing R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=8), pos_end=Position(line=2, column=27), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Bracket L L\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=73), pos_end=Position(line=2, column=79), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HSMul R L ?m.31\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=50), pos_end=Position(line=2, column=56), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LieRing L\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=60), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='unsolved goals\\nL : Type u_1\\nh e f : L\\nR : Type u_2\\nx : L\\nt : IsSl2Triple h e f\\n\u22a2 x \u2208 sorry \u2194 \u2203 c\u2081 c\u2082 c\u2083, sorry', 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=179, i_end=349, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=349, i_end=399, messages=[Message(data='typeclass instance problem is stuck\\n LieRing ?m.9\\n\\nNote: Lean will not try to resolve this typeclass instance problem because the type argument to `LieRing` 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=9, column=30), pos_end=Position(line=9, column=47), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=399, i_end=608, messages=[Message(data='Unknown identifier `toEnd` at quotation precheck\\n\\nNote: You can use `set_option quotPrecheck false` to disable this check.', pos=Position(line=10, column=27), pos_end=Position(line=10, column=32), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=608, i_end=650, messages=[Message(data='unexpected end of input', pos=Position(line=14, column=42), 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/Algebra/Lie/Sl2.lean", "module": "Mathlib.Algebra.Lie.Sl2", "declaration": "Mathlib.Algebra.Lie.Sl2.mem_toLieSubalgebra_iff", "span": "L138-L150", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Sl2.lean#L138"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1326, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4640, "lean_code_chars": 619, "natural_language_chars": 4021, "lean_code_ratio": 0.1334, "line_count": 25, "imports_count": 0, "declarations_count": 570, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "77172cab6d705898", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.PFunctor.Multivariate.M.M", "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.Data.PFunctor.Multivariate.M)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem M.dest_corec' {\u03b1 : TypeVec.{u} n} {\u03b2 : Type v} (g\u2080 : \u03b2 \u2192 P.A)\n (g\u2081 : \u2200 b : \u03b2, P.drop.B (g\u2080 b) \u27f9 \u03b1) (g\u2082 : \u2200 b : \u03b2, P.last.B (g\u2080 b) \u2192 \u03b2) (x : \u03b2) :\n M.dest P (M.corec' P g\u2080 g\u2081 g\u2082 x) = \u27e8g\u2080 x, splitFun (g\u2081 x) (M.corec' P g\u2080 g\u2081 g\u2082 \u2218 g\u2082 x)\u27e9\n:= _unbalancedParenXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=119, messages=[Message(data='expected token', pos=Position(line=2, column=35), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=119, i_end=326, 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.Data.PFunctor.Multivariate.M).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem M.dest_corec' {\u03b1 : TypeVec.{u} n} {\u03b2 : Type v} (g\u2080 : \u03b2 \u2192 P.A)\n (g\u2081 : \u2200 b : \u03b2, P.drop.B (g\u2080 b) \u27f9 \u03b1) (g\u2082 : \u2200 b : \u03b2, P.last.B (g\u2080 b) \u2192 \u03b2) (x : \u03b2) :\n M.dest P (M.corec' P g\u2080 g\u2081 g\u2082 x) = \u27e8g\u2080 x, splitFun (g\u2081 x) (M.corec' P g\u2080 g\u2081 g\u2082 \u2218 g\u2082 x)\u27e9\n:= _unbalancedParenXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=119, messages=[Message(data='expected token', pos=Position(line=2, column=35), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=119, i_end=326, 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/Data/PFunctor/Multivariate/M.lean", "module": "Mathlib.Data.PFunctor.Multivariate.M", "declaration": "Mathlib.Data.PFunctor.Multivariate.M.M", "span": "L189-L193", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/PFunctor/Multivariate/M.lean#L189"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 393, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1141, "lean_code_chars": 275, "natural_language_chars": 866, "lean_code_ratio": 0.241, "line_count": 16, "imports_count": 0, "declarations_count": 134, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a7de36cbba1ba99f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.Filter.Map.singleton_mem_pure", "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.Order.Filter.Map)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem singleton_mem_pure {a : \u03b1} : {a} \u2208 (pure a : Filter \u03b1)\n:= thisIsWrongLemmaNameXYZ\nmem_singleton a\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=109, messages=[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)]\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.Order.Filter.Map).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem singleton_mem_pure {a : \u03b1} : {a} \u2208 (pure a : Filter \u03b1)\n:= thisIsWrongLemmaNameXYZ\nmem_singleton a\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=109, messages=[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)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Filter/Map.lean", "module": "Mathlib.Order.Filter.Map", "declaration": "Mathlib.Order.Filter.Map.singleton_mem_pure", "span": "L827-L829", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Filter/Map.lean#L827"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 251, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 909, "lean_code_chars": 106, "natural_language_chars": 803, "lean_code_ratio": 0.1166, "line_count": 14, "imports_count": 0, "declarations_count": 93, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1acd0a74c21cc329", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.ContinuousMap.Compact.enorm_eq_iSup_enorm", "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.Topology.ContinuousMap.Compact)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem enorm_eq_iSup_enorm : \u2016f\u2016\u2091 = \u2a06 x, \u2016f x\u2016\u2091\n:= thisIsWrongLemmaNameXYZ\n(mkOfCompact f).enorm_eq_iSup_enorm\n\n-- A version with better keys\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=156, messages=[Message(data=\"Function expected at\\n f\\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 `f` 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=43), pos_end=Position(line=1, column=46), 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)]\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.Topology.ContinuousMap.Compact).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem enorm_eq_iSup_enorm : \u2016f\u2016\u2091 = \u2a06 x, \u2016f x\u2016\u2091\n:= thisIsWrongLemmaNameXYZ\n(mkOfCompact f).enorm_eq_iSup_enorm\n\n-- A version with better keys\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=156, messages=[Message(data=\"Function expected at\\n f\\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 `f` 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=43), pos_end=Position(line=1, column=46), 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)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/ContinuousMap/Compact.lean", "module": "Mathlib.Topology.ContinuousMap.Compact", "declaration": "Mathlib.Topology.ContinuousMap.Compact.enorm_eq_iSup_enorm", "span": "L230-L233", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/ContinuousMap/Compact.lean#L230"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 434, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1569, "lean_code_chars": 143, "natural_language_chars": 1426, "lean_code_ratio": 0.0911, "line_count": 16, "imports_count": 0, "declarations_count": 198, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9968a1ddec50e7f4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Convex.Between.Sbtw", "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.Analysis.Convex.Between)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Sbtw.left_ne_right {x y z : P} (h : Sbtw R x y z) : x \u2260 z\n frobnicateTacticThatDoesNotExist :=\nh.wbtw.left_ne_right_of_ne_left h.2.1\n\nvariable (R) in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=145, messages=[Message(data='`Sbtw.left_ne_right` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=26), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=145, i_end=160, messages=[Message(data='unexpected end of input', pos=Position(line=5, column=15), 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.Analysis.Convex.Between).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Sbtw.left_ne_right {x y z : P} (h : Sbtw R x y z) : x \u2260 z\n frobnicateTacticThatDoesNotExist :=\nh.wbtw.left_ne_right_of_ne_left h.2.1\n\nvariable (R) in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=145, messages=[Message(data='`Sbtw.left_ne_right` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=26), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=145, i_end=160, messages=[Message(data='unexpected end of input', pos=Position(line=5, column=15), 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/Analysis/Convex/Between.lean", "module": "Mathlib.Analysis.Convex.Between", "declaration": "Mathlib.Analysis.Convex.Between.Sbtw", "span": "L437-L440", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Between.lean#L437"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 354, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1201, "lean_code_chars": 159, "natural_language_chars": 1042, "lean_code_ratio": 0.1324, "line_count": 16, "imports_count": 0, "declarations_count": 133, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5d2cfe3209bc9577", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Enumerative.Composition.ne_single_iff", "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.Combinatorics.Enumerative.Composition)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ne_single_iff {n : \u2115} (hn : 0 < n) {c : Composition n} :\n c \u2260 single n hn \u2194 \u2200 i, c.blocksFun i < n\n:= by .someMissingNamespaceXYZ\ncontrapose!\n constructor\n \u00b7 rintro rfl\n exact \u27e8\u27e80, by simp\u27e9, by simp\u27e9\n \u00b7 rintro \u27e8i, hi\u27e9\n rw [eq_single_iff_length]\n have : \u2200 j : Fin c.length, j = i := by\n intro j\n by_contra ji\n apply lt_irrefl (\u2211 k, c.blocksFun k)\n calc\n \u2211 k, c.blocksFun k \u2264 c.blocksFun i := by simp only [c.sum_blocksFun, hi]\n _ < \u2211 k, c.blocksFun k :=\n Finset.single_lt_sum ji (Finset.mem_univ _) (Finset.mem_univ _) (c.one_le_blocksFun j)\n fun _ _ _ => zero_le _\n simpa using Fintype.card_eq_one_of_forall_eq this\n\nvariable {m : \u2115}\n\n/-- Change `n` in `(c : Composition n)` to a propositionally equal value. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=126, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n single\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n n\\n\\nHint: The identifier `single` 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=8), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nsingle : x\u271d\\nn : \u2115\\nhn : 0 < n\\nc : Composition n\\n\u22a2 c \u2260 sorry \u2194 \u2200 (i : Fin c.length), c.blocksFun i < n', 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=126, i_end=749, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=749, i_end=825, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=23, column=76), 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.Combinatorics.Enumerative.Composition).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ne_single_iff {n : \u2115} (hn : 0 < n) {c : Composition n} :\n c \u2260 single n hn \u2194 \u2200 i, c.blocksFun i < n\n:= by .someMissingNamespaceXYZ\ncontrapose!\n constructor\n \u00b7 rintro rfl\n exact \u27e8\u27e80, by simp\u27e9, by simp\u27e9\n \u00b7 rintro \u27e8i, hi\u27e9\n rw [eq_single_iff_length]\n have : \u2200 j : Fin c.length, j = i := by\n intro j\n by_contra ji\n apply lt_irrefl (\u2211 k, c.blocksFun k)\n calc\n \u2211 k, c.blocksFun k \u2264 c.blocksFun i := by simp only [c.sum_blocksFun, hi]\n _ < \u2211 k, c.blocksFun k :=\n Finset.single_lt_sum ji (Finset.mem_univ _) (Finset.mem_univ _) (c.one_le_blocksFun j)\n fun _ _ _ => zero_le _\n simpa using Fintype.card_eq_one_of_forall_eq this\n\nvariable {m : \u2115}\n\n/-- Change `n` in `(c : Composition n)` to a propositionally equal value. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=126, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n single\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n n\\n\\nHint: The identifier `single` 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=8), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nsingle : x\u271d\\nn : \u2115\\nhn : 0 < n\\nc : Composition n\\n\u22a2 c \u2260 sorry \u2194 \u2200 (i : Fin c.length), c.blocksFun i < n', 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=126, i_end=749, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=749, i_end=825, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=23, column=76), 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/Combinatorics/Enumerative/Composition.lean", "module": "Mathlib.Combinatorics.Enumerative.Composition", "declaration": "Mathlib.Combinatorics.Enumerative.Composition.ne_single_iff", "span": "L559-L580", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Enumerative/Composition.lean#L559"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 873, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2846, "lean_code_chars": 792, "natural_language_chars": 2054, "lean_code_ratio": 0.2783, "line_count": 34, "imports_count": 0, "declarations_count": 352, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "583b8e896e5531fa", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.MonoidLocalization.Away.Away", "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.GroupTheory.MonoidLocalization.Away)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev Away\n:= .someMissingNamespaceXYZ\nLocalization (Submonoid.powers x)\n\n/-- Given `x : M`, `invSelf` is `x\u207b\u00b9` in the Localization (as a quotient type) of `M` at the\nSubmonoid generated by `x`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=75, messages=[Message(data='Invalid dotted identifier notation: The expected type of `.someMissingNamespaceXYZ` could not be determined', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.invalidDottedIdent._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=75, i_end=201, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, 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.GroupTheory.MonoidLocalization.Away).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev Away\n:= .someMissingNamespaceXYZ\nLocalization (Submonoid.powers x)\n\n/-- Given `x : M`, `invSelf` is `x\u207b\u00b9` in the Localization (as a quotient type) of `M` at the\nSubmonoid generated by `x`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=75, messages=[Message(data='Invalid dotted identifier notation: The expected type of `.someMissingNamespaceXYZ` could not be determined', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.invalidDottedIdent._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=75, i_end=201, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, 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/GroupTheory/MonoidLocalization/Away.lean", "module": "Mathlib.GroupTheory.MonoidLocalization.Away", "declaration": "Mathlib.GroupTheory.MonoidLocalization.Away.Away", "span": "L142-L146", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/MonoidLocalization/Away.lean#L142"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 378, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1363, "lean_code_chars": 199, "natural_language_chars": 1164, "lean_code_ratio": 0.146, "line_count": 17, "imports_count": 0, "declarations_count": 150, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4ab887a4b1b6acc1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.RootsOfUnity.Complex.IsPrimitiveRoot", "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.RingTheory.RootsOfUnity.Complex)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsPrimitiveRoot.norm'_eq_one {\u03b6 : \u2102} {n : \u2115} (h : IsPrimitiveRoot \u03b6 n) (hn : n \u2260 0) :\n \u2016\u03b6\u2016 = 1\n:= \u27e8\u27e9\u27e8\u27e9\nComplex.norm_eq_one_of_pow_eq_one h.pow_eq_one hn\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=128, messages=[Message(data=\"`IsPrimitiveRoot.norm'_eq_one` has already been declared\", pos=Position(line=1, column=8), pos_end=Position(line=1, column=36), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=128, i_end=184, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=5), pos_end=Position(line=3, 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.RingTheory.RootsOfUnity.Complex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsPrimitiveRoot.norm'_eq_one {\u03b6 : \u2102} {n : \u2115} (h : IsPrimitiveRoot \u03b6 n) (hn : n \u2260 0) :\n \u2016\u03b6\u2016 = 1\n:= \u27e8\u27e9\u27e8\u27e9\nComplex.norm_eq_one_of_pow_eq_one h.pow_eq_one hn\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=128, messages=[Message(data=\"`IsPrimitiveRoot.norm'_eq_one` has already been declared\", pos=Position(line=1, column=8), pos_end=Position(line=1, column=36), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=128, i_end=184, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=5), pos_end=Position(line=3, 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/RingTheory/RootsOfUnity/Complex.lean", "module": "Mathlib.RingTheory.RootsOfUnity.Complex", "declaration": "Mathlib.RingTheory.RootsOfUnity.Complex.IsPrimitiveRoot", "span": "L132-L135", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/RootsOfUnity/Complex.lean#L132"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 383, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1260, "lean_code_chars": 164, "natural_language_chars": 1096, "lean_code_ratio": 0.1302, "line_count": 15, "imports_count": 0, "declarations_count": 126, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b947cd6c91b22764", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Complex.Module.mem_unitary_iff_isStarNormal_and_realPart_sq_add_imaginaryPart_sq_eq_one", "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.LinearAlgebra.Complex.Module)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mem_unitary_iff_isStarNormal_and_realPart_sq_add_imaginaryPart_sq_eq_one [Ring A]\n [StarRing A] [Module \u2102 A] [SMulCommClass \u2102 A A] [IsScalarTower \u2102 A A] [StarModule \u2102 A] {x : A} :\n x \u2208 unitary A \u2194 IsStarNormal x \u2227 \u211c x ^ 2 + \u2111 x ^ 2 = (1 : A)\n:= by \u27e8\u27e9\u27e8\u27e9\nrw [Unitary.mem_iff]\n refine \u27e8fun \u27e8h, h'\u27e9 \u21a6 ?_, fun \u27e8hx, h\u27e9 \u21a6 ?_\u27e9\n \u00b7 have : IsStarNormal x := \u27e8h.trans h'.symm\u27e9\n exact \u27e8this, by simp [sq, \u2190 star_mul_self_eq_realPart_sq_add_imaginaryPart_sq x, h]\u27e9\n \u00b7 simp [\u2190 hx.star_comm_self.eq, star_mul_self_eq_realPart_sq_add_imaginaryPart_sq, \u2190 sq, h]\n\nend RealImaginaryPart\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=278, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=4, column=5), pos_end=Position(line=4, column=7), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=278, i_end=642, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=11, column=0), pos_end=Position(line=11, column=21), 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.LinearAlgebra.Complex.Module).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma mem_unitary_iff_isStarNormal_and_realPart_sq_add_imaginaryPart_sq_eq_one [Ring A]\n [StarRing A] [Module \u2102 A] [SMulCommClass \u2102 A A] [IsScalarTower \u2102 A A] [StarModule \u2102 A] {x : A} :\n x \u2208 unitary A \u2194 IsStarNormal x \u2227 \u211c x ^ 2 + \u2111 x ^ 2 = (1 : A)\n:= by \u27e8\u27e9\u27e8\u27e9\nrw [Unitary.mem_iff]\n refine \u27e8fun \u27e8h, h'\u27e9 \u21a6 ?_, fun \u27e8hx, h\u27e9 \u21a6 ?_\u27e9\n \u00b7 have : IsStarNormal x := \u27e8h.trans h'.symm\u27e9\n exact \u27e8this, by simp [sq, \u2190 star_mul_self_eq_realPart_sq_add_imaginaryPart_sq x, h]\u27e9\n \u00b7 simp [\u2190 hx.star_comm_self.eq, star_mul_self_eq_realPart_sq_add_imaginaryPart_sq, \u2190 sq, h]\n\nend RealImaginaryPart\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=278, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=4, column=5), pos_end=Position(line=4, column=7), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=278, i_end=642, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=11, column=0), pos_end=Position(line=11, column=21), 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/LinearAlgebra/Complex/Module.lean", "module": "Mathlib.LinearAlgebra.Complex.Module", "declaration": "Mathlib.LinearAlgebra.Complex.Module.mem_unitary_iff_isStarNormal_and_realPart_sq_add_imaginaryPart_sq_eq_one", "span": "L598-L607", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Complex/Module.lean#L598"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 577, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1740, "lean_code_chars": 585, "natural_language_chars": 1155, "lean_code_ratio": 0.3362, "line_count": 22, "imports_count": 0, "declarations_count": 187, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6892d317149faf35", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.PythagoreanTriples.classified", "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.NumberTheory.PythagoreanTriples)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem classified : h.IsClassified\n:= by thisIsWrongLemmaNameXYZ\nby_cases h0 : Int.gcd x y = 0\n \u00b7 have hx : x = 0 := by\n apply Int.natAbs_eq_zero.mp\n apply Nat.eq_zero_of_gcd_eq_zero_left h0\n have hy : y = 0 := by\n apply Int.natAbs_eq_zero.mp\n apply Nat.eq_zero_of_gcd_eq_zero_right h0\n use 0, 1, 0\n simp [hx, hy]\n apply h.isClassified_of_normalize_isPrimitiveClassified\n apply h.normalize.isPrimitiveClassified_of_coprime\n apply Int.gcd_div_gcd_div_gcd (Nat.pos_of_ne_zero h0)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=43, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `h.IsClassified`', pos=Position(line=1, column=21), pos_end=Position(line=1, column=35), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u22a2 sorry', 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=43, i_end=512, 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.NumberTheory.PythagoreanTriples).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem classified : h.IsClassified\n:= by thisIsWrongLemmaNameXYZ\nby_cases h0 : Int.gcd x y = 0\n \u00b7 have hx : x = 0 := by\n apply Int.natAbs_eq_zero.mp\n apply Nat.eq_zero_of_gcd_eq_zero_left h0\n have hy : y = 0 := by\n apply Int.natAbs_eq_zero.mp\n apply Nat.eq_zero_of_gcd_eq_zero_right h0\n use 0, 1, 0\n simp [hx, hy]\n apply h.isClassified_of_normalize_isPrimitiveClassified\n apply h.normalize.isPrimitiveClassified_of_coprime\n apply Int.gcd_div_gcd_div_gcd (Nat.pos_of_ne_zero h0)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=43, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `h.IsClassified`', pos=Position(line=1, column=21), pos_end=Position(line=1, column=35), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u22a2 sorry', 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=43, i_end=512, 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/NumberTheory/PythagoreanTriples.lean", "module": "Mathlib.NumberTheory.PythagoreanTriples", "declaration": "Mathlib.NumberTheory.PythagoreanTriples.classified", "span": "L529-L542", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/PythagoreanTriples.lean#L529"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 517, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1743, "lean_code_chars": 512, "natural_language_chars": 1231, "lean_code_ratio": 0.2937, "line_count": 25, "imports_count": 0, "declarations_count": 167, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "fee5f41c8492f290", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Field.Subfield.Basic.mem_fieldRange_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.Algebra.Field.Subfield.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_fieldRange_self (x : K) : f x \u2208 f.fieldRange\n:= .someMissingNamespaceXYZ\nexists_apply_eq_apply _ _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=112, messages=[Message(data='Invalid field notation: Type of\\n f\\nis not known; cannot resolve field `fieldRange`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AlgHom.fieldRange`\\n \u2022 `RingHom.fieldRange`', pos=Position(line=1, column=44), pos_end=Position(line=1, column=56), severity=, kind='lean.invalidField._namedError'), Message(data=\"Function expected at\\n f\\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 `f` 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=38), pos_end=Position(line=1, column=41), 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.Algebra.Field.Subfield.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_fieldRange_self (x : K) : f x \u2208 f.fieldRange\n:= .someMissingNamespaceXYZ\nexists_apply_eq_apply _ _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=112, messages=[Message(data='Invalid field notation: Type of\\n f\\nis not known; cannot resolve field `fieldRange`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AlgHom.fieldRange`\\n \u2022 `RingHom.fieldRange`', pos=Position(line=1, column=44), pos_end=Position(line=1, column=56), severity=, kind='lean.invalidField._namedError'), Message(data=\"Function expected at\\n f\\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 `f` 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=38), pos_end=Position(line=1, column=41), 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/Algebra/Field/Subfield/Basic.lean", "module": "Mathlib.Algebra.Field.Subfield.Basic", "declaration": "Mathlib.Algebra.Field.Subfield.Basic.mem_fieldRange_self", "span": "L208-L210", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Field/Subfield/Basic.lean#L208"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 456, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1709, "lean_code_chars": 111, "natural_language_chars": 1598, "lean_code_ratio": 0.065, "line_count": 14, "imports_count": 0, "declarations_count": 224, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "249b52c97c6cf1d3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Rat.BigOperators.cast_list_sum", "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.Data.Rat.BigOperators)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem cast_list_sum (s : List \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum\n:= .someMissingNamespaceXYZ\nmap_list_sum (Rat.castHom \u03b1) _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=134, messages=[Message(data='Type mismatch\\n s.sum\\nhas type\\n \u211a\\nbut is expected to have type\\n \u03b1', pos=Position(line=1, column=38), pos_end=Position(line=1, column=44), severity=, kind=None), Message(data='cannot coerce\\n x\\nto type\\n \u03b1', pos=Position(line=1, column=59), pos_end=Position(line=1, column=62), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Add \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=52), pos_end=Position(line=1, column=67), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Zero \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=52), pos_end=Position(line=1, column=67), severity=, kind='lean.synthInstanceFailed._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.Data.Rat.BigOperators).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem cast_list_sum (s : List \u211a) : (\u2191s.sum : \u03b1) = (s.map (\u2191)).sum\n:= .someMissingNamespaceXYZ\nmap_list_sum (Rat.castHom \u03b1) _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=134, messages=[Message(data='Type mismatch\\n s.sum\\nhas type\\n \u211a\\nbut is expected to have type\\n \u03b1', pos=Position(line=1, column=38), pos_end=Position(line=1, column=44), severity=, kind=None), Message(data='cannot coerce\\n x\\nto type\\n \u03b1', pos=Position(line=1, column=59), pos_end=Position(line=1, column=62), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Add \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=52), pos_end=Position(line=1, column=67), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Zero \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=52), pos_end=Position(line=1, column=67), severity=, kind='lean.synthInstanceFailed._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/Data/Rat/BigOperators.lean", "module": "Mathlib.Data.Rat.BigOperators", "declaration": "Mathlib.Data.Rat.BigOperators.cast_list_sum", "span": "L25-L27", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Rat/BigOperators.lean#L25"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 502, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1778, "lean_code_chars": 127, "natural_language_chars": 1651, "lean_code_ratio": 0.0714, "line_count": 14, "imports_count": 0, "declarations_count": 204, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "802a1ace328fe207", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.Filter.CountableInter.EventuallyLE", "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.Order.Filter.CountableInter)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem EventuallyLE.countable_bUnion {\u03b9 : Type*} {S : Set \u03b9} (hS : S.Countable)\n {s t : \u2200 i \u2208 S, Set \u03b1} (h : \u2200 i hi, s i hi \u2264\u1da0[l] t i hi) :\n \u22c3 i \u2208 S, s i \u2039_\u203a \u2264\u1da0[l] \u22c3 i \u2208 S, t i \u2039_\u203a\n frobnicateTacticThatDoesNotExist := by\nsimp only [biUnion_eq_iUnion]\n haveI := hS.toEncodable\n exact EventuallyLE.countable_iUnion fun i => h i i.2\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=294, messages=[Message(data='`EventuallyLE.countable_bUnion` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=37), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=294, i_end=372, messages=[Message(data=\"unexpected token 'haveI'; expected command\", pos=Position(line=6, column=2), pos_end=Position(line=6, column=7), 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.Order.Filter.CountableInter).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem EventuallyLE.countable_bUnion {\u03b9 : Type*} {S : Set \u03b9} (hS : S.Countable)\n {s t : \u2200 i \u2208 S, Set \u03b1} (h : \u2200 i hi, s i hi \u2264\u1da0[l] t i hi) :\n \u22c3 i \u2208 S, s i \u2039_\u203a \u2264\u1da0[l] \u22c3 i \u2208 S, t i \u2039_\u203a\n frobnicateTacticThatDoesNotExist := by\nsimp only [biUnion_eq_iUnion]\n haveI := hS.toEncodable\n exact EventuallyLE.countable_iUnion fun i => h i i.2\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=294, messages=[Message(data='`EventuallyLE.countable_bUnion` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=37), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=294, i_end=372, messages=[Message(data=\"unexpected token 'haveI'; expected command\", pos=Position(line=6, column=2), pos_end=Position(line=6, column=7), 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/Order/Filter/CountableInter.lean", "module": "Mathlib.Order.Filter.CountableInter", "declaration": "Mathlib.Order.Filter.CountableInter.EventuallyLE", "span": "L93-L99", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Filter/CountableInter.lean#L93"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 448, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1437, "lean_code_chars": 340, "natural_language_chars": 1097, "lean_code_ratio": 0.2366, "line_count": 18, "imports_count": 0, "declarations_count": 163, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "09900e5e1e35efd2", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.MetricSpace.Basic.isClosedEmbedding_of_pairwise_le_dist", "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.Topology.MetricSpace.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isClosedEmbedding_of_pairwise_le_dist {\u03b1 : Type*} [TopologicalSpace \u03b1] [DiscreteTopology \u03b1]\n {\u03b5 : \u211d} (h\u03b5 : 0 < \u03b5) {f : \u03b1 \u2192 \u03b3} (hf : Pairwise fun x y => \u03b5 \u2264 dist (f x) (f y)) :\n IsClosedEmbedding f\n:= thisIsWrongLemmaNameXYZ\nisClosedEmbedding_of_spaced_out (dist_mem_uniformity h\u03b5) <| by simpa using hf\n\n/-- If `f : \u03b2 \u2192 \u03b1` sends any two distinct points to points at distance at least `\u03b5 > 0`, then\n`f` is a uniform embedding with respect to the discrete uniformity on `\u03b2`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=333, messages=[Message(data='failed to synthesize instance of type class\\n Dist \u03b3\\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=\"Function expected at\\n IsClosedEmbedding\\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 `IsClosedEmbedding` 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=3, column=4), pos_end=Position(line=3, column=23), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=4, column=3), pos_end=Position(line=4, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=333, i_end=510, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=77), 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.Topology.MetricSpace.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isClosedEmbedding_of_pairwise_le_dist {\u03b1 : Type*} [TopologicalSpace \u03b1] [DiscreteTopology \u03b1]\n {\u03b5 : \u211d} (h\u03b5 : 0 < \u03b5) {f : \u03b1 \u2192 \u03b3} (hf : Pairwise fun x y => \u03b5 \u2264 dist (f x) (f y)) :\n IsClosedEmbedding f\n:= thisIsWrongLemmaNameXYZ\nisClosedEmbedding_of_spaced_out (dist_mem_uniformity h\u03b5) <| by simpa using hf\n\n/-- If `f : \u03b2 \u2192 \u03b1` sends any two distinct points to points at distance at least `\u03b5 > 0`, then\n`f` is a uniform embedding with respect to the discrete uniformity on `\u03b2`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=333, messages=[Message(data='failed to synthesize instance of type class\\n Dist \u03b3\\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=\"Function expected at\\n IsClosedEmbedding\\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 `IsClosedEmbedding` 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=3, column=4), pos_end=Position(line=3, column=23), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=4, column=3), pos_end=Position(line=4, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=333, i_end=510, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=77), 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/Topology/MetricSpace/Basic.lean", "module": "Mathlib.Topology.MetricSpace.Basic", "declaration": "Mathlib.Topology.MetricSpace.Basic.isClosedEmbedding_of_pairwise_le_dist", "span": "L60-L66", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/MetricSpace/Basic.lean#L60"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 706, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2565, "lean_code_chars": 489, "natural_language_chars": 2076, "lean_code_ratio": 0.1906, "line_count": 19, "imports_count": 0, "declarations_count": 305, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ffa87513bdf2e372", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.SpecialFunctions.Pow.NNReal.lt_rpow_inv_iff_of_neg", "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.Analysis.SpecialFunctions.Pow.NNReal)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma lt_rpow_inv_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) : x < y ^ z\u207b\u00b9 \u2194 y < x ^ z\n:= .someMissingNamespaceXYZ\nReal.lt_rpow_inv_iff_of_neg hx hy hz\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=163, messages=[Message(data='failed to synthesize instance of type class\\n Inv \u2115\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=78), pos_end=Position(line=1, column=81), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown constant `Iff.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n x < y ^ z\u207b\u00b9 \u2194 y < x ^ z', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), 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.Analysis.SpecialFunctions.Pow.NNReal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma lt_rpow_inv_iff_of_neg (hx : 0 < x) (hy : 0 < y) (hz : z < 0) : x < y ^ z\u207b\u00b9 \u2194 y < x ^ z\n:= .someMissingNamespaceXYZ\nReal.lt_rpow_inv_iff_of_neg hx hy hz\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=163, messages=[Message(data='failed to synthesize instance of type class\\n Inv \u2115\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=78), pos_end=Position(line=1, column=81), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown constant `Iff.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n x < y ^ z\u207b\u00b9 \u2194 y < x ^ z', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), 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/Analysis/SpecialFunctions/Pow/NNReal.lean", "module": "Mathlib.Analysis.SpecialFunctions.Pow.NNReal", "declaration": "Mathlib.Analysis.SpecialFunctions.Pow.NNReal.lt_rpow_inv_iff_of_neg", "span": "L315-L317", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Pow/NNReal.lean#L315"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 424, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1445, "lean_code_chars": 159, "natural_language_chars": 1286, "lean_code_ratio": 0.11, "line_count": 14, "imports_count": 0, "declarations_count": 160, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f8a4c63f37e2db6b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Enumerative.DyckWord.insidePart_add", "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.Combinatorics.Enumerative.DyckWord)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma insidePart_add : (p + q).insidePart = p.insidePart\n:= by _unbalancedParenXYZ\nsimp_rw [insidePart, firstReturn_add, add_eq_zero', h, false_and, dite_false, ite_false,\n DyckWord.ext_iff, take]\n congr 3\n exact take_append_of_le_length (firstReturn_lt_length h)\n\ninclude h in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=64, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='Invalid field notation: Type of\\n p + q\\nis not known; cannot resolve field `insidePart`\\n\\nHint: Consider replacing the field projection `.insidePart` with a call to the function `DyckWord.insidePart`.', pos=Position(line=1, column=23), pos_end=Position(line=1, column=41), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n p\\nis not known; cannot resolve field `insidePart`\\n\\nHint: Consider replacing the field projection `.insidePart` with a call to the function `DyckWord.insidePart`.', pos=Position(line=1, column=44), pos_end=Position(line=1, column=56), severity=, kind='lean.invalidField._namedError'), Message(data='unsolved goals\\nx\u271d\u00b9 : Type u_1\\np : x\u271d\u00b9\\nx\u271d : Type u_2\\nq : x\u271d\\n\u22a2 sorry = 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=64, i_end=282, messages=[Message(data='unexpected end of input', pos=Position(line=8, column=12), 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.Combinatorics.Enumerative.DyckWord).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma insidePart_add : (p + q).insidePart = p.insidePart\n:= by _unbalancedParenXYZ\nsimp_rw [insidePart, firstReturn_add, add_eq_zero', h, false_and, dite_false, ite_false,\n DyckWord.ext_iff, take]\n congr 3\n exact take_append_of_le_length (firstReturn_lt_length h)\n\ninclude h in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=64, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='Invalid field notation: Type of\\n p + q\\nis not known; cannot resolve field `insidePart`\\n\\nHint: Consider replacing the field projection `.insidePart` with a call to the function `DyckWord.insidePart`.', pos=Position(line=1, column=23), pos_end=Position(line=1, column=41), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n p\\nis not known; cannot resolve field `insidePart`\\n\\nHint: Consider replacing the field projection `.insidePart` with a call to the function `DyckWord.insidePart`.', pos=Position(line=1, column=44), pos_end=Position(line=1, column=56), severity=, kind='lean.invalidField._namedError'), Message(data='unsolved goals\\nx\u271d\u00b9 : Type u_1\\np : x\u271d\u00b9\\nx\u271d : Type u_2\\nq : x\u271d\\n\u22a2 sorry = 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=64, i_end=282, messages=[Message(data='unexpected end of input', pos=Position(line=8, column=12), 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/Combinatorics/Enumerative/DyckWord.lean", "module": "Mathlib.Combinatorics.Enumerative.DyckWord", "declaration": "Mathlib.Combinatorics.Enumerative.DyckWord.insidePart_add", "span": "L353-L359", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Enumerative/DyckWord.lean#L353"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 654, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2218, "lean_code_chars": 283, "natural_language_chars": 1935, "lean_code_ratio": 0.1276, "line_count": 19, "imports_count": 0, "declarations_count": 250, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "4c052fe4c29997eb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.GroupAction.FixedPoints.set_mem_fixedBy_of_subset_fixedBy", "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.GroupTheory.GroupAction.FixedPoints)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem set_mem_fixedBy_of_subset_fixedBy {s : Set \u03b1} {g : G} (s_ss_fixedBy : s \u2286 fixedBy \u03b1 g) :\n s \u2208 fixedBy (Set \u03b1) g\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 fixedBy_inv]\n ext x\n rw [Set.mem_inv_smul_set_iff]\n refine \u27e8fun gxs => ?xs, fun xs => (s_ss_fixedBy xs).symm \u25b8 xs\u27e9\n rw [\u2190 fixedBy_inv] at s_ss_fixedBy\n rwa [\u2190 s_ss_fixedBy gxs, inv_smul_smul] at gxs\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=137, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n fixedBy\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `fixedBy` 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=82), pos_end=Position(line=1, column=93), severity=, kind=None), Message(data=\"Function expected at\\n fixedBy\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Set \u03b1)\\n\\nHint: The identifier `fixedBy` 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=8), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data='unsolved goals\\n\u03b1 : Type u_1\\nG : Sort u_2\\nx\u271d : Sort u_3\\nfixedBy : x\u271d\\ns : Set \u03b1\\ng : G\\ns_ss_fixedBy : s \u2286 sorry\\n\u22a2 s \u2208 sorry', 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=137, i_end=381, 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.GroupTheory.GroupAction.FixedPoints).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem set_mem_fixedBy_of_subset_fixedBy {s : Set \u03b1} {g : G} (s_ss_fixedBy : s \u2286 fixedBy \u03b1 g) :\n s \u2208 fixedBy (Set \u03b1) g\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 fixedBy_inv]\n ext x\n rw [Set.mem_inv_smul_set_iff]\n refine \u27e8fun gxs => ?xs, fun xs => (s_ss_fixedBy xs).symm \u25b8 xs\u27e9\n rw [\u2190 fixedBy_inv] at s_ss_fixedBy\n rwa [\u2190 s_ss_fixedBy gxs, inv_smul_smul] at gxs\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=137, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n fixedBy\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `fixedBy` 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=82), pos_end=Position(line=1, column=93), severity=, kind=None), Message(data=\"Function expected at\\n fixedBy\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Set \u03b1)\\n\\nHint: The identifier `fixedBy` 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=8), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data='unsolved goals\\n\u03b1 : Type u_1\\nG : Sort u_2\\nx\u271d : Sort u_3\\nfixedBy : x\u271d\\ns : Set \u03b1\\ng : G\\ns_ss_fixedBy : s \u2286 sorry\\n\u22a2 s \u2208 sorry', 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=137, i_end=381, 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/GroupTheory/GroupAction/FixedPoints.lean", "module": "Mathlib.GroupTheory.GroupAction.FixedPoints", "declaration": "Mathlib.GroupTheory.GroupAction.FixedPoints.set_mem_fixedBy_of_subset_fixedBy", "span": "L157-L165", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/GroupAction/FixedPoints.lean#L157"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 817, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2756, "lean_code_chars": 363, "natural_language_chars": 2393, "lean_code_ratio": 0.1317, "line_count": 20, "imports_count": 0, "declarations_count": 370, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6fc840c69685d387", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.SimpleModule.Isotypic.LinearEquiv", "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.RingTheory.SimpleModule.Isotypic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem LinearEquiv.isIsotypicOfType_iff (e : M \u2243\u2097[R] N) :\n IsIsotypicOfType R M S \u2194 IsIsotypicOfType R N S\n frobnicateTacticThatDoesNotExist :=\n\u27e8(\u00b7.of_injective _ e.symm.injective), (\u00b7.of_injective _ e.injective)\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=230, messages=[Message(data='`LinearEquiv.isIsotypicOfType_iff` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=40), 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.RingTheory.SimpleModule.Isotypic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem LinearEquiv.isIsotypicOfType_iff (e : M \u2243\u2097[R] N) :\n IsIsotypicOfType R M S \u2194 IsIsotypicOfType R N S\n frobnicateTacticThatDoesNotExist :=\n\u27e8(\u00b7.of_injective _ e.symm.injective), (\u00b7.of_injective _ e.injective)\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=230, messages=[Message(data='`LinearEquiv.isIsotypicOfType_iff` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=40), 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/RingTheory/SimpleModule/Isotypic.lean", "module": "Mathlib.RingTheory.SimpleModule.Isotypic", "declaration": "Mathlib.RingTheory.SimpleModule.Isotypic.LinearEquiv", "span": "L107-L110", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/SimpleModule/Isotypic.lean#L107"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 307, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1022, "lean_code_chars": 219, "natural_language_chars": 803, "lean_code_ratio": 0.2143, "line_count": 15, "imports_count": 0, "declarations_count": 106, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "7f03f1f0afc25fb6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition.Submodule", "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.LinearAlgebra.Dimension.FreeAndStrongRankCondition)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Submodule.rank_le_one_iff_isPrincipal (W : Submodule K V) [Module.Free K W] :\n Module.rank K W \u2264 1 \u2194 W.IsPrincipal\n:= by thisIsWrongLemmaNameXYZ\nsimp only [rank_le_one_iff, Submodule.isPrincipal_iff, le_antisymm_iff, le_span_singleton_iff,\n span_singleton_le_iff_mem]\n constructor\n \u00b7 rintro \u27e8\u27e8m, hm\u27e9, hm'\u27e9\n choose f hf using hm'\n exact \u27e8m, \u27e8fun v hv => \u27e8f \u27e8v, hv\u27e9, congr_arg ((\u2191) : W \u2192 V) (hf \u27e8v, hv\u27e9)\u27e9, hm\u27e9\u27e9\n \u00b7 rintro \u27e8a, \u27e8h, ha\u27e9\u27e9\n choose f hf using h\n exact \u27e8\u27e8a, ha\u27e9, fun v => \u27e8f v.1 v.2, Subtype.ext (hf v.1 v.2)\u27e9\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=137, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=137, i_end=604, 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.LinearAlgebra.Dimension.FreeAndStrongRankCondition).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Submodule.rank_le_one_iff_isPrincipal (W : Submodule K V) [Module.Free K W] :\n Module.rank K W \u2264 1 \u2194 W.IsPrincipal\n:= by thisIsWrongLemmaNameXYZ\nsimp only [rank_le_one_iff, Submodule.isPrincipal_iff, le_antisymm_iff, le_span_singleton_iff,\n span_singleton_le_iff_mem]\n constructor\n \u00b7 rintro \u27e8\u27e8m, hm\u27e9, hm'\u27e9\n choose f hf using hm'\n exact \u27e8m, \u27e8fun v hv => \u27e8f \u27e8v, hv\u27e9, congr_arg ((\u2191) : W \u2192 V) (hf \u27e8v, hv\u27e9)\u27e9, hm\u27e9\u27e9\n \u00b7 rintro \u27e8a, \u27e8h, ha\u27e9\u27e9\n choose f hf using h\n exact \u27e8\u27e8a, ha\u27e9, fun v => \u27e8f v.1 v.2, Subtype.ext (hf v.1 v.2)\u27e9\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=137, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=137, i_end=604, 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/LinearAlgebra/Dimension/FreeAndStrongRankCondition.lean", "module": "Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition", "declaration": "Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition.Submodule", "span": "L159-L170", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Dimension/FreeAndStrongRankCondition.lean#L159"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 490, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1434, "lean_code_chars": 547, "natural_language_chars": 887, "lean_code_ratio": 0.3815, "line_count": 23, "imports_count": 0, "declarations_count": 160, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "487b47dd5f64e344", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.LegendreSymbol.AddCharacter.IsPrimitive", "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.NumberTheory.LegendreSymbol.AddCharacter)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsPrimitive.of_ne_one {F : Type u} [Field F] {\u03c8 : AddChar F R'} (h\u03c8 : \u03c8 \u2260 1) :\n IsPrimitive \u03c8\n:= \u27e8\u27e9\u27e8\u27e9\nfun a ha h \u21a6 h\u03c8 <| by simpa [mulShift_mulShift, ha] using congr_arg (mulShift \u00b7 a\u207b\u00b9) h\n\n/-- If `r` is not a unit, then `e.mulShift r` is not primitive. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=120, messages=[Message(data=\"failed to synthesize instance of type class\\n Monoid R'\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.\", pos=Position(line=1, column=58), pos_end=Position(line=1, column=70), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n IsPrimitive\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c8\\n\\nHint: The identifier `IsPrimitive` 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=17), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=120, i_end=288, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=66), 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.NumberTheory.LegendreSymbol.AddCharacter).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsPrimitive.of_ne_one {F : Type u} [Field F] {\u03c8 : AddChar F R'} (h\u03c8 : \u03c8 \u2260 1) :\n IsPrimitive \u03c8\n:= \u27e8\u27e9\u27e8\u27e9\nfun a ha h \u21a6 h\u03c8 <| by simpa [mulShift_mulShift, ha] using congr_arg (mulShift \u00b7 a\u207b\u00b9) h\n\n/-- If `r` is not a unit, then `e.mulShift r` is not primitive. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=120, messages=[Message(data=\"failed to synthesize instance of type class\\n Monoid R'\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.\", pos=Position(line=1, column=58), pos_end=Position(line=1, column=70), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n IsPrimitive\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03c8\\n\\nHint: The identifier `IsPrimitive` 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=17), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=120, i_end=288, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=66), 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/NumberTheory/LegendreSymbol/AddCharacter.lean", "module": "Mathlib.NumberTheory.LegendreSymbol.AddCharacter", "declaration": "Mathlib.NumberTheory.LegendreSymbol.AddCharacter.IsPrimitive", "span": "L84-L88", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LegendreSymbol/AddCharacter.lean#L84"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 648, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2310, "lean_code_chars": 268, "natural_language_chars": 2042, "lean_code_ratio": 0.116, "line_count": 17, "imports_count": 0, "declarations_count": 291, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "356f998a59ceaa78", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.CubicDiscriminant.ne_zero_of_a_ne_zero", "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.Algebra.CubicDiscriminant)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ne_zero_of_a_ne_zero (ha : P.a \u2260 0) : P.toPoly \u2260 0\n:= thisIsWrongLemmaNameXYZ\n(or_imp.mp ne_zero).1 ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=114, messages=[Message(data='Unknown identifier `P.a`', pos=Position(line=1, column=35), pos_end=Position(line=1, column=38), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `P.toPoly`', pos=Position(line=1, column=46), pos_end=Position(line=1, column=54), severity=, kind='lean.unknownIdentifier._namedError'), 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)]\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.Algebra.CubicDiscriminant).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ne_zero_of_a_ne_zero (ha : P.a \u2260 0) : P.toPoly \u2260 0\n:= thisIsWrongLemmaNameXYZ\n(or_imp.mp ne_zero).1 ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=114, messages=[Message(data='Unknown identifier `P.a`', pos=Position(line=1, column=35), pos_end=Position(line=1, column=38), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `P.toPoly`', pos=Position(line=1, column=46), pos_end=Position(line=1, column=54), severity=, kind='lean.unknownIdentifier._namedError'), 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)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/CubicDiscriminant.lean", "module": "Mathlib.Algebra.CubicDiscriminant", "declaration": "Mathlib.Algebra.CubicDiscriminant.ne_zero_of_a_ne_zero", "span": "L162-L164", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/CubicDiscriminant.lean#L162"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 374, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1298, "lean_code_chars": 111, "natural_language_chars": 1187, "lean_code_ratio": 0.0855, "line_count": 14, "imports_count": 0, "declarations_count": 126, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ce1b162ab95b266f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Set.Basic.union_empty", "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.Data.Set.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem union_empty (a : Set \u03b1) : a \u222a \u2205 = a\n:= thisIsWrongLemmaNameXYZ\next fun _ => iff_of_eq (or_false _)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=111, messages=[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)]\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.Data.Set.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem union_empty (a : Set \u03b1) : a \u222a \u2205 = a\n:= thisIsWrongLemmaNameXYZ\next fun _ => iff_of_eq (or_false _)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=111, messages=[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)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Basic.lean", "module": "Mathlib.Data.Set.Basic", "declaration": "Mathlib.Data.Set.Basic.union_empty", "span": "L618-L620", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Basic.lean#L618"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 256, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 908, "lean_code_chars": 107, "natural_language_chars": 801, "lean_code_ratio": 0.1178, "line_count": 14, "imports_count": 0, "declarations_count": 96, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f77cb79b47e3c491", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.LiminfLimsup.limsSup_eq_iInf_sSup", "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.Order.LiminfLimsup)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem limsSup_eq_iInf_sSup {f : Filter \u03b1} : limsSup f = \u2a05 s \u2208 f, sSup s\n:= .someMissingNamespaceXYZ\nf.basis_sets.limsSup_eq_iInf_sSup\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=140, messages=[Message(data='failed to synthesize instance of type class\\n SupSet \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=67), pos_end=Position(line=1, column=73), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n InfSet \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=58), pos_end=Position(line=1, column=73), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n InfSet \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=58), pos_end=Position(line=1, column=73), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n limsSup\\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 `limsSup` 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=46), pos_end=Position(line=1, column=55), 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.Order.LiminfLimsup).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem limsSup_eq_iInf_sSup {f : Filter \u03b1} : limsSup f = \u2a05 s \u2208 f, sSup s\n:= .someMissingNamespaceXYZ\nf.basis_sets.limsSup_eq_iInf_sSup\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=140, messages=[Message(data='failed to synthesize instance of type class\\n SupSet \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=67), pos_end=Position(line=1, column=73), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n InfSet \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=58), pos_end=Position(line=1, column=73), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n InfSet \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=58), pos_end=Position(line=1, column=73), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n limsSup\\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 `limsSup` 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=46), pos_end=Position(line=1, column=55), 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/Order/LiminfLimsup.lean", "module": "Mathlib.Order.LiminfLimsup", "declaration": "Mathlib.Order.LiminfLimsup.limsSup_eq_iInf_sSup", "span": "L381-L383", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/LiminfLimsup.lean#L381"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 634, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2393, "lean_code_chars": 136, "natural_language_chars": 2257, "lean_code_ratio": 0.0568, "line_count": 14, "imports_count": 0, "declarations_count": 295, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "c762a0ca9c17e8e3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Algebra.GroupCompletion.instAddCommGroup", "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.Topology.Algebra.GroupCompletion)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance instAddCommGroup : AddCommGroup (Completion \u03b1)\n:= _unbalancedParenXYZ\n{ (inferInstance : AddGroup <| Completion \u03b1) with\n add_comm a b :=\n Completion.induction_on\u2082 a b\n (isClosed_eq (by fun_prop) (by fun_prop))\n fun x y \u21a6 by\n change (x : Completion \u03b1) + \u2191y = \u2191y + \u2191x\n rw [\u2190 coe_add, \u2190 coe_add, add_comm] }\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=366, messages=[Message(data=\"Function expected at\\n Completion\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Completion` 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=42), pos_end=Position(line=1, column=54), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), 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.Topology.Algebra.GroupCompletion).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance instAddCommGroup : AddCommGroup (Completion \u03b1)\n:= _unbalancedParenXYZ\n{ (inferInstance : AddGroup <| Completion \u03b1) with\n add_comm a b :=\n Completion.induction_on\u2082 a b\n (isClosed_eq (by fun_prop) (by fun_prop))\n fun x y \u21a6 by\n change (x : Completion \u03b1) + \u2191y = \u2191y + \u2191x\n rw [\u2190 coe_add, \u2190 coe_add, add_comm] }\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=366, messages=[Message(data=\"Function expected at\\n Completion\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Completion` 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=42), pos_end=Position(line=1, column=54), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), 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/Topology/Algebra/GroupCompletion.lean", "module": "Mathlib.Topology.Algebra.GroupCompletion", "declaration": "Mathlib.Topology.Algebra.GroupCompletion.instAddCommGroup", "span": "L195-L203", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/GroupCompletion.lean#L195"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 487, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1792, "lean_code_chars": 350, "natural_language_chars": 1442, "lean_code_ratio": 0.1953, "line_count": 20, "imports_count": 0, "declarations_count": 216, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f1f7431a9448cbf9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Calculus.DerivativeTest.isLocalMax_of_deriv_deriv_neg", "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.Analysis.Calculus.DerivativeTest)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isLocalMax_of_deriv_deriv_neg (hf : deriv (deriv f) x\u2080 < 0) (hd : deriv f x\u2080 = 0)\n (hc : ContinuousAt f x\u2080) : IsLocalMax f x\u2080\n:= by thisIsWrongLemmaNameXYZ\nsimpa using isLocalMin_of_deriv_deriv_pos (by simpa) (by simpa) hc.neg |>.neg\n\nend SecondDeriv\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=152, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=152, i_end=269, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=6, column=0), pos_end=Position(line=6, column=15), 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.Analysis.Calculus.DerivativeTest).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isLocalMax_of_deriv_deriv_neg (hf : deriv (deriv f) x\u2080 < 0) (hd : deriv f x\u2080 = 0)\n (hc : ContinuousAt f x\u2080) : IsLocalMax f x\u2080\n:= by thisIsWrongLemmaNameXYZ\nsimpa using isLocalMin_of_deriv_deriv_pos (by simpa) (by simpa) hc.neg |>.neg\n\nend SecondDeriv\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=152, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=152, i_end=269, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=6, column=0), pos_end=Position(line=6, column=15), 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/Analysis/Calculus/DerivativeTest.lean", "module": "Mathlib.Analysis.Calculus.DerivativeTest", "declaration": "Mathlib.Analysis.Calculus.DerivativeTest.isLocalMax_of_deriv_deriv_neg", "span": "L208-L212", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/DerivativeTest.lean#L208"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 412, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1367, "lean_code_chars": 262, "natural_language_chars": 1105, "lean_code_ratio": 0.1917, "line_count": 17, "imports_count": 0, "declarations_count": 155, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "91d72c69c1cf3a80", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph.connected_iff_forall_exists_walk_subgraph", "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.Combinatorics.SimpleGraph.Connectivity.Subgraph)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma connected_iff_forall_exists_walk_subgraph (H : G.Subgraph) :\n H.Connected \u2194\n H.verts.Nonempty \u2227\n \u2200 {u v}, u \u2208 H.verts \u2192 v \u2208 H.verts \u2192 \u2203 p : G.Walk u v, p.toSubgraph \u2264 H\n:= by _unbalancedParenXYZ\nrw [H.connected_iff, preconnected_iff_forall_exists_walk_subgraph, and_comm]\n\nend Subgraph\n\nsection induced_subgraphs\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=215, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `G.Subgraph`', pos=Position(line=1, column=53), pos_end=Position(line=1, column=63), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `G.Walk`', pos=Position(line=4, column=51), pos_end=Position(line=4, column=57), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nH : sorry\\n\u22a2 sorry \u2194 sorry \u2227 \u2200 {u : ?m.18 H} {v : ?m.19 H}, u \u2208 sorry \u2192 v \u2208 sorry \u2192 \u2203 p, sorry', pos=Position(line=5, column=3), pos_end=Position(line=5, column=25), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=215, i_end=326, messages=[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=12), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=326, i_end=353, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=353, i_end=409, messages=[Message(data='unexpected end of input', pos=Position(line=12, 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.Combinatorics.SimpleGraph.Connectivity.Subgraph).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma connected_iff_forall_exists_walk_subgraph (H : G.Subgraph) :\n H.Connected \u2194\n H.verts.Nonempty \u2227\n \u2200 {u v}, u \u2208 H.verts \u2192 v \u2208 H.verts \u2192 \u2203 p : G.Walk u v, p.toSubgraph \u2264 H\n:= by _unbalancedParenXYZ\nrw [H.connected_iff, preconnected_iff_forall_exists_walk_subgraph, and_comm]\n\nend Subgraph\n\nsection induced_subgraphs\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=215, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `G.Subgraph`', pos=Position(line=1, column=53), pos_end=Position(line=1, column=63), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `G.Walk`', pos=Position(line=4, column=51), pos_end=Position(line=4, column=57), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nH : sorry\\n\u22a2 sorry \u2194 sorry \u2227 \u2200 {u : ?m.18 H} {v : ?m.19 H}, u \u2208 sorry \u2192 v \u2208 sorry \u2192 \u2203 p, sorry', pos=Position(line=5, column=3), pos_end=Position(line=5, column=25), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=215, i_end=326, messages=[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=12), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=326, i_end=353, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=353, i_end=409, messages=[Message(data='unexpected end of input', pos=Position(line=12, 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/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph", "declaration": "Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph.connected_iff_forall_exists_walk_subgraph", "span": "L573-L583", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean#L573"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 751, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2546, "lean_code_chars": 392, "natural_language_chars": 2154, "lean_code_ratio": 0.154, "line_count": 23, "imports_count": 0, "declarations_count": 263, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "81dc5836a1d66e9a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.Subgroup.Centralizer.le_centralizer_iff_isMulCommutative", "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.GroupTheory.Subgroup.Centralizer)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem le_centralizer_iff_isMulCommutative : K \u2264 centralizer K \u2194 IsMulCommutative K\n:= _unbalancedParenXYZ\n\u27e8fun h => \u27e8\u27e8fun x y => Subtype.ext (h y.2 x x.2)\u27e9\u27e9,\n fun h x hx y hy => congr_arg Subtype.val (h.1.1 \u27e8y, hy\u27e9 \u27e8x, hx\u27e9)\u27e9\n\nvariable (H)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=255, messages=[Message(data='failed to synthesize instance of type class\\n Mul K\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=66), pos_end=Position(line=1, column=84), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LE (Type ?u.335)\\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=63), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n centralizer\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `centralizer` 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=63), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=255, i_end=267, 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.GroupTheory.Subgroup.Centralizer).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem le_centralizer_iff_isMulCommutative : K \u2264 centralizer K \u2194 IsMulCommutative K\n:= _unbalancedParenXYZ\n\u27e8fun h => \u27e8\u27e8fun x y => Subtype.ext (h y.2 x x.2)\u27e9\u27e9,\n fun h x hx y hy => congr_arg Subtype.val (h.1.1 \u27e8y, hy\u27e9 \u27e8x, hx\u27e9)\u27e9\n\nvariable (H)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=255, messages=[Message(data='failed to synthesize instance of type class\\n Mul K\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=66), pos_end=Position(line=1, column=84), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n LE (Type ?u.335)\\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=63), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n centralizer\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `centralizer` 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=63), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=255, i_end=267, 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/GroupTheory/Subgroup/Centralizer.lean", "module": "Mathlib.GroupTheory.Subgroup.Centralizer", "declaration": "Mathlib.GroupTheory.Subgroup.Centralizer.le_centralizer_iff_isMulCommutative", "span": "L89-L94", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Subgroup/Centralizer.lean#L89"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 709, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2518, "lean_code_chars": 244, "natural_language_chars": 2274, "lean_code_ratio": 0.0969, "line_count": 17, "imports_count": 0, "declarations_count": 309, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "fd86b015687b6fc3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.Int.Basic.prime_iff_natAbs_prime", "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.RingTheory.Int.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem prime_iff_natAbs_prime {k : \u2124} : Prime k \u2194 Nat.Prime k.natAbs\n frobnicateTacticThatDoesNotExist :=\n(Int.associated_natAbs k).prime_iff.trans Nat.prime_iff_prime_int.symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=182, messages=[Message(data='Function expected at\\n Nat.Prime k.natAbs\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=51), pos_end=Position(line=2, column=34), 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.RingTheory.Int.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem prime_iff_natAbs_prime {k : \u2124} : Prime k \u2194 Nat.Prime k.natAbs\n frobnicateTacticThatDoesNotExist :=\n(Int.associated_natAbs k).prime_iff.trans Nat.prime_iff_prime_int.symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=182, messages=[Message(data='Function expected at\\n Nat.Prime k.natAbs\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=51), pos_end=Position(line=2, column=34), 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/RingTheory/Int/Basic.lean", "module": "Mathlib.RingTheory.Int.Basic", "declaration": "Mathlib.RingTheory.Int.Basic.prime_iff_natAbs_prime", "span": "L105-L107", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Int/Basic.lean#L105"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 314, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1101, "lean_code_chars": 179, "natural_language_chars": 922, "lean_code_ratio": 0.1626, "line_count": 14, "imports_count": 0, "declarations_count": 121, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "68dd442a7e53744b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Projection.ofIsCompl_smul", "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.LinearAlgebra.Projection)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ofIsCompl_smul {R : Type*} [CommRing R] {E : Type*} [AddCommGroup E] [Module R E]\n {F : Type*} [AddCommGroup F] [Module R F] {p q : Submodule R E} (h : IsCompl p q)\n {\u03c6 : p \u2192\u2097[R] F} {\u03c8 : q \u2192\u2097[R] F} (c : R) : ofIsCompl h (c \u2022 \u03c6) (c \u2022 \u03c8) = c \u2022 ofIsCompl h \u03c6 \u03c8\n frobnicateTacticThatDoesNotExist :=\nofIsCompl_eq _ (by simp) (by simp)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=364, messages=[Message(data=\"Function expected at\\n ofIsCompl\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n h\\n\\nHint: The identifier `ofIsCompl` 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=3, column=46), pos_end=Position(line=3, column=73), severity=, kind=None), Message(data=\"Function expected at\\n ofIsCompl\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n h\\n\\nHint: The identifier `ofIsCompl` 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=3, column=80), pos_end=Position(line=4, column=34), severity=, kind=None), Message(data='Unknown identifier `ofIsCompl_eq`', pos=Position(line=5, column=0), pos_end=Position(line=5, column=12), 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.LinearAlgebra.Projection).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ofIsCompl_smul {R : Type*} [CommRing R] {E : Type*} [AddCommGroup E] [Module R E]\n {F : Type*} [AddCommGroup F] [Module R F] {p q : Submodule R E} (h : IsCompl p q)\n {\u03c6 : p \u2192\u2097[R] F} {\u03c8 : q \u2192\u2097[R] F} (c : R) : ofIsCompl h (c \u2022 \u03c6) (c \u2022 \u03c8) = c \u2022 ofIsCompl h \u03c6 \u03c8\n frobnicateTacticThatDoesNotExist :=\nofIsCompl_eq _ (by simp) (by simp)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=364, messages=[Message(data=\"Function expected at\\n ofIsCompl\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n h\\n\\nHint: The identifier `ofIsCompl` 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=3, column=46), pos_end=Position(line=3, column=73), severity=, kind=None), Message(data=\"Function expected at\\n ofIsCompl\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n h\\n\\nHint: The identifier `ofIsCompl` 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=3, column=80), pos_end=Position(line=4, column=34), severity=, kind=None), Message(data='Unknown identifier `ofIsCompl_eq`', pos=Position(line=5, column=0), pos_end=Position(line=5, column=12), 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/LinearAlgebra/Projection.lean", "module": "Mathlib.LinearAlgebra.Projection", "declaration": "Mathlib.LinearAlgebra.Projection.ofIsCompl_smul", "span": "L349-L353", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Projection.lean#L349"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 690, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2395, "lean_code_chars": 345, "natural_language_chars": 2050, "lean_code_ratio": 0.1441, "line_count": 16, "imports_count": 0, "declarations_count": 334, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a7e14c3f5f3034bc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody.minkowskiBound_lt_top", "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.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem minkowskiBound_lt_top : minkowskiBound K I < \u22a4\n:= by .someMissingNamespaceXYZ\nclassical\n -- FIXME: Make `finiteness` work here\n exact ENNReal.mul_lt_top (fundamentalDomain_isBounded _).measure_lt_top <|\n ENNReal.pow_lt_top ENNReal.ofNat_lt_top\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n minkowskiBound\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `minkowskiBound` 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=32), pos_end=Position(line=1, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nminkowskiBound : x\u271d\\n\u22a2 sorry < \u22a4', pos=Position(line=2, column=6), pos_end=Position(line=2, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=258, 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.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem minkowskiBound_lt_top : minkowskiBound K I < \u22a4\n:= by .someMissingNamespaceXYZ\nclassical\n -- FIXME: Make `finiteness` work here\n exact ENNReal.mul_lt_top (fundamentalDomain_isBounded _).measure_lt_top <|\n ENNReal.pow_lt_top ENNReal.ofNat_lt_top\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n minkowskiBound\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `minkowskiBound` 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=32), pos_end=Position(line=1, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nminkowskiBound : x\u271d\\n\u22a2 sorry < \u22a4', pos=Position(line=2, column=6), pos_end=Position(line=2, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=258, 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/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean", "module": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody", "declaration": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody.minkowskiBound_lt_top", "span": "L460-L465", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean#L460"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 561, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1990, "lean_code_chars": 257, "natural_language_chars": 1733, "lean_code_ratio": 0.1291, "line_count": 17, "imports_count": 0, "declarations_count": 235, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "7472ece878830c36", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Order.GroupWithZero.Unbundled.Basic.inv_lt_one_iff\u2080", "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.Algebra.Order.GroupWithZero.Unbundled.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma inv_lt_one_iff\u2080 : a\u207b\u00b9 < 1 \u2194 a \u2264 0 \u2228 1 < a\n:= by thisIsWrongLemmaNameXYZ\nsimp_rw [\u2190 not_le, one_le_inv_iff\u2080, not_and_or, not_lt]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=66, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=66, i_end=148, 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.Algebra.Order.GroupWithZero.Unbundled.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma inv_lt_one_iff\u2080 : a\u207b\u00b9 < 1 \u2194 a \u2264 0 \u2228 1 < a\n:= by thisIsWrongLemmaNameXYZ\nsimp_rw [\u2190 not_le, one_le_inv_iff\u2080, not_and_or, not_lt]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=66, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=66, i_end=148, 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/Algebra/Order/GroupWithZero/Unbundled/Basic.lean", "module": "Mathlib.Algebra.Order.GroupWithZero.Unbundled.Basic", "declaration": "Mathlib.Algebra.Order.GroupWithZero.Unbundled.Basic.inv_lt_one_iff\u2080", "span": "L1331-L1333", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/GroupWithZero/Unbundled/Basic.lean#L1331"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 298, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1012, "lean_code_chars": 134, "natural_language_chars": 878, "lean_code_ratio": 0.1324, "line_count": 14, "imports_count": 0, "declarations_count": 104, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1f6f5bebc06bd1b0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Finsupp.Single.zipWith_single_single", "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.Data.Finsupp.Single)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem zipWith_single_single (f : M \u2192 N \u2192 P) (hf : f 0 0 = 0) (a : \u03b1) (m : M) (n : N) :\n zipWith f hf (single a m) (single a n) = single a (f m n)\n:= by \u27e8\u27e9\u27e8\u27e9\nclassical\n grind\n\nend ZipWith\nend Finsupp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=7), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n OfNat M 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n M\\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=54), pos_end=Position(line=1, column=55), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat N 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n N\\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=56), pos_end=Position(line=1, column=57), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat P 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n P\\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=60), pos_end=Position(line=1, column=61), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n zipWith\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `zipWith` 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=\"Function expected at\\n single\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `single` 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=45), pos_end=Position(line=2, column=61), severity=, kind=None), Message(data='unsolved goals\\nM : Type u_1\\nN : Type u_2\\nP : Type u_3\\n\u03b1 : Sort u_4\\nx\u271d\u00b9 : Sort u_5\\nzipWith : x\u271d\u00b9\\nx\u271d : Sort u_6\\nsingle : x\u271d\\nf : M \u2192 N \u2192 P\\nhf : f sorry sorry = 0\\na : \u03b1\\nm : M\\nn : N\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=162, i_end=206, messages=[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=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=206, i_end=217, messages=[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)]\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.Data.Finsupp.Single).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem zipWith_single_single (f : M \u2192 N \u2192 P) (hf : f 0 0 = 0) (a : \u03b1) (m : M) (n : N) :\n zipWith f hf (single a m) (single a n) = single a (f m n)\n:= by \u27e8\u27e9\u27e8\u27e9\nclassical\n grind\n\nend ZipWith\nend Finsupp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=7), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n OfNat M 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n M\\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=54), pos_end=Position(line=1, column=55), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat N 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n N\\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=56), pos_end=Position(line=1, column=57), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat P 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n P\\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=60), pos_end=Position(line=1, column=61), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n zipWith\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `zipWith` 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=\"Function expected at\\n single\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `single` 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=45), pos_end=Position(line=2, column=61), severity=, kind=None), Message(data='unsolved goals\\nM : Type u_1\\nN : Type u_2\\nP : Type u_3\\n\u03b1 : Sort u_4\\nx\u271d\u00b9 : Sort u_5\\nzipWith : x\u271d\u00b9\\nx\u271d : Sort u_6\\nsingle : x\u271d\\nf : M \u2192 N \u2192 P\\nhf : f sorry sorry = 0\\na : \u03b1\\nm : M\\nn : N\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=162, i_end=206, messages=[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=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=206, i_end=217, messages=[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)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Finsupp/Single.lean", "module": "Mathlib.Data.Finsupp.Single", "declaration": "Mathlib.Data.Finsupp.Single.zipWith_single_single", "span": "L449-L455", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finsupp/Single.lean#L449"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1361, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4819, "lean_code_chars": 205, "natural_language_chars": 4614, "lean_code_ratio": 0.0425, "line_count": 19, "imports_count": 0, "declarations_count": 668, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ef3dcdc24a9d086a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.Interval.Set.OrdConnectedComponent.ordConnectedComponent_subset", "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.Order.Interval.Set.OrdConnectedComponent)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ordConnectedComponent_subset : ordConnectedComponent s x \u2286 s\n:= fun _ hy => .someMissingNamespaceXYZ\nhy right_mem_uIcc\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=128, messages=[Message(data=\"Function expected at\\n ordConnectedComponent\\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 `ordConnectedComponent` 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=39), pos_end=Position(line=1, column=64), severity=, kind=None), Message(data='Invalid dotted identifier notation: The expected type of `.someMissingNamespaceXYZ` could not be determined', pos=Position(line=2, column=15), pos_end=Position(line=2, column=39), severity=, kind='lean.invalidDottedIdent._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.Order.Interval.Set.OrdConnectedComponent).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ordConnectedComponent_subset : ordConnectedComponent s x \u2286 s\n:= fun _ hy => .someMissingNamespaceXYZ\nhy right_mem_uIcc\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=128, messages=[Message(data=\"Function expected at\\n ordConnectedComponent\\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 `ordConnectedComponent` 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=39), pos_end=Position(line=1, column=64), severity=, kind=None), Message(data='Invalid dotted identifier notation: The expected type of `.someMissingNamespaceXYZ` could not be determined', pos=Position(line=2, column=15), pos_end=Position(line=2, column=39), severity=, kind='lean.invalidDottedIdent._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/Order/Interval/Set/OrdConnectedComponent.lean", "module": "Mathlib.Order.Interval.Set.OrdConnectedComponent", "declaration": "Mathlib.Order.Interval.Set.OrdConnectedComponent.ordConnectedComponent_subset", "span": "L41-L43", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Set/OrdConnectedComponent.lean#L41"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 425, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1668, "lean_code_chars": 127, "natural_language_chars": 1541, "lean_code_ratio": 0.0761, "line_count": 14, "imports_count": 0, "declarations_count": 205, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "16c8cc06981d8bea", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Separation.SeparatedNhds.preimage", "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.Topology.Separation.SeparatedNhds)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem preimage [TopologicalSpace Y] {f : X \u2192 Y} {s t : Set Y} (h : SeparatedNhds s t)\n (hf : Continuous f) : SeparatedNhds (f \u207b\u00b9' s) (f \u207b\u00b9' t)\n:= thisIsWrongLemmaNameXYZ\nlet \u27e8U, V, oU, oV, sU, tV, UV\u27e9 := h\n \u27e8f \u207b\u00b9' U, f \u207b\u00b9' V, oU.preimage hf, oV.preimage hf, preimage_mono sU, preimage_mono tV,\n UV.preimage f\u27e9\n\nprotected theorem disjoint (h : SeparatedNhds s t) : Disjoint s t :=\n let \u27e8_, _, _, _, hsU, htV, hd\u27e9 := h; hd.mono hsU htV\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=183, messages=[Message(data='failed to synthesize instance of type class\\n TopologicalSpace X\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=10), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n TopologicalSpace X\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=26), pos_end=Position(line=2, column=59), severity=, kind='lean.synthInstanceFailed._namedError'), 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), CompilationUnit(i_begin=183, i_end=469, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=3), severity=, kind=None), Message(data='protected declarations must be in a namespace', pos=Position(line=8, column=18), pos_end=Position(line=8, column=26), 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.Topology.Separation.SeparatedNhds).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem preimage [TopologicalSpace Y] {f : X \u2192 Y} {s t : Set Y} (h : SeparatedNhds s t)\n (hf : Continuous f) : SeparatedNhds (f \u207b\u00b9' s) (f \u207b\u00b9' t)\n:= thisIsWrongLemmaNameXYZ\nlet \u27e8U, V, oU, oV, sU, tV, UV\u27e9 := h\n \u27e8f \u207b\u00b9' U, f \u207b\u00b9' V, oU.preimage hf, oV.preimage hf, preimage_mono sU, preimage_mono tV,\n UV.preimage f\u27e9\n\nprotected theorem disjoint (h : SeparatedNhds s t) : Disjoint s t :=\n let \u27e8_, _, _, _, hsU, htV, hd\u27e9 := h; hd.mono hsU htV\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=183, messages=[Message(data='failed to synthesize instance of type class\\n TopologicalSpace X\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=10), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n TopologicalSpace X\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=26), pos_end=Position(line=2, column=59), severity=, kind='lean.synthInstanceFailed._namedError'), 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), CompilationUnit(i_begin=183, i_end=469, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=3), severity=, kind=None), Message(data='protected declarations must be in a namespace', pos=Position(line=8, column=18), pos_end=Position(line=8, column=26), 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/Topology/Separation/SeparatedNhds.lean", "module": "Mathlib.Topology.Separation.SeparatedNhds", "declaration": "Mathlib.Topology.Separation.SeparatedNhds.preimage", "span": "L131-L139", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Separation/SeparatedNhds.lean#L131"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 732, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2448, "lean_code_chars": 444, "natural_language_chars": 2004, "lean_code_ratio": 0.1814, "line_count": 20, "imports_count": 0, "declarations_count": 284, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "cd425d4c641b40c0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Convex.Function.StrictConvexOn", "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.Analysis.Convex.Function)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem StrictConvexOn.sub_concaveOn (hf : StrictConvexOn \ud835\udd5c s f) (hg : ConcaveOn \ud835\udd5c s g) :\n StrictConvexOn \ud835\udd5c s (f - g)\n:= thisIsWrongLemmaNameXYZ\n(sub_eq_add_neg f g).symm \u25b8 hf.add_convexOn hg.neg\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=209, messages=[Message(data='`StrictConvexOn.sub_concaveOn` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=36), 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.Analysis.Convex.Function).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem StrictConvexOn.sub_concaveOn (hf : StrictConvexOn \ud835\udd5c s f) (hg : ConcaveOn \ud835\udd5c s g) :\n StrictConvexOn \ud835\udd5c s (f - g)\n:= thisIsWrongLemmaNameXYZ\n(sub_eq_add_neg f g).symm \u25b8 hf.add_convexOn hg.neg\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=209, messages=[Message(data='`StrictConvexOn.sub_concaveOn` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=36), 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/Analysis/Convex/Function.lean", "module": "Mathlib.Analysis.Convex.Function", "declaration": "Mathlib.Analysis.Convex.Function.StrictConvexOn", "span": "L849-L852", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Function.lean#L849"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 302, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 990, "lean_code_chars": 199, "natural_language_chars": 791, "lean_code_ratio": 0.201, "line_count": 15, "imports_count": 0, "declarations_count": 106, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4c4d478f5166fd98", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Additive.Convolution.convolution_op_smul_eq_convolution_mul_inv", "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.Combinatorics.Additive.Convolution)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma convolution_op_smul_eq_convolution_mul_inv (A B : Finset G) (s x : G) :\n A.convolution (B <\u2022 s) x = A.convolution B (x * s\u207b\u00b9)\n:= by thisIsWrongLemmaNameXYZ\nnth_rw 2 [\u2190 inv_inv B]\n rw [\u2190 inv_inv (B <\u2022 s), inv_op_smul_finset_distrib, \u2190 card_inter_smul, \u2190 card_inter_smul,\n smul_smul]\n\nend Finset\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=100, messages=[Message(data=\"unexpected token '\u2022'; expected term\", pos=Position(line=2, column=22), pos_end=Position(line=2, column=23), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=100, i_end=321, messages=[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=10), 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.Combinatorics.Additive.Convolution).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma convolution_op_smul_eq_convolution_mul_inv (A B : Finset G) (s x : G) :\n A.convolution (B <\u2022 s) x = A.convolution B (x * s\u207b\u00b9)\n:= by thisIsWrongLemmaNameXYZ\nnth_rw 2 [\u2190 inv_inv B]\n rw [\u2190 inv_inv (B <\u2022 s), inv_op_smul_finset_distrib, \u2190 card_inter_smul, \u2190 card_inter_smul,\n smul_smul]\n\nend Finset\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=100, messages=[Message(data=\"unexpected token '\u2022'; expected term\", pos=Position(line=2, column=22), pos_end=Position(line=2, column=23), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=100, i_end=321, messages=[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=10), 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/Combinatorics/Additive/Convolution.lean", "module": "Mathlib.Combinatorics.Additive.Convolution", "declaration": "Mathlib.Combinatorics.Additive.Convolution.convolution_op_smul_eq_convolution_mul_inv", "span": "L102-L108", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Additive/Convolution.lean#L102"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 434, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1459, "lean_code_chars": 307, "natural_language_chars": 1152, "lean_code_ratio": 0.2104, "line_count": 19, "imports_count": 0, "declarations_count": 160, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1752716a631c8f65", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.SpecificGroups.Alternating.MaximalSubgroups.isCoatom_stabilizer", "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.GroupTheory.SpecificGroups.Alternating.MaximalSubgroups)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isCoatom_stabilizer {s : Set \u03b1}\n (h0 : s.Nonempty) (h1 : s\u1d9c.Nonempty) (hs : Nat.card \u03b1 \u2260 2 * ncard s) :\n IsCoatom (stabilizer (alternatingGroup \u03b1) s)\n:= by \u27e8\u27e9\u27e8\u27e9\nrw [\u2190 ncard_add_ncard_compl s, two_mul, ne_eq, Nat.add_left_cancel_iff] at hs\n wlog hs' : ncard s < ncard s\u1d9c\n \u00b7 rw [\u2190 stabilizer_compl]\n apply this h1 <;> rw [compl_compl] <;> grind\n \u00b7 by_cases h0' : s.Nontrivial\n \u00b7 apply isCoatom_stabilizer_of_ncard_lt_ncard_compl h0' hs'\n \u00b7 simp only [not_nontrivial_iff] at h0'\n apply isCoatom_stabilizer_singleton _ h0 h0'\n rw [\u2190 ncard_add_ncard_compl s]\n rw [\u2190 ncard_pos] at h0 h1\n grind\n\nend alternatingGroup\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=177, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=4, column=5), pos_end=Position(line=4, column=7), severity=, kind=None), Message(data=\"Function expected at\\n ncard\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n s\\n\\nHint: The identifier `ncard` 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=64), pos_end=Position(line=2, column=71), severity=, kind=None), Message(data=\"Function expected at\\n stabilizer\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (alternatingGroup \u03b1)\\n\\nHint: The identifier `stabilizer` 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=3, column=14), pos_end=Position(line=3, column=47), severity=, kind=None), Message(data='unsolved goals\\n\u03b1 : Type u_1\\nx\u271d\u00b9 : Sort u_2\\nncard : x\u271d\u00b9\\nx\u271d : Sort u_3\\nstabilizer : x\u271d\\ns : Set \u03b1\\nh0 : s.Nonempty\\nh1 : s\u1d9c.Nonempty\\nhs : Nat.card \u03b1 \u2260 2 * sorry\\n\u22a2 IsCoatom sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=177, i_end=684, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=17, column=0), pos_end=Position(line=17, column=20), 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.GroupTheory.SpecificGroups.Alternating.MaximalSubgroups).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isCoatom_stabilizer {s : Set \u03b1}\n (h0 : s.Nonempty) (h1 : s\u1d9c.Nonempty) (hs : Nat.card \u03b1 \u2260 2 * ncard s) :\n IsCoatom (stabilizer (alternatingGroup \u03b1) s)\n:= by \u27e8\u27e9\u27e8\u27e9\nrw [\u2190 ncard_add_ncard_compl s, two_mul, ne_eq, Nat.add_left_cancel_iff] at hs\n wlog hs' : ncard s < ncard s\u1d9c\n \u00b7 rw [\u2190 stabilizer_compl]\n apply this h1 <;> rw [compl_compl] <;> grind\n \u00b7 by_cases h0' : s.Nontrivial\n \u00b7 apply isCoatom_stabilizer_of_ncard_lt_ncard_compl h0' hs'\n \u00b7 simp only [not_nontrivial_iff] at h0'\n apply isCoatom_stabilizer_singleton _ h0 h0'\n rw [\u2190 ncard_add_ncard_compl s]\n rw [\u2190 ncard_pos] at h0 h1\n grind\n\nend alternatingGroup\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=177, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=4, column=5), pos_end=Position(line=4, column=7), severity=, kind=None), Message(data=\"Function expected at\\n ncard\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n s\\n\\nHint: The identifier `ncard` 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=64), pos_end=Position(line=2, column=71), severity=, kind=None), Message(data=\"Function expected at\\n stabilizer\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (alternatingGroup \u03b1)\\n\\nHint: The identifier `stabilizer` 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=3, column=14), pos_end=Position(line=3, column=47), severity=, kind=None), Message(data='unsolved goals\\n\u03b1 : Type u_1\\nx\u271d\u00b9 : Sort u_2\\nncard : x\u271d\u00b9\\nx\u271d : Sort u_3\\nstabilizer : x\u271d\\ns : Set \u03b1\\nh0 : s.Nonempty\\nh1 : s\u1d9c.Nonempty\\nhs : Nat.card \u03b1 \u2260 2 * sorry\\n\u22a2 IsCoatom sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=177, i_end=684, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=17, column=0), pos_end=Position(line=17, column=20), 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/GroupTheory/SpecificGroups/Alternating/MaximalSubgroups.lean", "module": "Mathlib.GroupTheory.SpecificGroups.Alternating.MaximalSubgroups", "declaration": "Mathlib.GroupTheory.SpecificGroups.Alternating.MaximalSubgroups.isCoatom_stabilizer", "span": "L293-L308", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/SpecificGroups/Alternating/MaximalSubgroups.lean#L293"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1047, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3428, "lean_code_chars": 656, "natural_language_chars": 2772, "lean_code_ratio": 0.1914, "line_count": 28, "imports_count": 0, "declarations_count": 439, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a1f4a05c72decaba", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots.pow_sub_one_eq", "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.RingTheory.RootsOfUnity.PrimitiveRoots)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem pow_sub_one_eq [IsDomain R] {\u03b6 : R} (h\u03b6 : IsPrimitiveRoot \u03b6 k) (hk : 1 < k) :\n \u03b6 ^ k.pred = -\u2211 i \u2208 range k.pred, \u03b6 ^ i\n frobnicateTacticThatDoesNotExist := by\nrw [eq_neg_iff_add_eq_zero, add_comm, \u2190 sum_range_succ, \u2190 Nat.succ_eq_add_one,\n Nat.succ_pred_eq_of_pos (pos_of_gt hk), h\u03b6.geom_sum_eq_zero hk]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The (additive) monoid equivalence between `ZMod k`\nand the powers of a primitive root of unity `\u03b6`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=390, messages=[Message(data=\"unexpected token '/--'; expected '{' or tactic\", pos=Position(line=7, column=56), pos_end=Position(line=8, column=3), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=24), pos_end=Position(line=1, column=34), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=390, i_end=497, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=51), 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.RingTheory.RootsOfUnity.PrimitiveRoots).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem pow_sub_one_eq [IsDomain R] {\u03b6 : R} (h\u03b6 : IsPrimitiveRoot \u03b6 k) (hk : 1 < k) :\n \u03b6 ^ k.pred = -\u2211 i \u2208 range k.pred, \u03b6 ^ i\n frobnicateTacticThatDoesNotExist := by\nrw [eq_neg_iff_add_eq_zero, add_comm, \u2190 sum_range_succ, \u2190 Nat.succ_eq_add_one,\n Nat.succ_pred_eq_of_pos (pos_of_gt hk), h\u03b6.geom_sum_eq_zero hk]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The (additive) monoid equivalence between `ZMod k`\nand the powers of a primitive root of unity `\u03b6`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=390, messages=[Message(data=\"unexpected token '/--'; expected '{' or tactic\", pos=Position(line=7, column=56), pos_end=Position(line=8, column=3), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=24), pos_end=Position(line=1, column=34), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=390, i_end=497, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=51), 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/RingTheory/RootsOfUnity/PrimitiveRoots.lean", "module": "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "declaration": "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots.pow_sub_one_eq", "span": "L439-L446", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean#L439"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 553, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1905, "lean_code_chars": 483, "natural_language_chars": 1422, "lean_code_ratio": 0.2535, "line_count": 20, "imports_count": 0, "declarations_count": 203, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "09180490e5dea0c9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Matrix.IsDiag.IsDiag", "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.LinearAlgebra.Matrix.IsDiag)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsDiag.transpose [Zero \u03b1] {A : Matrix n n \u03b1} (ha : A.IsDiag) : A\u1d40.IsDiag\n frobnicateTacticThatDoesNotExist := fun _ _ h =>\nha h.symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=74, messages=[Message(data=\"unexpected token '\u1d40'; expected ':=', 'where' or '|'\", pos=Position(line=1, column=72), pos_end=Position(line=1, column=73), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=74, i_end=145, 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.LinearAlgebra.Matrix.IsDiag).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsDiag.transpose [Zero \u03b1] {A : Matrix n n \u03b1} (ha : A.IsDiag) : A\u1d40.IsDiag\n frobnicateTacticThatDoesNotExist := fun _ _ h =>\nha h.symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=74, messages=[Message(data=\"unexpected token '\u1d40'; expected ':=', 'where' or '|'\", pos=Position(line=1, column=72), pos_end=Position(line=1, column=73), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=74, i_end=145, 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/LinearAlgebra/Matrix/IsDiag.lean", "module": "Mathlib.LinearAlgebra.Matrix.IsDiag", "declaration": "Mathlib.LinearAlgebra.Matrix.IsDiag.IsDiag", "span": "L104-L106", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/IsDiag.lean#L104"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 316, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1065, "lean_code_chars": 142, "natural_language_chars": 923, "lean_code_ratio": 0.1333, "line_count": 14, "imports_count": 0, "declarations_count": 115, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "cb4e79b55b0cc7db", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds.f_nat", "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.NumberTheory.ModularForms.JacobiTheta.Bounds)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef f_nat (k : \u2115) (a t : \u211d) (n : \u2115) : \u211d\n:= (n + a) ^ k * exp (-\u03c0 * (n + a) ^ 2 * t) \u27e8\u27e9\u27e8\u27e9\n/-- An upper bound for the summand when `0 \u2264 a`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data='Unknown identifier `exp`', pos=Position(line=2, column=17), pos_end=Position(line=2, column=20), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=99, i_end=159, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=46), pos_end=Position(line=2, column=47), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=3, column=51), 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.NumberTheory.ModularForms.JacobiTheta.Bounds).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef f_nat (k : \u2115) (a t : \u211d) (n : \u2115) : \u211d\n:= (n + a) ^ k * exp (-\u03c0 * (n + a) ^ 2 * t) \u27e8\u27e9\u27e8\u27e9\n/-- An upper bound for the summand when `0 \u2264 a`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data='Unknown identifier `exp`', pos=Position(line=2, column=17), pos_end=Position(line=2, column=20), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=99, i_end=159, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=46), pos_end=Position(line=2, column=47), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=3, column=51), 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/NumberTheory/ModularForms/JacobiTheta/Bounds.lean", "module": "Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds", "declaration": "Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds.f_nat", "span": "L70-L72", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ModularForms/JacobiTheta/Bounds.lean#L70"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 427, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1398, "lean_code_chars": 141, "natural_language_chars": 1257, "lean_code_ratio": 0.1009, "line_count": 14, "imports_count": 0, "declarations_count": 152, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "63b69c1e43723b9a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.CharP.Frobenius.frobenius_mul", "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.Algebra.CharP.Frobenius)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma frobenius_mul : frobenius R p (x * y) = frobenius R p x * frobenius R p y\n:= _unbalancedParenXYZ\nmap_mul (frobenius R p) x y\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data='`frobenius_mul` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=19), 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.Algebra.CharP.Frobenius).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma frobenius_mul : frobenius R p (x * y) = frobenius R p x * frobenius R p y\n:= _unbalancedParenXYZ\nmap_mul (frobenius R p) x y\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data='`frobenius_mul` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=19), 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/Algebra/CharP/Frobenius.lean", "module": "Mathlib.Algebra.CharP.Frobenius", "declaration": "Mathlib.Algebra.CharP.Frobenius.frobenius_mul", "span": "L78-L80", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/CharP/Frobenius.lean#L78"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 268, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 906, "lean_code_chars": 131, "natural_language_chars": 775, "lean_code_ratio": 0.1446, "line_count": 14, "imports_count": 0, "declarations_count": 107, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5225dc530c37f536", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.FinEnum.Finset", "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.Data.FinEnum)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Finset.mem_enum [DecidableEq \u03b1] (s : Finset \u03b1) (xs : List \u03b1) :\n s \u2208 Finset.enum xs \u2194 \u2200 x \u2208 s, x \u2208 xs\n:= by thisIsWrongLemmaNameXYZ\ninduction xs generalizing s with\n | nil => simp [enum, eq_empty_iff_forall_notMem]\n | cons x xs ih =>\n simp only [enum, List.bind_eq_flatMap, List.mem_flatMap, List.mem_cons,\n List.not_mem_nil, or_false, ih]\n refine \u27e8by aesop, fun hs => \u27e8s.erase x, ?_\u27e9\u27e9\n simp only [or_iff_not_imp_left] at hs\n simp +contextual [eq_comm (a := s), or_iff_not_imp_left, hs]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=132, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown constant `Finset.enum`', pos=Position(line=2, column=8), pos_end=Position(line=2, column=19), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u03b1 : Type u_1\\ninst\u271d : DecidableEq \u03b1\\ns : Finset \u03b1\\nxs : List \u03b1\\n\u22a2 s \u2208 sorry \u2194 \u2200 x \u2208 s, x \u2208 xs', 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=132, i_end=546, 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.Data.FinEnum).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Finset.mem_enum [DecidableEq \u03b1] (s : Finset \u03b1) (xs : List \u03b1) :\n s \u2208 Finset.enum xs \u2194 \u2200 x \u2208 s, x \u2208 xs\n:= by thisIsWrongLemmaNameXYZ\ninduction xs generalizing s with\n | nil => simp [enum, eq_empty_iff_forall_notMem]\n | cons x xs ih =>\n simp only [enum, List.bind_eq_flatMap, List.mem_flatMap, List.mem_cons,\n List.not_mem_nil, or_false, ih]\n refine \u27e8by aesop, fun hs => \u27e8s.erase x, ?_\u27e9\u27e9\n simp only [or_iff_not_imp_left] at hs\n simp +contextual [eq_comm (a := s), or_iff_not_imp_left, hs]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=132, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown constant `Finset.enum`', pos=Position(line=2, column=8), pos_end=Position(line=2, column=19), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u03b1 : Type u_1\\ninst\u271d : DecidableEq \u03b1\\ns : Finset \u03b1\\nxs : List \u03b1\\n\u22a2 s \u2208 sorry \u2194 \u2200 x \u2208 s, x \u2208 xs', 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=132, i_end=546, 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/Data/FinEnum.lean", "module": "Mathlib.Data.FinEnum", "declaration": "Mathlib.Data.FinEnum.Finset", "span": "L143-L153", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/FinEnum.lean#L143"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 578, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1820, "lean_code_chars": 526, "natural_language_chars": 1294, "lean_code_ratio": 0.289, "line_count": 22, "imports_count": 0, "declarations_count": 199, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "b262428b7eff17ab", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.Disjoint.Disjoint", "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.Order.Disjoint)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Disjoint.mono (h\u2081 : a \u2264 b) (h\u2082 : c \u2264 d) : Disjoint b d \u2192 Disjoint a c\n:= .someMissingNamespaceXYZ\nfun h _ ha hc \u21a6 h (ha.trans h\u2081) (hc.trans h\u2082)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=167, messages=[Message(data='`Disjoint.mono` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=21), 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.Order.Disjoint).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Disjoint.mono (h\u2081 : a \u2264 b) (h\u2082 : c \u2264 d) : Disjoint b d \u2192 Disjoint a c\n:= .someMissingNamespaceXYZ\nfun h _ ha hc \u21a6 h (ha.trans h\u2081) (hc.trans h\u2082)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=167, messages=[Message(data='`Disjoint.mono` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=21), 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/Order/Disjoint.lean", "module": "Mathlib.Order.Disjoint", "declaration": "Mathlib.Order.Disjoint.Disjoint", "span": "L74-L76", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Disjoint.lean#L74"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 272, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 918, "lean_code_chars": 152, "natural_language_chars": 766, "lean_code_ratio": 0.1656, "line_count": 14, "imports_count": 0, "declarations_count": 110, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2940a46be9eed568", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.MetricSpace.Kuratowski.embeddingOfSubset_isometry", "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.Topology.MetricSpace.Kuratowski)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem embeddingOfSubset_isometry (H : DenseRange x) : Isometry (embeddingOfSubset x)\n frobnicateTacticThatDoesNotExist := by\nrefine Isometry.of_dist_eq fun a b => ?_\n refine (embeddingOfSubset_dist_le x a b).antisymm (le_of_forall_pos_le_add fun e epos => ?_)\n -- First step: find n with dist a (x n) < e\n rcases Metric.mem_closure_range_iff.1 (H a) (e / 2) (half_pos epos) with \u27e8n, hn\u27e9\n -- Second step: use the norm control at index n to conclude\n have C : dist b (x n) - dist a (x n) = embeddingOfSubset x b n - embeddingOfSubset x a n := by\n simp only [embeddingOfSubset_coe, sub_sub_sub_cancel_right]\n have :=\n calc\n dist a b \u2264 dist a (x n) + dist (x n) b := dist_triangle _ _ _\n _ = 2 * dist a (x n) + (dist b (x n) - dist a (x n)) := by simp [dist_comm]; ring\n _ \u2264 2 * dist a (x n) + |dist b (x n) - dist a (x n)| := by grw [\u2190 le_abs_self]\n _ \u2264 2 * (e / 2) + |embeddingOfSubset x b n - embeddingOfSubset x a n| := by\n rw [C]\n gcongr\n _ \u2264 2 * (e / 2) + dist (embeddingOfSubset x b) (embeddingOfSubset x a) := by\n gcongr\n simp only [dist_eq_norm]\n exact lp.norm_apply_le_norm ENNReal.top_ne_zero\n (embeddingOfSubset x b - embeddingOfSubset x a) n\n _ = dist (embeddingOfSubset x b) (embeddingOfSubset x a) + e := by ring\n simpa [dist_comm] using this\n\n/-- Every separable metric space embeds isometrically in `\u2113^\u221e(\u2115)`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=380, messages=[Message(data='Function expected at\\n Isometry ?m.12\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=56), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data=\"Function expected at\\n embeddingOfSubset\\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 `embeddingOfSubset` 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=66), pos_end=Position(line=1, column=85), severity=, kind=None), Message(data='Function expected at\\n ?m.27\\nbut this term has type\\n ?m.26\\n\\nNote: Expected a function because this term is being applied to the argument\\n refine', pos=Position(line=3, column=38), pos_end=Position(line=6, column=69), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=380, i_end=1434, messages=[Message(data=\"unexpected token 'with'; expected command\", pos=Position(line=6, column=70), pos_end=Position(line=6, column=74), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=26, 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.Topology.MetricSpace.Kuratowski).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem embeddingOfSubset_isometry (H : DenseRange x) : Isometry (embeddingOfSubset x)\n frobnicateTacticThatDoesNotExist := by\nrefine Isometry.of_dist_eq fun a b => ?_\n refine (embeddingOfSubset_dist_le x a b).antisymm (le_of_forall_pos_le_add fun e epos => ?_)\n -- First step: find n with dist a (x n) < e\n rcases Metric.mem_closure_range_iff.1 (H a) (e / 2) (half_pos epos) with \u27e8n, hn\u27e9\n -- Second step: use the norm control at index n to conclude\n have C : dist b (x n) - dist a (x n) = embeddingOfSubset x b n - embeddingOfSubset x a n := by\n simp only [embeddingOfSubset_coe, sub_sub_sub_cancel_right]\n have :=\n calc\n dist a b \u2264 dist a (x n) + dist (x n) b := dist_triangle _ _ _\n _ = 2 * dist a (x n) + (dist b (x n) - dist a (x n)) := by simp [dist_comm]; ring\n _ \u2264 2 * dist a (x n) + |dist b (x n) - dist a (x n)| := by grw [\u2190 le_abs_self]\n _ \u2264 2 * (e / 2) + |embeddingOfSubset x b n - embeddingOfSubset x a n| := by\n rw [C]\n gcongr\n _ \u2264 2 * (e / 2) + dist (embeddingOfSubset x b) (embeddingOfSubset x a) := by\n gcongr\n simp only [dist_eq_norm]\n exact lp.norm_apply_le_norm ENNReal.top_ne_zero\n (embeddingOfSubset x b - embeddingOfSubset x a) n\n _ = dist (embeddingOfSubset x b) (embeddingOfSubset x a) + e := by ring\n simpa [dist_comm] using this\n\n/-- Every separable metric space embeds isometrically in `\u2113^\u221e(\u2115)`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=380, messages=[Message(data='Function expected at\\n Isometry ?m.12\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=56), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data=\"Function expected at\\n embeddingOfSubset\\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 `embeddingOfSubset` 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=66), pos_end=Position(line=1, column=85), severity=, kind=None), Message(data='Function expected at\\n ?m.27\\nbut this term has type\\n ?m.26\\n\\nNote: Expected a function because this term is being applied to the argument\\n refine', pos=Position(line=3, column=38), pos_end=Position(line=6, column=69), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=380, i_end=1434, messages=[Message(data=\"unexpected token 'with'; expected command\", pos=Position(line=6, column=70), pos_end=Position(line=6, column=74), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=26, 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/Topology/MetricSpace/Kuratowski.lean", "module": "Mathlib.Topology.MetricSpace.Kuratowski", "declaration": "Mathlib.Topology.MetricSpace.Kuratowski.embeddingOfSubset_isometry", "span": "L60-L84", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/MetricSpace/Kuratowski.lean#L60"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1137, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3718, "lean_code_chars": 1415, "natural_language_chars": 2303, "lean_code_ratio": 0.3806, "line_count": 37, "imports_count": 0, "declarations_count": 491, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "1e6d7cb603c0c8c3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Complex.ValueDistribution.LogCounting.Basic.logCounting_add_analyticOn", "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.Analysis.Complex.ValueDistribution.LogCounting.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem logCounting_add_analyticOn (hf : Meromorphic f) (hg : AnalyticOn \ud835\udd5c g univ) :\n logCounting (f + g) \u22a4 = logCounting f \u22a4\n:= by .someMissingNamespaceXYZ\nsimp only [logCounting, \u2193reduceDIte]\n rw [hf.meromorphicOn.negPart_divisor_add_of_analyticNhdOn_right\n (isOpen_univ.analyticOn_iff_analyticOnNhd.1 hg)]\n\n/--\nSpecial case of `logCounting_add_analyticOn`: Adding a constant does not change the logarithmic\ncounting function for the poles.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=144, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n NontriviallyNormedField \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=62), pos_end=Position(line=1, column=81), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n logCounting\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n (f + g)\\n\\nHint: The identifier `logCounting` 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=25), severity=, kind=None), Message(data=\"Function expected at\\n logCounting\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `logCounting` 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=28), pos_end=Position(line=2, column=43), severity=, kind=None), Message(data='unsolved goals\\n\ud835\udd5c\u271d : Type u_1\\nE\u271d : Type u_2\\nf : \ud835\udd5c\u271d \u2192 E\u271d\\n\ud835\udd5c : Type u_3\\n\u03b1\u271d : Type u_4\\nx\u271d\u00b9 : Type u_5\\ng : \u03b1\u271d \u2192 x\u271d\u00b9\\nuniv : Set \u03b1\u271d\\nx\u271d : Sort u_6\\nlogCounting : x\u271d\\nhf : Meromorphic f\\nhg : sorry\\n\u22a2 sorry = 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=144, i_end=461, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=11, 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.Analysis.Complex.ValueDistribution.LogCounting.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem logCounting_add_analyticOn (hf : Meromorphic f) (hg : AnalyticOn \ud835\udd5c g univ) :\n logCounting (f + g) \u22a4 = logCounting f \u22a4\n:= by .someMissingNamespaceXYZ\nsimp only [logCounting, \u2193reduceDIte]\n rw [hf.meromorphicOn.negPart_divisor_add_of_analyticNhdOn_right\n (isOpen_univ.analyticOn_iff_analyticOnNhd.1 hg)]\n\n/--\nSpecial case of `logCounting_add_analyticOn`: Adding a constant does not change the logarithmic\ncounting function for the poles.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=144, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n NontriviallyNormedField \ud835\udd5c\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=62), pos_end=Position(line=1, column=81), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n logCounting\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n (f + g)\\n\\nHint: The identifier `logCounting` 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=25), severity=, kind=None), Message(data=\"Function expected at\\n logCounting\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `logCounting` 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=28), pos_end=Position(line=2, column=43), severity=, kind=None), Message(data='unsolved goals\\n\ud835\udd5c\u271d : Type u_1\\nE\u271d : Type u_2\\nf : \ud835\udd5c\u271d \u2192 E\u271d\\n\ud835\udd5c : Type u_3\\n\u03b1\u271d : Type u_4\\nx\u271d\u00b9 : Type u_5\\ng : \u03b1\u271d \u2192 x\u271d\u00b9\\nuniv : Set \u03b1\u271d\\nx\u271d : Sort u_6\\nlogCounting : x\u271d\\nhf : Meromorphic f\\nhg : sorry\\n\u22a2 sorry = 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=144, i_end=461, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=11, 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/Analysis/Complex/ValueDistribution/LogCounting/Basic.lean", "module": "Mathlib.Analysis.Complex.ValueDistribution.LogCounting.Basic", "declaration": "Mathlib.Analysis.Complex.ValueDistribution.LogCounting.Basic.logCounting_add_analyticOn", "span": "L408-L417", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Complex/ValueDistribution/LogCounting/Basic.lean#L408"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1031, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3471, "lean_code_chars": 453, "natural_language_chars": 3018, "lean_code_ratio": 0.1305, "line_count": 22, "imports_count": 0, "declarations_count": 441, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "dd2d6a0c34f195df", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Matroid.Circuit.IsCircuit", "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.Combinatorics.Matroid.Circuit)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma IsCircuit.subset_ground (hC : M.IsCircuit C) : C \u2286 M.E\n:= _unbalancedParenXYZ\nhC.dep.subset_ground\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='Unknown identifier `M.IsCircuit`', pos=Position(line=1, column=36), pos_end=Position(line=1, column=47), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `M.E`', pos=Position(line=1, column=57), pos_end=Position(line=1, column=60), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), 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.Combinatorics.Matroid.Circuit).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma IsCircuit.subset_ground (hC : M.IsCircuit C) : C \u2286 M.E\n:= _unbalancedParenXYZ\nhC.dep.subset_ground\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='Unknown identifier `M.IsCircuit`', pos=Position(line=1, column=36), pos_end=Position(line=1, column=47), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `M.E`', pos=Position(line=1, column=57), pos_end=Position(line=1, column=60), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), 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/Combinatorics/Matroid/Circuit.lean", "module": "Mathlib.Combinatorics.Matroid.Circuit", "declaration": "Mathlib.Combinatorics.Matroid.Circuit.IsCircuit", "span": "L75-L77", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Matroid/Circuit.lean#L75"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 373, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1295, "lean_code_chars": 105, "natural_language_chars": 1190, "lean_code_ratio": 0.0811, "line_count": 14, "imports_count": 0, "declarations_count": 126, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "de556b8422591476", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.MonoidLocalization.Basic.induction_on", "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.GroupTheory.MonoidLocalization.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem induction_on {p : Localization S \u2192 Prop} (x) (H : \u2200 y : M \u00d7 S, p (mk y.1 y.2)) : p x\n:= _unbalancedParenXYZ\nind H x\n\n/-- Non-dependent recursion principle for localizations: given elements `f x y : p`\nfor all `x` and `y`, such that `r S x x'` and `r S y y'` implies `f x y = f x' y'`,\nthen `f` is defined on the whole `Localization S`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data=\"Function expected at\\n mk\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n y.1\\n\\nHint: The identifier `mk` 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=74), pos_end=Position(line=1, column=84), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=130, i_end=351, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=53), 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.GroupTheory.MonoidLocalization.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem induction_on {p : Localization S \u2192 Prop} (x) (H : \u2200 y : M \u00d7 S, p (mk y.1 y.2)) : p x\n:= _unbalancedParenXYZ\nind H x\n\n/-- Non-dependent recursion principle for localizations: given elements `f x y : p`\nfor all `x` and `y`, such that `r S x x'` and `r S y y'` implies `f x y = f x' y'`,\nthen `f` is defined on the whole `Localization S`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data=\"Function expected at\\n mk\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n y.1\\n\\nHint: The identifier `mk` 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=74), pos_end=Position(line=1, column=84), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=130, i_end=351, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=53), 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/GroupTheory/MonoidLocalization/Basic.lean", "module": "Mathlib.GroupTheory.MonoidLocalization.Basic", "declaration": "Mathlib.GroupTheory.MonoidLocalization.Basic.induction_on", "span": "L292-L297", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/MonoidLocalization/Basic.lean#L292"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 580, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2059, "lean_code_chars": 347, "natural_language_chars": 1712, "lean_code_ratio": 0.1685, "line_count": 18, "imports_count": 0, "declarations_count": 278, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "2ec64d7a98d3c221", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.Perfection.valAux_one", "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.RingTheory.Perfection)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem valAux_one : valAux K v O p 1 = 1\n frobnicateTacticThatDoesNotExist :=\n(valAux_eq (hv := hv) <| show coeff 0 1 \u2260 0 from one_ne_zero).trans <| by\n rw [pow_zero, pow_one, map_one, \u2190 (Ideal.Quotient.mk _).map_one, ModP.preVal_mk hv,\n map_one, v.map_one]\n change (1 : ModP O p) \u2260 0\n exact one_ne_zero\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=325, messages=[Message(data=\"Function expected at\\n valAux\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `valAux` 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=21), pos_end=Position(line=1, column=37), severity=, kind=None), Message(data='Function expected at\\n 1\\nbut this term has type\\n ?m.8\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=40), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `valAux_eq`', pos=Position(line=3, column=1), pos_end=Position(line=3, column=10), 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.RingTheory.Perfection).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem valAux_one : valAux K v O p 1 = 1\n frobnicateTacticThatDoesNotExist :=\n(valAux_eq (hv := hv) <| show coeff 0 1 \u2260 0 from one_ne_zero).trans <| by\n rw [pow_zero, pow_one, map_one, \u2190 (Ideal.Quotient.mk _).map_one, ModP.preVal_mk hv,\n map_one, v.map_one]\n change (1 : ModP O p) \u2260 0\n exact one_ne_zero\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=325, messages=[Message(data=\"Function expected at\\n valAux\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `valAux` 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=21), pos_end=Position(line=1, column=37), severity=, kind=None), Message(data='Function expected at\\n 1\\nbut this term has type\\n ?m.8\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=40), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `valAux_eq`', pos=Position(line=3, column=1), pos_end=Position(line=3, column=10), 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/RingTheory/Perfection.lean", "module": "Mathlib.RingTheory.Perfection", "declaration": "Mathlib.RingTheory.Perfection.valAux_one", "span": "L743-L749", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Perfection.lean#L743"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 584, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2035, "lean_code_chars": 320, "natural_language_chars": 1715, "lean_code_ratio": 0.1572, "line_count": 18, "imports_count": 0, "declarations_count": 258, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "bd0c4aaef9131d70", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.TensorProduct.Subalgebra.mulMap_map_comp_eq", "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.LinearAlgebra.TensorProduct.Subalgebra)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mulMap_map_comp_eq (f : S \u2192\u2090[R] T) :\n (mulMap (A.map f) (B.map f)).comp\n (Algebra.TensorProduct.map (f.subalgebraMap A) (f.subalgebraMap B))\n = f.comp (mulMap A B)\n:= by .someMissingNamespaceXYZ\next <;> simp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=199, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=41), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n mulMap\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n (A.map f)\\n\\nHint: The identifier `mulMap` 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=5), pos_end=Position(line=2, column=31), severity=, kind=None), Message(data='unsolved goals\\nR : Type u_1\\nS : Type u_2\\nT : Type u_3\\nx\u271d : Sort u_4\\nmulMap : x\u271d\\nf : sorry\\n\u22a2 sorry = sorry', pos=Position(line=5, column=6), pos_end=Position(line=5, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=199, i_end=234, 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.LinearAlgebra.TensorProduct.Subalgebra).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mulMap_map_comp_eq (f : S \u2192\u2090[R] T) :\n (mulMap (A.map f) (B.map f)).comp\n (Algebra.TensorProduct.map (f.subalgebraMap A) (f.subalgebraMap B))\n = f.comp (mulMap A B)\n:= by .someMissingNamespaceXYZ\next <;> simp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=199, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=41), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n mulMap\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n (A.map f)\\n\\nHint: The identifier `mulMap` 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=5), pos_end=Position(line=2, column=31), severity=, kind=None), Message(data='unsolved goals\\nR : Type u_1\\nS : Type u_2\\nT : Type u_3\\nx\u271d : Sort u_4\\nmulMap : x\u271d\\nf : sorry\\n\u22a2 sorry = sorry', pos=Position(line=5, column=6), pos_end=Position(line=5, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=199, i_end=234, 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/LinearAlgebra/TensorProduct/Subalgebra.lean", "module": "Mathlib.LinearAlgebra.TensorProduct.Subalgebra", "declaration": "Mathlib.LinearAlgebra.TensorProduct.Subalgebra.mulMap_map_comp_eq", "span": "L222-L227", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/TensorProduct/Subalgebra.lean#L222"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 667, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2341, "lean_code_chars": 231, "natural_language_chars": 2110, "lean_code_ratio": 0.0987, "line_count": 17, "imports_count": 0, "declarations_count": 293, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "bd9eb44af33908f9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_iff", "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.NumberTheory.LSeries.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma LSeriesHasSum_iff {f : \u2115 \u2192 \u2102} {s a : \u2102} :\n LSeriesHasSum f s a \u2194 LSeriesSummable f s \u2227 LSeries f s = a\n:= thisIsWrongLemmaNameXYZ\n\u27e8fun H \u21a6 \u27e8H.LSeriesSummable, H.LSeries_eq\u27e9, fun \u27e8H\u2081, H\u2082\u27e9 \u21a6 H\u2082 \u25b8 H\u2081.LSeriesHasSum\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=258, messages=[Message(data='`LSeriesHasSum_iff` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=23), 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.NumberTheory.LSeries.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma LSeriesHasSum_iff {f : \u2115 \u2192 \u2102} {s a : \u2102} :\n LSeriesHasSum f s a \u2194 LSeriesSummable f s \u2227 LSeries f s = a\n:= thisIsWrongLemmaNameXYZ\n\u27e8fun H \u21a6 \u27e8H.LSeriesSummable, H.LSeries_eq\u27e9, fun \u27e8H\u2081, H\u2082\u27e9 \u21a6 H\u2082 \u25b8 H\u2081.LSeriesHasSum\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=258, messages=[Message(data='`LSeriesHasSum_iff` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=23), 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/NumberTheory/LSeries/Basic.lean", "module": "Mathlib.NumberTheory.LSeries.Basic", "declaration": "Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_iff", "span": "L227-L230", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LSeries/Basic.lean#L227"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 321, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1003, "lean_code_chars": 221, "natural_language_chars": 782, "lean_code_ratio": 0.2203, "line_count": 15, "imports_count": 0, "declarations_count": 112, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "19da1cc9b9bcc805", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Polynomial.Derivation.derivation_ext", "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.Algebra.Polynomial.Derivation)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem derivation_ext {D\u2081 D\u2082 : Derivation R R[X] A} (h : D\u2081 X = D\u2082 X) : D\u2081 = D\u2082\n:= .someMissingNamespaceXYZ\nDerivation.ext fun f => Derivation.eqOn_adjoin (Set.eqOn_singleton.2 h) <| by\n simp only [adjoin_X, Algebra.coe_top, Set.mem_univ]\n\nvariable [IsScalarTower R (Polynomial R) A]\nvariable (R)\n\n/-- The derivation on `R[X]` that takes the value `a` on `X`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=256, messages=[Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=51), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=51), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"failed to prove index is valid, possible solutions:\\n - Use `have`-expressions to prove the index is valid\\n - Use `a[i]!` notation instead, runtime check is performed, and 'Panic' error message is produced if index is not valid\\n - Use `a[i]?` notation instead, result is an `Option` type\\n - Use `a[i]'h` notation instead, where `h` is a proof that index is valid\\nR : Type ?u.92\\nX : ?m.2\\nA : Type ?u.90\\n\u22a2 ?m.7 R X\", pos=Position(line=1, column=45), pos_end=Position(line=1, column=49), severity=, kind=None), Message(data=\"failed to prove index is valid, possible solutions:\\n - Use `have`-expressions to prove the index is valid\\n - Use `a[i]!` notation instead, runtime check is performed, and 'Panic' error message is produced if index is not valid\\n - Use `a[i]?` notation instead, result is an `Option` type\\n - Use `a[i]'h` notation instead, where `h` is a proof that index is valid\\nR : Type ?u.92\\nX : ?m.2\\nA : Type ?u.90\\nD\u2081 : sorry\\n\u22a2 ?m.19 R X\", pos=Position(line=1, column=45), pos_end=Position(line=1, column=49), severity=, kind=None), Message(data='stuck at solving universe constraint\\n max (?u.90+1) (?u.91+1) =?= max (?u.90+1) (?u.1582+1)\\nwhile trying to unify\\n CoeT.{max (?u.90 + 1) (?u.1582 + 1), max (?u.90 + 1) (?u.91 + 1)}\\n (sorryAx.{(max (?u.90 + 1) (?u.1582 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.1582)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.53))\\n x\\n (sorryAx.{(max (?u.90 + 1) (?u.91 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.91)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.39)) : Type (max 0 ?u.90 ?u.91)\\nwith\\n CoeT.{max (?u.90 + 1) (?u.1582 + 1), max (?u.90 + 1) (?u.1582 + 1)}\\n (sorryAx.{(max (?u.90 + 1) (?u.1582 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.1582)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.53))\\n x\\n (sorryAx.{(max (?u.90 + 1) (?u.1582 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.1582)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.53)) : Type (max 0 ?u.90 ?u.1582)', pos=Position(line=1, column=0), pos_end=Position(line=1, column=80), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=256, i_end=300, messages=[Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=6, column=27), pos_end=Position(line=6, column=39), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=300, i_end=314, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=314, i_end=378, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=64), 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.Algebra.Polynomial.Derivation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem derivation_ext {D\u2081 D\u2082 : Derivation R R[X] A} (h : D\u2081 X = D\u2082 X) : D\u2081 = D\u2082\n:= .someMissingNamespaceXYZ\nDerivation.ext fun f => Derivation.eqOn_adjoin (Set.eqOn_singleton.2 h) <| by\n simp only [adjoin_X, Algebra.coe_top, Set.mem_univ]\n\nvariable [IsScalarTower R (Polynomial R) A]\nvariable (R)\n\n/-- The derivation on `R[X]` that takes the value `a` on `X`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=256, messages=[Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=51), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n CommSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=51), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"failed to prove index is valid, possible solutions:\\n - Use `have`-expressions to prove the index is valid\\n - Use `a[i]!` notation instead, runtime check is performed, and 'Panic' error message is produced if index is not valid\\n - Use `a[i]?` notation instead, result is an `Option` type\\n - Use `a[i]'h` notation instead, where `h` is a proof that index is valid\\nR : Type ?u.92\\nX : ?m.2\\nA : Type ?u.90\\n\u22a2 ?m.7 R X\", pos=Position(line=1, column=45), pos_end=Position(line=1, column=49), severity=, kind=None), Message(data=\"failed to prove index is valid, possible solutions:\\n - Use `have`-expressions to prove the index is valid\\n - Use `a[i]!` notation instead, runtime check is performed, and 'Panic' error message is produced if index is not valid\\n - Use `a[i]?` notation instead, result is an `Option` type\\n - Use `a[i]'h` notation instead, where `h` is a proof that index is valid\\nR : Type ?u.92\\nX : ?m.2\\nA : Type ?u.90\\nD\u2081 : sorry\\n\u22a2 ?m.19 R X\", pos=Position(line=1, column=45), pos_end=Position(line=1, column=49), severity=, kind=None), Message(data='stuck at solving universe constraint\\n max (?u.90+1) (?u.91+1) =?= max (?u.90+1) (?u.1582+1)\\nwhile trying to unify\\n CoeT.{max (?u.90 + 1) (?u.1582 + 1), max (?u.90 + 1) (?u.91 + 1)}\\n (sorryAx.{(max (?u.90 + 1) (?u.1582 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.1582)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.53))\\n x\\n (sorryAx.{(max (?u.90 + 1) (?u.91 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.91)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.39)) : Type (max 0 ?u.90 ?u.91)\\nwith\\n CoeT.{max (?u.90 + 1) (?u.1582 + 1), max (?u.90 + 1) (?u.1582 + 1)}\\n (sorryAx.{(max (?u.90 + 1) (?u.1582 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.1582)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.53))\\n x\\n (sorryAx.{(max (?u.90 + 1) (?u.1582 + 1)) + 1} (Unit \u2192 Type (max ?u.90 ?u.1582)) true\\n (Function.const Lean.Name () `1.32.1.51.32.51._sorry._@.1886321366._hygCtx._hyg.53)) : Type (max 0 ?u.90 ?u.1582)', pos=Position(line=1, column=0), pos_end=Position(line=1, column=80), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=256, i_end=300, messages=[Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=6, column=27), pos_end=Position(line=6, column=39), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=300, i_end=314, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=314, i_end=378, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=9, column=64), 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/Algebra/Polynomial/Derivation.lean", "module": "Mathlib.Algebra.Polynomial.Derivation", "declaration": "Mathlib.Algebra.Polynomial.Derivation.derivation_ext", "span": "L54-L61", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Derivation.lean#L54"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1723, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4881, "lean_code_chars": 367, "natural_language_chars": 4514, "lean_code_ratio": 0.0752, "line_count": 20, "imports_count": 0, "declarations_count": 598, "diagnostics_count": 3, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a0d5bf3973413184", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.NNRat.BigOperators.cast_listProd", "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.Data.NNRat.BigOperators)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem cast_listProd (l : List \u211a\u22650) : (l.prod : K) = (l.map (\u2191)).prod\n:= .someMissingNamespaceXYZ\nmap_list_prod (castHom _) _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=132, messages=[Message(data='Type mismatch\\n l.prod\\nhas type\\n \u211a\u22650\\nbut is expected to have type\\n K', pos=Position(line=1, column=39), pos_end=Position(line=1, column=51), severity=, kind=None), Message(data='cannot coerce\\n x\\nto type\\n ?m.12', pos=Position(line=1, column=61), pos_end=Position(line=1, column=64), 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.Data.NNRat.BigOperators).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem cast_listProd (l : List \u211a\u22650) : (l.prod : K) = (l.map (\u2191)).prod\n:= .someMissingNamespaceXYZ\nmap_list_prod (castHom _) _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=132, messages=[Message(data='Type mismatch\\n l.prod\\nhas type\\n \u211a\u22650\\nbut is expected to have type\\n K', pos=Position(line=1, column=39), pos_end=Position(line=1, column=51), severity=, kind=None), Message(data='cannot coerce\\n x\\nto type\\n ?m.12', pos=Position(line=1, column=61), pos_end=Position(line=1, column=64), 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/Data/NNRat/BigOperators.lean", "module": "Mathlib.Data.NNRat.BigOperators", "declaration": "Mathlib.Data.NNRat.BigOperators.cast_listProd", "span": "L30-L32", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/NNRat/BigOperators.lean#L30"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 335, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1102, "lean_code_chars": 127, "natural_language_chars": 975, "lean_code_ratio": 0.1152, "line_count": 14, "imports_count": 0, "declarations_count": 130, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e128753333cb96b3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.WithBot.toDual_map", "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.Order.WithBot)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem toDual_map (f : \u03b1 \u2192 \u03b2) (a : WithBot \u03b1) :\n WithBot.toDual (map f a) = WithTop.map (toDual \u2218 f \u2218 ofDual) (WithBot.toDual a)\n:= thisIsWrongLemmaNameXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=172, messages=[Message(data=\"Function expected at\\n map\\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 `map` 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=20), pos_end=Position(line=2, column=27), 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.Order.WithBot).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem toDual_map (f : \u03b1 \u2192 \u03b2) (a : WithBot \u03b1) :\n WithBot.toDual (map f a) = WithTop.map (toDual \u2218 f \u2218 ofDual) (WithBot.toDual a)\n:= thisIsWrongLemmaNameXYZ\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=172, messages=[Message(data=\"Function expected at\\n map\\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 `map` 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=20), pos_end=Position(line=2, column=27), 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/Order/WithBot.lean", "module": "Mathlib.Order.WithBot", "declaration": "Mathlib.Order.WithBot.toDual_map", "span": "L944-L947", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/WithBot.lean#L944"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 437, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1577, "lean_code_chars": 164, "natural_language_chars": 1413, "lean_code_ratio": 0.104, "line_count": 15, "imports_count": 0, "declarations_count": 200, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0a369cde2065efc0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Order.continuous_bot", "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.Topology.Order)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem continuous_bot {t : TopologicalSpace \u03b2} : Continuous[\u22a5, t] f\n:= _unbalancedParenXYZ\ncontinuous_iff_le_induced.2 bot_le\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data=\"unexpected token ','; expected ':', ']' or ']''\", pos=Position(line=1, column=62), pos_end=Position(line=1, column=63), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=187, messages=[Message(data='unexpected end of input', pos=Position(line=5, 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.Topology.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem continuous_bot {t : TopologicalSpace \u03b2} : Continuous[\u22a5, t] f\n:= _unbalancedParenXYZ\ncontinuous_iff_le_induced.2 bot_le\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data=\"unexpected token ','; expected ':', ']' or ']''\", pos=Position(line=1, column=62), pos_end=Position(line=1, column=63), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=187, messages=[Message(data='unexpected end of input', pos=Position(line=5, 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/Topology/Order.lean", "module": "Mathlib.Topology.Order", "declaration": "Mathlib.Topology.Order.continuous_bot", "span": "L864-L867", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Order.lean#L864"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 341, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1218, "lean_code_chars": 185, "natural_language_chars": 1033, "lean_code_ratio": 0.1519, "line_count": 16, "imports_count": 0, "declarations_count": 126, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "cb97894720ed769d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.BoxIntegral.Partition.Filter.biUnionTagged_memBaseSet", "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.Analysis.BoxIntegral.Partition.Filter)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem biUnionTagged_memBaseSet {\u03c0 : Prepartition I} {\u03c0i : \u2200 J, TaggedPrepartition J}\n (h : \u2200 J \u2208 \u03c0, l.MemBaseSet J c r (\u03c0i J)) (hp : \u2200 J \u2208 \u03c0, (\u03c0i J).IsPartition)\n (hc : l.bDistortion \u2192 \u03c0.compl.distortion \u2264 c) : l.MemBaseSet I c r (\u03c0.biUnionTagged \u03c0i)\n frobnicateTacticThatDoesNotExist := by\nrefine \u27e8TaggedPrepartition.isSubordinate_biUnionTagged.2 fun J hJ => (h J hJ).1,\n fun hH => TaggedPrepartition.isHenstock_biUnionTagged.2 fun J hJ => (h J hJ).2 hH,\n fun hD => ?_, fun hD => ?_\u27e9\n \u00b7 rw [Prepartition.distortion_biUnionTagged, Finset.sup_le_iff]\n exact fun J hJ => (h J hJ).3 hD\n \u00b7 refine \u27e8_, ?_, hc hD\u27e9\n rw [\u03c0.iUnion_compl, \u2190 \u03c0.iUnion_biUnion_partition hp]\n rfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=729, messages=[Message(data='Unknown identifier `l.MemBaseSet`', pos=Position(line=2, column=18), pos_end=Position(line=2, column=30), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `l.bDistortion`', pos=Position(line=3, column=10), pos_end=Position(line=3, column=23), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `l.MemBaseSet`', pos=Position(line=3, column=52), pos_end=Position(line=3, column=64), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n Prepartition\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n I\\n\\nHint: The identifier `Prepartition` 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=38), pos_end=Position(line=1, column=52), severity=, kind=None), Message(data=\"Function expected at\\n TaggedPrepartition\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n J\\n\\nHint: The identifier `TaggedPrepartition` 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=65), pos_end=Position(line=1, column=85), severity=, kind=None), Message(data='Invalid `\u27e8...\u27e9` notation: The expected type of this term could not be determined', pos=Position(line=5, column=7), pos_end=Position(line=7, column=31), 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.Analysis.BoxIntegral.Partition.Filter).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem biUnionTagged_memBaseSet {\u03c0 : Prepartition I} {\u03c0i : \u2200 J, TaggedPrepartition J}\n (h : \u2200 J \u2208 \u03c0, l.MemBaseSet J c r (\u03c0i J)) (hp : \u2200 J \u2208 \u03c0, (\u03c0i J).IsPartition)\n (hc : l.bDistortion \u2192 \u03c0.compl.distortion \u2264 c) : l.MemBaseSet I c r (\u03c0.biUnionTagged \u03c0i)\n frobnicateTacticThatDoesNotExist := by\nrefine \u27e8TaggedPrepartition.isSubordinate_biUnionTagged.2 fun J hJ => (h J hJ).1,\n fun hH => TaggedPrepartition.isHenstock_biUnionTagged.2 fun J hJ => (h J hJ).2 hH,\n fun hD => ?_, fun hD => ?_\u27e9\n \u00b7 rw [Prepartition.distortion_biUnionTagged, Finset.sup_le_iff]\n exact fun J hJ => (h J hJ).3 hD\n \u00b7 refine \u27e8_, ?_, hc hD\u27e9\n rw [\u03c0.iUnion_compl, \u2190 \u03c0.iUnion_biUnion_partition hp]\n rfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=729, messages=[Message(data='Unknown identifier `l.MemBaseSet`', pos=Position(line=2, column=18), pos_end=Position(line=2, column=30), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `l.bDistortion`', pos=Position(line=3, column=10), pos_end=Position(line=3, column=23), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `l.MemBaseSet`', pos=Position(line=3, column=52), pos_end=Position(line=3, column=64), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n Prepartition\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n I\\n\\nHint: The identifier `Prepartition` 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=38), pos_end=Position(line=1, column=52), severity=, kind=None), Message(data=\"Function expected at\\n TaggedPrepartition\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n J\\n\\nHint: The identifier `TaggedPrepartition` 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=65), pos_end=Position(line=1, column=85), severity=, kind=None), Message(data='Invalid `\u27e8...\u27e9` notation: The expected type of this term could not be determined', pos=Position(line=5, column=7), pos_end=Position(line=7, column=31), 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/Analysis/BoxIntegral/Partition/Filter.lean", "module": "Mathlib.Analysis.BoxIntegral.Partition.Filter", "declaration": "Mathlib.Analysis.BoxIntegral.Partition.Filter.biUnionTagged_memBaseSet", "span": "L392-L403", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/BoxIntegral/Partition/Filter.lean#L392"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 994, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3378, "lean_code_chars": 693, "natural_language_chars": 2685, "lean_code_ratio": 0.2052, "line_count": 23, "imports_count": 0, "declarations_count": 421, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "13c8bc2976aea802", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Enumerative.IncidenceAlgebra.zeta_mul_zeta", "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.Combinatorics.Enumerative.IncidenceAlgebra)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma zeta_mul_zeta [NonAssocSemiring \ud835\udd5c] [Preorder \u03b1] [LocallyFiniteOrder \u03b1] [DecidableLE \u03b1]\n (a b : \u03b1) : (zeta \ud835\udd5c * zeta \ud835\udd5c : IncidenceAlgebra \ud835\udd5c \u03b1) a b = (Icc a b).card\n:= by .someMissingNamespaceXYZ\nrw [mul_apply, card_eq_sum_ones, Nat.cast_sum, Nat.cast_one]\n refine sum_congr rfl fun x hx \u21a6 ?_\n rw [mem_Icc] at hx\n rw [zeta_of_le hx.1, zeta_of_le hx.2, one_mul]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=196, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n zeta\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n \ud835\udd5c\\n\\nHint: The identifier `zeta` 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=17), pos_end=Position(line=2, column=23), severity=, kind=None), Message(data=\"Function expected at\\n zeta\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n \ud835\udd5c\\n\\nHint: The identifier `zeta` 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=26), pos_end=Position(line=2, column=32), severity=, kind=None), Message(data=\"Function expected at\\n Icc\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `Icc` 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=64), pos_end=Position(line=2, column=71), severity=, kind=None), Message(data='unsolved goals\\n\ud835\udd5c : Type u_1\\n\u03b1 : Type u_2\\nx\u271d\u00b9 : Sort u_3\\nzeta : x\u271d\u00b9\\nx\u271d : Sort u_4\\nIcc : x\u271d\\ninst\u271d\u00b3 : NonAssocSemiring \ud835\udd5c\\ninst\u271d\u00b2 : Preorder \u03b1\\ninst\u271d\u00b9 : LocallyFiniteOrder \u03b1\\ninst\u271d : DecidableLE \u03b1\\na b : \u03b1\\n\u22a2 (sorry * sorry) a b = 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=196, i_end=388, 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.Combinatorics.Enumerative.IncidenceAlgebra).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma zeta_mul_zeta [NonAssocSemiring \ud835\udd5c] [Preorder \u03b1] [LocallyFiniteOrder \u03b1] [DecidableLE \u03b1]\n (a b : \u03b1) : (zeta \ud835\udd5c * zeta \ud835\udd5c : IncidenceAlgebra \ud835\udd5c \u03b1) a b = (Icc a b).card\n:= by .someMissingNamespaceXYZ\nrw [mul_apply, card_eq_sum_ones, Nat.cast_sum, Nat.cast_one]\n refine sum_congr rfl fun x hx \u21a6 ?_\n rw [mem_Icc] at hx\n rw [zeta_of_le hx.1, zeta_of_le hx.2, one_mul]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=196, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n zeta\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n \ud835\udd5c\\n\\nHint: The identifier `zeta` 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=17), pos_end=Position(line=2, column=23), severity=, kind=None), Message(data=\"Function expected at\\n zeta\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n \ud835\udd5c\\n\\nHint: The identifier `zeta` 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=26), pos_end=Position(line=2, column=32), severity=, kind=None), Message(data=\"Function expected at\\n Icc\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `Icc` 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=64), pos_end=Position(line=2, column=71), severity=, kind=None), Message(data='unsolved goals\\n\ud835\udd5c : Type u_1\\n\u03b1 : Type u_2\\nx\u271d\u00b9 : Sort u_3\\nzeta : x\u271d\u00b9\\nx\u271d : Sort u_4\\nIcc : x\u271d\\ninst\u271d\u00b3 : NonAssocSemiring \ud835\udd5c\\ninst\u271d\u00b2 : Preorder \u03b1\\ninst\u271d\u00b9 : LocallyFiniteOrder \u03b1\\ninst\u271d : DecidableLE \u03b1\\na b : \u03b1\\n\u22a2 (sorry * sorry) a b = 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=196, i_end=388, 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/Combinatorics/Enumerative/IncidenceAlgebra.lean", "module": "Mathlib.Combinatorics.Enumerative.IncidenceAlgebra", "declaration": "Mathlib.Combinatorics.Enumerative.IncidenceAlgebra.zeta_mul_zeta", "span": "L340-L346", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Enumerative/IncidenceAlgebra.lean#L340"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1040, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3477, "lean_code_chars": 370, "natural_language_chars": 3107, "lean_code_ratio": 0.1064, "line_count": 18, "imports_count": 0, "declarations_count": 479, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ad0f6c827b9b1d95", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.Perm.Subgroup.sumCongrHom", "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.GroupTheory.Perm.Subgroup)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem sumCongrHom.card_range {\u03b1 \u03b2 : Type*} [Fintype (sumCongrHom \u03b1 \u03b2).range]\n [Fintype (Perm \u03b1 \u00d7 Perm \u03b2)] :\n Fintype.card (sumCongrHom \u03b1 \u03b2).range = Fintype.card (Perm \u03b1 \u00d7 Perm \u03b2)\n:= _unbalancedParenXYZ\nFintype.card_eq.mpr \u27e8(ofInjective (sumCongrHom \u03b1 \u03b2) sumCongrHom_injective).symm\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=308, messages=[Message(data=\"Function expected at\\n sumCongrHom\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `sumCongrHom` 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=55), pos_end=Position(line=1, column=70), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=14), pos_end=Position(line=2, column=20), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b2\\n\\nHint: The identifier `Perm` 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=23), pos_end=Position(line=2, column=29), severity=, kind=None), Message(data=\"Function expected at\\n sumCongrHom\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `sumCongrHom` 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=3, column=18), pos_end=Position(line=3, column=33), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=3, column=57), pos_end=Position(line=3, column=63), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b2\\n\\nHint: The identifier `Perm` 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=3, column=66), pos_end=Position(line=3, column=72), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=4, column=3), pos_end=Position(line=4, column=22), 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.GroupTheory.Perm.Subgroup).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem sumCongrHom.card_range {\u03b1 \u03b2 : Type*} [Fintype (sumCongrHom \u03b1 \u03b2).range]\n [Fintype (Perm \u03b1 \u00d7 Perm \u03b2)] :\n Fintype.card (sumCongrHom \u03b1 \u03b2).range = Fintype.card (Perm \u03b1 \u00d7 Perm \u03b2)\n:= _unbalancedParenXYZ\nFintype.card_eq.mpr \u27e8(ofInjective (sumCongrHom \u03b1 \u03b2) sumCongrHom_injective).symm\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=308, messages=[Message(data=\"Function expected at\\n sumCongrHom\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `sumCongrHom` 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=55), pos_end=Position(line=1, column=70), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=14), pos_end=Position(line=2, column=20), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b2\\n\\nHint: The identifier `Perm` 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=23), pos_end=Position(line=2, column=29), severity=, kind=None), Message(data=\"Function expected at\\n sumCongrHom\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `sumCongrHom` 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=3, column=18), pos_end=Position(line=3, column=33), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `Perm` 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=3, column=57), pos_end=Position(line=3, column=63), severity=, kind=None), Message(data=\"Function expected at\\n Perm\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b2\\n\\nHint: The identifier `Perm` 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=3, column=66), pos_end=Position(line=3, column=72), severity=, kind=None), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=4, column=3), pos_end=Position(line=4, column=22), 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/GroupTheory/Perm/Subgroup.lean", "module": "Mathlib.GroupTheory.Perm.Subgroup", "declaration": "Mathlib.GroupTheory.Perm.Subgroup.sumCongrHom", "span": "L42-L46", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Perm/Subgroup.lean#L42"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1262, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4817, "lean_code_chars": 291, "natural_language_chars": 4526, "lean_code_ratio": 0.0604, "line_count": 16, "imports_count": 0, "declarations_count": 698, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ec0f00345ba58dda", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.Ideal.Quotient.Operations.quotientMap\u2090", "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.RingTheory.Ideal.Quotient.Operations)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef quotientMap\u2090 (f : A \u2192\u2090[R\u2081] B) (hIJ : I \u2264 J.comap f) :\n A \u29f8 I \u2192\u2090[R\u2081] B \u29f8 J\n:= thisIsWrongLemmaNameXYZ\n{ quotientMap J (f : A \u2192+* B) hIJ with commutes' := fun r => by simp only [RingHom.toFun_eq_coe,\n quotientMap_algebraMap, AlgHom.coe_toRingHom, AlgHom.commutes, Quotient.mk_algebraMap] }\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=319, messages=[Message(data='failed to synthesize instance of type class\\n CommSemiring R\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=32), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n CommSemiring R\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=4), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Invalid field notation: Type of\\n J\\nis not known; cannot resolve field `comap`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddCon.comap`\\n \u2022 `AddSubgroup.comap`\\n \u2022 `AddSubmonoid.comap`\\n \u2022 `AddSubsemigroup.comap`\\n \u2022 `AddValuation.comap`\\n \u2022 `AffineSubspace.comap`\\n \u2022 `Archimedean.comap`\\n \u2022 `BooleanSubalgebra.comap`\\n \u2022 `Cauchy.comap`\\n \u2022 `ClosedSubmodule.comap`\\n \u2022 `CompleteSublattice.comap`\\n \u2022 `Con.comap`\\n \u2022 `ConvexCone.comap`\\n \u2022 `DFA.comap`\\n \u2022 `DiscreteQuotient.comap`\\n \u2022 `Equivalence.comap`\\n \u2022 `Filter.comap`\\n \u2022 `FiniteIndexNormalAddSubgroup.comap`\\n \u2022 `FiniteIndexNormalSubgroup.comap`\\n \u2022 `HomogeneousIdeal.comap`\\n \u2022 `Ideal.comap`\\n \u2022 `IntermediateField.comap`\\n \u2022 `IsPiSystem.comap`\\n \u2022 `IsTrans.comap`\\n \u2022 `IsUltraUniformity.comap`\\n \u2022 `IsUniformAddGroup.comap`\\n \u2022 `IsUniformGroup.comap`\\n \u2022 `LTSeries.comap`\\n \u2022 `LieIdeal.comap`\\n \u2022 `LieSubalgebra.comap`\\n \u2022 `LieSubmodule.comap`\\n \u2022 `LocallyConstant.comap`\\n \u2022 `Matroid.comap`\\n \u2022 `MeasurableSpace.comap`\\n \u2022 `MulArchimedean.comap`\\n \u2022 `MvPolynomial.comap`\\n \u2022 `NonUnitalStarSubalgebra.comap`\\n \u2022 `NonUnitalSubalgebra.comap`\\n \u2022 `NonUnitalSubring.comap`\\n \u2022 `NonUnitalSubsemiring.comap`\\n \u2022 `OpenAddSubgroup.comap`\\n \u2022 `OpenSubgroup.comap`\\n \u2022 `PointedCone.comap`\\n \u2022 `PrimeSpectrum.comap`\\n \u2022 `ProperCone.comap`\\n \u2022 `Reflexive.comap`\\n \u2022 `RingCon.comap`\\n \u2022 `SModEq.comap`\\n \u2022 `Setoid.comap`\\n \u2022 `SimpleGraph.comap`\\n \u2022 `SingularManifold.comap`\\n \u2022 `StarSubalgebra.comap`\\n \u2022 `Subalgebra.comap`\\n \u2022 `Subfield.comap`\\n \u2022 `Subgroup.comap`\\n \u2022 `Sublattice.comap`\\n \u2022 `Submodule.comap`\\n \u2022 `Submonoid.comap`\\n \u2022 `Subring.comap`\\n \u2022 `Subsemigroup.comap`\\n \u2022 `Subsemiring.comap`\\n \u2022 `SummationFilter.comap`\\n \u2022 `Symmetric.comap`\\n \u2022 `Transitive.comap`\\n \u2022 `TwoSidedIdeal.comap`\\n \u2022 `Ultrafilter.comap`\\n \u2022 `UniformSpace.comap`\\n \u2022 `Valuation.comap`\\n \u2022 `ValuationSubring.comap`\\n \u2022 `ZLattice.comap`\\n \u2022 `AddSubgroup.IsSubnormal.comap`\\n \u2022 `AddSubgroup.Normal.comap`\\n \u2022 `AddValuation.IsEquiv.comap`\\n \u2022 `AlgebraicGeometry.ProjectiveSpectrum.comap`\\n \u2022 `AlgebraicGeometry.StructureSheaf.comap`\\n \u2022 `CategoryTheory.GradedObject.comap`\\n \u2022 `CategoryTheory.Mod_.comap`\\n \u2022 `CategoryTheory.Pi.comap`\\n \u2022 `CategoryTheory.Precoverage.comap`\\n \u2022 `CategoryTheory.Subgroupoid.comap`\\n \u2022 `Filter.Eventually.comap`\\n \u2022 `Filter.HasAntitoneBasis.comap`\\n \u2022 `Filter.HasBasis.comap`\\n \u2022 `Filter.Realizer.comap`\\n \u2022 `Ideal.IsPrimary.comap`\\n \u2022 `Ideal.IsPrime.comap`\\n \u2022 `Ideal.IsRadical.comap`\\n \u2022 `IsDedekindDomain.HeightOneSpectrum.comap`\\n \u2022 `MeasurableSpace.CountablyGenerated.comap`\\n \u2022 `MeasureTheory.FiniteMeasure.comap`\\n \u2022 `MeasureTheory.Measure.comap`\\n \u2022 `MeasureTheory.OuterMeasure.comap`\\n \u2022 `Module.IsTorsionFree.comap`\\n \u2022 `NumberField.InfinitePlace.comap`\\n \u2022 `ProbabilityTheory.Kernel.comap`\\n \u2022 `SimpleGraph.CliqueFree.comap`\\n \u2022 `SimpleGraph.Embedding.comap`\\n \u2022 `SimpleGraph.Hom.comap`\\n \u2022 `SimpleGraph.IsAcyclic.comap`\\n \u2022 `SimpleGraph.IsCompleteMultipartite.comap`\\n \u2022 `SimpleGraph.Iso.comap`\\n \u2022 `SimpleGraph.Subgraph.comap`\\n \u2022 `Subgroup.IsSubnormal.comap`\\n \u2022 `Subgroup.Normal.comap`\\n \u2022 `Submodule.IsOrtho.comap`\\n \u2022 `TopologicalSpace.IsOpenCover.comap`\\n \u2022 `TopologicalSpace.OpenNhdsOf.comap`\\n \u2022 `TopologicalSpace.Opens.comap`\\n \u2022 `Valuation.IsEquiv.comap`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.comap`\\n \u2022 `CategoryTheory.GrothendieckTopology.Point.comap`\\n \u2022 `FirstOrder.Language.Substructure.comap`\\n \u2022 `MeasureTheory.Measure.InnerRegular.comap`\\n \u2022 `MeasureTheory.Measure.InnerRegularWRT.comap`\\n \u2022 `MeasureTheory.Measure.IsAddHaarMeasure.comap`\\n \u2022 `MeasureTheory.Measure.IsAddLeftInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsAddRightInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsFiniteMeasureOnCompacts.comap`\\n \u2022 `MeasureTheory.Measure.IsHaarMeasure.comap`\\n \u2022 `MeasureTheory.Measure.IsMulLeftInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsMulRightInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsOpenPosMeasure.comap`\\n \u2022 `MeasureTheory.Measure.OuterRegular.comap`\\n \u2022 `MeasureTheory.Measure.Regular.comap`\\n \u2022 `NumberField.InfinitePlace.IsReal.comap`\\n \u2022 `NumberField.InfinitePlace.IsUnramified.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsFiniteKernel.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsMarkovKernel.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsSFiniteKernel.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsZeroOrMarkovKernel.comap`', pos=Position(line=1, column=45), pos_end=Position(line=1, column=54), severity=, kind='lean.invalidField._namedError'), 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.RingTheory.Ideal.Quotient.Operations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef quotientMap\u2090 (f : A \u2192\u2090[R\u2081] B) (hIJ : I \u2264 J.comap f) :\n A \u29f8 I \u2192\u2090[R\u2081] B \u29f8 J\n:= thisIsWrongLemmaNameXYZ\n{ quotientMap J (f : A \u2192+* B) hIJ with commutes' := fun r => by simp only [RingHom.toFun_eq_coe,\n quotientMap_algebraMap, AlgHom.coe_toRingHom, AlgHom.commutes, Quotient.mk_algebraMap] }\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=319, messages=[Message(data='failed to synthesize instance of type class\\n CommSemiring R\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=32), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n CommSemiring R\u2081\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=4), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Invalid field notation: Type of\\n J\\nis not known; cannot resolve field `comap`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddCon.comap`\\n \u2022 `AddSubgroup.comap`\\n \u2022 `AddSubmonoid.comap`\\n \u2022 `AddSubsemigroup.comap`\\n \u2022 `AddValuation.comap`\\n \u2022 `AffineSubspace.comap`\\n \u2022 `Archimedean.comap`\\n \u2022 `BooleanSubalgebra.comap`\\n \u2022 `Cauchy.comap`\\n \u2022 `ClosedSubmodule.comap`\\n \u2022 `CompleteSublattice.comap`\\n \u2022 `Con.comap`\\n \u2022 `ConvexCone.comap`\\n \u2022 `DFA.comap`\\n \u2022 `DiscreteQuotient.comap`\\n \u2022 `Equivalence.comap`\\n \u2022 `Filter.comap`\\n \u2022 `FiniteIndexNormalAddSubgroup.comap`\\n \u2022 `FiniteIndexNormalSubgroup.comap`\\n \u2022 `HomogeneousIdeal.comap`\\n \u2022 `Ideal.comap`\\n \u2022 `IntermediateField.comap`\\n \u2022 `IsPiSystem.comap`\\n \u2022 `IsTrans.comap`\\n \u2022 `IsUltraUniformity.comap`\\n \u2022 `IsUniformAddGroup.comap`\\n \u2022 `IsUniformGroup.comap`\\n \u2022 `LTSeries.comap`\\n \u2022 `LieIdeal.comap`\\n \u2022 `LieSubalgebra.comap`\\n \u2022 `LieSubmodule.comap`\\n \u2022 `LocallyConstant.comap`\\n \u2022 `Matroid.comap`\\n \u2022 `MeasurableSpace.comap`\\n \u2022 `MulArchimedean.comap`\\n \u2022 `MvPolynomial.comap`\\n \u2022 `NonUnitalStarSubalgebra.comap`\\n \u2022 `NonUnitalSubalgebra.comap`\\n \u2022 `NonUnitalSubring.comap`\\n \u2022 `NonUnitalSubsemiring.comap`\\n \u2022 `OpenAddSubgroup.comap`\\n \u2022 `OpenSubgroup.comap`\\n \u2022 `PointedCone.comap`\\n \u2022 `PrimeSpectrum.comap`\\n \u2022 `ProperCone.comap`\\n \u2022 `Reflexive.comap`\\n \u2022 `RingCon.comap`\\n \u2022 `SModEq.comap`\\n \u2022 `Setoid.comap`\\n \u2022 `SimpleGraph.comap`\\n \u2022 `SingularManifold.comap`\\n \u2022 `StarSubalgebra.comap`\\n \u2022 `Subalgebra.comap`\\n \u2022 `Subfield.comap`\\n \u2022 `Subgroup.comap`\\n \u2022 `Sublattice.comap`\\n \u2022 `Submodule.comap`\\n \u2022 `Submonoid.comap`\\n \u2022 `Subring.comap`\\n \u2022 `Subsemigroup.comap`\\n \u2022 `Subsemiring.comap`\\n \u2022 `SummationFilter.comap`\\n \u2022 `Symmetric.comap`\\n \u2022 `Transitive.comap`\\n \u2022 `TwoSidedIdeal.comap`\\n \u2022 `Ultrafilter.comap`\\n \u2022 `UniformSpace.comap`\\n \u2022 `Valuation.comap`\\n \u2022 `ValuationSubring.comap`\\n \u2022 `ZLattice.comap`\\n \u2022 `AddSubgroup.IsSubnormal.comap`\\n \u2022 `AddSubgroup.Normal.comap`\\n \u2022 `AddValuation.IsEquiv.comap`\\n \u2022 `AlgebraicGeometry.ProjectiveSpectrum.comap`\\n \u2022 `AlgebraicGeometry.StructureSheaf.comap`\\n \u2022 `CategoryTheory.GradedObject.comap`\\n \u2022 `CategoryTheory.Mod_.comap`\\n \u2022 `CategoryTheory.Pi.comap`\\n \u2022 `CategoryTheory.Precoverage.comap`\\n \u2022 `CategoryTheory.Subgroupoid.comap`\\n \u2022 `Filter.Eventually.comap`\\n \u2022 `Filter.HasAntitoneBasis.comap`\\n \u2022 `Filter.HasBasis.comap`\\n \u2022 `Filter.Realizer.comap`\\n \u2022 `Ideal.IsPrimary.comap`\\n \u2022 `Ideal.IsPrime.comap`\\n \u2022 `Ideal.IsRadical.comap`\\n \u2022 `IsDedekindDomain.HeightOneSpectrum.comap`\\n \u2022 `MeasurableSpace.CountablyGenerated.comap`\\n \u2022 `MeasureTheory.FiniteMeasure.comap`\\n \u2022 `MeasureTheory.Measure.comap`\\n \u2022 `MeasureTheory.OuterMeasure.comap`\\n \u2022 `Module.IsTorsionFree.comap`\\n \u2022 `NumberField.InfinitePlace.comap`\\n \u2022 `ProbabilityTheory.Kernel.comap`\\n \u2022 `SimpleGraph.CliqueFree.comap`\\n \u2022 `SimpleGraph.Embedding.comap`\\n \u2022 `SimpleGraph.Hom.comap`\\n \u2022 `SimpleGraph.IsAcyclic.comap`\\n \u2022 `SimpleGraph.IsCompleteMultipartite.comap`\\n \u2022 `SimpleGraph.Iso.comap`\\n \u2022 `SimpleGraph.Subgraph.comap`\\n \u2022 `Subgroup.IsSubnormal.comap`\\n \u2022 `Subgroup.Normal.comap`\\n \u2022 `Submodule.IsOrtho.comap`\\n \u2022 `TopologicalSpace.IsOpenCover.comap`\\n \u2022 `TopologicalSpace.OpenNhdsOf.comap`\\n \u2022 `TopologicalSpace.Opens.comap`\\n \u2022 `Valuation.IsEquiv.comap`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.comap`\\n \u2022 `CategoryTheory.GrothendieckTopology.Point.comap`\\n \u2022 `FirstOrder.Language.Substructure.comap`\\n \u2022 `MeasureTheory.Measure.InnerRegular.comap`\\n \u2022 `MeasureTheory.Measure.InnerRegularWRT.comap`\\n \u2022 `MeasureTheory.Measure.IsAddHaarMeasure.comap`\\n \u2022 `MeasureTheory.Measure.IsAddLeftInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsAddRightInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsFiniteMeasureOnCompacts.comap`\\n \u2022 `MeasureTheory.Measure.IsHaarMeasure.comap`\\n \u2022 `MeasureTheory.Measure.IsMulLeftInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsMulRightInvariant.comap`\\n \u2022 `MeasureTheory.Measure.IsOpenPosMeasure.comap`\\n \u2022 `MeasureTheory.Measure.OuterRegular.comap`\\n \u2022 `MeasureTheory.Measure.Regular.comap`\\n \u2022 `NumberField.InfinitePlace.IsReal.comap`\\n \u2022 `NumberField.InfinitePlace.IsUnramified.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsFiniteKernel.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsMarkovKernel.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsSFiniteKernel.comap`\\n \u2022 `ProbabilityTheory.Kernel.IsZeroOrMarkovKernel.comap`', pos=Position(line=1, column=45), pos_end=Position(line=1, column=54), severity=, kind='lean.invalidField._namedError'), 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/RingTheory/Ideal/Quotient/Operations.lean", "module": "Mathlib.RingTheory.Ideal.Quotient.Operations", "declaration": "Mathlib.RingTheory.Ideal.Quotient.Operations.quotientMap\u2090", "span": "L692-L696", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Quotient/Operations.lean#L692"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 2323, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 6468, "lean_code_chars": 298, "natural_language_chars": 6170, "lean_code_ratio": 0.0461, "line_count": 16, "imports_count": 0, "declarations_count": 500, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "e6c9af89c6e0c111", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.arrowCongr", "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.LinearAlgebra.AffineSpace.AffineEquiv)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef arrowCongr : (P\u2081 \u2192\u1d43[R] P\u2083) \u2243\u1d43[R] (P\u2082 \u2192\u1d43[R] P\u2084) where\n __\n:= e\u2081.arrowCongrEquiv e\u2082 .someMissingNamespaceXYZ\nlinear := e\u2081.arrowCongr\u2097 e\u2082.linear\n map_vadd' _ _ := by ext; simp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=136, messages=[Message(data='failed to synthesize instance of type class\\n Ring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=18), pos_end=Position(line=1, column=29), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Ring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=38), pos_end=Position(line=1, column=49), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Ring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=17), pos_end=Position(line=1, column=50), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `e\u2081.arrowCongrEquiv`', pos=Position(line=3, column=3), pos_end=Position(line=3, column=21), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='expected structure', pos=Position(line=1, column=51), pos_end=Position(line=4, column=0), severity=, kind=None), Message(data=\"(kernel) declaration has metavariables 'arrowCongr'\", pos=Position(line=1, column=4), pos_end=Position(line=1, column=14), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=136, i_end=208, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, 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.LinearAlgebra.AffineSpace.AffineEquiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef arrowCongr : (P\u2081 \u2192\u1d43[R] P\u2083) \u2243\u1d43[R] (P\u2082 \u2192\u1d43[R] P\u2084) where\n __\n:= e\u2081.arrowCongrEquiv e\u2082 .someMissingNamespaceXYZ\nlinear := e\u2081.arrowCongr\u2097 e\u2082.linear\n map_vadd' _ _ := by ext; simp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=136, messages=[Message(data='failed to synthesize instance of type class\\n Ring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=18), pos_end=Position(line=1, column=29), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Ring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=38), pos_end=Position(line=1, column=49), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Ring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=17), pos_end=Position(line=1, column=50), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `e\u2081.arrowCongrEquiv`', pos=Position(line=3, column=3), pos_end=Position(line=3, column=21), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='expected structure', pos=Position(line=1, column=51), pos_end=Position(line=4, column=0), severity=, kind=None), Message(data=\"(kernel) declaration has metavariables 'arrowCongr'\", pos=Position(line=1, column=4), pos_end=Position(line=1, column=14), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=136, i_end=208, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, 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/LinearAlgebra/AffineSpace/AffineEquiv.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.AffineEquiv", "declaration": "Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.arrowCongr", "span": "L681-L685", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/AffineEquiv.lean#L681"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 754, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2651, "lean_code_chars": 179, "natural_language_chars": 2472, "lean_code_ratio": 0.0675, "line_count": 16, "imports_count": 0, "declarations_count": 295, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6587beb9788c84fe", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.Pell.d_pos_of_one_lt_x", "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.NumberTheory.Pell)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem d_pos_of_one_lt_x {a : Solution\u2081 d} (ha : 1 < a.x) : 0 < d\n:= by .someMissingNamespaceXYZ\nrefine pos_of_mul_pos_left ?_ (sq_nonneg a.y)\n rw [a.prop_y, sub_pos]\n exact one_lt_pow\u2080 ha two_ne_zero\n\n/-- If a solution has `x > 1`, then `d` is not a square. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=77, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n Solution\u2081\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n d\\n\\nHint: The identifier `Solution\u2081` 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=42), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nSolution\u2081 : x\u271d\\nd : \u2115\\na : sorry\\nha : 1 < sorry\\n\u22a2 0 < d', pos=Position(line=2, column=6), pos_end=Position(line=2, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=77, i_end=268, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=59), 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.NumberTheory.Pell).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem d_pos_of_one_lt_x {a : Solution\u2081 d} (ha : 1 < a.x) : 0 < d\n:= by .someMissingNamespaceXYZ\nrefine pos_of_mul_pos_left ?_ (sq_nonneg a.y)\n rw [a.prop_y, sub_pos]\n exact one_lt_pow\u2080 ha two_ne_zero\n\n/-- If a solution has `x > 1`, then `d` is not a square. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=77, messages=[Message(data='unknown tactic', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n Solution\u2081\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n d\\n\\nHint: The identifier `Solution\u2081` 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=42), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nSolution\u2081 : x\u271d\\nd : \u2115\\na : sorry\\nha : 1 < sorry\\n\u22a2 0 < d', pos=Position(line=2, column=6), pos_end=Position(line=2, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=77, i_end=268, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=59), 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/NumberTheory/Pell.lean", "module": "Mathlib.NumberTheory.Pell", "declaration": "Mathlib.NumberTheory.Pell.d_pos_of_one_lt_x", "span": "L208-L213", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Pell.lean#L208"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 626, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2121, "lean_code_chars": 265, "natural_language_chars": 1856, "lean_code_ratio": 0.1249, "line_count": 18, "imports_count": 0, "declarations_count": 271, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "b76e5c14d9d24446", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.Polynomial.Degree.Defs.Monic", "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.Algebra.Polynomial.Degree.Defs)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Monic.ne_zero_of_ne (h : (0 : R) \u2260 1) {p : R[X]} (hp : p.Monic) : p \u2260 0\n:= by thisIsWrongLemmaNameXYZ\nnontriviality R\n exact hp.ne_zero\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=91, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n OfNat R 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n R\\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=34), pos_end=Position(line=1, column=35), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat R 1\\nnumerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is\\n R\\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=43), pos_end=Position(line=1, column=44), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Invalid field notation: Field projection operates on types of the form `C ...` where C is a constant. The expression\\n p\\nhas type `?m.12.1 R X ?m.13` which does not have the necessary form.', pos=Position(line=1, column=63), pos_end=Position(line=1, column=70), severity=, kind='lean.invalidField._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat R[X] 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n R[X]\\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=78), pos_end=Position(line=1, column=79), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='unsolved goals\\nR : Type u_1\\nidx\u271d : Type u_2\\nX : idx\u271d\\nh : sorry \u2260 1\\np : R[X]\\nhp : sorry\\n\u22a2 p \u2260 0', 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=91, i_end=148, 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.Algebra.Polynomial.Degree.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Monic.ne_zero_of_ne (h : (0 : R) \u2260 1) {p : R[X]} (hp : p.Monic) : p \u2260 0\n:= by thisIsWrongLemmaNameXYZ\nnontriviality R\n exact hp.ne_zero\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=91, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n OfNat R 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n R\\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=34), pos_end=Position(line=1, column=35), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat R 1\\nnumerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is\\n R\\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=43), pos_end=Position(line=1, column=44), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Invalid field notation: Field projection operates on types of the form `C ...` where C is a constant. The expression\\n p\\nhas type `?m.12.1 R X ?m.13` which does not have the necessary form.', pos=Position(line=1, column=63), pos_end=Position(line=1, column=70), severity=, kind='lean.invalidField._namedError'), Message(data='failed to synthesize instance of type class\\n OfNat R[X] 0\\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\\n R[X]\\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=78), pos_end=Position(line=1, column=79), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='unsolved goals\\nR : Type u_1\\nidx\u271d : Type u_2\\nX : idx\u271d\\nh : sorry \u2260 1\\np : R[X]\\nhp : sorry\\n\u22a2 p \u2260 0', 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=91, i_end=148, 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/Algebra/Polynomial/Degree/Defs.lean", "module": "Mathlib.Algebra.Polynomial.Degree.Defs", "declaration": "Mathlib.Algebra.Polynomial.Degree.Defs.Monic", "span": "L462-L465", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Degree/Defs.lean#L462"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 889, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3119, "lean_code_chars": 145, "natural_language_chars": 2974, "lean_code_ratio": 0.0465, "line_count": 15, "imports_count": 0, "declarations_count": 398, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "519df5d6bb683366", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Real.ConjExponents.inv_inv_add_inv", "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.Data.Real.ConjExponents)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma inv_inv_add_inv : (p\u207b\u00b9 + q\u207b\u00b9)\u207b\u00b9 = r\n frobnicateTacticThatDoesNotExist := by exact_mod_cast h.coe.inv_inv_add_inv\nprotected lemma inv_lt_inv : p\u207b\u00b9 < r\u207b\u00b9 := h.coe.inv_lt_inv\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=129, messages=[Message(data=\"Function expected at\\n r\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist\\n\\nHint: The identifier `r` 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=40), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `h.coe.inv_inv_add_inv`', pos=Position(line=2, column=56), pos_end=Position(line=2, column=77), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=129, i_end=193, messages=[Message(data='protected declarations must be in a namespace', pos=Position(line=3, column=16), pos_end=Position(line=3, column=26), 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.Data.Real.ConjExponents).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma inv_inv_add_inv : (p\u207b\u00b9 + q\u207b\u00b9)\u207b\u00b9 = r\n frobnicateTacticThatDoesNotExist := by exact_mod_cast h.coe.inv_inv_add_inv\nprotected lemma inv_lt_inv : p\u207b\u00b9 < r\u207b\u00b9 := h.coe.inv_lt_inv\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=129, messages=[Message(data=\"Function expected at\\n r\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist\\n\\nHint: The identifier `r` 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=40), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `h.coe.inv_inv_add_inv`', pos=Position(line=2, column=56), pos_end=Position(line=2, column=77), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=129, i_end=193, messages=[Message(data='protected declarations must be in a namespace', pos=Position(line=3, column=16), pos_end=Position(line=3, column=26), 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/Data/Real/ConjExponents.lean", "module": "Mathlib.Data.Real.ConjExponents", "declaration": "Mathlib.Data.Real.ConjExponents.inv_inv_add_inv", "span": "L302-L304", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Real/ConjExponents.lean#L302"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 543, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1935, "lean_code_chars": 179, "natural_language_chars": 1756, "lean_code_ratio": 0.0925, "line_count": 14, "imports_count": 0, "declarations_count": 231, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "dbce441efe6eee60", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.Category.BddDistLat.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.Order.Category.BddDistLat)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef Hom.Simps.hom (X Y : BddDistLat.{u}) (f : Hom X Y)\n:= thisIsWrongLemmaNameXYZ\nf.hom\n\ninitialize_simps_projections Hom (hom' \u2192 hom)\n\n/-!\nThe results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=89, messages=[Message(data=\"Function expected at\\n Hom\\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 `Hom` 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=46), pos_end=Position(line=1, column=53), 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=89, i_end=138, messages=[Message(data='Unknown constant `Hom`', pos=Position(line=5, column=29), pos_end=Position(line=5, column=32), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=138, i_end=242, 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.Order.Category.BddDistLat).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef Hom.Simps.hom (X Y : BddDistLat.{u}) (f : Hom X Y)\n:= thisIsWrongLemmaNameXYZ\nf.hom\n\ninitialize_simps_projections Hom (hom' \u2192 hom)\n\n/-!\nThe results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=89, messages=[Message(data=\"Function expected at\\n Hom\\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 `Hom` 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=46), pos_end=Position(line=1, column=53), 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=89, i_end=138, messages=[Message(data='Unknown constant `Hom`', pos=Position(line=5, column=29), pos_end=Position(line=5, column=32), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=138, i_end=242, 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/Order/Category/BddDistLat.lean", "module": "Mathlib.Order.Category.BddDistLat", "declaration": "Mathlib.Order.Category.BddDistLat.Hom", "span": "L84-L92", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Category/BddDistLat.lean#L84"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 580, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2115, "lean_code_chars": 241, "natural_language_chars": 1874, "lean_code_ratio": 0.1139, "line_count": 20, "imports_count": 0, "declarations_count": 255, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "83d1ee6daa073a2e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.QuasiSeparated.QuasiSeparatedSpace", "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.Topology.QuasiSeparated)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma QuasiSeparatedSpace.isCompact_sInter_of_nonempty {s : Set (Set \u03b1)} (hf : s.Finite)\n (hne : s.Nonempty) (ho : \u2200 t \u2208 s, IsOpen t \u2228 IsClosed t) (hc : \u2200 t \u2208 s, IsCompact t) :\n IsCompact (\u22c2\u2080 s)\n:= by _unbalancedParenXYZ\nwlog h : \u2200 t \u2208 s, IsOpen t\n \u00b7 let a := { t \u2208 s | IsOpen t }\n let b := { t \u2208 s | IsClosed t }\n have heq : s = a \u222a b := subset_antisymm (by grind) (by grind)\n rw [heq, Set.sInter_union]\n simp only [not_forall] at h\n obtain \u27e8t, ht, hno\u27e9 := h\n obtain (ha | ha) := a.eq_empty_or_nonempty\n \u00b7 simp only [ha, Set.sInter_empty, Set.univ_inter]\n exact IsCompact.of_isClosed_subset (hc _ ht) (isClosed_sInter (by grind)) (by grind)\n \u00b7 apply IsCompact.inter_right\n \u00b7 apply this (hf.subset (by grind)) ha <;> grind\n \u00b7 exact isClosed_sInter (by grind)\n revert hne\n induction s, hf using Set.Finite.induction_on with\n | empty => simp\n | insert ha hs ih =>\n rename_i s\n obtain (rfl | hne) := s.eq_empty_or_nonempty\n \u00b7 grind\n \u00b7 grind [IsCompact.inter_of_isOpen, hs.isOpen_sInter, Set.sInter_insert]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=223, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=223, i_end=1100, 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.Topology.QuasiSeparated).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma QuasiSeparatedSpace.isCompact_sInter_of_nonempty {s : Set (Set \u03b1)} (hf : s.Finite)\n (hne : s.Nonempty) (ho : \u2200 t \u2208 s, IsOpen t \u2228 IsClosed t) (hc : \u2200 t \u2208 s, IsCompact t) :\n IsCompact (\u22c2\u2080 s)\n:= by _unbalancedParenXYZ\nwlog h : \u2200 t \u2208 s, IsOpen t\n \u00b7 let a := { t \u2208 s | IsOpen t }\n let b := { t \u2208 s | IsClosed t }\n have heq : s = a \u222a b := subset_antisymm (by grind) (by grind)\n rw [heq, Set.sInter_union]\n simp only [not_forall] at h\n obtain \u27e8t, ht, hno\u27e9 := h\n obtain (ha | ha) := a.eq_empty_or_nonempty\n \u00b7 simp only [ha, Set.sInter_empty, Set.univ_inter]\n exact IsCompact.of_isClosed_subset (hc _ ht) (isClosed_sInter (by grind)) (by grind)\n \u00b7 apply IsCompact.inter_right\n \u00b7 apply this (hf.subset (by grind)) ha <;> grind\n \u00b7 exact isClosed_sInter (by grind)\n revert hne\n induction s, hf using Set.Finite.induction_on with\n | empty => simp\n | insert ha hs ih =>\n rename_i s\n obtain (rfl | hne) := s.eq_empty_or_nonempty\n \u00b7 grind\n \u00b7 grind [IsCompact.inter_of_isOpen, hs.isOpen_sInter, Set.sInter_insert]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=223, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=223, i_end=1100, 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/Topology/QuasiSeparated.lean", "module": "Mathlib.Topology.QuasiSeparated", "declaration": "Mathlib.Topology.QuasiSeparated.QuasiSeparatedSpace", "span": "L142-L166", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/QuasiSeparated.lean#L142"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 615, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1926, "lean_code_chars": 1065, "natural_language_chars": 861, "lean_code_ratio": 0.553, "line_count": 36, "imports_count": 0, "declarations_count": 215, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "2be671e5cad66274", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Calculus.FDeriv.Equiv.UniqueDiffOn", "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.Analysis.Calculus.FDeriv.Equiv)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem UniqueDiffOn.image {f' : E \u2192 E \u2192L[\ud835\udd5c] F} (hs : UniqueDiffOn \ud835\udd5c s)\n (hf' : \u2200 x \u2208 s, HasFDerivWithinAt f (f' x) s x) (hd : \u2200 x \u2208 s, DenseRange (f' x)) :\n UniqueDiffOn \ud835\udd5c (f '' s)\n:= .someMissingNamespaceXYZ\nforall_mem_image.2 fun x hx => (hf' x hx).uniqueDiffWithinAt (hs x hx) (hd x hx)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=317, messages=[Message(data='`UniqueDiffOn.image` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=26), 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.Analysis.Calculus.FDeriv.Equiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem UniqueDiffOn.image {f' : E \u2192 E \u2192L[\ud835\udd5c] F} (hs : UniqueDiffOn \ud835\udd5c s)\n (hf' : \u2200 x \u2208 s, HasFDerivWithinAt f (f' x) s x) (hd : \u2200 x \u2208 s, DenseRange (f' x)) :\n UniqueDiffOn \ud835\udd5c (f '' s)\n:= .someMissingNamespaceXYZ\nforall_mem_image.2 fun x hx => (hf' x hx).uniqueDiffWithinAt (hs x hx) (hd x hx)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=317, messages=[Message(data='`UniqueDiffOn.image` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=26), 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/Analysis/Calculus/FDeriv/Equiv.lean", "module": "Mathlib.Analysis.Calculus.FDeriv.Equiv", "declaration": "Mathlib.Analysis.Calculus.FDeriv.Equiv.UniqueDiffOn", "span": "L509-L513", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/FDeriv/Equiv.lean#L509"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 349, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1084, "lean_code_chars": 297, "natural_language_chars": 787, "lean_code_ratio": 0.274, "line_count": 16, "imports_count": 0, "declarations_count": 128, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1f1c81c4fd0b185f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.SimpleGraph.Finsubgraph.FinsubgraphHom", "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.Combinatorics.SimpleGraph.Finsubgraph)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef FinsubgraphHom.restrict {G' G'' : G.Finsubgraph} (h : G'' \u2264 G') (f : G' \u2192fg F) : G'' \u2192fg F\n frobnicateTacticThatDoesNotExist := by\nrefine \u27e8fun \u27e8v, hv\u27e9 => f.toFun \u27e8v, h.1 hv\u27e9, ?_\u27e9\n rintro \u27e8u, hu\u27e9 \u27e8v, hv\u27e9 huv\n exact f.map_rel' (h.2 huv)\n\n/-- The inverse system of finite homomorphisms. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=269, messages=[Message(data='Unknown identifier `G.Finsubgraph`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `G.Finsubgraph`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Invalid `\u27e8...\u27e9` notation: The expected type of this term could not be determined', pos=Position(line=3, column=7), pos_end=Position(line=3, column=47), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=269, i_end=319, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, 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.Combinatorics.SimpleGraph.Finsubgraph).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef FinsubgraphHom.restrict {G' G'' : G.Finsubgraph} (h : G'' \u2264 G') (f : G' \u2192fg F) : G'' \u2192fg F\n frobnicateTacticThatDoesNotExist := by\nrefine \u27e8fun \u27e8v, hv\u27e9 => f.toFun \u27e8v, h.1 hv\u27e9, ?_\u27e9\n rintro \u27e8u, hu\u27e9 \u27e8v, hv\u27e9 huv\n exact f.map_rel' (h.2 huv)\n\n/-- The inverse system of finite homomorphisms. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=269, messages=[Message(data='Unknown identifier `G.Finsubgraph`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `G.Finsubgraph`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Invalid `\u27e8...\u27e9` notation: The expected type of this term could not be determined', pos=Position(line=3, column=7), pos_end=Position(line=3, column=47), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=269, i_end=319, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, 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/Combinatorics/SimpleGraph/Finsubgraph.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Finsubgraph", "declaration": "Mathlib.Combinatorics.SimpleGraph.Finsubgraph.FinsubgraphHom", "span": "L141-L146", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Finsubgraph.lean#L141"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 553, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1792, "lean_code_chars": 294, "natural_language_chars": 1498, "lean_code_ratio": 0.1641, "line_count": 18, "imports_count": 0, "declarations_count": 198, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "82af2b3150cd1854", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.Sylow.normalizer_sup_eq_top'", "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.GroupTheory.Sylow)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem normalizer_sup_eq_top' {p : \u2115} [Fact p.Prime] {N : Subgroup G} [N.Normal]\n [Finite (Sylow p N)] (P : Sylow p G) (hP : P \u2264 N) : normalizer (P : Subgroup G) \u2294 N = \u22a4\n:= by .someMissingNamespaceXYZ\nrw [\u2190 normalizer_sup_eq_top (P.subtype hP), P.coe_subtype, subgroupOf_map_subtype,\n inf_of_le_left hP]\n\nend Sylow\n\nend InfiniteSylow\n\nopen Equiv Equiv.Perm Finset Function List QuotientGroup\n\nuniverse u\n\nvariable {G : Type u} [Group G]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=190, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Group G\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=59), pos_end=Position(line=1, column=69), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=190, i_end=333, messages=[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=9), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=333, i_end=352, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, column=17), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=352, i_end=410, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=410, i_end=422, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=422, i_end=453, 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.GroupTheory.Sylow).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem normalizer_sup_eq_top' {p : \u2115} [Fact p.Prime] {N : Subgroup G} [N.Normal]\n [Finite (Sylow p N)] (P : Sylow p G) (hP : P \u2264 N) : normalizer (P : Subgroup G) \u2294 N = \u22a4\n:= by .someMissingNamespaceXYZ\nrw [\u2190 normalizer_sup_eq_top (P.subtype hP), P.coe_subtype, subgroupOf_map_subtype,\n inf_of_le_left hP]\n\nend Sylow\n\nend InfiniteSylow\n\nopen Equiv Equiv.Perm Finset Function List QuotientGroup\n\nuniverse u\n\nvariable {G : Type u} [Group G]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=190, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Group G\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=59), pos_end=Position(line=1, column=69), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=190, i_end=333, messages=[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=9), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=333, i_end=352, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, column=17), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=352, i_end=410, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=410, i_end=422, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=422, i_end=453, 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/GroupTheory/Sylow.lean", "module": "Mathlib.GroupTheory.Sylow", "declaration": "Mathlib.GroupTheory.Sylow.normalizer_sup_eq_top'", "span": "L492-L506", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Sylow.lean#L492"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 770, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2653, "lean_code_chars": 444, "natural_language_chars": 2209, "lean_code_ratio": 0.1674, "line_count": 26, "imports_count": 0, "declarations_count": 298, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "e1b9cefbc89dea36", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.HahnSeries.Addition.truncLT_smul", "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.RingTheory.HahnSeries.Addition)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem truncLT_smul [DecidableLT \u0393] (c : \u0393) (r : R) (x : V\u27e6\u0393\u27e7) :\n truncLT c (r \u2022 x) = r \u2022 truncLT c x\n frobnicateTacticThatDoesNotExist := by ext; simp\nend SMulZeroClass\n\nsection Addition\n\nvariable [PartialOrder \u0393]\n\nsection AddMonoid\n\nvariable [AddMonoid R]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=168, messages=[Message(data='failed to synthesize instance of type class\\n LT \u0393\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=35), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=168, i_end=187, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=4, column=0), pos_end=Position(line=4, column=17), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=187, i_end=205, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=205, i_end=233, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=233, i_end=252, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=252, i_end=274, 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.RingTheory.HahnSeries.Addition).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem truncLT_smul [DecidableLT \u0393] (c : \u0393) (r : R) (x : V\u27e6\u0393\u27e7) :\n truncLT c (r \u2022 x) = r \u2022 truncLT c x\n frobnicateTacticThatDoesNotExist := by ext; simp\nend SMulZeroClass\n\nsection Addition\n\nvariable [PartialOrder \u0393]\n\nsection AddMonoid\n\nvariable [AddMonoid R]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=168, messages=[Message(data='failed to synthesize instance of type class\\n LT \u0393\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=22), pos_end=Position(line=1, column=35), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=168, i_end=187, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=4, column=0), pos_end=Position(line=4, column=17), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=187, i_end=205, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=205, i_end=233, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=233, i_end=252, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=252, i_end=274, 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/RingTheory/HahnSeries/Addition.lean", "module": "Mathlib.RingTheory.HahnSeries.Addition", "declaration": "Mathlib.RingTheory.HahnSeries.Addition.truncLT_smul", "span": "L89-L101", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/HahnSeries/Addition.lean#L89"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 609, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2128, "lean_code_chars": 263, "natural_language_chars": 1865, "lean_code_ratio": 0.1236, "line_count": 23, "imports_count": 0, "declarations_count": 228, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "cb60b991da4e96e1", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Finsupp.LSum.domLCongr_apply", "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.LinearAlgebra.Finsupp.LSum)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem domLCongr_apply {\u03b1\u2081 : Type*} {\u03b1\u2082 : Type*} (e : \u03b1\u2081 \u2243 \u03b1\u2082) (v : \u03b1\u2081 \u2192\u2080 M) :\n (Finsupp.domLCongr e : _ \u2243\u2097[R] _) v = Finsupp.domCongr e v\n frobnicateTacticThatDoesNotExist :=\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=209, messages=[Message(data='failed to synthesize instance of type class\\n Zero M\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=69), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=27), pos_end=Position(line=2, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=27), pos_end=Position(line=2, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Application type mismatch: The argument\\n frobnicateTacticThatDoesNotExist\\nhas type\\n ?m.3\\nbut is expected to have type\\n \u03b1\u2082\\nin the application\\n ((Finsupp.domCongr e) ?m.34) frobnicateTacticThatDoesNotExist', pos=Position(line=3, column=2), pos_end=Position(line=3, column=34), 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.LinearAlgebra.Finsupp.LSum).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem domLCongr_apply {\u03b1\u2081 : Type*} {\u03b1\u2082 : Type*} (e : \u03b1\u2081 \u2243 \u03b1\u2082) (v : \u03b1\u2081 \u2192\u2080 M) :\n (Finsupp.domLCongr e : _ \u2243\u2097[R] _) v = Finsupp.domCongr e v\n frobnicateTacticThatDoesNotExist :=\nrfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=209, messages=[Message(data='failed to synthesize instance of type class\\n Zero M\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=69), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=27), pos_end=Position(line=2, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=27), pos_end=Position(line=2, column=36), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Application type mismatch: The argument\\n frobnicateTacticThatDoesNotExist\\nhas type\\n ?m.3\\nbut is expected to have type\\n \u03b1\u2082\\nin the application\\n ((Finsupp.domCongr e) ?m.34) frobnicateTacticThatDoesNotExist', pos=Position(line=3, column=2), pos_end=Position(line=3, column=34), 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/LinearAlgebra/Finsupp/LSum.lean", "module": "Mathlib.LinearAlgebra.Finsupp.LSum", "declaration": "Mathlib.LinearAlgebra.Finsupp.LSum.domLCongr_apply", "span": "L187-L190", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Finsupp/LSum.lean#L187"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 623, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2181, "lean_code_chars": 185, "natural_language_chars": 1996, "lean_code_ratio": 0.0848, "line_count": 15, "imports_count": 0, "declarations_count": 244, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "0c39f984d5cbf1b7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.SelbergSieve.prodPrimes_ne_zero", "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.NumberTheory.SelbergSieve)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem prodPrimes_ne_zero : s.prodPrimes \u2260 0\n frobnicateTacticThatDoesNotExist :=\nSquarefree.ne_zero s.prodPrimes_squarefree\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=128, messages=[Message(data='Unknown identifier `s.prodPrimes`', pos=Position(line=1, column=29), pos_end=Position(line=1, column=41), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Function expected at\\n 0\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=44), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `s.prodPrimes_squarefree`', pos=Position(line=3, column=19), pos_end=Position(line=3, column=42), 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.NumberTheory.SelbergSieve).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem prodPrimes_ne_zero : s.prodPrimes \u2260 0\n frobnicateTacticThatDoesNotExist :=\nSquarefree.ne_zero s.prodPrimes_squarefree\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=128, messages=[Message(data='Unknown identifier `s.prodPrimes`', pos=Position(line=1, column=29), pos_end=Position(line=1, column=41), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Function expected at\\n 0\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=44), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `s.prodPrimes_squarefree`', pos=Position(line=3, column=19), pos_end=Position(line=3, column=42), 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/NumberTheory/SelbergSieve.lean", "module": "Mathlib.NumberTheory.SelbergSieve", "declaration": "Mathlib.NumberTheory.SelbergSieve.prodPrimes_ne_zero", "span": "L107-L109", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/SelbergSieve.lean#L107"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 411, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1436, "lean_code_chars": 127, "natural_language_chars": 1309, "lean_code_ratio": 0.0884, "line_count": 14, "imports_count": 0, "declarations_count": 147, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b09454dd45b50c0b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Algebra.CharP.Algebra.algebraRat", "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.Algebra.CharP.Algebra)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem algebraRat.charP_zero [Semiring R] [Algebra \u211a R] : CharP R 0\n:= .someMissingNamespaceXYZ\ncharP_of_injective_algebraMap (algebraMap \u211a R).injective 0\n\n/-- A nontrivial `\u211a`-algebra has characteristic zero.\n\nThis cannot be a (local) instance because it would immediately form a loop with the\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=161, messages=[Message(data='`algebraRat.charP_zero` has already been declared', pos=Position(line=1, column=8), 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=161, i_end=301, messages=[Message(data='unterminated comment', pos=Position(line=7, column=83), 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.Algebra.CharP.Algebra).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem algebraRat.charP_zero [Semiring R] [Algebra \u211a R] : CharP R 0\n:= .someMissingNamespaceXYZ\ncharP_of_injective_algebraMap (algebraMap \u211a R).injective 0\n\n/-- A nontrivial `\u211a`-algebra has characteristic zero.\n\nThis cannot be a (local) instance because it would immediately form a loop with the\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=161, messages=[Message(data='`algebraRat.charP_zero` has already been declared', pos=Position(line=1, column=8), 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=161, i_end=301, messages=[Message(data='unterminated comment', pos=Position(line=7, column=83), 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/Algebra/CharP/Algebra.lean", "module": "Mathlib.Algebra.CharP.Algebra", "declaration": "Mathlib.Algebra.CharP.Algebra.algebraRat", "span": "L153-L158", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/CharP/Algebra.lean#L153"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 374, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1336, "lean_code_chars": 296, "natural_language_chars": 1040, "lean_code_ratio": 0.2216, "line_count": 18, "imports_count": 0, "declarations_count": 145, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "146524cad58925c5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Data.Nat.Log.log_lt_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.Data.Nat.Log)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma log_lt_self (b : \u2115) {x : \u2115} (hx : x \u2260 0) : log b x < x\n:= thisIsWrongLemmaNameXYZ\nmatch le_or_gt b 1 with\n | .inl h => log_of_left_le_one h x \u25b8 Nat.pos_iff_ne_zero.2 hx\n | .inr h => log_lt_of_lt_pow hx <| Nat.lt_pow_self h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=120, messages=[Message(data=\"unexpected token '|'; expected '.'\", pos=Position(line=3, column=23), pos_end=Position(line=4, column=3), severity=, kind=None), Message(data=\"Function expected at\\n log\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\\n\\nHint: The identifier `log` 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=49), pos_end=Position(line=1, column=56), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=120, i_end=238, 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.Data.Nat.Log).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma log_lt_self (b : \u2115) {x : \u2115} (hx : x \u2260 0) : log b x < x\n:= thisIsWrongLemmaNameXYZ\nmatch le_or_gt b 1 with\n | .inl h => log_of_left_le_one h x \u25b8 Nat.pos_iff_ne_zero.2 hx\n | .inr h => log_lt_of_lt_pow hx <| Nat.lt_pow_self h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=120, messages=[Message(data=\"unexpected token '|'; expected '.'\", pos=Position(line=3, column=23), pos_end=Position(line=4, column=3), severity=, kind=None), Message(data=\"Function expected at\\n log\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\\n\\nHint: The identifier `log` 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=49), pos_end=Position(line=1, column=56), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=120, i_end=238, 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/Data/Nat/Log.lean", "module": "Mathlib.Data.Nat.Log", "declaration": "Mathlib.Data.Nat.Log.log_lt_self", "span": "L196-L200", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Nat/Log.lean#L196"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 505, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1736, "lean_code_chars": 231, "natural_language_chars": 1505, "lean_code_ratio": 0.1331, "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": "05cdac57498fde50", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Order.ConditionallyCompleteLattice.Basic.csInf_image_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.Order.ConditionallyCompleteLattice.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem csInf_image_le {s : Set \u03b1} {c : \u03b1} (hcs : c \u2208 s) (h_bdd : BddBelow s) :\n sInf (f '' s) \u2264 f c\n frobnicateTacticThatDoesNotExist := by\nlet f' : \u03b1\u1d52\u1d48 \u2192 \u03b2\u1d52\u1d48 := f\n exact le_csSup_image (\u03b1 := \u03b1\u1d52\u1d48) (\u03b2 := \u03b2\u1d52\u1d48)\n (show Monotone f' from fun x y hxy => h_mono hxy) hcs h_bdd\n\n-- Porting note: in mathlib3 `f'` is not needed\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=356, messages=[Message(data='failed to synthesize instance of type class\\n LE \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=66), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Function expected at\\n f c\\nbut this term has type\\n ?m.13\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=2, column=20), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='Unknown identifier `\u03b2`', pos=Position(line=4, column=15), pos_end=Position(line=4, column=16), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `exact`', pos=Position(line=5, column=2), pos_end=Position(line=5, column=7), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Invalid argument name `\u03b1` for function', pos=Position(line=5, column=23), pos_end=Position(line=5, column=33), severity=, kind=None), Message(data=\"unsolved goals\\n\u03b1 : Type u_1\\n\u03b1\u271d : Type u_2\\nf : \u03b1 \u2192 \u03b1\u271d\\ns : Set \u03b1\\nc : \u03b1\\nhcs : c \u2208 s\\nh_bdd : sorry\\nf' : \u03b1\u1d52\u1d48 \u2192 sorry\u1d52\u1d48 := sorry\\n\u22a2 sInf (f '' s) \u2264 sorry\", pos=Position(line=3, column=38), pos_end=Position(line=6, column=63), severity=, kind='Tactic.unsolvedGoals')], 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.Order.ConditionallyCompleteLattice.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem csInf_image_le {s : Set \u03b1} {c : \u03b1} (hcs : c \u2208 s) (h_bdd : BddBelow s) :\n sInf (f '' s) \u2264 f c\n frobnicateTacticThatDoesNotExist := by\nlet f' : \u03b1\u1d52\u1d48 \u2192 \u03b2\u1d52\u1d48 := f\n exact le_csSup_image (\u03b1 := \u03b1\u1d52\u1d48) (\u03b2 := \u03b2\u1d52\u1d48)\n (show Monotone f' from fun x y hxy => h_mono hxy) hcs h_bdd\n\n-- Porting note: in mathlib3 `f'` is not needed\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=356, messages=[Message(data='failed to synthesize instance of type class\\n LE \u03b1\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=66), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Function expected at\\n f c\\nbut this term has type\\n ?m.13\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=2, column=20), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='Unknown identifier `\u03b2`', pos=Position(line=4, column=15), pos_end=Position(line=4, column=16), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `exact`', pos=Position(line=5, column=2), pos_end=Position(line=5, column=7), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Invalid argument name `\u03b1` for function', pos=Position(line=5, column=23), pos_end=Position(line=5, column=33), severity=, kind=None), Message(data=\"unsolved goals\\n\u03b1 : Type u_1\\n\u03b1\u271d : Type u_2\\nf : \u03b1 \u2192 \u03b1\u271d\\ns : Set \u03b1\\nc : \u03b1\\nhcs : c \u2208 s\\nh_bdd : sorry\\nf' : \u03b1\u1d52\u1d48 \u2192 sorry\u1d52\u1d48 := sorry\\n\u22a2 sInf (f '' s) \u2264 sorry\", pos=Position(line=3, column=38), pos_end=Position(line=6, column=63), severity=, kind='Tactic.unsolvedGoals')], 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/Order/ConditionallyCompleteLattice/Basic.lean", "module": "Mathlib.Order.ConditionallyCompleteLattice.Basic", "declaration": "Mathlib.Order.ConditionallyCompleteLattice.Basic.csInf_image_le", "span": "L725-L731", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/ConditionallyCompleteLattice/Basic.lean#L725"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 779, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2433, "lean_code_chars": 327, "natural_language_chars": 2106, "lean_code_ratio": 0.1344, "line_count": 19, "imports_count": 0, "declarations_count": 282, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "909c34fc83df59ab", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Topology.Algebra.Valued.WithVal.withValEquiv", "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.Topology.Algebra.Valued.WithVal)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef withValEquiv (R : Type*) [CommRing R] [Algebra R K] [IsIntegralClosure R \u2124 K] :\n \ud835\udcde (WithVal v) \u2243+* R\n:= NumberField.RingOfIntegers.equiv R \u27e8\u27e9\u27e8\u27e9\nend NumberField.RingOfIntegers\n\nopen scoped NumberField in\n/-- The ring of integers of `WithVal v`, when `v` is a valuation on `\u211a`, is\nequivalent to `\u2124`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=159, messages=[Message(data='failed to synthesize instance of type class\\n Semiring K\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=54), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=159, i_end=198, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=40), pos_end=Position(line=3, column=41), 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=4, column=0), pos_end=Position(line=4, column=30), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=198, i_end=326, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=21), 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.Topology.Algebra.Valued.WithVal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef withValEquiv (R : Type*) [CommRing R] [Algebra R K] [IsIntegralClosure R \u2124 K] :\n \ud835\udcde (WithVal v) \u2243+* R\n:= NumberField.RingOfIntegers.equiv R \u27e8\u27e9\u27e8\u27e9\nend NumberField.RingOfIntegers\n\nopen scoped NumberField in\n/-- The ring of integers of `WithVal v`, when `v` is a valuation on `\u211a`, is\nequivalent to `\u2124`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=159, messages=[Message(data='failed to synthesize instance of type class\\n Semiring K\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=54), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=159, i_end=198, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=3, column=40), pos_end=Position(line=3, column=41), 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=4, column=0), pos_end=Position(line=4, column=30), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=198, i_end=326, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=21), 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/Topology/Algebra/Valued/WithVal.lean", "module": "Mathlib.Topology.Algebra.Valued.WithVal", "declaration": "Mathlib.Topology.Algebra.Valued.WithVal.withValEquiv", "span": "L623-L630", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Valued/WithVal.lean#L623"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 608, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2087, "lean_code_chars": 308, "natural_language_chars": 1779, "lean_code_ratio": 0.1476, "line_count": 19, "imports_count": 0, "declarations_count": 237, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "437106589294f8f0", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Analysis.Fourier.AddCircleMulti.hasSum_mFourier_series_apply_of_summable", "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.Analysis.Fourier.AddCircleMulti)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem hasSum_mFourier_series_apply_of_summable (h : Summable (mFourierCoeff f))\n (x : UnitAddTorus d) : HasSum (fun i \u21a6 mFourierCoeff f i \u2022 mFourier i x) (f x)\n:= by .someMissingNamespaceXYZ\nsimpa only [map_smul] using (ContinuousMap.evalCLM \u2102 x).hasSum\n (hasSum_mFourier_series_of_summable h)\n\nend Convergence\n\nend UnitAddTorus\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=177, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n mFourierCoeff\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `mFourierCoeff` 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=64), pos_end=Position(line=1, column=79), severity=, kind=None), Message(data=\"Function expected at\\n mFourierCoeff\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `mFourierCoeff` 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=43), pos_end=Position(line=2, column=60), severity=, kind=None), Message(data=\"Function expected at\\n mFourier\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n i\\n\\nHint: The identifier `mFourier` 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=63), pos_end=Position(line=2, column=75), severity=, kind=None), Message(data=\"Function expected at\\n f\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n x\\n\\nHint: The identifier `f` 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=78), pos_end=Position(line=2, column=81), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b2 : Sort u_1\\nmFourierCoeff : x\u271d\u00b2\\nd : Type u_2\\nx\u271d\u00b9 : Sort u_3\\nmFourier : x\u271d\u00b9\\nx\u271d : Sort u_4\\nf : x\u271d\\nh : Summable sorry\\nx : UnitAddTorus d\\n\u22a2 HasSum (fun i => ?m.16 \u2022 ?m.18) 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=177, i_end=326, messages=[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=15), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=326, i_end=342, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, 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.Analysis.Fourier.AddCircleMulti).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem hasSum_mFourier_series_apply_of_summable (h : Summable (mFourierCoeff f))\n (x : UnitAddTorus d) : HasSum (fun i \u21a6 mFourierCoeff f i \u2022 mFourier i x) (f x)\n:= by .someMissingNamespaceXYZ\nsimpa only [map_smul] using (ContinuousMap.evalCLM \u2102 x).hasSum\n (hasSum_mFourier_series_of_summable h)\n\nend Convergence\n\nend UnitAddTorus\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=177, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n mFourierCoeff\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `mFourierCoeff` 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=64), pos_end=Position(line=1, column=79), severity=, kind=None), Message(data=\"Function expected at\\n mFourierCoeff\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `mFourierCoeff` 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=43), pos_end=Position(line=2, column=60), severity=, kind=None), Message(data=\"Function expected at\\n mFourier\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n i\\n\\nHint: The identifier `mFourier` 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=63), pos_end=Position(line=2, column=75), severity=, kind=None), Message(data=\"Function expected at\\n f\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n x\\n\\nHint: The identifier `f` 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=78), pos_end=Position(line=2, column=81), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b2 : Sort u_1\\nmFourierCoeff : x\u271d\u00b2\\nd : Type u_2\\nx\u271d\u00b9 : Sort u_3\\nmFourier : x\u271d\u00b9\\nx\u271d : Sort u_4\\nf : x\u271d\\nh : Summable sorry\\nx : UnitAddTorus d\\n\u22a2 HasSum (fun i => ?m.16 \u2022 ?m.18) 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=177, i_end=326, messages=[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=15), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=326, i_end=342, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, 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/Analysis/Fourier/AddCircleMulti.lean", "module": "Mathlib.Analysis.Fourier.AddCircleMulti", "declaration": "Mathlib.Analysis.Fourier.AddCircleMulti.hasSum_mFourier_series_apply_of_summable", "span": "L339-L346", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Fourier/AddCircleMulti.lean#L339"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1331, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4657, "lean_code_chars": 337, "natural_language_chars": 4320, "lean_code_ratio": 0.0724, "line_count": 20, "imports_count": 0, "declarations_count": 650, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "3adcf4e81b89f3fe", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.Combinatorics.Matroid.Loop.closure_inter_eq_of_subset_coloops", "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.Combinatorics.Matroid.Loop)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma closure_inter_eq_of_subset_coloops (X : Set \u03b1) (hK : K \u2286 M.coloops) :\n M.closure X \u2229 K = X \u2229 K\n:= by .someMissingNamespaceXYZ\nnth_rw 1 [\u2190 inter_eq_self_of_subset_right hK]\n rw [\u2190 inter_assoc, closure_inter_coloops_eq, inter_assoc, inter_eq_self_of_subset_right hK]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=120, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `M.coloops`', pos=Position(line=1, column=63), pos_end=Position(line=1, column=72), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `M.closure`', pos=Position(line=2, column=5), pos_end=Position(line=2, column=14), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u03b1 : Type u_1\\nK X : Set \u03b1\\nhK : K \u2286 sorry\\n\u22a2 sorry \u2229 K = X \u2229 K', 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=120, i_end=286, 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.Combinatorics.Matroid.Loop).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma closure_inter_eq_of_subset_coloops (X : Set \u03b1) (hK : K \u2286 M.coloops) :\n M.closure X \u2229 K = X \u2229 K\n:= by .someMissingNamespaceXYZ\nnth_rw 1 [\u2190 inter_eq_self_of_subset_right hK]\n rw [\u2190 inter_assoc, closure_inter_coloops_eq, inter_assoc, inter_eq_self_of_subset_right hK]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=120, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `M.coloops`', pos=Position(line=1, column=63), pos_end=Position(line=1, column=72), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `M.closure`', pos=Position(line=2, column=5), pos_end=Position(line=2, column=14), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\n\u03b1 : Type u_1\\nK X : Set \u03b1\\nhK : K \u2286 sorry\\n\u22a2 sorry \u2229 K = X \u2229 K', 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=120, i_end=286, 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/Combinatorics/Matroid/Loop.lean", "module": "Mathlib.Combinatorics.Matroid.Loop", "declaration": "Mathlib.Combinatorics.Matroid.Loop.closure_inter_eq_of_subset_coloops", "span": "L645-L649", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Matroid/Loop.lean#L645"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 528, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1744, "lean_code_chars": 276, "natural_language_chars": 1468, "lean_code_ratio": 0.1583, "line_count": 16, "imports_count": 0, "declarations_count": 179, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ee5d4b4e2d78087a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.GroupTheory.OrderOfElement.pow_mod_card", "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.GroupTheory.OrderOfElement)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma pow_mod_card (a : G) (n : \u2115) : a ^ (n % card G) = a ^ n\n frobnicateTacticThatDoesNotExist := by\nrw [eq_comm, \u2190 pow_mod_orderOf, \u2190 Nat.mod_mod_of_dvd n orderOf_dvd_card, pow_mod_orderOf]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=198, messages=[Message(data='`pow_mod_card` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=18), 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.GroupTheory.OrderOfElement).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma pow_mod_card (a : G) (n : \u2115) : a ^ (n % card G) = a ^ n\n frobnicateTacticThatDoesNotExist := by\nrw [eq_comm, \u2190 pow_mod_orderOf, \u2190 Nat.mod_mod_of_dvd n orderOf_dvd_card, pow_mod_orderOf]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=198, messages=[Message(data='`pow_mod_card` has already been declared', pos=Position(line=1, column=6), pos_end=Position(line=1, column=18), 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/GroupTheory/OrderOfElement.lean", "module": "Mathlib.GroupTheory.OrderOfElement", "declaration": "Mathlib.GroupTheory.OrderOfElement.pow_mod_card", "span": "L1184-L1186", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/OrderOfElement.lean#L1184"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 282, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 970, "lean_code_chars": 193, "natural_language_chars": 777, "lean_code_ratio": 0.199, "line_count": 14, "imports_count": 0, "declarations_count": 105, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f20175703a82059d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.RingTheory.Polynomial.Basic.isNoetherianRing_fin_0", "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.RingTheory.Polynomial.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isNoetherianRing_fin_0 [IsNoetherianRing R] :\n IsNoetherianRing (MvPolynomial (Fin 0) R)\n:= by .someMissingNamespaceXYZ\napply isNoetherianRing_of_ringEquiv R\n symm; apply MvPolynomial.isEmptyRingEquiv R (Fin 0)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=108, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=50), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=108, i_end=222, 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.RingTheory.Polynomial.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem isNoetherianRing_fin_0 [IsNoetherianRing R] :\n IsNoetherianRing (MvPolynomial (Fin 0) R)\n:= by .someMissingNamespaceXYZ\napply isNoetherianRing_of_ringEquiv R\n symm; apply MvPolynomial.isEmptyRingEquiv R (Fin 0)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=108, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=32), pos_end=Position(line=1, column=50), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=108, i_end=222, 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/RingTheory/Polynomial/Basic.lean", "module": "Mathlib.RingTheory.Polynomial.Basic", "declaration": "Mathlib.RingTheory.Polynomial.Basic.isNoetherianRing_fin_0", "span": "L897-L901", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/Basic.lean#L897"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 405, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1434, "lean_code_chars": 223, "natural_language_chars": 1211, "lean_code_ratio": 0.1555, "line_count": 16, "imports_count": 0, "declarations_count": 150, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ab0549a9bfb43ac8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.LinearAlgebra.Matrix.Charpoly.Basic.BlockTriangular", "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.LinearAlgebra.Matrix.Charpoly.Basic)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma BlockTriangular.charpoly {\u03b1 : Type*} {b : n \u2192 \u03b1} [LinearOrder \u03b1] (h : M.BlockTriangular b) :\n M.charpoly = \u220f a \u2208 image b univ, (M.toSquareBlock b a).charpoly\n:= by thisIsWrongLemmaNameXYZ\nsimp only [Matrix.charpoly, h.charmatrix.det, charmatrix_toSquareBlock]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=183, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `M.BlockTriangular`', pos=Position(line=1, column=76), pos_end=Position(line=1, column=93), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `M.charpoly`', pos=Position(line=2, column=4), pos_end=Position(line=2, column=14), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n image\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\\n\\nHint: The identifier `image` 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=23), pos_end=Position(line=2, column=35), severity=, kind=None), Message(data='Unknown identifier `M.toSquareBlock`', pos=Position(line=2, column=38), pos_end=Position(line=2, column=53), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nn : Sort u_2\\nx\u271d : Sort u_3\\nimage : x\u271d\\n\u03b1 : Type u_1\\nb : n \u2192 \u03b1\\ninst\u271d : LinearOrder \u03b1\\nh : sorry\\n\u22a2 sorry = \u220f a \u2208 sorry, ?m.10', 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=183, i_end=277, 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.LinearAlgebra.Matrix.Charpoly.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma BlockTriangular.charpoly {\u03b1 : Type*} {b : n \u2192 \u03b1} [LinearOrder \u03b1] (h : M.BlockTriangular b) :\n M.charpoly = \u220f a \u2208 image b univ, (M.toSquareBlock b a).charpoly\n:= by thisIsWrongLemmaNameXYZ\nsimp only [Matrix.charpoly, h.charmatrix.det, charmatrix_toSquareBlock]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=183, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `M.BlockTriangular`', pos=Position(line=1, column=76), pos_end=Position(line=1, column=93), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `M.charpoly`', pos=Position(line=2, column=4), pos_end=Position(line=2, column=14), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n image\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\\n\\nHint: The identifier `image` 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=23), pos_end=Position(line=2, column=35), severity=, kind=None), Message(data='Unknown identifier `M.toSquareBlock`', pos=Position(line=2, column=38), pos_end=Position(line=2, column=53), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nn : Sort u_2\\nx\u271d : Sort u_3\\nimage : x\u271d\\n\u03b1 : Type u_1\\nb : n \u2192 \u03b1\\ninst\u271d : LinearOrder \u03b1\\nh : sorry\\n\u22a2 sorry = \u220f a \u2208 sorry, ?m.10', 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=183, i_end=277, 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/LinearAlgebra/Matrix/Charpoly/Basic.lean", "module": "Mathlib.LinearAlgebra.Matrix.Charpoly.Basic", "declaration": "Mathlib.LinearAlgebra.Matrix.Charpoly.Basic.BlockTriangular", "span": "L195-L198", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/Charpoly/Basic.lean#L195"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 761, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2635, "lean_code_chars": 269, "natural_language_chars": 2366, "lean_code_ratio": 0.1021, "line_count": 15, "imports_count": 0, "declarations_count": 306, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "3b7aad18fa7f6523", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "B-Mathlib.NumberTheory.NumberField.CMField.mem_realUnits_iff", "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.NumberTheory.NumberField.CMField)."}, {"role": "user", "content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_realUnits_iff (u : (\ud835\udcde K)\u02e3) :\n u \u2208 realUnits K \u2194 \u2203 v : (\ud835\udcde K\u207a)\u02e3, algebraMap (\ud835\udcde K\u207a) (\ud835\udcde K) v = u\n:= by .someMissingNamespaceXYZ\nsimp [realUnits, MonoidHom.mem_range, RingHom.toMonoidHom_eq_coe, Units.ext_iff]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=140, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `\ud835\udcde` 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=32), pos_end=Position(line=1, column=35), severity=, kind=None), Message(data=\"Function expected at\\n realUnits\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `realUnits` 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=8), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\u207a\\n\\nHint: The identifier `\ud835\udcde` 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=29), pos_end=Position(line=2, column=33), severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\u207a\\n\\nHint: The identifier `\ud835\udcde` 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=49), pos_end=Position(line=2, column=53), severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `\ud835\udcde` 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=56), pos_end=Position(line=2, column=59), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=140, i_end=243, 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.NumberTheory.NumberField.CMField).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_realUnits_iff (u : (\ud835\udcde K)\u02e3) :\n u \u2208 realUnits K \u2194 \u2203 v : (\ud835\udcde K\u207a)\u02e3, algebraMap (\ud835\udcde K\u207a) (\ud835\udcde K) v = u\n:= by .someMissingNamespaceXYZ\nsimp [realUnits, MonoidHom.mem_range, RingHom.toMonoidHom_eq_coe, Units.ext_iff]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=140, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `\ud835\udcde` 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=32), pos_end=Position(line=1, column=35), severity=, kind=None), Message(data=\"Function expected at\\n realUnits\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `realUnits` 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=8), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\u207a\\n\\nHint: The identifier `\ud835\udcde` 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=29), pos_end=Position(line=2, column=33), severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\u207a\\n\\nHint: The identifier `\ud835\udcde` 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=49), pos_end=Position(line=2, column=53), severity=, kind=None), Message(data=\"Function expected at\\n \ud835\udcde\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n K\\n\\nHint: The identifier `\ud835\udcde` 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=56), pos_end=Position(line=2, column=59), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=140, i_end=243, 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/NumberTheory/NumberField/CMField.lean", "module": "Mathlib.NumberTheory.NumberField.CMField", "declaration": "Mathlib.NumberTheory.NumberField.CMField.mem_realUnits_iff", "span": "L275-L278", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CMField.lean#L275"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1138, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 4151, "lean_code_chars": 220, "natural_language_chars": 3931, "lean_code_ratio": 0.053, "line_count": 15, "imports_count": 0, "declarations_count": 605, "diagnostics_count": 1, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "a591ec1db57bf12d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Topology.Category.TopCat.Limits.Pullbacks.fst_iso_of_right_embedding_range_subset", "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.Topology.Category.TopCat.Limits.Pullbacks)."}, {"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.Topology.Category.TopCat.Limits.Pullbacks.fst_iso_of_right_embedding_range_subset`:\nState 0: \u22a2 theorem fst_iso_of_right_embedding_range_subset {X Y S : TopCat} (f : X \u27f6 S) {g : Y \u27f6 S}\n (hg : IsEmbedding g) (H : Set.range f \u2286 Set.range g) :\n IsIso (pullback.fst f g)\nTactic: rw [pullback_fst_range]\nState 1: \u22a2 \nTactic: exact \u27e8_, (H (Set.mem_range_self x)).choose_spec.symm\u27e9\u27e9 }\nState 2: \u22a2 \nTactic: convert (isoOfHomeo esto).isIso_hom\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.Topology.Category.TopCat.Limits.Pullbacks).[/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.Topology.Category.TopCat.Limits.Pullbacks.fst_iso_of_right_embedding_range_subset`:\nState 0: \u22a2 theorem fst_iso_of_right_embedding_range_subset {X Y S : TopCat} (f : X \u27f6 S) {g : Y \u27f6 S}\n (hg : IsEmbedding g) (H : Set.range f \u2286 Set.range g) :\n IsIso (pullback.fst f g)\nTactic: rw [pullback_fst_range]\nState 1: \u22a2 \nTactic: exact \u27e8_, (H (Set.mem_range_self x)).choose_spec.symm\u27e9\u27e9 }\nState 2: \u22a2 \nTactic: convert (isoOfHomeo esto).isIso_hom\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean", "module": "Mathlib.Topology.Category.TopCat.Limits.Pullbacks", "declaration": "Mathlib.Topology.Category.TopCat.Limits.Pullbacks.fst_iso_of_right_embedding_range_subset", "span": "L326-L337", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean#L326"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 358, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1128, "lean_code_chars": 0, "natural_language_chars": 1128, "lean_code_ratio": 0.0, "line_count": 15, "imports_count": 0, "declarations_count": 126, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d2f5939ec7f4e289", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Combinatorics.Graph.Subgraph.le_of_le_subset", "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.Combinatorics.Graph.Subgraph)."}, {"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.Combinatorics.Graph.Subgraph.le_of_le_subset`:\nState 0: \u22a2 lemma le_of_le_subset (h' : K \u2264 G) (hsu : V(K) \u2286 V(H)) (h : H \u2264i G) : K \u2264 H\nTactic: refine (Compatible.of_le_le h' h.le).le_iff.mpr \u27e8hsu, fun e he \u21a6 ?_\u27e9\nState 1: \u22a2 \nTactic: obtain \u27e8u, v, huv\u27e9 := K.exists_isLink_of_mem_edgeSet he\nState 2: \u22a2 \nTactic: exact h.2 (huv.mono h') (hsu huv.left_mem) (hsu huv.right_mem) |>.edge_mem\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.Combinatorics.Graph.Subgraph).[/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.Combinatorics.Graph.Subgraph.le_of_le_subset`:\nState 0: \u22a2 lemma le_of_le_subset (h' : K \u2264 G) (hsu : V(K) \u2286 V(H)) (h : H \u2264i G) : K \u2264 H\nTactic: refine (Compatible.of_le_le h' h.le).le_iff.mpr \u27e8hsu, fun e he \u21a6 ?_\u27e9\nState 1: \u22a2 \nTactic: obtain \u27e8u, v, huv\u27e9 := K.exists_isLink_of_mem_edgeSet he\nState 2: \u22a2 \nTactic: exact h.2 (huv.mono h') (hsu huv.left_mem) (hsu huv.right_mem) |>.edge_mem\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/Graph/Subgraph.lean", "module": "Mathlib.Combinatorics.Graph.Subgraph", "declaration": "Mathlib.Combinatorics.Graph.Subgraph.le_of_le_subset", "span": "L265-L269", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Graph/Subgraph.lean#L265"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 369, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1102, "lean_code_chars": 0, "natural_language_chars": 1102, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 139, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b6b33d11e6dead38", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.GroupTheory.PGroup.nonempty_fixed_point_of_prime_not_dvd_card", "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.GroupTheory.PGroup)."}, {"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.GroupTheory.PGroup.nonempty_fixed_point_of_prime_not_dvd_card`:\nState 0: \u22a2 theorem nonempty_fixed_point_of_prime_not_dvd_card (\u03b1) [MulAction G \u03b1] (hp\u03b1 : \u00acp \u2223 Nat.card \u03b1) :\n (fixedPoints G \u03b1).Nonempty\nTactic: have : Finite \u03b1 := Nat.finite_of_card_ne_zero (fun h \u21a6 (h \u25b8 hp\u03b1) (dvd_zero p)) @Set.Nonempty.of_subtype _ _ (by\nState 1: \u22a2 \nTactic: rw [\u2190 Finite.card_pos_iff, pos_iff_ne_zero]\nState 2: \u22a2 \nTactic: contrapose! hp\u03b1\nState 3: \u22a2 \nTactic: rw [\u2190 Nat.modEq_zero_iff_dvd, \u2190 hp\u03b1]\nState 4: \u22a2 \nTactic: exact hG.card_modEq_card_fixedPoints \u03b1) /-- If a p-group acts on `\u03b1` and the cardinality of `\u03b1` is a multiple of `p`, and the action has one fixed point, then it has another fixed point. -/\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.GroupTheory.PGroup).[/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.GroupTheory.PGroup.nonempty_fixed_point_of_prime_not_dvd_card`:\nState 0: \u22a2 theorem nonempty_fixed_point_of_prime_not_dvd_card (\u03b1) [MulAction G \u03b1] (hp\u03b1 : \u00acp \u2223 Nat.card \u03b1) :\n (fixedPoints G \u03b1).Nonempty\nTactic: have : Finite \u03b1 := Nat.finite_of_card_ne_zero (fun h \u21a6 (h \u25b8 hp\u03b1) (dvd_zero p)) @Set.Nonempty.of_subtype _ _ (by\nState 1: \u22a2 \nTactic: rw [\u2190 Finite.card_pos_iff, pos_iff_ne_zero]\nState 2: \u22a2 \nTactic: contrapose! hp\u03b1\nState 3: \u22a2 \nTactic: rw [\u2190 Nat.modEq_zero_iff_dvd, \u2190 hp\u03b1]\nState 4: \u22a2 \nTactic: exact hG.card_modEq_card_fixedPoints \u03b1) /-- If a p-group acts on `\u03b1` and the cardinality of `\u03b1` is a multiple of `p`, and the action has one fixed point, then it has another fixed point. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/PGroup.lean", "module": "Mathlib.GroupTheory.PGroup", "declaration": "Mathlib.GroupTheory.PGroup.nonempty_fixed_point_of_prime_not_dvd_card", "span": "L193-L204", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/PGroup.lean#L193"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 487, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1479, "lean_code_chars": 0, "natural_language_chars": 1479, "lean_code_ratio": 0.0, "line_count": 18, "imports_count": 0, "declarations_count": 168, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9207a978c5d92489", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.Localization.AsSubring.isLocalization_range_mapToFractionRing", "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.RingTheory.Localization.AsSubring)."}, {"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.RingTheory.Localization.AsSubring.isLocalization_range_mapToFractionRing`:\nState 0: \u22a2 instance isLocalization_range_mapToFractionRing (B : Type*) [CommRing B] [Algebra A B]\n [IsLocalization S B] (hS : S \u2264 A\u2070) : IsLocalization S (mapToFractionRing K S B hS).range\nTactic: refine \u27e8fun a b h => ?_, Set.rangeFactorization_surjective\u27e9\nState 1: \u22a2 ?_, Set.rangeFactorization_surjective\u27e9>\nTactic: refine (IsLocalization.lift_injective_iff _).2 (fun a b => ?_) (Subtype.ext_iff.1 h)\nState 2: \u22a2 ?_) (Subtype.ext_iff.1 h)>\nTactic: exact \u27e8fun h => congr_arg _ (IsLocalization.injective _ hS h), fun h => congr_arg _ (IsFractionRing.injective A K h)\u27e9)\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.RingTheory.Localization.AsSubring).[/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.RingTheory.Localization.AsSubring.isLocalization_range_mapToFractionRing`:\nState 0: \u22a2 instance isLocalization_range_mapToFractionRing (B : Type*) [CommRing B] [Algebra A B]\n [IsLocalization S B] (hS : S \u2264 A\u2070) : IsLocalization S (mapToFractionRing K S B hS).range\nTactic: refine \u27e8fun a b h => ?_, Set.rangeFactorization_surjective\u27e9\nState 1: \u22a2 ?_, Set.rangeFactorization_surjective\u27e9>\nTactic: refine (IsLocalization.lift_injective_iff _).2 (fun a b => ?_) (Subtype.ext_iff.1 h)\nState 2: \u22a2 ?_) (Subtype.ext_iff.1 h)>\nTactic: exact \u27e8fun h => congr_arg _ (IsLocalization.injective _ hS h), fun h => congr_arg _ (IsFractionRing.injective A K h)\u27e9)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Localization/AsSubring.lean", "module": "Mathlib.RingTheory.Localization.AsSubring", "declaration": "Mathlib.RingTheory.Localization.AsSubring.isLocalization_range_mapToFractionRing", "span": "L63-L71", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Localization/AsSubring.lean#L63"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 403, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1324, "lean_code_chars": 0, "natural_language_chars": 1324, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 154, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "8be0d10c725743d4", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Algebra.Polynomial.EraseLead.mono_map_natDegree_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.Algebra.Polynomial.EraseLead)."}, {"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.Algebra.Polynomial.EraseLead.mono_map_natDegree_eq`:\nState 0: \u22a2 theorem mono_map_natDegree_eq {S F : Type*} [Semiring S]\n [FunLike F R[X] S[X]] [AddMonoidHomClass F R[X] S[X]] {\u03c6 : F}\n {p : R[X]} (k : \u2115) (fu : \u2115 \u2192 \u2115) (fu0 : \u2200 {n}, n \u2264 k \u2192 fu n = 0)\n (fc : \u2200 {n m}, k \u2264 n \u2192 n < m \u2192 fu n < fu m) (\u03c6_k : \u2200 {f : R[X]}, f.natDegree < k \u2192 \u03c6 f = 0)\n (\u03c6_mon_nat : \u2200 n c, c \u2260 0 \u2192 (\u03c6 (monomial n c)).natDegree = fu n) :\n (\u03c6 p).natDegree = fu p.natDegree\nTactic: refine induction_with_natDegree_le (fun p => (\u03c6 p).natDegree = fu p.natDegree) p.natDegree (by simp [fu0]) ?_ ?_ _ rfl.le \u00b7 intro n r r0 _\nState 1: \u22a2 (\u03c6 p).natDegree = fu p.natDegree)>\nTactic: rw [natDegree_C_mul_X_pow _ _ r0, C_mul_X_pow_eq_monomial, \u03c6_mon_nat _ _ r0] \u00b7 intro f g fg _ fk gk\nState 2: \u22a2 \nTactic: rw [natDegree_add_eq_right_of_natDegree_lt fg, map_add] by_cases! FG : k \u2264 f.natDegree \u00b7 rw [natDegree_add_eq_right_of_natDegree_lt, gk]\nState 3: \u22a2 \nTactic: rw [fk, gk]\nState 4: \u22a2 \nTactic: exact fc FG fg \u00b7 cases k \u00b7 nomatch FG \u00b7 rwa [\u03c6_k FG, zero_add]\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.Algebra.Polynomial.EraseLead).[/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.Algebra.Polynomial.EraseLead.mono_map_natDegree_eq`:\nState 0: \u22a2 theorem mono_map_natDegree_eq {S F : Type*} [Semiring S]\n [FunLike F R[X] S[X]] [AddMonoidHomClass F R[X] S[X]] {\u03c6 : F}\n {p : R[X]} (k : \u2115) (fu : \u2115 \u2192 \u2115) (fu0 : \u2200 {n}, n \u2264 k \u2192 fu n = 0)\n (fc : \u2200 {n m}, k \u2264 n \u2192 n < m \u2192 fu n < fu m) (\u03c6_k : \u2200 {f : R[X]}, f.natDegree < k \u2192 \u03c6 f = 0)\n (\u03c6_mon_nat : \u2200 n c, c \u2260 0 \u2192 (\u03c6 (monomial n c)).natDegree = fu n) :\n (\u03c6 p).natDegree = fu p.natDegree\nTactic: refine induction_with_natDegree_le (fun p => (\u03c6 p).natDegree = fu p.natDegree) p.natDegree (by simp [fu0]) ?_ ?_ _ rfl.le \u00b7 intro n r r0 _\nState 1: \u22a2 (\u03c6 p).natDegree = fu p.natDegree)>\nTactic: rw [natDegree_C_mul_X_pow _ _ r0, C_mul_X_pow_eq_monomial, \u03c6_mon_nat _ _ r0] \u00b7 intro f g fg _ fk gk\nState 2: \u22a2 \nTactic: rw [natDegree_add_eq_right_of_natDegree_lt fg, map_add] by_cases! FG : k \u2264 f.natDegree \u00b7 rw [natDegree_add_eq_right_of_natDegree_lt, gk]\nState 3: \u22a2 \nTactic: rw [fk, gk]\nState 4: \u22a2 \nTactic: exact fc FG fg \u00b7 cases k \u00b7 nomatch FG \u00b7 rwa [\u03c6_k FG, zero_add]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Polynomial/EraseLead.lean", "module": "Mathlib.Algebra.Polynomial.EraseLead", "declaration": "Mathlib.Algebra.Polynomial.EraseLead.mono_map_natDegree_eq", "span": "L353-L372", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/EraseLead.lean#L353"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 692, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1849, "lean_code_chars": 0, "natural_language_chars": 1849, "lean_code_ratio": 0.0, "line_count": 22, "imports_count": 0, "declarations_count": 242, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ce5e642c6a2c92f8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Data.Nat.BinaryRec.binaryRec_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.Data.Nat.BinaryRec)."}, {"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.Data.Nat.BinaryRec.binaryRec_eq`:\nState 0: \u22a2 theorem binaryRec_eq {zero : motive 0} {bit : \u2200 b n, motive n \u2192 motive (bit b n)}\n (b n) (h : bit false 0 zero = zero \u2228 (n = 0 \u2192 b = true)) :\n binaryRec zero bit (n.bit b) = bit b n (binaryRec zero bit n)\nTactic: obtain \u27e8rfl, rfl\u27e9 := bit_eq_zero_iff.mp h'\nState 1: \u22a2 \nTactic: simp only [Bool.false_eq_true, imp_false, not_true_eq_false, or_false] at h unfold binaryRec\nState 2: \u22a2 \nTactic: exact h.symm case neg =>\nState 3: \u22a2 \nTactic: rw [binaryRec, dif_neg h'] change congrArg motive (n.bit b).bit_testBit_zero_shiftRight_one \u25b8 bit _ _ _ = _ generalize congrArg motive (n.bit b).bit_testBit_zero_shiftRight_one = e; revert e\nState 4: \u22a2 \nTactic: rw [testBit_bit_zero, bit_shiftRight_one] intros; 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.Data.Nat.BinaryRec).[/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.Data.Nat.BinaryRec.binaryRec_eq`:\nState 0: \u22a2 theorem binaryRec_eq {zero : motive 0} {bit : \u2200 b n, motive n \u2192 motive (bit b n)}\n (b n) (h : bit false 0 zero = zero \u2228 (n = 0 \u2192 b = true)) :\n binaryRec zero bit (n.bit b) = bit b n (binaryRec zero bit n)\nTactic: obtain \u27e8rfl, rfl\u27e9 := bit_eq_zero_iff.mp h'\nState 1: \u22a2 \nTactic: simp only [Bool.false_eq_true, imp_false, not_true_eq_false, or_false] at h unfold binaryRec\nState 2: \u22a2 \nTactic: exact h.symm case neg =>\nState 3: \u22a2 \nTactic: rw [binaryRec, dif_neg h'] change congrArg motive (n.bit b).bit_testBit_zero_shiftRight_one \u25b8 bit _ _ _ = _ generalize congrArg motive (n.bit b).bit_testBit_zero_shiftRight_one = e; revert e\nState 4: \u22a2 \nTactic: rw [testBit_bit_zero, bit_shiftRight_one] intros; rfl\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Nat/BinaryRec.lean", "module": "Mathlib.Data.Nat.BinaryRec", "declaration": "Mathlib.Data.Nat.BinaryRec.binaryRec_eq", "span": "L165-L180", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Nat/BinaryRec.lean#L165"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 497, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1523, "lean_code_chars": 0, "natural_language_chars": 1523, "lean_code_ratio": 0.0, "line_count": 19, "imports_count": 0, "declarations_count": 192, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5ac691af8d1c084a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Combinatorics.SimpleGraph.Circulant.circulantGraph_eq_symm", "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.Combinatorics.SimpleGraph.Circulant)."}, {"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.Combinatorics.SimpleGraph.Circulant.circulantGraph_eq_symm`:\nState 0: \u22a2 theorem circulantGraph_eq_symm : circulantGraph s = circulantGraph (s \u222a (-s))\nTactic: ext\nState 1: \u22a2 \nTactic: simp only [circulantGraph_adj, Set.mem_union, Set.mem_neg, neg_sub] grind\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.Combinatorics.SimpleGraph.Circulant).[/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.Combinatorics.SimpleGraph.Circulant.circulantGraph_eq_symm`:\nState 0: \u22a2 theorem circulantGraph_eq_symm : circulantGraph s = circulantGraph (s \u222a (-s))\nTactic: ext\nState 1: \u22a2 \nTactic: simp only [circulantGraph_adj, Set.mem_union, Set.mem_neg, neg_sub] grind\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Circulant.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Circulant", "declaration": "Mathlib.Combinatorics.SimpleGraph.Circulant.circulantGraph_eq_symm", "span": "L50-L54", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Circulant.lean#L50"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 240, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 851, "lean_code_chars": 0, "natural_language_chars": 851, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 94, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9d357802af161efc", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.LinearAlgebra.RootSystem.Finite.Nondegenerate.ker_rootForm_eq_dualAnnihilator", "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.LinearAlgebra.RootSystem.Finite.Nondegenerate)."}, {"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.LinearAlgebra.RootSystem.Finite.Nondegenerate.ker_rootForm_eq_dualAnnihilator`:\nState 0: \u22a2 lemma ker_rootForm_eq_dualAnnihilator :\n P.RootForm.ker =\n (P.corootSpan R).dualAnnihilator.map (P.toPerfPair.symm : Dual R N \u2192\u2097[R] M)\nTactic: have : IsReflexive R M := .of_isPerfPair P.toLinearMap\nState 1: \u22a2 \nTactic: have : IsReflexive R N := .of_isPerfPair P.flip.toLinearMap suffices finrank R (LinearMap.ker P.RootForm) = finrank R (P.corootSpan R).dualAnnihilator by\nState 2: \u22a2 \nTactic: refine (Submodule.eq_of_le_of_finrank_eq P.corootSpan_dualAnnihilator_le_ker_rootForm ?_).symm\nState 3: \u22a2 \nTactic: rw [this]\nState 4: \u22a2 \nTactic: apply LinearEquiv.finrank_map_eq\nState 5: \u22a2 \nTactic: have aux0 := Subspace.finrank_add_finrank_dualAnnihilator_eq (P.corootSpan R)\nState 6: \u22a2 \nTactic: have aux1 := Submodule.finrank_add_eq_of_isCompl P.isCompl_rootSpan_ker_rootForm\nState 7: \u22a2 \nTactic: rw [\u2190 P.finrank_corootSpan_eq', P.toPerfPair.finrank_eq, Subspace.dual_finrank_eq] at aux1 lia\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.LinearAlgebra.RootSystem.Finite.Nondegenerate).[/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.LinearAlgebra.RootSystem.Finite.Nondegenerate.ker_rootForm_eq_dualAnnihilator`:\nState 0: \u22a2 lemma ker_rootForm_eq_dualAnnihilator :\n P.RootForm.ker =\n (P.corootSpan R).dualAnnihilator.map (P.toPerfPair.symm : Dual R N \u2192\u2097[R] M)\nTactic: have : IsReflexive R M := .of_isPerfPair P.toLinearMap\nState 1: \u22a2 \nTactic: have : IsReflexive R N := .of_isPerfPair P.flip.toLinearMap suffices finrank R (LinearMap.ker P.RootForm) = finrank R (P.corootSpan R).dualAnnihilator by\nState 2: \u22a2 \nTactic: refine (Submodule.eq_of_le_of_finrank_eq P.corootSpan_dualAnnihilator_le_ker_rootForm ?_).symm\nState 3: \u22a2 \nTactic: rw [this]\nState 4: \u22a2 \nTactic: apply LinearEquiv.finrank_map_eq\nState 5: \u22a2 \nTactic: have aux0 := Subspace.finrank_add_finrank_dualAnnihilator_eq (P.corootSpan R)\nState 6: \u22a2 \nTactic: have aux1 := Submodule.finrank_add_eq_of_isCompl P.isCompl_rootSpan_ker_rootForm\nState 7: \u22a2 \nTactic: rw [\u2190 P.finrank_corootSpan_eq', P.toPerfPair.finrank_eq, Subspace.dual_finrank_eq] at aux1 lia\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/RootSystem/Finite/Nondegenerate.lean", "module": "Mathlib.LinearAlgebra.RootSystem.Finite.Nondegenerate", "declaration": "Mathlib.LinearAlgebra.RootSystem.Finite.Nondegenerate.ker_rootForm_eq_dualAnnihilator", "span": "L291-L304", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/RootSystem/Finite/Nondegenerate.lean#L291"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 693, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2069, "lean_code_chars": 0, "natural_language_chars": 2069, "lean_code_ratio": 0.0, "line_count": 25, "imports_count": 0, "declarations_count": 192, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "e7f4c28962aa7250", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.NumberField.CMField.ringOfIntegersComplexConj_eq_self_iff", "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.NumberTheory.NumberField.CMField)."}, {"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.NumberTheory.NumberField.CMField.ringOfIntegersComplexConj_eq_self_iff`:\nState 0: \u22a2 theorem ringOfIntegersComplexConj_eq_self_iff (x : \ud835\udcde K) :\n ringOfIntegersComplexConj K x = x \u2194 x \u2208 Set.range (algebraMap (\ud835\udcde K\u207a) (\ud835\udcde K))\nTactic: refine \u27e8fun h \u21a6 ?_, ?_\u27e9 \u00b7 rw [RingOfIntegers.ext_iff, coe_ringOfIntegersComplexConj, RingOfIntegers.complexConj_eq_self_iff] at h\nState 1: \u22a2 \nTactic: obtain \u27e8y, hy\u27e9 := h\nState 2: \u22a2 \nTactic: exact \u27e8y, RingOfIntegers.ext_iff.mpr hy\u27e9 \u00b7 rintro \u27e8y, rfl\u27e9\nState 3: \u22a2 \nTactic: simp end complexConj section units open Units /-- The complex conjugation as an isomorphism of the units of `K`. -/ noncomputable abbrev unitsComplexConj [Algebra.IsIntegral \u211a K] : (\ud835\udcde K)\u02e3 \u2243* (\ud835\udcde K)\u02e3 := Units.mapEquiv <| RingOfIntegers.mapRingEquiv (complexConj K).toRingEquiv /-- The subgroup of `(\ud835\udcde K)\u02e3` generated by the units of `K\u207a`. These units are exactly the units fixed by the complex conjugation, see `IsCMField.unitsComplexConj_eq_self_iff`. -/\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.NumberTheory.NumberField.CMField).[/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.NumberTheory.NumberField.CMField.ringOfIntegersComplexConj_eq_self_iff`:\nState 0: \u22a2 theorem ringOfIntegersComplexConj_eq_self_iff (x : \ud835\udcde K) :\n ringOfIntegersComplexConj K x = x \u2194 x \u2208 Set.range (algebraMap (\ud835\udcde K\u207a) (\ud835\udcde K))\nTactic: refine \u27e8fun h \u21a6 ?_, ?_\u27e9 \u00b7 rw [RingOfIntegers.ext_iff, coe_ringOfIntegersComplexConj, RingOfIntegers.complexConj_eq_self_iff] at h\nState 1: \u22a2 \nTactic: obtain \u27e8y, hy\u27e9 := h\nState 2: \u22a2 \nTactic: exact \u27e8y, RingOfIntegers.ext_iff.mpr hy\u27e9 \u00b7 rintro \u27e8y, rfl\u27e9\nState 3: \u22a2 \nTactic: simp end complexConj section units open Units /-- The complex conjugation as an isomorphism of the units of `K`. -/ noncomputable abbrev unitsComplexConj [Algebra.IsIntegral \u211a K] : (\ud835\udcde K)\u02e3 \u2243* (\ud835\udcde K)\u02e3 := Units.mapEquiv <| RingOfIntegers.mapRingEquiv (complexConj K).toRingEquiv /-- The subgroup of `(\ud835\udcde K)\u02e3` generated by the units of `K\u207a`. These units are exactly the units fixed by the complex conjugation, see `IsCMField.unitsComplexConj_eq_self_iff`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/CMField.lean", "module": "Mathlib.NumberTheory.NumberField.CMField", "declaration": "Mathlib.NumberTheory.NumberField.CMField.ringOfIntegersComplexConj_eq_self_iff", "span": "L247-L271", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CMField.lean#L247"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 579, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1662, "lean_code_chars": 0, "natural_language_chars": 1662, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 187, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "c43022b1c3a4e5b3", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Data.Set.Lattice.Image.image2_sInter_subset_left", "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.Data.Set.Lattice.Image)."}, {"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.Data.Set.Lattice.Image.image2_sInter_subset_left`:\nState 0: \u22a2 theorem image2_sInter_subset_left (S : Set (Set \u03b1)) (t : Set \u03b2) :\n image2 f (\u22c2\u2080 S) t \u2286 \u22c2 s \u2208 S, image2 f s t\nTactic: rw [sInter_eq_biInter]\nState 1: \u22a2 \nTactic: exact image2_iInter\u2082_subset_left ..\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.Data.Set.Lattice.Image).[/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.Data.Set.Lattice.Image.image2_sInter_subset_left`:\nState 0: \u22a2 theorem image2_sInter_subset_left (S : Set (Set \u03b1)) (t : Set \u03b2) :\n image2 f (\u22c2\u2080 S) t \u2286 \u22c2 s \u2208 S, image2 f s t\nTactic: rw [sInter_eq_biInter]\nState 1: \u22a2 \nTactic: exact image2_iInter\u2082_subset_left ..\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Set/Lattice/Image.lean", "module": "Mathlib.Data.Set.Lattice.Image", "declaration": "Mathlib.Data.Set.Lattice.Image.image2_sInter_subset_left", "span": "L563-L567", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Set/Lattice/Image.lean#L563"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 257, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 861, "lean_code_chars": 0, "natural_language_chars": 861, "lean_code_ratio": 0.0, "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": "b3cfbb6a709a9167", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Topology.Separation.Basic.singleton_mem_nhdsWithin_of_mem_discrete", "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.Topology.Separation.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.Topology.Separation.Basic.singleton_mem_nhdsWithin_of_mem_discrete`:\nState 0: \u22a2 theorem singleton_mem_nhdsWithin_of_mem_discrete {s : Set X} (hs : IsDiscrete s) {x : X}\n (hx : x \u2208 s) : {x} \u2208 \ud835\udcdd[s] x\nTactic: rw [isDiscrete_iff_discreteTopology] at hs\nState 1: \u22a2 \nTactic: have : ({\u27e8x, hx\u27e9} : Set s) \u2208 \ud835\udcdd (\u27e8x, hx\u27e9 : s) := by simp [nhds_discrete]\nState 2: \u22a2 \nTactic: simpa only [nhdsWithin_eq_map_subtype_coe hx, image_singleton] using @image_mem_map _ _ _ ((\u2191) : s \u2192 X) _ this /-- The neighbourhoods filter of `x` within `s`, under the discrete topology, is equal to the pure `x` filter (which is the principal filter at the singleton `{x}`.) -/\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.Topology.Separation.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.Topology.Separation.Basic.singleton_mem_nhdsWithin_of_mem_discrete`:\nState 0: \u22a2 theorem singleton_mem_nhdsWithin_of_mem_discrete {s : Set X} (hs : IsDiscrete s) {x : X}\n (hx : x \u2208 s) : {x} \u2208 \ud835\udcdd[s] x\nTactic: rw [isDiscrete_iff_discreteTopology] at hs\nState 1: \u22a2 \nTactic: have : ({\u27e8x, hx\u27e9} : Set s) \u2208 \ud835\udcdd (\u27e8x, hx\u27e9 : s) := by simp [nhds_discrete]\nState 2: \u22a2 \nTactic: simpa only [nhdsWithin_eq_map_subtype_coe hx, image_singleton] using @image_mem_map _ _ _ ((\u2191) : s \u2192 X) _ this /-- The neighbourhoods filter of `x` within `s`, under the discrete topology, is equal to the pure `x` filter (which is the principal filter at the singleton `{x}`.) -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Separation/Basic.lean", "module": "Mathlib.Topology.Separation.Basic", "declaration": "Mathlib.Topology.Separation.Basic.singleton_mem_nhdsWithin_of_mem_discrete", "span": "L804-L812", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Separation/Basic.lean#L804"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 465, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1354, "lean_code_chars": 0, "natural_language_chars": 1354, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 169, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "d1c68790cc83cc92", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.Extension.Generators.map_toComp_ker", "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.RingTheory.Extension.Generators)."}, {"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.RingTheory.Extension.Generators.map_toComp_ker`:\nState 0: \u22a2 lemma map_toComp_ker (Q : Generators S T \u03b9') (P : Generators R S \u03b9) :\n P.ker.map (Q.toComp P).toAlgHom = RingHom.ker (Q.ofComp P).toAlgHom\nTactic: apply le_antisymm \u00b7 rw [Ideal.map_le_iff_le_comap] rintro x (hx : algebraMap P.Ring S x = 0)\nState 1: \u22a2 \nTactic: have : (Q.ofComp P).toAlgHom.comp (Q.toComp P).toAlgHom = IsScalarTower.toAlgHom R _ _ := by ext1; simp\nState 2: \u22a2 \nTactic: simp only [Ideal.mem_comap, RingHom.mem_ker, \u2190 AlgHom.comp_apply, this, IsScalarTower.toAlgHom_apply]\nState 3: \u22a2 \nTactic: rw [IsScalarTower.algebraMap_apply P.Ring S, hx, map_zero] \u00b7 rintro x (h\u2082 : (Q.ofComp P).toAlgHom x = 0) let e : (\u03b9' \u2295 \u03b9 \u2192\u2080 \u2115) \u2243+ (\u03b9' \u2192\u2080 \u2115) \u00d7 (\u03b9 \u2192\u2080 \u2115) := Finsupp.sumFinsuppAddEquivProdFinsupp suffices \u2211 v \u2208 (support x).map e, (monomial (e.symm v)) (coeff (e.symm v) x) \u2208 Ideal.map (Q.toComp P).toAlgHom.toRingHom P.ker by\nState 4: \u22a2 \nTactic: simpa only [AlgHom.toRingHom_eq_coe, Finset.sum_map, Equiv.coe_toEmbedding, EquivLike.coe_coe, AddEquiv.symm_apply_apply, support_sum_monomial_coeff] using this\nState 5: \u22a2 \nTactic: rw [\u2190 Finset.sum_fiberwise_of_maps_to (fun i \u21a6 Finset.mem_image_of_mem Prod.fst)]\nState 6: \u22a2 \nTactic: refine sum_mem fun i hi \u21a6 ?_ convert_to monomial (e.symm (i, 0)) 1 * (Q.toComp P).toAlgHom.toRingHom (\u2211 j \u2208 (support x).map e.toEmbedding with j.1 = i, monomial j.2 (coeff (e.symm j) x)) \u2208 _ \u00b7 rw [map_sum, Finset.mul_sum]\nState 7: \u22a2 \nTactic: refine Finset.sum_congr rfl fun j hj \u21a6 ?_\nState 8: \u22a2 \nTactic: obtain rfl := (Finset.mem_filter.mp hj).2\nState 9: \u22a2 \nTactic: obtain \u27e8i, j\u27e9 := j clear hj hi\nState 10: \u22a2 \nTactic: have : (Q.toComp P).toAlgHom (monomial j (coeff (e.symm (i, j)) x)) = monomial (e.symm (0, j)) (coeff (e.symm (i, j)) x) := toComp_toAlgHom_monomial ..\nState 11: \u22a2 \nTactic: simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, this]\nState 12: \u22a2 \nTactic: rw [monomial_mul, \u2190 map_add, Prod.mk_add_mk, add_zero, zero_add, one_mul] \u00b7 apply Ideal.mul_mem_left\nState 13: \u22a2 \nTactic: refine Ideal.mem_map_of_mem _ ?_\nState 14: \u22a2 \nTactic: simp only [ker_eq_ker_aeval_val, AddEquiv.toEquiv_eq_coe, RingHom.mem_ker, map_sum]\nState 15: \u22a2 \nTactic: rw [\u2190 coeff_zero i, \u2190 h\u2082] clear h\u2082 hi\nState 16: \u22a2 \nTactic: have (x : (Q.comp P).Ring) : (Function.support fun a \u21a6 if a.1 = i then aeval P.val (monomial a.2 (coeff (e.symm a) x)) else 0) \u2286 SetLike.coe ((support x).map e) := by\nState 17: \u22a2 \nTactic: rw [\u2190 Set.compl_subset_compl]\nState 18: \u22a2 \nTactic: intro j\nState 19: \u22a2 \nTactic: obtain \u27e8j, rfl\u27e9 := e.surjective j\nState 20: \u22a2 \nTactic: simp_all\nState 21: \u22a2 \nTactic: rw [Finset.sum_filter, \u2190 finsum_eq_sum_of_support_subset _ (this x)]\nState 22: \u22a2 \nTactic: induction x using MvPolynomial.induction_on' with | monomial v a =>\nState 23: \u22a2 \nTactic: rw [finsum_eq_sum_of_support_subset _ (this _), \u2190 Finset.sum_filter]\nState 24: \u22a2 \nTactic: obtain \u27e8v, rfl\u27e9 := e.symm.surjective v -- Rewrite `e` in the right-hand side only. conv_rhs => simp only [e, Finsupp.sumFinsuppAddEquivProdFinsupp, Finsupp.sumFinsuppEquivProdFinsupp, AddEquiv.symm_mk, AddEquiv.coe_mk, Equiv.coe_fn_symm_mk, ofComp_toAlgHom_monomial_sumElim] classical\nState 25: \u22a2 \nTactic: simp only [coeff_monomial, \u2190 e.injective.eq_iff, map_zero, AddEquiv.apply_symm_apply, apply_ite]\nState 26: \u22a2 \nTactic: rw [\u2190 apply_ite, Finset.sum_ite_eq]\nState 27: \u22a2 \nTactic: simp only [Finset.mem_filter, Finset.mem_map_equiv, AddEquiv.coe_toEquiv_symm, mem_support_iff, coeff_monomial, \u2193reduceIte, ne_eq, ite_and, ite_not]\nState 28: \u22a2 \nTactic: split \u00b7 simp only [*, map_zero, ite_self] \u00b7 congr | add p q hp hq =>\nState 29: \u22a2 \nTactic: simp only [coeff_add, map_add, ite_add_zero]\nState 30: \u22a2 \nTactic: rw [finsum_add_distrib, hp, hq] \u00b7 refine (((support p).map e).finite_toSet.subset ?_)\nState 31: \u22a2 \nTactic: convert this p \u00b7 refine (((support q).map e).finite_toSet.subset ?_)\nState 32: \u22a2 \nTactic: convert this q /-- Given `R[X] \u2192 S` and `S[Y] \u2192 T`, this is the lift of an element in `ker(S[Y] \u2192 T)` to `ker(R[X][Y] \u2192 S[Y] \u2192 T)` constructed from `P.\u03c3`. -/ noncomputable\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.RingTheory.Extension.Generators).[/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.RingTheory.Extension.Generators.map_toComp_ker`:\nState 0: \u22a2 lemma map_toComp_ker (Q : Generators S T \u03b9') (P : Generators R S \u03b9) :\n P.ker.map (Q.toComp P).toAlgHom = RingHom.ker (Q.ofComp P).toAlgHom\nTactic: apply le_antisymm \u00b7 rw [Ideal.map_le_iff_le_comap] rintro x (hx : algebraMap P.Ring S x = 0)\nState 1: \u22a2 \nTactic: have : (Q.ofComp P).toAlgHom.comp (Q.toComp P).toAlgHom = IsScalarTower.toAlgHom R _ _ := by ext1; simp\nState 2: \u22a2 \nTactic: simp only [Ideal.mem_comap, RingHom.mem_ker, \u2190 AlgHom.comp_apply, this, IsScalarTower.toAlgHom_apply]\nState 3: \u22a2 \nTactic: rw [IsScalarTower.algebraMap_apply P.Ring S, hx, map_zero] \u00b7 rintro x (h\u2082 : (Q.ofComp P).toAlgHom x = 0) let e : (\u03b9' \u2295 \u03b9 \u2192\u2080 \u2115) \u2243+ (\u03b9' \u2192\u2080 \u2115) \u00d7 (\u03b9 \u2192\u2080 \u2115) := Finsupp.sumFinsuppAddEquivProdFinsupp suffices \u2211 v \u2208 (support x).map e, (monomial (e.symm v)) (coeff (e.symm v) x) \u2208 Ideal.map (Q.toComp P).toAlgHom.toRingHom P.ker by\nState 4: \u22a2 \nTactic: simpa only [AlgHom.toRingHom_eq_coe, Finset.sum_map, Equiv.coe_toEmbedding, EquivLike.coe_coe, AddEquiv.symm_apply_apply, support_sum_monomial_coeff] using this\nState 5: \u22a2 \nTactic: rw [\u2190 Finset.sum_fiberwise_of_maps_to (fun i \u21a6 Finset.mem_image_of_mem Prod.fst)]\nState 6: \u22a2 \nTactic: refine sum_mem fun i hi \u21a6 ?_ convert_to monomial (e.symm (i, 0)) 1 * (Q.toComp P).toAlgHom.toRingHom (\u2211 j \u2208 (support x).map e.toEmbedding with j.1 = i, monomial j.2 (coeff (e.symm j) x)) \u2208 _ \u00b7 rw [map_sum, Finset.mul_sum]\nState 7: \u22a2 \nTactic: refine Finset.sum_congr rfl fun j hj \u21a6 ?_\nState 8: \u22a2 \nTactic: obtain rfl := (Finset.mem_filter.mp hj).2\nState 9: \u22a2 \nTactic: obtain \u27e8i, j\u27e9 := j clear hj hi\nState 10: \u22a2 \nTactic: have : (Q.toComp P).toAlgHom (monomial j (coeff (e.symm (i, j)) x)) = monomial (e.symm (0, j)) (coeff (e.symm (i, j)) x) := toComp_toAlgHom_monomial ..\nState 11: \u22a2 \nTactic: simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, this]\nState 12: \u22a2 \nTactic: rw [monomial_mul, \u2190 map_add, Prod.mk_add_mk, add_zero, zero_add, one_mul] \u00b7 apply Ideal.mul_mem_left\nState 13: \u22a2 \nTactic: refine Ideal.mem_map_of_mem _ ?_\nState 14: \u22a2 \nTactic: simp only [ker_eq_ker_aeval_val, AddEquiv.toEquiv_eq_coe, RingHom.mem_ker, map_sum]\nState 15: \u22a2 \nTactic: rw [\u2190 coeff_zero i, \u2190 h\u2082] clear h\u2082 hi\nState 16: \u22a2 \nTactic: have (x : (Q.comp P).Ring) : (Function.support fun a \u21a6 if a.1 = i then aeval P.val (monomial a.2 (coeff (e.symm a) x)) else 0) \u2286 SetLike.coe ((support x).map e) := by\nState 17: \u22a2 \nTactic: rw [\u2190 Set.compl_subset_compl]\nState 18: \u22a2 \nTactic: intro j\nState 19: \u22a2 \nTactic: obtain \u27e8j, rfl\u27e9 := e.surjective j\nState 20: \u22a2 \nTactic: simp_all\nState 21: \u22a2 \nTactic: rw [Finset.sum_filter, \u2190 finsum_eq_sum_of_support_subset _ (this x)]\nState 22: \u22a2 \nTactic: induction x using MvPolynomial.induction_on' with | monomial v a =>\nState 23: \u22a2 \nTactic: rw [finsum_eq_sum_of_support_subset _ (this _), \u2190 Finset.sum_filter]\nState 24: \u22a2 \nTactic: obtain \u27e8v, rfl\u27e9 := e.symm.surjective v -- Rewrite `e` in the right-hand side only. conv_rhs => simp only [e, Finsupp.sumFinsuppAddEquivProdFinsupp, Finsupp.sumFinsuppEquivProdFinsupp, AddEquiv.symm_mk, AddEquiv.coe_mk, Equiv.coe_fn_symm_mk, ofComp_toAlgHom_monomial_sumElim] classical\nState 25: \u22a2 \nTactic: simp only [coeff_monomial, \u2190 e.injective.eq_iff, map_zero, AddEquiv.apply_symm_apply, apply_ite]\nState 26: \u22a2 \nTactic: rw [\u2190 apply_ite, Finset.sum_ite_eq]\nState 27: \u22a2 \nTactic: simp only [Finset.mem_filter, Finset.mem_map_equiv, AddEquiv.coe_toEquiv_symm, mem_support_iff, coeff_monomial, \u2193reduceIte, ne_eq, ite_and, ite_not]\nState 28: \u22a2 \nTactic: split \u00b7 simp only [*, map_zero, ite_self] \u00b7 congr | add p q hp hq =>\nState 29: \u22a2 \nTactic: simp only [coeff_add, map_add, ite_add_zero]\nState 30: \u22a2 \nTactic: rw [finsum_add_distrib, hp, hq] \u00b7 refine (((support p).map e).finite_toSet.subset ?_)\nState 31: \u22a2 \nTactic: convert this p \u00b7 refine (((support q).map e).finite_toSet.subset ?_)\nState 32: \u22a2 \nTactic: convert this q /-- Given `R[X] \u2192 S` and `S[Y] \u2192 T`, this is the lift of an element in `ker(S[Y] \u2192 T)` to `ker(R[X][Y] \u2192 S[Y] \u2192 T)` constructed from `P.\u03c3`. -/ noncomputable\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Extension/Generators.lean", "module": "Mathlib.RingTheory.Extension.Generators", "declaration": "Mathlib.RingTheory.Extension.Generators.map_toComp_ker", "span": "L602-L676", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Extension/Generators.lean#L602"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 2522, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 6480, "lean_code_chars": 0, "natural_language_chars": 6480, "lean_code_ratio": 0.0, "line_count": 74, "imports_count": 0, "declarations_count": 739, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "medium", "duplicate_fingerprint": "d59b9fc933e0e2e5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots.norm_pow_sub_one_two", "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.NumberTheory.Cyclotomic.PrimitiveRoots)."}, {"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.NumberTheory.Cyclotomic.PrimitiveRoots.norm_pow_sub_one_two`:\nState 0: \u22a2 theorem norm_pow_sub_one_two {k : \u2115} (h\u03b6 : IsPrimitiveRoot \u03b6 (2 ^ (k + 1)))\n [IsCyclotomicExtension {2 ^ (k + 1)} K L]\n (hirr : Irreducible (cyclotomic (2 ^ (k + 1)) K)) :\n norm K (\u03b6 ^ 2 ^ k - 1) = (-2 : K) ^ 2 ^ k\nTactic: have := h\u03b6.pow_of_dvd (fun h => two_ne_zero (eq_zero_of_pow_eq_zero h)) (pow_dvd_pow 2 (le_succ k))\nState 1: \u22a2 \nTactic: rw [Nat.pow_div (le_succ k) zero_lt_two, Nat.succ_sub (le_refl k), Nat.sub_self, pow_one] at this\nState 2: \u22a2 \nTactic: have H : (-1 : L) - (1 : L) = algebraMap K L (-2) := by\nState 3: \u22a2 \nTactic: simp only [map_neg, map_ofNat]\nState 4: \u22a2 \nTactic: ring replace hirr : Irreducible (cyclotomic (2 ^ (k + 1)) K) := by simp [hirr]\nState 5: \u22a2 \nTactic: rw [this.eq_neg_one_of_two_right, H, Algebra.norm_algebraMap, IsCyclotomicExtension.finrank L hirr, totient_prime_pow Nat.prime_two (zero_lt_succ k), succ_sub_succ_eq_sub, tsub_zero]\nState 6: \u22a2 \nTactic: simp /-- If `Irreducible (cyclotomic (2 ^ k) K)` (in particular for `K = \u211a`) and `k` is at least `2`, then the norm of `\u03b6 - 1` is `2`. -/\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.NumberTheory.Cyclotomic.PrimitiveRoots).[/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.NumberTheory.Cyclotomic.PrimitiveRoots.norm_pow_sub_one_two`:\nState 0: \u22a2 theorem norm_pow_sub_one_two {k : \u2115} (h\u03b6 : IsPrimitiveRoot \u03b6 (2 ^ (k + 1)))\n [IsCyclotomicExtension {2 ^ (k + 1)} K L]\n (hirr : Irreducible (cyclotomic (2 ^ (k + 1)) K)) :\n norm K (\u03b6 ^ 2 ^ k - 1) = (-2 : K) ^ 2 ^ k\nTactic: have := h\u03b6.pow_of_dvd (fun h => two_ne_zero (eq_zero_of_pow_eq_zero h)) (pow_dvd_pow 2 (le_succ k))\nState 1: \u22a2 \nTactic: rw [Nat.pow_div (le_succ k) zero_lt_two, Nat.succ_sub (le_refl k), Nat.sub_self, pow_one] at this\nState 2: \u22a2 \nTactic: have H : (-1 : L) - (1 : L) = algebraMap K L (-2) := by\nState 3: \u22a2 \nTactic: simp only [map_neg, map_ofNat]\nState 4: \u22a2 \nTactic: ring replace hirr : Irreducible (cyclotomic (2 ^ (k + 1)) K) := by simp [hirr]\nState 5: \u22a2 \nTactic: rw [this.eq_neg_one_of_two_right, H, Algebra.norm_algebraMap, IsCyclotomicExtension.finrank L hirr, totient_prime_pow Nat.prime_two (zero_lt_succ k), succ_sub_succ_eq_sub, tsub_zero]\nState 6: \u22a2 \nTactic: simp /-- If `Irreducible (cyclotomic (2 ^ k) K)` (in particular for `K = \u211a`) and `k` is at least `2`, then the norm of `\u03b6 - 1` is `2`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean", "module": "Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots", "declaration": "Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots.norm_pow_sub_one_two", "span": "L474-L491", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean#L474"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 735, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2043, "lean_code_chars": 0, "natural_language_chars": 2043, "lean_code_ratio": 0.0, "line_count": 24, "imports_count": 0, "declarations_count": 228, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "771f45ec0f8a96db", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.AdicCompletion.Basic.bot", "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.RingTheory.AdicCompletion.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.RingTheory.AdicCompletion.Basic.bot`:\nState 0: \u22a2 instance bot : IsPrecomplete (\u22a5 : Ideal R) M\nTactic: refine \u27e8fun f hf => \u27e8f 1, fun n => ?_\u27e9\u27e9 rcases n with - | n \u00b7 rw [pow_zero, Ideal.one_eq_top, top_smul]\nState 1: \u22a2 \u27e8f 1, fun n => ?_\u27e9\u27e9>\nTactic: exact SModEq.top specialize hf (Nat.le_add_left 1 n)\nState 2: \u22a2 \nTactic: rw [pow_one, bot_smul, SModEq.bot] at hf; rw [hf]\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.RingTheory.AdicCompletion.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.RingTheory.AdicCompletion.Basic.bot`:\nState 0: \u22a2 instance bot : IsPrecomplete (\u22a5 : Ideal R) M\nTactic: refine \u27e8fun f hf => \u27e8f 1, fun n => ?_\u27e9\u27e9 rcases n with - | n \u00b7 rw [pow_zero, Ideal.one_eq_top, top_smul]\nState 1: \u22a2 \u27e8f 1, fun n => ?_\u27e9\u27e9>\nTactic: exact SModEq.top specialize hf (Nat.le_add_left 1 n)\nState 2: \u22a2 \nTactic: rw [pow_one, bot_smul, SModEq.bot] at hf; rw [hf]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/AdicCompletion/Basic.lean", "module": "Mathlib.RingTheory.AdicCompletion.Basic", "declaration": "Mathlib.RingTheory.AdicCompletion.Basic.bot", "span": "L245-L252", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/AdicCompletion/Basic.lean#L245"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 333, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1007, "lean_code_chars": 0, "natural_language_chars": 1007, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 128, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ab8f857144572b36", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Algebra.Homology.DerivedCategory.Ext.Basic.hasExt_iff_small_ext", "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.Algebra.Homology.DerivedCategory.Ext.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.Algebra.Homology.DerivedCategory.Ext.Basic.hasExt_iff_small_ext`:\nState 0: \u22a2 lemma hasExt_iff_small_ext :\n HasExt.{w'} C \u2194 \u2200 (X Y : C) (n : \u2115), Small.{w'} (Ext.{w} X Y n)\nTactic: simp only [hasExt_iff, small_congr Ext.homEquiv]\nState 1: \u22a2 \nTactic: constructor \u00b7 intro h X Y n\nState 2: \u22a2 \nTactic: exact h X Y n (by simp) \u00b7 intro h X Y n hn lift n to \u2115 using hn\nState 3: \u22a2 \nTactic: exact h X Y n end CategoryTheory\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.Algebra.Homology.DerivedCategory.Ext.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.Algebra.Homology.DerivedCategory.Ext.Basic.hasExt_iff_small_ext`:\nState 0: \u22a2 lemma hasExt_iff_small_ext :\n HasExt.{w'} C \u2194 \u2200 (X Y : C) (n : \u2115), Small.{w'} (Ext.{w} X Y n)\nTactic: simp only [hasExt_iff, small_congr Ext.homEquiv]\nState 1: \u22a2 \nTactic: constructor \u00b7 intro h X Y n\nState 2: \u22a2 \nTactic: exact h X Y n (by simp) \u00b7 intro h X Y n hn lift n to \u2115 using hn\nState 3: \u22a2 \nTactic: exact h X Y n end CategoryTheory\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Homology/DerivedCategory/Ext/Basic.lean", "module": "Mathlib.Algebra.Homology.DerivedCategory.Ext.Basic", "declaration": "Mathlib.Algebra.Homology.DerivedCategory.Ext.Basic.hasExt_iff_small_ext", "span": "L556-L567", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/DerivedCategory/Ext/Basic.lean#L556"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 360, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1126, "lean_code_chars": 0, "natural_language_chars": 1126, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 151, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "627c1e7587750e67", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.NumberField.Cyclotomic.Basic.finite_quotient_span_sub_one", "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.NumberTheory.NumberField.Cyclotomic.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.NumberTheory.NumberField.Cyclotomic.Basic.finite_quotient_span_sub_one`:\nState 0: \u22a2 theorem finite_quotient_span_sub_one [hcycl : IsCyclotomicExtension {p ^ (k + 1)} \u211a K]\n (h\u03b6 : IsPrimitiveRoot \u03b6 (p ^ (k + 1))) :\n Finite (\ud835\udcde K \u29f8 Ideal.span {h\u03b6.toInteger - 1})\nTactic: have : NumberField K := IsCyclotomicExtension.numberField {p ^ (k + 1)} \u211a K\nState 1: \u22a2 \nTactic: refine Ideal.finiteQuotientOfFreeOfNeBot _ (fun h \u21a6 ?_)\nState 2: \u22a2 \nTactic: simp only [Ideal.span_singleton_eq_bot, sub_eq_zero] at h\nState 3: \u22a2 \nTactic: exact h\u03b6.ne_one (one_lt_pow\u2080 hp.1.one_lt (Nat.zero_ne_add_one k).symm) (RingOfIntegers.ext_iff.1 h)\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.NumberTheory.NumberField.Cyclotomic.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.NumberTheory.NumberField.Cyclotomic.Basic.finite_quotient_span_sub_one`:\nState 0: \u22a2 theorem finite_quotient_span_sub_one [hcycl : IsCyclotomicExtension {p ^ (k + 1)} \u211a K]\n (h\u03b6 : IsPrimitiveRoot \u03b6 (p ^ (k + 1))) :\n Finite (\ud835\udcde K \u29f8 Ideal.span {h\u03b6.toInteger - 1})\nTactic: have : NumberField K := IsCyclotomicExtension.numberField {p ^ (k + 1)} \u211a K\nState 1: \u22a2 \nTactic: refine Ideal.finiteQuotientOfFreeOfNeBot _ (fun h \u21a6 ?_)\nState 2: \u22a2 \nTactic: simp only [Ideal.span_singleton_eq_bot, sub_eq_zero] at h\nState 3: \u22a2 \nTactic: exact h\u03b6.ne_one (one_lt_pow\u2080 hp.1.one_lt (Nat.zero_ne_add_one k).symm) (RingOfIntegers.ext_iff.1 h)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/Cyclotomic/Basic.lean", "module": "Mathlib.NumberTheory.NumberField.Cyclotomic.Basic", "declaration": "Mathlib.NumberTheory.NumberField.Cyclotomic.Basic.finite_quotient_span_sub_one", "span": "L480-L488", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/Cyclotomic/Basic.lean#L480"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 474, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1434, "lean_code_chars": 0, "natural_language_chars": 1434, "lean_code_ratio": 0.0, "line_count": 17, "imports_count": 0, "declarations_count": 150, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "15c99cac1393378a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Data.ENNReal.Holder.eq_top_iff_eq_one", "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.Data.ENNReal.Holder)."}, {"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.Data.ENNReal.Holder.eq_top_iff_eq_one`:\nState 0: \u22a2 lemma eq_top_iff_eq_one : p = \u221e \u2194 q = 1\nTactic: constructor \u00b7 rintro rfl\nState 1: \u22a2 \nTactic: rw [\u2190 inv_inv q, \u2190 one_sub_inv \u221e q]\nState 2: \u22a2 \nTactic: simp \u00b7 rintro rfl\nState 3: \u22a2 \nTactic: rw [\u2190 inv_inv p, \u2190 one_sub_inv 1 p]\nState 4: \u22a2 \nTactic: simp\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.Data.ENNReal.Holder).[/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.Data.ENNReal.Holder.eq_top_iff_eq_one`:\nState 0: \u22a2 lemma eq_top_iff_eq_one : p = \u221e \u2194 q = 1\nTactic: constructor \u00b7 rintro rfl\nState 1: \u22a2 \nTactic: rw [\u2190 inv_inv q, \u2190 one_sub_inv \u221e q]\nState 2: \u22a2 \nTactic: simp \u00b7 rintro rfl\nState 3: \u22a2 \nTactic: rw [\u2190 inv_inv p, \u2190 one_sub_inv 1 p]\nState 4: \u22a2 \nTactic: simp\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/ENNReal/Holder.lean", "module": "Mathlib.Data.ENNReal.Holder", "declaration": "Mathlib.Data.ENNReal.Holder.eq_top_iff_eq_one", "span": "L160-L168", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/ENNReal/Holder.lean#L160"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 330, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1000, "lean_code_chars": 0, "natural_language_chars": 1000, "lean_code_ratio": 0.0, "line_count": 17, "imports_count": 0, "declarations_count": 123, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "6d11d83b7db163b8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_compCLMOfContinuousLinearEquiv", "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.Analysis.Distribution.SchwartzSpace.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.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_compCLMOfContinuousLinearEquiv`:\nState 0: \u22a2 theorem smulLeftCLM_compCLMOfContinuousLinearEquiv {u : D \u2192 \ud835\udd5c'} (hu : u.HasTemperateGrowth)\n (g : D \u2243L[\u211d] E) (f : \ud835\udce2(E, F)) :\n smulLeftCLM F u (compCLMOfContinuousLinearEquiv \ud835\udd5c g f) =\n compCLMOfContinuousLinearEquiv \ud835\udd5c g (smulLeftCLM F (u \u2218 g.symm) f)\nTactic: ext x\nState 1: \u22a2 \nTactic: have hu' : (u \u2218 g.symm).HasTemperateGrowth := by fun_prop\nState 2: \u22a2 \nTactic: simp [smulLeftCLM_apply_apply hu, smulLeftCLM_apply_apply hu'] end Comp section Postcomp variable [RCLike \ud835\udd5c] [NormedSpace \ud835\udd5c F] [NormedAddCommGroup G] [NormedSpace \u211d G] [NormedSpace \ud835\udd5c G] [NormedAddCommGroup H] [NormedSpace \u211d H] [NormedSpace \ud835\udd5c H] /-- Postcomposition with a continuous linear map is a continuous linear map on Schwartz functions. -/\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.Analysis.Distribution.SchwartzSpace.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.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_compCLMOfContinuousLinearEquiv`:\nState 0: \u22a2 theorem smulLeftCLM_compCLMOfContinuousLinearEquiv {u : D \u2192 \ud835\udd5c'} (hu : u.HasTemperateGrowth)\n (g : D \u2243L[\u211d] E) (f : \ud835\udce2(E, F)) :\n smulLeftCLM F u (compCLMOfContinuousLinearEquiv \ud835\udd5c g f) =\n compCLMOfContinuousLinearEquiv \ud835\udd5c g (smulLeftCLM F (u \u2218 g.symm) f)\nTactic: ext x\nState 1: \u22a2 \nTactic: have hu' : (u \u2218 g.symm).HasTemperateGrowth := by fun_prop\nState 2: \u22a2 \nTactic: simp [smulLeftCLM_apply_apply hu, smulLeftCLM_apply_apply hu'] end Comp section Postcomp variable [RCLike \ud835\udd5c] [NormedSpace \ud835\udd5c F] [NormedAddCommGroup G] [NormedSpace \u211d G] [NormedSpace \ud835\udd5c G] [NormedAddCommGroup H] [NormedSpace \u211d H] [NormedSpace \ud835\udd5c H] /-- Postcomposition with a continuous linear map is a continuous linear map on Schwartz functions. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean", "module": "Mathlib.Analysis.Distribution.SchwartzSpace.Basic", "declaration": "Mathlib.Analysis.Distribution.SchwartzSpace.Basic.smulLeftCLM_compCLMOfContinuousLinearEquiv", "span": "L1015-L1033", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean#L1015"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 516, "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": 165, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ad4ace8c23c2ba71", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.Localization.Ideal.map_comap", "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.RingTheory.Localization.Ideal)."}, {"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.RingTheory.Localization.Ideal.map_comap`:\nState 0: \u22a2 theorem map_comap (J : Ideal S) :\n Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) J) = J\nTactic: obtain \u27e8r, s, hx\u27e9 := exists_mk'_eq M x\nState 1: \u22a2 \nTactic: rw [\u2190 hx] at hJ \u22a2\nState 2: \u22a2 \nTactic: exact Ideal.mul_mem_right _ _ (Ideal.mem_map_of_mem _ (show (algebraMap R S) r \u2208 J from mk'_spec S r s \u25b8 J.mul_mem_right ((algebraMap R S) s) hJ))\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.RingTheory.Localization.Ideal).[/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.RingTheory.Localization.Ideal.map_comap`:\nState 0: \u22a2 theorem map_comap (J : Ideal S) :\n Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) J) = J\nTactic: obtain \u27e8r, s, hx\u27e9 := exists_mk'_eq M x\nState 1: \u22a2 \nTactic: rw [\u2190 hx] at hJ \u22a2\nState 2: \u22a2 \nTactic: exact Ideal.mul_mem_right _ _ (Ideal.mem_map_of_mem _ (show (algebraMap R S) r \u2208 J from mk'_spec S r s \u25b8 J.mul_mem_right ((algebraMap R S) s) hJ))\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Localization/Ideal.lean", "module": "Mathlib.RingTheory.Localization.Ideal", "declaration": "Mathlib.RingTheory.Localization.Ideal.map_comap", "span": "L132-L142", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Localization/Ideal.lean#L132"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 357, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1064, "lean_code_chars": 0, "natural_language_chars": 1064, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 142, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b8698c15670f6a0e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.SpecialFunctions.Log.Deriv.hasSum_pow_div_log_of_abs_lt_one", "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.Analysis.SpecialFunctions.Log.Deriv)."}, {"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.Analysis.SpecialFunctions.Log.Deriv.hasSum_pow_div_log_of_abs_lt_one`:\nState 0: \u22a2 theorem hasSum_pow_div_log_of_abs_lt_one {x : \u211d} (h : |x| < 1) :\n HasSum (fun n : \u2115 => x ^ (n + 1) / (n + 1)) (-log (1 - x))\nTactic: rw [Summable.hasSum_iff_tendsto_nat] \u00b7 show Tendsto (fun n : \u2115 => \u2211 i \u2208 range n, x ^ (i + 1) / (i + 1)) atTop (\ud835\udcdd (-log (1 - x)))\nState 1: \u22a2 \nTactic: rw [tendsto_iff_norm_sub_tendsto_zero]\nState 2: \u22a2 \nTactic: simp only [norm_eq_abs, sub_neg_eq_add]\nState 3: \u22a2 \nTactic: refine squeeze_zero (fun n => abs_nonneg _) (abs_log_sub_add_sum_range_le h) ?_ suffices Tendsto (fun t : \u2115 => |x| ^ (t + 1) / (1 - |x|)) atTop (\ud835\udcdd (|x| * 0 / (1 - |x|))) by\nState 4: \u22a2 abs_nonneg _) (abs_log_sub_add_sum_range_le h) ?_>\nTactic: simpa\nState 5: \u22a2 \nTactic: simp only [pow_succ']\nState 6: \u22a2 \nTactic: refine (tendsto_const_nhds.mul ?_).div_const _\nState 7: \u22a2 \nTactic: exact tendsto_pow_atTop_nhds_zero_of_lt_one (abs_nonneg _) h show Summable fun n : \u2115 => x ^ (n + 1) / (n + 1)\nState 8: \u22a2 \nTactic: refine .of_norm_bounded (summable_geometric_of_lt_one (abs_nonneg _) h) fun i => ?_\nState 9: \u22a2 ?_>\nTactic: calc \u2016x ^ (i + 1) / (i + 1)\u2016 = |x| ^ (i + 1) / (i + 1) := by\nState 10: \u22a2 \nTactic: have : (0 : \u211d) \u2264 i + 1 := le_of_lt (Nat.cast_add_one_pos i)\nState 11: \u22a2 \nTactic: rw [norm_eq_abs, abs_div, \u2190 pow_abs, abs_of_nonneg this] _ \u2264 |x| ^ (i + 1) / (0 + 1) := by\nState 12: \u22a2 \nTactic: gcongr\nState 13: \u22a2 \nTactic: exact i.cast_nonneg _ \u2264 |x| ^ i := by\nState 14: \u22a2 \nTactic: simpa [pow_succ] using mul_le_of_le_one_right (pow_nonneg (abs_nonneg x) i) (le_of_lt h) /-- Power series expansion of `log(1 + x) - log(1 - x)` for `|x| < 1`. -/\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.Analysis.SpecialFunctions.Log.Deriv).[/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.Analysis.SpecialFunctions.Log.Deriv.hasSum_pow_div_log_of_abs_lt_one`:\nState 0: \u22a2 theorem hasSum_pow_div_log_of_abs_lt_one {x : \u211d} (h : |x| < 1) :\n HasSum (fun n : \u2115 => x ^ (n + 1) / (n + 1)) (-log (1 - x))\nTactic: rw [Summable.hasSum_iff_tendsto_nat] \u00b7 show Tendsto (fun n : \u2115 => \u2211 i \u2208 range n, x ^ (i + 1) / (i + 1)) atTop (\ud835\udcdd (-log (1 - x)))\nState 1: \u22a2 \nTactic: rw [tendsto_iff_norm_sub_tendsto_zero]\nState 2: \u22a2 \nTactic: simp only [norm_eq_abs, sub_neg_eq_add]\nState 3: \u22a2 \nTactic: refine squeeze_zero (fun n => abs_nonneg _) (abs_log_sub_add_sum_range_le h) ?_ suffices Tendsto (fun t : \u2115 => |x| ^ (t + 1) / (1 - |x|)) atTop (\ud835\udcdd (|x| * 0 / (1 - |x|))) by\nState 4: \u22a2 abs_nonneg _) (abs_log_sub_add_sum_range_le h) ?_>\nTactic: simpa\nState 5: \u22a2 \nTactic: simp only [pow_succ']\nState 6: \u22a2 \nTactic: refine (tendsto_const_nhds.mul ?_).div_const _\nState 7: \u22a2 \nTactic: exact tendsto_pow_atTop_nhds_zero_of_lt_one (abs_nonneg _) h show Summable fun n : \u2115 => x ^ (n + 1) / (n + 1)\nState 8: \u22a2 \nTactic: refine .of_norm_bounded (summable_geometric_of_lt_one (abs_nonneg _) h) fun i => ?_\nState 9: \u22a2 ?_>\nTactic: calc \u2016x ^ (i + 1) / (i + 1)\u2016 = |x| ^ (i + 1) / (i + 1) := by\nState 10: \u22a2 \nTactic: have : (0 : \u211d) \u2264 i + 1 := le_of_lt (Nat.cast_add_one_pos i)\nState 11: \u22a2 \nTactic: rw [norm_eq_abs, abs_div, \u2190 pow_abs, abs_of_nonneg this] _ \u2264 |x| ^ (i + 1) / (0 + 1) := by\nState 12: \u22a2 \nTactic: gcongr\nState 13: \u22a2 \nTactic: exact i.cast_nonneg _ \u2264 |x| ^ i := by\nState 14: \u22a2 \nTactic: simpa [pow_succ] using mul_le_of_le_one_right (pow_nonneg (abs_nonneg x) i) (le_of_lt h) /-- Power series expansion of `log(1 + x) - log(1 - x)` for `|x| < 1`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean", "module": "Mathlib.Analysis.SpecialFunctions.Log.Deriv", "declaration": "Mathlib.Analysis.SpecialFunctions.Log.Deriv.hasSum_pow_div_log_of_abs_lt_one", "span": "L353-L377", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean#L353"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1134, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2891, "lean_code_chars": 0, "natural_language_chars": 2891, "lean_code_ratio": 0.0, "line_count": 38, "imports_count": 0, "declarations_count": 319, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6f56d260cc2cfd24", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.FiniteType.freeAlgebra_lift_of_surjective_of_closure", "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.RingTheory.FiniteType)."}, {"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.RingTheory.FiniteType.freeAlgebra_lift_of_surjective_of_closure`:\nState 0: \u22a2 theorem freeAlgebra_lift_of_surjective_of_closure [CommSemiring R] {S : Set M}\n (hS : closure S = \u22a4) :\n Function.Surjective\n (FreeAlgebra.lift R fun s : S => of R M \u2191s : FreeAlgebra R S \u2192 R[M])\nTactic: intro f\nState 1: \u22a2 \nTactic: induction f using induction_on with | hM m =>\nState 2: \u22a2 \nTactic: have : m \u2208 closure S := hS.symm \u25b8 mem_top _\nState 3: \u22a2 \nTactic: refine Submonoid.closure_induction (fun m hm => ?_) ?_ ?_ this \u00b7 exact \u27e8FreeAlgebra.\u03b9 R \u27e8m, hm\u27e9, FreeAlgebra.lift_\u03b9_apply _ _\u27e9 \u00b7 exact \u27e81, map_one _\u27e9 \u00b7 rintro m\u2081 m\u2082 _ _ \u27e8P\u2081, hP\u2081\u27e9 \u27e8P\u2082, hP\u2082\u27e9\nState 4: \u22a2 ?_) ?_ ?_ this>\nTactic: exact \u27e8P\u2081 * P\u2082, by\nState 5: \u22a2 \nTactic: rw [map_mul, hP\u2081, hP\u2082, of_apply, of_apply, of_apply, single_mul_single, one_mul]\u27e9 | hadd f g ihf ihg => rcases ihf with \u27e8P, rfl\u27e9 rcases ihg with \u27e8Q, rfl\u27e9\nState 6: \u22a2 \nTactic: exact \u27e8P + Q, map_add _ _ _\u27e9 | hsmul r f ih => rcases ih with \u27e8P, rfl\u27e9\nState 7: \u22a2 \nTactic: exact \u27e8r \u2022 P, map_smul _ _ _\u27e9 /-- If a monoid `M` is finitely generated then `R[M]` is of finite type. -/\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.RingTheory.FiniteType).[/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.RingTheory.FiniteType.freeAlgebra_lift_of_surjective_of_closure`:\nState 0: \u22a2 theorem freeAlgebra_lift_of_surjective_of_closure [CommSemiring R] {S : Set M}\n (hS : closure S = \u22a4) :\n Function.Surjective\n (FreeAlgebra.lift R fun s : S => of R M \u2191s : FreeAlgebra R S \u2192 R[M])\nTactic: intro f\nState 1: \u22a2 \nTactic: induction f using induction_on with | hM m =>\nState 2: \u22a2 \nTactic: have : m \u2208 closure S := hS.symm \u25b8 mem_top _\nState 3: \u22a2 \nTactic: refine Submonoid.closure_induction (fun m hm => ?_) ?_ ?_ this \u00b7 exact \u27e8FreeAlgebra.\u03b9 R \u27e8m, hm\u27e9, FreeAlgebra.lift_\u03b9_apply _ _\u27e9 \u00b7 exact \u27e81, map_one _\u27e9 \u00b7 rintro m\u2081 m\u2082 _ _ \u27e8P\u2081, hP\u2081\u27e9 \u27e8P\u2082, hP\u2082\u27e9\nState 4: \u22a2 ?_) ?_ ?_ this>\nTactic: exact \u27e8P\u2081 * P\u2082, by\nState 5: \u22a2 \nTactic: rw [map_mul, hP\u2081, hP\u2082, of_apply, of_apply, of_apply, single_mul_single, one_mul]\u27e9 | hadd f g ihf ihg => rcases ihf with \u27e8P, rfl\u27e9 rcases ihg with \u27e8Q, rfl\u27e9\nState 6: \u22a2 \nTactic: exact \u27e8P + Q, map_add _ _ _\u27e9 | hsmul r f ih => rcases ih with \u27e8P, rfl\u27e9\nState 7: \u22a2 \nTactic: exact \u27e8r \u2022 P, map_smul _ _ _\u27e9 /-- If a monoid `M` is finitely generated then `R[M]` is of finite type. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/FiniteType.lean", "module": "Mathlib.RingTheory.FiniteType", "declaration": "Mathlib.RingTheory.FiniteType.freeAlgebra_lift_of_surjective_of_closure", "span": "L565-L588", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/FiniteType.lean#L565"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 749, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1994, "lean_code_chars": 0, "natural_language_chars": 1994, "lean_code_ratio": 0.0, "line_count": 26, "imports_count": 0, "declarations_count": 278, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "bf5adeb1c7b197eb", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds.F_int", "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.NumberTheory.ModularForms.JacobiTheta.Bounds)."}, {"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.NumberTheory.ModularForms.JacobiTheta.Bounds.F_int`:\nState 0: \u22a2 def F_int (k : \u2115) (a : UnitAddCircle) (t : \u211d) : \u211d\nTactic: intro b simp_rw [\u2190 (Equiv.addRight (1 : \u2124)).tsum_eq (f := fun n \u21a6 f_int k b t n)]\nState 1: \u22a2 \nTactic: simp only [f_int, \u2190 add_assoc, add_comm, Equiv.coe_addRight, Int.cast_add, Int.cast_one]).lift a\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.NumberTheory.ModularForms.JacobiTheta.Bounds).[/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.NumberTheory.ModularForms.JacobiTheta.Bounds.F_int`:\nState 0: \u22a2 def F_int (k : \u2115) (a : UnitAddCircle) (t : \u211d) : \u211d\nTactic: intro b simp_rw [\u2190 (Equiv.addRight (1 : \u2124)).tsum_eq (f := fun n \u21a6 f_int k b t n)]\nState 1: \u22a2 \nTactic: simp only [f_int, \u2190 add_assoc, add_comm, Equiv.coe_addRight, Int.cast_add, Int.cast_one]).lift a\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/ModularForms/JacobiTheta/Bounds.lean", "module": "Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds", "declaration": "Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds.F_int", "span": "L233-L238", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ModularForms/JacobiTheta/Bounds.lean#L233"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 288, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 929, "lean_code_chars": 0, "natural_language_chars": 929, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 109, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "833f61afbcdfa125", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Order.Interval.Set.ProjIcc.IccExtend_eq_self", "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.Order.Interval.Set.ProjIcc)."}, {"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.Order.Interval.Set.ProjIcc.IccExtend_eq_self`:\nState 0: \u22a2 theorem IccExtend_eq_self (f : \u03b1 \u2192 \u03b2) (ha : \u2200 x < a, f x = f a) (hb : \u2200 x, b < x \u2192 f x = f b) :\n IccExtend h (f \u2218 (\u2191)) = f\nTactic: ext x rcases lt_or_ge x a with hxa | hax \u00b7 simp [IccExtend_of_le_left _ _ hxa.le, ha x hxa] \u00b7 rcases le_or_gt x b with hxb | hbx \u00b7 lift x to Icc a b using \u27e8hax, hxb\u27e9\nState 1: \u22a2 \nTactic: rw [IccExtend_val, comp_apply] \u00b7 simp [IccExtend_of_right_le _ _ hbx.le, hb x hbx] end Set open Set variable [Preorder \u03b2] {s t : Set \u03b1} {a b : \u03b1} (h : a \u2264 b) {f : Icc a b \u2192 \u03b2} protected theorem Monotone.IciExtend {f : Ici a \u2192 \u03b2} (hf : Monotone f) : Monotone (IciExtend f) := hf.comp monotone_projIci protected theorem Monotone.IicExtend {f : Iic b \u2192 \u03b2} (hf : Monotone f) : Monotone (IicExtend f) := hf.comp monotone_projIic protected theorem Monotone.IccExtend (hf : Monotone f) : Monotone (IccExtend h f) := hf.comp <| monotone_projIcc h\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.Order.Interval.Set.ProjIcc).[/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.Order.Interval.Set.ProjIcc.IccExtend_eq_self`:\nState 0: \u22a2 theorem IccExtend_eq_self (f : \u03b1 \u2192 \u03b2) (ha : \u2200 x < a, f x = f a) (hb : \u2200 x, b < x \u2192 f x = f b) :\n IccExtend h (f \u2218 (\u2191)) = f\nTactic: ext x rcases lt_or_ge x a with hxa | hax \u00b7 simp [IccExtend_of_le_left _ _ hxa.le, ha x hxa] \u00b7 rcases le_or_gt x b with hxb | hbx \u00b7 lift x to Icc a b using \u27e8hax, hxb\u27e9\nState 1: \u22a2 \nTactic: rw [IccExtend_val, comp_apply] \u00b7 simp [IccExtend_of_right_le _ _ hbx.le, hb x hbx] end Set open Set variable [Preorder \u03b2] {s t : Set \u03b1} {a b : \u03b1} (h : a \u2264 b) {f : Icc a b \u2192 \u03b2} protected theorem Monotone.IciExtend {f : Ici a \u2192 \u03b2} (hf : Monotone f) : Monotone (IciExtend f) := hf.comp monotone_projIci protected theorem Monotone.IicExtend {f : Iic b \u2192 \u03b2} (hf : Monotone f) : Monotone (IicExtend f) := hf.comp monotone_projIic protected theorem Monotone.IccExtend (hf : Monotone f) : Monotone (IccExtend h f) := hf.comp <| monotone_projIcc h\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Interval/Set/ProjIcc.lean", "module": "Mathlib.Order.Interval.Set.ProjIcc", "declaration": "Mathlib.Order.Interval.Set.ProjIcc.IccExtend_eq_self", "span": "L239-L263", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Set/ProjIcc.lean#L239"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 544, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1518, "lean_code_chars": 0, "natural_language_chars": 1518, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 205, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "e4d3b9d6b2f0f96e", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected.connectedComponentMk_supp_subset_supp", "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.Combinatorics.SimpleGraph.Connectivity.Connected)."}, {"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.Combinatorics.SimpleGraph.Connectivity.Connected.connectedComponentMk_supp_subset_supp`:\nState 0: \u22a2 lemma connectedComponentMk_supp_subset_supp {G'} {v : V} (h : G \u2264 G') (c' : G'.ConnectedComponent)\n (hc' : v \u2208 c'.supp) : (G.connectedComponentMk v).supp \u2286 c'.supp\nTactic: intro v' hv'\nState 1: \u22a2 \nTactic: simp only [mem_supp_iff, ConnectedComponent.eq] at hv' \u22a2\nState 2: \u22a2 \nTactic: rw [ConnectedComponent.sound (hv'.mono h)]\nState 3: \u22a2 \nTactic: exact hc'\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.Combinatorics.SimpleGraph.Connectivity.Connected).[/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.Combinatorics.SimpleGraph.Connectivity.Connected.connectedComponentMk_supp_subset_supp`:\nState 0: \u22a2 lemma connectedComponentMk_supp_subset_supp {G'} {v : V} (h : G \u2264 G') (c' : G'.ConnectedComponent)\n (hc' : v \u2208 c'.supp) : (G.connectedComponentMk v).supp \u2286 c'.supp\nTactic: intro v' hv'\nState 1: \u22a2 \nTactic: simp only [mem_supp_iff, ConnectedComponent.eq] at hv' \u22a2\nState 2: \u22a2 \nTactic: rw [ConnectedComponent.sound (hv'.mono h)]\nState 3: \u22a2 \nTactic: exact hc'\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected", "declaration": "Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected.connectedComponentMk_supp_subset_supp", "span": "L595-L601", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean#L595"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 366, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1198, "lean_code_chars": 0, "natural_language_chars": 1198, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 131, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5489cbba140775ef", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.LegendreSymbol.Basic.prime_dvd_of_eq_neg_one", "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.NumberTheory.LegendreSymbol.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.NumberTheory.LegendreSymbol.Basic.prime_dvd_of_eq_neg_one`:\nState 0: \u22a2 theorem prime_dvd_of_eq_neg_one {p : \u2115} [Fact p.Prime] {a : \u2124} (h : legendreSym p a = -1) {x y : \u2124}\n (hxy : (p : \u2124) \u2223 x ^ 2 - a * y ^ 2) : \u2191p \u2223 x \u2227 \u2191p \u2223 y\nTactic: push_cast at hxy\nState 1: \u22a2 \nTactic: exact eq_zero_mod_of_eq_neg_one h hxy end legendreSym end QuadraticForm section Values /-! ### The value of the Legendre symbol at `-1` See `jacobiSym.at_neg_one` for the corresponding statement for the Jacobi symbol. -/ variable {p : \u2115} [Fact p.Prime] open ZMod /-- `legendreSym p (-1)` is given by `\u03c7\u2084 p`. -/\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.NumberTheory.LegendreSymbol.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.NumberTheory.LegendreSymbol.Basic.prime_dvd_of_eq_neg_one`:\nState 0: \u22a2 theorem prime_dvd_of_eq_neg_one {p : \u2115} [Fact p.Prime] {a : \u2124} (h : legendreSym p a = -1) {x y : \u2124}\n (hxy : (p : \u2124) \u2223 x ^ 2 - a * y ^ 2) : \u2191p \u2223 x \u2227 \u2191p \u2223 y\nTactic: push_cast at hxy\nState 1: \u22a2 \nTactic: exact eq_zero_mod_of_eq_neg_one h hxy end legendreSym end QuadraticForm section Values /-! ### The value of the Legendre symbol at `-1` See `jacobiSym.at_neg_one` for the corresponding statement for the Jacobi symbol. -/ variable {p : \u2115} [Fact p.Prime] open ZMod /-- `legendreSym p (-1)` is given by `\u03c7\u2084 p`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/LegendreSymbol/Basic.lean", "module": "Mathlib.NumberTheory.LegendreSymbol.Basic", "declaration": "Mathlib.NumberTheory.LegendreSymbol.Basic.prime_dvd_of_eq_neg_one", "span": "L250-L273", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LegendreSymbol/Basic.lean#L250"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 391, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1200, "lean_code_chars": 0, "natural_language_chars": 1200, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 144, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "300f4006bf533175", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Data.Nat.Choose.Basic.choose_two_right", "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.Data.Nat.Choose.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.Data.Nat.Choose.Basic.choose_two_right`:\nState 0: \u22a2 theorem choose_two_right (n : \u2115) : choose n 2 = n * (n - 1) / 2\nTactic: induction n with | zero => simp | succ n ih =>\nState 1: \u22a2 \nTactic: rw [triangle_succ n, choose, ih]\nState 2: \u22a2 \nTactic: simp [Nat.add_comm]\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.Data.Nat.Choose.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.Data.Nat.Choose.Basic.choose_two_right`:\nState 0: \u22a2 theorem choose_two_right (n : \u2115) : choose n 2 = n * (n - 1) / 2\nTactic: induction n with | zero => simp | succ n ih =>\nState 1: \u22a2 \nTactic: rw [triangle_succ n, choose, ih]\nState 2: \u22a2 \nTactic: simp [Nat.add_comm]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/Nat/Choose/Basic.lean", "module": "Mathlib.Data.Nat.Choose.Basic", "declaration": "Mathlib.Data.Nat.Choose.Basic.choose_two_right", "span": "L109-L115", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Nat/Choose/Basic.lean#L109"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 275, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 904, "lean_code_chars": 0, "natural_language_chars": 904, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 112, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "489aeaf4025902c5", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.Normed.Affine.Simplex.scalene_iff_dist_ne_and_dist_ne_and_dist_ne", "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.Analysis.Normed.Affine.Simplex)."}, {"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.Analysis.Normed.Affine.Simplex.scalene_iff_dist_ne_and_dist_ne_and_dist_ne`:\nState 0: \u22a2 lemma scalene_iff_dist_ne_and_dist_ne_and_dist_ne {t : Triangle R P} :\n t.Scalene \u2194 dist (t.points 0) (t.points 1) \u2260 dist (t.points 0) (t.points 2) \u2227\n dist (t.points 0) (t.points 1) \u2260 dist (t.points 1) (t.points 2) \u2227\n dist (t.points 0) (t.points 2) \u2260 dist (t.points 1) (t.points 2)\nTactic: refine \u27e8fun h \u21a6 \u27e8h.dist_ne (by decide : (0 : Fin 3) \u2260 1) (by decide : (0 : Fin 3) \u2260 2) (by decide) (by decide), h.dist_ne (by decide : (0 : Fin 3) \u2260 1) (by decide : (1 : Fin 3) \u2260 2) (by decide) (by decide), h.dist_ne (by decide : (0 : Fin 3) \u2260 2) (by decide : (1 : Fin 3) \u2260 2) (by decide) (by decide)\u27e9, fun \u27e8h\u2081, h\u2082, h\u2083\u27e9 \u21a6 ?_\u27e9\nState 1: \u22a2 \nTactic: intro \u27e8\u27e8x\u2081, x\u2082\u27e9, hx\u27e9 \u27e8\u27e8y\u2081, y\u2082\u27e9, hy\u27e9 hxy\nState 2: \u22a2 \nTactic: simp only at hx hy hxy\nState 3: \u22a2 \nTactic: simp only [Subtype.mk.injEq, Prod.mk.injEq] fin_cases x\u2081 <;> fin_cases x\u2082 <;> simp +decide only at hx <;> fin_cases y\u2081 <;> fin_cases y\u2082 <;> simp +decide only at hy <;>\nState 4: \u22a2 \nTactic: simp [h\u2081, h\u2082, h\u2083, h\u2081.symm, h\u2082.symm, h\u2083.symm] at hxy \u22a2\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.Analysis.Normed.Affine.Simplex).[/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.Analysis.Normed.Affine.Simplex.scalene_iff_dist_ne_and_dist_ne_and_dist_ne`:\nState 0: \u22a2 lemma scalene_iff_dist_ne_and_dist_ne_and_dist_ne {t : Triangle R P} :\n t.Scalene \u2194 dist (t.points 0) (t.points 1) \u2260 dist (t.points 0) (t.points 2) \u2227\n dist (t.points 0) (t.points 1) \u2260 dist (t.points 1) (t.points 2) \u2227\n dist (t.points 0) (t.points 2) \u2260 dist (t.points 1) (t.points 2)\nTactic: refine \u27e8fun h \u21a6 \u27e8h.dist_ne (by decide : (0 : Fin 3) \u2260 1) (by decide : (0 : Fin 3) \u2260 2) (by decide) (by decide), h.dist_ne (by decide : (0 : Fin 3) \u2260 1) (by decide : (1 : Fin 3) \u2260 2) (by decide) (by decide), h.dist_ne (by decide : (0 : Fin 3) \u2260 2) (by decide : (1 : Fin 3) \u2260 2) (by decide) (by decide)\u27e9, fun \u27e8h\u2081, h\u2082, h\u2083\u27e9 \u21a6 ?_\u27e9\nState 1: \u22a2 \nTactic: intro \u27e8\u27e8x\u2081, x\u2082\u27e9, hx\u27e9 \u27e8\u27e8y\u2081, y\u2082\u27e9, hy\u27e9 hxy\nState 2: \u22a2 \nTactic: simp only at hx hy hxy\nState 3: \u22a2 \nTactic: simp only [Subtype.mk.injEq, Prod.mk.injEq] fin_cases x\u2081 <;> fin_cases x\u2082 <;> simp +decide only at hx <;> fin_cases y\u2081 <;> fin_cases y\u2082 <;> simp +decide only at hy <;>\nState 4: \u22a2 \nTactic: simp [h\u2081, h\u2082, h\u2083, h\u2081.symm, h\u2082.symm, h\u2083.symm] at hxy \u22a2\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Normed/Affine/Simplex.lean", "module": "Mathlib.Analysis.Normed.Affine.Simplex", "declaration": "Mathlib.Analysis.Normed.Affine.Simplex.scalene_iff_dist_ne_and_dist_ne_and_dist_ne", "span": "L132-L147", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Affine/Simplex.lean#L132"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 770, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1832, "lean_code_chars": 0, "natural_language_chars": 1832, "lean_code_ratio": 0.0, "line_count": 20, "imports_count": 0, "declarations_count": 225, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "2fe8eefbedddb66d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.SumTwoSquares.Nat", "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.NumberTheory.SumTwoSquares)."}, {"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.NumberTheory.SumTwoSquares.Nat`:\nState 0: \u22a2 theorem Nat.mod_four_ne_three_of_mem_primeFactors_of_isSquare_neg_one {p n : \u2115}\n (hp : p \u2208 n.primeFactors) (hs : IsSquare (-1 : ZMod n)) : p % 4 \u2260 3\nTactic: obtain \u27e8y, h\u27e9 := ZMod.isSquare_neg_one_of_dvd (Nat.dvd_of_mem_primeFactors hp) hs\nState 1: \u22a2 \nTactic: rw [\u2190 sq, eq_comm, show (-1 : ZMod p) = -1 ^ 2 by ring] at h\nState 2: \u22a2 \nTactic: have : Fact p.Prime := \u27e8Nat.prime_of_mem_primeFactors hp\u27e9\nState 3: \u22a2 \nTactic: exact ZMod.mod_four_ne_three_of_sq_eq_neg_sq' one_ne_zero h\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.NumberTheory.SumTwoSquares).[/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.NumberTheory.SumTwoSquares.Nat`:\nState 0: \u22a2 theorem Nat.mod_four_ne_three_of_mem_primeFactors_of_isSquare_neg_one {p n : \u2115}\n (hp : p \u2208 n.primeFactors) (hs : IsSquare (-1 : ZMod n)) : p % 4 \u2260 3\nTactic: obtain \u27e8y, h\u27e9 := ZMod.isSquare_neg_one_of_dvd (Nat.dvd_of_mem_primeFactors hp) hs\nState 1: \u22a2 \nTactic: rw [\u2190 sq, eq_comm, show (-1 : ZMod p) = -1 ^ 2 by ring] at h\nState 2: \u22a2 \nTactic: have : Fact p.Prime := \u27e8Nat.prime_of_mem_primeFactors hp\u27e9\nState 3: \u22a2 \nTactic: exact ZMod.mod_four_ne_three_of_sq_eq_neg_sq' one_ne_zero h\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/SumTwoSquares.lean", "module": "Mathlib.NumberTheory.SumTwoSquares", "declaration": "Mathlib.NumberTheory.SumTwoSquares.Nat", "span": "L95-L101", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/SumTwoSquares.lean#L95"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 458, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1331, "lean_code_chars": 0, "natural_language_chars": 1331, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 146, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a6fe2019acf0e50f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Algebra.Polynomial.Splits.Splits", "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.Algebra.Polynomial.Splits)."}, {"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.Algebra.Polynomial.Splits.Splits`:\nState 0: \u22a2 theorem Splits.of_dvd (hg : Splits g) (hg\u2080 : g \u2260 0) (hfg : f \u2223 g) : Splits f\nTactic: obtain \u27e8g, rfl\u27e9 := hfg\nState 1: \u22a2 \nTactic: exact ((splits_mul_iff (by simp_all) (by simp_all)).mp hg).1\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.Algebra.Polynomial.Splits).[/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.Algebra.Polynomial.Splits.Splits`:\nState 0: \u22a2 theorem Splits.of_dvd (hg : Splits g) (hg\u2080 : g \u2260 0) (hfg : f \u2223 g) : Splits f\nTactic: obtain \u27e8g, rfl\u27e9 := hfg\nState 1: \u22a2 \nTactic: exact ((splits_mul_iff (by simp_all) (by simp_all)).mp hg).1\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Polynomial/Splits.lean", "module": "Mathlib.Algebra.Polynomial.Splits", "declaration": "Mathlib.Algebra.Polynomial.Splits.Splits", "span": "L483-L486", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Polynomial/Splits.lean#L483"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 274, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 838, "lean_code_chars": 0, "natural_language_chars": 838, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 106, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1467a49cffe63280", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Order.Atoms.covBy_iff", "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.Order.Atoms)."}, {"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.Order.Atoms.covBy_iff`:\nState 0: \u22a2 theorem covBy_iff {K L : A} :\n K \u22d6 L \u2194 K < L \u2227 \u2200 H g, K \u2264 H \u2192 H \u2264 L \u2192 g \u2209 K \u2192 g \u2208 H \u2192 H = L\nTactic: refine and_congr_right fun _ \u21a6 forall_congr' fun H \u21a6 ?_\nState 1: \u22a2 \nTactic: contrapose!\nState 2: \u22a2 \nTactic: rw [lt_iff_le_not_ge, lt_iff_le_and_ne, and_and_and_comm] simp_rw [exists_and_left, and_assoc, and_congr_right_iff, \u2190 and_assoc, and_comm, exists_and_left, SetLike.not_le_iff_exists, and_comm, implies_true] /-- Dual variant of `SetLike.covBy_iff` -/\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.Order.Atoms).[/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.Order.Atoms.covBy_iff`:\nState 0: \u22a2 theorem covBy_iff {K L : A} :\n K \u22d6 L \u2194 K < L \u2227 \u2200 H g, K \u2264 H \u2192 H \u2264 L \u2192 g \u2209 K \u2192 g \u2208 H \u2192 H = L\nTactic: refine and_congr_right fun _ \u21a6 forall_congr' fun H \u21a6 ?_\nState 1: \u22a2 \nTactic: contrapose!\nState 2: \u22a2 \nTactic: rw [lt_iff_le_not_ge, lt_iff_le_and_ne, and_and_and_comm] simp_rw [exists_and_left, and_assoc, and_congr_right_iff, \u2190 and_assoc, and_comm, exists_and_left, SetLike.not_le_iff_exists, and_comm, implies_true] /-- Dual variant of `SetLike.covBy_iff` -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Atoms.lean", "module": "Mathlib.Order.Atoms", "declaration": "Mathlib.Order.Atoms.covBy_iff", "span": "L232-L240", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Atoms.lean#L232"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 375, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1145, "lean_code_chars": 0, "natural_language_chars": 1145, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 139, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2304953f13ab8355", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.Modular.exists_one_half_le_im_smul", "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.NumberTheory.Modular)."}, {"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.NumberTheory.Modular.exists_one_half_le_im_smul`:\nState 0: \u22a2 lemma exists_one_half_le_im_smul (\u03c4 : \u210d) : \u2203 \u03b3 : SL(2, \u2124), 1 / 2 \u2264 im (\u03b3 \u2022 \u03c4)\nTactic: obtain \u27e8\u03b3, h\u03b3\u27e9 := exists_smul_mem_fd \u03c4\nState 1: \u22a2 \nTactic: use \u03b3 nlinarith [three_le_four_mul_im_sq_of_mem_fd h\u03b3, im_pos (\u03b3 \u2022 \u03c4)] /-- For every `\u03c4 : \u210d` there is some `\u03b3 \u2208 SL(2, \u2124)` that sends it to an element whose imaginary part is at least `1/2` and such that `denom \u03b3 \u03c4` has norm at most 1. -/\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.NumberTheory.Modular).[/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.NumberTheory.Modular.exists_one_half_le_im_smul`:\nState 0: \u22a2 lemma exists_one_half_le_im_smul (\u03c4 : \u210d) : \u2203 \u03b3 : SL(2, \u2124), 1 / 2 \u2264 im (\u03b3 \u2022 \u03c4)\nTactic: obtain \u27e8\u03b3, h\u03b3\u27e9 := exists_smul_mem_fd \u03c4\nState 1: \u22a2 \nTactic: use \u03b3 nlinarith [three_le_four_mul_im_sq_of_mem_fd h\u03b3, im_pos (\u03b3 \u2022 \u03c4)] /-- For every `\u03c4 : \u210d` there is some `\u03b3 \u2208 SL(2, \u2124)` that sends it to an element whose imaginary part is at least `1/2` and such that `denom \u03b3 \u03c4` has norm at most 1. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/Modular.lean", "module": "Mathlib.NumberTheory.Modular", "declaration": "Mathlib.NumberTheory.Modular.exists_one_half_le_im_smul", "span": "L692-L698", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Modular.lean#L692"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 341, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1061, "lean_code_chars": 0, "natural_language_chars": 1061, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 119, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "847b3215878dc556", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Order.ConditionallyCompleteLattice.Finset.Finset", "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.Order.ConditionallyCompleteLattice.Finset)."}, {"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.Order.ConditionallyCompleteLattice.Finset.Finset`:\nState 0: \u22a2 theorem Finset.ciSup_eq_max'_image {s : Finset \u03b9} (h : \u2203 x \u2208 s, sSup \u2205 \u2264 f x)\n (h' : (s.image f).Nonempty\nTactic: rw [iSup, \u2190 h'.csSup_eq_max', coe_image]\nState 1: \u22a2 \nTactic: refine csSup_eq_csSup_of_forall_exists_le ?_ ?_ \u00b7 simp only [ciSup_eq_ite, dite_eq_ite, Set.mem_range, Set.mem_image, mem_coe, exists_exists_and_eq_and, forall_exists_index, forall_apply_eq_imp_iff]\nState 2: \u22a2 \nTactic: intro i split_ifs \u00b7 exact \u27e8_, by assumption, le_rfl\u27e9 \u00b7 assumption \u00b7 simp only [Set.mem_image, mem_coe, ciSup_eq_ite, dite_eq_ite, Set.mem_range, exists_exists_eq_and, forall_exists_index, and_imp, forall_apply_eq_imp_iff\u2082]\nState 3: \u22a2 \nTactic: intro i hi\nState 4: \u22a2 \nTactic: refine \u27e8i, ?_\u27e9\nState 5: \u22a2 \nTactic: simp [hi]\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.Order.ConditionallyCompleteLattice.Finset).[/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.Order.ConditionallyCompleteLattice.Finset.Finset`:\nState 0: \u22a2 theorem Finset.ciSup_eq_max'_image {s : Finset \u03b9} (h : \u2203 x \u2208 s, sSup \u2205 \u2264 f x)\n (h' : (s.image f).Nonempty\nTactic: rw [iSup, \u2190 h'.csSup_eq_max', coe_image]\nState 1: \u22a2 \nTactic: refine csSup_eq_csSup_of_forall_exists_le ?_ ?_ \u00b7 simp only [ciSup_eq_ite, dite_eq_ite, Set.mem_range, Set.mem_image, mem_coe, exists_exists_and_eq_and, forall_exists_index, forall_apply_eq_imp_iff]\nState 2: \u22a2 \nTactic: intro i split_ifs \u00b7 exact \u27e8_, by assumption, le_rfl\u27e9 \u00b7 assumption \u00b7 simp only [Set.mem_image, mem_coe, ciSup_eq_ite, dite_eq_ite, Set.mem_range, exists_exists_eq_and, forall_exists_index, and_imp, forall_apply_eq_imp_iff\u2082]\nState 3: \u22a2 \nTactic: intro i hi\nState 4: \u22a2 \nTactic: refine \u27e8i, ?_\u27e9\nState 5: \u22a2 \nTactic: simp [hi]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/ConditionallyCompleteLattice/Finset.lean", "module": "Mathlib.Order.ConditionallyCompleteLattice.Finset", "declaration": "Mathlib.Order.ConditionallyCompleteLattice.Finset.Finset", "span": "L56-L73", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/ConditionallyCompleteLattice/Finset.lean#L56"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 521, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1552, "lean_code_chars": 0, "natural_language_chars": 1552, "lean_code_ratio": 0.0, "line_count": 20, "imports_count": 0, "declarations_count": 170, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "17fa9dad4996802a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.Convex.Combination.affineCombination_mem_convexHull", "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.Analysis.Convex.Combination)."}, {"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.Analysis.Convex.Combination.affineCombination_mem_convexHull`:\nState 0: \u22a2 theorem affineCombination_mem_convexHull {s : Finset \u03b9} {v : \u03b9 \u2192 E} {w : \u03b9 \u2192 R}\n (hw\u2080 : \u2200 i \u2208 s, 0 \u2264 w i) (hw\u2081 : s.sum w = 1) :\n s.affineCombination R v w \u2208 convexHull R (range v)\nTactic: rw [affineCombination_eq_centerMass hw\u2081]\nState 1: \u22a2 \nTactic: apply s.centerMass_mem_convexHull hw\u2080 \u00b7 simp [hw\u2081] \u00b7 simp /-- The centroid can be regarded as a center of mass. -/\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.Analysis.Convex.Combination).[/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.Analysis.Convex.Combination.affineCombination_mem_convexHull`:\nState 0: \u22a2 theorem affineCombination_mem_convexHull {s : Finset \u03b9} {v : \u03b9 \u2192 E} {w : \u03b9 \u2192 R}\n (hw\u2080 : \u2200 i \u2208 s, 0 \u2264 w i) (hw\u2081 : s.sum w = 1) :\n s.affineCombination R v w \u2208 convexHull R (range v)\nTactic: rw [affineCombination_eq_centerMass hw\u2081]\nState 1: \u22a2 \nTactic: apply s.centerMass_mem_convexHull hw\u2080 \u00b7 simp [hw\u2081] \u00b7 simp /-- The centroid can be regarded as a center of mass. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Convex/Combination.lean", "module": "Mathlib.Analysis.Convex.Combination", "declaration": "Mathlib.Analysis.Convex.Combination.affineCombination_mem_convexHull", "span": "L283-L291", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Combination.lean#L283"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 335, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1070, "lean_code_chars": 0, "natural_language_chars": 1070, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 124, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "4b1396367cd289b6", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.GroupTheory.PushoutI.ext_smul", "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.GroupTheory.PushoutI)."}, {"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.GroupTheory.PushoutI.ext_smul`:\nState 0: \u22a2 theorem ext_smul {w\u2081 w\u2082 : NormalWord d} (i : \u03b9)\n (h : CoprodI.of (\u03c6 i w\u2081.head) \u2022 w\u2081.toWord =\n CoprodI.of (\u03c6 i w\u2082.head) \u2022 w\u2082.toWord) :\n w\u2081 = w\u2082\nTactic: rw [smul_eq_iff_eq_inv_smul, \u2190 mul_smul] at h subst h\nState 1: \u22a2 \nTactic: simp only [\u2190 map_inv, \u2190 map_mul] at hw\u2081\nState 2: \u22a2 \nTactic: have : h\u2081\u207b\u00b9 * h\u2082 = 1 := eq_one_of_smul_normalized w\u2082 (h\u2081\u207b\u00b9 * h\u2082) hw\u2082 hw\u2081\nState 3: \u22a2 \nTactic: rw [inv_mul_eq_one] at this; subst this\nState 4: \u22a2 \nTactic: simp /-- Given a pair `(head, tail)`, we can form a word by prepending `head` to `tail`, but putting head into normal form first, by making sure it is expressed as an element of the base group multiplied by an element of the transversal. -/ noncomputable def rcons (i : \u03b9) (p : Pair d i) : NormalWord d := letI n := (d.compl i).equiv p.head let w := (Word.equivPair i).symm { p.toPair with head := n.2 } { toWord := w head := (MonoidHom.ofInjective (d.injective i)).symm n.1 normalized := fun i g hg => by dsimp [w] at hg\nState 5: \u22a2 \nTactic: rw [Word.equivPair_symm, Word.mem_rcons_iff] at hg rcases hg with hg | \u27e8_, rfl, rfl\u27e9 \u00b7 exact p.normalized _ _ hg \u00b7 simp }\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.GroupTheory.PushoutI).[/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.GroupTheory.PushoutI.ext_smul`:\nState 0: \u22a2 theorem ext_smul {w\u2081 w\u2082 : NormalWord d} (i : \u03b9)\n (h : CoprodI.of (\u03c6 i w\u2081.head) \u2022 w\u2081.toWord =\n CoprodI.of (\u03c6 i w\u2082.head) \u2022 w\u2082.toWord) :\n w\u2081 = w\u2082\nTactic: rw [smul_eq_iff_eq_inv_smul, \u2190 mul_smul] at h subst h\nState 1: \u22a2 \nTactic: simp only [\u2190 map_inv, \u2190 map_mul] at hw\u2081\nState 2: \u22a2 \nTactic: have : h\u2081\u207b\u00b9 * h\u2082 = 1 := eq_one_of_smul_normalized w\u2082 (h\u2081\u207b\u00b9 * h\u2082) hw\u2082 hw\u2081\nState 3: \u22a2 \nTactic: rw [inv_mul_eq_one] at this; subst this\nState 4: \u22a2 \nTactic: simp /-- Given a pair `(head, tail)`, we can form a word by prepending `head` to `tail`, but putting head into normal form first, by making sure it is expressed as an element of the base group multiplied by an element of the transversal. -/ noncomputable def rcons (i : \u03b9) (p : Pair d i) : NormalWord d := letI n := (d.compl i).equiv p.head let w := (Word.equivPair i).symm { p.toPair with head := n.2 } { toWord := w head := (MonoidHom.ofInjective (d.injective i)).symm n.1 normalized := fun i g hg => by dsimp [w] at hg\nState 5: \u22a2 \nTactic: rw [Word.equivPair_symm, Word.mem_rcons_iff] at hg rcases hg with hg | \u27e8_, rfl, rfl\u27e9 \u00b7 exact p.normalized _ _ hg \u00b7 simp }\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/PushoutI.lean", "module": "Mathlib.GroupTheory.PushoutI", "declaration": "Mathlib.GroupTheory.PushoutI.ext_smul", "span": "L377-L405", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/PushoutI.lean#L377"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 724, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2000, "lean_code_chars": 0, "natural_language_chars": 2000, "lean_code_ratio": 0.0, "line_count": 22, "imports_count": 0, "declarations_count": 275, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "b6aafa8e90bd5462", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.GradedAlgebra.Homogeneous.Submodule.HomogeneousSubmodule", "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.RingTheory.GradedAlgebra.Homogeneous.Submodule)."}, {"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.RingTheory.GradedAlgebra.Homogeneous.Submodule.HomogeneousSubmodule`:\nState 0: \u22a2 theorem HomogeneousSubmodule.ext' {I J : HomogeneousSubmodule \ud835\udc9c \u2133}\n (h : \u2200 i, \u2200 x \u2208 \u2133 i, x \u2208 I \u2194 x \u2208 J) :\n I = J\nTactic: ext\nState 1: \u22a2 \nTactic: rw [I.isHomogeneous.mem_iff, J.isHomogeneous.mem_iff]\nState 2: \u22a2 \nTactic: apply forall_congr'\nState 3: \u22a2 \nTactic: exact fun i \u21a6 h i _ (decompose \u2133 _ i).2\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.RingTheory.GradedAlgebra.Homogeneous.Submodule).[/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.RingTheory.GradedAlgebra.Homogeneous.Submodule.HomogeneousSubmodule`:\nState 0: \u22a2 theorem HomogeneousSubmodule.ext' {I J : HomogeneousSubmodule \ud835\udc9c \u2133}\n (h : \u2200 i, \u2200 x \u2208 \u2133 i, x \u2208 I \u2194 x \u2208 J) :\n I = J\nTactic: ext\nState 1: \u22a2 \nTactic: rw [I.isHomogeneous.mem_iff, J.isHomogeneous.mem_iff]\nState 2: \u22a2 \nTactic: apply forall_congr'\nState 3: \u22a2 \nTactic: exact fun i \u21a6 h i _ (decompose \u2133 _ i).2\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/GradedAlgebra/Homogeneous/Submodule.lean", "module": "Mathlib.RingTheory.GradedAlgebra.Homogeneous.Submodule", "declaration": "Mathlib.RingTheory.GradedAlgebra.Homogeneous.Submodule.HomogeneousSubmodule", "span": "L117-L124", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Submodule.lean#L117"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 349, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1089, "lean_code_chars": 0, "natural_language_chars": 1089, "lean_code_ratio": 0.0, "line_count": 17, "imports_count": 0, "declarations_count": 122, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "95250667f897475a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.LinearAlgebra.AffineSpace.Matrix.affineIndependent_of_toMatrix_right_inv", "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.LinearAlgebra.AffineSpace.Matrix)."}, {"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.LinearAlgebra.AffineSpace.Matrix.affineIndependent_of_toMatrix_right_inv`:\nState 0: \u22a2 theorem affineIndependent_of_toMatrix_right_inv [Fintype \u03b9] [Finite \u03b9'] [DecidableEq \u03b9']\n (p : \u03b9' \u2192 P) {A : Matrix \u03b9 \u03b9' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p\nTactic: cases nonempty_fintype \u03b9'\nState 1: \u22a2 \nTactic: rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq]\nState 2: \u22a2 \nTactic: intro w\u2081 w\u2082 hw\u2081 hw\u2082 hweq\nState 3: \u22a2 \nTactic: have hweq' : w\u2081 \u1d65* b.toMatrix p = w\u2082 \u1d65* b.toMatrix p := by\nState 4: \u22a2 \nTactic: ext j change (\u2211 i, w\u2081 i \u2022 b.coord j (p i)) = \u2211 i, w\u2082 i \u2022 b.coord j (p i)\nState 5: \u22a2 \nTactic: rw [\u2190 Finset.univ.affineCombination_eq_linear_combination _ _ hw\u2081, \u2190 Finset.univ.affineCombination_eq_linear_combination _ _ hw\u2082, \u2190 Function.comp_def (b.coord j) p, \u2190 Finset.univ.map_affineCombination p w\u2081 hw\u2081, \u2190 Finset.univ.map_affineCombination p w\u2082 hw\u2082, hweq] replace hweq' := congr_arg (fun w => w \u1d65* A) hweq'\nState 6: \u22a2 \nTactic: simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq' /-- Given a family of points `p : \u03b9' \u2192 P` and an affine basis `b`, if the matrix whose rows are the coordinates of `p` with respect `b` has a left inverse, then `p` spans the entire space. -/\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.LinearAlgebra.AffineSpace.Matrix).[/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.LinearAlgebra.AffineSpace.Matrix.affineIndependent_of_toMatrix_right_inv`:\nState 0: \u22a2 theorem affineIndependent_of_toMatrix_right_inv [Fintype \u03b9] [Finite \u03b9'] [DecidableEq \u03b9']\n (p : \u03b9' \u2192 P) {A : Matrix \u03b9 \u03b9' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p\nTactic: cases nonempty_fintype \u03b9'\nState 1: \u22a2 \nTactic: rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq]\nState 2: \u22a2 \nTactic: intro w\u2081 w\u2082 hw\u2081 hw\u2082 hweq\nState 3: \u22a2 \nTactic: have hweq' : w\u2081 \u1d65* b.toMatrix p = w\u2082 \u1d65* b.toMatrix p := by\nState 4: \u22a2 \nTactic: ext j change (\u2211 i, w\u2081 i \u2022 b.coord j (p i)) = \u2211 i, w\u2082 i \u2022 b.coord j (p i)\nState 5: \u22a2 \nTactic: rw [\u2190 Finset.univ.affineCombination_eq_linear_combination _ _ hw\u2081, \u2190 Finset.univ.affineCombination_eq_linear_combination _ _ hw\u2082, \u2190 Function.comp_def (b.coord j) p, \u2190 Finset.univ.map_affineCombination p w\u2081 hw\u2081, \u2190 Finset.univ.map_affineCombination p w\u2082 hw\u2082, hweq] replace hweq' := congr_arg (fun w => w \u1d65* A) hweq'\nState 6: \u22a2 \nTactic: simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq' /-- Given a family of points `p : \u03b9' \u2192 P` and an affine basis `b`, if the matrix whose rows are the coordinates of `p` with respect `b` has a left inverse, then `p` spans the entire space. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/AffineSpace/Matrix.lean", "module": "Mathlib.LinearAlgebra.AffineSpace.Matrix", "declaration": "Mathlib.LinearAlgebra.AffineSpace.Matrix.affineIndependent_of_toMatrix_right_inv", "span": "L59-L75", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/Matrix.lean#L59"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 745, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 2111, "lean_code_chars": 0, "natural_language_chars": 2111, "lean_code_ratio": 0.0, "line_count": 22, "imports_count": 0, "declarations_count": 249, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "6302f18ca5383e7b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.Padics.PadicVal.Basic.padicValNat_factorial_mul_add", "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.NumberTheory.Padics.PadicVal.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.NumberTheory.Padics.PadicVal.Basic.padicValNat_factorial_mul_add`:\nState 0: \u22a2 theorem padicValNat_factorial_mul_add {n : \u2115} (m : \u2115) [hp : Fact p.Prime] (h : n < p) :\n padicValNat p (p * m + n)! = padicValNat p (p * m)!\nTactic: induction n with | zero => rw [add_zero] | succ n hn =>\nState 1: \u22a2 \nTactic: rw [add_succ, factorial_succ, padicValNat.mul (succ_ne_zero (p * m + n)) <| factorial_ne_zero (p * m + _), hn <| lt_of_succ_lt h, \u2190 add_succ, padicValNat_eq_zero_of_mem_Ioo \u27e8(Nat.lt_add_of_pos_right <| succ_pos n), (Nat.mul_add _ _ _\u25b8 Nat.mul_one _ \u25b8 ((add_lt_add_iff_left (p * m)).mpr h))\u27e9, zero_add] /-- The `p`-adic valuation of `n!` is equal to the `p`-adic valuation of the factorial of the largest multiple of `p` below `n`, i.e. `(p * \u230an / p\u230b)!`. -/\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.NumberTheory.Padics.PadicVal.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.NumberTheory.Padics.PadicVal.Basic.padicValNat_factorial_mul_add`:\nState 0: \u22a2 theorem padicValNat_factorial_mul_add {n : \u2115} (m : \u2115) [hp : Fact p.Prime] (h : n < p) :\n padicValNat p (p * m + n)! = padicValNat p (p * m)!\nTactic: induction n with | zero => rw [add_zero] | succ n hn =>\nState 1: \u22a2 \nTactic: rw [add_succ, factorial_succ, padicValNat.mul (succ_ne_zero (p * m + n)) <| factorial_ne_zero (p * m + _), hn <| lt_of_succ_lt h, \u2190 add_succ, padicValNat_eq_zero_of_mem_Ioo \u27e8(Nat.lt_add_of_pos_right <| succ_pos n), (Nat.mul_add _ _ _\u25b8 Nat.mul_one _ \u25b8 ((add_lt_add_iff_left (p * m)).mpr h))\u27e9, zero_add] /-- The `p`-adic valuation of `n!` is equal to the `p`-adic valuation of the factorial of the largest multiple of `p` below `n`, i.e. `(p * \u230an / p\u230b)!`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/Padics/PadicVal/Basic.lean", "module": "Mathlib.NumberTheory.Padics.PadicVal.Basic", "declaration": "Mathlib.NumberTheory.Padics.PadicVal.Basic.padicValNat_factorial_mul_add", "span": "L543-L556", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Padics/PadicVal/Basic.lean#L543"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 471, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1378, "lean_code_chars": 0, "natural_language_chars": 1378, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 169, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2f8f0755e663d74d", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Algebra.Algebra.Subalgebra.Unitization.unitization_range", "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.Algebra.Algebra.Subalgebra.Unitization)."}, {"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.Algebra.Algebra.Subalgebra.Unitization.unitization_range`:\nState 0: \u22a2 theorem unitization_range :\n (unitization s).range = subalgebraOfSubsemiring (.closure s)\nTactic: have := AddSubmonoidClass.nsmulMemClass (S := S)\nState 1: \u22a2 \nTactic: rw [unitization, NonUnitalSubalgebra.unitization_range (hSRA := this), Algebra.adjoin_nat] end NonUnitalSubsemiring /-! ## Subrings -/ namespace NonUnitalSubring variable {R S : Type*} [Ring R] [SetLike S R] [hSR : NonUnitalSubringClass S R] (s : S) /-- The natural `\u2124`-algebra homomorphism from the unitization of a non-unital subring to its `Subring.closure`. -/\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.Algebra.Algebra.Subalgebra.Unitization).[/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.Algebra.Algebra.Subalgebra.Unitization.unitization_range`:\nState 0: \u22a2 theorem unitization_range :\n (unitization s).range = subalgebraOfSubsemiring (.closure s)\nTactic: have := AddSubmonoidClass.nsmulMemClass (S := S)\nState 1: \u22a2 \nTactic: rw [unitization, NonUnitalSubalgebra.unitization_range (hSRA := this), Algebra.adjoin_nat] end NonUnitalSubsemiring /-! ## Subrings -/ namespace NonUnitalSubring variable {R S : Type*} [Ring R] [SetLike S R] [hSR : NonUnitalSubringClass S R] (s : S) /-- The natural `\u2124`-algebra homomorphism from the unitization of a non-unital subring to its `Subring.closure`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Algebra/Algebra/Subalgebra/Unitization.lean", "module": "Mathlib.Algebra.Algebra.Subalgebra.Unitization", "declaration": "Mathlib.Algebra.Algebra.Subalgebra.Unitization.unitization_range", "span": "L169-L183", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/Subalgebra/Unitization.lean#L169"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 365, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1253, "lean_code_chars": 0, "natural_language_chars": 1253, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 135, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "545dfd4cd4be20b8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Data.QPF.Multivariate.Constructions.Fix.recF_eq_of_wEquiv", "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.Data.QPF.Multivariate.Constructions.Fix)."}, {"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.Data.QPF.Multivariate.Constructions.Fix.recF_eq_of_wEquiv`:\nState 0: \u22a2 theorem recF_eq_of_wEquiv (\u03b1 : TypeVec n) {\u03b2 : Type u} (u : F (\u03b1.append1 \u03b2) \u2192 \u03b2) (x y : q.P.W \u03b1) :\n WEquiv x y \u2192 recF u x = recF u y\nTactic: induction x using q.P.wCases case ih a\u2080 f'\u2080 f\u2080 =>\nState 1: \u22a2 \nTactic: induction y using q.P.wCases case ih a\u2081 f'\u2081 f\u2081 =>\nState 2: \u22a2 \nTactic: intro h -- Porting note: induction on h doesn't work.\nState 3: \u22a2 \nTactic: refine @WEquiv.recOn _ _ _ _ (fun a a' _ \u21a6 recF u a = recF u a') _ _ h ?_ ?_ ?_ \u00b7 intro a f' f\u2080 f\u2081 _h ih; simp only [recF_eq] congr 4; funext; apply ih \u00b7 intro a\u2080 f'\u2080 f\u2080 a\u2081 f'\u2081 f\u2081 h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h] \u00b7 intro x y z _e\u2081 _e\u2082 ih\u2081 ih\u2082; exact Eq.trans ih\u2081 ih\u2082\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.Data.QPF.Multivariate.Constructions.Fix).[/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.Data.QPF.Multivariate.Constructions.Fix.recF_eq_of_wEquiv`:\nState 0: \u22a2 theorem recF_eq_of_wEquiv (\u03b1 : TypeVec n) {\u03b2 : Type u} (u : F (\u03b1.append1 \u03b2) \u2192 \u03b2) (x y : q.P.W \u03b1) :\n WEquiv x y \u2192 recF u x = recF u y\nTactic: induction x using q.P.wCases case ih a\u2080 f'\u2080 f\u2080 =>\nState 1: \u22a2 \nTactic: induction y using q.P.wCases case ih a\u2081 f'\u2081 f\u2081 =>\nState 2: \u22a2 \nTactic: intro h -- Porting note: induction on h doesn't work.\nState 3: \u22a2 \nTactic: refine @WEquiv.recOn _ _ _ _ (fun a a' _ \u21a6 recF u a = recF u a') _ _ h ?_ ?_ ?_ \u00b7 intro a f' f\u2080 f\u2081 _h ih; simp only [recF_eq] congr 4; funext; apply ih \u00b7 intro a\u2080 f'\u2080 f\u2080 a\u2081 f'\u2081 f\u2081 h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h] \u00b7 intro x y z _e\u2081 _e\u2082 ih\u2081 ih\u2082; exact Eq.trans ih\u2081 ih\u2082\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean", "module": "Mathlib.Data.QPF.Multivariate.Constructions.Fix", "declaration": "Mathlib.Data.QPF.Multivariate.Constructions.Fix.recF_eq_of_wEquiv", "span": "L87-L100", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean#L87"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 500, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1413, "lean_code_chars": 0, "natural_language_chars": 1413, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 206, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "948cfc44e010914a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Order.Monotone.Odd.strictMono_of_odd_strictMonoOn_nonneg", "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.Order.Monotone.Odd)."}, {"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.Order.Monotone.Odd.strictMono_of_odd_strictMonoOn_nonneg`:\nState 0: \u22a2 theorem strictMono_of_odd_strictMonoOn_nonneg {f : G \u2192 H} (h\u2081 : \u2200 x, f (-x) = -f x)\n (h\u2082 : StrictMonoOn f (Ici 0)) : StrictMono f\nTactic: refine StrictMonoOn.Iic_union_Ici (fun x hx y hy hxy => neg_lt_neg_iff.1 ?_) h\u2082\nState 1: \u22a2 neg_lt_neg_iff.1 ?_) h\u2082>\nTactic: rw [\u2190 h\u2081, \u2190 h\u2081]\nState 2: \u22a2 \nTactic: exact h\u2082 (neg_nonneg.2 hy) (neg_nonneg.2 hx) (neg_lt_neg hxy) /-- An odd function on a linear ordered additive commutative group is strictly antitone on the whole group provided that it is strictly antitone on `Set.Ici 0`. -/\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.Order.Monotone.Odd).[/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.Order.Monotone.Odd.strictMono_of_odd_strictMonoOn_nonneg`:\nState 0: \u22a2 theorem strictMono_of_odd_strictMonoOn_nonneg {f : G \u2192 H} (h\u2081 : \u2200 x, f (-x) = -f x)\n (h\u2082 : StrictMonoOn f (Ici 0)) : StrictMono f\nTactic: refine StrictMonoOn.Iic_union_Ici (fun x hx y hy hxy => neg_lt_neg_iff.1 ?_) h\u2082\nState 1: \u22a2 neg_lt_neg_iff.1 ?_) h\u2082>\nTactic: rw [\u2190 h\u2081, \u2190 h\u2081]\nState 2: \u22a2 \nTactic: exact h\u2082 (neg_nonneg.2 hy) (neg_nonneg.2 hx) (neg_lt_neg hxy) /-- An odd function on a linear ordered additive commutative group is strictly antitone on the whole group provided that it is strictly antitone on `Set.Ici 0`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/Monotone/Odd.lean", "module": "Mathlib.Order.Monotone.Odd", "declaration": "Mathlib.Order.Monotone.Odd.strictMono_of_odd_strictMonoOn_nonneg", "span": "L30-L37", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Monotone/Odd.lean#L30"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 432, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1256, "lean_code_chars": 0, "natural_language_chars": 1256, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 160, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "5eb29d0f991e97ac", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Topology.Sets.VietorisTopology.compactSpace_iff", "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.Topology.Sets.VietorisTopology)."}, {"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.Topology.Sets.VietorisTopology.compactSpace_iff`:\nState 0: \u22a2 theorem compactSpace_iff : CompactSpace (Compacts \u03b1) \u2194 CompactSpace \u03b1\nTactic: refine \u27e8fun h => \u27e8?_\u27e9, fun _ => inferInstance\u27e9\nState 1: \u22a2 \u27e8?_\u27e9, fun _ => inferInstance\u27e9>\nTactic: convert isCompact_biUnion_coe_of_isCompact (\u03b1 := \u03b1) isCompact_univ symm simp_rw [biUnion_univ, eq_univ_iff_forall, mem_iUnion]\nState 2: \u22a2 \nTactic: exact fun x => \u27e8{x}, Set.mem_singleton x\u27e9\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.Topology.Sets.VietorisTopology).[/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.Topology.Sets.VietorisTopology.compactSpace_iff`:\nState 0: \u22a2 theorem compactSpace_iff : CompactSpace (Compacts \u03b1) \u2194 CompactSpace \u03b1\nTactic: refine \u27e8fun h => \u27e8?_\u27e9, fun _ => inferInstance\u27e9\nState 1: \u22a2 \u27e8?_\u27e9, fun _ => inferInstance\u27e9>\nTactic: convert isCompact_biUnion_coe_of_isCompact (\u03b1 := \u03b1) isCompact_univ symm simp_rw [biUnion_univ, eq_univ_iff_forall, mem_iUnion]\nState 2: \u22a2 \nTactic: exact fun x => \u27e8{x}, Set.mem_singleton x\u27e9\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Sets/VietorisTopology.lean", "module": "Mathlib.Topology.Sets.VietorisTopology", "declaration": "Mathlib.Topology.Sets.VietorisTopology.compactSpace_iff", "span": "L302-L308", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Sets/VietorisTopology.lean#L302"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 339, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1108, "lean_code_chars": 0, "natural_language_chars": 1108, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 118, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "0dfa1e8d37140521", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.InnerProductSpace.Harmonic.Basic.HarmonicAt", "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.Analysis.InnerProductSpace.Harmonic.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.Analysis.InnerProductSpace.Harmonic.Basic.HarmonicAt`:\nState 0: \u22a2 theorem HarmonicAt.comp_CLM (h : HarmonicAt f x) (l : F \u2192L[\u211d] G) :\n HarmonicAt (l \u2218 f) x\nTactic: constructor \u00b7 exact h.1.continuousLinearMap_comp l \u00b7 filter_upwards [h.1.laplacian_CLM_comp_left_nhds (l := l), h.2]\nState 1: \u22a2 \nTactic: simp_all /-- Compositions of continuous linear maps with harmonic functions are harmonic. -/\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.Analysis.InnerProductSpace.Harmonic.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.Analysis.InnerProductSpace.Harmonic.Basic.HarmonicAt`:\nState 0: \u22a2 theorem HarmonicAt.comp_CLM (h : HarmonicAt f x) (l : F \u2192L[\u211d] G) :\n HarmonicAt (l \u2218 f) x\nTactic: constructor \u00b7 exact h.1.continuousLinearMap_comp l \u00b7 filter_upwards [h.1.laplacian_CLM_comp_left_nhds (l := l), h.2]\nState 1: \u22a2 \nTactic: simp_all /-- Compositions of continuous linear maps with harmonic functions are harmonic. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/InnerProductSpace/Harmonic/Basic.lean", "module": "Mathlib.Analysis.InnerProductSpace.Harmonic.Basic", "declaration": "Mathlib.Analysis.InnerProductSpace.Harmonic.Basic.HarmonicAt", "span": "L182-L191", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/Harmonic/Basic.lean#L182"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 296, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1009, "lean_code_chars": 0, "natural_language_chars": 1009, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 113, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ea20262da2ff6c5b", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.IntegralClosure.IntegralRestrict.galLift", "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.RingTheory.IntegralClosure.IntegralRestrict)."}, {"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.RingTheory.IntegralClosure.IntegralRestrict.galLift`:\nState 0: \u22a2 def galLift (\u03c3 : B \u2192\u2090[A] B\u2082) : L \u2192\u2090[K] L\u2082\nTactic: simpa only [RingHom.coe_comp, RingHom.coe_coe, Function.comp_apply, AlgHom.commutes, isUnit_iff_ne_zero, ne_eq, map_eq_zero_iff _ (FaithfulSMul.algebraMap_injective _ _), \u2190 IsScalarTower.algebraMap_apply] using nonZeroDivisors.ne_zero hx haveI H_eq : (IsLocalization.lift (S := L) H).comp (algebraMap K L) = (algebraMap K L\u2082) := by\nState 1: \u22a2 \nTactic: apply IsLocalization.ringHom_ext A\u2070\nState 2: \u22a2 \nTactic: ext\nState 3: \u22a2 \nTactic: simp only [RingHom.coe_comp, Function.comp_apply, \u2190 IsScalarTower.algebraMap_apply A K L, \u2190 IsScalarTower.algebraMap_apply A K L\u2082, IsScalarTower.algebraMap_apply A B L, IsScalarTower.algebraMap_apply A B\u2082 L\u2082, IsLocalization.lift_eq, RingHom.coe_coe, AlgHom.commutes] { IsLocalization.lift (S := L) H with commutes' := DFunLike.congr_fun H_eq } omit [IsIntegralClosure B\u2082 A L\u2082] in\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.RingTheory.IntegralClosure.IntegralRestrict).[/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.RingTheory.IntegralClosure.IntegralRestrict.galLift`:\nState 0: \u22a2 def galLift (\u03c3 : B \u2192\u2090[A] B\u2082) : L \u2192\u2090[K] L\u2082\nTactic: simpa only [RingHom.coe_comp, RingHom.coe_coe, Function.comp_apply, AlgHom.commutes, isUnit_iff_ne_zero, ne_eq, map_eq_zero_iff _ (FaithfulSMul.algebraMap_injective _ _), \u2190 IsScalarTower.algebraMap_apply] using nonZeroDivisors.ne_zero hx haveI H_eq : (IsLocalization.lift (S := L) H).comp (algebraMap K L) = (algebraMap K L\u2082) := by\nState 1: \u22a2 \nTactic: apply IsLocalization.ringHom_ext A\u2070\nState 2: \u22a2 \nTactic: ext\nState 3: \u22a2 \nTactic: simp only [RingHom.coe_comp, Function.comp_apply, \u2190 IsScalarTower.algebraMap_apply A K L, \u2190 IsScalarTower.algebraMap_apply A K L\u2082, IsScalarTower.algebraMap_apply A B L, IsScalarTower.algebraMap_apply A B\u2082 L\u2082, IsLocalization.lift_eq, RingHom.coe_coe, AlgHom.commutes] { IsLocalization.lift (S := L) H with commutes' := DFunLike.congr_fun H_eq } omit [IsIntegralClosure B\u2082 A L\u2082] in\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/IntegralClosure/IntegralRestrict.lean", "module": "Mathlib.RingTheory.IntegralClosure.IntegralRestrict", "declaration": "Mathlib.RingTheory.IntegralClosure.IntegralRestrict.galLift", "span": "L87-L106", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/IntegralClosure/IntegralRestrict.lean#L87"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 562, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1682, "lean_code_chars": 0, "natural_language_chars": 1682, "lean_code_ratio": 0.0, "line_count": 15, "imports_count": 0, "declarations_count": 176, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "043194353758a0d9", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.SpecialFunctions.Complex.Arg.arg_eq_zero_iff", "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.Analysis.SpecialFunctions.Complex.Arg)."}, {"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.Analysis.SpecialFunctions.Complex.Arg.arg_eq_zero_iff`:\nState 0: \u22a2 theorem arg_eq_zero_iff {z : \u2102} : arg z = 0 \u2194 0 \u2264 z.re \u2227 z.im = 0\nTactic: refine \u27e8fun h => ?_, ?_\u27e9 \u00b7 rw [\u2190 norm_mul_cos_add_sin_mul_I z, h]\nState 1: \u22a2 ?_, ?_\u27e9>\nTactic: simp [norm_nonneg] \u00b7 obtain \u27e8x, y\u27e9 := z rintro \u27e8h, rfl : y = 0\u27e9\nState 2: \u22a2 \nTactic: exact arg_ofReal_of_nonneg h open ComplexOrder in\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.Analysis.SpecialFunctions.Complex.Arg).[/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.Analysis.SpecialFunctions.Complex.Arg.arg_eq_zero_iff`:\nState 0: \u22a2 theorem arg_eq_zero_iff {z : \u2102} : arg z = 0 \u2194 0 \u2264 z.re \u2227 z.im = 0\nTactic: refine \u27e8fun h => ?_, ?_\u27e9 \u00b7 rw [\u2190 norm_mul_cos_add_sin_mul_I z, h]\nState 1: \u22a2 ?_, ?_\u27e9>\nTactic: simp [norm_nonneg] \u00b7 obtain \u27e8x, y\u27e9 := z rintro \u27e8h, rfl : y = 0\u27e9\nState 2: \u22a2 \nTactic: exact arg_ofReal_of_nonneg h open ComplexOrder in\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean", "module": "Mathlib.Analysis.SpecialFunctions.Complex.Arg", "declaration": "Mathlib.Analysis.SpecialFunctions.Complex.Arg.arg_eq_zero_iff", "span": "L226-L234", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean#L226"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 338, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1013, "lean_code_chars": 0, "natural_language_chars": 1013, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 121, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "b19e54574416435f", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.MvPowerSeries.Order.coeff_mul_left_one_sub_of_lt_order", "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.RingTheory.MvPowerSeries.Order)."}, {"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.RingTheory.MvPowerSeries.Order.coeff_mul_left_one_sub_of_lt_order`:\nState 0: \u22a2 theorem coeff_mul_left_one_sub_of_lt_order (d : \u03c3 \u2192\u2080 \u2115) (h : degree d < g.order) :\n coeff d (f * (1 - g)) = coeff d f\nTactic: rw [degree_eq_weight_one] at h\nState 1: \u22a2 \nTactic: exact coeff_mul_left_one_sub_of_lt_weightedOrder _ h\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.RingTheory.MvPowerSeries.Order).[/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.RingTheory.MvPowerSeries.Order.coeff_mul_left_one_sub_of_lt_order`:\nState 0: \u22a2 theorem coeff_mul_left_one_sub_of_lt_order (d : \u03c3 \u2192\u2080 \u2115) (h : degree d < g.order) :\n coeff d (f * (1 - g)) = coeff d f\nTactic: rw [degree_eq_weight_one] at h\nState 1: \u22a2 \nTactic: exact coeff_mul_left_one_sub_of_lt_weightedOrder _ h\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/MvPowerSeries/Order.lean", "module": "Mathlib.RingTheory.MvPowerSeries.Order", "declaration": "Mathlib.RingTheory.MvPowerSeries.Order.coeff_mul_left_one_sub_of_lt_order", "span": "L516-L520", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPowerSeries/Order.lean#L516"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 278, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 928, "lean_code_chars": 0, "natural_language_chars": 928, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 104, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "c26e9809e911d63c", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.ModularForms.EisensteinSeries.Summable.auxbound2", "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.NumberTheory.ModularForms.EisensteinSeries.Summable)."}, {"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.NumberTheory.ModularForms.EisensteinSeries.Summable.auxbound2`:\nState 0: \u22a2 lemma auxbound2 (c : \u211d) {d : \u211d} (hd : 1 \u2264 d ^ 2) : r z \u2264 \u2016c * (z : \u2102) + d\u2016\nTactic: have H1 : \u221a(r1 z) \u2264 \u221a((c * z.re + d) ^ 2 + (c * z.im) ^ 2) := (Real.sqrt_le_sqrt_iff (by positivity)).mpr (r1_aux_bound _ _ hd)\nState 1: \u22a2 \nTactic: simpa only [r, norm_def, normSq_apply, add_re, re_ofReal_mul, coe_re, ofReal_re, \u2190 pow_two, add_im, im_ofReal_mul, coe_im, ofReal_im, add_zero, min_le_iff] using Or.inr H1\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.NumberTheory.ModularForms.EisensteinSeries.Summable).[/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.NumberTheory.ModularForms.EisensteinSeries.Summable.auxbound2`:\nState 0: \u22a2 lemma auxbound2 (c : \u211d) {d : \u211d} (hd : 1 \u2264 d ^ 2) : r z \u2264 \u2016c * (z : \u2102) + d\u2016\nTactic: have H1 : \u221a(r1 z) \u2264 \u221a((c * z.re + d) ^ 2 + (c * z.im) ^ 2) := (Real.sqrt_le_sqrt_iff (by positivity)).mpr (r1_aux_bound _ _ hd)\nState 1: \u22a2 \nTactic: simpa only [r, norm_def, normSq_apply, add_re, re_ofReal_mul, coe_re, ofReal_re, \u2190 pow_two, add_im, im_ofReal_mul, coe_im, ofReal_im, add_zero, min_le_iff] using Or.inr H1\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/ModularForms/EisensteinSeries/Summable.lean", "module": "Mathlib.NumberTheory.ModularForms.EisensteinSeries.Summable", "declaration": "Mathlib.NumberTheory.ModularForms.EisensteinSeries.Summable.auxbound2", "span": "L111-L116", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/ModularForms/EisensteinSeries/Summable.lean#L111"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 404, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1148, "lean_code_chars": 0, "natural_language_chars": 1148, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 134, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "15cd743239229b6a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Topology.OpenPartialHomeomorph.Continuity.eventually_nhds'", "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.Topology.OpenPartialHomeomorph.Continuity)."}, {"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.Topology.OpenPartialHomeomorph.Continuity.eventually_nhds'`:\nState 0: \u22a2 theorem eventually_nhds' {x : X} (p : X \u2192 Prop) (hx : x \u2208 e.source) :\n (\u2200\u1da0 y in \ud835\udcdd (e x), p (e.symm y)) \u2194 \u2200\u1da0 x in \ud835\udcdd x, p x\nTactic: rw [e.eventually_nhds _ hx]\nState 1: \u22a2 \nTactic: refine eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => ?_)\nState 2: \u22a2 ?_)>\nTactic: rw [hy]\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.Topology.OpenPartialHomeomorph.Continuity).[/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.Topology.OpenPartialHomeomorph.Continuity.eventually_nhds'`:\nState 0: \u22a2 theorem eventually_nhds' {x : X} (p : X \u2192 Prop) (hx : x \u2208 e.source) :\n (\u2200\u1da0 y in \ud835\udcdd (e x), p (e.symm y)) \u2194 \u2200\u1da0 x in \ud835\udcdd x, p x\nTactic: rw [e.eventually_nhds _ hx]\nState 1: \u22a2 \nTactic: refine eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => ?_)\nState 2: \u22a2 ?_)>\nTactic: rw [hy]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/OpenPartialHomeomorph/Continuity.lean", "module": "Mathlib.Topology.OpenPartialHomeomorph.Continuity", "declaration": "Mathlib.Topology.OpenPartialHomeomorph.Continuity.eventually_nhds'", "span": "L102-L107", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/OpenPartialHomeomorph/Continuity.lean#L102"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 343, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1071, "lean_code_chars": 0, "natural_language_chars": 1071, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 132, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "f8cba94f189a53ad", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Combinatorics.Enumerative.DyckWord.count_D_lt_count_U_of_lt_firstReturn", "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.Combinatorics.Enumerative.DyckWord)."}, {"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.Combinatorics.Enumerative.DyckWord.count_D_lt_count_U_of_lt_firstReturn`:\nState 0: \u22a2 lemma count_D_lt_count_U_of_lt_firstReturn {i : \u2115} (hi : i < p.firstReturn) :\n (p.toList.take (i + 1)).count D < (p.toList.take (i + 1)).count U\nTactic: have ne := not_of_lt_findIdx hi\nState 1: \u22a2 \nTactic: rw [decide_eq_false_iff_not, \u2190 ne_eq, getElem_range] at ne\nState 2: \u22a2 \nTactic: exact lt_of_le_of_ne (p.count_D_le_count_U (i + 1)) ne.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.Combinatorics.Enumerative.DyckWord).[/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.Combinatorics.Enumerative.DyckWord.count_D_lt_count_U_of_lt_firstReturn`:\nState 0: \u22a2 lemma count_D_lt_count_U_of_lt_firstReturn {i : \u2115} (hi : i < p.firstReturn) :\n (p.toList.take (i + 1)).count D < (p.toList.take (i + 1)).count U\nTactic: have ne := not_of_lt_findIdx hi\nState 1: \u22a2 \nTactic: rw [decide_eq_false_iff_not, \u2190 ne_eq, getElem_range] at ne\nState 2: \u22a2 \nTactic: exact lt_of_le_of_ne (p.count_D_le_count_U (i + 1)) ne.symm\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/Enumerative/DyckWord.lean", "module": "Mathlib.Combinatorics.Enumerative.DyckWord", "declaration": "Mathlib.Combinatorics.Enumerative.DyckWord.count_D_lt_count_U_of_lt_firstReturn", "span": "L288-L293", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/Enumerative/DyckWord.lean#L288"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 357, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1124, "lean_code_chars": 0, "natural_language_chars": 1124, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 121, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "805d7005d3fb3b5a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.LinearAlgebra.Matrix.PosDef.conjTranspose_mul_mul_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.LinearAlgebra.Matrix.PosDef)."}, {"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.LinearAlgebra.Matrix.PosDef.conjTranspose_mul_mul_same`:\nState 0: \u22a2 lemma conjTranspose_mul_mul_same {A : Matrix n n R} {B : Matrix n m R} (hA : A.PosDef)\n (hB : Function.Injective B.mulVec) :\n (B\u1d34 * A * B).PosDef\nTactic: refine of_dotProduct_mulVec_pos (isHermitian_conjTranspose_mul_mul _ hA.1) fun x hx => ?_\nState 1: \u22a2 ?_>\nTactic: have : B *\u1d65 x \u2260 0 := fun h => hx <| hB.eq_iff' (mulVec_zero _) |>.1 h\nState 2: \u22a2 hx <| hB.eq_iff' (mulVec_zero _) |>.1 h>\nTactic: simpa only [star_mulVec, dotProduct_mulVec, vecMul_vecMul] using hA.dotProduct_mulVec_pos this\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.LinearAlgebra.Matrix.PosDef).[/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.LinearAlgebra.Matrix.PosDef.conjTranspose_mul_mul_same`:\nState 0: \u22a2 lemma conjTranspose_mul_mul_same {A : Matrix n n R} {B : Matrix n m R} (hA : A.PosDef)\n (hB : Function.Injective B.mulVec) :\n (B\u1d34 * A * B).PosDef\nTactic: refine of_dotProduct_mulVec_pos (isHermitian_conjTranspose_mul_mul _ hA.1) fun x hx => ?_\nState 1: \u22a2 ?_>\nTactic: have : B *\u1d65 x \u2260 0 := fun h => hx <| hB.eq_iff' (mulVec_zero _) |>.1 h\nState 2: \u22a2 hx <| hB.eq_iff' (mulVec_zero _) |>.1 h>\nTactic: simpa only [star_mulVec, dotProduct_mulVec, vecMul_vecMul] using hA.dotProduct_mulVec_pos this\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/LinearAlgebra/Matrix/PosDef.lean", "module": "Mathlib.LinearAlgebra.Matrix.PosDef", "declaration": "Mathlib.LinearAlgebra.Matrix.PosDef.conjTranspose_mul_mul_same", "span": "L438-L444", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/PosDef.lean#L438"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 438, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1277, "lean_code_chars": 0, "natural_language_chars": 1277, "lean_code_ratio": 0.0, "line_count": 15, "imports_count": 0, "declarations_count": 149, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "52b156ea1de86459", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Combinatorics.SimpleGraph.Diam.ediam_le_two_mul_radius", "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.Combinatorics.SimpleGraph.Diam)."}, {"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.Combinatorics.SimpleGraph.Diam.ediam_le_two_mul_radius`:\nState 0: \u22a2 lemma ediam_le_two_mul_radius : G.ediam \u2264 2 * G.radius\nTactic: cases isEmpty_or_nonempty \u03b1 \u00b7 rw [radius_eq_top_of_isEmpty]\nState 1: \u22a2 \nTactic: exact le_top \u00b7 by_cases hdiam : G.ediam = \u22a4 \u00b7 simp [hdiam, ediam_eq_top_iff_radius_eq_top.mp hdiam] \u00b7 obtain \u27e8w, hw\u27e9 := G.exists_eccent_eq_radius\nState 2: \u22a2 \nTactic: obtain \u27e8_, _, h\u27e9 := G.exists_edist_eq_ediam_of_ne_top hdiam\nState 3: \u22a2 \nTactic: apply le_trans (h \u25b8 G.edist_triangle (v := w))\nState 4: \u22a2 \nTactic: rw [two_mul]\nState 5: \u22a2 \nTactic: exact hw \u25b8 add_le_add (G.edist_comm \u25b8 G.edist_le_eccent) G.edist_le_eccent\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.Combinatorics.SimpleGraph.Diam).[/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.Combinatorics.SimpleGraph.Diam.ediam_le_two_mul_radius`:\nState 0: \u22a2 lemma ediam_le_two_mul_radius : G.ediam \u2264 2 * G.radius\nTactic: cases isEmpty_or_nonempty \u03b1 \u00b7 rw [radius_eq_top_of_isEmpty]\nState 1: \u22a2 \nTactic: exact le_top \u00b7 by_cases hdiam : G.ediam = \u22a4 \u00b7 simp [hdiam, ediam_eq_top_iff_radius_eq_top.mp hdiam] \u00b7 obtain \u27e8w, hw\u27e9 := G.exists_eccent_eq_radius\nState 2: \u22a2 \nTactic: obtain \u27e8_, _, h\u27e9 := G.exists_edist_eq_ediam_of_ne_top hdiam\nState 3: \u22a2 \nTactic: apply le_trans (h \u25b8 G.edist_triangle (v := w))\nState 4: \u22a2 \nTactic: rw [two_mul]\nState 5: \u22a2 \nTactic: exact hw \u25b8 add_le_add (G.edist_comm \u25b8 G.edist_le_eccent) G.edist_le_eccent\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Combinatorics/SimpleGraph/Diam.lean", "module": "Mathlib.Combinatorics.SimpleGraph.Diam", "declaration": "Mathlib.Combinatorics.SimpleGraph.Diam.ediam_le_two_mul_radius", "span": "L398-L409", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/Diam.lean#L398"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 486, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1430, "lean_code_chars": 0, "natural_language_chars": 1430, "lean_code_ratio": 0.0, "line_count": 19, "imports_count": 0, "declarations_count": 153, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "797520c03f92d3db", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.Polynomial.Vieta.prod_X_add_C_eq_sum_esymm", "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.RingTheory.Polynomial.Vieta)."}, {"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.RingTheory.Polynomial.Vieta.prod_X_add_C_eq_sum_esymm`:\nState 0: \u22a2 theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) :\n (s.map fun r => X + C r).prod =\n \u2211 j \u2208 Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))\nTactic: rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, \u2190 bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]\nState 1: \u22a2 \nTactic: intro _ _\nState 2: \u22a2 \nTactic: rw [esymm, \u2190 sum_hom', \u2190 sum_map_mul_right, map_congr (Eq.refl _)]\nState 3: \u22a2 \nTactic: intro s ht\nState 4: \u22a2 \nTactic: rw [mem_powersetCard] at ht dsimp\nState 5: \u22a2 \nTactic: rw [prod_hom' s (Polynomial.C : R \u2192+* R[X])]\nState 6: \u22a2 \nTactic: simp [ht, prod_replicate, map_id', card_sub] /-- Vieta's formula for the coefficients of the product of linear terms `X + \u03bb` where `\u03bb` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/\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.RingTheory.Polynomial.Vieta).[/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.RingTheory.Polynomial.Vieta.prod_X_add_C_eq_sum_esymm`:\nState 0: \u22a2 theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) :\n (s.map fun r => X + C r).prod =\n \u2211 j \u2208 Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))\nTactic: rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, \u2190 bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]\nState 1: \u22a2 \nTactic: intro _ _\nState 2: \u22a2 \nTactic: rw [esymm, \u2190 sum_hom', \u2190 sum_map_mul_right, map_congr (Eq.refl _)]\nState 3: \u22a2 \nTactic: intro s ht\nState 4: \u22a2 \nTactic: rw [mem_powersetCard] at ht dsimp\nState 5: \u22a2 \nTactic: rw [prod_hom' s (Polynomial.C : R \u2192+* R[X])]\nState 6: \u22a2 \nTactic: simp [ht, prod_replicate, map_id', card_sub] /-- Vieta's formula for the coefficients of the product of linear terms `X + \u03bb` where `\u03bb` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/Polynomial/Vieta.lean", "module": "Mathlib.RingTheory.Polynomial.Vieta", "declaration": "Mathlib.RingTheory.Polynomial.Vieta.prod_X_add_C_eq_sum_esymm", "span": "L40-L55", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/Vieta.lean#L40"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 631, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1835, "lean_code_chars": 0, "natural_language_chars": 1835, "lean_code_ratio": 0.0, "line_count": 23, "imports_count": 0, "declarations_count": 223, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "ff33eb039c70d8da", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.PellMatiyasevic.eq_pell_lem", "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.NumberTheory.PellMatiyasevic)."}, {"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.NumberTheory.PellMatiyasevic.eq_pell_lem`:\nState 0: \u22a2 theorem eq_pell_lem : \u2200 (n) (b : \u2124\u221a(d a1)), 1 \u2264 b \u2192 IsPell b \u2192\n b \u2264 pellZd a1 n \u2192 \u2203 n, b = pellZd a1 n\n | 0, _ => fun h1 _ hl => \u27e80, le_antisymm hl h1\u27e9\n | n + 1, b => fun h1 hp h =>\n have a1p : (0 : \u2124\u221a(d a1)) \u2264 \u27e8a, 1\u27e9\nTactic: have am1p : (0 : \u2124\u221a(d a1)) \u2264 \u27e8a, -1\u27e9 := show (_ : Nat) \u2264 _ by simp [d]\nState 1: \u22a2 \nTactic: have a1m : (\u27e8a, 1\u27e9 * \u27e8a, -1\u27e9 : \u2124\u221a(d a1)) = 1 := isPell_norm.1 (isPell_one a1) if ha : (\u27e8\u2191a, 1\u27e9 : \u2124\u221a(d a1)) \u2264 b then let \u27e8m, e\u27e9 := eq_pell_lem n (b * \u27e8a, -1\u27e9) (by rw [\u2190 a1m]; exact mul_le_mul_of_nonneg_right ha am1p) (isPell_mul hp (isPell_star.1 (isPell_one a1))) (by\nState 2: \u22a2 \nTactic: have t := mul_le_mul_of_nonneg_right h am1p rwa [pellZd_succ, mul_assoc, a1m, mul_one] at t) \u27e8m + 1, by\nState 3: \u22a2 \nTactic: rw [show b = b * \u27e8a, -1\u27e9 * \u27e8a, 1\u27e9 by rw [mul_assoc, Eq.trans (mul_comm _ _) a1m]; simp, pellZd_succ, e]\u27e9 else suffices \u00ac1 < b from \u27e80, show b = 1 from (Or.resolve_left (lt_or_eq_of_le h1) this).symm\u27e9 fun h1l => by\nState 4: \u22a2 \nTactic: obtain \u27e8x, y\u27e9 := b\nState 5: \u22a2 \nTactic: exact by\nState 6: \u22a2 \nTactic: have bm : (_ * \u27e8_, _\u27e9 : \u2124\u221ad a1) = 1 := Pell.isPell_norm.1 hp\nState 7: \u22a2 \nTactic: have y0l : (0 : \u2124\u221ad a1) < \u27e8x - x, y - -y\u27e9 := sub_lt_sub h1l fun hn : (1 : \u2124\u221ad a1) \u2264 \u27e8x, -y\u27e9 => by\nState 8: \u22a2 \nTactic: have t := mul_le_mul_of_nonneg_left hn (le_trans zero_le_one h1)\nState 9: \u22a2 \nTactic: rw [bm, mul_one] at t\nState 10: \u22a2 \nTactic: exact h1l t\nState 11: \u22a2 \nTactic: have yl2 : (\u27e8_, _\u27e9 : \u2124\u221a_) < \u27e8_, _\u27e9 := show (\u27e8x, y\u27e9 - \u27e8x, -y\u27e9 : \u2124\u221ad a1) < \u27e8a, 1\u27e9 - \u27e8a, -1\u27e9 from sub_lt_sub ha fun hn : (\u27e8x, -y\u27e9 : \u2124\u221ad a1) \u2264 \u27e8a, -1\u27e9 => by\nState 12: \u22a2 \nTactic: have t := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hn (le_trans zero_le_one h1)) a1p\nState 13: \u22a2 \nTactic: rw [bm, one_mul, mul_assoc, Eq.trans (mul_comm _ _) a1m, mul_one] at t\nState 14: \u22a2 \nTactic: exact ha t\nState 15: \u22a2 \nTactic: simp only [sub_self, sub_neg_eq_add] at y0l; simp only [Zsqrtd.re_neg, add_neg_cancel, Zsqrtd.im_neg, neg_neg] at yl2\nState 16: \u22a2 \nTactic: exact match y, y0l, (yl2 : (\u27e8_, _\u27e9 : \u2124\u221a_) < \u27e8_, _\u27e9) with | 0, y0l, _ => y0l (le_refl 0) | (y + 1 : \u2115), _, yl2 => yl2 (Zsqrtd.le_of_le_le (by simp) (let t := Int.ofNat_le_ofNat_of_le (Nat.succ_pos y) add_le_add t t)) | Int.negSucc _, y0l, _ => y0l trivial set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in\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.NumberTheory.PellMatiyasevic).[/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.NumberTheory.PellMatiyasevic.eq_pell_lem`:\nState 0: \u22a2 theorem eq_pell_lem : \u2200 (n) (b : \u2124\u221a(d a1)), 1 \u2264 b \u2192 IsPell b \u2192\n b \u2264 pellZd a1 n \u2192 \u2203 n, b = pellZd a1 n\n | 0, _ => fun h1 _ hl => \u27e80, le_antisymm hl h1\u27e9\n | n + 1, b => fun h1 hp h =>\n have a1p : (0 : \u2124\u221a(d a1)) \u2264 \u27e8a, 1\u27e9\nTactic: have am1p : (0 : \u2124\u221a(d a1)) \u2264 \u27e8a, -1\u27e9 := show (_ : Nat) \u2264 _ by simp [d]\nState 1: \u22a2 \nTactic: have a1m : (\u27e8a, 1\u27e9 * \u27e8a, -1\u27e9 : \u2124\u221a(d a1)) = 1 := isPell_norm.1 (isPell_one a1) if ha : (\u27e8\u2191a, 1\u27e9 : \u2124\u221a(d a1)) \u2264 b then let \u27e8m, e\u27e9 := eq_pell_lem n (b * \u27e8a, -1\u27e9) (by rw [\u2190 a1m]; exact mul_le_mul_of_nonneg_right ha am1p) (isPell_mul hp (isPell_star.1 (isPell_one a1))) (by\nState 2: \u22a2 \nTactic: have t := mul_le_mul_of_nonneg_right h am1p rwa [pellZd_succ, mul_assoc, a1m, mul_one] at t) \u27e8m + 1, by\nState 3: \u22a2 \nTactic: rw [show b = b * \u27e8a, -1\u27e9 * \u27e8a, 1\u27e9 by rw [mul_assoc, Eq.trans (mul_comm _ _) a1m]; simp, pellZd_succ, e]\u27e9 else suffices \u00ac1 < b from \u27e80, show b = 1 from (Or.resolve_left (lt_or_eq_of_le h1) this).symm\u27e9 fun h1l => by\nState 4: \u22a2 \nTactic: obtain \u27e8x, y\u27e9 := b\nState 5: \u22a2 \nTactic: exact by\nState 6: \u22a2 \nTactic: have bm : (_ * \u27e8_, _\u27e9 : \u2124\u221ad a1) = 1 := Pell.isPell_norm.1 hp\nState 7: \u22a2 \nTactic: have y0l : (0 : \u2124\u221ad a1) < \u27e8x - x, y - -y\u27e9 := sub_lt_sub h1l fun hn : (1 : \u2124\u221ad a1) \u2264 \u27e8x, -y\u27e9 => by\nState 8: \u22a2 \nTactic: have t := mul_le_mul_of_nonneg_left hn (le_trans zero_le_one h1)\nState 9: \u22a2 \nTactic: rw [bm, mul_one] at t\nState 10: \u22a2 \nTactic: exact h1l t\nState 11: \u22a2 \nTactic: have yl2 : (\u27e8_, _\u27e9 : \u2124\u221a_) < \u27e8_, _\u27e9 := show (\u27e8x, y\u27e9 - \u27e8x, -y\u27e9 : \u2124\u221ad a1) < \u27e8a, 1\u27e9 - \u27e8a, -1\u27e9 from sub_lt_sub ha fun hn : (\u27e8x, -y\u27e9 : \u2124\u221ad a1) \u2264 \u27e8a, -1\u27e9 => by\nState 12: \u22a2 \nTactic: have t := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hn (le_trans zero_le_one h1)) a1p\nState 13: \u22a2 \nTactic: rw [bm, one_mul, mul_assoc, Eq.trans (mul_comm _ _) a1m, mul_one] at t\nState 14: \u22a2 \nTactic: exact ha t\nState 15: \u22a2 \nTactic: simp only [sub_self, sub_neg_eq_add] at y0l; simp only [Zsqrtd.re_neg, add_neg_cancel, Zsqrtd.im_neg, neg_neg] at yl2\nState 16: \u22a2 \nTactic: exact match y, y0l, (yl2 : (\u27e8_, _\u27e9 : \u2124\u221a_) < \u27e8_, _\u27e9) with | 0, y0l, _ => y0l (le_refl 0) | (y + 1 : \u2115), _, yl2 => yl2 (Zsqrtd.le_of_le_le (by simp) (let t := Int.ofNat_le_ofNat_of_le (Nat.succ_pos y) add_le_add t t)) | Int.negSucc _, y0l, _ => y0l trivial set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/PellMatiyasevic.lean", "module": "Mathlib.NumberTheory.PellMatiyasevic", "declaration": "Mathlib.NumberTheory.PellMatiyasevic.eq_pell_lem", "span": "L262-L310", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/PellMatiyasevic.lean#L262"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 1826, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 3905, "lean_code_chars": 0, "natural_language_chars": 3905, "lean_code_ratio": 0.0, "line_count": 45, "imports_count": 0, "declarations_count": 539, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "647a0c88319b3b82", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Order.InitialSeg.top_rel_top", "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.Order.InitialSeg)."}, {"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.Order.InitialSeg.top_rel_top`:\nState 0: \u22a2 theorem top_rel_top {r : \u03b1 \u2192 \u03b1 \u2192 Prop} {s : \u03b2 \u2192 \u03b2 \u2192 Prop} {t : \u03b3 \u2192 \u03b3 \u2192 Prop} [IsWellOrder \u03b3 t]\n (f : r \u227ai s) (g : s \u227ai t) (h : r \u227ai t) : t h.top g.top\nTactic: rw [Subsingleton.elim h (f.trans g)]\nState 1: \u22a2 \nTactic: apply PrincipalSeg.lt_top /-- Any element of a well order yields a principal segment. -/\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.Order.InitialSeg).[/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.Order.InitialSeg.top_rel_top`:\nState 0: \u22a2 theorem top_rel_top {r : \u03b1 \u2192 \u03b1 \u2192 Prop} {s : \u03b2 \u2192 \u03b2 \u2192 Prop} {t : \u03b3 \u2192 \u03b3 \u2192 Prop} [IsWellOrder \u03b3 t]\n (f : r \u227ai s) (g : s \u227ai t) (h : r \u227ai t) : t h.top g.top\nTactic: rw [Subsingleton.elim h (f.trans g)]\nState 1: \u22a2 \nTactic: apply PrincipalSeg.lt_top /-- Any element of a well order yields a principal segment. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Order/InitialSeg.lean", "module": "Mathlib.Order.InitialSeg", "declaration": "Mathlib.Order.InitialSeg.top_rel_top", "span": "L401-L406", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/InitialSeg.lean#L401"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 295, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 959, "lean_code_chars": 0, "natural_language_chars": 959, "lean_code_ratio": 0.0, "line_count": 12, "imports_count": 0, "declarations_count": 125, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "1e21bcb6e30a43c7", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Topology.Homotopy.HomotopyGroup.fromLoop", "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.Topology.Homotopy.HomotopyGroup)."}, {"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.Topology.Homotopy.HomotopyGroup.fromLoop`:\nState 0: \u22a2 def fromLoop (i : N) (p : \u03a9 (\u03a9^ { j // j \u2260 i } X x) const) : \u03a9^ N X x\nTactic: simp only [ContinuousMap.comp_apply, ContinuousMap.coe_coe, funSplitAt_apply, ContinuousMap.uncurry_apply, ContinuousMap.coe_mk, Function.uncurry_apply_pair]\nState 1: \u22a2 \nTactic: obtain rfl | Hne := eq_or_ne j i \u00b7 rcases Hj with Hj | Hj <;> simp only [Hj, p.coe_toContinuousMap, p.source, p.target] <;> rfl \u00b7 exact GenLoop.boundary _ _ \u27e8\u27e8j, Hne\u27e9, Hj\u27e9\u27e9\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.Topology.Homotopy.HomotopyGroup).[/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.Topology.Homotopy.HomotopyGroup.fromLoop`:\nState 0: \u22a2 def fromLoop (i : N) (p : \u03a9 (\u03a9^ { j // j \u2260 i } X x) const) : \u03a9^ N X x\nTactic: simp only [ContinuousMap.comp_apply, ContinuousMap.coe_coe, funSplitAt_apply, ContinuousMap.uncurry_apply, ContinuousMap.coe_mk, Function.uncurry_apply_pair]\nState 1: \u22a2 \nTactic: obtain rfl | Hne := eq_or_ne j i \u00b7 rcases Hj with Hj | Hj <;> simp only [Hj, p.coe_toContinuousMap, p.source, p.target] <;> rfl \u00b7 exact GenLoop.boundary _ _ \u27e8\u27e8j, Hne\u27e9, Hj\u27e9\u27e9\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Topology/Homotopy/HomotopyGroup.lean", "module": "Mathlib.Topology.Homotopy.HomotopyGroup", "declaration": "Mathlib.Topology.Homotopy.HomotopyGroup.fromLoop", "span": "L285-L296", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Homotopy/HomotopyGroup.lean#L285"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 367, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1133, "lean_code_chars": 0, "natural_language_chars": 1133, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 129, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "e7f40228c957d603", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.Normed.Ring.Units.closure_ne_top", "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.Analysis.Normed.Ring.Units)."}, {"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.Analysis.Normed.Ring.Units.closure_ne_top`:\nState 0: \u22a2 theorem closure_ne_top (I : Ideal R) (hI : I \u2260 \u22a4) : I.closure \u2260 \u22a4\nTactic: have h := closure_minimal (coe_subset_nonunits hI) nonunits.isClosed\nState 1: \u22a2 \nTactic: simpa only [I.closure.eq_top_iff_one, Ne] using mt (@h 1) one_notMem_nonunits /-- The `Ideal.closure` of a maximal ideal in a normed ring with summable geometric series is the ideal itself. -/\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.Analysis.Normed.Ring.Units).[/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.Analysis.Normed.Ring.Units.closure_ne_top`:\nState 0: \u22a2 theorem closure_ne_top (I : Ideal R) (hI : I \u2260 \u22a4) : I.closure \u2260 \u22a4\nTactic: have h := closure_minimal (coe_subset_nonunits hI) nonunits.isClosed\nState 1: \u22a2 \nTactic: simpa only [I.closure.eq_top_iff_one, Ne] using mt (@h 1) one_notMem_nonunits /-- The `Ideal.closure` of a maximal ideal in a normed ring with summable geometric series is the ideal itself. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Normed/Ring/Units.lean", "module": "Mathlib.Analysis.Normed.Ring.Units", "declaration": "Mathlib.Analysis.Normed.Ring.Units.closure_ne_top", "span": "L223-L228", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Ring/Units.lean#L223"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 319, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1063, "lean_code_chars": 0, "natural_language_chars": 1063, "lean_code_ratio": 0.0, "line_count": 11, "imports_count": 0, "declarations_count": 124, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "9c7ccbf9e416d09a", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.GroupTheory.Complement.IsComplement'", "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.GroupTheory.Complement)."}, {"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.GroupTheory.Complement.IsComplement'`:\nState 0: \u22a2 theorem IsComplement'.isCompl (h : IsComplement' H K) : IsCompl H K\nTactic: refine \u27e8disjoint_iff_inf_le.mpr fun g \u27e8p, q\u27e9 => let x : H \u00d7 K := \u27e8\u27e8g, p\u27e9, 1\u27e9 let y : H \u00d7 K := \u27e81, g, q\u27e9 Subtype.ext_iff.mp (Prod.ext_iff.mp (show x = y from h.1 ((mul_one g).trans (one_mul g).symm))).1, codisjoint_iff_le_sup.mpr fun g _ => ?_\u27e9\nState 1: \u22a2 \nTactic: obtain \u27e8\u27e8h, k\u27e9, rfl\u27e9 := h.2 g\nState 2: \u22a2 \nTactic: exact Subgroup.mul_mem_sup h.2 k.2\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.GroupTheory.Complement).[/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.GroupTheory.Complement.IsComplement'`:\nState 0: \u22a2 theorem IsComplement'.isCompl (h : IsComplement' H K) : IsCompl H K\nTactic: refine \u27e8disjoint_iff_inf_le.mpr fun g \u27e8p, q\u27e9 => let x : H \u00d7 K := \u27e8\u27e8g, p\u27e9, 1\u27e9 let y : H \u00d7 K := \u27e81, g, q\u27e9 Subtype.ext_iff.mp (Prod.ext_iff.mp (show x = y from h.1 ((mul_one g).trans (one_mul g).symm))).1, codisjoint_iff_le_sup.mpr fun g _ => ?_\u27e9\nState 1: \u22a2 \nTactic: obtain \u27e8\u27e8h, k\u27e9, rfl\u27e9 := h.2 g\nState 2: \u22a2 \nTactic: exact Subgroup.mul_mem_sup h.2 k.2\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/GroupTheory/Complement.lean", "module": "Mathlib.GroupTheory.Complement", "declaration": "Mathlib.GroupTheory.Complement.IsComplement'", "span": "L617-L627", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Complement.lean#L617"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 399, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1107, "lean_code_chars": 0, "natural_language_chars": 1107, "lean_code_ratio": 0.0, "line_count": 13, "imports_count": 0, "declarations_count": 144, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "206a798714ad56c8", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.MvPolynomial.MonomialOrder.degree_sub_leadingTerm_lt_degree", "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.RingTheory.MvPolynomial.MonomialOrder)."}, {"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.RingTheory.MvPolynomial.MonomialOrder.degree_sub_leadingTerm_lt_degree`:\nState 0: \u22a2 theorem degree_sub_leadingTerm_lt_degree {f : MvPolynomial \u03c3 R} (h : m.degree f \u2260 0) :\n m.degree (f - m.leadingTerm f) \u227a[m] m.degree f\nTactic: simp only [EmbeddingLike.apply_eq_iff_eq] at h'\nState 1: \u22a2 \nTactic: apply m.degree_mem_support at hl\nState 2: \u22a2 \nTactic: rw [h', mem_support_iff] at hl\nState 3: \u22a2 \nTactic: simp [leadingTerm, leadingCoeff] at hl\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.RingTheory.MvPolynomial.MonomialOrder).[/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.RingTheory.MvPolynomial.MonomialOrder.degree_sub_leadingTerm_lt_degree`:\nState 0: \u22a2 theorem degree_sub_leadingTerm_lt_degree {f : MvPolynomial \u03c3 R} (h : m.degree f \u2260 0) :\n m.degree (f - m.leadingTerm f) \u227a[m] m.degree f\nTactic: simp only [EmbeddingLike.apply_eq_iff_eq] at h'\nState 1: \u22a2 \nTactic: apply m.degree_mem_support at hl\nState 2: \u22a2 \nTactic: rw [h', mem_support_iff] at hl\nState 3: \u22a2 \nTactic: simp [leadingTerm, leadingCoeff] at hl\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/MvPolynomial/MonomialOrder.lean", "module": "Mathlib.RingTheory.MvPolynomial.MonomialOrder", "declaration": "Mathlib.RingTheory.MvPolynomial.MonomialOrder.degree_sub_leadingTerm_lt_degree", "span": "L912-L923", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPolynomial/MonomialOrder.lean#L912"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 362, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1169, "lean_code_chars": 0, "natural_language_chars": 1169, "lean_code_ratio": 0.0, "line_count": 16, "imports_count": 0, "declarations_count": 134, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "a8921f3f11d95083", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody.convexBodySum_volume_eq_zero_of_le_zero", "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.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody)."}, {"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.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody.convexBodySum_volume_eq_zero_of_le_zero`:\nState 0: \u22a2 theorem convexBodySum_volume_eq_zero_of_le_zero {B} (hB : B \u2264 0) :\n volume (convexBodySum K B) = 0\nTactic: obtain hB | hB := lt_or_eq_of_le hB \u00b7 suffices convexBodySum K B = \u2205 by rw [this, measure_empty]\nState 1: \u22a2 \nTactic: ext x\nState 2: \u22a2 \nTactic: refine \u27e8fun hx => ?_, fun h => h.elim\u27e9\nState 3: \u22a2 ?_, fun h => h.elim\u27e9>\nTactic: rw [Set.mem_setOf] at hx\nState 4: \u22a2 \nTactic: linarith [convexBodySumFun_nonneg x] \u00b7 suffices convexBodySum K B = { 0 } by rw [this, measure_singleton]\nState 5: \u22a2 \nTactic: ext\nState 6: \u22a2 \nTactic: rw [convexBodySum, Set.mem_setOf_eq, Set.mem_singleton_iff, hB, \u2190 convexBodySumFun_eq_zero_iff]\nState 7: \u22a2 \nTactic: exact (convexBodySumFun_nonneg _).ge_iff_eq'\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.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody).[/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.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody.convexBodySum_volume_eq_zero_of_le_zero`:\nState 0: \u22a2 theorem convexBodySum_volume_eq_zero_of_le_zero {B} (hB : B \u2264 0) :\n volume (convexBodySum K B) = 0\nTactic: obtain hB | hB := lt_or_eq_of_le hB \u00b7 suffices convexBodySum K B = \u2205 by rw [this, measure_empty]\nState 1: \u22a2 \nTactic: ext x\nState 2: \u22a2 \nTactic: refine \u27e8fun hx => ?_, fun h => h.elim\u27e9\nState 3: \u22a2 ?_, fun h => h.elim\u27e9>\nTactic: rw [Set.mem_setOf] at hx\nState 4: \u22a2 \nTactic: linarith [convexBodySumFun_nonneg x] \u00b7 suffices convexBodySum K B = { 0 } by rw [this, measure_singleton]\nState 5: \u22a2 \nTactic: ext\nState 6: \u22a2 \nTactic: rw [convexBodySum, Set.mem_setOf_eq, Set.mem_singleton_iff, hB, \u2190 convexBodySumFun_eq_zero_iff]\nState 7: \u22a2 \nTactic: exact (convexBodySumFun_nonneg _).ge_iff_eq'\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean", "module": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody", "declaration": "Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody.convexBodySum_volume_eq_zero_of_le_zero", "span": "L317-L329", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean#L317"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 576, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1702, "lean_code_chars": 0, "natural_language_chars": 1702, "lean_code_ratio": 0.0, "line_count": 24, "imports_count": 0, "declarations_count": 187, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "short", "duplicate_fingerprint": "93bfcc350ef1bb24", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.Analysis.Convex.Side.wOppSide_of_left_mem", "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.Analysis.Convex.Side)."}, {"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.Analysis.Convex.Side.wOppSide_of_left_mem`:\nState 0: \u22a2 theorem wOppSide_of_left_mem {s : AffineSubspace R P} {x : P} (y : P) (hx : x \u2208 s) :\n s.WOppSide x y\nTactic: refine \u27e8x, hx, x, hx, ?_\u27e9\nState 1: \u22a2 \nTactic: rw [vsub_self]\nState 2: \u22a2 \nTactic: apply SameRay.zero_left\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.Analysis.Convex.Side).[/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.Analysis.Convex.Side.wOppSide_of_left_mem`:\nState 0: \u22a2 theorem wOppSide_of_left_mem {s : AffineSubspace R P} {x : P} (y : P) (hx : x \u2208 s) :\n s.WOppSide x y\nTactic: refine \u27e8x, hx, x, hx, ?_\u27e9\nState 1: \u22a2 \nTactic: rw [vsub_self]\nState 2: \u22a2 \nTactic: apply SameRay.zero_left\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/Analysis/Convex/Side.lean", "module": "Mathlib.Analysis.Convex.Side", "declaration": "Mathlib.Analysis.Convex.Side.wOppSide_of_left_mem", "span": "L223-L228", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Side.lean#L223"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 297, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 900, "lean_code_chars": 0, "natural_language_chars": 900, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 116, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "ce202015a9544826", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}} {"sample_id": "E-Mathlib.RingTheory.LaurentSeries.eq_coeff_of_valuation_sub_lt", "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.RingTheory.LaurentSeries)."}, {"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.RingTheory.LaurentSeries.eq_coeff_of_valuation_sub_lt`:\nState 0: \u22a2 theorem eq_coeff_of_valuation_sub_lt {d n : \u2124} {f g : K\u2e28X\u2e29}\n (H : Valued.v (g - f) \u2264 exp (-d)) : n < d \u2192 g.coeff n = f.coeff n\nTactic: apply eq_of_sub_eq_zero\nState 1: \u22a2 \nTactic: rw [\u2190 HahnSeries.coeff_sub]\nState 2: \u22a2 \nTactic: apply coeff_zero_of_lt_valuation K H hn /- Every Laurent series of valuation less than `(1 : \u2124\u1d50\u2070)` comes from a power series. -/\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.RingTheory.LaurentSeries).[/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.RingTheory.LaurentSeries.eq_coeff_of_valuation_sub_lt`:\nState 0: \u22a2 theorem eq_coeff_of_valuation_sub_lt {d n : \u2124} {f g : K\u2e28X\u2e29}\n (H : Valued.v (g - f) \u2264 exp (-d)) : n < d \u2192 g.coeff n = f.coeff n\nTactic: apply eq_of_sub_eq_zero\nState 1: \u22a2 \nTactic: rw [\u2190 HahnSeries.coeff_sub]\nState 2: \u22a2 \nTactic: apply coeff_zero_of_lt_valuation K H hn /- Every Laurent series of valuation less than `(1 : \u2124\u1d50\u2070)` comes from a power series. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "source": {"mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "file": "Mathlib/RingTheory/LaurentSeries.lean", "module": "Mathlib.RingTheory.LaurentSeries", "declaration": "Mathlib.RingTheory.LaurentSeries.eq_coeff_of_valuation_sub_lt", "span": "L604-L613", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/LaurentSeries.lean#L604"}, "environment": {"project_commit": "05e9d49ed350cd358ce0314cb0c563850b8fd8c7", "dataseek_commit": "4fbe94ef64ee1f07f80a1bd8c52e0889f4e4e33a", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "lean_toolchain": "leanprover/lean4:v4.29.1", "leandojo_version": "1.0.9", "python_version": "3.11.15", "tokenizer_id": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "chat_template_id": "mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])"}, "measurements": {"input_tokens": 337, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "approximate_tokens": false, "chars": 1070, "lean_code_chars": 0, "natural_language_chars": 1070, "lean_code_ratio": 0.0, "line_count": 14, "imports_count": 0, "declarations_count": 127, "diagnostics_count": 0, "retrieval_snippets_count": 0, "tool_transcript_turns": 0, "length_bucket": "tiny", "duplicate_fingerprint": "2c195098ca61a578", "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", "soft_review_flags": [], "soft_review_applied_to_decision": false}}